Search in sources :

Example 1 with StatusCode

use of com.twitter.heron.common.network.StatusCode in project incubator-heron by apache.

the class CheckpointManagerServerTest method testGetInstanceState.

@Test
public void testGetInstanceState() throws Exception {
    final Checkpoint checkpoint = new Checkpoint(TOPOLOGY_NAME, instance, instanceStateCheckpoint);
    when(statefulStorage.restore(TOPOLOGY_NAME, CHECKPOINT_ID, instance)).thenReturn(checkpoint);
    runTest(TestRequestHandler.RequestType.GET_INSTANCE_STATE, new HeronServerTester.SuccessResponseHandler(CheckpointManager.GetInstanceStateResponse.class, new HeronServerTester.TestResponseHandler() {

        @Override
        public void handleResponse(HeronClient client, StatusCode status, Object ctx, Message response) throws Exception {
            verify(statefulStorage).restore(TOPOLOGY_NAME, CHECKPOINT_ID, instance);
            assertEquals(checkpoint.getCheckpoint(), ((CheckpointManager.GetInstanceStateResponse) response).getCheckpoint());
        }
    }));
}
Also used : Checkpoint(com.twitter.heron.spi.statefulstorage.Checkpoint) HeronClient(com.twitter.heron.common.network.HeronClient) Message(com.google.protobuf.Message) CheckpointManager(com.twitter.heron.proto.ckptmgr.CheckpointManager) HeronServerTester(com.twitter.heron.common.testhelpers.HeronServerTester) StatusCode(com.twitter.heron.common.network.StatusCode) Test(org.junit.Test)

Aggregations

Message (com.google.protobuf.Message)1 HeronClient (com.twitter.heron.common.network.HeronClient)1 StatusCode (com.twitter.heron.common.network.StatusCode)1 HeronServerTester (com.twitter.heron.common.testhelpers.HeronServerTester)1 CheckpointManager (com.twitter.heron.proto.ckptmgr.CheckpointManager)1 Checkpoint (com.twitter.heron.spi.statefulstorage.Checkpoint)1 Test (org.junit.Test)1