Search in sources :

Example 31 with SeriesQuery

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

the class SeriesQueryLimitOrderTest method testAscOrderLimit3.

@Issue("4635")
@Test(description = "test series query result with LIMIT = 3, ASC")
public void testAscOrderLimit3() throws Exception {
    SeriesQuery query = new SeriesQuery(TEST_ENTITY, TEST_METRIC, MIN_QUERYABLE_DATE, MAX_QUERYABLE_DATE);
    query.setLimit(3);
    query.setDirection("ASC");
    assertSeriesQueryResult("Incorrect series query result with LIMIT = 3, ASC", query, TEST_SAMPLES[0], TEST_SAMPLES[1], TEST_SAMPLES[2]);
}
Also used : SeriesQuery(com.axibase.tsd.api.model.series.query.SeriesQuery) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Example 32 with SeriesQuery

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

the class SeriesQueryLimitOrderTest method testDescOrderNoLimit.

@Issue("4635")
@Test(description = "test series query result with no LIMIT, DESC")
public void testDescOrderNoLimit() throws Exception {
    SeriesQuery query = new SeriesQuery(TEST_ENTITY, TEST_METRIC, MIN_QUERYABLE_DATE, MAX_QUERYABLE_DATE);
    query.setDirection("DESC");
    assertSeriesQueryResult("Incorrect series query result with no LIMIT, DESC", query, TEST_SAMPLES[0], TEST_SAMPLES[1], TEST_SAMPLES[2], TEST_SAMPLES[3], TEST_SAMPLES[4]);
}
Also used : SeriesQuery(com.axibase.tsd.api.model.series.query.SeriesQuery) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Example 33 with SeriesQuery

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

the class SeriesQueryLimitOrderTest method testAscOrderLimit3WithFilter.

@Issue("4635")
@Test(description = "test series query result with LIMIT = 3, datetime filter, ASC")
public void testAscOrderLimit3WithFilter() throws Exception {
    SeriesQuery query = new SeriesQuery(TEST_ENTITY, TEST_METRIC, TEST_SAMPLES[3].getRawDate(), Util.addOneMS(TEST_SAMPLES[4].getRawDate()));
    query.setLimit(3);
    query.setDirection("ASC");
    assertSeriesQueryResult("Incorrect series query result with LIMIT = 3, datetime filter, ASC", query, TEST_SAMPLES[3], TEST_SAMPLES[4]);
}
Also used : SeriesQuery(com.axibase.tsd.api.model.series.query.SeriesQuery) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Example 34 with SeriesQuery

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

the class SeriesQueryMultipleYearsGroupTest method testSeriesQueryMultipleYearGroupSingleEntity.

@Issue("4101")
@Issue("4591")
@Test
public void testSeriesQueryMultipleYearGroupSingleEntity() throws Exception {
    SeriesQuery query = new SeriesQuery();
    query.setEntities(Collections.singletonList(ENTITY_NAME2));
    query.setMetric(METRIC_NAME);
    query.setStartDate("1900-01-01T00:00:00.000Z");
    query.setEndDate("2100-01-01T00:00:00.000Z");
    query.setAggregate(new Aggregate(AggregationType.COUNT, new Period(12, TimeUnit.YEAR)));
    List<Series> resultSeries = querySeriesAsList(query);
    List<Sample> samples = new ArrayList<>();
    samples.add(Sample.ofDateInteger("2006-01-01T00:00:00.000Z", 2));
    assertSamples(samples, resultSeries.get(0).getData());
}
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) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Example 35 with SeriesQuery

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

the class SeriesQueryMultipleYearsGroupTest method testSeriesQueryMultipleYearGroupBothEntities.

@Issue("4101")
@Issue("4591")
@Test
public void testSeriesQueryMultipleYearGroupBothEntities() throws Exception {
    SeriesQuery query = new SeriesQuery();
    query.setEntities(Arrays.asList(ENTITY_NAME1, ENTITY_NAME2));
    query.setMetric(METRIC_NAME);
    query.setStartDate("1900-01-01T00:00:00.000Z");
    query.setEndDate("2100-01-01T00:00:00.000Z");
    query.setAggregate(new Aggregate(AggregationType.COUNT, new Period(12, TimeUnit.YEAR)));
    List<Series> resultSeries = querySeriesAsList(query);
    List<Sample> samples1 = new ArrayList<>();
    /* See #4101#note-18 */
    if (zeroTimeOffset <= 0) {
        samples1.add(Sample.ofDateInteger("1970-01-01T00:00:00.000Z", 1));
    }
    samples1.add(Sample.ofDateInteger("2006-01-01T00:00:00.000Z", 2));
    samples1.add(Sample.ofDateInteger("2018-01-01T00:00:00.000Z", 1));
    List<Sample> samples2 = new ArrayList<>();
    samples2.add(Sample.ofDateInteger("2006-01-01T00:00:00.000Z", 2));
    assertSamples(samples1, resultSeries.get(0).getData());
    assertSamples(samples2, resultSeries.get(1).getData());
}
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) 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