|
|
@ -678,12 +678,12 @@ public abstract class BaseTimeseriesServiceTest extends AbstractServiceTest { |
|
|
|
|
|
|
|
|
@Test |
|
|
@Test |
|
|
public void shouldSaveEntryOfEachType() throws Exception { |
|
|
public void shouldSaveEntryOfEachType() throws Exception { |
|
|
List<TsKvEntry> timeseries = List.of( |
|
|
BasicTsKvEntry booleanEntry = new BasicTsKvEntry(TimeUnit.MINUTES.toMillis(1), new BooleanDataEntry("test", true)); |
|
|
new BasicTsKvEntry(TimeUnit.MINUTES.toMillis(1), new BooleanDataEntry("test", true)), |
|
|
BasicTsKvEntry stringEntry = new BasicTsKvEntry(TimeUnit.MINUTES.toMillis(2), new StringDataEntry("test", "text")); |
|
|
new BasicTsKvEntry(TimeUnit.MINUTES.toMillis(2), new StringDataEntry("test", "text")), |
|
|
BasicTsKvEntry longEntry = new BasicTsKvEntry(TimeUnit.MINUTES.toMillis(3), new LongDataEntry("test", 15L)); |
|
|
new BasicTsKvEntry(TimeUnit.MINUTES.toMillis(3), new LongDataEntry("test", 15L)), |
|
|
BasicTsKvEntry doubleEntry = new BasicTsKvEntry(TimeUnit.MINUTES.toMillis(4), new DoubleDataEntry("test", 10.5)); |
|
|
new BasicTsKvEntry(TimeUnit.MINUTES.toMillis(4), new DoubleDataEntry("test", 10.5)), |
|
|
BasicTsKvEntry jsonEntry = new BasicTsKvEntry(TimeUnit.MINUTES.toMillis(5), new JsonDataEntry("test", "{\"test\":\"testValue\"}")); |
|
|
new BasicTsKvEntry(TimeUnit.MINUTES.toMillis(5), new JsonDataEntry("test", "{\"test\":\"testValue\"}"))); |
|
|
List<TsKvEntry> timeseries = List.of(booleanEntry, stringEntry, longEntry, doubleEntry, jsonEntry); |
|
|
|
|
|
|
|
|
DeviceId deviceId = new DeviceId(Uuids.timeBased()); |
|
|
DeviceId deviceId = new DeviceId(Uuids.timeBased()); |
|
|
for (TsKvEntry tsKvEntry : timeseries) { |
|
|
for (TsKvEntry tsKvEntry : timeseries) { |
|
|
@ -693,10 +693,13 @@ public abstract class BaseTimeseriesServiceTest extends AbstractServiceTest { |
|
|
List<TsKvEntry> listUntil3Minutes = tsService.findAll(tenantId, deviceId, Collections.singletonList(new BaseReadTsKvQuery("test", 0L, |
|
|
List<TsKvEntry> listUntil3Minutes = tsService.findAll(tenantId, deviceId, Collections.singletonList(new BaseReadTsKvQuery("test", 0L, |
|
|
TimeUnit.MINUTES.toMillis(3), 1000, 10, Aggregation.NONE))).get(MAX_TIMEOUT, TimeUnit.SECONDS); |
|
|
TimeUnit.MINUTES.toMillis(3), 1000, 10, Aggregation.NONE))).get(MAX_TIMEOUT, TimeUnit.SECONDS); |
|
|
assertEquals(2, listUntil3Minutes.size()); |
|
|
assertEquals(2, listUntil3Minutes.size()); |
|
|
|
|
|
assertThat(listUntil3Minutes).containsOnlyOnceElementsOf(List.of( |
|
|
|
|
|
booleanEntry, stringEntry)); |
|
|
|
|
|
|
|
|
List<TsKvEntry> fullList = tsService.findAll(tenantId, deviceId, Collections.singletonList(new BaseReadTsKvQuery("test", 0L, |
|
|
List<TsKvEntry> fullList = tsService.findAll(tenantId, deviceId, Collections.singletonList(new BaseReadTsKvQuery("test", 0L, |
|
|
TimeUnit.MINUTES.toMillis(6), 1000, 10, Aggregation.NONE))).get(MAX_TIMEOUT, TimeUnit.SECONDS); |
|
|
TimeUnit.MINUTES.toMillis(6), 1000, 10, Aggregation.NONE))).get(MAX_TIMEOUT, TimeUnit.SECONDS); |
|
|
assertEquals(5, fullList.size()); |
|
|
assertEquals(5, fullList.size()); |
|
|
|
|
|
assertThat(fullList).containsOnlyOnceElementsOf(timeseries); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private TsKvEntry save(DeviceId deviceId, long ts, long value) throws Exception { |
|
|
private TsKvEntry save(DeviceId deviceId, long ts, long value) throws Exception { |
|
|
|