summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Musum <musum@verizonmedia.com>2021-03-03 15:06:39 +0100
committerGitHub <noreply@github.com>2021-03-03 15:06:39 +0100
commitce88aa9ee99369ad23c44b70b8c7740f945ccd4a (patch)
tree65f67d99cfe8a583c25959f6d12ad7f640c5eabd
parente9478a84149e989d506a702955d824cc3aa985e0 (diff)
parent8c09ef2b7657ecc34a7dbb69e2daaad83bc688f0 (diff)
Merge pull request #16761 from vespa-engine/hmusum/simplify-2
Simplify and remove unused dependencies
-rw-r--r--zkfacade/pom.xml17
-rw-r--r--zkfacade/src/test/java/com/yahoo/vespa/curator/CuratorTest.java66
2 files changed, 7 insertions, 76 deletions
diff --git a/zkfacade/pom.xml b/zkfacade/pom.xml
index 70079e53c78..179856f053f 100644
--- a/zkfacade/pom.xml
+++ b/zkfacade/pom.xml
@@ -42,27 +42,10 @@
<scope>provided</scope>
</dependency>
<dependency>
- <groupId>com.yahoo.vespa</groupId>
- <artifactId>testutil</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
<groupId>org.apache.curator</groupId>
<artifactId>curator-recipes</artifactId>
</dependency>
<dependency>
- <groupId>org.apache.curator</groupId>
- <artifactId>curator-test</artifactId>
- <scope>test</scope>
- <exclusions>
- <exclusion>
- <groupId>com.google.guava</groupId>
- <artifactId>guava</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<scope>provided</scope>
diff --git a/zkfacade/src/test/java/com/yahoo/vespa/curator/CuratorTest.java b/zkfacade/src/test/java/com/yahoo/vespa/curator/CuratorTest.java
index 5341efaefe5..96619258ed3 100644
--- a/zkfacade/src/test/java/com/yahoo/vespa/curator/CuratorTest.java
+++ b/zkfacade/src/test/java/com/yahoo/vespa/curator/CuratorTest.java
@@ -1,55 +1,27 @@
-// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.curator;
import com.yahoo.cloud.config.CuratorConfig;
import com.yahoo.net.HostName;
-import org.apache.curator.test.TestingServer;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Test;
-import java.io.IOException;
import java.util.Optional;
import static org.junit.Assert.assertEquals;
/**
- * Sets up actual ZooKeeper servers and verifies we can talk to them.
+ * Very simple testing of setting up curator
*
* @author Ulf Lilleengen
*/
public class CuratorTest {
- private static String localhost = HostName.getLocalhost();
+ private static final String localhost = HostName.getLocalhost();
- private String spec1;
- private String spec2;
- private TestingServer test1;
- private TestingServer test2;
- private int port1;
- private int port2;
-
- @Before
- public void setupServers() throws Exception {
- port1 = allocatePort();
- port2 = allocatePort();
- test1 = new TestingServer(port1);
- test2 = new TestingServer(port2);
- spec1 = localhost + ":" + port1;
- spec2 = localhost + ":" + port2;
- }
-
- private int allocatePort() {
- return PortAllocator.findAvailablePort();
- }
-
- @After
- public void teardownServers() throws IOException {
- test1.stop();
- test1.close();
- test2.close();
- test2.stop();
- }
+ private static final int port1 = 1;
+ private static final int port2 = 2;
+ private static final String spec1 = localhost + ":" + port1;
+ private static final String spec2 = localhost + ":" + port2;
@Test
public void require_curator_is_created_from_config() {
@@ -90,28 +62,4 @@ public class CuratorTest {
Optional.empty());
}
- private static class PortAllocator {
-
- private static class PortRange {
- private int first = 18621;
- private int last = 18630; // see: factory/doc/port-ranges
- private int value = first;
-
- synchronized int next() {
- if (value > last) {
- throw new RuntimeException("no port ports in range");
- }
- return value++;
- }
- }
-
- private final static PortRange portRange = new PortRange();
-
- // Get the next port from a pre-allocated range
- static int findAvailablePort() {
- return portRange.next();
- }
-
- }
-
}