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);
}
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);
}
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));
}
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));
}
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);
}
Aggregations