Search in sources :

Example 26 with Entity

use of com.axibase.tsd.api.model.entity.Entity in project atsd-api-test by axibase.

the class SqlIsNullOperatorTest method prepareData.

@BeforeClass
public static void prepareData() throws Exception {
    List<Series> seriesList = new ArrayList<>();
    seriesList.add(new Series(TEST_ENTITY1_NAME, TEST_METRIC_NAME, "tag1", "val1") {

        {
            addSamples(Sample.ofDateInteger("2016-06-19T11:00:00.000Z", 1));
        }
    });
    seriesList.add(new Series(TEST_ENTITY2_NAME, TEST_METRIC_NAME, "tag1", "val2", "tag2", "val2") {

        {
            addSamples(Sample.ofDateInteger("2016-06-19T11:05:00.000Z", 2));
        }
    });
    seriesList.add(new Series(TEST_ENTITY3_NAME, TEST_METRIC_NAME, "tag2", "val3") {

        {
            addSamples(Sample.ofDateInteger("2016-06-19T11:10:00.000Z", 3));
        }
    });
    seriesList.add(new Series(TEST_ENTITY4_NAME, TEST_METRIC_NAME, "tag4", "val4") {

        {
            addSamples(Sample.ofDateInteger("2016-06-19T11:15:00.000Z", 4));
        }
    });
    seriesList.add(new Series(TEST_ENTITY5_NAME, TEST_METRIC_NAME) {

        {
            addSamples(Sample.ofDateInteger("2016-06-19T11:20:00.000Z", 5));
        }
    });
    EntityMethod.createOrReplaceEntityCheck(new Entity(TEST_ENTITY1_NAME, new HashMap<String, String>() {

        {
            put("tag1", "val1");
        }
    }));
    SeriesMethod.insertSeriesCheck(seriesList);
}
Also used : Series(com.axibase.tsd.api.model.series.Series) Entity(com.axibase.tsd.api.model.entity.Entity) BeforeClass(org.testng.annotations.BeforeClass)

Example 27 with Entity

use of com.axibase.tsd.api.model.entity.Entity in project atsd-api-test by axibase.

the class SqlLookupFunctionTest method prepareData.

@BeforeClass
public static void prepareData() throws Exception {
    String testEntityNameTagsCase = entity();
    List<Series> seriesList = new ArrayList<>();
    {
        Series series = new Series(entity(), TEST_METRIC_NAME_BASE_LOOKUP_CASE);
        series.addSamples(Sample.ofDateText("2016-06-03T09:20:00.000Z", "word"), Sample.ofDateText("2016-06-03T09:21:00.000Z", "-1"), Sample.ofDateText("2016-06-03T09:22:00.000Z", "1"), Sample.ofDateText("2016-06-03T09:23:00.000Z", "2"), Sample.ofDateText("2016-06-03T09:24:00.000Z", "word"), Sample.ofDateText("2016-06-03T09:25:00.000Z", "words"), Sample.ofDateText("2016-06-03T09:26:00.000Z", "3"), Sample.ofDateText("2016-06-03T09:27:00.000Z", "4"), Sample.ofDateText("2016-06-03T09:28:00.000Z", "PI"), Sample.ofDateText("2016-06-03T09:29:00.000Z", "3.14"), Sample.ofDateText("2016-06-03T09:30:00.000Z", "nothing"));
        seriesList.add(series);
    }
    Map<String, String> tags = new HashMap<>();
    tags.put("1", "-1");
    tags.put("2", "1");
    tags.put("3", "2");
    tags.put("4", "word");
    tags.put("5", "words");
    tags.put("6", "3");
    tags.put("7", "4");
    tags.put("8", "PI");
    tags.put("9", "3.14");
    tags.put("10", "nothing");
    Metric metric = new Metric(TEST_METRIC_NAME_TAGS_CASE, tags);
    Entity entity = new Entity(testEntityNameTagsCase, tags);
    Series series = new Series(testEntityNameTagsCase, TEST_METRIC_NAME_TAGS_CASE, tags);
    series.addSamples(Sample.ofDateInteger("2016-06-03T09:20:00.000Z", 1));
    seriesList.add(series);
    MetricMethod.createOrReplaceMetricCheck(metric);
    EntityMethod.createOrReplaceEntityCheck(entity);
    SeriesMethod.insertSeriesCheck(seriesList);
}
Also used : Series(com.axibase.tsd.api.model.series.Series) Entity(com.axibase.tsd.api.model.entity.Entity) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Metric(com.axibase.tsd.api.model.metric.Metric) BeforeClass(org.testng.annotations.BeforeClass)

