diff --git a/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/action/TbDeviceStateNode.java b/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/action/TbDeviceStateNode.java index 65d7e0979e..f28a3e4467 100644 --- a/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/action/TbDeviceStateNode.java +++ b/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/action/TbDeviceStateNode.java @@ -81,14 +81,7 @@ public class TbDeviceStateNode implements TbNode { @Override public void onMsg(TbContext ctx, TbMsg msg) { - var originator = msg.getOriginator(); - if (!ctx.isLocalEntity(originator)) { - log.warn("[{}][{}] Received message from non-local entity [{}]!", - ctx.getTenantId().getId(), ctx.getSelfId().getId(), originator.getId()); - ctx.ack(msg); - return; - } - if (!EntityType.DEVICE.equals(originator.getEntityType())) { + if (!EntityType.DEVICE.equals(msg.getOriginator().getEntityType())) { ctx.tellSuccess(msg); return; } diff --git a/rule-engine/rule-engine-components/src/test/java/org/thingsboard/rule/engine/action/TbDeviceStateNodeTest.java b/rule-engine/rule-engine-components/src/test/java/org/thingsboard/rule/engine/action/TbDeviceStateNodeTest.java index 2882493f84..988d8911a4 100644 --- a/rule-engine/rule-engine-components/src/test/java/org/thingsboard/rule/engine/action/TbDeviceStateNodeTest.java +++ b/rule-engine/rule-engine-components/src/test/java/org/thingsboard/rule/engine/action/TbDeviceStateNodeTest.java @@ -132,32 +132,15 @@ public class TbDeviceStateNodeTest { // GIVEN var asset = new AssetId(UUID.randomUUID()); var msg = TbMsg.newMsg(TbMsgType.ENTITY_CREATED, asset, TbMsgMetaData.EMPTY, TbMsg.EMPTY_JSON_OBJECT); - given(ctxMock.isLocalEntity(asset)).willReturn(true); // WHEN node.onMsg(ctxMock, msg); // THEN - then(ctxMock).should().isLocalEntity(asset); then(ctxMock).should().tellSuccess(msg); then(ctxMock).shouldHaveNoMoreInteractions(); } - @Test - public void givenNonLocalOriginator_whenOnMsg_thenTellsSuccessAndNoActivityActionsTriggered() { - // GIVEN - given(ctxMock.isLocalEntity(msg.getOriginator())).willReturn(false); - given(ctxMock.getSelfId()).willReturn(new RuleNodeId(UUID.randomUUID())); - given(ctxMock.getTenantId()).willReturn(TENANT_ID); - - // WHEN - node.onMsg(ctxMock, msg); - - // THEN - then(ctxMock).should().ack(msg); - then(ctxMock).shouldHaveNoMoreInteractions(); - } - @ParameterizedTest @MethodSource("provideSupportedEventsAndExpectedMessages") public void givenSupportedEvent_whenOnMsg_thenCorrectMsgIsSent(TbMsgType event, TransportProtos.ToCoreMsg expectedToCoreMsg) { @@ -171,7 +154,6 @@ public class TbDeviceStateNodeTest { } given(ctxMock.getTenantId()).willReturn(TENANT_ID); given(ctxMock.getClusterService()).willReturn(tbClusterServiceMock); - given(ctxMock.isLocalEntity(msg.getOriginator())).willReturn(true); // WHEN node.onMsg(ctxMock, msg);