fixed proto utils test

This commit is contained in:
IrynaMatveieva 2025-02-17 14:55:04 +02:00
parent 1e46100cd2
commit 5e9ee15b1d

View File

@ -31,6 +31,7 @@ import org.thingsboard.server.common.data.EdgeUtils;
import org.thingsboard.server.common.data.EntityType; import org.thingsboard.server.common.data.EntityType;
import org.thingsboard.server.common.data.ResourceSubType; import org.thingsboard.server.common.data.ResourceSubType;
import org.thingsboard.server.common.data.ResourceType; import org.thingsboard.server.common.data.ResourceType;
import org.thingsboard.server.common.data.StringUtils;
import org.thingsboard.server.common.data.TbResource; import org.thingsboard.server.common.data.TbResource;
import org.thingsboard.server.common.data.Tenant; import org.thingsboard.server.common.data.Tenant;
import org.thingsboard.server.common.data.TenantProfile; import org.thingsboard.server.common.data.TenantProfile;
@ -148,9 +149,13 @@ public class ProtoUtils {
var builder = ComponentLifecycleMsg.builder() var builder = ComponentLifecycleMsg.builder()
.tenantId(TenantId.fromUUID(new UUID(proto.getTenantIdMSB(), proto.getTenantIdLSB()))) .tenantId(TenantId.fromUUID(new UUID(proto.getTenantIdMSB(), proto.getTenantIdLSB())))
.entityId(entityId) .entityId(entityId)
.event(ComponentLifecycleEvent.values()[proto.getEventValue()]) .event(ComponentLifecycleEvent.values()[proto.getEventValue()]);
.name(proto.getName()) if (!StringUtils.isEmpty(proto.getName())) {
.oldName(proto.getOldName()); builder.name(proto.getName());
}
if (!StringUtils.isEmpty(proto.getOldName())) {
builder.oldName(proto.getOldName());
}
if (proto.getProfileIdMSB() != 0 || proto.getProfileIdLSB() != 0) { if (proto.getProfileIdMSB() != 0 || proto.getProfileIdLSB() != 0) {
var profileType = EntityType.DEVICE.equals(entityId.getEntityType()) ? EntityType.DEVICE_PROFILE : EntityType.ASSET_PROFILE; var profileType = EntityType.DEVICE.equals(entityId.getEntityType()) ? EntityType.DEVICE_PROFILE : EntityType.ASSET_PROFILE;
builder.profileId(EntityIdFactory.getByTypeAndUuid(profileType, new UUID(proto.getProfileIdMSB(), proto.getProfileIdLSB()))); builder.profileId(EntityIdFactory.getByTypeAndUuid(profileType, new UUID(proto.getProfileIdMSB(), proto.getProfileIdLSB())));