Search in sources :

Example 21 with Period

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");
}
Also used : Series(com.axibase.tsd.api.model.series.Series) 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) Test(org.testng.annotations.Test)

Example 22 with Period

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");
}
Also used : Group(com.axibase.tsd.api.model.series.query.transformation.group.Group) SeriesQuery(com.axibase.tsd.api.model.series.query.SeriesQuery) Period(com.axibase.tsd.api.model.Period) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Example 23 with Period

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");
}
Also used : SeriesQuery(com.axibase.tsd.api.model.series.query.SeriesQuery) 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 24 with Period

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");
}
Also used : Group(com.axibase.tsd.api.model.series.query.transformation.group.Group) SeriesQuery(com.axibase.tsd.api.model.series.query.SeriesQuery) Period(com.axibase.tsd.api.model.Period) BigDecimal(java.math.BigDecimal) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Example 25 with Period

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");
}
Also used : Group(com.axibase.tsd.api.model.series.query.transformation.group.Group) SeriesQuery(com.axibase.tsd.api.model.series.query.SeriesQuery) Period(com.axibase.tsd.api.model.Period) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Aggregations

Period (com.axibase.tsd.api.model.Period)63 Test (org.testng.annotations.Test)48 Issue (io.qameta.allure.Issue)44 SeriesQuery (com.axibase.tsd.api.model.series.query.SeriesQuery)39 Aggregate (com.axibase.tsd.api.model.series.query.transformation.aggregate.Aggregate)30 BigDecimal (java.math.BigDecimal)24 Group (com.axibase.tsd.api.model.series.query.transformation.group.Group)16 Series (com.axibase.tsd.api.model.series.Series)14 Rate (com.axibase.tsd.api.model.series.query.transformation.rate.Rate)11 AggregationInterpolate (com.axibase.tsd.api.model.series.query.transformation.AggregationInterpolate)10 PropertyQuery (com.axibase.tsd.api.model.property.PropertyQuery)7 Property (com.axibase.tsd.api.model.property.Property)6 MessageQuery (com.axibase.tsd.api.model.message.MessageQuery)5 MessageQuerySizeCheck (com.axibase.tsd.api.method.checks.MessageQuerySizeCheck)4 Message (com.axibase.tsd.api.model.message.Message)4 AggregationType (com.axibase.tsd.api.model.series.query.transformation.aggregate.AggregationType)3 ArrayList (java.util.ArrayList)3 Response (javax.ws.rs.core.Response)3 DataProvider (org.testng.annotations.DataProvider)3 Metric (com.axibase.tsd.api.model.metric.Metric)2