Commit bb1a03f5c852c0e2fe2fa9d0148f7a0aa1db3063
1 parent
2700c429
Device profile provision type set to DISABLED if not provided
Showing
2 changed files
with
5 additions
and
1 deletions
@@ -30,6 +30,7 @@ import org.junit.Test; | @@ -30,6 +30,7 @@ import org.junit.Test; | ||
30 | import org.thingsboard.server.common.data.Device; | 30 | import org.thingsboard.server.common.data.Device; |
31 | import org.thingsboard.server.common.data.DeviceProfile; | 31 | import org.thingsboard.server.common.data.DeviceProfile; |
32 | import org.thingsboard.server.common.data.DeviceProfileInfo; | 32 | import org.thingsboard.server.common.data.DeviceProfileInfo; |
33 | +import org.thingsboard.server.common.data.DeviceProfileProvisionType; | ||
33 | import org.thingsboard.server.common.data.DeviceProfileType; | 34 | import org.thingsboard.server.common.data.DeviceProfileType; |
34 | import org.thingsboard.server.common.data.DeviceTransportType; | 35 | import org.thingsboard.server.common.data.DeviceTransportType; |
35 | import org.thingsboard.server.common.data.Tenant; | 36 | import org.thingsboard.server.common.data.Tenant; |
@@ -101,6 +102,7 @@ public abstract class BaseDeviceProfileControllerTest extends AbstractController | @@ -101,6 +102,7 @@ public abstract class BaseDeviceProfileControllerTest extends AbstractController | ||
101 | Assert.assertEquals(deviceProfile.getProfileData(), savedDeviceProfile.getProfileData()); | 102 | Assert.assertEquals(deviceProfile.getProfileData(), savedDeviceProfile.getProfileData()); |
102 | Assert.assertEquals(deviceProfile.isDefault(), savedDeviceProfile.isDefault()); | 103 | Assert.assertEquals(deviceProfile.isDefault(), savedDeviceProfile.isDefault()); |
103 | Assert.assertEquals(deviceProfile.getDefaultRuleChainId(), savedDeviceProfile.getDefaultRuleChainId()); | 104 | Assert.assertEquals(deviceProfile.getDefaultRuleChainId(), savedDeviceProfile.getDefaultRuleChainId()); |
105 | + Assert.assertEquals(DeviceProfileProvisionType.DISABLED, savedDeviceProfile.getProvisionType()); | ||
104 | savedDeviceProfile.setName("New device profile"); | 106 | savedDeviceProfile.setName("New device profile"); |
105 | doPost("/api/deviceProfile", savedDeviceProfile, DeviceProfile.class); | 107 | doPost("/api/deviceProfile", savedDeviceProfile, DeviceProfile.class); |
106 | DeviceProfile foundDeviceProfile = doGet("/api/deviceProfile/"+savedDeviceProfile.getId().getId().toString(), DeviceProfile.class); | 108 | DeviceProfile foundDeviceProfile = doGet("/api/deviceProfile/"+savedDeviceProfile.getId().getId().toString(), DeviceProfile.class); |
@@ -373,7 +373,9 @@ public class DeviceProfileServiceImpl extends AbstractEntityService implements D | @@ -373,7 +373,9 @@ public class DeviceProfileServiceImpl extends AbstractEntityService implements D | ||
373 | throw new DataValidationException("Another default device profile is present in scope of current tenant!"); | 373 | throw new DataValidationException("Another default device profile is present in scope of current tenant!"); |
374 | } | 374 | } |
375 | } | 375 | } |
376 | - | 376 | + if (deviceProfile.getProvisionType() == null) { |
377 | + deviceProfile.setProvisionType(DeviceProfileProvisionType.DISABLED); | ||
378 | + } | ||
377 | DeviceProfileTransportConfiguration transportConfiguration = deviceProfile.getProfileData().getTransportConfiguration(); | 379 | DeviceProfileTransportConfiguration transportConfiguration = deviceProfile.getProfileData().getTransportConfiguration(); |
378 | transportConfiguration.validate(); | 380 | transportConfiguration.validate(); |
379 | if (transportConfiguration instanceof MqttDeviceProfileTransportConfiguration) { | 381 | if (transportConfiguration instanceof MqttDeviceProfileTransportConfiguration) { |