use of org.thingsboard.server.common.data.OtaPackage in project thingsboard by thingsboard.
the class BaseOtaPackageServiceTest method testSaveFirmwareWithEmptyData.
@Test
public void testSaveFirmwareWithEmptyData() {
OtaPackage firmware = new OtaPackage();
firmware.setTenantId(tenantId);
firmware.setDeviceProfileId(deviceProfileId);
firmware.setType(FIRMWARE);
firmware.setTitle(TITLE);
firmware.setVersion(VERSION);
firmware.setFileName(FILE_NAME);
firmware.setContentType(CONTENT_TYPE);
firmware.setChecksumAlgorithm(CHECKSUM_ALGORITHM);
firmware.setChecksum(CHECKSUM);
thrown.expect(DataValidationException.class);
thrown.expectMessage("OtaPackage data should be specified!");
otaPackageService.saveOtaPackage(firmware);
}
use of org.thingsboard.server.common.data.OtaPackage in project thingsboard by thingsboard.
the class BaseOtaPackageServiceTest method createFirmware.
private OtaPackage createFirmware(TenantId tenantId, String version) {
OtaPackage firmware = new OtaPackage();
firmware.setTenantId(tenantId);
firmware.setDeviceProfileId(deviceProfileId);
firmware.setType(FIRMWARE);
firmware.setTitle(TITLE);
firmware.setVersion(version);
firmware.setFileName(FILE_NAME);
firmware.setContentType(CONTENT_TYPE);
firmware.setChecksumAlgorithm(CHECKSUM_ALGORITHM);
firmware.setChecksum(CHECKSUM);
firmware.setData(DATA);
firmware.setDataSize(DATA_SIZE);
return otaPackageService.saveOtaPackage(firmware);
}
use of org.thingsboard.server.common.data.OtaPackage in project thingsboard by thingsboard.
the class BaseOtaPackageServiceTest method testSaveFirmwareWithEmptyChecksum.
@Test
public void testSaveFirmwareWithEmptyChecksum() {
OtaPackage firmware = new OtaPackage();
firmware.setTenantId(tenantId);
firmware.setDeviceProfileId(deviceProfileId);
firmware.setType(FIRMWARE);
firmware.setTitle(TITLE);
firmware.setVersion(VERSION);
firmware.setFileName(FILE_NAME);
firmware.setContentType(CONTENT_TYPE);
firmware.setChecksumAlgorithm(CHECKSUM_ALGORITHM);
firmware.setData(DATA);
thrown.expect(DataValidationException.class);
thrown.expectMessage("OtaPackage checksum should be specified!");
otaPackageService.saveOtaPackage(firmware);
}
use of org.thingsboard.server.common.data.OtaPackage in project thingsboard by thingsboard.
the class BaseOtaPackageServiceTest method testSaveFirmwareWithEmptyType.
@Test
public void testSaveFirmwareWithEmptyType() {
OtaPackage firmware = new OtaPackage();
firmware.setTenantId(tenantId);
firmware.setDeviceProfileId(deviceProfileId);
firmware.setTitle(TITLE);
firmware.setVersion(VERSION);
firmware.setFileName(FILE_NAME);
firmware.setContentType(CONTENT_TYPE);
firmware.setChecksumAlgorithm(CHECKSUM_ALGORITHM);
firmware.setChecksum(CHECKSUM);
firmware.setData(DATA);
thrown.expect(DataValidationException.class);
thrown.expectMessage("Type should be specified!");
otaPackageService.saveOtaPackage(firmware);
}
use of org.thingsboard.server.common.data.OtaPackage in project thingsboard by thingsboard.
the class BaseOtaPackageServiceTest method testFindFirmwareById.
@Test
public void testFindFirmwareById() {
OtaPackage savedFirmware = createFirmware(tenantId, VERSION);
OtaPackage foundFirmware = otaPackageService.findOtaPackageById(tenantId, savedFirmware.getId());
Assert.assertNotNull(foundFirmware);
Assert.assertEquals(savedFirmware, foundFirmware);
otaPackageService.deleteOtaPackage(tenantId, savedFirmware.getId());
}
Aggregations