|
|
@ -1,12 +1,12 @@ |
|
|
/** |
|
|
/** |
|
|
* Copyright © 2016-2022 The Thingsboard Authors |
|
|
* Copyright © 2016-2022 The Thingsboard Authors |
|
|
* |
|
|
* <p> |
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
* you may not use this file except in compliance with the License. |
|
|
* you may not use this file except in compliance with the License. |
|
|
* You may obtain a copy of the License at |
|
|
* You may obtain a copy of the License at |
|
|
* |
|
|
* <p> |
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
* |
|
|
* <p> |
|
|
* Unless required by applicable law or agreed to in writing, software |
|
|
* Unless required by applicable law or agreed to in writing, software |
|
|
* distributed under the License is distributed on an "AS IS" BASIS, |
|
|
* distributed under the License is distributed on an "AS IS" BASIS, |
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
|
@ -69,7 +69,7 @@ public abstract class AbstractNotifyEntityTest extends AbstractWebTest { |
|
|
TenantId tenantId, CustomerId customerId, UserId userId, String userName, |
|
|
TenantId tenantId, CustomerId customerId, UserId userId, String userName, |
|
|
ActionType actionType, Object... additionalInfo) { |
|
|
ActionType actionType, Object... additionalInfo) { |
|
|
int cntTime = 1; |
|
|
int cntTime = 1; |
|
|
testSendNotificationMsgToEdgeServiceTime(entityId, tenantId, actionType, cntTime); |
|
|
testNotificationMsgToEdgeServiceTime(entityId, tenantId, actionType, cntTime); |
|
|
testLogEntityAction(entity, originatorId, tenantId, customerId, userId, userName, actionType, cntTime, additionalInfo); |
|
|
testLogEntityAction(entity, originatorId, tenantId, customerId, userId, userName, actionType, cntTime, additionalInfo); |
|
|
ArgumentMatcher<EntityId> matcherOriginatorId = argument -> argument.equals(originatorId); |
|
|
ArgumentMatcher<EntityId> matcherOriginatorId = argument -> argument.equals(originatorId); |
|
|
testPushMsgToRuleEngineTime(matcherOriginatorId, tenantId, cntTime); |
|
|
testPushMsgToRuleEngineTime(matcherOriginatorId, tenantId, cntTime); |
|
|
@ -96,8 +96,8 @@ public abstract class AbstractNotifyEntityTest extends AbstractWebTest { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
protected void testNotifyEntityAllManyRelation(EntityRelation relation, |
|
|
protected void testNotifyEntityAllManyRelation(EntityRelation relation, |
|
|
TenantId tenantId, CustomerId customerId, UserId userId, String userName, |
|
|
TenantId tenantId, CustomerId customerId, UserId userId, String userName, |
|
|
ActionType actionType, int cntTime) { |
|
|
ActionType actionType, int cntTime) { |
|
|
Mockito.verify(tbClusterService, times(cntTime)).sendNotificationMsgToEdge(Mockito.eq(tenantId), |
|
|
Mockito.verify(tbClusterService, times(cntTime)).sendNotificationMsgToEdge(Mockito.eq(tenantId), |
|
|
Mockito.isNull(), Mockito.isNull(), Mockito.any(), Mockito.eq(EdgeEventType.RELATION), |
|
|
Mockito.isNull(), Mockito.isNull(), Mockito.any(), Mockito.eq(EdgeEventType.RELATION), |
|
|
Mockito.eq(edgeTypeByActionType(actionType))); |
|
|
Mockito.eq(edgeTypeByActionType(actionType))); |
|
|
@ -113,7 +113,7 @@ public abstract class AbstractNotifyEntityTest extends AbstractWebTest { |
|
|
TenantId tenantId, CustomerId customerId, UserId userId, String userName, |
|
|
TenantId tenantId, CustomerId customerId, UserId userId, String userName, |
|
|
ActionType actionType, Object... additionalInfo) { |
|
|
ActionType actionType, Object... additionalInfo) { |
|
|
int cntTime = 1; |
|
|
int cntTime = 1; |
|
|
testSendNotificationMsgToEdgeServiceTime(entityId, tenantId, actionType, cntTime); |
|
|
testNotificationMsgToEdgeServiceTime(entityId, tenantId, actionType, cntTime); |
|
|
testLogEntityActionEntityEqClass(entity, originatorId, tenantId, customerId, userId, userName, actionType, cntTime, additionalInfo); |
|
|
testLogEntityActionEntityEqClass(entity, originatorId, tenantId, customerId, userId, userName, actionType, cntTime, additionalInfo); |
|
|
ArgumentMatcher<EntityId> matcherOriginatorId = argument -> argument.equals(originatorId); |
|
|
ArgumentMatcher<EntityId> matcherOriginatorId = argument -> argument.equals(originatorId); |
|
|
testPushMsgToRuleEngineTime(matcherOriginatorId, tenantId, cntTime); |
|
|
testPushMsgToRuleEngineTime(matcherOriginatorId, tenantId, cntTime); |
|
|
@ -122,7 +122,7 @@ public abstract class AbstractNotifyEntityTest extends AbstractWebTest { |
|
|
|
|
|
|
|
|
protected void testNotifyEntityNeverMsgToEdgeServiceOneTime(HasName entity, EntityId entityId, TenantId tenantId, |
|
|
protected void testNotifyEntityNeverMsgToEdgeServiceOneTime(HasName entity, EntityId entityId, TenantId tenantId, |
|
|
ActionType actionType) { |
|
|
ActionType actionType) { |
|
|
testSendNotificationMsgToEdgeServiceTime(entityId, tenantId, actionType, 1); |
|
|
testNotificationMsgToEdgeServiceTime(entityId, tenantId, actionType, 1); |
|
|
testLogEntityActionNever(entityId, entity); |
|
|
testLogEntityActionNever(entityId, entity); |
|
|
testPushMsgToRuleEngineNever(entityId); |
|
|
testPushMsgToRuleEngineNever(entityId); |
|
|
Mockito.reset(tbClusterService, auditLogService); |
|
|
Mockito.reset(tbClusterService, auditLogService); |
|
|
@ -132,7 +132,7 @@ public abstract class AbstractNotifyEntityTest extends AbstractWebTest { |
|
|
TenantId tenantId, CustomerId customerId, UserId userId, |
|
|
TenantId tenantId, CustomerId customerId, UserId userId, |
|
|
String userName, ActionType actionType, Object... additionalInfo) { |
|
|
String userName, ActionType actionType, Object... additionalInfo) { |
|
|
int cntTime = 1; |
|
|
int cntTime = 1; |
|
|
testNotificationMsgToEdgeServiceNever(entityId); |
|
|
testNotificationMsgToEdgeServiceNeverWithActionType(entityId, actionType); |
|
|
testLogEntityAction(entity, originatorId, tenantId, customerId, userId, userName, actionType, cntTime, additionalInfo); |
|
|
testLogEntityAction(entity, originatorId, tenantId, customerId, userId, userName, actionType, cntTime, additionalInfo); |
|
|
ArgumentMatcher<EntityId> matcherOriginatorId = argument -> argument.equals(originatorId); |
|
|
ArgumentMatcher<EntityId> matcherOriginatorId = argument -> argument.equals(originatorId); |
|
|
if (ActionType.RELATIONS_DELETED.equals(actionType)) { |
|
|
if (ActionType.RELATIONS_DELETED.equals(actionType)) { |
|
|
@ -148,7 +148,7 @@ public abstract class AbstractNotifyEntityTest extends AbstractWebTest { |
|
|
ActionType actionType, int cntTime, Object... additionalInfo) { |
|
|
ActionType actionType, int cntTime, Object... additionalInfo) { |
|
|
EntityId entityId = createEntityId_NULL_UUID(entity); |
|
|
EntityId entityId = createEntityId_NULL_UUID(entity); |
|
|
EntityId originatorId = createEntityId_NULL_UUID(originator); |
|
|
EntityId originatorId = createEntityId_NULL_UUID(originator); |
|
|
testNotificationMsgToEdgeServiceNever(entityId); |
|
|
testNotificationMsgToEdgeServiceNeverWithActionType(entityId, actionType); |
|
|
ArgumentMatcher<HasName> matcherEntityClassEquals = argument -> argument.getClass().equals(entity.getClass()); |
|
|
ArgumentMatcher<HasName> matcherEntityClassEquals = argument -> argument.getClass().equals(entity.getClass()); |
|
|
ArgumentMatcher<EntityId> matcherOriginatorId = argument -> argument.getClass().equals(originatorId.getClass()); |
|
|
ArgumentMatcher<EntityId> matcherOriginatorId = argument -> argument.getClass().equals(originatorId.getClass()); |
|
|
testLogEntityActionAdditionalInfo(matcherEntityClassEquals, matcherOriginatorId, tenantId, customerId, userId, userName, actionType, cntTime, |
|
|
testLogEntityActionAdditionalInfo(matcherEntityClassEquals, matcherOriginatorId, tenantId, customerId, userId, userName, actionType, cntTime, |
|
|
@ -189,7 +189,7 @@ public abstract class AbstractNotifyEntityTest extends AbstractWebTest { |
|
|
ActionType actionType, int cntTime, int cntAdditionalInfo) { |
|
|
ActionType actionType, int cntTime, int cntAdditionalInfo) { |
|
|
EntityId entityId = createEntityId_NULL_UUID(entity); |
|
|
EntityId entityId = createEntityId_NULL_UUID(entity); |
|
|
EntityId originatorId = createEntityId_NULL_UUID(originator); |
|
|
EntityId originatorId = createEntityId_NULL_UUID(originator); |
|
|
testNotificationMsgToEdgeServiceNever(entityId); |
|
|
testNotificationMsgToEdgeServiceNeverWithActionType(entityId, actionType); |
|
|
ArgumentMatcher<HasName> matcherEntityClassEquals = argument -> argument.getClass().equals(entity.getClass()); |
|
|
ArgumentMatcher<HasName> matcherEntityClassEquals = argument -> argument.getClass().equals(entity.getClass()); |
|
|
ArgumentMatcher<EntityId> matcherOriginatorId = argument -> argument.getClass().equals(originatorId.getClass()); |
|
|
ArgumentMatcher<EntityId> matcherOriginatorId = argument -> argument.getClass().equals(originatorId.getClass()); |
|
|
testLogEntityActionAdditionalInfoAny(matcherEntityClassEquals, matcherOriginatorId, tenantId, customerId, userId, userName, actionType, cntTime, |
|
|
testLogEntityActionAdditionalInfoAny(matcherEntityClassEquals, matcherOriginatorId, tenantId, customerId, userId, userName, actionType, cntTime, |
|
|
@ -202,7 +202,7 @@ public abstract class AbstractNotifyEntityTest extends AbstractWebTest { |
|
|
TenantId tenantId, CustomerId customerId, UserId userId, String userName, |
|
|
TenantId tenantId, CustomerId customerId, UserId userId, String userName, |
|
|
ActionType actionType, Object... additionalInfo) { |
|
|
ActionType actionType, Object... additionalInfo) { |
|
|
int cntTime = 1; |
|
|
int cntTime = 1; |
|
|
testSendNotificationMsgToEdgeServiceTime(entityId, tenantId, actionType, cntTime); |
|
|
testNotificationMsgToEdgeServiceTime(entityId, tenantId, actionType, cntTime); |
|
|
testLogEntityAction(entity, originatorId, tenantId, customerId, userId, userName, actionType, cntTime, additionalInfo); |
|
|
testLogEntityAction(entity, originatorId, tenantId, customerId, userId, userName, actionType, cntTime, additionalInfo); |
|
|
ArgumentMatcher<EntityId> matcherOriginatorId = argument -> argument.equals(originatorId); |
|
|
ArgumentMatcher<EntityId> matcherOriginatorId = argument -> argument.equals(originatorId); |
|
|
testPushMsgToRuleEngineTime(matcherOriginatorId, tenantId, cntTime); |
|
|
testPushMsgToRuleEngineTime(matcherOriginatorId, tenantId, cntTime); |
|
|
@ -214,7 +214,7 @@ public abstract class AbstractNotifyEntityTest extends AbstractWebTest { |
|
|
TenantId tenantId, CustomerId customerId, UserId userId, String userName, |
|
|
TenantId tenantId, CustomerId customerId, UserId userId, String userName, |
|
|
ActionType actionType, Object... additionalInfo) { |
|
|
ActionType actionType, Object... additionalInfo) { |
|
|
int cntTime = 1; |
|
|
int cntTime = 1; |
|
|
testNotificationMsgToEdgeServiceNever(entityId); |
|
|
testNotificationMsgToEdgeServiceNeverWithActionType(entityId, actionType); |
|
|
testLogEntityAction(entity, originatorId, tenantId, customerId, userId, userName, actionType, cntTime, additionalInfo); |
|
|
testLogEntityAction(entity, originatorId, tenantId, customerId, userId, userName, actionType, cntTime, additionalInfo); |
|
|
ArgumentMatcher<EntityId> matcherOriginatorId = argument -> argument.equals(originatorId); |
|
|
ArgumentMatcher<EntityId> matcherOriginatorId = argument -> argument.equals(originatorId); |
|
|
testPushMsgToRuleEngineTime(matcherOriginatorId, tenantId, cntTime); |
|
|
testPushMsgToRuleEngineTime(matcherOriginatorId, tenantId, cntTime); |
|
|
@ -222,26 +222,28 @@ public abstract class AbstractNotifyEntityTest extends AbstractWebTest { |
|
|
Mockito.reset(tbClusterService, auditLogService); |
|
|
Mockito.reset(tbClusterService, auditLogService); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
protected void testNotifyEntityBroadcastEntityStateChangeEventManyMsgToEdgeServiceNever(HasName entity, HasName originator, |
|
|
protected void testNotifyEntityBroadcastEntityStateChangeEventMany(HasName entity, HasName originator, |
|
|
TenantId tenantId, CustomerId customerId, UserId userId, String userName, |
|
|
TenantId tenantId, CustomerId customerId, |
|
|
ActionType actionType, int cntTime, int cntAdditionalInfo) { |
|
|
UserId userId, String userName, ActionType actionType, |
|
|
|
|
|
ActionType actionTypeEdge, |
|
|
|
|
|
int cntTime, int cntTimeEdge, int cntTimeRuleEngine, |
|
|
|
|
|
int cntAdditionalInfo) { |
|
|
EntityId entityId = createEntityId_NULL_UUID(entity); |
|
|
EntityId entityId = createEntityId_NULL_UUID(entity); |
|
|
EntityId originatorId = createEntityId_NULL_UUID(originator); |
|
|
EntityId originatorId = createEntityId_NULL_UUID(originator); |
|
|
testNotificationMsgToEdgeServiceNever(entityId); |
|
|
testNotificationMsgToEdgeServiceTime(entityId, tenantId, actionTypeEdge, cntTimeEdge); |
|
|
ArgumentMatcher<HasName> matcherEntityClassEquals = argument -> argument.getClass().equals(entity.getClass()); |
|
|
ArgumentMatcher<HasName> matcherEntityClassEquals = argument -> argument.getClass().equals(entity.getClass()); |
|
|
ArgumentMatcher<EntityId> matcherOriginatorId = argument -> argument.getClass().equals(originatorId.getClass()); |
|
|
ArgumentMatcher<EntityId> matcherOriginatorId = argument -> argument.getClass().equals(originatorId.getClass()); |
|
|
testLogEntityActionAdditionalInfoAny(matcherEntityClassEquals, matcherOriginatorId, tenantId, customerId, userId, userName, actionType, cntTime, |
|
|
testLogEntityActionAdditionalInfoAny(matcherEntityClassEquals, matcherOriginatorId, tenantId, customerId, userId, userName, actionType, cntTime, |
|
|
cntAdditionalInfo); |
|
|
cntAdditionalInfo); |
|
|
testPushMsgToRuleEngineTime(matcherOriginatorId, tenantId, cntTime); |
|
|
testPushMsgToRuleEngineTime(matcherOriginatorId, tenantId, cntTimeRuleEngine); |
|
|
testBroadcastEntityStateChangeEventTime(entityId, tenantId, cntTime); |
|
|
testBroadcastEntityStateChangeEventTime(entityId, tenantId, cntTime); |
|
|
Mockito.reset(tbClusterService, auditLogService); |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
protected void testNotifyEntityMsgToEdgePushMsgToCoreOneTime(HasName entity, EntityId entityId, EntityId originatorId, |
|
|
protected void testNotifyEntityMsgToEdgePushMsgToCoreOneTime(HasName entity, EntityId entityId, EntityId originatorId, |
|
|
TenantId tenantId, CustomerId customerId, UserId userId, String userName, |
|
|
TenantId tenantId, CustomerId customerId, UserId userId, String userName, |
|
|
ActionType actionType, Object... additionalInfo) { |
|
|
ActionType actionType, Object... additionalInfo) { |
|
|
int cntTime = 1; |
|
|
int cntTime = 1; |
|
|
testSendNotificationMsgToEdgeServiceTime(entityId, tenantId, actionType, cntTime); |
|
|
testNotificationMsgToEdgeServiceTime(entityId, tenantId, actionType, cntTime); |
|
|
testLogEntityAction(entity, originatorId, tenantId, customerId, userId, userName, actionType, cntTime, additionalInfo); |
|
|
testLogEntityAction(entity, originatorId, tenantId, customerId, userId, userName, actionType, cntTime, additionalInfo); |
|
|
tesPushMsgToCoreTime(cntTime); |
|
|
tesPushMsgToCoreTime(cntTime); |
|
|
Mockito.reset(tbClusterService, auditLogService); |
|
|
Mockito.reset(tbClusterService, auditLogService); |
|
|
@ -252,7 +254,7 @@ public abstract class AbstractNotifyEntityTest extends AbstractWebTest { |
|
|
Object... additionalInfo) { |
|
|
Object... additionalInfo) { |
|
|
CustomerId customer_NULL_UUID = (CustomerId) EntityIdFactory.getByTypeAndUuid(EntityType.CUSTOMER, ModelConstants.NULL_UUID); |
|
|
CustomerId customer_NULL_UUID = (CustomerId) EntityIdFactory.getByTypeAndUuid(EntityType.CUSTOMER, ModelConstants.NULL_UUID); |
|
|
EntityId entity_originator_NULL_UUID = createEntityId_NULL_UUID(entity); |
|
|
EntityId entity_originator_NULL_UUID = createEntityId_NULL_UUID(entity); |
|
|
testNotificationMsgToEdgeServiceNever(entity_originator_NULL_UUID); |
|
|
testNotificationMsgToEdgeServiceNeverWithActionType(entity_originator_NULL_UUID, actionType); |
|
|
ArgumentMatcher<HasName> matcherEntityEquals = argument -> argument.getClass().equals(entity.getClass()); |
|
|
ArgumentMatcher<HasName> matcherEntityEquals = argument -> argument.getClass().equals(entity.getClass()); |
|
|
ArgumentMatcher<Exception> matcherError = argument -> argument.getMessage().contains(exp.getMessage()) |
|
|
ArgumentMatcher<Exception> matcherError = argument -> argument.getMessage().contains(exp.getMessage()) |
|
|
& argument.getClass().equals(exp.getClass()); |
|
|
& argument.getClass().equals(exp.getClass()); |
|
|
@ -266,7 +268,7 @@ public abstract class AbstractNotifyEntityTest extends AbstractWebTest { |
|
|
Object... additionalInfo) { |
|
|
Object... additionalInfo) { |
|
|
CustomerId customer_NULL_UUID = (CustomerId) EntityIdFactory.getByTypeAndUuid(EntityType.CUSTOMER, ModelConstants.NULL_UUID); |
|
|
CustomerId customer_NULL_UUID = (CustomerId) EntityIdFactory.getByTypeAndUuid(EntityType.CUSTOMER, ModelConstants.NULL_UUID); |
|
|
EntityId entity_originator_NULL_UUID = createEntityId_NULL_UUID(entity); |
|
|
EntityId entity_originator_NULL_UUID = createEntityId_NULL_UUID(entity); |
|
|
testNotificationMsgToEdgeServiceNever(entity_originator_NULL_UUID); |
|
|
testNotificationMsgToEdgeServiceNeverWithActionType(entity_originator_NULL_UUID, actionType); |
|
|
ArgumentMatcher<HasName> matcherEntityIsNull = Objects::isNull; |
|
|
ArgumentMatcher<HasName> matcherEntityIsNull = Objects::isNull; |
|
|
ArgumentMatcher<Exception> matcherError = argument -> argument.getMessage().contains(exp.getMessage()) & |
|
|
ArgumentMatcher<Exception> matcherError = argument -> argument.getMessage().contains(exp.getMessage()) & |
|
|
argument.getClass().equals(exp.getClass()); |
|
|
argument.getClass().equals(exp.getClass()); |
|
|
@ -299,6 +301,13 @@ public abstract class AbstractNotifyEntityTest extends AbstractWebTest { |
|
|
Mockito.verify(gatewayNotificationsService, never()).onDeviceDeleted(Mockito.any(Device.class)); |
|
|
Mockito.verify(gatewayNotificationsService, never()).onDeviceDeleted(Mockito.any(Device.class)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void testNotificationMsgToEdgeServiceNeverWithActionType(EntityId entityId, ActionType actionType) { |
|
|
|
|
|
EdgeEventActionType edgeEventActionType = ActionType.CREDENTIALS_UPDATED.equals(actionType) ? |
|
|
|
|
|
EdgeEventActionType.CREDENTIALS_UPDATED : edgeTypeByActionType(actionType); |
|
|
|
|
|
Mockito.verify(tbClusterService, never()).sendNotificationMsgToEdge(Mockito.any(), |
|
|
|
|
|
Mockito.any(), Mockito.any(entityId.getClass()), Mockito.any(), Mockito.any(), Mockito.eq(edgeEventActionType)); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
private void testNotificationMsgToEdgeServiceNever(EntityId entityId) { |
|
|
private void testNotificationMsgToEdgeServiceNever(EntityId entityId) { |
|
|
Mockito.verify(tbClusterService, never()).sendNotificationMsgToEdge(Mockito.any(), |
|
|
Mockito.verify(tbClusterService, never()).sendNotificationMsgToEdge(Mockito.any(), |
|
|
Mockito.any(), Mockito.any(entityId.getClass()), Mockito.any(), Mockito.any(), Mockito.any()); |
|
|
Mockito.any(), Mockito.any(entityId.getClass()), Mockito.any(), Mockito.any(), Mockito.any()); |
|
|
@ -317,16 +326,23 @@ public abstract class AbstractNotifyEntityTest extends AbstractWebTest { |
|
|
Mockito.any(entityId.getClass()), Mockito.any(), Mockito.any()); |
|
|
Mockito.any(entityId.getClass()), Mockito.any(), Mockito.any()); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
protected void testBroadcastEntityStateChangeEventNever(EntityId entityId) { |
|
|
|
|
|
Mockito.verify(tbClusterService, never()).broadcastEntityStateChangeEvent(Mockito.any(), |
|
|
|
|
|
Mockito.any(entityId.getClass()), Mockito.any(ComponentLifecycleEvent.class)); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
private void testPushMsgToRuleEngineTime(ArgumentMatcher<EntityId> matcherOriginatorId, TenantId tenantId, int cntTime) { |
|
|
private void testPushMsgToRuleEngineTime(ArgumentMatcher<EntityId> matcherOriginatorId, TenantId tenantId, int cntTime) { |
|
|
Mockito.verify(tbClusterService, times(cntTime)).pushMsgToRuleEngine(Mockito.eq(tenantId), |
|
|
Mockito.verify(tbClusterService, times(cntTime)).pushMsgToRuleEngine(Mockito.eq(tenantId), |
|
|
Mockito.argThat(matcherOriginatorId), Mockito.any(TbMsg.class), Mockito.isNull()); |
|
|
Mockito.argThat(matcherOriginatorId), Mockito.any(TbMsg.class), Mockito.isNull()); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private void testSendNotificationMsgToEdgeServiceTime(EntityId entityId, TenantId tenantId, ActionType actionType, int cntTime) { |
|
|
private void testNotificationMsgToEdgeServiceTime(EntityId entityId, TenantId tenantId, ActionType actionType, int cntTime) { |
|
|
EdgeEventActionType edgeEventActionType = ActionType.CREDENTIALS_UPDATED.equals(actionType) ? |
|
|
EdgeEventActionType edgeEventActionType = ActionType.CREDENTIALS_UPDATED.equals(actionType) ? |
|
|
EdgeEventActionType.CREDENTIALS_UPDATED : edgeTypeByActionType(actionType); |
|
|
EdgeEventActionType.CREDENTIALS_UPDATED : edgeTypeByActionType(actionType); |
|
|
|
|
|
ArgumentMatcher<EntityId> matcherEntityId = cntTime == 1 ? argument -> argument.equals(entityId) : |
|
|
|
|
|
argument -> argument.getClass().equals(entityId.getClass()); |
|
|
Mockito.verify(tbClusterService, times(cntTime)).sendNotificationMsgToEdge(Mockito.eq(tenantId), |
|
|
Mockito.verify(tbClusterService, times(cntTime)).sendNotificationMsgToEdge(Mockito.eq(tenantId), |
|
|
Mockito.any(), Mockito.eq(entityId), Mockito.any(), Mockito.isNull(), |
|
|
Mockito.any(), Mockito.argThat(matcherEntityId), Mockito.any(), Mockito.isNull(), |
|
|
Mockito.eq(edgeEventActionType)); |
|
|
Mockito.eq(edgeEventActionType)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -336,7 +352,7 @@ public abstract class AbstractNotifyEntityTest extends AbstractWebTest { |
|
|
Mockito.eq(edgeTypeByActionType(actionType))); |
|
|
Mockito.eq(edgeTypeByActionType(actionType))); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private void testBroadcastEntityStateChangeEventTime(EntityId entityId, TenantId tenantId, int cntTime) { |
|
|
protected void testBroadcastEntityStateChangeEventTime(EntityId entityId, TenantId tenantId, int cntTime) { |
|
|
Mockito.verify(tbClusterService, times(cntTime)).broadcastEntityStateChangeEvent(Mockito.eq(tenantId), |
|
|
Mockito.verify(tbClusterService, times(cntTime)).broadcastEntityStateChangeEvent(Mockito.eq(tenantId), |
|
|
Mockito.any(entityId.getClass()), Mockito.any(ComponentLifecycleEvent.class)); |
|
|
Mockito.any(entityId.getClass()), Mockito.any(ComponentLifecycleEvent.class)); |
|
|
} |
|
|
} |
|
|
|