refactoring: tests Device, Dashboard add int cntTimeEdge, int cntTimeRuleEngine
This commit is contained in:
parent
3ca714d3d4
commit
cb8f11e210
@ -116,7 +116,7 @@ public class DefaultTbDeviceService extends AbstractTbEntityService implements T
|
|||||||
try {
|
try {
|
||||||
Device savedDevice = checkNotNull(deviceService.assignDeviceToCustomer(tenantId, deviceId, customerId));
|
Device savedDevice = checkNotNull(deviceService.assignDeviceToCustomer(tenantId, deviceId, customerId));
|
||||||
notificationEntityService.notifyAssignOrUnassignEntityToCustomer(tenantId, deviceId, customerId, savedDevice,
|
notificationEntityService.notifyAssignOrUnassignEntityToCustomer(tenantId, deviceId, customerId, savedDevice,
|
||||||
actionType, edgeTypeByActionType(actionType), user, true, deviceId.toString(), customerId.toString(), customer.getName());
|
actionType, user, true, deviceId.toString(), customerId.toString(), customer.getName());
|
||||||
|
|
||||||
return savedDevice;
|
return savedDevice;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|||||||
@ -111,14 +111,15 @@ public abstract class AbstractNotifyEntityTest extends AbstractWebTest {
|
|||||||
|
|
||||||
protected void testNotifyManyEntityManyTimeMsgToEdgeServiceEntityEqAny(HasName entity, HasName originator,
|
protected void testNotifyManyEntityManyTimeMsgToEdgeServiceEntityEqAny(HasName entity, HasName originator,
|
||||||
TenantId tenantId, CustomerId customerId, UserId userId, String userName,
|
TenantId tenantId, CustomerId customerId, UserId userId, String userName,
|
||||||
ActionType actionType, ActionType actionTypeEdge, int cntTime, int cntTimeEdge, Object... additionalInfo) {
|
ActionType actionType, ActionType actionTypeEdge,
|
||||||
|
int cntTime, int cntTimeEdge, int cntTimeRuleEngine, Object... additionalInfo) {
|
||||||
EntityId originatorId = createEntityId_NULL_UUID(originator);
|
EntityId originatorId = createEntityId_NULL_UUID(originator);
|
||||||
testSendNotificationMsgToEdgeServiceTimeEntityEqAny(tenantId, actionTypeEdge, cntTime);
|
testSendNotificationMsgToEdgeServiceTimeEntityEqAny(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());
|
||||||
testLogEntityActionAdditionalInfo(matcherEntityClassEquals, matcherOriginatorId, tenantId, customerId, userId, userName, actionType, cntTime,
|
testLogEntityActionAdditionalInfo(matcherEntityClassEquals, matcherOriginatorId, tenantId, customerId, userId, userName, actionType, cntTime,
|
||||||
extractMatcherAdditionalInfo(additionalInfo));
|
extractMatcherAdditionalInfo(additionalInfo));
|
||||||
testPushMsgToRuleEngineTime(originatorId, tenantId, cntTimeEdge);
|
testPushMsgToRuleEngineTime(originatorId, tenantId, cntTimeRuleEngine);
|
||||||
Mockito.reset(tbClusterService, auditLogService);
|
Mockito.reset(tbClusterService, auditLogService);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -126,7 +127,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, ActionType actionTypeEdge, int cntTime, int cntTimeEdge, int cntAdditionalInfo) {
|
ActionType actionType, ActionType actionTypeEdge, int cntTime, int cntTimeEdge, int cntAdditionalInfo) {
|
||||||
EntityId originatorId = createEntityId_NULL_UUID(originator);
|
EntityId originatorId = createEntityId_NULL_UUID(originator);
|
||||||
testSendNotificationMsgToEdgeServiceTimeEntityEqAny(tenantId, actionTypeEdge, cntTime);
|
testSendNotificationMsgToEdgeServiceTimeEntityEqAny(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,
|
||||||
|
|||||||
@ -432,7 +432,7 @@ public abstract class BaseDashboardControllerTest extends AbstractControllerTest
|
|||||||
|
|
||||||
testNotifyManyEntityManyTimeMsgToEdgeServiceEntityEqAny(new Dashboard(), new Dashboard(),
|
testNotifyManyEntityManyTimeMsgToEdgeServiceEntityEqAny(new Dashboard(), new Dashboard(),
|
||||||
savedTenant.getId(), tenantAdmin.getCustomerId(), tenantAdmin.getId(), tenantAdmin.getEmail(),
|
savedTenant.getId(), tenantAdmin.getCustomerId(), tenantAdmin.getId(), tenantAdmin.getEmail(),
|
||||||
ActionType.ADDED, ActionType.ASSIGNED_TO_CUSTOMER, cntEntity, cntEntity*2);
|
ActionType.ADDED, ActionType.ASSIGNED_TO_CUSTOMER, cntEntity, cntEntity, cntEntity*2);
|
||||||
|
|
||||||
List<DashboardInfo> loadedDashboards = new ArrayList<>();
|
List<DashboardInfo> loadedDashboards = new ArrayList<>();
|
||||||
PageLink pageLink = new PageLink(21);
|
PageLink pageLink = new PageLink(21);
|
||||||
|
|||||||
@ -798,7 +798,7 @@ public abstract class BaseDeviceControllerTest extends AbstractControllerTest {
|
|||||||
|
|
||||||
testNotifyManyEntityManyTimeMsgToEdgeServiceEntityEqAny(new Device(), new Device(),
|
testNotifyManyEntityManyTimeMsgToEdgeServiceEntityEqAny(new Device(), new Device(),
|
||||||
savedTenant.getId(), tenantAdmin.getCustomerId(), tenantAdmin.getId(), tenantAdmin.getEmail(),
|
savedTenant.getId(), tenantAdmin.getCustomerId(), tenantAdmin.getId(), tenantAdmin.getEmail(),
|
||||||
ActionType.ADDED, ActionType.ASSIGNED_TO_CUSTOMER, cntEntity, cntEntity * 2);
|
ActionType.ADDED, ActionType.ASSIGNED_TO_CUSTOMER, cntEntity, cntEntity, cntEntity * 2);
|
||||||
testNotificationUpdateGatewayNever();
|
testNotificationUpdateGatewayNever();
|
||||||
|
|
||||||
List<Device> loadedDevices = new ArrayList<>(cntEntity);
|
List<Device> loadedDevices = new ArrayList<>(cntEntity);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user