@Test ()
public void testNormalMsgExecution() throws InterruptedException
{
System.out.println("START TestCMTaskExecutor.testNormalMsgExecution()");
HelixTaskExecutor executor = new HelixTaskExecutor();
HelixManager manager = new MockClusterManager();
TestMessageHandlerFactory factory = new TestMessageHandlerFactory();
executor.registerMessageHandlerFactory(factory.getMessageType(), factory);
TestMessageHandlerFactory2 factory2 = new TestMessageHandlerFactory2();
executor.registerMessageHandlerFactory(factory2.getMessageType(), factory2);
NotificationContext changeContext = new NotificationContext(manager);
List<Message> msgList = new ArrayList<Message>();
int nMsgs1 = 5;
for(int i = 0; i < nMsgs1; i++)
{
Message msg = new Message(factory.getMessageType(), UUID.randomUUID().toString());
msg.setTgtSessionId(manager.getSessionId());
msg.setTgtName("Localhost_1123");
msg.setSrcName("127.101.1.23_2234");
msg.setCorrelationId(UUID.randomUUID().toString());
msgList.add(msg);
}
int nMsgs2 = 6;
for(int i = 0; i < nMsgs2; i++)
{
Message msg = new Message(factory2.getMessageType(), UUID.randomUUID().toString());
msg.setTgtSessionId(manager.getSessionId());
msg.setTgtName("Localhost_1123");
msg.setSrcName("127.101.1.23_2234");
msg.setCorrelationId(UUID.randomUUID().toString());
msgList.add(msg);
}
executor.onMessage("someInstance", msgList, changeContext);
Thread.sleep(1000);
AssertJUnit.assertTrue(factory._processedMsgIds.size() == nMsgs1);
AssertJUnit.assertTrue(factory2._processedMsgIds.size() == nMsgs2);