Search in sources :

Example 1 with MqttDeviceProfileTransportConfiguration

use of org.thingsboard.server.common.data.device.profile.MqttDeviceProfileTransportConfiguration in project thingsboard by thingsboard.

the class AbstractWebTest method createMqttDeviceProfileTransportConfiguration.

protected MqttDeviceProfileTransportConfiguration createMqttDeviceProfileTransportConfiguration(TransportPayloadTypeConfiguration transportPayloadTypeConfiguration) {
    MqttDeviceProfileTransportConfiguration mqttDeviceProfileTransportConfiguration = new MqttDeviceProfileTransportConfiguration();
    mqttDeviceProfileTransportConfiguration.setDeviceTelemetryTopic(MqttTopics.DEVICE_TELEMETRY_TOPIC);
    mqttDeviceProfileTransportConfiguration.setDeviceTelemetryTopic(MqttTopics.DEVICE_ATTRIBUTES_TOPIC);
    mqttDeviceProfileTransportConfiguration.setTransportPayloadTypeConfiguration(transportPayloadTypeConfiguration);
    return mqttDeviceProfileTransportConfiguration;
}
Also used : MqttDeviceProfileTransportConfiguration(org.thingsboard.server.common.data.device.profile.MqttDeviceProfileTransportConfiguration)

Example 2 with MqttDeviceProfileTransportConfiguration

use of org.thingsboard.server.common.data.device.profile.MqttDeviceProfileTransportConfiguration in project thingsboard by thingsboard.

the class BaseDeviceProfileControllerTest method testSaveDeviceProfileWithInvalidRpcRequestProtoSchema.

private void testSaveDeviceProfileWithInvalidRpcRequestProtoSchema(String schema, String errorMsg) throws Exception {
    ProtoTransportPayloadConfiguration protoTransportPayloadConfiguration = this.createProtoTransportPayloadConfiguration(schema, schema, schema, null);
    MqttDeviceProfileTransportConfiguration mqttDeviceProfileTransportConfiguration = this.createMqttDeviceProfileTransportConfiguration(protoTransportPayloadConfiguration);
    DeviceProfile deviceProfile = this.createDeviceProfile("Device Profile", mqttDeviceProfileTransportConfiguration);
    doPost("/api/deviceProfile", deviceProfile).andExpect(status().isBadRequest()).andExpect(statusReason(containsString(errorMsg)));
}
Also used : DeviceProfile(org.thingsboard.server.common.data.DeviceProfile) MqttDeviceProfileTransportConfiguration(org.thingsboard.server.common.data.device.profile.MqttDeviceProfileTransportConfiguration) ProtoTransportPayloadConfiguration(org.thingsboard.server.common.data.device.profile.ProtoTransportPayloadConfiguration)

Example 3 with MqttDeviceProfileTransportConfiguration

use of org.thingsboard.server.common.data.device.profile.MqttDeviceProfileTransportConfiguration in project thingsboard by thingsboard.

the class BaseDeviceProfileControllerTest method testSaveDeviceProfileWithProtoPayloadType.

private DeviceProfile testSaveDeviceProfileWithProtoPayloadType(String schema) throws Exception {
    ProtoTransportPayloadConfiguration protoTransportPayloadConfiguration = this.createProtoTransportPayloadConfiguration(schema, schema, null, null);
    MqttDeviceProfileTransportConfiguration mqttDeviceProfileTransportConfiguration = this.createMqttDeviceProfileTransportConfiguration(protoTransportPayloadConfiguration);
    DeviceProfile deviceProfile = this.createDeviceProfile("Device Profile", mqttDeviceProfileTransportConfiguration);
    DeviceProfile savedDeviceProfile = doPost("/api/deviceProfile", deviceProfile, DeviceProfile.class);
    DeviceProfile foundDeviceProfile = doGet("/api/deviceProfile/" + savedDeviceProfile.getId().getId().toString(), DeviceProfile.class);
    Assert.assertEquals(savedDeviceProfile.getName(), foundDeviceProfile.getName());
    return savedDeviceProfile;
}
Also used : DeviceProfile(org.thingsboard.server.common.data.DeviceProfile) MqttDeviceProfileTransportConfiguration(org.thingsboard.server.common.data.device.profile.MqttDeviceProfileTransportConfiguration) ProtoTransportPayloadConfiguration(org.thingsboard.server.common.data.device.profile.ProtoTransportPayloadConfiguration)

Example 4 with MqttDeviceProfileTransportConfiguration

use of org.thingsboard.server.common.data.device.profile.MqttDeviceProfileTransportConfiguration in project thingsboard by thingsboard.

the class BaseDeviceProfileControllerTest method testSaveDeviceProfileWithInvalidProtoSchema.

