aboutsummaryrefslogtreecommitdiffstats
path: root/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/task/util/file/TestTaskContext.java
blob: d023a11671eee857ee768c5aa002a7b6ec3b29d1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

package com.yahoo.vespa.hosted.node.admin.task.util.file;

import com.yahoo.vespa.hosted.node.admin.component.TaskContext;
import com.yahoo.vespa.test.file.TestFileSystem;

import java.nio.file.FileSystem;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.List;
import java.util.logging.Logger;

public class TestTaskContext implements TaskContext {
    private final FileSystem fileSystem = TestFileSystem.create();
    private final List<String> logs = new ArrayList<>();

    @Override
    public Cloud cloud() {
        return Cloud.YAHOO;
    }

    @Override
    public EnumSet<Role> roles() {
        return EnumSet.of(Role.CONFIG_SERVER_DOCKER_HOST);
    }

    @Override
    public FileSystem fileSystem() {
        return fileSystem;
    }

    @Override
    public void logSystemModification(Logger logger, String actionDescription) {
        logs.add(actionDescription);
    }

    public List<String> getSystemModificationLog() {
        return logs;
    }

    public void clearSystemModificationLog() {
        logs.clear();
    }
}