Search in sources :

Example 96 with Series

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

the class AutoTimeZoneTest method testEntityTimeZone.

@Test
public void testEntityTimeZone() throws Exception {
    Entity entity = new Entity(entity());
    entity.setTimeZoneID(ALGIERS_TIMEZONE_ID);
    Series series = new Series(entity.getName(), metric());
    series.addSamples(DEFAULT_SAMPLE);
    EntityMethod.createOrReplaceEntityCheck(entity);
    SeriesMethod.insertSeriesCheck(Collections.singletonList(series));
    String sqlQuery = String.format("SELECT date_format(time, '%s', AUTO) FROM \"%s\"", DEFAULT_PATTERN, series.getMetric());
    String[][] expectedRows = { { formatDate(parseDate(DEFAULT_SAMPLE.getRawDate()), DEFAULT_PATTERN, getTimeZone(entity.getTimeZoneID())) } };
    assertSqlQueryRows("Failed to define entity timezone by AUTO param", expectedRows, sqlQuery);
}
Also used : Entity(com.axibase.tsd.api.model.entity.Entity) Series(com.axibase.tsd.api.model.series.Series) Test(org.testng.annotations.Test) SqlTest(com.axibase.tsd.api.method.sql.SqlTest)

Example 97 with Series

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

the class DateFormatInsideClausesTest method prepareData.

@BeforeClass
public static void prepareData() throws Exception {
    Series series1 = new Series(entity(), METRIC_NAME1);
    series1.addSamples(Sample.ofDateInteger("2017-02-09T13:00:00.000Z", 10), Sample.ofDateInteger("2017-02-10T12:00:00.000Z", 11), Sample.ofDateInteger("2017-02-10T07:00:00.000Z", 12), Sample.ofDateInteger("2017-02-12T12:00:00.000Z", 13), Sample.ofDateInteger("2017-02-11T12:00:00.000Z", 14), Sample.ofDateInteger("2017-02-09T12:00:00.000Z", 15));
    Series series2 = new Series(entity(), METRIC_NAME2);
    series2.addSamples(Sample.ofDateInteger("2017-02-09T12:00:00.000Z", 0), Sample.ofDateInteger("2017-02-09T13:00:00.000Z", 0), Sample.ofDateInteger("2017-02-10T12:00:00.000Z", 0), Sample.ofDateInteger("2017-02-11T12:00:00.000Z", 0), Sample.ofDateInteger("2017-02-12T12:00:00.000Z", 0));
    SeriesMethod.insertSeriesCheck(series1, series2);
}
Also used : Series(com.axibase.tsd.api.model.series.Series) BeforeClass(org.testng.annotations.BeforeClass)

Example 98 with Series

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

the class ApplyTest method testNullSeries.

@Issue("3462")
@Test
public void testNullSeries() throws Exception {
    Long startTime = Util.parseDate("2016-06-29T07:00:00.000Z'").getTime();
    Long endTime = Util.parseDate("2016-06-29T10:00:00.000Z").getTime();
    Series series = new Series(entity(), metric());
    for (long i = startTime; i < endTime; i += 60000) {
        series.addSamples(Sample.ofDateDecimal(Util.ISOFormat(i), (BigDecimal) null));
    }
    SeriesMethod.insertSeriesCheck(Collections.singletonList(series));
    String sqlQuery = String.format("SELECT * FROM \"%s\"%nWHERE time >= %d AND time < %d%nWITH INTERPOLATE(1 MINUTE, LINEAR)", series.getMetric(), startTime, endTime);
    String assertMessage = String.format("Failed to apply interpolation to series with only null data.%n\tQuery: %s", sqlQuery);
    assertOkRequest(assertMessage, queryResponse(sqlQuery));
}
Also used : Series(com.axibase.tsd.api.model.series.Series) BigDecimal(java.math.BigDecimal) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test) SqlTest(com.axibase.tsd.api.method.sql.SqlTest)

Example 99 with Series

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

the class ApplyTest method prepareApplyData.

@BeforeClass
public static void prepareApplyData() throws Exception {
    Series series = new Series(entity(), APPLY_METRIC);
    series.addSamples(DEFAULT_SAMPLE);
    SeriesMethod.insertSeriesCheck(singletonList(series));
}
Also used : Series(com.axibase.tsd.api.model.series.Series) BeforeClass(org.testng.annotations.BeforeClass)

Example 100 with Series

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

the class InterpolateUserTimeZoneTest method prepareData.

@BeforeClass
public void prepareData() throws Exception {
    Series series = new Series(ENTITY_NAME, METRIC_NAME);
    series.addSamples(Sample.ofDateInteger("2017-10-11T05:00:00.000Z", 1), Sample.ofDateInteger("2017-10-12T05:00:00.000Z", 2));
    SeriesMethod.insertSeriesCheck(series);
}
Also used : Series(com.axibase.tsd.api.model.series.Series) BeforeClass(org.testng.annotations.BeforeClass)

Aggregations

Series (com.axibase.tsd.api.model.series.Series)271 BeforeClass (org.testng.annotations.BeforeClass)150 Test (org.testng.annotations.Test)96 Issue (io.qameta.allure.Issue)88 ArrayList (java.util.ArrayList)46 SqlTest (com.axibase.tsd.api.method.sql.SqlTest)32 BigDecimal (java.math.BigDecimal)26 Metric (com.axibase.tsd.api.model.metric.Metric)25 Sample (com.axibase.tsd.api.model.series.Sample)25 SeriesQuery (com.axibase.tsd.api.model.series.query.SeriesQuery)23 Entity (com.axibase.tsd.api.model.entity.Entity)21 SeriesCommand (com.axibase.tsd.api.model.command.SeriesCommand)16 Response (javax.ws.rs.core.Response)16 List (java.util.List)9 SeriesCheck (com.axibase.tsd.api.method.checks.SeriesCheck)7 SeriesTest (com.axibase.tsd.api.method.series.SeriesTest)6 CommandMethodTest (com.axibase.tsd.api.extended.CommandMethodTest)5 PlainCommand (com.axibase.tsd.api.model.command.PlainCommand)5 HashMap (java.util.HashMap)5 StringTable (com.axibase.tsd.api.model.sql.StringTable)4