Fix tests. Improve TbMsgPushNode toCloud and toEdge description
This commit is contained in:
parent
e84a1f0662
commit
1478383db6
@ -110,7 +110,7 @@ public class AlarmControllerTest extends AbstractControllerTest {
|
||||
|
||||
Alarm alarm = createAlarm(TEST_ALARM_TYPE);
|
||||
|
||||
testNotifyEntityAllOneTime(alarm, alarm.getId(), alarm.getOriginator(),
|
||||
testNotifyEntityOneTimeMsgToEdgeServiceNever(alarm, alarm.getId(), alarm.getOriginator(),
|
||||
tenantId, customerId, customerUserId, CUSTOMER_USER_EMAIL, ActionType.ADDED);
|
||||
}
|
||||
|
||||
@ -122,7 +122,7 @@ public class AlarmControllerTest extends AbstractControllerTest {
|
||||
|
||||
Alarm alarm = createAlarm(TEST_ALARM_TYPE);
|
||||
|
||||
testNotifyEntityAllOneTime(alarm, alarm.getId(), alarm.getOriginator(),
|
||||
testNotifyEntityOneTimeMsgToEdgeServiceNever(alarm, alarm.getId(), alarm.getOriginator(),
|
||||
tenantId, customerId, tenantAdminUserId, TENANT_ADMIN_EMAIL, ActionType.ADDED);
|
||||
}
|
||||
|
||||
@ -772,7 +772,7 @@ public class AlarmControllerTest extends AbstractControllerTest {
|
||||
alarm = doPost("/api/alarm", alarm, Alarm.class);
|
||||
Assert.assertNotNull("Saved alarm is null!", alarm);
|
||||
|
||||
testNotifyEntityNeverMsgToEdgeServiceOneTime(alarm, alarm.getId(), tenantId, ActionType.ADDED);
|
||||
testNotifyEntityNever(alarm.getId(), alarm);
|
||||
|
||||
resetTokens();
|
||||
|
||||
|
||||
@ -27,6 +27,7 @@ import org.thingsboard.rule.engine.api.util.TbNodeUtils;
|
||||
import org.thingsboard.server.common.data.DataConstants;
|
||||
import org.thingsboard.server.common.data.EntityType;
|
||||
import org.thingsboard.server.common.data.StringUtils;
|
||||
import org.thingsboard.server.common.data.alarm.Alarm;
|
||||
import org.thingsboard.server.common.data.alarm.AlarmComment;
|
||||
import org.thingsboard.server.common.data.edge.EdgeEventActionType;
|
||||
import org.thingsboard.server.common.data.id.TenantId;
|
||||
@ -147,9 +148,8 @@ public abstract class AbstractTbMsgPushNode<T extends BaseTbMsgPushNodeConfigura
|
||||
abstract void processMsg(TbContext ctx, TbMsg msg);
|
||||
|
||||
protected UUID getUUIDFromMsgData(TbMsg msg) {
|
||||
JsonNode data = JacksonUtil.toJsonNode(msg.getData()).get("id");
|
||||
String id = JacksonUtil.convertValue(data.get("id"), String.class);
|
||||
return UUID.fromString(id);
|
||||
Alarm alarm = JacksonUtil.fromString(msg.getData(), Alarm.class);
|
||||
return alarm != null ? alarm.getUuidId() : null;
|
||||
}
|
||||
|
||||
protected UUID getUUIDFromCommentMsg(TbMsg msg) {
|
||||
|
||||
@ -38,20 +38,14 @@ import java.util.UUID;
|
||||
"This node used only on edge to push messages from edge to cloud. " +
|
||||
"Once message arrived into this node it’s going to be converted into cloud event and saved to the local database. " +
|
||||
"Node doesn't push messages directly to cloud, but stores event(s) in the cloud queue. " +
|
||||
"<br>Supports next originator types:" +
|
||||
"<br><code>DEVICE</code>" +
|
||||
"<br><code>ASSET</code>" +
|
||||
"<br><code>ENTITY_VIEW</code>" +
|
||||
"<br><code>DASHBOARD</code>" +
|
||||
"<br><code>TENANT</code>" +
|
||||
"<br><code>CUSTOMER</code>" +
|
||||
"<br><code>EDGE</code><br><br>" +
|
||||
"As well node supports next message types:" +
|
||||
"Supports next message types:" +
|
||||
"<br><code>POST_TELEMETRY_REQUEST</code>" +
|
||||
"<br><code>POST_ATTRIBUTES_REQUEST</code>" +
|
||||
"<br><code>ATTRIBUTES_UPDATED</code>" +
|
||||
"<br><code>ATTRIBUTES_DELETED</code>" +
|
||||
"<br><code>ALARM</code><br><br>" +
|
||||
"<br><code>COMMENT_CREATED</code>" +
|
||||
"<br><code>COMMENT_UPDATED</code>" +
|
||||
"Message will be routed via <b>Failure</b> route if node was not able to save cloud event to database or unsupported originator type/message type arrived. " +
|
||||
"In case successful storage cloud event to database message will be routed via <b>Success</b> route.",
|
||||
uiResources = {"static/rulenode/rulenode-core-config.js"},
|
||||
|
||||
@ -60,6 +60,8 @@ import java.util.UUID;
|
||||
"<br><code>ATTRIBUTES_UPDATED</code>" +
|
||||
"<br><code>ATTRIBUTES_DELETED</code>" +
|
||||
"<br><code>ALARM</code><br><br>" +
|
||||
"<br><code>COMMENT_CREATED</code>" +
|
||||
"<br><code>COMMENT_UPDATED</code>" +
|
||||
"Message will be routed via <b>Failure</b> route if node was not able to save edge event to database or unsupported message type arrived. " +
|
||||
"In case successful storage edge event to database message will be routed via <b>Success</b> route.",
|
||||
uiResources = {"static/rulenode/rulenode-core-config.js"},
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user