Merge PR 5039
This commit is contained in:
commit
6eba6db64c
@ -1,52 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright © 2016-2021 The Thingsboard Authors
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
package org.thingsboard.server.service.edge.rpc;
|
|
||||||
|
|
||||||
import com.google.protobuf.BoolValue;
|
|
||||||
import com.google.protobuf.ByteString;
|
|
||||||
import com.google.protobuf.BytesValue;
|
|
||||||
import com.google.protobuf.Int64Value;
|
|
||||||
import com.google.protobuf.StringValue;
|
|
||||||
|
|
||||||
public class EdgeProtoUtils {
|
|
||||||
|
|
||||||
private EdgeProtoUtils() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public static BoolValue getBoolValue(Boolean value) {
|
|
||||||
BoolValue.Builder builder = BoolValue.newBuilder();
|
|
||||||
builder.setValue(value);
|
|
||||||
return builder.build();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static StringValue getStringValue(String value) {
|
|
||||||
StringValue.Builder builder = StringValue.newBuilder();
|
|
||||||
builder.setValue(value);
|
|
||||||
return builder.build();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Int64Value getInt64Value(Long value) {
|
|
||||||
Int64Value.Builder builder = Int64Value.newBuilder();
|
|
||||||
builder.setValue(value);
|
|
||||||
return builder.build();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static BytesValue getBytesValue(ByteString value) {
|
|
||||||
BytesValue.Builder builder = BytesValue.newBuilder();
|
|
||||||
builder.setValue(value);
|
|
||||||
return builder.build();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -16,17 +16,14 @@
|
|||||||
package org.thingsboard.server.service.edge.rpc.constructor;
|
package org.thingsboard.server.service.edge.rpc.constructor;
|
||||||
|
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.thingsboard.common.util.JacksonUtil;
|
||||||
import org.thingsboard.server.common.data.asset.Asset;
|
import org.thingsboard.server.common.data.asset.Asset;
|
||||||
import org.thingsboard.server.common.data.id.AssetId;
|
import org.thingsboard.server.common.data.id.AssetId;
|
||||||
import org.thingsboard.server.common.data.id.CustomerId;
|
import org.thingsboard.server.common.data.id.CustomerId;
|
||||||
import org.thingsboard.common.util.JacksonUtil;
|
|
||||||
import org.thingsboard.server.gen.edge.v1.AssetUpdateMsg;
|
import org.thingsboard.server.gen.edge.v1.AssetUpdateMsg;
|
||||||
import org.thingsboard.server.gen.edge.v1.UpdateMsgType;
|
import org.thingsboard.server.gen.edge.v1.UpdateMsgType;
|
||||||
import org.thingsboard.server.queue.util.TbCoreComponent;
|
import org.thingsboard.server.queue.util.TbCoreComponent;
|
||||||
|
|
||||||
import static org.thingsboard.server.service.edge.rpc.EdgeProtoUtils.getInt64Value;
|
|
||||||
import static org.thingsboard.server.service.edge.rpc.EdgeProtoUtils.getStringValue;
|
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@TbCoreComponent
|
@TbCoreComponent
|
||||||
public class AssetMsgConstructor {
|
public class AssetMsgConstructor {
|
||||||
@ -39,14 +36,14 @@ public class AssetMsgConstructor {
|
|||||||
.setName(asset.getName())
|
.setName(asset.getName())
|
||||||
.setType(asset.getType());
|
.setType(asset.getType());
|
||||||
if (asset.getLabel() != null) {
|
if (asset.getLabel() != null) {
|
||||||
builder.setLabel(getStringValue(asset.getLabel()));
|
builder.setLabel(asset.getLabel());
|
||||||
}
|
}
|
||||||
if (customerId != null) {
|
if (customerId != null) {
|
||||||
builder.setCustomerIdMSB(getInt64Value(customerId.getId().getMostSignificantBits()));
|
builder.setCustomerIdMSB(customerId.getId().getMostSignificantBits());
|
||||||
builder.setCustomerIdLSB(getInt64Value(customerId.getId().getLeastSignificantBits()));
|
builder.setCustomerIdLSB(customerId.getId().getLeastSignificantBits());
|
||||||
}
|
}
|
||||||
if (asset.getAdditionalInfo() != null) {
|
if (asset.getAdditionalInfo() != null) {
|
||||||
builder.setAdditionalInfo(getStringValue(JacksonUtil.toString(asset.getAdditionalInfo())));
|
builder.setAdditionalInfo(JacksonUtil.toString(asset.getAdditionalInfo()));
|
||||||
}
|
}
|
||||||
return builder.build();
|
return builder.build();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,15 +16,13 @@
|
|||||||
package org.thingsboard.server.service.edge.rpc.constructor;
|
package org.thingsboard.server.service.edge.rpc.constructor;
|
||||||
|
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.thingsboard.common.util.JacksonUtil;
|
||||||
import org.thingsboard.server.common.data.Customer;
|
import org.thingsboard.server.common.data.Customer;
|
||||||
import org.thingsboard.server.common.data.id.CustomerId;
|
import org.thingsboard.server.common.data.id.CustomerId;
|
||||||
import org.thingsboard.common.util.JacksonUtil;
|
|
||||||
import org.thingsboard.server.gen.edge.v1.CustomerUpdateMsg;
|
import org.thingsboard.server.gen.edge.v1.CustomerUpdateMsg;
|
||||||
import org.thingsboard.server.gen.edge.v1.UpdateMsgType;
|
import org.thingsboard.server.gen.edge.v1.UpdateMsgType;
|
||||||
import org.thingsboard.server.queue.util.TbCoreComponent;
|
import org.thingsboard.server.queue.util.TbCoreComponent;
|
||||||
|
|
||||||
import static org.thingsboard.server.service.edge.rpc.EdgeProtoUtils.getStringValue;
|
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@TbCoreComponent
|
@TbCoreComponent
|
||||||
public class CustomerMsgConstructor {
|
public class CustomerMsgConstructor {
|
||||||
@ -36,31 +34,31 @@ public class CustomerMsgConstructor {
|
|||||||
.setIdLSB(customer.getId().getId().getLeastSignificantBits())
|
.setIdLSB(customer.getId().getId().getLeastSignificantBits())
|
||||||
.setTitle(customer.getTitle());
|
.setTitle(customer.getTitle());
|
||||||
if (customer.getCountry() != null) {
|
if (customer.getCountry() != null) {
|
||||||
builder.setCountry(getStringValue(customer.getCountry()));
|
builder.setCountry(customer.getCountry());
|
||||||
}
|
}
|
||||||
if (customer.getState() != null) {
|
if (customer.getState() != null) {
|
||||||
builder.setState(getStringValue(customer.getState()));
|
builder.setState(customer.getState());
|
||||||
}
|
}
|
||||||
if (customer.getCity() != null) {
|
if (customer.getCity() != null) {
|
||||||
builder.setCity(getStringValue(customer.getCity()));
|
builder.setCity(customer.getCity());
|
||||||
}
|
}
|
||||||
if (customer.getAddress() != null) {
|
if (customer.getAddress() != null) {
|
||||||
builder.setAddress(getStringValue(customer.getAddress()));
|
builder.setAddress(customer.getAddress());
|
||||||
}
|
}
|
||||||
if (customer.getAddress2() != null) {
|
if (customer.getAddress2() != null) {
|
||||||
builder.setAddress2(getStringValue(customer.getAddress2()));
|
builder.setAddress2(customer.getAddress2());
|
||||||
}
|
}
|
||||||
if (customer.getZip() != null) {
|
if (customer.getZip() != null) {
|
||||||
builder.setZip(getStringValue(customer.getZip()));
|
builder.setZip(customer.getZip());
|
||||||
}
|
}
|
||||||
if (customer.getPhone() != null) {
|
if (customer.getPhone() != null) {
|
||||||
builder.setPhone(getStringValue(customer.getPhone()));
|
builder.setPhone(customer.getPhone());
|
||||||
}
|
}
|
||||||
if (customer.getEmail() != null) {
|
if (customer.getEmail() != null) {
|
||||||
builder.setEmail(getStringValue(customer.getEmail()));
|
builder.setEmail(customer.getEmail());
|
||||||
}
|
}
|
||||||
if (customer.getAdditionalInfo() != null) {
|
if (customer.getAdditionalInfo() != null) {
|
||||||
builder.setAdditionalInfo(getStringValue(JacksonUtil.toString(customer.getAdditionalInfo())));
|
builder.setAdditionalInfo(JacksonUtil.toString(customer.getAdditionalInfo()));
|
||||||
}
|
}
|
||||||
return builder.build();
|
return builder.build();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,16 +16,14 @@
|
|||||||
package org.thingsboard.server.service.edge.rpc.constructor;
|
package org.thingsboard.server.service.edge.rpc.constructor;
|
||||||
|
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.thingsboard.common.util.JacksonUtil;
|
||||||
import org.thingsboard.server.common.data.Dashboard;
|
import org.thingsboard.server.common.data.Dashboard;
|
||||||
import org.thingsboard.server.common.data.id.CustomerId;
|
import org.thingsboard.server.common.data.id.CustomerId;
|
||||||
import org.thingsboard.server.common.data.id.DashboardId;
|
import org.thingsboard.server.common.data.id.DashboardId;
|
||||||
import org.thingsboard.common.util.JacksonUtil;
|
|
||||||
import org.thingsboard.server.gen.edge.v1.DashboardUpdateMsg;
|
import org.thingsboard.server.gen.edge.v1.DashboardUpdateMsg;
|
||||||
import org.thingsboard.server.gen.edge.v1.UpdateMsgType;
|
import org.thingsboard.server.gen.edge.v1.UpdateMsgType;
|
||||||
import org.thingsboard.server.queue.util.TbCoreComponent;
|
import org.thingsboard.server.queue.util.TbCoreComponent;
|
||||||
|
|
||||||
import static org.thingsboard.server.service.edge.rpc.EdgeProtoUtils.getInt64Value;
|
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@TbCoreComponent
|
@TbCoreComponent
|
||||||
public class DashboardMsgConstructor {
|
public class DashboardMsgConstructor {
|
||||||
@ -38,8 +36,8 @@ public class DashboardMsgConstructor {
|
|||||||
.setTitle(dashboard.getTitle())
|
.setTitle(dashboard.getTitle())
|
||||||
.setConfiguration(JacksonUtil.toString(dashboard.getConfiguration()));
|
.setConfiguration(JacksonUtil.toString(dashboard.getConfiguration()));
|
||||||
if (customerId != null) {
|
if (customerId != null) {
|
||||||
builder.setCustomerIdMSB(getInt64Value(customerId.getId().getMostSignificantBits()));
|
builder.setCustomerIdMSB(customerId.getId().getMostSignificantBits());
|
||||||
builder.setCustomerIdLSB(getInt64Value(customerId.getId().getLeastSignificantBits()));
|
builder.setCustomerIdLSB(customerId.getId().getLeastSignificantBits());
|
||||||
}
|
}
|
||||||
return builder.build();
|
return builder.build();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -32,9 +32,6 @@ import org.thingsboard.server.queue.util.TbCoreComponent;
|
|||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import static org.thingsboard.server.service.edge.rpc.EdgeProtoUtils.getInt64Value;
|
|
||||||
import static org.thingsboard.server.service.edge.rpc.EdgeProtoUtils.getStringValue;
|
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@TbCoreComponent
|
@TbCoreComponent
|
||||||
public class DeviceMsgConstructor {
|
public class DeviceMsgConstructor {
|
||||||
@ -49,21 +46,21 @@ public class DeviceMsgConstructor {
|
|||||||
.setName(device.getName())
|
.setName(device.getName())
|
||||||
.setType(device.getType());
|
.setType(device.getType());
|
||||||
if (device.getLabel() != null) {
|
if (device.getLabel() != null) {
|
||||||
builder.setLabel(getStringValue(device.getLabel()));
|
builder.setLabel(device.getLabel());
|
||||||
}
|
}
|
||||||
if (customerId != null) {
|
if (customerId != null) {
|
||||||
builder.setCustomerIdMSB(getInt64Value(customerId.getId().getMostSignificantBits()));
|
builder.setCustomerIdMSB(customerId.getId().getMostSignificantBits());
|
||||||
builder.setCustomerIdLSB(getInt64Value(customerId.getId().getLeastSignificantBits()));
|
builder.setCustomerIdLSB(customerId.getId().getLeastSignificantBits());
|
||||||
}
|
}
|
||||||
if (device.getDeviceProfileId() != null) {
|
if (device.getDeviceProfileId() != null) {
|
||||||
builder.setDeviceProfileIdMSB(getInt64Value(device.getDeviceProfileId().getId().getMostSignificantBits()));
|
builder.setDeviceProfileIdMSB(device.getDeviceProfileId().getId().getMostSignificantBits());
|
||||||
builder.setDeviceProfileIdLSB(getInt64Value(device.getDeviceProfileId().getId().getLeastSignificantBits()));
|
builder.setDeviceProfileIdLSB(device.getDeviceProfileId().getId().getLeastSignificantBits());
|
||||||
}
|
}
|
||||||
if (device.getAdditionalInfo() != null) {
|
if (device.getAdditionalInfo() != null) {
|
||||||
builder.setAdditionalInfo(getStringValue(JacksonUtil.toString(device.getAdditionalInfo())));
|
builder.setAdditionalInfo(JacksonUtil.toString(device.getAdditionalInfo()));
|
||||||
}
|
}
|
||||||
if (conflictName != null) {
|
if (conflictName != null) {
|
||||||
builder.setConflictName(getStringValue(conflictName));
|
builder.setConflictName(conflictName);
|
||||||
}
|
}
|
||||||
return builder.build();
|
return builder.build();
|
||||||
}
|
}
|
||||||
@ -77,7 +74,7 @@ public class DeviceMsgConstructor {
|
|||||||
.setCredentialsId(deviceCredentials.getCredentialsId());
|
.setCredentialsId(deviceCredentials.getCredentialsId());
|
||||||
}
|
}
|
||||||
if (deviceCredentials.getCredentialsValue() != null) {
|
if (deviceCredentials.getCredentialsValue() != null) {
|
||||||
builder.setCredentialsValue(getStringValue(deviceCredentials.getCredentialsValue()));
|
builder.setCredentialsValue(deviceCredentials.getCredentialsValue());
|
||||||
}
|
}
|
||||||
return builder.build();
|
return builder.build();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -27,9 +27,6 @@ import org.thingsboard.server.queue.util.TbCoreComponent;
|
|||||||
|
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
|
|
||||||
import static org.thingsboard.server.service.edge.rpc.EdgeProtoUtils.getBytesValue;
|
|
||||||
import static org.thingsboard.server.service.edge.rpc.EdgeProtoUtils.getStringValue;
|
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@TbCoreComponent
|
@TbCoreComponent
|
||||||
public class DeviceProfileMsgConstructor {
|
public class DeviceProfileMsgConstructor {
|
||||||
@ -55,19 +52,19 @@ public class DeviceProfileMsgConstructor {
|
|||||||
// builder.setDefaultQueueName(deviceProfile.getDefaultQueueName());
|
// builder.setDefaultQueueName(deviceProfile.getDefaultQueueName());
|
||||||
// }
|
// }
|
||||||
if (deviceProfile.getDescription() != null) {
|
if (deviceProfile.getDescription() != null) {
|
||||||
builder.setDescription(getStringValue(deviceProfile.getDescription()));
|
builder.setDescription(deviceProfile.getDescription());
|
||||||
}
|
}
|
||||||
if (deviceProfile.getTransportType() != null) {
|
if (deviceProfile.getTransportType() != null) {
|
||||||
builder.setTransportType(getStringValue(deviceProfile.getTransportType().name()));
|
builder.setTransportType(deviceProfile.getTransportType().name());
|
||||||
}
|
}
|
||||||
if (deviceProfile.getProvisionType() != null) {
|
if (deviceProfile.getProvisionType() != null) {
|
||||||
builder.setProvisionType(getStringValue(deviceProfile.getProvisionType().name()));
|
builder.setProvisionType(deviceProfile.getProvisionType().name());
|
||||||
}
|
}
|
||||||
if (deviceProfile.getProvisionDeviceKey() != null) {
|
if (deviceProfile.getProvisionDeviceKey() != null) {
|
||||||
builder.setProvisionDeviceKey(getStringValue(deviceProfile.getProvisionDeviceKey()));
|
builder.setProvisionDeviceKey(deviceProfile.getProvisionDeviceKey());
|
||||||
}
|
}
|
||||||
if (deviceProfile.getImage() != null) {
|
if (deviceProfile.getImage() != null) {
|
||||||
builder.setImage(getBytesValue(ByteString.copyFrom(deviceProfile.getImage().getBytes(StandardCharsets.UTF_8))));
|
builder.setImage(ByteString.copyFrom(deviceProfile.getImage().getBytes(StandardCharsets.UTF_8)));
|
||||||
}
|
}
|
||||||
return builder.build();
|
return builder.build();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,18 +16,15 @@
|
|||||||
package org.thingsboard.server.service.edge.rpc.constructor;
|
package org.thingsboard.server.service.edge.rpc.constructor;
|
||||||
|
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.thingsboard.common.util.JacksonUtil;
|
||||||
import org.thingsboard.server.common.data.EntityView;
|
import org.thingsboard.server.common.data.EntityView;
|
||||||
import org.thingsboard.server.common.data.id.CustomerId;
|
import org.thingsboard.server.common.data.id.CustomerId;
|
||||||
import org.thingsboard.server.common.data.id.EntityViewId;
|
import org.thingsboard.server.common.data.id.EntityViewId;
|
||||||
import org.thingsboard.common.util.JacksonUtil;
|
|
||||||
import org.thingsboard.server.gen.edge.v1.EdgeEntityType;
|
import org.thingsboard.server.gen.edge.v1.EdgeEntityType;
|
||||||
import org.thingsboard.server.gen.edge.v1.EntityViewUpdateMsg;
|
import org.thingsboard.server.gen.edge.v1.EntityViewUpdateMsg;
|
||||||
import org.thingsboard.server.gen.edge.v1.UpdateMsgType;
|
import org.thingsboard.server.gen.edge.v1.UpdateMsgType;
|
||||||
import org.thingsboard.server.queue.util.TbCoreComponent;
|
import org.thingsboard.server.queue.util.TbCoreComponent;
|
||||||
|
|
||||||
import static org.thingsboard.server.service.edge.rpc.EdgeProtoUtils.getInt64Value;
|
|
||||||
import static org.thingsboard.server.service.edge.rpc.EdgeProtoUtils.getStringValue;
|
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@TbCoreComponent
|
@TbCoreComponent
|
||||||
public class EntityViewMsgConstructor {
|
public class EntityViewMsgConstructor {
|
||||||
@ -54,11 +51,11 @@ public class EntityViewMsgConstructor {
|
|||||||
.setEntityIdLSB(entityView.getEntityId().getId().getLeastSignificantBits())
|
.setEntityIdLSB(entityView.getEntityId().getId().getLeastSignificantBits())
|
||||||
.setEntityType(entityType);
|
.setEntityType(entityType);
|
||||||
if (customerId != null) {
|
if (customerId != null) {
|
||||||
builder.setCustomerIdMSB(getInt64Value(customerId.getId().getMostSignificantBits()));
|
builder.setCustomerIdMSB(customerId.getId().getMostSignificantBits());
|
||||||
builder.setCustomerIdLSB(getInt64Value(customerId.getId().getLeastSignificantBits()));
|
builder.setCustomerIdLSB(customerId.getId().getLeastSignificantBits());
|
||||||
}
|
}
|
||||||
if (entityView.getAdditionalInfo() != null) {
|
if (entityView.getAdditionalInfo() != null) {
|
||||||
builder.setAdditionalInfo(getStringValue(JacksonUtil.toString(entityView.getAdditionalInfo())));
|
builder.setAdditionalInfo(JacksonUtil.toString(entityView.getAdditionalInfo()));
|
||||||
}
|
}
|
||||||
return builder.build();
|
return builder.build();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,14 +16,12 @@
|
|||||||
package org.thingsboard.server.service.edge.rpc.constructor;
|
package org.thingsboard.server.service.edge.rpc.constructor;
|
||||||
|
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.thingsboard.server.common.data.relation.EntityRelation;
|
|
||||||
import org.thingsboard.common.util.JacksonUtil;
|
import org.thingsboard.common.util.JacksonUtil;
|
||||||
|
import org.thingsboard.server.common.data.relation.EntityRelation;
|
||||||
import org.thingsboard.server.gen.edge.v1.RelationUpdateMsg;
|
import org.thingsboard.server.gen.edge.v1.RelationUpdateMsg;
|
||||||
import org.thingsboard.server.gen.edge.v1.UpdateMsgType;
|
import org.thingsboard.server.gen.edge.v1.UpdateMsgType;
|
||||||
import org.thingsboard.server.queue.util.TbCoreComponent;
|
import org.thingsboard.server.queue.util.TbCoreComponent;
|
||||||
|
|
||||||
import static org.thingsboard.server.service.edge.rpc.EdgeProtoUtils.getStringValue;
|
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@TbCoreComponent
|
@TbCoreComponent
|
||||||
public class RelationMsgConstructor {
|
public class RelationMsgConstructor {
|
||||||
@ -42,7 +40,7 @@ public class RelationMsgConstructor {
|
|||||||
builder.setAdditionalInfo(JacksonUtil.toString(entityRelation.getAdditionalInfo()));
|
builder.setAdditionalInfo(JacksonUtil.toString(entityRelation.getAdditionalInfo()));
|
||||||
}
|
}
|
||||||
if (entityRelation.getTypeGroup() != null) {
|
if (entityRelation.getTypeGroup() != null) {
|
||||||
builder.setTypeGroup(getStringValue(entityRelation.getTypeGroup().name()));
|
builder.setTypeGroup(entityRelation.getTypeGroup().name());
|
||||||
}
|
}
|
||||||
return builder.build();
|
return builder.build();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -19,13 +19,13 @@ import com.fasterxml.jackson.core.JsonProcessingException;
|
|||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.thingsboard.common.util.JacksonUtil;
|
||||||
import org.thingsboard.server.common.data.id.RuleChainId;
|
import org.thingsboard.server.common.data.id.RuleChainId;
|
||||||
import org.thingsboard.server.common.data.rule.NodeConnectionInfo;
|
import org.thingsboard.server.common.data.rule.NodeConnectionInfo;
|
||||||
import org.thingsboard.server.common.data.rule.RuleChain;
|
import org.thingsboard.server.common.data.rule.RuleChain;
|
||||||
import org.thingsboard.server.common.data.rule.RuleChainConnectionInfo;
|
import org.thingsboard.server.common.data.rule.RuleChainConnectionInfo;
|
||||||
import org.thingsboard.server.common.data.rule.RuleChainMetaData;
|
import org.thingsboard.server.common.data.rule.RuleChainMetaData;
|
||||||
import org.thingsboard.server.common.data.rule.RuleNode;
|
import org.thingsboard.server.common.data.rule.RuleNode;
|
||||||
import org.thingsboard.common.util.JacksonUtil;
|
|
||||||
import org.thingsboard.server.gen.edge.v1.NodeConnectionInfoProto;
|
import org.thingsboard.server.gen.edge.v1.NodeConnectionInfoProto;
|
||||||
import org.thingsboard.server.gen.edge.v1.RuleChainConnectionInfoProto;
|
import org.thingsboard.server.gen.edge.v1.RuleChainConnectionInfoProto;
|
||||||
import org.thingsboard.server.gen.edge.v1.RuleChainMetadataUpdateMsg;
|
import org.thingsboard.server.gen.edge.v1.RuleChainMetadataUpdateMsg;
|
||||||
@ -37,8 +37,6 @@ import org.thingsboard.server.queue.util.TbCoreComponent;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static org.thingsboard.server.service.edge.rpc.EdgeProtoUtils.getInt64Value;
|
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@TbCoreComponent
|
@TbCoreComponent
|
||||||
@ -56,8 +54,8 @@ public class RuleChainMsgConstructor {
|
|||||||
.setDebugMode(ruleChain.isDebugMode())
|
.setDebugMode(ruleChain.isDebugMode())
|
||||||
.setConfiguration(JacksonUtil.toString(ruleChain.getConfiguration()));
|
.setConfiguration(JacksonUtil.toString(ruleChain.getConfiguration()));
|
||||||
if (ruleChain.getFirstRuleNodeId() != null) {
|
if (ruleChain.getFirstRuleNodeId() != null) {
|
||||||
builder.setFirstRuleNodeIdMSB(getInt64Value(ruleChain.getFirstRuleNodeId().getId().getMostSignificantBits()))
|
builder.setFirstRuleNodeIdMSB(ruleChain.getFirstRuleNodeId().getId().getMostSignificantBits())
|
||||||
.setFirstRuleNodeIdLSB(getInt64Value(ruleChain.getFirstRuleNodeId().getId().getLeastSignificantBits()));
|
.setFirstRuleNodeIdLSB(ruleChain.getFirstRuleNodeId().getId().getLeastSignificantBits());
|
||||||
}
|
}
|
||||||
return builder.build();
|
return builder.build();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -26,9 +26,6 @@ import org.thingsboard.server.gen.edge.v1.UserCredentialsUpdateMsg;
|
|||||||
import org.thingsboard.server.gen.edge.v1.UserUpdateMsg;
|
import org.thingsboard.server.gen.edge.v1.UserUpdateMsg;
|
||||||
import org.thingsboard.server.queue.util.TbCoreComponent;
|
import org.thingsboard.server.queue.util.TbCoreComponent;
|
||||||
|
|
||||||
import static org.thingsboard.server.service.edge.rpc.EdgeProtoUtils.getInt64Value;
|
|
||||||
import static org.thingsboard.server.service.edge.rpc.EdgeProtoUtils.getStringValue;
|
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@TbCoreComponent
|
@TbCoreComponent
|
||||||
public class UserMsgConstructor {
|
public class UserMsgConstructor {
|
||||||
@ -41,17 +38,17 @@ public class UserMsgConstructor {
|
|||||||
.setEmail(user.getEmail())
|
.setEmail(user.getEmail())
|
||||||
.setAuthority(user.getAuthority().name());
|
.setAuthority(user.getAuthority().name());
|
||||||
if (customerId != null) {
|
if (customerId != null) {
|
||||||
builder.setCustomerIdMSB(getInt64Value(customerId.getId().getMostSignificantBits()));
|
builder.setCustomerIdMSB(customerId.getId().getMostSignificantBits());
|
||||||
builder.setCustomerIdLSB(getInt64Value(customerId.getId().getLeastSignificantBits()));
|
builder.setCustomerIdLSB(customerId.getId().getLeastSignificantBits());
|
||||||
}
|
}
|
||||||
if (user.getFirstName() != null) {
|
if (user.getFirstName() != null) {
|
||||||
builder.setFirstName(getStringValue(user.getFirstName()));
|
builder.setFirstName(user.getFirstName());
|
||||||
}
|
}
|
||||||
if (user.getLastName() != null) {
|
if (user.getLastName() != null) {
|
||||||
builder.setLastName(getStringValue(user.getLastName()));
|
builder.setLastName(user.getLastName());
|
||||||
}
|
}
|
||||||
if (user.getAdditionalInfo() != null) {
|
if (user.getAdditionalInfo() != null) {
|
||||||
builder.setAdditionalInfo(getStringValue(JacksonUtil.toString(user.getAdditionalInfo())));
|
builder.setAdditionalInfo(JacksonUtil.toString(user.getAdditionalInfo()));
|
||||||
}
|
}
|
||||||
return builder.build();
|
return builder.build();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -24,8 +24,6 @@ import org.thingsboard.server.gen.edge.v1.UpdateMsgType;
|
|||||||
import org.thingsboard.server.gen.edge.v1.WidgetTypeUpdateMsg;
|
import org.thingsboard.server.gen.edge.v1.WidgetTypeUpdateMsg;
|
||||||
import org.thingsboard.server.queue.util.TbCoreComponent;
|
import org.thingsboard.server.queue.util.TbCoreComponent;
|
||||||
|
|
||||||
import static org.thingsboard.server.service.edge.rpc.EdgeProtoUtils.getStringValue;
|
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@TbCoreComponent
|
@TbCoreComponent
|
||||||
public class WidgetTypeMsgConstructor {
|
public class WidgetTypeMsgConstructor {
|
||||||
@ -36,16 +34,16 @@ public class WidgetTypeMsgConstructor {
|
|||||||
.setIdMSB(widgetType.getId().getId().getMostSignificantBits())
|
.setIdMSB(widgetType.getId().getId().getMostSignificantBits())
|
||||||
.setIdLSB(widgetType.getId().getId().getLeastSignificantBits());
|
.setIdLSB(widgetType.getId().getId().getLeastSignificantBits());
|
||||||
if (widgetType.getBundleAlias() != null) {
|
if (widgetType.getBundleAlias() != null) {
|
||||||
builder.setBundleAlias(getStringValue(widgetType.getBundleAlias()));
|
builder.setBundleAlias(widgetType.getBundleAlias());
|
||||||
}
|
}
|
||||||
if (widgetType.getAlias() != null) {
|
if (widgetType.getAlias() != null) {
|
||||||
builder.setAlias(getStringValue(widgetType.getAlias()));
|
builder.setAlias(widgetType.getAlias());
|
||||||
}
|
}
|
||||||
if (widgetType.getName() != null) {
|
if (widgetType.getName() != null) {
|
||||||
builder.setName(getStringValue(widgetType.getName()));
|
builder.setName(widgetType.getName());
|
||||||
}
|
}
|
||||||
if (widgetType.getDescriptor() != null) {
|
if (widgetType.getDescriptor() != null) {
|
||||||
builder.setDescriptorJson(getStringValue(JacksonUtil.toString(widgetType.getDescriptor())));
|
builder.setDescriptorJson(JacksonUtil.toString(widgetType.getDescriptor()));
|
||||||
}
|
}
|
||||||
if (widgetType.getTenantId().equals(TenantId.SYS_TENANT_ID)) {
|
if (widgetType.getTenantId().equals(TenantId.SYS_TENANT_ID)) {
|
||||||
builder.setIsSystem(true);
|
builder.setIsSystem(true);
|
||||||
|
|||||||
@ -26,9 +26,6 @@ import org.thingsboard.server.queue.util.TbCoreComponent;
|
|||||||
|
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
|
|
||||||
import static org.thingsboard.server.service.edge.rpc.EdgeProtoUtils.getBytesValue;
|
|
||||||
import static org.thingsboard.server.service.edge.rpc.EdgeProtoUtils.getStringValue;
|
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@TbCoreComponent
|
@TbCoreComponent
|
||||||
public class WidgetsBundleMsgConstructor {
|
public class WidgetsBundleMsgConstructor {
|
||||||
@ -41,10 +38,10 @@ public class WidgetsBundleMsgConstructor {
|
|||||||
.setTitle(widgetsBundle.getTitle())
|
.setTitle(widgetsBundle.getTitle())
|
||||||
.setAlias(widgetsBundle.getAlias());
|
.setAlias(widgetsBundle.getAlias());
|
||||||
if (widgetsBundle.getImage() != null) {
|
if (widgetsBundle.getImage() != null) {
|
||||||
builder.setImage(getBytesValue(ByteString.copyFrom(widgetsBundle.getImage().getBytes(StandardCharsets.UTF_8))));
|
builder.setImage(ByteString.copyFrom(widgetsBundle.getImage().getBytes(StandardCharsets.UTF_8)));
|
||||||
}
|
}
|
||||||
if (widgetsBundle.getDescription() != null) {
|
if (widgetsBundle.getDescription() != null) {
|
||||||
builder.setDescription(getStringValue(widgetsBundle.getDescription()));
|
builder.setDescription(widgetsBundle.getDescription());
|
||||||
}
|
}
|
||||||
if (widgetsBundle.getTenantId().equals(TenantId.SYS_TENANT_ID)) {
|
if (widgetsBundle.getTenantId().equals(TenantId.SYS_TENANT_ID)) {
|
||||||
builder.setIsSystem(true);
|
builder.setIsSystem(true);
|
||||||
|
|||||||
@ -144,7 +144,7 @@ public class DeviceEdgeProcessor extends BaseEdgeProcessor {
|
|||||||
deviceCredentials.setCredentialsType(DeviceCredentialsType.valueOf(deviceCredentialsUpdateMsg.getCredentialsType()));
|
deviceCredentials.setCredentialsType(DeviceCredentialsType.valueOf(deviceCredentialsUpdateMsg.getCredentialsType()));
|
||||||
deviceCredentials.setCredentialsId(deviceCredentialsUpdateMsg.getCredentialsId());
|
deviceCredentials.setCredentialsId(deviceCredentialsUpdateMsg.getCredentialsId());
|
||||||
if (deviceCredentialsUpdateMsg.hasCredentialsValue()) {
|
if (deviceCredentialsUpdateMsg.hasCredentialsValue()) {
|
||||||
deviceCredentials.setCredentialsValue(deviceCredentialsUpdateMsg.getCredentialsValue().getValue());
|
deviceCredentials.setCredentialsValue(deviceCredentialsUpdateMsg.getCredentialsValue());
|
||||||
}
|
}
|
||||||
deviceCredentialsService.updateDeviceCredentials(tenantId, deviceCredentials);
|
deviceCredentialsService.updateDeviceCredentials(tenantId, deviceCredentials);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@ -164,15 +164,15 @@ public class DeviceEdgeProcessor extends BaseEdgeProcessor {
|
|||||||
device.setName(deviceUpdateMsg.getName());
|
device.setName(deviceUpdateMsg.getName());
|
||||||
device.setType(deviceUpdateMsg.getType());
|
device.setType(deviceUpdateMsg.getType());
|
||||||
if (deviceUpdateMsg.hasLabel()) {
|
if (deviceUpdateMsg.hasLabel()) {
|
||||||
device.setLabel(deviceUpdateMsg.getLabel().getValue());
|
device.setLabel(deviceUpdateMsg.getLabel());
|
||||||
}
|
}
|
||||||
if (deviceUpdateMsg.hasAdditionalInfo()) {
|
if (deviceUpdateMsg.hasAdditionalInfo()) {
|
||||||
device.setAdditionalInfo(JacksonUtil.toJsonNode(deviceUpdateMsg.getAdditionalInfo().getValue()));
|
device.setAdditionalInfo(JacksonUtil.toJsonNode(deviceUpdateMsg.getAdditionalInfo()));
|
||||||
}
|
}
|
||||||
if (deviceUpdateMsg.hasDeviceProfileIdMSB() && deviceUpdateMsg.hasDeviceProfileIdLSB()) {
|
if (deviceUpdateMsg.hasDeviceProfileIdMSB() && deviceUpdateMsg.hasDeviceProfileIdLSB()) {
|
||||||
DeviceProfileId deviceProfileId = new DeviceProfileId(
|
DeviceProfileId deviceProfileId = new DeviceProfileId(
|
||||||
new UUID(deviceUpdateMsg.getDeviceProfileIdMSB().getValue(),
|
new UUID(deviceUpdateMsg.getDeviceProfileIdMSB(),
|
||||||
deviceUpdateMsg.getDeviceProfileIdLSB().getValue()));
|
deviceUpdateMsg.getDeviceProfileIdLSB()));
|
||||||
device.setDeviceProfileId(deviceProfileId);
|
device.setDeviceProfileId(deviceProfileId);
|
||||||
}
|
}
|
||||||
Device savedDevice = deviceService.saveDevice(device);
|
Device savedDevice = deviceService.saveDevice(device);
|
||||||
@ -203,15 +203,15 @@ public class DeviceEdgeProcessor extends BaseEdgeProcessor {
|
|||||||
device.setName(deviceName);
|
device.setName(deviceName);
|
||||||
device.setType(deviceUpdateMsg.getType());
|
device.setType(deviceUpdateMsg.getType());
|
||||||
if (deviceUpdateMsg.hasLabel()) {
|
if (deviceUpdateMsg.hasLabel()) {
|
||||||
device.setLabel(deviceUpdateMsg.getLabel().getValue());
|
device.setLabel(deviceUpdateMsg.getLabel());
|
||||||
}
|
}
|
||||||
if (deviceUpdateMsg.hasAdditionalInfo()) {
|
if (deviceUpdateMsg.hasAdditionalInfo()) {
|
||||||
device.setAdditionalInfo(JacksonUtil.toJsonNode(deviceUpdateMsg.getAdditionalInfo().getValue()));
|
device.setAdditionalInfo(JacksonUtil.toJsonNode(deviceUpdateMsg.getAdditionalInfo()));
|
||||||
}
|
}
|
||||||
if (deviceUpdateMsg.hasDeviceProfileIdMSB() && deviceUpdateMsg.hasDeviceProfileIdLSB()) {
|
if (deviceUpdateMsg.hasDeviceProfileIdMSB() && deviceUpdateMsg.hasDeviceProfileIdLSB()) {
|
||||||
DeviceProfileId deviceProfileId = new DeviceProfileId(
|
DeviceProfileId deviceProfileId = new DeviceProfileId(
|
||||||
new UUID(deviceUpdateMsg.getDeviceProfileIdMSB().getValue(),
|
new UUID(deviceUpdateMsg.getDeviceProfileIdMSB(),
|
||||||
deviceUpdateMsg.getDeviceProfileIdLSB().getValue()));
|
deviceUpdateMsg.getDeviceProfileIdLSB()));
|
||||||
device.setDeviceProfileId(deviceProfileId);
|
device.setDeviceProfileId(deviceProfileId);
|
||||||
}
|
}
|
||||||
Device savedDevice = deviceService.saveDevice(device, false);
|
Device savedDevice = deviceService.saveDevice(device, false);
|
||||||
|
|||||||
@ -73,7 +73,7 @@ public class RelationEdgeProcessor extends BaseEdgeProcessor {
|
|||||||
|
|
||||||
entityRelation.setType(relationUpdateMsg.getType());
|
entityRelation.setType(relationUpdateMsg.getType());
|
||||||
if (relationUpdateMsg.hasTypeGroup()) {
|
if (relationUpdateMsg.hasTypeGroup()) {
|
||||||
entityRelation.setTypeGroup(RelationTypeGroup.valueOf(relationUpdateMsg.getTypeGroup().getValue()));
|
entityRelation.setTypeGroup(RelationTypeGroup.valueOf(relationUpdateMsg.getTypeGroup()));
|
||||||
}
|
}
|
||||||
entityRelation.setAdditionalInfo(mapper.readTree(relationUpdateMsg.getAdditionalInfo()));
|
entityRelation.setAdditionalInfo(mapper.readTree(relationUpdateMsg.getAdditionalInfo()));
|
||||||
switch (relationUpdateMsg.getMsgType()) {
|
switch (relationUpdateMsg.getMsgType()) {
|
||||||
|
|||||||
@ -127,7 +127,6 @@ import java.util.UUID;
|
|||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
|
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
|
||||||
import static org.thingsboard.server.service.edge.rpc.EdgeProtoUtils.getStringValue;
|
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
abstract public class BaseEdgeTest extends AbstractControllerTest {
|
abstract public class BaseEdgeTest extends AbstractControllerTest {
|
||||||
@ -650,7 +649,7 @@ abstract public class BaseEdgeTest extends AbstractControllerTest {
|
|||||||
Assert.assertEquals(relationUpdateMsg.getFromIdMSB(), relation.getFrom().getId().getMostSignificantBits());
|
Assert.assertEquals(relationUpdateMsg.getFromIdMSB(), relation.getFrom().getId().getMostSignificantBits());
|
||||||
Assert.assertEquals(relationUpdateMsg.getToIdLSB(), relation.getTo().getId().getLeastSignificantBits());
|
Assert.assertEquals(relationUpdateMsg.getToIdLSB(), relation.getTo().getId().getLeastSignificantBits());
|
||||||
Assert.assertEquals(relationUpdateMsg.getToEntityType(), relation.getTo().getEntityType().name());
|
Assert.assertEquals(relationUpdateMsg.getToEntityType(), relation.getTo().getEntityType().name());
|
||||||
Assert.assertEquals(relationUpdateMsg.getTypeGroup().getValue(), relation.getTypeGroup().name());
|
Assert.assertEquals(relationUpdateMsg.getTypeGroup(), relation.getTypeGroup().name());
|
||||||
|
|
||||||
// 2
|
// 2
|
||||||
edgeImitator.expectMessageAmount(1);
|
edgeImitator.expectMessageAmount(1);
|
||||||
@ -674,7 +673,7 @@ abstract public class BaseEdgeTest extends AbstractControllerTest {
|
|||||||
Assert.assertEquals(relationUpdateMsg.getFromIdMSB(), relation.getFrom().getId().getMostSignificantBits());
|
Assert.assertEquals(relationUpdateMsg.getFromIdMSB(), relation.getFrom().getId().getMostSignificantBits());
|
||||||
Assert.assertEquals(relationUpdateMsg.getToIdLSB(), relation.getTo().getId().getLeastSignificantBits());
|
Assert.assertEquals(relationUpdateMsg.getToIdLSB(), relation.getTo().getId().getLeastSignificantBits());
|
||||||
Assert.assertEquals(relationUpdateMsg.getToEntityType(), relation.getTo().getEntityType().name());
|
Assert.assertEquals(relationUpdateMsg.getToEntityType(), relation.getTo().getEntityType().name());
|
||||||
Assert.assertEquals(relationUpdateMsg.getTypeGroup().getValue(), relation.getTypeGroup().name());
|
Assert.assertEquals(relationUpdateMsg.getTypeGroup(), relation.getTypeGroup().name());
|
||||||
|
|
||||||
log.info("Relations tested successfully");
|
log.info("Relations tested successfully");
|
||||||
}
|
}
|
||||||
@ -910,9 +909,9 @@ abstract public class BaseEdgeTest extends AbstractControllerTest {
|
|||||||
Assert.assertEquals(UpdateMsgType.ENTITY_CREATED_RPC_MESSAGE, widgetTypeUpdateMsg.getMsgType());
|
Assert.assertEquals(UpdateMsgType.ENTITY_CREATED_RPC_MESSAGE, widgetTypeUpdateMsg.getMsgType());
|
||||||
Assert.assertEquals(widgetTypeUpdateMsg.getIdMSB(), savedWidgetType.getUuidId().getMostSignificantBits());
|
Assert.assertEquals(widgetTypeUpdateMsg.getIdMSB(), savedWidgetType.getUuidId().getMostSignificantBits());
|
||||||
Assert.assertEquals(widgetTypeUpdateMsg.getIdLSB(), savedWidgetType.getUuidId().getLeastSignificantBits());
|
Assert.assertEquals(widgetTypeUpdateMsg.getIdLSB(), savedWidgetType.getUuidId().getLeastSignificantBits());
|
||||||
Assert.assertEquals(widgetTypeUpdateMsg.getAlias().getValue(), savedWidgetType.getAlias());
|
Assert.assertEquals(widgetTypeUpdateMsg.getAlias(), savedWidgetType.getAlias());
|
||||||
Assert.assertEquals(widgetTypeUpdateMsg.getName().getValue(), savedWidgetType.getName());
|
Assert.assertEquals(widgetTypeUpdateMsg.getName(), savedWidgetType.getName());
|
||||||
Assert.assertEquals(JacksonUtil.toJsonNode(widgetTypeUpdateMsg.getDescriptorJson().getValue()), savedWidgetType.getDescriptor());
|
Assert.assertEquals(JacksonUtil.toJsonNode(widgetTypeUpdateMsg.getDescriptorJson()), savedWidgetType.getDescriptor());
|
||||||
|
|
||||||
// 3
|
// 3
|
||||||
edgeImitator.expectMessageAmount(1);
|
edgeImitator.expectMessageAmount(1);
|
||||||
@ -1212,7 +1211,7 @@ abstract public class BaseEdgeTest extends AbstractControllerTest {
|
|||||||
Assert.assertTrue(latestMessage instanceof DeviceUpdateMsg);
|
Assert.assertTrue(latestMessage instanceof DeviceUpdateMsg);
|
||||||
DeviceUpdateMsg latestDeviceUpdateMsg = (DeviceUpdateMsg) latestMessage;
|
DeviceUpdateMsg latestDeviceUpdateMsg = (DeviceUpdateMsg) latestMessage;
|
||||||
Assert.assertNotEquals(deviceOnCloudName, latestDeviceUpdateMsg.getName());
|
Assert.assertNotEquals(deviceOnCloudName, latestDeviceUpdateMsg.getName());
|
||||||
Assert.assertEquals(deviceOnCloudName, latestDeviceUpdateMsg.getConflictName().getValue());
|
Assert.assertEquals(deviceOnCloudName, latestDeviceUpdateMsg.getConflictName());
|
||||||
|
|
||||||
UUID newDeviceId = new UUID(latestDeviceUpdateMsg.getIdMSB(), latestDeviceUpdateMsg.getIdLSB());
|
UUID newDeviceId = new UUID(latestDeviceUpdateMsg.getIdMSB(), latestDeviceUpdateMsg.getIdLSB());
|
||||||
|
|
||||||
@ -1279,7 +1278,7 @@ abstract public class BaseEdgeTest extends AbstractControllerTest {
|
|||||||
EntityId toEntityId = EntityIdFactory.getByTypeAndUuid(relationUpdateMsg.getToEntityType(), toUUID);
|
EntityId toEntityId = EntityIdFactory.getByTypeAndUuid(relationUpdateMsg.getToEntityType(), toUUID);
|
||||||
Assert.assertEquals(relation.getTo(), toEntityId);
|
Assert.assertEquals(relation.getTo(), toEntityId);
|
||||||
|
|
||||||
Assert.assertEquals(relation.getTypeGroup().name(), relationUpdateMsg.getTypeGroup().getValue());
|
Assert.assertEquals(relation.getTypeGroup().name(), relationUpdateMsg.getTypeGroup());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendAlarm() throws Exception {
|
private void sendAlarm() throws Exception {
|
||||||
@ -1391,7 +1390,7 @@ abstract public class BaseEdgeTest extends AbstractControllerTest {
|
|||||||
UplinkMsg.Builder uplinkMsgBuilder = UplinkMsg.newBuilder();
|
UplinkMsg.Builder uplinkMsgBuilder = UplinkMsg.newBuilder();
|
||||||
RelationUpdateMsg.Builder relationUpdateMsgBuilder = RelationUpdateMsg.newBuilder();
|
RelationUpdateMsg.Builder relationUpdateMsgBuilder = RelationUpdateMsg.newBuilder();
|
||||||
relationUpdateMsgBuilder.setType("test");
|
relationUpdateMsgBuilder.setType("test");
|
||||||
relationUpdateMsgBuilder.setTypeGroup(getStringValue(RelationTypeGroup.COMMON.name()));
|
relationUpdateMsgBuilder.setTypeGroup(RelationTypeGroup.COMMON.name());
|
||||||
relationUpdateMsgBuilder.setToIdMSB(device1.getId().getId().getMostSignificantBits());
|
relationUpdateMsgBuilder.setToIdMSB(device1.getId().getId().getMostSignificantBits());
|
||||||
relationUpdateMsgBuilder.setToIdLSB(device1.getId().getId().getLeastSignificantBits());
|
relationUpdateMsgBuilder.setToIdLSB(device1.getId().getId().getLeastSignificantBits());
|
||||||
relationUpdateMsgBuilder.setToEntityType(device1.getId().getEntityType().name());
|
relationUpdateMsgBuilder.setToEntityType(device1.getId().getEntityType().name());
|
||||||
|
|||||||
@ -20,7 +20,6 @@ option java_multiple_files = true;
|
|||||||
option java_outer_classname = "EdgeProtos";
|
option java_outer_classname = "EdgeProtos";
|
||||||
|
|
||||||
import "queue.proto";
|
import "queue.proto";
|
||||||
import "google/protobuf/wrappers.proto";
|
|
||||||
|
|
||||||
package edge;
|
package edge;
|
||||||
|
|
||||||
@ -130,8 +129,8 @@ message RuleChainUpdateMsg {
|
|||||||
int64 idMSB = 2;
|
int64 idMSB = 2;
|
||||||
int64 idLSB = 3;
|
int64 idLSB = 3;
|
||||||
string name = 4;
|
string name = 4;
|
||||||
google.protobuf.Int64Value firstRuleNodeIdMSB = 5;
|
optional int64 firstRuleNodeIdMSB = 5;
|
||||||
google.protobuf.Int64Value firstRuleNodeIdLSB = 6;
|
optional int64 firstRuleNodeIdLSB = 6;
|
||||||
bool root = 7;
|
bool root = 7;
|
||||||
bool debugMode = 8;
|
bool debugMode = 8;
|
||||||
string configuration = 9;
|
string configuration = 9;
|
||||||
@ -175,8 +174,8 @@ message DashboardUpdateMsg {
|
|||||||
UpdateMsgType msgType = 1;
|
UpdateMsgType msgType = 1;
|
||||||
int64 idMSB = 2;
|
int64 idMSB = 2;
|
||||||
int64 idLSB = 3;
|
int64 idLSB = 3;
|
||||||
google.protobuf.Int64Value customerIdMSB = 4;
|
optional int64 customerIdMSB = 4;
|
||||||
google.protobuf.Int64Value customerIdLSB = 5;
|
optional int64 customerIdLSB = 5;
|
||||||
string title = 6;
|
string title = 6;
|
||||||
string configuration = 7;
|
string configuration = 7;
|
||||||
}
|
}
|
||||||
@ -185,15 +184,15 @@ message DeviceUpdateMsg {
|
|||||||
UpdateMsgType msgType = 1;
|
UpdateMsgType msgType = 1;
|
||||||
int64 idMSB = 2;
|
int64 idMSB = 2;
|
||||||
int64 idLSB = 3;
|
int64 idLSB = 3;
|
||||||
google.protobuf.Int64Value customerIdMSB = 4;
|
optional int64 customerIdMSB = 4;
|
||||||
google.protobuf.Int64Value customerIdLSB = 5;
|
optional int64 customerIdLSB = 5;
|
||||||
google.protobuf.Int64Value deviceProfileIdMSB = 6;
|
optional int64 deviceProfileIdMSB = 6;
|
||||||
google.protobuf.Int64Value deviceProfileIdLSB = 7;
|
optional int64 deviceProfileIdLSB = 7;
|
||||||
string name = 8;
|
string name = 8;
|
||||||
string type = 9;
|
string type = 9;
|
||||||
google.protobuf.StringValue label = 10;
|
optional string label = 10;
|
||||||
google.protobuf.StringValue additionalInfo = 11;
|
optional string additionalInfo = 11;
|
||||||
google.protobuf.StringValue conflictName = 12;
|
optional string conflictName = 12;
|
||||||
}
|
}
|
||||||
|
|
||||||
message DeviceProfileUpdateMsg {
|
message DeviceProfileUpdateMsg {
|
||||||
@ -201,17 +200,17 @@ message DeviceProfileUpdateMsg {
|
|||||||
int64 idMSB = 2;
|
int64 idMSB = 2;
|
||||||
int64 idLSB = 3;
|
int64 idLSB = 3;
|
||||||
string name = 4;
|
string name = 4;
|
||||||
google.protobuf.StringValue description = 5;
|
optional string description = 5;
|
||||||
bool default = 6;
|
bool default = 6;
|
||||||
string type = 7;
|
string type = 7;
|
||||||
google.protobuf.StringValue transportType = 8;
|
optional string transportType = 8;
|
||||||
google.protobuf.StringValue provisionType = 9;
|
optional string provisionType = 9;
|
||||||
int64 defaultRuleChainIdMSB = 10;
|
int64 defaultRuleChainIdMSB = 10;
|
||||||
int64 defaultRuleChainIdLSB = 11;
|
int64 defaultRuleChainIdLSB = 11;
|
||||||
string defaultQueueName = 12;
|
string defaultQueueName = 12;
|
||||||
bytes profileDataBytes = 13;
|
bytes profileDataBytes = 13;
|
||||||
google.protobuf.StringValue provisionDeviceKey = 14;
|
optional string provisionDeviceKey = 14;
|
||||||
google.protobuf.BytesValue image = 15;
|
optional bytes image = 15;
|
||||||
}
|
}
|
||||||
|
|
||||||
message DeviceCredentialsUpdateMsg {
|
message DeviceCredentialsUpdateMsg {
|
||||||
@ -219,33 +218,33 @@ message DeviceCredentialsUpdateMsg {
|
|||||||
int64 deviceIdLSB = 2;
|
int64 deviceIdLSB = 2;
|
||||||
string credentialsType = 3;
|
string credentialsType = 3;
|
||||||
string credentialsId = 4;
|
string credentialsId = 4;
|
||||||
google.protobuf.StringValue credentialsValue = 5;
|
optional string credentialsValue = 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
message AssetUpdateMsg {
|
message AssetUpdateMsg {
|
||||||
UpdateMsgType msgType = 1;
|
UpdateMsgType msgType = 1;
|
||||||
int64 idMSB = 2;
|
int64 idMSB = 2;
|
||||||
int64 idLSB = 3;
|
int64 idLSB = 3;
|
||||||
google.protobuf.Int64Value customerIdMSB = 4;
|
optional int64 customerIdMSB = 4;
|
||||||
google.protobuf.Int64Value customerIdLSB = 5;
|
optional int64 customerIdLSB = 5;
|
||||||
string name = 6;
|
string name = 6;
|
||||||
string type = 7;
|
string type = 7;
|
||||||
google.protobuf.StringValue label = 8;
|
optional string label = 8;
|
||||||
google.protobuf.StringValue additionalInfo = 9;
|
optional string additionalInfo = 9;
|
||||||
}
|
}
|
||||||
|
|
||||||
message EntityViewUpdateMsg {
|
message EntityViewUpdateMsg {
|
||||||
UpdateMsgType msgType = 1;
|
UpdateMsgType msgType = 1;
|
||||||
int64 idMSB = 2;
|
int64 idMSB = 2;
|
||||||
int64 idLSB = 3;
|
int64 idLSB = 3;
|
||||||
google.protobuf.Int64Value customerIdMSB = 4;
|
optional int64 customerIdMSB = 4;
|
||||||
google.protobuf.Int64Value customerIdLSB = 5;
|
optional int64 customerIdLSB = 5;
|
||||||
string name = 6;
|
string name = 6;
|
||||||
string type = 7;
|
string type = 7;
|
||||||
int64 entityIdMSB = 8;
|
int64 entityIdMSB = 8;
|
||||||
int64 entityIdLSB = 9;
|
int64 entityIdLSB = 9;
|
||||||
EdgeEntityType entityType = 10;
|
EdgeEntityType entityType = 10;
|
||||||
google.protobuf.StringValue additionalInfo = 11;
|
optional string additionalInfo = 11;
|
||||||
}
|
}
|
||||||
|
|
||||||
message AlarmUpdateMsg {
|
message AlarmUpdateMsg {
|
||||||
@ -271,15 +270,15 @@ message CustomerUpdateMsg {
|
|||||||
int64 idMSB = 2;
|
int64 idMSB = 2;
|
||||||
int64 idLSB = 3;
|
int64 idLSB = 3;
|
||||||
string title = 4;
|
string title = 4;
|
||||||
google.protobuf.StringValue country = 5;
|
optional string country = 5;
|
||||||
google.protobuf.StringValue state = 6;
|
optional string state = 6;
|
||||||
google.protobuf.StringValue city = 7;
|
optional string city = 7;
|
||||||
google.protobuf.StringValue address = 8;
|
optional string address = 8;
|
||||||
google.protobuf.StringValue address2 = 9;
|
optional string address2 = 9;
|
||||||
google.protobuf.StringValue zip = 10;
|
optional string zip = 10;
|
||||||
google.protobuf.StringValue phone = 11;
|
optional string phone = 11;
|
||||||
google.protobuf.StringValue email = 12;
|
optional string email = 12;
|
||||||
google.protobuf.StringValue additionalInfo = 13;
|
optional string additionalInfo = 13;
|
||||||
}
|
}
|
||||||
|
|
||||||
message RelationUpdateMsg {
|
message RelationUpdateMsg {
|
||||||
@ -291,7 +290,7 @@ message RelationUpdateMsg {
|
|||||||
int64 toIdLSB = 6;
|
int64 toIdLSB = 6;
|
||||||
string toEntityType = 7;
|
string toEntityType = 7;
|
||||||
string type = 8;
|
string type = 8;
|
||||||
google.protobuf.StringValue typeGroup = 9;
|
optional string typeGroup = 9;
|
||||||
string additionalInfo = 10;
|
string additionalInfo = 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -299,13 +298,13 @@ message UserUpdateMsg {
|
|||||||
UpdateMsgType msgType = 1;
|
UpdateMsgType msgType = 1;
|
||||||
int64 idMSB = 2;
|
int64 idMSB = 2;
|
||||||
int64 idLSB = 3;
|
int64 idLSB = 3;
|
||||||
google.protobuf.Int64Value customerIdMSB = 4;
|
optional int64 customerIdMSB = 4;
|
||||||
google.protobuf.Int64Value customerIdLSB = 5;
|
optional int64 customerIdLSB = 5;
|
||||||
string email = 6;
|
string email = 6;
|
||||||
string authority = 7;
|
string authority = 7;
|
||||||
google.protobuf.StringValue firstName = 8;
|
optional string firstName = 8;
|
||||||
google.protobuf.StringValue lastName = 9;
|
optional string lastName = 9;
|
||||||
google.protobuf.StringValue additionalInfo = 10;
|
optional string additionalInfo = 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
message WidgetsBundleUpdateMsg {
|
message WidgetsBundleUpdateMsg {
|
||||||
@ -314,19 +313,19 @@ message WidgetsBundleUpdateMsg {
|
|||||||
int64 idLSB = 3;
|
int64 idLSB = 3;
|
||||||
string title = 4;
|
string title = 4;
|
||||||
string alias = 5;
|
string alias = 5;
|
||||||
google.protobuf.BytesValue image = 6;
|
optional bytes image = 6;
|
||||||
bool isSystem = 7;
|
bool isSystem = 7;
|
||||||
google.protobuf.StringValue description = 8;
|
optional string description = 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
message WidgetTypeUpdateMsg {
|
message WidgetTypeUpdateMsg {
|
||||||
UpdateMsgType msgType = 1;
|
UpdateMsgType msgType = 1;
|
||||||
int64 idMSB = 2;
|
int64 idMSB = 2;
|
||||||
int64 idLSB = 3;
|
int64 idLSB = 3;
|
||||||
google.protobuf.StringValue bundleAlias = 4;
|
optional string bundleAlias = 4;
|
||||||
google.protobuf.StringValue alias = 5;
|
optional string alias = 5;
|
||||||
google.protobuf.StringValue name = 6;
|
optional string name = 6;
|
||||||
google.protobuf.StringValue descriptorJson = 7;
|
optional string descriptorJson = 7;
|
||||||
bool isSystem = 8;
|
bool isSystem = 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user