Browse Source
Merge pull request #4923 from volodymyr-babak/device-provision-type-fix
[3.3.0] Device profile provision type set to DISABLED if not provided
pull/4928/head
Igor Kulikov
5 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
5 additions and
1 deletions
-
application/src/test/java/org/thingsboard/server/controller/BaseDeviceProfileControllerTest.java
-
dao/src/main/java/org/thingsboard/server/dao/device/DeviceProfileServiceImpl.java
|
|
|
@ -30,6 +30,7 @@ import org.junit.Test; |
|
|
|
import org.thingsboard.server.common.data.Device; |
|
|
|
import org.thingsboard.server.common.data.DeviceProfile; |
|
|
|
import org.thingsboard.server.common.data.DeviceProfileInfo; |
|
|
|
import org.thingsboard.server.common.data.DeviceProfileProvisionType; |
|
|
|
import org.thingsboard.server.common.data.DeviceProfileType; |
|
|
|
import org.thingsboard.server.common.data.DeviceTransportType; |
|
|
|
import org.thingsboard.server.common.data.Tenant; |
|
|
|
@ -101,6 +102,7 @@ public abstract class BaseDeviceProfileControllerTest extends AbstractController |
|
|
|
Assert.assertEquals(deviceProfile.getProfileData(), savedDeviceProfile.getProfileData()); |
|
|
|
Assert.assertEquals(deviceProfile.isDefault(), savedDeviceProfile.isDefault()); |
|
|
|
Assert.assertEquals(deviceProfile.getDefaultRuleChainId(), savedDeviceProfile.getDefaultRuleChainId()); |
|
|
|
Assert.assertEquals(DeviceProfileProvisionType.DISABLED, savedDeviceProfile.getProvisionType()); |
|
|
|
savedDeviceProfile.setName("New device profile"); |
|
|
|
doPost("/api/deviceProfile", savedDeviceProfile, DeviceProfile.class); |
|
|
|
DeviceProfile foundDeviceProfile = doGet("/api/deviceProfile/"+savedDeviceProfile.getId().getId().toString(), DeviceProfile.class); |
|
|
|
|
|
|
|
@ -373,7 +373,9 @@ public class DeviceProfileServiceImpl extends AbstractEntityService implements D |
|
|
|
throw new DataValidationException("Another default device profile is present in scope of current tenant!"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (deviceProfile.getProvisionType() == null) { |
|
|
|
deviceProfile.setProvisionType(DeviceProfileProvisionType.DISABLED); |
|
|
|
} |
|
|
|
DeviceProfileTransportConfiguration transportConfiguration = deviceProfile.getProfileData().getTransportConfiguration(); |
|
|
|
transportConfiguration.validate(); |
|
|
|
if (transportConfiguration instanceof MqttDeviceProfileTransportConfiguration) { |
|
|
|
|