added test
This commit is contained in:
parent
665bb03a1f
commit
bca508ac00
@ -499,7 +499,8 @@ public class EntityQueryControllerTest extends AbstractControllerTest {
|
||||
);
|
||||
EntityDataPageLink pageLink = new EntityDataPageLink(10, 0, null, sortOrder);
|
||||
List<EntityKey> entityFields = Collections.singletonList(new EntityKey(EntityKeyType.ENTITY_FIELD, "name"));
|
||||
List<EntityKey> latestValues = Collections.singletonList(new EntityKey(EntityKeyType.ATTRIBUTE, "temperature"));
|
||||
List<EntityKey> latestValues = List.of(new EntityKey(EntityKeyType.ATTRIBUTE, "temperature"),
|
||||
new EntityKey(EntityKeyType.ATTRIBUTE, "non-existing-attribute"));
|
||||
|
||||
EntityDataQuery query = new EntityDataQuery(filter, pageLink, entityFields, latestValues, null);
|
||||
PageData<EntityData> data = findByQueryAndCheck(query, 67);
|
||||
@ -517,6 +518,14 @@ public class EntityQueryControllerTest extends AbstractControllerTest {
|
||||
List<String> deviceTemperatures = temperatures.stream().map(aLong -> Long.toString(aLong)).collect(Collectors.toList());
|
||||
Assert.assertEquals(deviceTemperatures, loadedTemperatures);
|
||||
|
||||
// check ts value == 0, value is empty string for non-existing data points
|
||||
List<TsValue> loadedNonExistingAttributes = loadedEntities.stream().map(entityData ->
|
||||
entityData.getLatest().get(EntityKeyType.ATTRIBUTE).get("non-existing-attribute")).toList();
|
||||
loadedNonExistingAttributes.forEach(tsValue -> {
|
||||
assertThat(tsValue.getTs()).isEqualTo(0L);
|
||||
assertThat(tsValue.getValue()).isEqualTo("");
|
||||
});
|
||||
|
||||
pageLink = new EntityDataPageLink(10, 0, null, sortOrder);
|
||||
KeyFilter highTemperatureFilter = new KeyFilter();
|
||||
highTemperatureFilter.setKey(new EntityKey(EntityKeyType.ATTRIBUTE, "temperature"));
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user