Search in sources :

Example 1 with StatusCode

use of org.apache.heron.common.network.StatusCode in project heron by twitter.

the class CheckpointManagerServerTest method testGetInstanceState.

@Test
public void testGetInstanceState() throws Exception {
    final CheckpointInfo info = new CheckpointInfo(CHECKPOINT_ID, instance);
    final Checkpoint checkpoint = new Checkpoint(checkpointPartition);
    when(statefulStorage.restoreCheckpoint(any(CheckpointInfo.class))).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).restoreCheckpoint(info);
            assertEquals(checkpoint.getCheckpoint(), ((CheckpointManager.GetInstanceStateResponse) response).getCheckpoint());
        }
    }));
}
Also used : Checkpoint(org.apache.heron.spi.statefulstorage.Checkpoint) HeronClient(org.apache.heron.common.network.HeronClient) Message(com.google.protobuf.Message) CheckpointManager(org.apache.heron.proto.ckptmgr.CheckpointManager) CheckpointInfo(org.apache.heron.spi.statefulstorage.CheckpointInfo) HeronServerTester(org.apache.heron.common.testhelpers.HeronServerTester) StatusCode(org.apache.heron.common.network.StatusCode) Test(org.junit.Test)

Aggregations

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