ZooKeeperClient { void setupZooKeeper() { int retries = 5; try { while (retries > 0) { try { createZooKeeperNodes(); break; } catch (RuntimeException e) { logger.log(Level.FINE, "ZK init failed, retrying: " + e); retries--; if (retries == 0) { throw e; } Thread.sleep(100); } } } catch (Exception e) { throw new IllegalStateException("Unable to initialize vespa model writing to config server(s) " + System.getProperty("configsources") + "\n" + "Please ensure that cloudconfig_server is started on the config server node(s), " + "and check the vespa log for configserver errors. ", e); } } ZooKeeperClient(ConfigCurator configCurator, DeployLogger logger, Path rootPath); void write(AllocatedHosts hosts); void write(Map<Version, FileRegistry> fileRegistryMap);  }
@Test public void testInitZooKeeper() { ConfigCurator zk = ConfigCurator.create(new MockCurator()); BaseDeployLogger logger = new BaseDeployLogger(); long generation = 1L; ZooKeeperClient zooKeeperClient = new ZooKeeperClient(zk, logger, Path.fromString("/1")); zooKeeperClient.setupZooKeeper(); String appPath = "/"; assertThat(zk.getChildren(appPath).size(), is(1)); assertTrue(zk.exists("/" + generation)); String currentAppPath = appPath + generation; assertTrue(zk.exists(currentAppPath, ConfigCurator.DEFCONFIGS_ZK_SUBPATH.replaceFirst("/", ""))); assertThat(zk.getChildren(currentAppPath).size(), is(4)); }