private void testSaveDeviceProfileWithInvalidProtoSchema(String schema, String errorMsg) throws Exception {
    ProtoTransportPayloadConfiguration protoTransportPayloadConfiguration = this.createProtoTransportPayloadConfiguration(schema, schema, null, null);
    MqttDeviceProfileTransportConfiguration mqttDeviceProfileTransportConfiguration = this.createMqttDeviceProfileTransportConfiguration(protoTransportPayloadConfiguration);
    DeviceProfile deviceProfile = this.createDeviceProfile("Device Profile", mqttDeviceProfileTransportConfiguration);
    doPost("/api/deviceProfile", deviceProfile).andExpect(status().isBadRequest()).andExpect(statusReason(containsString(errorMsg)));
}
Also used : DeviceProfile(org.thingsboard.server.common.data.DeviceProfile) MqttDeviceProfileTransportConfiguration(org.thingsboard.server.common.data.device.profile.MqttDeviceProfileTransportConfiguration) ProtoTransportPayloadConfiguration(org.thingsboard.server.common.data.device.profile.ProtoTransportPayloadConfiguration)

Example 5 with MqttDeviceProfileTransportConfiguration

use of org.thingsboard.server.common.data.device.profile.MqttDeviceProfileTransportConfiguration in project thingsboard by thingsboard.

the class AbstractMqttAttributesProtoIntegrationTest method getDynamicSchema.

private DynamicSchema getDynamicSchema() {
    DeviceProfileTransportConfiguration transportConfiguration = deviceProfile.getProfileData().getTransportConfiguration();
    assertTrue(transportConfiguration instanceof MqttDeviceProfileTransportConfiguration);
    MqttDeviceProfileTransportConfiguration mqttTransportConfiguration = (MqttDeviceProfileTransportConfiguration) transportConfiguration;
    TransportPayloadTypeConfiguration transportPayloadTypeConfiguration = mqttTransportConfiguration.getTransportPayloadTypeConfiguration();
    assertTrue(transportPayloadTypeConfiguration instanceof ProtoTransportPayloadConfiguration);
    ProtoTransportPayloadConfiguration protoTransportPayloadConfiguration = (ProtoTransportPayloadConfiguration) transportPayloadTypeConfiguration;
    ProtoFileElement transportProtoSchemaFile = protoTransportPayloadConfiguration.getTransportProtoSchema(DEVICE_ATTRIBUTES_PROTO_SCHEMA);
    return protoTransportPayloadConfiguration.getDynamicSchema(transportProtoSchemaFile, ProtoTransportPayloadConfiguration.ATTRIBUTES_PROTO_SCHEMA);
}
Also used : MqttDeviceProfileTransportConfiguration(org.thingsboard.server.common.data.device.profile.MqttDeviceProfileTransportConfiguration) DeviceProfileTransportConfiguration(org.thingsboard.server.common.data.device.profile.DeviceProfileTransportConfiguration) MqttDeviceProfileTransportConfiguration(org.thingsboard.server.common.data.device.profile.MqttDeviceProfileTransportConfiguration) ProtoTransportPayloadConfiguration(org.thingsboard.server.common.data.device.profile.ProtoTransportPayloadConfiguration) TransportPayloadTypeConfiguration(org.thingsboard.server.common.data.device.profile.TransportPayloadTypeConfiguration) ProtoFileElement(com.squareup.wire.schema.internal.parser.ProtoFileElement)

Aggregations

MqttDeviceProfileTransportConfiguration (org.thingsboard.server.common.data.device.profile.MqttDeviceProfileTransportConfiguration)12 ProtoTransportPayloadConfiguration (org.thingsboard.server.common.data.device.profile.ProtoTransportPayloadConfiguration)11 TransportPayloadTypeConfiguration (org.thingsboard.server.common.data.device.profile.TransportPayloadTypeConfiguration)8 DeviceProfileTransportConfiguration (org.thingsboard.server.common.data.device.profile.DeviceProfileTransportConfiguration)7 DeviceProfile (org.thingsboard.server.common.data.DeviceProfile)6 ProtoFileElement (com.squareup.wire.schema.internal.parser.ProtoFileElement)4 DynamicSchema (com.github.os72.protobuf.dynamic.DynamicSchema)1 Descriptors (com.google.protobuf.Descriptors)1 DynamicMessage (com.google.protobuf.DynamicMessage)1 HashSet (java.util.HashSet)1 MqttMessage (org.eclipse.paho.client.mqttv3.MqttMessage)1 DashboardInfo (org.thingsboard.server.common.data.DashboardInfo)1 OtaPackage (org.thingsboard.server.common.data.OtaPackage)1 Tenant (org.thingsboard.server.common.data.Tenant)1 AllowCreateNewDevicesDeviceProfileProvisionConfiguration (org.thingsboard.server.common.data.device.profile.AllowCreateNewDevicesDeviceProfileProvisionConfiguration)1 CheckPreProvisionedDevicesDeviceProfileProvisionConfiguration (org.thingsboard.server.common.data.device.profile.CheckPreProvisionedDevicesDeviceProfileProvisionConfiguration)1 CoapDeviceProfileTransportConfiguration (org.thingsboard.server.common.data.device.profile.CoapDeviceProfileTransportConfiguration)1 CoapDeviceTypeConfiguration (org.thingsboard.server.common.data.device.profile.CoapDeviceTypeConfiguration)1 DefaultCoapDeviceTypeConfiguration (org.thingsboard.server.common.data.device.profile.DefaultCoapDeviceTypeConfiguration)1 DefaultDeviceProfileConfiguration (org.thingsboard.server.common.data.device.profile.DefaultDeviceProfileConfiguration)1