Merge pull request #4923 from volodymyr-babak/device-provision-type-fix
[3.3.0] Device profile provision type set to DISABLED if not provided
This commit is contained in:
commit
96f92a995c
@ -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) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user