jiajunwang commented on a change in pull request #1514:
URL: https://github.com/apache/helix/pull/1514#discussion_r520829622
##########
File path:
helix-core/src/test/java/org/apache/helix/messaging/handling/TestHelixTaskExecutor.java
##########
@@ -563,23 +564,42 @@ public void testCreateHandlerException() throws
InterruptedException {
HelixManager manager = new MockClusterManager();
HelixDataAccessor dataAccessor = manager.getHelixDataAccessor();
PropertyKey.Builder keyBuilder = dataAccessor.keyBuilder();
-
- TestMessageHandlerFactory factory = new TestMessageHandlerFactory();
- for (String type : factory.getMessageTypes()) {
- executor.registerMessageHandlerFactory(type, factory);
- }
-
NotificationContext changeContext = new NotificationContext(manager);
+ TestMessageHandlerFactory factory = new TestMessageHandlerFactory();
+ // Sending message without registering the factory.
+ // The message won't be processed since creating handler returns null.
int nMsgs1 = 5;
+ List<Message> msgList = new ArrayList<>();
for (int i = 0; i < nMsgs1; i++) {
Message msg = new Message(factory.getMessageTypes().get(0),
UUID.randomUUID().toString());
msg.setTgtSessionId(manager.getSessionId());
msg.setTgtName("Localhost_1123");
msg.setSrcName("127.101.1.23_2234");
msg.setCorrelationId(UUID.randomUUID().toString());
dataAccessor.setProperty(keyBuilder.message(manager.getInstanceName(),
msg.getMsgId()), msg);
+ msgList.add(msg);
+ }
+
+ changeContext.setChangeType(HelixConstants.ChangeType.MESSAGE);
+ executor.onMessage(manager.getInstanceName(), Collections.emptyList(),
changeContext);
+
+ Thread.sleep(1000);
Review comment:
I think removing it will be fine. It was from some old code. Let me have
a try.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]