blob: 6ad77af08e20a0b904384e3b3b74015a5c7e668f (
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
|
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.controller.persistence;
import com.yahoo.cloud.config.ConfigserverConfig;
import com.yahoo.component.annotation.Inject;
import com.yahoo.config.provision.SystemName;
import com.yahoo.vespa.curator.mock.MockCurator;
import java.time.Duration;
/**
* A curator db backed by a mock curator.
*
* @author bratseth
*/
@SuppressWarnings("unused") // injected
public class MockCuratorDb extends CuratorDb {
private final MockCurator curator;
@Inject
public MockCuratorDb(ConfigserverConfig config) {
this("test-controller:2222");
}
public MockCuratorDb(SystemName system) {
this("test-controller:2222");
}
public MockCuratorDb(String zooKeeperEnsembleConnectionSpec) {
this(new MockCurator() { @Override public String zooKeeperEnsembleConnectionSpec() { return zooKeeperEnsembleConnectionSpec; } });
}
public MockCuratorDb(MockCurator curator) {
super(curator, Duration.ofMillis(100));
this.curator = curator;
}
public MockCurator curator() { return curator; }
}
|