Search in sources :

Example 16 with SeriesQuery

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

the class SeriesQueryWildcardEscapeTest method testEntitySpecialCharEscape.

@Issue("4662")
@Test(description = "Test series query for entity name that contains wildcard", dataProvider = "provideSpecialCharacters")
public static void testEntitySpecialCharEscape(char c) throws Exception {
    String entityName = ENTITY_PREFIX + c + "e1";
    Series series = new Series(entityName, Mocks.metric());
    series.addSamples(Mocks.SAMPLE);
    SeriesMethod.insertSeriesCheck(series);
    SeriesQuery seriesQuery = new SeriesQuery(series);
    String actualEntityName = SeriesMethod.querySeriesAsList(seriesQuery).get(0).getEntity();
    assertEquals("Wrong result when performing series query with entity that contains wildcard character " + c, entityName, actualEntityName);
}
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 17 with SeriesQuery

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

the class SeriesQueryWildcardEscapeTest method testTagSpecialCharEscapeNotFound.

@Issue("4662")
@Test(description = "Test series query for tag value that contains wildcard and nothing were found", dataProvider = "provideSpecialCharacters")
public static void testTagSpecialCharEscapeNotFound(char c) throws Exception {
    String entityName = Mocks.entity();
    String metricName = Mocks.metric();
    String expectedTagValue = "tag" + '\\' + c;
    EntityMethod.createOrReplaceEntityCheck(new Entity(entityName));
    MetricMethod.createOrReplaceMetricCheck(new Metric(metricName));
    SeriesQuery seriesQuery = new SeriesQuery(metricName, entityName, MIN_QUERYABLE_DATE, MAX_QUERYABLE_DATE);
    seriesQuery.addTag("tag", expectedTagValue);
    String actualTagValue = SeriesMethod.querySeriesAsList(seriesQuery).get(0).getTags().get("tag");
    assertEquals("Wrong result when performing series query with tag value that contains wildcard character " + c + " and no series were found", expectedTagValue, actualTagValue);
}
Also used : Entity(com.axibase.tsd.api.model.entity.Entity) SeriesQuery(com.axibase.tsd.api.model.series.query.SeriesQuery) Metric(com.axibase.tsd.api.model.metric.Metric) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Example 18 with SeriesQuery

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

the class SeriesQueryWildcardEscapeTest method testTagSpecialCharEscape.

@Issue("4662")
@Test(description = "Test series query for tag value that contains wildcard", dataProvider = "provideSpecialCharacters")
public static void testTagSpecialCharEscape(char c) throws Exception {
    String entityName = Mocks.entity();
    String metircName = Mocks.metric();
    String tagValue = "tag" + c;
    Series series = new Series(entityName, metircName);
    series.addTag("tag", tagValue);
    series.addSamples(Mocks.SAMPLE);
    SeriesMethod.insertSeriesCheck(series);
    SeriesQuery seriesQuery = new SeriesQuery(series);
    String actualTagValue = SeriesMethod.querySeriesAsList(seriesQuery).get(0).getTags().get("tag");
    assertEquals("Wrong result when performing series query with tag value that contains wildcard character " + c, tagValue, actualTagValue);
}
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 19 with SeriesQuery

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

the class SeriesQueryAggregateGroupOrderRateTest method testDefaultOrderGroupAggregate.

@Issue("4729")
@Test(description = "test query result with default Group/Aggregate order")
public void testDefaultOrderGroupAggregate() {
    SeriesQuery query = new SeriesQuery("*", TEST_METRIC, "2017-01-01T00:00:00Z", "2017-01-01T00:00:20Z");
    query.setAggregate(new Aggregate(AggregationType.COUNT, new Period(10, TimeUnit.SECOND)));
    query.setGroup(new Group(GroupType.MAX, new Period(5, TimeUnit.SECOND)));
    List<Series> result = querySeriesAsList(query);
    Series expectedSeries = createSeries("*", Sample.ofDateDecimal("2017-01-01T00:00:00.000Z", new BigDecimal("2.0")), Sample.ofDateDecimal("2017-01-01T00:00:10.000Z", new BigDecimal("2.0")));
    assertEquals(result, Collections.singletonList(expectedSeries), "Incorrect query result with default 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) 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 20 with SeriesQuery

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

the class SeriesQueryEntityEscapeTest method testEntityEscape.

@Issue("4640")
@Test(dataProvider = "provideEntityFilters", description = "test entity name escaping in series query")
public void testEntityEscape(String filter) throws Exception {
    List<Series> series = SeriesMethod.querySeriesAsList(new SeriesQuery(filter, TEST_METRIC, MIN_QUERYABLE_DATE, MAX_QUERYABLE_DATE));
    assertEquals(String.format("Incorrect series count with filter %s", filter), 1, series.size());
    assertEquals(String.format("Incorrect series returned with filter %s", filter), TEST_SERIES, series.get(0));
}
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