Search in sources :

Example 1 with Interpolate

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

the class SeriesQueryTest method testEndTimeInterpolation.

@Issue("4867")
@Test(description = "test END_TIME period align interpolation")
public void testEndTimeInterpolation() {
    SeriesQuery query = new SeriesQuery(TEST_SERIES3.getEntity(), TEST_SERIES3.getMetric());
    query.setStartDate("2017-01-01T00:00:50Z");
    query.setEndDate("2017-01-01T00:03:30Z");
    query.setInterpolate(new Interpolate(InterpolateFunction.LINEAR, new Period(1, TimeUnit.MINUTE, PeriodAlignment.END_TIME)));
    List<Series> result = SeriesMethod.querySeriesAsList(query);
    Series expectedSeries = new Series();
    expectedSeries.setEntity(TEST_SERIES3.getEntity());
    expectedSeries.setMetric(TEST_SERIES3.getMetric());
    expectedSeries.setTags(Mocks.TAGS);
    expectedSeries.addSamples(Sample.ofDateDecimal("2017-01-01T00:01:30Z", new BigDecimal("1.5")), Sample.ofDateDecimal("2017-01-01T00:02:30Z", new BigDecimal("2.5")));
    assertEquals("Incorrect query result with END_TIME period align interpolation", 1, result.size());
    assertEquals("Incorrect query result with END_TIME period align interpolation", expectedSeries, result.get(0));
}
Also used : SeriesQuery(com.axibase.tsd.api.model.series.query.SeriesQuery) Interpolate(com.axibase.tsd.api.model.series.query.transformation.interpolate.Interpolate) AggregationInterpolate(com.axibase.tsd.api.model.series.query.transformation.AggregationInterpolate) Period(com.axibase.tsd.api.model.Period) BigDecimal(java.math.BigDecimal) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Aggregations

Period (com.axibase.tsd.api.model.Period)1 SeriesQuery (com.axibase.tsd.api.model.series.query.SeriesQuery)1 AggregationInterpolate (com.axibase.tsd.api.model.series.query.transformation.AggregationInterpolate)1 Interpolate (com.axibase.tsd.api.model.series.query.transformation.interpolate.Interpolate)1 Issue (io.qameta.allure.Issue)1 BigDecimal (java.math.BigDecimal)1 Test (org.testng.annotations.Test)1