Search in sources :

Example 6 with Rate

use of com.axibase.tsd.api.model.series.query.transformation.rate.Rate in project atsd-api-test by axibase.

the class SeriesQueryAggregateGroupOrderRateTest method testExplicitEqualsOrderGroupRateAggregate.

@Issue("4729")
@Test(description = "test query result with explicit equals Group/Rate/Aggregate order")
public void testExplicitEqualsOrderGroupRateAggregate() {
    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), 0));
    query.setRate(new Rate(new Period(2, TimeUnit.SECOND), 0));
    query.setAggregate(new Aggregate(AggregationType.SUM, new Period(10, TimeUnit.SECOND), 0));
    List<Series> result = querySeriesAsList(query);
    Series expectedSeries = createSeries("*", Sample.ofDateDecimal("2017-01-01T00:00:00.000Z", new BigDecimal("1.6")), Sample.ofDateDecimal("2017-01-01T00:00:10.000Z", new BigDecimal("4.0")));
    assertEquals(result, Collections.singletonList(expectedSeries), "Incorrect query result with explicit equals Group/Aggregate order");
}
Also used : Group(com.axibase.tsd.api.model.series.query.transformation.group.Group) SeriesQuery(com.axibase.tsd.api.model.series.query.SeriesQuery) Rate(com.axibase.tsd.api.model.series.query.transformation.rate.Rate) Period(com.axibase.tsd.api.model.Period) Aggregate(com.axibase.tsd.api.model.series.query.transformation.aggregate.Aggregate) BigDecimal(java.math.BigDecimal) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Example 7 with Rate

use of com.axibase.tsd.api.model.series.query.transformation.rate.Rate in project atsd-api-test by axibase.

the class SeriesQueryAggregateGroupOrderRateTest method testRateSeriesLimit.

@Issue("4729")
@Test(description = "test query result with rate seriesLimit")
public void testRateSeriesLimit() {
    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.setSeriesLimit(1);
    List<Series> result = querySeriesAsList(query);
    Series expectedSeries = createSeries(TEST_ENTITY1, Sample.ofDateDecimal("2017-01-01T00:00:03.000Z", new BigDecimal("5.0")), Sample.ofDateDecimal("2017-01-01T00:00:05.000Z", new BigDecimal("5.0")), Sample.ofDateDecimal("2017-01-01T00:00:07.000Z", new BigDecimal("5.0")), Sample.ofDateDecimal("2017-01-01T00:00:09.000Z", new BigDecimal("5.0")), Sample.ofDateDecimal("2017-01-01T00:00:11.000Z", new BigDecimal("5.0")), Sample.ofDateDecimal("2017-01-01T00:00:13.000Z", new BigDecimal("5.0")), Sample.ofDateDecimal("2017-01-01T00:00:15.000Z", new BigDecimal("5.0")), Sample.ofDateDecimal("2017-01-01T00:00:17.000Z", new BigDecimal("5.0")), Sample.ofDateDecimal("2017-01-01T00:00:19.000Z", new BigDecimal("5.0")));
    assertEquals(result, Collections.singletonList(expectedSeries), "Incorrect query result with rate");
}
Also used : SeriesQuery(com.axibase.tsd.api.model.series.query.SeriesQuery) Rate(com.axibase.tsd.api.model.series.query.transformation.rate.Rate) Period(com.axibase.tsd.api.model.Period) BigDecimal(java.math.BigDecimal) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Example 8 with Rate

use of com.axibase.tsd.api.model.series.query.transformation.rate.Rate in project atsd-api-test by axibase.

the class SeriesQueryAggregateGroupOrderRateTest method testRateOrder.

@Issue("4729")
@Test(dataProvider = "provideOrders", description = "test query result with rate")
public void testRateOrder(Integer order) {
    SeriesQuery query = new SeriesQuery("*", TEST_METRIC, "2017-01-01T00:00:00Z", "2017-01-01T00:00:20Z");
    Rate rate = new Rate(new Period(5, TimeUnit.SECOND));
    if (order != null) {
        rate.setOrder(order);
    }
    query.setRate(rate);
    List<Series> result = querySeriesAsList(query);
    Series expectedSeries1 = createSeries(TEST_ENTITY1, Sample.ofDateDecimal("2017-01-01T00:00:03.000Z", new BigDecimal("5.0")), Sample.ofDateDecimal("2017-01-01T00:00:05.000Z", new BigDecimal("5.0")), Sample.ofDateDecimal("2017-01-01T00:00:07.000Z", new BigDecimal("5.0")), Sample.ofDateDecimal("2017-01-01T00:00:09.000Z", new BigDecimal("5.0")), Sample.ofDateDecimal("2017-01-01T00:00:11.000Z", new BigDecimal("5.0")), Sample.ofDateDecimal("2017-01-01T00:00:13.000Z", new BigDecimal("5.0")), Sample.ofDateDecimal("2017-01-01T00:00:15.000Z", new BigDecimal("5.0")), Sample.ofDateDecimal("2017-01-01T00:00:17.000Z", new BigDecimal("5.0")), Sample.ofDateDecimal("2017-01-01T00:00:19.000Z", new BigDecimal("5.0")));
    Series expectedSeries2 = createSeries(TEST_ENTITY2, Sample.ofDateDecimal("2017-01-01T00:00:02.000Z", new BigDecimal("5.0")), Sample.ofDateDecimal("2017-01-01T00:00:04.000Z", new BigDecimal("5.0")), Sample.ofDateDecimal("2017-01-01T00:00:06.000Z", new BigDecimal("5.0")), Sample.ofDateDecimal("2017-01-01T00:00:08.000Z", new BigDecimal("5.0")), Sample.ofDateDecimal("2017-01-01T00:00:10.000Z", new BigDecimal("5.0")), Sample.ofDateDecimal("2017-01-01T00:00:12.000Z", new BigDecimal("5.0")), Sample.ofDateDecimal("2017-01-01T00:00:14.000Z", new BigDecimal("5.0")), Sample.ofDateDecimal("2017-01-01T00:00:16.000Z", new BigDecimal("5.0")), Sample.ofDateDecimal("2017-01-01T00:00:18.000Z", new BigDecimal("5.0")));
    assertEquals(result, Arrays.asList(expectedSeries1, expectedSeries2), "Incorrect query result with rate");
}
Also used : SeriesQuery(com.axibase.tsd.api.model.series.query.SeriesQuery) Rate(com.axibase.tsd.api.model.series.query.transformation.rate.Rate) Period(com.axibase.tsd.api.model.Period) BigDecimal(java.math.BigDecimal) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Aggregations

Period (com.axibase.tsd.api.model.Period)8 SeriesQuery (com.axibase.tsd.api.model.series.query.SeriesQuery)8 Rate (com.axibase.tsd.api.model.series.query.transformation.rate.Rate)8 Issue (io.qameta.allure.Issue)8 Test (org.testng.annotations.Test)8 BigDecimal (java.math.BigDecimal)7 Aggregate (com.axibase.tsd.api.model.series.query.transformation.aggregate.Aggregate)4 Group (com.axibase.tsd.api.model.series.query.transformation.group.Group)4