Search in sources :

Example 41 with SeriesQuery

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

the class SeriesQueryEntityExpressionTest method testEntityExpressionWithEntityGroup.

@Issue("3612")
@Test(dataProvider = "entityExpressionProviderForEntityGroup")
public static void testEntityExpressionWithEntityGroup(String expression, HashSet<String> expectedEntities) throws Exception {
    SeriesQuery query = createTestQuery(null);
    query.setEntityGroup(ENTITY_GROUP_NAME);
    query.setEntityExpression(expression);
    List<Series> result = SeriesMethod.querySeriesAsList(query);
    HashSet<String> receivedEntities = new HashSet<>();
    for (Series series : result) {
        receivedEntities.add(series.getEntity());
    }
    assertEquals(formatErrorMsg("Wrong result entity set", expression), expectedEntities, receivedEntities);
    for (Series series : result) {
        List<Sample> seriesData = series.getData();
        assertEquals(formatErrorMsg("Wrong number of data entries", expression), 1, seriesData.size());
        assertEquals(formatErrorMsg("Wrong data received", expression), Mocks.SAMPLE, seriesData.get(0));
    }
}
Also used : Series(com.axibase.tsd.api.model.series.Series) SeriesQuery(com.axibase.tsd.api.model.series.query.SeriesQuery) Sample(com.axibase.tsd.api.model.series.Sample) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Example 42 with SeriesQuery

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

the class SeriesQueryEntityExpressionTest method testEntityExpressionWithWildcardEntity.

@Issue("3612")
@Test(dataProvider = "entityExpressionProviderForWildcardEntity")
public static void testEntityExpressionWithWildcardEntity(String expression, HashSet<String> expectedEntities) throws Exception {
    SeriesQuery query = createTestQuery("*");
    query.setEntityExpression(expression);
    List<Series> result = SeriesMethod.querySeriesAsList(query);
    HashSet<String> receivedEntities = new HashSet<>();
    for (Series series : result) {
        receivedEntities.add(series.getEntity());
    }
    assertEquals(formatErrorMsg("Wrong result entity set", expression), expectedEntities, receivedEntities);
    for (Series series : result) {
        List<Sample> seriesData = series.getData();
        assertEquals(formatErrorMsg("Wrong number of data entries", expression), 1, seriesData.size());
        assertEquals(formatErrorMsg("Wrong data received", expression), Mocks.SAMPLE, seriesData.get(0));
    }
}
Also used : Series(com.axibase.tsd.api.model.series.Series) SeriesQuery(com.axibase.tsd.api.model.series.query.SeriesQuery) Sample(com.axibase.tsd.api.model.series.Sample) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Example 43 with SeriesQuery

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

the class SeriesQueryEntityExpressionTest method testEmptyResultEntityExpressionWithWildcardEntity.

@Issue("3612")
@Test(dataProvider = "emptyResultEntityExpressionProvider")
public static void testEmptyResultEntityExpressionWithWildcardEntity(String expression) throws Exception {
    SeriesQuery query = createTestQuery("*");
    query.setEntityExpression(expression);
    List<Series> result = SeriesMethod.querySeriesAsList(query);
    assertEquals(formatErrorMsg("Dummy result is not present", expression), 1, result.size());
    Series series = result.get(0);
    assertEquals(formatErrorMsg("Dummy result entity name", expression), query.getEntity(), series.getEntity());
    assertEquals(formatErrorMsg("Dummy result data size", expression), 0, series.getData().size());
}
Also used : Series(com.axibase.tsd.api.model.series.Series) SeriesQuery(com.axibase.tsd.api.model.series.query.SeriesQuery) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Example 44 with SeriesQuery

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

the class SeriesQueryEntityExpressionTest method testEmptyResultEntityExpressionWithFixedEntity.

@Issue("3612")
@Test(dataProvider = "emptyResultEntityExpressionProviderForFixedEntity")
public static void testEmptyResultEntityExpressionWithFixedEntity(String expression) throws Exception {
    SeriesQuery query = createTestQuery(FIXED_ENTITY_NAME);
    query.setEntityExpression(expression);
    List<Series> result = SeriesMethod.querySeriesAsList(query);
    assertEquals(formatErrorMsg("Dummy result should be the one present", expression), 1, result.size());
    Series series = result.get(0);
    assertEquals(formatErrorMsg("Dummy result entity name should be preserved", expression), FIXED_ENTITY_NAME, series.getEntity());
    assertTrue(formatErrorMsg("Dummy result data should be empty", expression), series.getData().isEmpty());
}
Also used : Series(com.axibase.tsd.api.model.series.Series) SeriesQuery(com.axibase.tsd.api.model.series.query.SeriesQuery) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Example 45 with SeriesQuery

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

the class SeriesQueryEntityExpressionTest method testEntityExpressionWithEntityGroup.

@Issue("3612")
@Test(dataProvider = "emptyResultEntityExpressionProviderForEntityGroup")
public static void testEntityExpressionWithEntityGroup(String expression) throws Exception {
    SeriesQuery query = createTestQuery(null);
    query.setEntityGroup(ENTITY_GROUP_NAME);
    query.setEntityExpression(expression);
    List<Series> result = SeriesMethod.querySeriesAsList(query);
    HashSet<String> receivedEntities = new HashSet<>();
    for (Series series : result) {
        receivedEntities.add(series.getEntity());
    }
    assertTrue(formatErrorMsg("Result set should be empty", expression), receivedEntities.isEmpty());
}
Also used : Series(com.axibase.tsd.api.model.series.Series) 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