Merge pull request #6600 from volodymyr-babak/feature/edge-converters-integration
[3.4] Edge integrations/converters support
This commit is contained in:
		
						commit
						f80583db72
					
				@ -915,55 +915,24 @@ public abstract class BaseController {
 | 
			
		||||
        return null;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    protected void sendRelationNotificationMsg(TenantId tenantId, EntityRelation relation, EdgeEventActionType action) {
 | 
			
		||||
        try {
 | 
			
		||||
            if (!relation.getFrom().getEntityType().equals(EntityType.EDGE) &&
 | 
			
		||||
                    !relation.getTo().getEntityType().equals(EntityType.EDGE)) {
 | 
			
		||||
                sendNotificationMsgToEdgeService(tenantId, null, null, json.writeValueAsString(relation), EdgeEventType.RELATION, action);
 | 
			
		||||
            }
 | 
			
		||||
        } catch (Exception e) {
 | 
			
		||||
            log.warn("Failed to push relation to core: {}", relation, e);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    protected void sendDeleteNotificationMsg(TenantId tenantId, EntityId entityId, List<EdgeId> edgeIds) {
 | 
			
		||||
        sendDeleteNotificationMsg(tenantId, entityId, edgeIds, null);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    protected void sendDeleteNotificationMsg(TenantId tenantId, EntityId entityId, List<EdgeId> edgeIds, String body) {
 | 
			
		||||
        if (edgeIds != null && !edgeIds.isEmpty()) {
 | 
			
		||||
            for (EdgeId edgeId : edgeIds) {
 | 
			
		||||
                sendNotificationMsgToEdgeService(tenantId, edgeId, entityId, body, null, EdgeEventActionType.DELETED);
 | 
			
		||||
                sendNotificationMsgToEdge(tenantId, edgeId, entityId, null, null, EdgeEventActionType.DELETED);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    protected void sendAlarmDeleteNotificationMsg(TenantId tenantId, EntityId entityId, List<EdgeId> edgeIds, Alarm alarm) {
 | 
			
		||||
        try {
 | 
			
		||||
            sendDeleteNotificationMsg(tenantId, entityId, edgeIds, json.writeValueAsString(alarm));
 | 
			
		||||
        } catch (Exception e) {
 | 
			
		||||
            log.warn("Failed to push delete alarm msg to core: {}", alarm, e);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    protected void sendEntityAssignToCustomerNotificationMsg(TenantId tenantId, EntityId entityId, CustomerId customerId, EdgeEventActionType action) {
 | 
			
		||||
        try {
 | 
			
		||||
            sendNotificationMsgToEdgeService(tenantId, null, entityId, json.writeValueAsString(customerId), null, action);
 | 
			
		||||
        } catch (Exception e) {
 | 
			
		||||
            log.warn("Failed to push assign/unassign to/from customer to core: {}", customerId, e);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    protected void sendEntityNotificationMsg(TenantId tenantId, EntityId entityId, EdgeEventActionType action) {
 | 
			
		||||
        sendNotificationMsgToEdgeService(tenantId, null, entityId, null, null, action);
 | 
			
		||||
        sendNotificationMsgToEdge(tenantId, null, entityId, null, null, action);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    protected void sendEntityAssignToEdgeNotificationMsg(TenantId tenantId, EdgeId edgeId, EntityId entityId, EdgeEventActionType action) {
 | 
			
		||||
        sendNotificationMsgToEdgeService(tenantId, edgeId, entityId, null, null, action);
 | 
			
		||||
        sendNotificationMsgToEdge(tenantId, edgeId, entityId, null, null, action);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private void sendNotificationMsgToEdgeService(TenantId tenantId, EdgeId edgeId, EntityId entityId, String body, EdgeEventType type, EdgeEventActionType action) {
 | 
			
		||||
        tbClusterService.sendNotificationMsgToEdgeService(tenantId, edgeId, entityId, body, type, action);
 | 
			
		||||
    private void sendNotificationMsgToEdge(TenantId tenantId, EdgeId edgeId, EntityId entityId, String body, EdgeEventType type, EdgeEventActionType action) {
 | 
			
		||||
        tbClusterService.sendNotificationMsgToEdge(tenantId, edgeId, entityId, body, type, action);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    protected List<EdgeId> findRelatedEdgeIds(TenantId tenantId, EntityId entityId) {
 | 
			
		||||
 | 
			
		||||
@ -223,8 +223,8 @@ public class EntityActionService {
 | 
			
		||||
        auditLogService.logEntityAction(user.getTenantId(), customerId, user.getId(), user.getName(), entityId, entity, actionType, e, additionalInfo);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void sendEntityNotificationMsgToEdgeService(TenantId tenantId, EntityId entityId, EdgeEventActionType action) {
 | 
			
		||||
        tbClusterService.sendNotificationMsgToEdgeService(tenantId, null, entityId, null, null, action);
 | 
			
		||||
    public void sendEntityNotificationMsgToEdge(TenantId tenantId, EntityId entityId, EdgeEventActionType action) {
 | 
			
		||||
        tbClusterService.sendNotificationMsgToEdge(tenantId, null, entityId, null, null, action);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private <T> T extractParameter(Class<T> clazz, int index, Object... additionalInfo) {
 | 
			
		||||
 | 
			
		||||
@ -32,6 +32,6 @@ public class TenantWidgetsBundlesEdgeEventFetcher extends BaseWidgetsBundlesEdge
 | 
			
		||||
    }
 | 
			
		||||
    @Override
 | 
			
		||||
    protected PageData<WidgetsBundle> findWidgetsBundles(TenantId tenantId, PageLink pageLink) {
 | 
			
		||||
        return widgetsBundleService.findAllTenantWidgetsBundlesByTenantIdAndPageLink(tenantId, pageLink);
 | 
			
		||||
        return widgetsBundleService.findTenantWidgetsBundlesByTenantId(tenantId, pageLink);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -243,7 +243,7 @@ public class DefaultTbNotificationEntityService implements TbNotificationEntityS
 | 
			
		||||
            try {
 | 
			
		||||
                if (!relation.getFrom().getEntityType().equals(EntityType.EDGE) &&
 | 
			
		||||
                        !relation.getTo().getEntityType().equals(EntityType.EDGE)) {
 | 
			
		||||
                    sendNotificationMsgToEdgeService(tenantId, null, null, json.writeValueAsString(relation),
 | 
			
		||||
                    sendNotificationMsgToEdge(tenantId, null, null, json.writeValueAsString(relation),
 | 
			
		||||
                            EdgeEventType.RELATION, edgeTypeByActionType(actionType));
 | 
			
		||||
                }
 | 
			
		||||
            } catch (Exception e1) {
 | 
			
		||||
@ -267,18 +267,18 @@ public class DefaultTbNotificationEntityService implements TbNotificationEntityS
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private void sendEntityNotificationMsg(TenantId tenantId, EntityId entityId, EdgeEventActionType action) {
 | 
			
		||||
        sendNotificationMsgToEdgeService(tenantId, null, entityId, null, null, action);
 | 
			
		||||
        sendNotificationMsgToEdge(tenantId, null, entityId, null, null, action);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private void sendEntityAssignToCustomerNotificationMsg(TenantId tenantId, EntityId entityId, CustomerId customerId, EdgeEventActionType action) {
 | 
			
		||||
        try {
 | 
			
		||||
            sendNotificationMsgToEdgeService(tenantId, null, entityId, json.writeValueAsString(customerId), null, action);
 | 
			
		||||
            sendNotificationMsgToEdge(tenantId, null, entityId, json.writeValueAsString(customerId), null, action);
 | 
			
		||||
        } catch (Exception e) {
 | 
			
		||||
            log.warn("Failed to push assign/unassign to/from customer to core: {}", customerId, e);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    protected void sendAlarmDeleteNotificationMsg(TenantId tenantId, Alarm alarm, List<EdgeId> edgeIds, String body) {
 | 
			
		||||
    private void sendAlarmDeleteNotificationMsg(TenantId tenantId, Alarm alarm, List<EdgeId> edgeIds, String body) {
 | 
			
		||||
        try {
 | 
			
		||||
            sendDeleteNotificationMsg(tenantId, alarm.getId(), edgeIds, body);
 | 
			
		||||
        } catch (Exception e) {
 | 
			
		||||
@ -286,8 +286,7 @@ public class DefaultTbNotificationEntityService implements TbNotificationEntityS
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    protected <E extends HasName, I extends EntityId> void sendDeleteNotificationMsg(TenantId tenantId, I entityId, E entity,
 | 
			
		||||
                                                                                     List<EdgeId> edgeIds) {
 | 
			
		||||
    private <E extends HasName, I extends EntityId> void sendDeleteNotificationMsg(TenantId tenantId, I entityId, E entity, List<EdgeId> edgeIds) {
 | 
			
		||||
        try {
 | 
			
		||||
            sendDeleteNotificationMsg(tenantId, entityId, edgeIds, null);
 | 
			
		||||
        } catch (Exception e) {
 | 
			
		||||
@ -298,17 +297,17 @@ public class DefaultTbNotificationEntityService implements TbNotificationEntityS
 | 
			
		||||
    private void sendDeleteNotificationMsg(TenantId tenantId, EntityId entityId, List<EdgeId> edgeIds, String body) {
 | 
			
		||||
        if (edgeIds != null && !edgeIds.isEmpty()) {
 | 
			
		||||
            for (EdgeId edgeId : edgeIds) {
 | 
			
		||||
                sendNotificationMsgToEdgeService(tenantId, edgeId, entityId, body, null, EdgeEventActionType.DELETED);
 | 
			
		||||
                sendNotificationMsgToEdge(tenantId, edgeId, entityId, body, null, EdgeEventActionType.DELETED);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private void sendEntityAssignToEdgeNotificationMsg(TenantId tenantId, EdgeId edgeId, EntityId entityId, EdgeEventActionType action) {
 | 
			
		||||
        sendNotificationMsgToEdgeService(tenantId, edgeId, entityId, null, null, action);
 | 
			
		||||
        sendNotificationMsgToEdge(tenantId, edgeId, entityId, null, null, action);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private void sendNotificationMsgToEdgeService(TenantId tenantId, EdgeId edgeId, EntityId entityId, String body, EdgeEventType type, EdgeEventActionType action) {
 | 
			
		||||
        tbClusterService.sendNotificationMsgToEdgeService(tenantId, edgeId, entityId, body, type, action);
 | 
			
		||||
    private void sendNotificationMsgToEdge(TenantId tenantId, EdgeId edgeId, EntityId entityId, String body, EdgeEventType type, EdgeEventActionType action) {
 | 
			
		||||
        tbClusterService.sendNotificationMsgToEdge(tenantId, edgeId, entityId, body, type, action);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private void pushAssignedFromNotification(Tenant currentTenant, TenantId newTenantId, Device assignedDevice) {
 | 
			
		||||
 | 
			
		||||
@ -441,12 +441,12 @@ public class DefaultTbClusterService implements TbClusterService {
 | 
			
		||||
        sendDeviceStateServiceEvent(device.getTenantId(), device.getId(), created, !created, false);
 | 
			
		||||
        otaPackageStateService.update(device, old);
 | 
			
		||||
        if (!created && notifyEdge) {
 | 
			
		||||
            sendNotificationMsgToEdgeService(device.getTenantId(), null, device.getId(), null, null, EdgeEventActionType.UPDATED);
 | 
			
		||||
            sendNotificationMsgToEdge(device.getTenantId(), null, device.getId(), null, null, EdgeEventActionType.UPDATED);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void sendNotificationMsgToEdgeService(TenantId tenantId, EdgeId edgeId, EntityId entityId, String body, EdgeEventType type, EdgeEventActionType action) {
 | 
			
		||||
    public void sendNotificationMsgToEdge(TenantId tenantId, EdgeId edgeId, EntityId entityId, String body, EdgeEventType type, EdgeEventActionType action) {
 | 
			
		||||
        if (!edgesEnabled) {
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@ -56,7 +56,7 @@ public class AssetImportService extends BaseEntityImportService<AssetId, Asset,
 | 
			
		||||
    protected void onEntitySaved(SecurityUser user, Asset savedAsset, Asset oldAsset) throws ThingsboardException {
 | 
			
		||||
        super.onEntitySaved(user, savedAsset, oldAsset);
 | 
			
		||||
        if (oldAsset != null) {
 | 
			
		||||
            entityActionService.sendEntityNotificationMsgToEdgeService(user.getTenantId(), savedAsset.getId(), EdgeEventActionType.UPDATED);
 | 
			
		||||
            entityActionService.sendEntityNotificationMsgToEdge(user.getTenantId(), savedAsset.getId(), EdgeEventActionType.UPDATED);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -72,7 +72,7 @@ public class CustomerImportService extends BaseEntityImportService<CustomerId, C
 | 
			
		||||
    protected void onEntitySaved(SecurityUser user, Customer savedCustomer, Customer oldCustomer) throws ThingsboardException {
 | 
			
		||||
        super.onEntitySaved(user, savedCustomer, oldCustomer);
 | 
			
		||||
        if (oldCustomer != null) {
 | 
			
		||||
            entityActionService.sendEntityNotificationMsgToEdgeService(user.getTenantId(), savedCustomer.getId(), EdgeEventActionType.UPDATED);
 | 
			
		||||
            entityActionService.sendEntityNotificationMsgToEdge(user.getTenantId(), savedCustomer.getId(), EdgeEventActionType.UPDATED);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -16,8 +16,6 @@
 | 
			
		||||
package org.thingsboard.server.service.sync.ie.importing.impl;
 | 
			
		||||
 | 
			
		||||
import com.fasterxml.jackson.databind.JsonNode;
 | 
			
		||||
import com.fasterxml.jackson.databind.node.ObjectNode;
 | 
			
		||||
import com.google.common.collect.Lists;
 | 
			
		||||
import lombok.RequiredArgsConstructor;
 | 
			
		||||
import org.springframework.stereotype.Service;
 | 
			
		||||
import org.thingsboard.common.util.JacksonUtil;
 | 
			
		||||
@ -28,23 +26,19 @@ import org.thingsboard.server.common.data.edge.EdgeEventActionType;
 | 
			
		||||
import org.thingsboard.server.common.data.exception.ThingsboardException;
 | 
			
		||||
import org.thingsboard.server.common.data.id.CustomerId;
 | 
			
		||||
import org.thingsboard.server.common.data.id.DashboardId;
 | 
			
		||||
import org.thingsboard.server.common.data.id.EntityId;
 | 
			
		||||
import org.thingsboard.server.common.data.id.TenantId;
 | 
			
		||||
import org.thingsboard.server.common.data.sync.ie.EntityExportData;
 | 
			
		||||
import org.thingsboard.server.dao.dashboard.DashboardService;
 | 
			
		||||
import org.thingsboard.server.queue.util.TbCoreComponent;
 | 
			
		||||
import org.thingsboard.server.service.security.model.SecurityUser;
 | 
			
		||||
import org.thingsboard.server.service.sync.vc.data.EntitiesImportCtx;
 | 
			
		||||
import org.thingsboard.common.util.RegexUtils;
 | 
			
		||||
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import java.util.Arrays;
 | 
			
		||||
import java.util.Collections;
 | 
			
		||||
import java.util.HashSet;
 | 
			
		||||
import java.util.LinkedHashSet;
 | 
			
		||||
import java.util.Optional;
 | 
			
		||||
import java.util.Set;
 | 
			
		||||
import java.util.UUID;
 | 
			
		||||
import java.util.stream.Collectors;
 | 
			
		||||
 | 
			
		||||
@Service
 | 
			
		||||
@ -127,7 +121,7 @@ public class DashboardImportService extends BaseEntityImportService<DashboardId,
 | 
			
		||||
    protected void onEntitySaved(SecurityUser user, Dashboard savedDashboard, Dashboard oldDashboard) throws ThingsboardException {
 | 
			
		||||
        super.onEntitySaved(user, savedDashboard, oldDashboard);
 | 
			
		||||
        if (oldDashboard != null) {
 | 
			
		||||
            entityActionService.sendEntityNotificationMsgToEdgeService(user.getTenantId(), savedDashboard.getId(), EdgeEventActionType.UPDATED);
 | 
			
		||||
            entityActionService.sendEntityNotificationMsgToEdge(user.getTenantId(), savedDashboard.getId(), EdgeEventActionType.UPDATED);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -66,7 +66,7 @@ public class DeviceProfileImportService extends BaseEntityImportService<DevicePr
 | 
			
		||||
        clusterService.onDeviceProfileChange(savedDeviceProfile, null);
 | 
			
		||||
        clusterService.broadcastEntityStateChangeEvent(user.getTenantId(), savedDeviceProfile.getId(),
 | 
			
		||||
                oldDeviceProfile == null ? ComponentLifecycleEvent.CREATED : ComponentLifecycleEvent.UPDATED);
 | 
			
		||||
        entityActionService.sendEntityNotificationMsgToEdgeService(user.getTenantId(), savedDeviceProfile.getId(),
 | 
			
		||||
        entityActionService.sendEntityNotificationMsgToEdge(user.getTenantId(), savedDeviceProfile.getId(),
 | 
			
		||||
                oldDeviceProfile == null ? EdgeEventActionType.ADDED : EdgeEventActionType.UPDATED);
 | 
			
		||||
        otaPackageStateService.update(savedDeviceProfile,
 | 
			
		||||
                oldDeviceProfile != null && !Objects.equals(oldDeviceProfile.getFirmwareId(), savedDeviceProfile.getFirmwareId()),
 | 
			
		||||
 | 
			
		||||
@ -21,7 +21,6 @@ import org.springframework.context.annotation.Lazy;
 | 
			
		||||
import org.springframework.stereotype.Service;
 | 
			
		||||
import org.thingsboard.server.common.data.EntityType;
 | 
			
		||||
import org.thingsboard.server.common.data.EntityView;
 | 
			
		||||
import org.thingsboard.server.common.data.asset.Asset;
 | 
			
		||||
import org.thingsboard.server.common.data.edge.EdgeEventActionType;
 | 
			
		||||
import org.thingsboard.server.common.data.exception.ThingsboardException;
 | 
			
		||||
import org.thingsboard.server.common.data.id.EntityViewId;
 | 
			
		||||
@ -66,7 +65,7 @@ public class EntityViewImportService extends BaseEntityImportService<EntityViewI
 | 
			
		||||
        tbEntityViewService.updateEntityViewAttributes(user, savedEntityView, oldEntityView);
 | 
			
		||||
        super.onEntitySaved(user, savedEntityView, oldEntityView);
 | 
			
		||||
        if (oldEntityView != null) {
 | 
			
		||||
            entityActionService.sendEntityNotificationMsgToEdgeService(user.getTenantId(), savedEntityView.getId(), EdgeEventActionType.UPDATED);
 | 
			
		||||
            entityActionService.sendEntityNotificationMsgToEdge(user.getTenantId(), savedEntityView.getId(), EdgeEventActionType.UPDATED);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -15,11 +15,9 @@
 | 
			
		||||
 */
 | 
			
		||||
package org.thingsboard.server.service.sync.ie.importing.impl;
 | 
			
		||||
 | 
			
		||||
import com.fasterxml.jackson.databind.JsonNode;
 | 
			
		||||
import lombok.RequiredArgsConstructor;
 | 
			
		||||
import lombok.extern.slf4j.Slf4j;
 | 
			
		||||
import org.springframework.stereotype.Service;
 | 
			
		||||
import org.thingsboard.common.util.JacksonUtil;
 | 
			
		||||
import org.thingsboard.server.common.data.EntityType;
 | 
			
		||||
import org.thingsboard.server.common.data.edge.EdgeEventActionType;
 | 
			
		||||
import org.thingsboard.server.common.data.exception.ThingsboardException;
 | 
			
		||||
@ -37,14 +35,12 @@ import org.thingsboard.server.dao.rule.RuleNodeDao;
 | 
			
		||||
import org.thingsboard.server.queue.util.TbCoreComponent;
 | 
			
		||||
import org.thingsboard.server.service.security.model.SecurityUser;
 | 
			
		||||
import org.thingsboard.server.service.sync.vc.data.EntitiesImportCtx;
 | 
			
		||||
import org.thingsboard.common.util.RegexUtils;
 | 
			
		||||
 | 
			
		||||
import java.util.Arrays;
 | 
			
		||||
import java.util.Collections;
 | 
			
		||||
import java.util.LinkedHashSet;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
import java.util.Optional;
 | 
			
		||||
import java.util.UUID;
 | 
			
		||||
import java.util.stream.Collectors;
 | 
			
		||||
 | 
			
		||||
@Slf4j
 | 
			
		||||
@ -135,7 +131,7 @@ public class RuleChainImportService extends BaseEntityImportService<RuleChainId,
 | 
			
		||||
            clusterService.broadcastEntityStateChangeEvent(user.getTenantId(), savedRuleChain.getId(),
 | 
			
		||||
                    oldRuleChain == null ? ComponentLifecycleEvent.CREATED : ComponentLifecycleEvent.UPDATED);
 | 
			
		||||
        } else if (savedRuleChain.getType() == RuleChainType.EDGE && oldRuleChain != null) {
 | 
			
		||||
            entityActionService.sendEntityNotificationMsgToEdgeService(user.getTenantId(), savedRuleChain.getId(), EdgeEventActionType.UPDATED);
 | 
			
		||||
            entityActionService.sendEntityNotificationMsgToEdge(user.getTenantId(), savedRuleChain.getId(), EdgeEventActionType.UPDATED);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -124,7 +124,7 @@ public abstract class AbstractNotifyEntityTest extends AbstractWebTest {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private void testNotificationMsgToEdgeServiceNever(EntityId entityId) {
 | 
			
		||||
        Mockito.verify(tbClusterService, never()).sendNotificationMsgToEdgeService(Mockito.any(),
 | 
			
		||||
        Mockito.verify(tbClusterService, never()).sendNotificationMsgToEdge(Mockito.any(),
 | 
			
		||||
                Mockito.any(), Mockito.any(entityId.getClass()), Mockito.any(), Mockito.any(), Mockito.any());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -159,7 +159,7 @@ public abstract class AbstractNotifyEntityTest extends AbstractWebTest {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private void testSendNotificationMsgToEdgeServiceOneTime(EntityId entityId, TenantId tenantId, ActionType actionType) {
 | 
			
		||||
        Mockito.verify(tbClusterService, times(1)).sendNotificationMsgToEdgeService(Mockito.eq(tenantId),
 | 
			
		||||
        Mockito.verify(tbClusterService, times(1)).sendNotificationMsgToEdge(Mockito.eq(tenantId),
 | 
			
		||||
                Mockito.isNull(), Mockito.eq(entityId), Mockito.isNull(), Mockito.isNull(),
 | 
			
		||||
                Mockito.eq(edgeTypeByActionType(actionType)));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -476,7 +476,7 @@ public class ExportImportServiceSqlTest extends BaseExportImportServiceTest {
 | 
			
		||||
        Customer updatedCustomer = importEntity(tenantAdmin2, updatedCustomerEntity).getSavedEntity();
 | 
			
		||||
        verify(entityActionService).logEntityAction(any(), eq(importedCustomer.getId()), eq(updatedCustomer),
 | 
			
		||||
                any(), eq(ActionType.UPDATED), isNull());
 | 
			
		||||
        verify(tbClusterService).sendNotificationMsgToEdgeService(any(), any(), eq(importedCustomer.getId()), any(), any(), eq(EdgeEventActionType.UPDATED));
 | 
			
		||||
        verify(tbClusterService).sendNotificationMsgToEdge(any(), any(), eq(importedCustomer.getId()), any(), any(), eq(EdgeEventActionType.UPDATED));
 | 
			
		||||
 | 
			
		||||
        Mockito.reset(entityActionService);
 | 
			
		||||
 | 
			
		||||
@ -494,7 +494,7 @@ public class ExportImportServiceSqlTest extends BaseExportImportServiceTest {
 | 
			
		||||
 | 
			
		||||
        verify(entityActionService).logEntityAction(any(), eq(importedAsset.getId()), eq(updatedAsset),
 | 
			
		||||
                any(), eq(ActionType.UPDATED), isNull());
 | 
			
		||||
        verify(tbClusterService).sendNotificationMsgToEdgeService(any(), any(), eq(importedAsset.getId()), any(), any(), eq(EdgeEventActionType.UPDATED));
 | 
			
		||||
        verify(tbClusterService).sendNotificationMsgToEdge(any(), any(), eq(importedAsset.getId()), any(), any(), eq(EdgeEventActionType.UPDATED));
 | 
			
		||||
 | 
			
		||||
        RuleChain importedRuleChain = (RuleChain) importEntity(tenantAdmin2, getAndClone(entitiesExportData, EntityType.RULE_CHAIN)).getSavedEntity();
 | 
			
		||||
        verify(entityActionService).logEntityAction(any(), eq(importedRuleChain.getId()), eq(importedRuleChain),
 | 
			
		||||
@ -510,7 +510,7 @@ public class ExportImportServiceSqlTest extends BaseExportImportServiceTest {
 | 
			
		||||
                any(), eq(ActionType.ADDED), isNull());
 | 
			
		||||
        verify(tbClusterService).onDeviceProfileChange(eq(importedDeviceProfile), any());
 | 
			
		||||
        verify(tbClusterService).broadcastEntityStateChangeEvent(any(), eq(importedDeviceProfile.getId()), eq(ComponentLifecycleEvent.CREATED));
 | 
			
		||||
        verify(tbClusterService).sendNotificationMsgToEdgeService(any(), any(), eq(importedDeviceProfile.getId()), any(), any(), eq(EdgeEventActionType.ADDED));
 | 
			
		||||
        verify(tbClusterService).sendNotificationMsgToEdge(any(), any(), eq(importedDeviceProfile.getId()), any(), any(), eq(EdgeEventActionType.ADDED));
 | 
			
		||||
        verify(otaPackageStateService).update(eq(importedDeviceProfile), eq(false), eq(false));
 | 
			
		||||
 | 
			
		||||
        Device importedDevice = (Device) importEntity(tenantAdmin2, getAndClone(entitiesExportData, EntityType.DEVICE)).getSavedEntity();
 | 
			
		||||
 | 
			
		||||
@ -88,5 +88,5 @@ public interface TbClusterService extends TbQueueClusterService {
 | 
			
		||||
 | 
			
		||||
    void onEdgeEventUpdate(TenantId tenantId, EdgeId edgeId);
 | 
			
		||||
 | 
			
		||||
    void sendNotificationMsgToEdgeService(TenantId tenantId, EdgeId edgeId, EntityId entityId, String body, EdgeEventType type, EdgeEventActionType action);
 | 
			
		||||
    void sendNotificationMsgToEdge(TenantId tenantId, EdgeId edgeId, EntityId entityId, String body, EdgeEventType type, EdgeEventActionType action);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user