use of com.axibase.tsd.api.model.series.query.SeriesQuery in project atsd-api-test by axibase.
the class SeriesQueryTest method testGroupInterpolateNoTypeRaiseError.
@Issue("3324")
@Test
public void testGroupInterpolateNoTypeRaiseError() throws Exception {
SeriesQuery query = new SeriesQuery("mock-entity", "mock-metric", MIN_QUERYABLE_DATE, MAX_QUERYABLE_DATE);
Group group = new Group(GroupType.SUM, new Period(99999, TimeUnit.QUARTER));
group.setInterpolate(new AggregationInterpolate());
query.setGroup(group);
Response response = querySeries(query);
assertEquals("Query with interpolation but without type should fail", BAD_REQUEST.getStatusCode(), response.getStatus());
assertEquals("Error message mismatch", INTERPOLATE_TYPE_REQUIRED, extractErrorMessage(response));
}
use of com.axibase.tsd.api.model.series.query.SeriesQuery in project atsd-api-test by axibase.
the class SeriesQueryTest method testXTextField.
@Issue("3480")
@Test(dataProvider = "dataTextProvider")
public void testXTextField(String text) throws Exception {
String entityName = entity();
String metricName = metric();
String largeNumber = "10.1";
Series series = new Series(entityName, metricName);
Sample sample = Sample.ofDateDecimalText(MIN_STORABLE_DATE, new BigDecimal(largeNumber), text);
series.addSamples(sample);
insertSeriesCheck(Collections.singletonList(series));
SeriesQuery seriesQuery = new SeriesQuery(series);
List<Series> seriesList = querySeriesAsList(seriesQuery);
assertEquals("Stored series are incorrect", Collections.singletonList(series), seriesList);
}
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() {
SeriesQuery query = new SeriesQuery(TEST_SERIES3.getEntity(), TEST_SERIES3.getMetric());
query.setStartDate("2017-01-01T00:01:00Z");
query.setEndDate("2017-01-01T00:04:00Z");
List<Series> result = SeriesMethod.querySeriesAsList(query, query);
assertEquals("Incorrect query result with two same series requests", Arrays.asList(TEST_SERIES3, TEST_SERIES3), result);
}
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, result.get(0));
}
use of com.axibase.tsd.api.model.series.query.SeriesQuery in project atsd-api-test by axibase.
the class SeriesQueryTest method testSeriesQueryWithTextSample.
@Test
public void testSeriesQueryWithTextSample() throws Exception {
Series series = Mocks.series();
series.setSamples(Collections.singleton(Mocks.TEXT_SAMPLE));
SeriesMethod.insertSeriesCheck(series);
List<Series> resultSeriesList = SeriesMethod.querySeriesAsList(new SeriesQuery(series));
String assertMessage = "SeriesList serialized as not expected!";
assertEquals(assertMessage, Collections.singletonList(series), resultSeriesList);
}
Aggregations