use of com.yahoo.vespa.config.server.zookeeper.ConfigCurator in project vespa by vespa-engine.
the class ZooKeeperDeployerTest method require_that_deployer_is_initialized.
@Test
public void require_that_deployer_is_initialized() throws IOException, ParseException {
ConfigCurator zkfacade = ConfigCurator.create(new MockCurator());
File serverdbDir = folder.newFolder("serverdb");
File defsDir = new File(serverdbDir, "serverdefs");
try {
IOUtils.createWriter(new File(defsDir, defFile), true);
} catch (IOException e) {
e.printStackTrace();
fail();
}
deploy(FilesApplicationPackage.fromFile(new File("src/test/apps/content")), zkfacade, Path.fromString("/1"));
deploy(FilesApplicationPackage.fromFile(new File("src/test/apps/content")), zkfacade, Path.fromString("/2"));
}
use of com.yahoo.vespa.config.server.zookeeper.ConfigCurator in project vespa by vespa-engine.
the class InjectedGlobalComponentRegistryTest method setupRegistry.
@Before
public void setupRegistry() {
curator = new MockCurator();
ConfigCurator configCurator = ConfigCurator.create(curator);
metrics = Metrics.createTestMetrics();
modelFactoryRegistry = new ModelFactoryRegistry(Collections.singletonList(new VespaModelFactory(new NullConfigModelRegistry())));
configserverConfig = new ConfigserverConfig(new ConfigserverConfig.Builder().configServerDBDir(Files.createTempDir().getAbsolutePath()).configDefinitionsDir(Files.createTempDir().getAbsolutePath()));
serverDB = new ConfigServerDB(configserverConfig);
sessionPreparer = new SessionTest.MockSessionPreparer();
rpcServer = new RpcServer(configserverConfig, null, Metrics.createTestMetrics(), new HostRegistries(), new ConfigRequestHostLivenessTracker(), new FileServer(FileDistribution.getDefaultFileDBPath()));
generationCounter = new SuperModelGenerationCounter(curator);
defRepo = new StaticConfigDefinitionRepo();
permanentApplicationPackage = new PermanentApplicationPackage(configserverConfig);
hostRegistries = new HostRegistries();
HostProvisionerProvider hostProvisionerProvider = HostProvisionerProvider.withProvisioner(new SessionHandlerTest.MockProvisioner());
zone = Zone.defaultZone();
globalComponentRegistry = new InjectedGlobalComponentRegistry(curator, configCurator, metrics, modelFactoryRegistry, serverDB, sessionPreparer, rpcServer, configserverConfig, generationCounter, defRepo, permanentApplicationPackage, hostRegistries, hostProvisionerProvider, zone);
}
use of com.yahoo.vespa.config.server.zookeeper.ConfigCurator 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.config.server.zookeeper.ConfigCurator 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.config.server.zookeeper.ConfigCurator in project vespa by vespa-engine.
the class ZooKeeperClientTest method testWritingHostNamesToZooKeeper.
@Test
public void testWritingHostNamesToZooKeeper() throws IOException {
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();
HostSpec host1 = new HostSpec("host1.yahoo.com", Collections.emptyList());
HostSpec host2 = new HostSpec("host2.yahoo.com", Collections.emptyList());
ImmutableSet<HostSpec> hosts = ImmutableSet.of(host1, host2);
zooKeeperClient.write(AllocatedHosts.withHosts(hosts));
Path hostsPath = app.append(ZKApplicationPackage.allocatedHostsNode);
assertTrue(zk.exists(hostsPath.getAbsolute()));
AllocatedHosts deserialized = AllocatedHosts.fromJson(zk.getBytes(hostsPath.getAbsolute()), Optional.empty());
assertEquals(hosts, deserialized.getHosts());
}
Aggregations