use of com.axibase.tsd.api.model.series.query.transformation.rate.Rate in project atsd-api-test by axibase.
the class SeriesQueryAggregateGroupOrderRateTest method testRateLimit.
@Issue("4729")
@Test(description = "test query result with rate limit")
public void testRateLimit() {
SeriesQuery query = new SeriesQuery("*", TEST_METRIC, "2017-01-01T00:00:00Z", "2017-01-01T00:00:20Z");
query.setRate(new Rate(new Period(10, TimeUnit.SECOND)));
query.setLimit(1);
query.setDirection("ASC");
List<Series> result = querySeriesAsList(query);
Series expectedSeries1 = createSeries(TEST_ENTITY1, Sample.ofDateDecimal("2017-01-01T00:00:03.000Z", new BigDecimal("10.0")));
Series expectedSeries2 = createSeries(TEST_ENTITY2, Sample.ofDateDecimal("2017-01-01T00:00:02.000Z", new BigDecimal("10.0")));
assertEquals(result, Arrays.asList(expectedSeries1, expectedSeries2), "Incorrect query result with group limit");
}
use of com.axibase.tsd.api.model.series.query.transformation.rate.Rate in project atsd-api-test by axibase.
the class SeriesQueryAggregateGroupOrderRateTest method testDefaultOrderRateAggregate.
@Issue("4729")
@Test(description = "test query result with default Group/Aggregate order")
public void testDefaultOrderRateAggregate() {
SeriesQuery query = new SeriesQuery("*", TEST_METRIC, "2017-01-01T00:00:00Z", "2017-01-01T00:00:20Z");
query.setRate(new Rate(new Period(5, TimeUnit.SECOND)));
query.setAggregate(new Aggregate(AggregationType.COUNT, new Period(10, TimeUnit.SECOND)));
List<Series> result = querySeriesAsList(query);
Series expectedSeries1 = createSeries(TEST_ENTITY1, Sample.ofDateInteger("2017-01-01T00:00:00.000Z", 4), Sample.ofDateInteger("2017-01-01T00:00:10.000Z", 5));
Series expectedSeries2 = createSeries(TEST_ENTITY2, Sample.ofDateInteger("2017-01-01T00:00:00.000Z", 4), Sample.ofDateInteger("2017-01-01T00:00:10.000Z", 5));
assertEquals(result, Arrays.asList(expectedSeries1, expectedSeries2), "Incorrect query result with default Rate/Aggregate order");
}
use of com.axibase.tsd.api.model.series.query.transformation.rate.Rate in project atsd-api-test by axibase.
the class SeriesQueryAggregateGroupOrderRateTest method testExplicitOrderGroupRateAggregate.
@Issue("4729")
@Test(description = "test query result with explicit non-equals Group/Aggregate order")
public void testExplicitOrderGroupRateAggregate() {
SeriesQuery query = new SeriesQuery("*", TEST_METRIC, "2017-01-01T00:00:00Z", "2017-01-01T00:00:20Z");
query.setAggregate(new Aggregate(AggregationType.SUM, new Period(4, TimeUnit.SECOND), 3));
query.setGroup(new Group(GroupType.MIN, new Period(5, TimeUnit.SECOND), 4));
query.setRate(new Rate(new Period(10, TimeUnit.SECOND), 5));
List<Series> result = querySeriesAsList(query);
Series expectedSeries = createSeries("*", Sample.ofDateDecimal("2017-01-01T00:00:05.000Z", new BigDecimal("32.0")), Sample.ofDateDecimal("2017-01-01T00:00:10.000Z", new BigDecimal("16.0")), Sample.ofDateDecimal("2017-01-01T00:00:15.000Z", new BigDecimal("16.0")));
assertEquals(result, Collections.singletonList(expectedSeries), "Incorrect query result with explicit non-equals Group/Rate/Aggregate order");
}
use of com.axibase.tsd.api.model.series.query.transformation.rate.Rate in project atsd-api-test by axibase.
the class SeriesQueryAggregateGroupOrderRateTest method testExplicitNegativeOrderGroupRateAggregate.
@Issue("4729")
@Test(description = "test query result with explicit negative Group/Aggregate order")
public void testExplicitNegativeOrderGroupRateAggregate() {
SeriesQuery query = new SeriesQuery("*", TEST_METRIC, "2017-01-01T00:00:00Z", "2017-01-01T00:00:20Z");
query.setAggregate(new Aggregate(AggregationType.SUM, new Period(4, TimeUnit.SECOND), -5));
query.setGroup(new Group(GroupType.MIN, new Period(5, TimeUnit.SECOND), -4));
query.setRate(new Rate(new Period(10, TimeUnit.SECOND), -3));
List<Series> result = querySeriesAsList(query);
Series expectedSeries = createSeries("*", Sample.ofDateDecimal("2017-01-01T00:00:05.000Z", new BigDecimal("32.0")), Sample.ofDateDecimal("2017-01-01T00:00:10.000Z", new BigDecimal("16.0")), Sample.ofDateDecimal("2017-01-01T00:00:15.000Z", new BigDecimal("16.0")));
assertEquals(result, Collections.singletonList(expectedSeries), "Incorrect query result with explicit non-equals Group/Rate/Aggregate order");
}
use of com.axibase.tsd.api.model.series.query.transformation.rate.Rate in project atsd-api-test by axibase.
the class SeriesQueryAggregateGroupOrderRateTest method testDefaultOrderGroupRate.
@Issue("4729")
@Test(description = "test query result with default Group/Rate order")
public void testDefaultOrderGroupRate() {
SeriesQuery query = new SeriesQuery("*", TEST_METRIC, "2017-01-01T00:00:00Z", "2017-01-01T00:00:20Z");
query.setGroup(new Group(GroupType.MAX, new Period(5, TimeUnit.SECOND)));
query.setRate(new Rate(new Period(10, TimeUnit.SECOND)));
List<Series> result = querySeriesAsList(query);
Series expectedSeries = createSeries("*", Sample.ofDateDecimal("2017-01-01T00:00:05.000Z", new BigDecimal("8.0")), Sample.ofDateDecimal("2017-01-01T00:00:10.000Z", new BigDecimal("12.0")), Sample.ofDateDecimal("2017-01-01T00:00:15.000Z", new BigDecimal("8.0")));
assertEquals(result, Collections.singletonList(expectedSeries), "Incorrect query result with default Group/Rate order");
}
Aggregations