use of com.axibase.tsd.api.model.entity.Entity in project atsd-api-test by axibase.
the class SqlEntityTagsTest method prepareData.
@BeforeClass
public static void prepareData() throws Exception {
Series series = new Series(TEST_ENTITY_NAME, TEST_METRIC_NAME) {
{
addSamples(Sample.ofDateInteger("2016-06-19T11:00:00.000Z", 3));
}
};
EntityMethod.createOrReplaceEntityCheck(new Entity(TEST_ENTITY_NAME, new HashMap<String, String>() {
{
put("tag1", "val1");
put("tag2", "val2");
put("tag3", "v3");
}
}));
SeriesMethod.insertSeriesCheck(Collections.singletonList(series));
}
use of com.axibase.tsd.api.model.entity.Entity in project atsd-api-test by axibase.
the class LastAndFirstFunctionTagsTest method prepareData.
@BeforeClass
public void prepareData() throws Exception {
String testEntity = entity();
Entity entity = new Entity(testEntity);
entity.addTag("literal_tag", "value");
entity.addTag("numeric_tag", "123");
Series series = new Series(testEntity, TEST_METRIC);
series.addSamples(Sample.ofDateInteger("2017-01-01T09:30:00.000Z", 1), Sample.ofDateInteger("2017-01-01T10:30:00.000Z", 1), Sample.ofDateInteger("2017-01-01T11:30:00.000Z", 2), Sample.ofDateInteger("2017-01-01T12:30:00.000Z", 2), Sample.ofDateInteger("2017-01-01T13:30:00.000Z", 2));
EntityMethod.createOrReplaceEntityCheck(entity);
SeriesMethod.insertSeriesCheck(series);
}
use of com.axibase.tsd.api.model.entity.Entity 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.entity.Entity in project atsd-api-test by axibase.
the class InterpolateUserTimeZoneTest method testInterpolateEntityTimezone.
@Issue("4103")
@Test(description = "Check that entity.timezone can be used for interpolation")
public void testInterpolateEntityTimezone() throws Exception {
String entityName = Mocks.entity();
String metricName = Mocks.metric();
Entity entity = new Entity(entityName);
entity.setTimeZoneID("America/Los_Angeles");
Series series = new Series(entityName, metricName);
series.addSamples(Sample.ofDateInteger("2017-10-11T05:22:43.573Z", 1), Sample.ofDateInteger("2017-10-12T05:22:43.573Z", 2));
EntityMethod.createOrReplaceEntityCheck(entity);
SeriesMethod.insertSeriesCheck(series);
String sqlQuery = String.format("SELECT date_format(datetime, 'yy-MM-dd HH:mm:ss', entity.timezone) " + "FROM \"%1$s\" " + "WHERE datetime BETWEEN '2017-10-11T05:00:00.000Z' " + "AND '2017-10-12T05:00:00.000Z' " + "WITH INTERPOLATE(1 DAY, PREVIOUS, OUTER, FALSE, CALENDAR, entity.timezone)", metricName);
String[][] expectedRows = { { "17-10-11 00:00:00" } };
assertSqlQueryRows("Incorrect interpolation when using entity.timezone as custom timezone", expectedRows, sqlQuery);
}
use of com.axibase.tsd.api.model.entity.Entity in project atsd-api-test by axibase.
the class LikeEscapeTest method prepareTest.
@BeforeClass
public void prepareTest() throws Exception {
Map<String, String> testTags = Collections.singletonMap(prefix + "tag", prefix + "value");
Entity entity = new Entity(TEST_ENTITY, testTags).setLabel(prefix + Mocks.LABEL);
Metric metric = new Metric(TEST_METRIC, testTags).setLabel(prefix + Mocks.LABEL).setDescription(prefix + Mocks.DESCRIPTION).setUnits(prefix + "units");
Series series = new Series(TEST_ENTITY, TEST_METRIC, testTags);
series.addSamples(Sample.ofDateIntegerText(Mocks.ISO_TIME, 1, prefix + Mocks.TEXT_VALUE));
EntityMethod.createOrReplaceEntityCheck(entity);
MetricMethod.createOrReplaceMetricCheck(metric);
SeriesMethod.insertSeriesCheck(series);
}
Aggregations