Example 28 with Entity

use of com.axibase.tsd.api.model.entity.Entity in project atsd-api-test by axibase.

the class SqlTagNameWithDoubleQuotationTest method prepareData.

@BeforeClass
public static void prepareData() throws Exception {
    final Map<String, String> tags = Collections.unmodifiableMap(new HashMap<String, String>() {

        {
            put("tag", "0");
            put("tag\"quotation", "1");
            put("tag+plus", "2");
            put("tag-minus", "3");
            put("tag*multiple", "4");
            put("tag/division", "5");
            put("tag\"quotation'", "6");
        }
    });
    Series series = new Series(TEST_ENTITY_NAME, TEST_METRIC_NAME, tags) {

        {
            addSamples(Sample.ofDateInteger("2016-06-19T11:00:00.500Z", 0));
        }
    };
    MetricMethod.createOrReplaceMetricCheck(new Metric(TEST_METRIC_NAME, tags));
    EntityMethod.createOrReplaceEntityCheck(new Entity(TEST_ENTITY_NAME, tags));
    SeriesMethod.insertSeriesCheck(Collections.singletonList(series));
}
Also used : Series(com.axibase.tsd.api.model.series.Series) Entity(com.axibase.tsd.api.model.entity.Entity) Metric(com.axibase.tsd.api.model.metric.Metric) BeforeClass(org.testng.annotations.BeforeClass)

Example 29 with Entity

use of com.axibase.tsd.api.model.entity.Entity in project atsd-api-test by axibase.

the class TCPSenderTest method testDebugSend.

@Test
public void testDebugSend() throws Exception {
    Entity entity = new Entity(entity(), TAGS);
    entity.setTimeZoneID(TIMEZONE_ID);
    entity.setInterpolationMode(InterpolationMode.LINEAR);
    entity.setLabel(LABEL);
    String result = TCPSender.send(singletonList(new EntityCommand(entity)), true);
    assertEquals("ok", result);
    assertCheck(new EntityCheck(entity));
}
Also used : Entity(com.axibase.tsd.api.model.entity.Entity) EntityCheck(com.axibase.tsd.api.method.checks.EntityCheck) EntityCommand(com.axibase.tsd.api.model.command.EntityCommand) Test(org.testng.annotations.Test)

Example 30 with Entity

use of com.axibase.tsd.api.model.entity.Entity in project atsd-api-test by axibase.

the class SqlSyntaxQuotesEscapingTest method prepareData.

@BeforeClass
public void prepareData() throws Exception {
    Map<String, String> tags = new HashMap<>();
    tags.put("double\"quote", "tv1");
    tags.put("single'quote", "tv2");
    tags.put("both'quo\"tes", "tv3");
    Series series = new Series(TEST_ENTITY_NAME, TEST_METRIC_NAME, tags);
    series.addSamples(Sample.ofDateDecimal("2016-07-27T22:41:50.407Z", new BigDecimal("12.4")));
    SeriesMethod.insertSeriesCheck(Collections.singletonList(series));
    Metric updatedMetricQuery = new Metric();
    updatedMetricQuery.setTags(tags);
    MetricMethod.updateMetric(TEST_METRIC_NAME, updatedMetricQuery);
    Entity updatedEntityQuery = new Entity();
    updatedEntityQuery.setTags(tags);
    MetricMethod.updateMetric(TEST_METRIC_NAME, updatedEntityQuery);
}
Also used : Series(com.axibase.tsd.api.model.series.Series) Entity(com.axibase.tsd.api.model.entity.Entity) Metric(com.axibase.tsd.api.model.metric.Metric) BigDecimal(java.math.BigDecimal) BeforeClass(org.testng.annotations.BeforeClass)

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