summaryrefslogtreecommitdiffstats
path: root/configserver/src/test/java/com/yahoo/vespa/config/server/MockConfigConvergenceChecker.java
blob: e63fdf9bf19f9b4b78309b42c18ae6c4b303b4e5 (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
package com.yahoo.vespa.config.server;

import com.yahoo.config.model.api.ServiceInfo;
import com.yahoo.vespa.config.server.application.Application;
import com.yahoo.vespa.config.server.application.ConfigConvergenceChecker;

import java.time.Duration;
import java.util.Map;

public class MockConfigConvergenceChecker extends ConfigConvergenceChecker {

    private final long wantedGeneration;

    public MockConfigConvergenceChecker(long wantedGeneration) {
        this.wantedGeneration = wantedGeneration;
    }

    @Override
    public Map<ServiceInfo, Long> getServiceConfigGenerations(Application application, Duration timeoutPerService) {
        return Map.of();
    }

    @Override
    public ServiceListResponse checkConvergenceForAllServices(Application application, Duration timeoutPerService) {
        return new ServiceListResponse(Map.of(), wantedGeneration, wantedGeneration);
    }

    @Override
    public ServiceResponse getServiceConfigGeneration(Application application, String hostAndPortToCheck, Duration timeout) {
        return new ServiceResponse(ServiceResponse.Status.ok, wantedGeneration);
    }

    @Override
    public ServiceListResponse checkConvergenceUnlessDeferringChangesUntilRestart(Application application, Duration timeoutPerService) {
        return new ServiceListResponse(Map.of(), wantedGeneration, wantedGeneration);
    }

}