Search in sources :

Example 71 with SeriesQuery

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

the class SeriesQueryMultipleAggregationTest method testSingleAggregatorFunctions.

@Issue("4717")
@Test(description = "test series query with single transformation functions", dataProvider = "provideSingleAggregatorFunctions")
public void testSingleAggregatorFunctions(AggregationType function, String[] expectedValues) throws Exception {
    SeriesQuery query = createSeriesQuery(function);
    List<Series> result = querySeriesAsList(query);
    assertEquals(result.size(), 1, "Incorrect response series count");
    List<Sample> resultSamples = result.get(0).getData();
    assertEquals(resultSamples.size(), 2, "Incorrect response samples count");
    assertSamples(resultSamples, expectedValues);
}
Also used : SeriesQuery(com.axibase.tsd.api.model.series.query.SeriesQuery) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Example 72 with SeriesQuery

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

the class SeriesQueryTagExpressionFilterTest method testTagFilterWithSeriesLimit.

@Issue("3915")
@Test(dataProvider = "provideSingleTagFilters", description = "test tag expression with limit")
public void testTagFilterWithSeriesLimit(Filter<String> filter) throws Exception {
    SeriesQuery query = new SeriesQuery(TEST_ENTITY, TEST_METRIC, Util.MIN_STORABLE_DATE, Util.MAX_STORABLE_DATE);
    query.setTagExpression(filter.getExpression());
    int expectedCount;
    Set<String> expectedResultSet = filter.getExpectedResultSet();
    if (expectedResultSet.size() > 1) {
        query.setSeriesLimit(expectedResultSet.size() - 1);
        expectedCount = expectedResultSet.size() - 1;
    } else {
        query.setSeriesLimit(1);
        expectedCount = expectedResultSet.size();
    }
    Set<String> tagsSet = executeTagsQuery(query);
    assertEquals(String.format("Incorrect result when using limit with tag expression %s", filter.getExpression()), expectedCount, tagsSet.size());
}
Also used : SeriesQuery(com.axibase.tsd.api.model.series.query.SeriesQuery) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Example 73 with SeriesQuery

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

the class SeriesQueryTagExpressionFilterTest method checkQuery.

private void checkQuery(String filter, Set<String> expectedResult, String errorMessage) throws Exception {
    Set<Object> expectedTagsSet = Sets.newHashSet(expectedResult);
    SeriesQuery query = new SeriesQuery(TEST_ENTITY, TEST_METRIC, Util.MIN_STORABLE_DATE, Util.MAX_STORABLE_DATE);
    query.setTagExpression(filter);
    Set<String> actualTagsSet = executeTagsQuery(query);
    assertEquals(String.format("%s filter %s", errorMessage, filter), expectedTagsSet, actualTagsSet);
}
Also used : SeriesQuery(com.axibase.tsd.api.model.series.query.SeriesQuery)

Example 74 with SeriesQuery

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

the class SeriesQueryTransformationsLimitTest method testTwoDifferentQueriesWithInterpolateLimit.

@Issue("4836")
@Test(description = "test two different limited queries with interpolation")
public void testTwoDifferentQueriesWithInterpolateLimit() throws Exception {
    SeriesQuery query1 = new SeriesQuery(ENTITY_1, METRIC, "2017-01-01T00:00:00Z", "2017-01-01T02:00:00Z");
    query1.setInterpolate(INTERPOLATE);
    SeriesQuery query2 = new SeriesQuery(ENTITY_2, METRIC, "2017-01-01T00:00:00Z", "2017-01-01T02:00:00Z");
    query2.setInterpolate(INTERPOLATE);
    checkResponse(query1, query2);
}
Also used : SeriesQuery(com.axibase.tsd.api.model.series.query.SeriesQuery) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Example 75 with SeriesQuery

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

the class SeriesQueryTransformationsLimitTest method testGroupAndRateLimit.

@Issue("4835")
@Test(description = "test that limit is applied correctly after grouping and rate calculation")
public void testGroupAndRateLimit() throws Exception {
    SeriesQuery query = new SeriesQuery("*", METRIC, "2017-01-01T00:00:00Z", "2017-01-01T02:00:00Z");
    query.setEntities(ENTITIES);
    GROUP.setOrder(1);
    query.setGroup(GROUP);
    RATE.setOrder(2);
    query.setRate(RATE);
    checkResponse(query);
}
Also used : SeriesQuery(com.axibase.tsd.api.model.series.query.SeriesQuery) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Aggregations

SeriesQuery (com.axibase.tsd.api.model.series.query.SeriesQuery)157 Issue (io.qameta.allure.Issue)145 Test (org.testng.annotations.Test)145 Period (com.axibase.tsd.api.model.Period)43 BigDecimal (java.math.BigDecimal)43 Response (javax.ws.rs.core.Response)31 Aggregate (com.axibase.tsd.api.model.series.query.transformation.aggregate.Aggregate)26 Series (com.axibase.tsd.api.model.series.Series)23 Group (com.axibase.tsd.api.model.series.query.transformation.group.Group)20 Metric (com.axibase.tsd.api.model.metric.Metric)13 AggregationInterpolate (com.axibase.tsd.api.model.series.query.transformation.AggregationInterpolate)8 Rate (com.axibase.tsd.api.model.series.query.transformation.rate.Rate)8 Sample (com.axibase.tsd.api.model.series.Sample)7 Entity (com.axibase.tsd.api.model.entity.Entity)6 ArrayList (java.util.ArrayList)5 File (java.io.File)4 List (java.util.List)3 HashMap (java.util.HashMap)2 BaseMethod.compareJsonString (com.axibase.tsd.api.method.BaseMethod.compareJsonString)1 SeriesCheck (com.axibase.tsd.api.method.checks.SeriesCheck)1