Search in sources :

Example 76 with Entity

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");
        }
    });
}
Also used : Series(com.axibase.tsd.api.model.series.Series) Entity(com.axibase.tsd.api.model.entity.Entity) BeforeClass(org.testng.annotations.BeforeClass)

Example 77 with Entity

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);
}
Also used : Entity(com.axibase.tsd.api.model.entity.Entity) Series(com.axibase.tsd.api.model.series.Series) Metric(com.axibase.tsd.api.model.metric.Metric) Test(org.testng.annotations.Test) SqlTest(com.axibase.tsd.api.method.sql.SqlTest)

Aggregations

Entity (com.axibase.tsd.api.model.entity.Entity)77 Test (org.testng.annotations.Test)60 Issue (io.qameta.allure.Issue)43 Metric (com.axibase.tsd.api.model.metric.Metric)21 Series (com.axibase.tsd.api.model.series.Series)21 BeforeClass (org.testng.annotations.BeforeClass)15 PropertyQuery (com.axibase.tsd.api.model.property.PropertyQuery)12 EntityCommand (com.axibase.tsd.api.model.command.EntityCommand)9 HashMap (java.util.HashMap)9 Property (com.axibase.tsd.api.model.property.Property)8 SeriesQuery (com.axibase.tsd.api.model.series.query.SeriesQuery)6 EntityCheck (com.axibase.tsd.api.method.checks.EntityCheck)5 Response (javax.ws.rs.core.Response)5 PlainCommand (com.axibase.tsd.api.model.command.PlainCommand)4 File (java.io.File)4 SqlTest (com.axibase.tsd.api.method.sql.SqlTest)3 SeriesSearchResultRecord (com.axibase.tsd.api.model.series.search.SeriesSearchResultRecord)3 Sample (com.axibase.tsd.api.model.series.Sample)2 SeriesSearchQuery (com.axibase.tsd.api.model.series.search.SeriesSearchQuery)2 BigDecimal (java.math.BigDecimal)2