Search in sources :

Example 21 with HBMessage

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());
}
Also used : Pacemaker(org.apache.storm.pacemaker.Pacemaker) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) HBMessage(org.apache.storm.generated.HBMessage) Test(org.junit.Test)

Example 22 with HBMessage

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);
}
Also used : HBMessage(org.apache.storm.generated.HBMessage)

Aggregations

HBMessage (org.apache.storm.generated.HBMessage)22 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)9 Pacemaker (org.apache.storm.pacemaker.Pacemaker)9 Test (org.junit.Test)9 HBPulse (org.apache.storm.generated.HBPulse)5 HBMessageData (org.apache.storm.generated.HBMessageData)3 ArrayList (java.util.ArrayList)2 ControlMessage (org.apache.storm.messaging.netty.ControlMessage)2 SaslMessageToken (org.apache.storm.messaging.netty.SaslMessageToken)2 ChannelBuffer (org.jboss.netty.buffer.ChannelBuffer)2 IOException (java.io.IOException)1 HashSet (java.util.HashSet)1 HBNodes (org.apache.storm.generated.HBNodes)1 HBServerMessageType (org.apache.storm.generated.HBServerMessageType)1 INettySerializable (org.apache.storm.messaging.netty.INettySerializable)1 Channel (org.jboss.netty.channel.Channel)1