summaryrefslogtreecommitdiffstats
path: root/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/stubs/MockTesterCloud.java
blob: ff3f168a9783a97faba308b7b6c91841024888f3 (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
46
47
48
package com.yahoo.vespa.hosted.controller.api.integration.stubs;

import com.yahoo.vespa.hosted.controller.api.integration.deployment.TesterCloud;

import java.net.URI;
import java.util.Arrays;

import static com.yahoo.vespa.hosted.controller.api.integration.deployment.TesterCloud.Status.NOT_STARTED;
import static com.yahoo.vespa.hosted.controller.api.integration.deployment.TesterCloud.Status.RUNNING;

public class MockTesterCloud implements TesterCloud {

    private byte[] logs = new byte[0];
    private Status status = NOT_STARTED;
    private byte[] config;
    private URI testerUrl;

    @Override
    public void startTests(URI testerUrl, Suite suite, byte[] config) {
        this.status = RUNNING;
        this.config = config;
        this.testerUrl = testerUrl;
    }

    @Override
    public byte[] getLogs(URI testerUrl) {
        return Arrays.copyOf(logs, logs.length);
    }

    @Override
    public Status getStatus(URI testerUrl) {
        return status;
    }

    public void set(byte[] logs, Status status) {
        this.logs = Arrays.copyOf(logs, logs.length);
        this.status = status;
    }

    public byte[] config() {
        return config;
    }

    public URI testerUrl() {
        return testerUrl;
    }

}