|
|
|
@ -16,14 +16,10 @@ |
|
|
|
package org.thingsboard.server.transport.lwm2m.ota; |
|
|
|
|
|
|
|
import com.fasterxml.jackson.core.type.TypeReference; |
|
|
|
import com.fasterxml.jackson.databind.node.ObjectNode; |
|
|
|
import com.github.dockerjava.zerodep.shaded.org.apache.commons.codec.binary.Hex; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.eclipse.leshan.core.ResponseCode; |
|
|
|
import org.springframework.mock.web.MockMultipartFile; |
|
|
|
import org.springframework.test.web.servlet.request.MockMultipartHttpServletRequestBuilder; |
|
|
|
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; |
|
|
|
import org.thingsboard.common.util.JacksonUtil; |
|
|
|
import org.thingsboard.server.common.data.Device; |
|
|
|
import org.thingsboard.server.common.data.OtaPackageInfo; |
|
|
|
import org.thingsboard.server.common.data.id.DeviceProfileId; |
|
|
|
@ -35,20 +31,13 @@ import org.thingsboard.server.transport.lwm2m.AbstractLwM2MIntegrationTest; |
|
|
|
|
|
|
|
import java.util.Comparator; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Optional; |
|
|
|
import java.util.UUID; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
import static org.junit.Assert.assertEquals; |
|
|
|
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; |
|
|
|
import static org.thingsboard.rest.client.utils.RestJsonConverter.toTimeseries; |
|
|
|
import static org.thingsboard.server.common.data.ota.OtaPackageType.FIRMWARE; |
|
|
|
import static org.thingsboard.server.common.data.ota.OtaPackageType.SOFTWARE; |
|
|
|
import static org.thingsboard.server.transport.lwm2m.server.ota.DefaultLwM2MOtaUpdateService.OTA_INFO_19_FILE_CHECKSUM256; |
|
|
|
import static org.thingsboard.server.transport.lwm2m.server.ota.DefaultLwM2MOtaUpdateService.OTA_INFO_19_FILE_NAME; |
|
|
|
import static org.thingsboard.server.transport.lwm2m.server.ota.DefaultLwM2MOtaUpdateService.OTA_INFO_19_FILE_SIZE; |
|
|
|
import static org.thingsboard.server.transport.lwm2m.server.ota.DefaultLwM2MOtaUpdateService.OTA_INFO_19_TITLE; |
|
|
|
import static org.thingsboard.server.transport.lwm2m.server.ota.DefaultLwM2MOtaUpdateService.OTA_INFO_19_VERSION; |
|
|
|
|
|
|
|
@Slf4j |
|
|
|
@DaoSqlTest |
|
|
|
@ -57,7 +46,6 @@ public abstract class AbstractOtaLwM2MIntegrationTest extends AbstractLwM2MInteg |
|
|
|
protected static final String CLIENT_ENDPOINT_WITHOUT_FW_INFO = "WithoutFirmwareInfoDevice"; |
|
|
|
protected static final String CLIENT_ENDPOINT_OTA5 = "Ota5_Device"; |
|
|
|
protected static final String CLIENT_ENDPOINT_OTA9 = "Ota9_Device"; |
|
|
|
protected static final String CLIENT_ENDPOINT_OTA9_19 = "Ota9_Device_19"; |
|
|
|
protected List<OtaPackageUpdateStatus> expectedStatuses; |
|
|
|
|
|
|
|
protected final String OBSERVE_ATTRIBUTES_WITH_PARAMS_OTA5 = |
|
|
|
@ -88,37 +76,6 @@ public abstract class AbstractOtaLwM2MIntegrationTest extends AbstractLwM2MInteg |
|
|
|
" \"attributeLwm2m\": {}\n" + |
|
|
|
" }"; |
|
|
|
|
|
|
|
protected final String OBSERVE_ATTRIBUTES_WITH_PARAMS_OTA5_19 = |
|
|
|
|
|
|
|
" {\n" + |
|
|
|
" \"keyName\": {\n" + |
|
|
|
" \"/5_1.2/0/3\": \"state\",\n" + |
|
|
|
" \"/5_1.2/0/5\": \"updateResult\",\n" + |
|
|
|
" \"/5_1.2/0/6\": \"pkgname\",\n" + |
|
|
|
" \"/5_1.2/0/7\": \"pkgversion\",\n" + |
|
|
|
" \"/5_1.2/0/9\": \"firmwareUpdateDeliveryMethod\",\n" + |
|
|
|
" \"/19_1.1/0/0\": \"dataRead\"\n" + |
|
|
|
" },\n" + |
|
|
|
" \"observe\": [\n" + |
|
|
|
" \"/5_1.2/0/3\",\n" + |
|
|
|
" \"/5_1.2/0/5\",\n" + |
|
|
|
" \"/5_1.2/0/6\",\n" + |
|
|
|
" \"/5_1.2/0/7\",\n" + |
|
|
|
" \"/5_1.2/0/9\",\n" + |
|
|
|
" \"/19_1.1/0/0\"\n" + |
|
|
|
" ],\n" + |
|
|
|
" \"attribute\": [],\n" + |
|
|
|
" \"telemetry\": [\n" + |
|
|
|
" \"/5_1.2/0/3\",\n" + |
|
|
|
" \"/5_1.2/0/5\",\n" + |
|
|
|
" \"/5_1.2/0/6\",\n" + |
|
|
|
" \"/5_1.2/0/7\",\n" + |
|
|
|
" \"/5_1.2/0/9\",\n" + |
|
|
|
" \"/19_1.1/0/0\"\n" + |
|
|
|
" ],\n" + |
|
|
|
" \"attributeLwm2m\": {}\n" + |
|
|
|
" }"; |
|
|
|
|
|
|
|
public static final String CLIENT_LWM2M_SETTINGS_19 = |
|
|
|
" {\n" + |
|
|
|
" \"useObject19ForOtaInfo\": true,\n" + |
|
|
|
|