use of com.yahoo.vespa.curator.mock.MockCurator in project vespa by vespa-engine.
the class ZooKeeperClientTest method testFeedComponentsFileReferencesToZooKeeper.
// TODO: Evaluate if we want this or not
@Test
@Ignore
public void testFeedComponentsFileReferencesToZooKeeper() throws IOException {
final String appDir = "src/test/apps/app_sdbundles";
ConfigCurator zk = ConfigCurator.create(new MockCurator());
BaseDeployLogger logger = new BaseDeployLogger();
Path app = Path.fromString("/1");
ZooKeeperClient zooKeeperClient = new ZooKeeperClient(zk, logger, true, app);
zooKeeperClient.setupZooKeeper();
String currentAppPath = app.getAbsolute();
assertTrue(zk.exists(currentAppPath, ConfigCurator.USERAPP_ZK_SUBPATH.replaceFirst("/", "")));
assertTrue(zk.exists(currentAppPath + ConfigCurator.USERAPP_ZK_SUBPATH, "components"));
assertTrue(zk.exists(currentAppPath + ConfigCurator.USERAPP_ZK_SUBPATH + "/components", "testbundle.jar"));
assertTrue(zk.exists(currentAppPath + ConfigCurator.USERAPP_ZK_SUBPATH + "/components", "testbundle2.jar"));
String data = zk.getData(currentAppPath + ConfigCurator.USERAPP_ZK_SUBPATH + "/components", "testbundle2.jar");
assertThat(data, is(new File(appDir + "/components/testbundle2.jar").getAbsolutePath()));
}
use of com.yahoo.vespa.curator.mock.MockCurator in project vespa by vespa-engine.
the class ZooKeeperClientTest method testInitZooKeeper.
@Test
public void testInitZooKeeper() throws IOException {
ConfigCurator zk = ConfigCurator.create(new MockCurator());
BaseDeployLogger logger = new BaseDeployLogger();
long generation = 1L;
ZooKeeperClient zooKeeperClient = new ZooKeeperClient(zk, logger, true, Path.fromString("/1"));
zooKeeperClient.setupZooKeeper();
String appPath = "/";
assertThat(zk.getChildren(appPath).size(), is(1));
assertTrue(zk.exists("/" + String.valueOf(generation)));
String currentAppPath = appPath + String.valueOf(generation);
assertTrue(zk.exists(currentAppPath, ConfigCurator.DEFCONFIGS_ZK_SUBPATH.replaceFirst("/", "")));
assertThat(zk.getChildren(currentAppPath).size(), is(4));
}
use of com.yahoo.vespa.curator.mock.MockCurator in project vespa by vespa-engine.
the class LocalSessionTest method setupTest.
@Before
public void setupTest() throws Exception {
curator = new MockCurator();
configCurator = ConfigCurator.create(curator);
superModelGenerationCounter = new SuperModelGenerationCounter(curator);
tenantFileSystemDirs = new TenantFileSystemDirs(Files.createTempDir(), TenantName.from("test_tenant"));
}
use of com.yahoo.vespa.curator.mock.MockCurator in project vespa by vespa-engine.
the class ZKApplicationFileTest method getApplicationFile.
@Override
public ApplicationFile getApplicationFile(Path path) throws IOException {
ConfigCurator configCurator = ConfigCurator.create(new MockCurator());
File tmp = Files.createTempDir();
writeAppTo(tmp);
feed(configCurator, tmp);
return new ZKApplicationFile(path, new ZKLiveApp(configCurator, Path.fromString("/0")));
}
use of com.yahoo.vespa.curator.mock.MockCurator in project vespa by vespa-engine.
the class CuratorCounterTest method testCounter.
@Test
public void testCounter() throws Exception {
DistributedAtomicLong counter = new MockCurator().createAtomicCounter("/mycounter");
counter.initialize(4l);
assertEquals(4l, counter.get().postValue().longValue());
assertEquals(5l, counter.increment().postValue().longValue());
}
Aggregations