use of com.axibase.tsd.api.model.series.query.SeriesQuery in project atsd-api-test by axibase.
the class AnotherTradeSideTest method addTestCase.
private void addTestCase(boolean isAggregate, String function, String periodStr, String[] requestedSides, List<TestCase> testCases) {
Period period = Period.from(periodStr);
SeriesQuery query = query(isAggregate, function, period, requestedSides);
int seriesCount = expectedSeriesCount(isAggregate, requestedSides);
Set<String> expectedSides = expectedSides(isAggregate, requestedSides);
int expectedSamplesCount = expectedSamplesCount(period);
testCases.add(new TestCase(query, seriesCount, expectedSides, expectedSamplesCount));
}
use of com.axibase.tsd.api.model.series.query.SeriesQuery in project atsd-api-test by axibase.
the class SeriesQueryTest method testSameDoubleSeriesQueryWithAggregation.
@Issue("4714")
@Test(description = "test same double series query")
public void testSameDoubleSeriesQueryWithAggregation() {
SeriesQuery query = new SeriesQuery(TEST_SERIES3.getEntity(), TEST_SERIES3.getMetric());
query.setStartDate("2017-01-01T00:01:00Z");
query.setEndDate("2017-01-01T00:04:00Z");
query.setAggregate(new Aggregate(AggregationType.SUM, new Period(3, TimeUnit.MINUTE, PeriodAlignment.START_TIME)));
List<Series> seriesList = SeriesMethod.querySeriesAsList(query, query);
List<Series> result = new ArrayList<>();
for (Series series : seriesList) {
result.add(pullCheckedFields(series));
}
Series expectedSeries = new Series();
expectedSeries.setEntity(TEST_SERIES3.getEntity());
expectedSeries.setMetric(TEST_SERIES3.getMetric());
expectedSeries.setTags(Mocks.TAGS);
expectedSeries.addSamples(Sample.ofDateDecimal("2017-01-01T00:01:00Z", new BigDecimal("6.0")));
assertEquals("Incorrect query result with two same series requests", Arrays.asList(expectedSeries, expectedSeries), result);
}
use of com.axibase.tsd.api.model.series.query.SeriesQuery in project atsd-api-test by axibase.
the class SeriesQueryTest method testSameDoubleSeriesQuery.
@Issue("4714")
@Test(description = "test same double series query")
public void testSameDoubleSeriesQuery() throws JSONException {
SeriesQuery query = new SeriesQuery(TEST_SERIES3.getEntity(), TEST_SERIES3.getMetric());
query.setStartDate("2017-01-01T00:01:00Z");
query.setEndDate("2017-01-01T00:04:00Z");
CommonAssertions.jsonAssert(Arrays.asList(TEST_SERIES3, TEST_SERIES3), SeriesMethod.querySeries(Arrays.asList(query, query)));
}
use of com.axibase.tsd.api.model.series.query.SeriesQuery in project atsd-api-test by axibase.
the class SeriesQueryTest method testDateFilterRangeIsAfterStorableRange.
@Issue("3013")
@Test
public void testDateFilterRangeIsAfterStorableRange() throws Exception {
String entityName = "e-query-range-15";
String metricName = "m-query-range-15";
BigDecimal v = new BigDecimal("7");
Series series = new Series(entityName, metricName);
series.addSamples(Sample.ofDateDecimal(MIN_STORABLE_DATE, v));
insertSeriesCheck(Collections.singletonList(series));
SeriesQuery seriesQuery = new SeriesQuery(series.getEntity(), series.getMetric(), addOneMS(MAX_STORABLE_DATE), MAX_QUERYABLE_DATE);
List<Sample> data = querySeriesAsList(seriesQuery).get(0).getData();
assertEquals("Not empty data for disjoint query and stored interval", 0, data.size());
}
use of com.axibase.tsd.api.model.series.query.SeriesQuery in project atsd-api-test by axibase.
the class SeriesQueryTest method testEndTimeAggregationWithInterpolation.
@Issue("4867")
@Test(description = "test END_TIME period align aggregation with interpolation")
public void testEndTimeAggregationWithInterpolation() {
SeriesQuery query = new SeriesQuery(TEST_SERIES3.getEntity(), TEST_SERIES3.getMetric());
query.setStartDate("2017-01-01T00:00:50Z");
query.setEndDate("2017-01-01T00:03:30Z");
Aggregate aggregate = new Aggregate(AggregationType.MAX, new Period(1, TimeUnit.MINUTE, PeriodAlignment.END_TIME));
aggregate.setInterpolate(new AggregationInterpolate(AggregationInterpolateType.PREVIOUS));
query.setAggregate(aggregate);
List<Series> result = SeriesMethod.querySeriesAsList(query);
Series expectedSeries = new Series();
expectedSeries.setEntity(TEST_SERIES3.getEntity());
expectedSeries.setMetric(TEST_SERIES3.getMetric());
expectedSeries.setTags(Mocks.TAGS);
expectedSeries.addSamples(Sample.ofDateDecimal("2017-01-01T00:01:30Z", new BigDecimal("2.0")), Sample.ofDateDecimal("2017-01-01T00:02:30Z", new BigDecimal("3.0")));
assertEquals("Incorrect query result with END_TIME period align aggregation with interpolation", 1, result.size());
assertEquals("Incorrect query result with END_TIME period align aggregation with interpolation", expectedSeries, pullCheckedFields(result.get(0)));
}
Aggregations