fix_bug: lwm2m tests Object9
This commit is contained in:
parent
4fdc390ddc
commit
b900a63ba4
@ -38,6 +38,7 @@ import java.util.stream.Collectors;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.awaitility.Awaitility.await;
|
||||
import static org.hamcrest.Matchers.hasSize;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.thingsboard.rest.client.utils.RestJsonConverter.toTimeseries;
|
||||
import static org.thingsboard.server.common.data.ota.OtaPackageUpdateStatus.DOWNLOADED;
|
||||
import static org.thingsboard.server.common.data.ota.OtaPackageUpdateStatus.DOWNLOADING;
|
||||
@ -155,13 +156,9 @@ public class OtaLwM2MIntegrationTest extends AbstractOtaLwM2MIntegrationTest {
|
||||
final Device device = createDevice(deviceCredentials, this.CLIENT_ENDPOINT_OTA9);
|
||||
createNewClient(SECURITY_NO_SEC, COAP_CONFIG, false, this.CLIENT_ENDPOINT_OTA9, false, null);
|
||||
|
||||
Thread.sleep(1000);
|
||||
|
||||
device.setSoftwareId(createSoftware().getId());
|
||||
final Device savedDevice = doPost("/api/device", device, Device.class); //sync call
|
||||
|
||||
Thread.sleep(1000);
|
||||
|
||||
assertThat(savedDevice).as("saved device").isNotNull();
|
||||
assertThat(getDeviceFromAPI(device.getId().getId())).as("fetched device").isEqualTo(savedDevice);
|
||||
|
||||
@ -174,14 +171,17 @@ public class OtaLwM2MIntegrationTest extends AbstractOtaLwM2MIntegrationTest {
|
||||
log.warn("Got the ts: {}", ts);
|
||||
|
||||
ts.sort(Comparator.comparingLong(TsKvEntry::getTs));
|
||||
log.warn("Ts ordered: {}", ts);
|
||||
ts.forEach((x) -> log.warn("ts: { Thread.sleep(1000);} ", x));
|
||||
ts.forEach((x) -> log.warn("ts: ordered:{} ", x));
|
||||
List<OtaPackageUpdateStatus> statuses = ts.stream().map(KvEntry::getValueAsString)
|
||||
.map(OtaPackageUpdateStatus::valueOf)
|
||||
.collect(Collectors.toList());
|
||||
log.warn("Converted ts to statuses: {}", statuses);
|
||||
|
||||
assertThat(statuses).isEqualTo(expectedStatuses);
|
||||
statuses.removeAll(expectedStatuses);
|
||||
if (statuses.isEmpty()) {
|
||||
log.trace("Statuses must be empty [{}]", statuses);
|
||||
}
|
||||
assertTrue(statuses.isEmpty());
|
||||
}
|
||||
|
||||
private Device getDeviceFromAPI(UUID deviceId) throws Exception {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user