summaryrefslogtreecommitdiffstats
path: root/zookeeper-server
diff options
context:
space:
mode:
authorHarald Musum <musum@verizonmedia.com>2020-05-19 18:01:46 +0200
committerGitHub <noreply@github.com>2020-05-19 18:01:46 +0200
commit4feab1c12f23bc75997242a14677fa06120c273f (patch)
treee96189abb54ac3cda804c23bcc16cc91f808c7ad /zookeeper-server
parent43f7f6c37f975cddef58887a633ba5fdd5fc543b (diff)
Revert "Build vespa zookeeper server variants with zookeeper 3.5.6 and 3.5.8"
Diffstat (limited to 'zookeeper-server')
-rw-r--r--zookeeper-server/CMakeLists.txt3
-rw-r--r--zookeeper-server/pom.xml3
-rw-r--r--zookeeper-server/zookeeper-server-3.5.6/CMakeLists.txt3
-rw-r--r--zookeeper-server/zookeeper-server-3.5.6/src/main/java/com/yahoo/vespa/zookeeper/VespaZooKeeperServerImpl.java56
-rw-r--r--zookeeper-server/zookeeper-server-3.5.8/CMakeLists.txt4
-rw-r--r--zookeeper-server/zookeeper-server-3.5.8/pom.xml78
-rw-r--r--zookeeper-server/zookeeper-server-3.5.8/src/main/java/com/yahoo/vespa/zookeeper/VespaZooKeeperServerImpl.java57
-rw-r--r--zookeeper-server/zookeeper-server-3.5/CMakeLists.txt3
-rw-r--r--zookeeper-server/zookeeper-server-3.5/pom.xml (renamed from zookeeper-server/zookeeper-server-3.5.6/pom.xml)2
-rw-r--r--zookeeper-server/zookeeper-server-3.5/src/main/java/com/yahoo/vespa/zookeeper/VespaZooKeeperServerImpl.java (renamed from zookeeper-server/zookeeper-server-common/src/main/java/com/yahoo/vespa/zookeeper/Configurator.java)68
-rw-r--r--zookeeper-server/zookeeper-server-3.5/src/test/java/com/yahoo/vespa/zookeeper/VespaZooKeeperServerImplTest.java (renamed from zookeeper-server/zookeeper-server-common/src/test/java/com/yahoo/vespa/zookeeper/ConfiguratorTest.java)32
-rw-r--r--zookeeper-server/zookeeper-server-common/pom.xml7
12 files changed, 81 insertions, 235 deletions
diff --git a/zookeeper-server/CMakeLists.txt b/zookeeper-server/CMakeLists.txt
index b146390046c..6e8c82bc66e 100644
--- a/zookeeper-server/CMakeLists.txt
+++ b/zookeeper-server/CMakeLists.txt
@@ -1,4 +1,3 @@
# Copyright 2019 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
add_subdirectory(zookeeper-server-common)
-add_subdirectory(zookeeper-server-3.5.6)
-add_subdirectory(zookeeper-server-3.5.8)
+add_subdirectory(zookeeper-server-3.5)
diff --git a/zookeeper-server/pom.xml b/zookeeper-server/pom.xml
index 28f18000c2d..edfbdbad02e 100644
--- a/zookeeper-server/pom.xml
+++ b/zookeeper-server/pom.xml
@@ -13,8 +13,7 @@
<version>7-SNAPSHOT</version>
<modules>
<module>zookeeper-server-common</module>
- <module>zookeeper-server-3.5.6</module>
- <module>zookeeper-server-3.5.8</module>
+ <module>zookeeper-server-3.5</module>
</modules>
<dependencies>
<dependency>
diff --git a/zookeeper-server/zookeeper-server-3.5.6/CMakeLists.txt b/zookeeper-server/zookeeper-server-3.5.6/CMakeLists.txt
deleted file mode 100644
index b68994d32e0..00000000000
--- a/zookeeper-server/zookeeper-server-3.5.6/CMakeLists.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-# Copyright 2019 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-install_fat_java_artifact(zookeeper-server-3.5.6)
-install_symlink(lib/jars/zookeeper-server-3.5.6-jar-with-dependencies.jar lib/jars/zookeeper-server-jar-with-dependencies.jar)
diff --git a/zookeeper-server/zookeeper-server-3.5.6/src/main/java/com/yahoo/vespa/zookeeper/VespaZooKeeperServerImpl.java b/zookeeper-server/zookeeper-server-3.5.6/src/main/java/com/yahoo/vespa/zookeeper/VespaZooKeeperServerImpl.java
deleted file mode 100644
index ee3695b02f8..00000000000
--- a/zookeeper-server/zookeeper-server-3.5.6/src/main/java/com/yahoo/vespa/zookeeper/VespaZooKeeperServerImpl.java
+++ /dev/null
@@ -1,56 +0,0 @@
-// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-package com.yahoo.vespa.zookeeper;
-
-import com.google.inject.Inject;
-import com.yahoo.cloud.config.ZookeeperServerConfig;
-import com.yahoo.component.AbstractComponent;
-import com.yahoo.security.tls.TransportSecurityUtils;
-
-import java.util.logging.Level;
-
-import static com.yahoo.vespa.defaults.Defaults.getDefaults;
-import static com.yahoo.vespa.zookeeper.Configurator.zookeeperServerHostnames;
-
-/**
- * Writes zookeeper config and starts zookeeper server.
- *
- * @author Ulf Lilleengen
- * @author Harald Musum
- */
-public class VespaZooKeeperServerImpl extends AbstractComponent implements Runnable, VespaZooKeeperServer {
- private static final java.util.logging.Logger log = java.util.logging.Logger.getLogger(VespaZooKeeperServerImpl.class.getName());
- private final Thread zkServerThread;
- private final ZookeeperServerConfig zookeeperServerConfig;
-
- @Inject
- public VespaZooKeeperServerImpl(ZookeeperServerConfig zookeeperServerConfig) {
- this.zookeeperServerConfig = zookeeperServerConfig;
- new Configurator(zookeeperServerConfig).writeConfigToDisk(TransportSecurityUtils.getOptions());
- zkServerThread = new Thread(this, "zookeeper server");
- zkServerThread.start();
- }
-
- private void shutdown() {
- zkServerThread.interrupt();
- try {
- zkServerThread.join();
- } catch (InterruptedException e) {
- log.log(Level.WARNING, "Error joining server thread on shutdown", e);
- }
- }
-
- @Override
- public void run() {
- String[] args = new String[]{getDefaults().underVespaHome(zookeeperServerConfig.zooKeeperConfigFile())};
- log.log(Level.INFO, "Starting ZooKeeper server with config file " + args[0] +
- ". Trying to establish ZooKeeper quorum (members: " + zookeeperServerHostnames(zookeeperServerConfig) + ")");
- org.apache.zookeeper.server.quorum.QuorumPeerMain.main(args);
- }
-
- @Override
- public void deconstruct() {
- shutdown();
- super.deconstruct();
- }
-
-}
diff --git a/zookeeper-server/zookeeper-server-3.5.8/CMakeLists.txt b/zookeeper-server/zookeeper-server-3.5.8/CMakeLists.txt
deleted file mode 100644
index 66765e34997..00000000000
--- a/zookeeper-server/zookeeper-server-3.5.8/CMakeLists.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-# Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-install_fat_java_artifact(zookeeper-server-3.5.8)
-# TODO: Needs to be included when this is the wanted default version (and other symlinks need to be removed)
-#install_symlink(lib/jars/zookeeper-server-3.5.8-jar-with-dependencies.jar lib/jars/zookeeper-server-jar-with-dependencies.jar)
diff --git a/zookeeper-server/zookeeper-server-3.5.8/pom.xml b/zookeeper-server/zookeeper-server-3.5.8/pom.xml
deleted file mode 100644
index e4000285ffa..00000000000
--- a/zookeeper-server/zookeeper-server-3.5.8/pom.xml
+++ /dev/null
@@ -1,78 +0,0 @@
-<?xml version="1.0"?>
-<!-- Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>com.yahoo.vespa</groupId>
- <artifactId>zookeeper-server</artifactId>
- <version>7-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <artifactId>zookeeper-server-3.5.8</artifactId>
- <packaging>container-plugin</packaging>
- <version>7-SNAPSHOT</version>
- <dependencies>
- <dependency>
- <groupId>com.yahoo.vespa</groupId>
- <artifactId>zookeeper-server-common</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.zookeeper</groupId>
- <artifactId>zookeeper</artifactId>
- <version>3.5.8</version>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-jdk14</artifactId>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <version>1.7.5</version>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <configuration>
- <compilerArgs>
- <arg>-Xlint:all</arg>
- <arg>-Werror</arg>
- </compilerArgs>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <redirectTestOutputToFile>${test.hide}</redirectTestOutputToFile>
- <forkMode>once</forkMode>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-install-plugin</artifactId>
- <configuration>
- <updateReleaseInfo>true</updateReleaseInfo>
- </configuration>
- </plugin>
- <plugin>
- <groupId>com.yahoo.vespa</groupId>
- <artifactId>bundle-plugin</artifactId>
- <extensions>true</extensions>
- <configuration>
- <importPackage>com.sun.management</importPackage>
- <bundleSymbolicName>zookeeper-server</bundleSymbolicName>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
diff --git a/zookeeper-server/zookeeper-server-3.5.8/src/main/java/com/yahoo/vespa/zookeeper/VespaZooKeeperServerImpl.java b/zookeeper-server/zookeeper-server-3.5.8/src/main/java/com/yahoo/vespa/zookeeper/VespaZooKeeperServerImpl.java
deleted file mode 100644
index 15d5d2f6f31..00000000000
--- a/zookeeper-server/zookeeper-server-3.5.8/src/main/java/com/yahoo/vespa/zookeeper/VespaZooKeeperServerImpl.java
+++ /dev/null
@@ -1,57 +0,0 @@
-// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-package com.yahoo.vespa.zookeeper;
-
-import com.google.inject.Inject;
-import com.yahoo.cloud.config.ZookeeperServerConfig;
-import com.yahoo.component.AbstractComponent;
-import com.yahoo.security.tls.TransportSecurityUtils;
-
-import java.util.logging.Level;
-
-import static com.yahoo.vespa.defaults.Defaults.getDefaults;
-import static com.yahoo.vespa.zookeeper.Configurator.zookeeperServerHostnames;
-
-/**
- * Writes zookeeper config and starts zookeeper server.
- *
- * @author Ulf Lilleengen
- * @author Harald Musum
- */
-public class VespaZooKeeperServerImpl extends AbstractComponent implements Runnable, VespaZooKeeperServer {
-
- private static final java.util.logging.Logger log = java.util.logging.Logger.getLogger(VespaZooKeeperServerImpl.class.getName());
- private final Thread zkServerThread;
- private final ZookeeperServerConfig zookeeperServerConfig;
-
- @Inject
- public VespaZooKeeperServerImpl(ZookeeperServerConfig zookeeperServerConfig) {
- this.zookeeperServerConfig = zookeeperServerConfig;
- new Configurator(zookeeperServerConfig).writeConfigToDisk(TransportSecurityUtils.getOptions());
- zkServerThread = new Thread(this, "zookeeper server");
- zkServerThread.start();
- }
-
- private void shutdown() {
- zkServerThread.interrupt();
- try {
- zkServerThread.join();
- } catch (InterruptedException e) {
- log.log(Level.WARNING, "Error joining server thread on shutdown", e);
- }
- }
-
- @Override
- public void run() {
- String[] args = new String[]{getDefaults().underVespaHome(zookeeperServerConfig.zooKeeperConfigFile())};
- log.log(Level.INFO, "Starting ZooKeeper server with config file " + args[0] +
- ". Trying to establish ZooKeeper quorum (members: " + zookeeperServerHostnames(zookeeperServerConfig) + ")");
- org.apache.zookeeper.server.quorum.QuorumPeerMain.main(args);
- }
-
- @Override
- public void deconstruct() {
- shutdown();
- super.deconstruct();
- }
-
-}
diff --git a/zookeeper-server/zookeeper-server-3.5/CMakeLists.txt b/zookeeper-server/zookeeper-server-3.5/CMakeLists.txt
new file mode 100644
index 00000000000..782c5f07b83
--- /dev/null
+++ b/zookeeper-server/zookeeper-server-3.5/CMakeLists.txt
@@ -0,0 +1,3 @@
+# Copyright 2019 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+install_fat_java_artifact(zookeeper-server-3.5)
+install_symlink(lib/jars/zookeeper-server-3.5-jar-with-dependencies.jar lib/jars/zookeeper-server-jar-with-dependencies.jar)
diff --git a/zookeeper-server/zookeeper-server-3.5.6/pom.xml b/zookeeper-server/zookeeper-server-3.5/pom.xml
index e50324a0488..0bbb97bd38c 100644
--- a/zookeeper-server/zookeeper-server-3.5.6/pom.xml
+++ b/zookeeper-server/zookeeper-server-3.5/pom.xml
@@ -8,7 +8,7 @@
<version>7-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
- <artifactId>zookeeper-server-3.5.6</artifactId>
+ <artifactId>zookeeper-server-3.5</artifactId>
<packaging>container-plugin</packaging>
<version>7-SNAPSHOT</version>
<dependencies>
diff --git a/zookeeper-server/zookeeper-server-common/src/main/java/com/yahoo/vespa/zookeeper/Configurator.java b/zookeeper-server/zookeeper-server-3.5/src/main/java/com/yahoo/vespa/zookeeper/VespaZooKeeperServerImpl.java
index 119509dd9cc..1f66c919a41 100644
--- a/zookeeper-server/zookeeper-server-common/src/main/java/com/yahoo/vespa/zookeeper/Configurator.java
+++ b/zookeeper-server/zookeeper-server-3.5/src/main/java/com/yahoo/vespa/zookeeper/VespaZooKeeperServerImpl.java
@@ -1,8 +1,10 @@
-// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-
+// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.zookeeper;
+import com.google.inject.Inject;
import com.yahoo.cloud.config.ZookeeperServerConfig;
+import com.yahoo.component.AbstractComponent;
+import java.util.logging.Level;
import com.yahoo.security.KeyStoreBuilder;
import com.yahoo.security.KeyStoreType;
import com.yahoo.security.KeyStoreUtils;
@@ -11,6 +13,7 @@ import com.yahoo.security.SslContextBuilder;
import com.yahoo.security.X509CertificateUtils;
import com.yahoo.security.tls.TlsContext;
import com.yahoo.security.tls.TransportSecurityOptions;
+import com.yahoo.security.tls.TransportSecurityUtils;
import com.yahoo.text.Utf8;
import javax.net.ssl.SSLContext;
@@ -30,34 +33,54 @@ import java.util.stream.Collectors;
import static com.yahoo.vespa.defaults.Defaults.getDefaults;
-public class Configurator {
+/**
+ * Writes zookeeper config and starts zookeeper server.
+ *
+ * @author Ulf Lilleengen
+ * @author Harald Musum
+ */
+public class VespaZooKeeperServerImpl extends AbstractComponent implements Runnable, VespaZooKeeperServer {
+
+ private static final java.util.logging.Logger log = java.util.logging.Logger.getLogger(VespaZooKeeperServerImpl.class.getName());
private static final String ZOOKEEPER_JMX_LOG4J_DISABLE = "zookeeper.jmx.log4j.disable";
static final String ZOOKEEPER_JUTE_MAX_BUFFER = "jute.maxbuffer";
-
+ private final Thread zkServerThread;
private final ZookeeperServerConfig zookeeperServerConfig;
private final String configFilePath;
private final String jksKeyStoreFilePath;
- public Configurator(ZookeeperServerConfig zookeeperServerConfig) {
+ VespaZooKeeperServerImpl(ZookeeperServerConfig zookeeperServerConfig, boolean startServer,
+ Optional<TransportSecurityOptions> transportSecurityOptions) {
this.zookeeperServerConfig = zookeeperServerConfig;
- this.configFilePath = zookeeperServerConfig.zooKeeperConfigFile();
- this.jksKeyStoreFilePath = zookeeperServerConfig.jksKeyStoreFile();
- System.setProperty(ZOOKEEPER_JMX_LOG4J_DISABLE, "true");
+ System.setProperty("zookeeper.jmx.log4j.disable", "true");
System.setProperty("zookeeper.snapshot.trust.empty", Boolean.valueOf(zookeeperServerConfig.trustEmptySnapshot()).toString());
System.setProperty(ZOOKEEPER_JUTE_MAX_BUFFER, Integer.valueOf(zookeeperServerConfig.juteMaxBuffer()).toString());
+
+ configFilePath = getDefaults().underVespaHome(zookeeperServerConfig.zooKeeperConfigFile());
+ jksKeyStoreFilePath = getDefaults().underVespaHome(zookeeperServerConfig.jksKeyStoreFile());
+ writeConfigToDisk(zookeeperServerConfig, transportSecurityOptions);
+ zkServerThread = new Thread(this, "zookeeper server");
+ if (startServer) {
+ zkServerThread.start();
+ }
+ }
+
+ @Inject
+ public VespaZooKeeperServerImpl(ZookeeperServerConfig zookeeperServerConfig) {
+ this(zookeeperServerConfig, true, TransportSecurityUtils.getOptions());
}
- void writeConfigToDisk(Optional<TransportSecurityOptions> transportSecurityOptions) {
+ private void writeConfigToDisk(ZookeeperServerConfig config, Optional<TransportSecurityOptions> transportSecurityOptions) {
new File(configFilePath).getParentFile().mkdirs();
try {
writeZooKeeperConfigFile(zookeeperServerConfig, transportSecurityOptions);
- writeMyIdFile(zookeeperServerConfig);
+ writeMyIdFile(config);
transportSecurityOptions.ifPresent(this::writeJksKeystore);
} catch (IOException e) {
throw new RuntimeException("Error writing zookeeper config", e);
}
- }
+ }
private void writeZooKeeperConfigFile(ZookeeperServerConfig config,
Optional<TransportSecurityOptions> transportSecurityOptions) throws IOException {
@@ -138,10 +161,31 @@ public class Configurator {
sb.append("server.").append(server.id()).append("=").append(server.hostname()).append(":").append(server.quorumPort()).append(":").append(server.electionPort()).append("\n");
}
+ private void shutdown() {
+ zkServerThread.interrupt();
+ try {
+ zkServerThread.join();
+ } catch (InterruptedException e) {
+ log.log(Level.WARNING, "Error joining server thread on shutdown", e);
+ }
+ }
+ @Override
+ public void run() {
+ System.setProperty(ZOOKEEPER_JMX_LOG4J_DISABLE, "true");
+ String[] args = new String[]{getDefaults().underVespaHome(zookeeperServerConfig.zooKeeperConfigFile())};
+ log.log(Level.INFO, "Starting ZooKeeper server with config file " + args[0] +
+ ". Trying to establish ZooKeeper quorum (members: " + zookeeperServerHostnames(zookeeperServerConfig) + ")");
+ org.apache.zookeeper.server.quorum.QuorumPeerMain.main(args);
+ }
+ @Override
+ public void deconstruct() {
+ shutdown();
+ super.deconstruct();
+ }
- static Set<String> zookeeperServerHostnames(ZookeeperServerConfig zookeeperServerConfig) {
+ private static Set<String> zookeeperServerHostnames(ZookeeperServerConfig zookeeperServerConfig) {
return zookeeperServerConfig.server().stream().map(ZookeeperServerConfig.Server::hostname).collect(Collectors.toSet());
}
diff --git a/zookeeper-server/zookeeper-server-common/src/test/java/com/yahoo/vespa/zookeeper/ConfiguratorTest.java b/zookeeper-server/zookeeper-server-3.5/src/test/java/com/yahoo/vespa/zookeeper/VespaZooKeeperServerImplTest.java
index 74e21339022..72351244cce 100644
--- a/zookeeper-server/zookeeper-server-common/src/test/java/com/yahoo/vespa/zookeeper/ConfiguratorTest.java
+++ b/zookeeper-server/zookeeper-server-3.5/src/test/java/com/yahoo/vespa/zookeeper/VespaZooKeeperServerImplTest.java
@@ -26,7 +26,6 @@ import static com.yahoo.cloud.config.ZookeeperServerConfig.TlsForQuorumCommunica
import static com.yahoo.cloud.config.ZookeeperServerConfig.TlsForClientServerCommunication;
import static com.yahoo.security.KeyAlgorithm.EC;
import static com.yahoo.security.SignatureAlgorithm.SHA256_WITH_ECDSA;
-import static com.yahoo.vespa.zookeeper.Configurator.ZOOKEEPER_JUTE_MAX_BUFFER;
import static java.time.Instant.EPOCH;
import static java.time.temporal.ChronoUnit.DAYS;
import static org.hamcrest.CoreMatchers.is;
@@ -37,7 +36,7 @@ import static org.junit.Assert.assertTrue;
/**
* Tests the zookeeper server.
*/
-public class ConfiguratorTest {
+public class VespaZooKeeperServerImplTest {
private File cfgFile;
private File idFile;
@@ -56,7 +55,7 @@ public class ConfiguratorTest {
@Test
public void config_is_written_correctly_when_one_server() throws IOException {
ZookeeperServerConfig.Builder builder = createConfigBuilderForSingleHost(cfgFile, idFile, jksKeyStoreFile);
- new Configurator(builder.build()).writeConfigToDisk(Optional.empty());
+ createServer(builder);
validateConfigFileSingleHost(cfgFile);
validateIdFile(idFile, "");
}
@@ -70,7 +69,7 @@ public class ConfiguratorTest {
builder.server(newServer(2, "baz", 345, 543));
builder.myidFile(idFile.getAbsolutePath());
builder.myid(1);
- new Configurator(builder.build()).writeConfigToDisk(Optional.empty());
+ createServer(builder);
validateConfigFileMultipleHosts(cfgFile);
validateIdFile(idFile, "1\n");
}
@@ -81,7 +80,7 @@ public class ConfiguratorTest {
builder.tlsForQuorumCommunication(TlsForQuorumCommunication.PORT_UNIFICATION);
builder.tlsForClientServerCommunication(TlsForClientServerCommunication.Enum.PORT_UNIFICATION);
Optional<TransportSecurityOptions> transportSecurityOptions = createTransportSecurityOptions();
- new Configurator(builder.build()).writeConfigToDisk(transportSecurityOptions);
+ createServer(builder, transportSecurityOptions);
validateConfigFilePortUnification(cfgFile, jksKeyStoreFile, transportSecurityOptions.get().getCaCertificatesFile().get().toFile());
validateThatJksKeyStoreFileExists(jksKeyStoreFile);
}
@@ -92,7 +91,7 @@ public class ConfiguratorTest {
builder.tlsForQuorumCommunication(TlsForQuorumCommunication.TLS_WITH_PORT_UNIFICATION);
builder.tlsForClientServerCommunication(TlsForClientServerCommunication.Enum.TLS_WITH_PORT_UNIFICATION);
Optional<TransportSecurityOptions> transportSecurityOptions = createTransportSecurityOptions();
- new Configurator(builder.build()).writeConfigToDisk(transportSecurityOptions);
+ createServer(builder, transportSecurityOptions);
validateConfigFileTlsWithPortUnification(cfgFile, jksKeyStoreFile, transportSecurityOptions.get().getCaCertificatesFile().get().toFile());
validateThatJksKeyStoreFileExists(jksKeyStoreFile);
}
@@ -103,7 +102,7 @@ public class ConfiguratorTest {
builder.tlsForQuorumCommunication(TlsForQuorumCommunication.TLS_ONLY);
builder.tlsForClientServerCommunication(TlsForClientServerCommunication.Enum.TLS_ONLY);
Optional<TransportSecurityOptions> transportSecurityOptions = createTransportSecurityOptions();
- new Configurator(builder.build()).writeConfigToDisk(transportSecurityOptions);
+ createServer(builder, transportSecurityOptions);
validateConfigFileTlsOnly(cfgFile, jksKeyStoreFile, transportSecurityOptions.get().getCaCertificatesFile().get().toFile());
validateThatJksKeyStoreFileExists(jksKeyStoreFile);
}
@@ -118,14 +117,21 @@ public class ConfiguratorTest {
return builder;
}
+ private void createServer(ZookeeperServerConfig.Builder builder) {
+ createServer(builder, Optional.empty());
+ }
+
+ private void createServer(ZookeeperServerConfig.Builder builder, Optional<TransportSecurityOptions> options) {
+ new VespaZooKeeperServerImpl(new ZookeeperServerConfig(builder), false, options);
+ }
+
@Test(expected = RuntimeException.class)
public void require_that_this_id_must_be_present_amongst_servers() {
ZookeeperServerConfig.Builder builder = new ZookeeperServerConfig.Builder();
- builder.zooKeeperConfigFile(cfgFile.getAbsolutePath());
builder.server(newServer(1, "bar", 234, 432));
builder.server(newServer(2, "baz", 345, 543));
builder.myid(0);
- new Configurator(builder.build()).writeConfigToDisk(Optional.empty());
+ createServer(builder);
}
@Test
@@ -139,13 +145,13 @@ public class ConfiguratorTest {
builder.zooKeeperConfigFile(cfgFile.getAbsolutePath());
builder.myidFile(idFile.getAbsolutePath());
- new Configurator(builder.build()).writeConfigToDisk(Optional.empty());
- assertThat(System.getProperty(ZOOKEEPER_JUTE_MAX_BUFFER), is("" + new ZookeeperServerConfig(builder).juteMaxBuffer()));
+ createServer(builder);
+ assertThat(System.getProperty(VespaZooKeeperServerImpl.ZOOKEEPER_JUTE_MAX_BUFFER), is("" + new ZookeeperServerConfig(builder).juteMaxBuffer()));
final int max_buffer = 1;
builder.juteMaxBuffer(max_buffer);
- new Configurator(builder.build()).writeConfigToDisk(Optional.empty());
- assertThat(System.getProperty(ZOOKEEPER_JUTE_MAX_BUFFER), is("" + max_buffer));
+ createServer(builder);
+ assertThat(System.getProperty(VespaZooKeeperServerImpl.ZOOKEEPER_JUTE_MAX_BUFFER), is("" + max_buffer));
}
private ZookeeperServerConfig.Server.Builder newServer(int id, String hostName, int electionPort, int quorumPort) {
diff --git a/zookeeper-server/zookeeper-server-common/pom.xml b/zookeeper-server/zookeeper-server-common/pom.xml
index b05136cd151..66e5bc2075c 100644
--- a/zookeeper-server/zookeeper-server-common/pom.xml
+++ b/zookeeper-server/zookeeper-server-common/pom.xml
@@ -11,13 +11,6 @@
<artifactId>zookeeper-server-common</artifactId>
<packaging>container-plugin</packaging>
<version>7-SNAPSHOT</version>
- <dependencies>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
<build>
<plugins>
<plugin>