use of com.axibase.tsd.api.model.series.query.SeriesQuery in project atsd-api-test by axibase.
the class SeriesQueryTransformationsLimitTest method testGroupAggregateRateLimit.
@Issue("4835")
@Test(description = "test that limit is applied correctly after all permutations of grouping, aggregation, and rate")
public void testGroupAggregateRateLimit() throws Exception {
SeriesQuery query = new SeriesQuery("*", METRIC, "2017-01-01T00:00:00Z", "2017-01-01T02:00:00Z");
query.setEntities(ENTITIES);
for (int i = 1; i <= 3; i++) {
for (int j = 1; j <= 3; j++) {
for (int k = 1; k < 3; k++) {
if (i != j && j != k && k != i) {
GROUP.setOrder(i);
query.setGroup(GROUP);
AGGREGATE.setOrder(j);
query.setAggregate(AGGREGATE);
RATE.setOrder(k);
query.setRate(RATE);
checkResponse(query);
}
}
}
}
}
use of com.axibase.tsd.api.model.series.query.SeriesQuery in project atsd-api-test by axibase.
the class SeriesQueryWildcardTest method testEntityWithWildcardExactMatchTrue.
@Issue("3371")
@Test
public void testEntityWithWildcardExactMatchTrue() throws Exception {
TestNameGenerator nameGenerator = new TestNameGenerator();
String metricName = Mocks.metric();
Series series1 = new Series(nameGenerator.newEntityName(), metricName);
series1.addSamples(Sample.ofDateInteger(MIN_STORABLE_DATE, 7));
Series series2 = new Series(nameGenerator.newEntityName(), metricName, "tag_key", "tag_value");
series2.addSamples(Sample.ofTimeInteger(MIN_STORABLE_TIMESTAMP, 7), Sample.ofTimeInteger(MIN_STORABLE_TIMESTAMP + 1, 8));
insertSeriesCheck(series1, series2);
SeriesQuery seriesQuery = new SeriesQuery(nameGenerator.getPrefix(TestNameGenerator.Key.ENTITY).concat("*"), series1.getMetric(), MIN_QUERYABLE_DATE, MAX_QUERYABLE_DATE);
seriesQuery.setExactMatch(true);
seriesQuery.setLimit(2);
seriesQuery.setSeriesLimit(1);
List<Sample> data = querySeriesAsList(seriesQuery).get(0).getData();
assertEquals("ExactMatch true with wildcard doesn't return series without tags", 1, data.size());
seriesQuery.addTag("tag_key", "tag_value");
data = querySeriesAsList(seriesQuery).get(0).getData();
assertEquals("ExactMatch true with wildcard doesn't return series with tags", 2, data.size());
}
use of com.axibase.tsd.api.model.series.query.SeriesQuery in project atsd-api-test by axibase.
the class SeriesQueryAddMetaTest method checkMeta.
private void checkMeta(String entity, String metric, SeriesType type) {
SeriesQuery seriesQuery = new SeriesQuery(entity, metric, MIN_QUERYABLE_DATE, MAX_QUERYABLE_DATE).setAddMeta(true).setType(type);
List<Series> seriesList = querySeriesAsList(seriesQuery);
assertEquals(String.format("Response for series query of type %s has inappropriate length", type), 1, seriesList.size());
SeriesMeta meta = seriesList.get(0).getMeta();
assertTrue(String.format("Response for series query of type %s doesn't contain meta", type), meta != null);
assertTrue(String.format("Response for series query of type %s doesn't contain entity meta", type), meta.getEntity() != null);
assertTrue(String.format("Response for series query of type %s doesn't contain metric meta", type), meta.getMetric() != null);
}
use of com.axibase.tsd.api.model.series.query.SeriesQuery in project atsd-api-test by axibase.
the class SeriesQueryDateFilterTest method testStartEqualEndRaiseError.
@Issue("3030")
@Test
public void testStartEqualEndRaiseError() throws Exception {
SeriesQuery query = new SeriesQuery("mockEntity", "mockMetric");
query.setEndDate(MIN_QUERYABLE_DATE);
query.setStartDate(MIN_QUERYABLE_DATE);
Response response = querySeries(query);
assertEquals("Response code mismatch", BAD_REQUEST.getStatusCode(), response.getStatus());
assertEquals("Error message mismatch", DATE_FILTER_END_GREATER_START_REQUIRED, extractErrorMessage(response));
}
use of com.axibase.tsd.api.model.series.query.SeriesQuery in project atsd-api-test by axibase.
the class SeriesQueryDateFilterTest method testIntervalZeroAndEndRaiseError.
@Issue("3030")
@Test
public void testIntervalZeroAndEndRaiseError() throws Exception {
SeriesQuery query = new SeriesQuery("mockEntity", "mockMetric");
query.setInterval(new Period(0, TimeUnit.HOUR));
query.setEndDate(MIN_QUERYABLE_DATE);
Response response = querySeries(query);
assertEquals("Response code mismatch", BAD_REQUEST.getStatusCode(), response.getStatus());
assertEquals("Error message mismatch", DATE_FILTER_END_GREATER_START_REQUIRED, extractErrorMessage(response));
}
Aggregations