use of org.apache.storm.generated.HBMessage in project storm by apache.
the class PacemakerTest method testServerDeletePath.
@Test
public void testServerDeletePath() {
Pacemaker handler = new Pacemaker(new ConcurrentHashMap());
makeNode(handler, "/some-root/DELETE_PATH/foo");
makeNode(handler, "/some-root/DELETE_PATH/bar");
makeNode(handler, "/some-root/DELETE_PATH/baz");
makeNode(handler, "/some-root/DELETE_PATH/boo");
messageWithRandId(HBServerMessageType.DELETE_PATH, HBMessageData.path("/some-root/DELETE_PATH"));
HBMessage response = handler.handleMessage(hbMessage, true);
Assert.assertEquals(mid, response.get_message_id());
Assert.assertEquals(HBServerMessageType.DELETE_PATH_RESPONSE, response.get_type());
Assert.assertNull(response.get_data());
messageWithRandId(HBServerMessageType.GET_ALL_NODES_FOR_PATH, HBMessageData.path("/some-root/DELETE_PATH"));
response = handler.handleMessage(hbMessage, true);
List<String> pulseIds = response.get_data().get_nodes().get_pulseIds();
Assert.assertEquals(mid, response.get_message_id());
Assert.assertEquals(HBServerMessageType.GET_ALL_NODES_FOR_PATH_RESPONSE, response.get_type());
Assert.assertTrue(pulseIds.isEmpty());
}
use of org.apache.storm.generated.HBMessage in project storm by apache.
the class PacemakerTest method messageWithRandId.
private void messageWithRandId(HBServerMessageType type, HBMessageData data) {
mid = random.nextInt();
hbMessage = new HBMessage(type, data);
hbMessage.set_message_id(mid);
}
Aggregations