use of com.navercorp.pinpoint.rpc.server.PinpointServer in project pinpoint by naver.
the class ZookeeperJobWorkerTest method test2.
@Test
public void test2() throws Exception {
MockZookeeperClient zookeeperClient = new MockZookeeperClient();
zookeeperClient.connect();
ZookeeperJobWorker zookeeperWorker = new ZookeeperJobWorker(zookeeperClient, IDENTIFIER);
zookeeperWorker.start();
try {
PinpointServer mockServer = createMockPinpointServer("app", "agent", System.currentTimeMillis());
zookeeperWorker.addPinpointServer(mockServer);
zookeeperWorker.addPinpointServer(mockServer);
waitZookeeperServerData(1, zookeeperClient);
Assert.assertEquals(1, decodeServerData(zookeeperWorker.getClusterData()).size());
zookeeperWorker.removePinpointServer(mockServer);
waitZookeeperServerData(0, zookeeperClient);
Assert.assertEquals(0, decodeServerData(zookeeperWorker.getClusterData()).size());
} finally {
zookeeperWorker.stop();
}
}
Aggregations