Search in sources :

Example 1 with TestAwaitTaskUtils

use of com.navercorp.pinpoint.rpc.TestAwaitTaskUtils in project pinpoint by naver.

the class PinpointServerStateTest method assertAvaiableWritableSocket.

private void assertAvaiableWritableSocket(final PinpointServerAcceptor serverAcceptor) {
    boolean pass = awaitUtils.await(new TestAwaitTaskUtils() {

        @Override
        public boolean checkCompleted() {
            return !serverAcceptor.getWritableSocketList().isEmpty();
        }
    });
    Assert.assertTrue(pass);
}
Also used : TestAwaitTaskUtils(com.navercorp.pinpoint.rpc.TestAwaitTaskUtils)

Example 2 with TestAwaitTaskUtils

use of com.navercorp.pinpoint.rpc.TestAwaitTaskUtils in project pinpoint by naver.

the class RequestManagerTest method testRegisterRequest.

@Test
public void testRegisterRequest() throws Exception {
    HashedWheelTimer timer = getTimer();
    RequestManager requestManager = new RequestManager(timer, 3000);
    try {
        RequestPacket packet = new RequestPacket(new byte[0]);
        final Future future = requestManager.register(packet, 50);
        TestAwaitUtils.await(new TestAwaitTaskUtils() {

            @Override
            public boolean checkCompleted() {
                return future.isReady();
            }
        }, 10, 200);
        Assert.assertTrue(future.isReady());
        Assert.assertFalse(future.isSuccess());
        Assert.assertTrue(future.getCause().getMessage().contains("timeout"));
        logger.debug(future.getCause().getMessage());
    } finally {
        requestManager.close();
        timer.stop();
    }
}
Also used : RequestPacket(com.navercorp.pinpoint.rpc.packet.RequestPacket) TestAwaitTaskUtils(com.navercorp.pinpoint.rpc.TestAwaitTaskUtils) Future(com.navercorp.pinpoint.rpc.Future) DefaultFuture(com.navercorp.pinpoint.rpc.DefaultFuture) HashedWheelTimer(org.jboss.netty.util.HashedWheelTimer) Test(org.junit.Test)

Example 3 with TestAwaitTaskUtils

use of com.navercorp.pinpoint.rpc.TestAwaitTaskUtils in project pinpoint by naver.

the class PinpointClientStateTest method assertHandlerState.

private void assertHandlerState(final SocketStateCode stateCode, final DefaultPinpointClientHandler handler) {
    boolean passed = awaitUtils.await(new TestAwaitTaskUtils() {

        @Override
        public boolean checkCompleted() {
            return handler.getCurrentStateCode() == stateCode;
        }
    });
    Assert.assertTrue(passed);
}
Also used : TestAwaitTaskUtils(com.navercorp.pinpoint.rpc.TestAwaitTaskUtils)

Example 4 with TestAwaitTaskUtils

use of com.navercorp.pinpoint.rpc.TestAwaitTaskUtils in project pinpoint by naver.

the class ReconnectTest method assertClientConnected.

private void assertClientConnected(final PinpointClient client) {
    boolean pass = awaitUtils.await(new TestAwaitTaskUtils() {

        @Override
        public boolean checkCompleted() {
            return client.isConnected();
        }
    });
    Assert.assertTrue(pass);
}
Also used : TestAwaitTaskUtils(com.navercorp.pinpoint.rpc.TestAwaitTaskUtils)

Example 5 with TestAwaitTaskUtils

use of com.navercorp.pinpoint.rpc.TestAwaitTaskUtils in project pinpoint by naver.

the class ReconnectTest method assertClientDisconnected.

private void assertClientDisconnected(final PinpointClient client) {
    boolean pass = awaitUtils.await(new TestAwaitTaskUtils() {

        @Override
        public boolean checkCompleted() {
            return !client.isConnected();
        }
    });
    Assert.assertTrue(pass);
}
Also used : TestAwaitTaskUtils(com.navercorp.pinpoint.rpc.TestAwaitTaskUtils)

Aggregations

TestAwaitTaskUtils (com.navercorp.pinpoint.rpc.TestAwaitTaskUtils)10 Test (org.junit.Test)4 PinpointSocket (com.navercorp.pinpoint.rpc.PinpointSocket)3 PinpointClient (com.navercorp.pinpoint.rpc.client.PinpointClient)2 PinpointClientFactory (com.navercorp.pinpoint.rpc.client.PinpointClientFactory)2 ArrayList (java.util.ArrayList)2 List (java.util.List)2 DefaultFuture (com.navercorp.pinpoint.rpc.DefaultFuture)1 Future (com.navercorp.pinpoint.rpc.Future)1 RequestPacket (com.navercorp.pinpoint.rpc.packet.RequestPacket)1 Socket (java.net.Socket)1 HashedWheelTimer (org.jboss.netty.util.HashedWheelTimer)1