use of com.axibase.tsd.api.model.entity.Entity in project atsd-api-test by axibase.
the class SqlSelectEntityTagsTest method prepareData.
@BeforeClass
public static void prepareData() throws Exception {
List<Series> seriesList = Arrays.asList(new Series(TEST_ENTITY1_NAME, TEST_METRIC_NAME) {
{
addSamples(Sample.ofDateInteger("2016-06-03T09:27:00.000Z", 0));
}
}, new Series(TEST_ENTITY2_NAME, TEST_METRIC_NAME) {
{
addSamples(Sample.ofDateInteger("2016-06-03T09:27:01.000Z", 1));
}
}, new Series(TEST_ENTITY3_NAME, TEST_METRIC_NAME) {
{
addSamples(Sample.ofDateInteger("2016-06-03T09:27:01.000Z", 2));
}
});
SeriesMethod.insertSeriesCheck(seriesList);
EntityMethod.updateEntity(TEST_ENTITY1_NAME, new Entity() {
{
addTag("a", "b");
addTag("b", "c");
}
});
EntityMethod.updateEntity(TEST_ENTITY2_NAME, new Entity() {
{
addTag("c", "d");
addTag("d", "e");
}
});
}
use of com.axibase.tsd.api.model.entity.Entity in project atsd-api-test by axibase.
the class AutoTimeZoneTest method testPriorityTimeZone.
@Test
public void testPriorityTimeZone() throws Exception {
Entity entity = new Entity(entity());
entity.setTimeZoneID(ALGIERS_TIMEZONE_ID);
Metric metric = new Metric(metric());
String metricTimeZoneId = "Canada/Yukon";
metric.setTimeZoneID(metricTimeZoneId);
Series series = new Series(entity.getName(), metric.getName());
series.addSamples(DEFAULT_SAMPLE);
EntityMethod.createOrReplaceEntityCheck(entity);
MetricMethod.createOrReplaceMetricCheck(metric);
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 as priority by AUTO param", expectedRows, sqlQuery);
}
Aggregations