Search in sources :

Example 1 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 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");
}
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 2 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 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");
}
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) Aggregate(com.axibase.tsd.api.model.series.query.transformation.aggregate.Aggregate) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Example 3 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 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");
}
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 4 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 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");
}
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 5 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 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");
}
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) 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