Search in sources :

Example 1 with FailureDetectorMsg

use of org.corfudb.protocols.wireprotocol.FailureDetectorMsg in project CorfuDB by CorfuDB.

the class ManagementServerTest method triggerFailureHandler.

/**
     * Triggering the failure handler with and without bootstrapping the server.
     */
@Test
public void triggerFailureHandler() {
    Layout layout = TestLayoutBuilder.single(SERVERS.PORT_0);
    Set<String> set = new HashSet<>();
    set.add("key");
    sendMessage(CorfuMsgType.MANAGEMENT_FAILURE_DETECTED.payloadMsg(new FailureDetectorMsg(set)));
    assertThat(getLastMessage().getMsgType()).isEqualTo(CorfuMsgType.MANAGEMENT_NOBOOTSTRAP_ERROR);
    sendMessage(CorfuMsgType.MANAGEMENT_BOOTSTRAP_REQUEST.payloadMsg(layout));
    assertThat(getLastMessage().getMsgType()).isEqualTo(CorfuMsgType.ACK);
    sendMessage(CorfuMsgType.MANAGEMENT_FAILURE_DETECTED.payloadMsg(new FailureDetectorMsg(set)));
    assertThat(getLastMessage().getMsgType()).isEqualTo(CorfuMsgType.ACK);
}
Also used : FailureDetectorMsg(org.corfudb.protocols.wireprotocol.FailureDetectorMsg) Layout(org.corfudb.runtime.view.Layout) HashSet(java.util.HashSet) Test(org.junit.Test)

Aggregations

HashSet (java.util.HashSet)1 FailureDetectorMsg (org.corfudb.protocols.wireprotocol.FailureDetectorMsg)1 Layout (org.corfudb.runtime.view.Layout)1 Test (org.junit.Test)1