Search in sources :

Example 11 with PinpointServer

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();
    }
}
Also used : PinpointServer(com.navercorp.pinpoint.rpc.server.PinpointServer) Test(org.junit.Test)

Aggregations

PinpointServer (com.navercorp.pinpoint.rpc.server.PinpointServer)11 Test (org.junit.Test)7 PinpointServerAcceptor (com.navercorp.pinpoint.rpc.server.PinpointServerAcceptor)5 PinpointSocket (com.navercorp.pinpoint.rpc.PinpointSocket)3 PingPacket (com.navercorp.pinpoint.rpc.packet.PingPacket)3 ServerMessageListener (com.navercorp.pinpoint.rpc.server.ServerMessageListener)3 Map (java.util.Map)3 DefaultPinpointClientFactory (com.navercorp.pinpoint.rpc.client.DefaultPinpointClientFactory)2 PinpointClient (com.navercorp.pinpoint.rpc.client.PinpointClient)2 PinpointClientFactory (com.navercorp.pinpoint.rpc.client.PinpointClientFactory)2 HandshakeResponseCode (com.navercorp.pinpoint.rpc.packet.HandshakeResponseCode)2 RequestPacket (com.navercorp.pinpoint.rpc.packet.RequestPacket)2 SendPacket (com.navercorp.pinpoint.rpc.packet.SendPacket)2 PinpointRPCTestUtils (com.navercorp.pinpoint.rpc.util.PinpointRPCTestUtils)1 HashMap (java.util.HashMap)1 CountDownLatch (java.util.concurrent.CountDownLatch)1 PostConstruct (javax.annotation.PostConstruct)1 Before (org.junit.Before)1