blob: 40cc679b69be3177e084bb10cce04f43759bb9a8 (
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
|
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.service.monitor;
import com.yahoo.cloud.config.ConfigserverConfig;
import com.yahoo.config.model.api.ApplicationInfo;
import com.yahoo.config.provision.HostName;
import com.yahoo.vespa.service.duper.ConfigServerApplication;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
* @author hakon
*/
public class ConfigserverUtil {
/** Create a ConfigserverConfig with the given settings. */
public static ConfigserverConfig create(
boolean multitenant,
String configServerHostname1,
String configServerHostname2,
String configServerHostname3) {
return new ConfigserverConfig(
new ConfigserverConfig.Builder()
.multitenant(multitenant)
.zookeeperserver(new ConfigserverConfig.Zookeeperserver.Builder().hostname(configServerHostname1).port(1))
.zookeeperserver(new ConfigserverConfig.Zookeeperserver.Builder().hostname(configServerHostname2).port(2))
.zookeeperserver(new ConfigserverConfig.Zookeeperserver.Builder().hostname(configServerHostname3).port(3)));
}
public static ConfigserverConfig createExampleConfigserverConfig() {
return create(true, "cfg1", "cfg2", "cfg3");
}
public static ApplicationInfo makeConfigServerApplicationInfo(
String configServerHostname1,
String configServerHostname2,
String configServerHostname3) {
return new ConfigServerApplication().makeApplicationInfo(
Stream.of(configServerHostname1, configServerHostname2, configServerHostname3)
.map(HostName::from).collect(Collectors.toList()));
}
public static ApplicationInfo makeExampleConfigServer() {
return makeConfigServerApplicationInfo("cfg1", "cfg2", "cfg3");
}
}
|