Fix test to use profile with ota on import
This commit is contained in:
parent
5949fa1ac8
commit
71ec0a588a
@ -685,23 +685,28 @@ public class VersionControlTest extends AbstractControllerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testOtaPackageVc_betweenTenants() throws Exception {
|
public void testOtaPackageVcWithProfile_betweenTenants() throws Exception {
|
||||||
DeviceProfile deviceProfile = createDeviceProfile(null, null, "Device profile v1.0");
|
DeviceProfile deviceProfile = createDeviceProfile(null, null, "Device profile v1.0");
|
||||||
OtaPackage firmware = createOtaPackage(tenantId1, deviceProfile.getId(), OtaPackageType.FIRMWARE);
|
OtaPackage firmware = createOtaPackage(tenantId1, deviceProfile.getId(), OtaPackageType.FIRMWARE);
|
||||||
OtaPackage software = createOtaPackage(tenantId1, deviceProfile.getId(), OtaPackageType.SOFTWARE);
|
OtaPackage software = createOtaPackage(tenantId1, deviceProfile.getId(), OtaPackageType.SOFTWARE);
|
||||||
|
deviceProfile.setFirmwareId(firmware.getId());
|
||||||
|
deviceProfile.setSoftwareId(software.getId());
|
||||||
|
deviceProfile = doPost("/api/deviceProfile", deviceProfile, DeviceProfile.class);
|
||||||
String versionId = createVersion("ota packages", EntityType.DEVICE_PROFILE, EntityType.OTA_PACKAGE);
|
String versionId = createVersion("ota packages", EntityType.DEVICE_PROFILE, EntityType.OTA_PACKAGE);
|
||||||
|
|
||||||
OtaPackage firmwareOta = findOtaPackage(firmware.getTitle());
|
|
||||||
OtaPackage softwareOta = findOtaPackage(software.getTitle());
|
|
||||||
|
|
||||||
loginTenant2();
|
loginTenant2();
|
||||||
loadVersion(versionId, EntityType.DEVICE_PROFILE, EntityType.OTA_PACKAGE);
|
loadVersion(versionId, EntityType.DEVICE_PROFILE, EntityType.OTA_PACKAGE);
|
||||||
OtaPackage importedFirmwareOta = findOtaPackage(firmwareOta.getTitle());
|
DeviceProfile importedProfile = findDeviceProfile(deviceProfile.getName());
|
||||||
OtaPackage importedSoftwareOta = findOtaPackage(softwareOta.getTitle());
|
OtaPackage importedFirmwareOta = findOtaPackage(firmware.getTitle());
|
||||||
checkImportedEntity(tenantId1, firmwareOta, tenantId2, importedFirmwareOta);
|
OtaPackage importedSoftwareOta = findOtaPackage(software.getTitle());
|
||||||
checkImportedOtaPackageData(firmwareOta, importedFirmwareOta);
|
checkImportedEntity(tenantId1, deviceProfile, tenantId2, importedProfile);
|
||||||
checkImportedEntity(tenantId1, softwareOta, tenantId2, importedSoftwareOta);
|
checkImportedDeviceProfileData(deviceProfile, importedProfile);
|
||||||
checkImportedOtaPackageData(softwareOta, importedSoftwareOta);
|
checkImportedEntity(tenantId1, firmware, tenantId2, importedFirmwareOta);
|
||||||
|
checkImportedOtaPackageData(firmware, importedFirmwareOta);
|
||||||
|
checkImportedEntity(tenantId1, software, tenantId2, importedSoftwareOta);
|
||||||
|
checkImportedOtaPackageData(software, importedSoftwareOta);
|
||||||
|
assertThat(importedProfile.getFirmwareId()).isEqualTo(importedFirmwareOta.getId());
|
||||||
|
assertThat(importedProfile.getSoftwareId()).isEqualTo(importedSoftwareOta.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void checkImportedOtaPackageData(OtaPackage otaPackage, OtaPackage importedOtaPackage) {
|
protected void checkImportedOtaPackageData(OtaPackage otaPackage, OtaPackage importedOtaPackage) {
|
||||||
|
|||||||
@ -22,6 +22,10 @@ import org.thingsboard.server.common.data.OtaPackage;
|
|||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
public class OtaPackageExportData extends EntityExportData<OtaPackage> {
|
public class OtaPackageExportData extends EntityExportData<OtaPackage> {
|
||||||
|
|
||||||
|
/*
|
||||||
|
* OtaPackage is not a versioned entity; its 'version' field is part of the domain model (not used for optimistic locking)
|
||||||
|
* We override both methods to ensure 'version' is not ignored during (de)serialization.
|
||||||
|
*/
|
||||||
@JsonIgnoreProperties(value = {"tenantId", "createdTime"}, ignoreUnknown = true)
|
@JsonIgnoreProperties(value = {"tenantId", "createdTime"}, ignoreUnknown = true)
|
||||||
@Override
|
@Override
|
||||||
public OtaPackage getEntity() {
|
public OtaPackage getEntity() {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user