use of com.axibase.tsd.api.model.Period in project atsd-api-test by axibase.
the class PostEvaluationTest method testRate.
@Test(description = "Calculate rate of evaluation-generated series.")
public void testRate() {
SeriesQuery query = baseQuery.withRate(new Rate(new Period(10, TimeUnit.MINUTE))).withTransformationOrder(Arrays.asList(EVALUATE, RATE));
List<Series> seriesList = querySeriesAsList(query);
assertEquals(seriesList.size(), seriesCount);
Collections.sort(seriesList);
checkValues(seriesList.get(0), "2", "1", "2", "1");
checkValues(seriesList.get(1), "4", "2", "4", "2");
checkValues(seriesList.get(2), "6", "3", "6", "3");
checkValues(seriesList.get(3), "8", "4", "8", "4");
checkValues(seriesList.get(4), "10", "5", "10", "5");
}
use of com.axibase.tsd.api.model.Period in project atsd-api-test by axibase.
the class SeriesQueryAggregateGroupOrderRateTest method testGroupSeriesLimit.
@Issue("4729")
@Test(description = "test query result with group seriesLimit")
public void testGroupSeriesLimit() {
SeriesQuery query = new SeriesQuery("*", TEST_METRIC, "2017-01-01T00:00:00Z", "2017-01-01T00:00:20Z");
query.setGroup(new Group(GroupType.COUNT, new Period(5, TimeUnit.SECOND)));
query.setSeriesLimit(1);
Set<CheckedFields> actualFields = createCheckFields(querySeriesAsList(query));
CheckedFields series = new CheckedFields("*", Arrays.asList(Sample.ofDateDecimal("2017-01-01T00:00:00.000Z", BigDecimal.valueOf(5.0d)), Sample.ofDateDecimal("2017-01-01T00:00:05.000Z", BigDecimal.valueOf(5.0d)), Sample.ofDateDecimal("2017-01-01T00:00:10.000Z", BigDecimal.valueOf(5.0d)), Sample.ofDateDecimal("2017-01-01T00:00:15.000Z", BigDecimal.valueOf(5.0d))));
Set<CheckedFields> expectedFields = collectCheckFields(series);
assertEquals(actualFields, expectedFields, "Incorrect query result with group seriesLimit");
}
use of com.axibase.tsd.api.model.Period in project atsd-api-test by axibase.
the class SeriesQueryAggregateGroupOrderRateTest method testAggregateOrder.
@Issue("4729")
@Test(dataProvider = "provideOrders", description = "test query result with aggregate")
public void testAggregateOrder(Integer order) {
SeriesQuery query = new SeriesQuery("*", TEST_METRIC, "2017-01-01T00:00:00Z", "2017-01-01T00:00:20Z");
Aggregate aggregate = new Aggregate(AggregationType.MIN, new Period(10, TimeUnit.SECOND));
if (order != null) {
aggregate.setOrder(order);
}
query.setAggregate(aggregate);
Set<CheckedFields> actualFields = createCheckFields(querySeriesAsList(query));
CheckedFields series1 = new CheckedFields(TEST_ENTITY1, Arrays.asList(Sample.ofDateDecimal("2017-01-01T00:00:00.000Z", new BigDecimal("101.0")), Sample.ofDateDecimal("2017-01-01T00:00:10.000Z", new BigDecimal("111.0"))));
CheckedFields series2 = new CheckedFields(TEST_ENTITY2, Arrays.asList(Sample.ofDateDecimal("2017-01-01T00:00:00.000Z", new BigDecimal("200.0")), Sample.ofDateDecimal("2017-01-01T00:00:10.000Z", new BigDecimal("210.0"))));
Set<CheckedFields> expectedFields = collectCheckFields(series1, series2);
assertEquals(actualFields, expectedFields, "Incorrect query result with aggregate");
}
use of com.axibase.tsd.api.model.Period in project atsd-api-test by axibase.
the class SeriesQueryAggregateGroupOrderRateTest method testGroupOrder.
@Issue("4729")
@Test(dataProvider = "provideOrders", description = "test query result with group")
public void testGroupOrder(Integer order) {
SeriesQuery query = new SeriesQuery("*", TEST_METRIC, "2017-01-01T00:00:00Z", "2017-01-01T00:00:20Z");
Group group = new Group(GroupType.MAX, new Period(5, TimeUnit.SECOND));
if (order != null) {
group.setOrder(order);
}
query.setGroup(group);
Set<CheckedFields> actualFields = createCheckFields(querySeriesAsList(query));
CheckedFields series = new CheckedFields("*", Arrays.asList(Sample.ofDateDecimal("2017-01-01T00:00:00.000Z", new BigDecimal("204.0")), Sample.ofDateDecimal("2017-01-01T00:00:05.000Z", new BigDecimal("208.0")), Sample.ofDateDecimal("2017-01-01T00:00:10.000Z", new BigDecimal("214.0")), Sample.ofDateDecimal("2017-01-01T00:00:15.000Z", new BigDecimal("218.0"))));
Set<CheckedFields> expectedFields = collectCheckFields(series);
assertEquals(actualFields, expectedFields, "Incorrect query result with group");
}
use of com.axibase.tsd.api.model.Period in project atsd-api-test by axibase.
the class SeriesQueryAggregateGroupOrderRateTest method testGroupLimit.
@Issue("4729")
@Test(description = "test query result with group limit")
public void testGroupLimit() {
SeriesQuery query = new SeriesQuery("*", TEST_METRIC, "2017-01-01T00:00:00Z", "2017-01-01T00:00:20Z");
query.setGroup(new Group(GroupType.COUNT, new Period(10, TimeUnit.SECOND)));
query.setLimit(1);
query.setDirection("ASC");
Set<CheckedFields> actualFields = createCheckFields(querySeriesAsList(query));
CheckedFields series = new CheckedFields("*", Arrays.asList(Sample.ofDateDecimal("2017-01-01T00:00:00.000Z", BigDecimal.valueOf(10.0d))));
Set<CheckedFields> expectedFields = collectCheckFields(series);
assertEquals(actualFields, expectedFields, "Incorrect query result with group limit");
}
Aggregations