-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] Message count node refactoring #10541
base: master
Are you sure you want to change the base?
[WIP] Message count node refactoring #10541
Conversation
Assertions.assertEquals(wantedNumberOfTellSelfInvocation, resultMsgs.size()); | ||
|
||
TbMsg firstMsg = resultMsgs.get(0); | ||
assertThat(firstMsg.getData()).isEqualTo("{\"count_null\":5}"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please mock ctx.getServiceId() to something like tb-rule-engine. then the data will contain count_tb-rule-engine
|
||
@Test | ||
public void givenIncomingMsgs_whenOnMsg_thenSendsMsgWithMsgCount() throws TbNodeException, InterruptedException { | ||
config.setInterval(10); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is too long an interval for the test. We need to use no more than 1.
TbMsg msg = TbMsg.newMsg(TbMsgType.POST_TELEMETRY_REQUEST, null, TbMsgMetaData.EMPTY, TbMsg.EMPTY_STRING); | ||
for (int i = 0; i < numberOfMsgs; i++) { | ||
node.onMsg(ctxMock, msg); | ||
Thread.sleep(2000); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thread.sleep is not acceptable here, we need to use only latch in this test.
Pull Request description
Added tests for Message count node.
General checklist
Back-End feature checklist