Search in sources :

Example 21 with SeriesQuery

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

the class SeriesQueryExactMatchTest method testExactFalseNoKey.

@Issue("3002")
@Test(description = "soft no tags => all series will be received")
public void testExactFalseNoKey() throws Exception {
    SeriesQuery seriesQuery = new SeriesQuery(exactMatchEntityName, exactMatchMetricName, MIN_QUERYABLE_DATE, MAX_QUERYABLE_DATE, new HashMap<>());
    seriesQuery.setExactMatch(false);
    Response response = querySeries(seriesQuery);
    final String given = response.readEntity(String.class);
    assertEquals("Response array contains wrong elements count", 4, calculateJsonArraySize(given));
    final String expected = jacksonMapper.writeValueAsString(Arrays.asList(seriesA, seriesB, seriesC, seriesD));
    assertTrue("Received series mismatch", compareJsonString(expected, given));
}
Also used : Response(javax.ws.rs.core.Response) SeriesQuery(com.axibase.tsd.api.model.series.query.SeriesQuery) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Example 22 with SeriesQuery

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

the class SeriesQueryExactMatchTest method testExactTrueTagMatch.

@Issue("3002")
@Test(description = "strict match tags => only series with specified tag (tag-1=val-1) will be received")
public void testExactTrueTagMatch() throws Exception {
    Map<String, String> tags = new HashMap<>();
    tags.put("tag-1", "val-1");
    SeriesQuery seriesQuery = new SeriesQuery(exactMatchEntityName, exactMatchMetricName, MIN_QUERYABLE_DATE, MAX_QUERYABLE_DATE, tags);
    seriesQuery.setExactMatch(true);
    Response response = querySeries(seriesQuery);
    final String given = response.readEntity(String.class);
    assertEquals("Response array contains wrong elements count", 1, calculateJsonArraySize(given));
    final String expected = jacksonMapper.writeValueAsString(Arrays.asList(seriesB));
    assertTrue("Received series mismatch", compareJsonString(expected, given));
}
Also used : Response(javax.ws.rs.core.Response) SeriesQuery(com.axibase.tsd.api.model.series.query.SeriesQuery) HashMap(java.util.HashMap) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Example 23 with SeriesQuery

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

the class SeriesQueryExactMatchTest method testExactTrueNoKey.

@Issue("3002")
@Test(description = "strict no tags => only seriesD should be received")
public void testExactTrueNoKey() throws Exception {
    SeriesQuery seriesQuery = new SeriesQuery(exactMatchEntityName, exactMatchMetricName, MIN_QUERYABLE_DATE, MAX_QUERYABLE_DATE, new HashMap<>());
    seriesQuery.setExactMatch(true);
    Response response = querySeries(seriesQuery);
    final String given = response.readEntity(String.class);
    assertEquals("Response array contains wrong elements count", 1, calculateJsonArraySize(given));
    final String expected = jacksonMapper.writeValueAsString(Collections.singletonList(seriesD));
    assertTrue("Received series mismatch", compareJsonString(expected, given));
}
Also used : Response(javax.ws.rs.core.Response) SeriesQuery(com.axibase.tsd.api.model.series.query.SeriesQuery) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Example 24 with SeriesQuery

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

the class SeriesQueryExactMatchTest method testWildcardInEntityName.

@Issue("3371")
@Test(description = "test that wildcard for existing entity unfolded correctly")
public void testWildcardInEntityName() throws Exception {
    SeriesQuery seriesQuery = new SeriesQuery("series-query-exactmatch-entity*", exactMatchMetricName, MIN_QUERYABLE_DATE, MAX_QUERYABLE_DATE);
    seriesQuery.setExactMatch(true);
    Response response = querySeries(seriesQuery);
    final String given = response.readEntity(String.class);
    assertEquals("Response array contains wrong elements count", calculateJsonArraySize(given), 1);
    final String expected = jacksonMapper.writeValueAsString(Arrays.asList(seriesD));
    assertTrue("Recieved series missmatch", compareJsonString(expected, given));
}
Also used : Response(javax.ws.rs.core.Response) SeriesQuery(com.axibase.tsd.api.model.series.query.SeriesQuery) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Example 25 with SeriesQuery

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

the class SeriesQueryLimitOrderTest method testAscOrderLimit1.

@Issue("4635")
@Test(description = "test series query result with LIMIT = 1, ASC")
public void testAscOrderLimit1() throws Exception {
    SeriesQuery query = new SeriesQuery(TEST_ENTITY, TEST_METRIC, MIN_QUERYABLE_DATE, MAX_QUERYABLE_DATE);
    query.setLimit(1);
    query.setDirection("ASC");
    assertSeriesQueryResult("Incorrect series query result with LIMIT = 1, ASC", query, TEST_SAMPLES[0]);
}
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