|
|
|
@ -51,6 +51,7 @@ public class AbstractChunkedAggregationTimeseriesDaoTest { |
|
|
|
Optional<TsKvEntry> optionalListenableFuture = Optional.of(mock(TsKvEntry.class)); |
|
|
|
willReturn(Futures.immediateFuture(optionalListenableFuture)).given(tsDao).findAndAggregateAsync(any(), anyString(), anyLong(), anyLong(), anyLong(), any()); |
|
|
|
willReturn(Futures.immediateFuture(mock(ReadTsKvQueryResult.class))).given(tsDao).getReadTsKvQueryResultFuture(any(), any()); |
|
|
|
willReturn(mock(ReadTsKvQueryResult.class)).given(tsDao).findAllAsyncWithLimit(any(), any()); |
|
|
|
} |
|
|
|
|
|
|
|
@Test |
|
|
|
@ -146,6 +147,24 @@ public class AbstractChunkedAggregationTimeseriesDaoTest { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@Test |
|
|
|
public void givenZeroInterval_whenAggregateCount_thenFindAllWithoutAggregation() { |
|
|
|
givenInterval_whenAggregateCount_thenFindAllWithoutAggregation(0); |
|
|
|
} |
|
|
|
|
|
|
|
@Test |
|
|
|
public void givenNegativeInterval_whenAggregateCount_thenFindAllWithoutAggregation() { |
|
|
|
givenInterval_whenAggregateCount_thenFindAllWithoutAggregation(-1); |
|
|
|
} |
|
|
|
|
|
|
|
public void givenInterval_whenAggregateCount_thenFindAllWithoutAggregation(int interval) { |
|
|
|
ReadTsKvQuery query = new BaseReadTsKvQuery(TEMP, 1, 3000, interval, LIMIT, COUNT, DESC); |
|
|
|
willCallRealMethod().given(tsDao).findAllAsync(SYS_TENANT_ID, SYS_TENANT_ID, query); |
|
|
|
tsDao.findAllAsync(SYS_TENANT_ID, SYS_TENANT_ID, query); |
|
|
|
verify(tsDao, times(1)).findAllAsyncWithLimit(any(), any()); |
|
|
|
verify(tsDao, times(0)).findAndAggregateAsync(any(), any(), anyLong(), anyLong(), anyLong(), any()); |
|
|
|
} |
|
|
|
|
|
|
|
long getTsForReadTsKvQuery(long startTs, long endTs) { |
|
|
|
return startTs + (endTs - startTs) / 2L; |
|
|
|
} |
|
|
|
|