aboutsummaryrefslogtreecommitdiffstats
path: root/configserver/src/test/java/com/yahoo/vespa/config/server
diff options
context:
space:
mode:
authorHarald Musum <musum@verizonmedia.com>2021-07-09 12:28:36 +0200
committerHarald Musum <musum@verizonmedia.com>2021-07-09 12:28:36 +0200
commitb0e2920c62e9679b07600328ae711d6657e70ff9 (patch)
tree9619cf72fd8732e4d19820d274a89373c4e4aa6a /configserver/src/test/java/com/yahoo/vespa/config/server
parent9e4889d949f2b7b8163e22ed8b08a6804f728fd2 (diff)
Use Curator instead of ConfigCurator, part 3
Diffstat (limited to 'configserver/src/test/java/com/yahoo/vespa/config/server')
-rw-r--r--configserver/src/test/java/com/yahoo/vespa/config/server/ApplicationRepositoryTest.java1
-rw-r--r--configserver/src/test/java/com/yahoo/vespa/config/server/session/MockSessionZKClient.java8
-rw-r--r--configserver/src/test/java/com/yahoo/vespa/config/server/session/SessionPreparerTest.java2
-rw-r--r--configserver/src/test/java/com/yahoo/vespa/config/server/session/SessionRepositoryTest.java2
-rw-r--r--configserver/src/test/java/com/yahoo/vespa/config/server/session/SessionZooKeeperClientTest.java1
-rw-r--r--configserver/src/test/java/com/yahoo/vespa/config/server/zookeeper/ZKApplicationFileTest.java13
-rw-r--r--configserver/src/test/java/com/yahoo/vespa/config/server/zookeeper/ZKApplicationPackageTest.java12
7 files changed, 17 insertions, 22 deletions
diff --git a/configserver/src/test/java/com/yahoo/vespa/config/server/ApplicationRepositoryTest.java b/configserver/src/test/java/com/yahoo/vespa/config/server/ApplicationRepositoryTest.java
index 934440f03d1..58b7385f4df 100644
--- a/configserver/src/test/java/com/yahoo/vespa/config/server/ApplicationRepositoryTest.java
+++ b/configserver/src/test/java/com/yahoo/vespa/config/server/ApplicationRepositoryTest.java
@@ -472,7 +472,6 @@ public class ApplicationRepositoryTest {
sessionId,
FilesApplicationPackage.fromFile(testApp),
new SessionZooKeeperClient(curator,
- configCurator,
tenant1,
sessionId,
ConfigUtils.getCanonicalHostName()));
diff --git a/configserver/src/test/java/com/yahoo/vespa/config/server/session/MockSessionZKClient.java b/configserver/src/test/java/com/yahoo/vespa/config/server/session/MockSessionZKClient.java
index 0451ef84e09..bdd758ee1ec 100644
--- a/configserver/src/test/java/com/yahoo/vespa/config/server/session/MockSessionZKClient.java
+++ b/configserver/src/test/java/com/yahoo/vespa/config/server/session/MockSessionZKClient.java
@@ -8,7 +8,6 @@ import com.yahoo.config.provision.TenantName;
import com.yahoo.vespa.config.server.tenant.TenantRepository;
import com.yahoo.vespa.config.server.zookeeper.ConfigCurator;
import com.yahoo.vespa.config.util.ConfigUtils;
-import com.yahoo.vespa.curator.Curator;
import java.util.Optional;
@@ -22,18 +21,17 @@ public class MockSessionZKClient extends SessionZooKeeperClient {
private final ApplicationPackage app;
private Optional<AllocatedHosts> info = Optional.empty();
- public MockSessionZKClient(Curator curator, TenantName tenantName, long sessionId) {
+ public MockSessionZKClient(com.yahoo.vespa.curator.Curator curator, TenantName tenantName, long sessionId) {
this(curator, tenantName, sessionId, (ApplicationPackage) null);
}
- public MockSessionZKClient(Curator curator, TenantName tenantName, long sessionId, Optional<AllocatedHosts> allocatedHosts) {
+ public MockSessionZKClient(com.yahoo.vespa.curator.Curator curator, TenantName tenantName, long sessionId, Optional<AllocatedHosts> allocatedHosts) {
this(curator, tenantName, sessionId);
this.info = allocatedHosts;
}
- MockSessionZKClient(Curator curator, TenantName tenantName, long sessionId, ApplicationPackage application) {
+ MockSessionZKClient(com.yahoo.vespa.curator.Curator curator, TenantName tenantName, long sessionId, ApplicationPackage application) {
super(curator,
- ConfigCurator.create(curator),
tenantName,
sessionId,
ConfigUtils.getCanonicalHostName());
diff --git a/configserver/src/test/java/com/yahoo/vespa/config/server/session/SessionPreparerTest.java b/configserver/src/test/java/com/yahoo/vespa/config/server/session/SessionPreparerTest.java
index 4995dc0decc..27e2d05a9fa 100644
--- a/configserver/src/test/java/com/yahoo/vespa/config/server/session/SessionPreparerTest.java
+++ b/configserver/src/test/java/com/yahoo/vespa/config/server/session/SessionPreparerTest.java
@@ -376,7 +376,7 @@ public class SessionPreparerTest {
}
private SessionZooKeeperClient createSessionZooKeeperClient(long sessionId) {
- return new SessionZooKeeperClient(curator, configCurator, applicationId().tenant(), sessionId, ConfigUtils.getCanonicalHostName());
+ return new SessionZooKeeperClient(curator, applicationId().tenant(), sessionId, ConfigUtils.getCanonicalHostName());
}
private Path sessionPath(long sessionId) {
diff --git a/configserver/src/test/java/com/yahoo/vespa/config/server/session/SessionRepositoryTest.java b/configserver/src/test/java/com/yahoo/vespa/config/server/session/SessionRepositoryTest.java
index 3fa00e3ecc3..2c131e56d67 100644
--- a/configserver/src/test/java/com/yahoo/vespa/config/server/session/SessionRepositoryTest.java
+++ b/configserver/src/test/java/com/yahoo/vespa/config/server/session/SessionRepositoryTest.java
@@ -28,7 +28,6 @@ import com.yahoo.vespa.config.server.http.InvalidApplicationException;
import com.yahoo.vespa.config.server.modelfactory.ModelFactoryRegistry;
import com.yahoo.vespa.config.server.tenant.TenantRepository;
import com.yahoo.vespa.config.server.tenant.TestTenantRepository;
-import com.yahoo.vespa.config.server.zookeeper.ConfigCurator;
import com.yahoo.vespa.config.util.ConfigUtils;
import com.yahoo.vespa.curator.Curator;
import com.yahoo.vespa.curator.mock.MockCurator;
@@ -285,7 +284,6 @@ public class SessionRepositoryTest {
private void createSession(long sessionId, boolean wait) {
SessionZooKeeperClient zkc = new SessionZooKeeperClient(curator,
- ConfigCurator.create(curator),
tenantName,
sessionId,
ConfigUtils.getCanonicalHostName());
diff --git a/configserver/src/test/java/com/yahoo/vespa/config/server/session/SessionZooKeeperClientTest.java b/configserver/src/test/java/com/yahoo/vespa/config/server/session/SessionZooKeeperClientTest.java
index f977011efbc..65c85c28a92 100644
--- a/configserver/src/test/java/com/yahoo/vespa/config/server/session/SessionZooKeeperClientTest.java
+++ b/configserver/src/test/java/com/yahoo/vespa/config/server/session/SessionZooKeeperClientTest.java
@@ -171,7 +171,6 @@ public class SessionZooKeeperClientTest {
private SessionZooKeeperClient createSessionZKClient(long sessionId) {
SessionZooKeeperClient zkc = new SessionZooKeeperClient(curator,
- ConfigCurator.create(curator),
tenantName,
sessionId,
ConfigUtils.getCanonicalHostName());
diff --git a/configserver/src/test/java/com/yahoo/vespa/config/server/zookeeper/ZKApplicationFileTest.java b/configserver/src/test/java/com/yahoo/vespa/config/server/zookeeper/ZKApplicationFileTest.java
index c452e1cf0f3..1c43591de9a 100644
--- a/configserver/src/test/java/com/yahoo/vespa/config/server/zookeeper/ZKApplicationFileTest.java
+++ b/configserver/src/test/java/com/yahoo/vespa/config/server/zookeeper/ZKApplicationFileTest.java
@@ -5,6 +5,7 @@ import com.yahoo.config.application.api.ApplicationFile;
import com.yahoo.config.application.api.ApplicationFileTest;
import com.yahoo.path.Path;
import com.yahoo.text.Utf8;
+import com.yahoo.vespa.curator.Curator;
import com.yahoo.vespa.curator.mock.MockCurator;
import org.junit.Rule;
import org.junit.rules.TemporaryFolder;
@@ -23,20 +24,20 @@ public class ZKApplicationFileTest extends ApplicationFileTest {
@Rule
public TemporaryFolder temporaryFolder = new TemporaryFolder();
- private void feed(ConfigCurator zk, File dirToFeed) {
+ private void feed(Curator curator, File dirToFeed) {
assertTrue(dirToFeed.isDirectory());
Path appPath = Path.fromString("/0");
- ZKApplicationPackageTest.feedZooKeeper(zk.curator(), dirToFeed, appPath.append(USERAPP_ZK_SUBPATH), null, true);
- zk.curator().set(appPath.append(ZKApplicationPackage.fileRegistryNode), Utf8.toBytes("dummyfiles"));
+ ZKApplicationPackageTest.feedZooKeeper(curator, dirToFeed, appPath.append(USERAPP_ZK_SUBPATH), null, true);
+ curator.set(appPath.append(ZKApplicationPackage.fileRegistryNode), Utf8.toBytes("dummyfiles"));
}
@Override
public ApplicationFile getApplicationFile(Path path) throws IOException{
- ConfigCurator configCurator = ConfigCurator.create(new MockCurator());
+ Curator curator = new MockCurator();
File tmp = temporaryFolder.newFolder();
writeAppTo(tmp);
- feed(configCurator, tmp);
- return new ZKApplicationFile(path, new ZKApplication(configCurator, Path.fromString("/0")));
+ feed(curator, tmp);
+ return new ZKApplicationFile(path, new ZKApplication(curator, Path.fromString("/0")));
}
}
diff --git a/configserver/src/test/java/com/yahoo/vespa/config/server/zookeeper/ZKApplicationPackageTest.java b/configserver/src/test/java/com/yahoo/vespa/config/server/zookeeper/ZKApplicationPackageTest.java
index 3f84646ad82..20aee737a7d 100644
--- a/configserver/src/test/java/com/yahoo/vespa/config/server/zookeeper/ZKApplicationPackageTest.java
+++ b/configserver/src/test/java/com/yahoo/vespa/config/server/zookeeper/ZKApplicationPackageTest.java
@@ -62,20 +62,20 @@ public class ZKApplicationPackageTest {
Optional.of(DockerImage.fromString(dockerImage)))));
}
- private ConfigCurator configCurator;
+ private Curator curator;
@Rule
public TemporaryFolder tmpDir = new TemporaryFolder();
@Before
public void setup() {
- configCurator = ConfigCurator.create(new MockCurator());
+ curator = new MockCurator();
}
@Test
public void testBasicZKFeed() throws IOException {
- feed(configCurator.curator(), new File(APP));
- ZKApplicationPackage zkApp = new ZKApplicationPackage(configCurator, Path.fromString("/0"));
+ feed(curator, new File(APP));
+ ZKApplicationPackage zkApp = new ZKApplicationPackage(curator, Path.fromString("/0"));
assertTrue(Pattern.compile(".*<slobroks>.*",Pattern.MULTILINE+Pattern.DOTALL).matcher(IOUtils.readAll(zkApp.getServices())).matches());
assertTrue(Pattern.compile(".*<alias>.*",Pattern.MULTILINE+Pattern.DOTALL).matcher(IOUtils.readAll(zkApp.getHosts())).matches());
assertTrue(Pattern.compile(".*<slobroks>.*",Pattern.MULTILINE+Pattern.DOTALL).matcher(IOUtils.readAll(zkApp.getFile(Path.fromString("services.xml")).createReader())).matches());
@@ -106,7 +106,7 @@ public class ZKApplicationPackageTest {
assertEquals("mydisc", DeploymentSpec.fromXml(zkApp.getDeployment().get()).requireInstance("default").globalServiceId().get());
}
- private void feed(Curator zk, File dirToFeed) throws IOException {
+ private void feed(com.yahoo.vespa.curator.Curator zk, File dirToFeed) throws IOException {
assertTrue(dirToFeed.isDirectory());
Path sessionPath = Path.fromString("/0");
feedZooKeeper(zk, dirToFeed, sessionPath.append(USERAPP_ZK_SUBPATH), null, true);
@@ -135,7 +135,7 @@ public class ZKApplicationPackageTest {
* @param filenameFilter A FilenameFilter which decides which files in dir are fed to zookeeper
* @param recurse recurse subdirectories
*/
- static void feedZooKeeper(Curator zk, File dir, Path path, FilenameFilter filenameFilter, boolean recurse) {
+ static void feedZooKeeper(com.yahoo.vespa.curator.Curator zk, File dir, Path path, FilenameFilter filenameFilter, boolean recurse) {
try {
if (filenameFilter == null) {
filenameFilter = acceptsAllFileNameFilter;