SessionZooKeeperClient { public Session.Status readStatus() { try { String data = configCurator.getData(sessionStatusPath.getAbsolute()); return Session.Status.parse(data); } catch (Exception e) { log.log(Level.INFO, "Unable to read session status, assuming it was deleted"); return Session.Status.NONE; } } SessionZooKeeperClient(Curator curator,
                                  ConfigCurator configCurator,
                                  TenantName tenantName,
                                  long sessionId,
                                  String serverId); void writeStatus(Session.Status sessionStatus); Session.Status readStatus(); Curator.CompletionWaiter createActiveWaiter(); CuratorTransaction deleteTransaction(); ApplicationPackage loadApplicationPackage(); ConfigDefinitionRepo getUserConfigDefinitions(); void writeApplicationId(ApplicationId id); Optional<ApplicationId> readApplicationId(); void writeVespaVersion(Version version); Version readVespaVersion(); Optional<DockerImage> readDockerImageRepository(); void writeDockerImageRepository(Optional<DockerImage> dockerImageRepository); Instant readCreateTime(); ZooKeeperDeployer createDeployer(DeployLogger logger); Transaction createWriteStatusTransaction(Session.Status status); void writeAthenzDomain(Optional<AthenzDomain> athenzDomain); Optional<AthenzDomain> readAthenzDomain(); void writeQuota(Optional<Quota> maybeQuota); Optional<Quota> readQuota(); void createNewSession(Instant createTime);  }
@Test public void require_that_status_is_read_from_zk() { int sessionId = 3; SessionZooKeeperClient zkc = createSessionZKClient(sessionId); curator.set(sessionPath(sessionId).append(ConfigCurator.SESSIONSTATE_ZK_SUBPATH), Utf8.toBytes("PREPARE")); assertThat(zkc.readStatus(), is(Session.Status.PREPARE)); }