Search in sources :

Example 31 with OtaPackageInfo

use of org.thingsboard.server.common.data.OtaPackageInfo in project thingsboard by thingsboard.

the class AbstractOtaLwM2MIntegrationTest method createSoftware.

protected OtaPackageInfo createSoftware() throws Exception {
    String CHECKSUM = "4bf5122f344554c53bde2ebb8cd2b7e3d1600ad631c385a5d7cce23c7785459a";
    OtaPackageInfo swInfo = new OtaPackageInfo();
    swInfo.setDeviceProfileId(deviceProfile.getId());
    swInfo.setType(SOFTWARE);
    swInfo.setTitle("My sw");
    swInfo.setVersion("v1.0");
    OtaPackageInfo savedFirmwareInfo = doPost("/api/otaPackage", swInfo, OtaPackageInfo.class);
    MockMultipartFile testData = new MockMultipartFile("file", "filename.txt", "text/plain", new byte[] { 1 });
    return savaData("/api/otaPackage/" + savedFirmwareInfo.getId().getId().toString() + "?checksum={checksum}&checksumAlgorithm={checksumAlgorithm}", testData, CHECKSUM, "SHA256");
}
Also used : MockMultipartFile(org.springframework.mock.web.MockMultipartFile) OtaPackageInfo(org.thingsboard.server.common.data.OtaPackageInfo)

Aggregations

OtaPackageInfo (org.thingsboard.server.common.data.OtaPackageInfo)31 Test (org.junit.Test)18 SaveOtaPackageInfoRequest (org.thingsboard.server.common.data.SaveOtaPackageInfoRequest)8 MockMultipartFile (org.springframework.mock.web.MockMultipartFile)6 OtaPackageId (org.thingsboard.server.common.data.id.OtaPackageId)6 ArrayList (java.util.ArrayList)5 OtaPackage (org.thingsboard.server.common.data.OtaPackage)5 ThingsboardException (org.thingsboard.server.common.data.exception.ThingsboardException)4 PageLink (org.thingsboard.server.common.data.page.PageLink)4 ApiOperation (io.swagger.annotations.ApiOperation)3 PreAuthorize (org.springframework.security.access.prepost.PreAuthorize)3 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)3 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)3 DataValidationException (org.thingsboard.server.dao.exception.DataValidationException)3 TypeReference (com.fasterxml.jackson.core.type.TypeReference)2 ConstraintViolationException (org.hibernate.exception.ConstraintViolationException)2 Cache (org.springframework.cache.Cache)2 OtaPackageDataCache (org.thingsboard.server.cache.ota.OtaPackageDataCache)2 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)1 HashMap (java.util.HashMap)1