Search in sources :

Example 16 with SeriesCommand

use of com.axibase.tsd.api.model.command.SeriesCommand in project atsd-api-test by axibase.

the class SqlLargeDataTest method testQueryLargeData.

@Issue("3890")
@Test
public void testQueryLargeData() throws Exception {
    ArrayList<SeriesCommand> seriesRequests = new ArrayList<>(ENTITIES_COUNT);
    Registry.Entity.checkExists(ENTITY_NAME);
    Registry.Metric.checkExists(METRIC_NAME);
    for (int i = 1; i <= ENTITIES_COUNT; i++) {
        // manually set entity and metric to avoid check
        Series series = new Series();
        series.setEntity(ENTITY_NAME);
        series.setMetric(METRIC_NAME);
        series.addTag("tag", String.valueOf(i));
        series.addSamples(createTestSample(i));
        seriesRequests.addAll(series.toCommands());
    }
    TCPSender.sendChecked(new LargeDataCheck(ENTITY_NAME, METRIC_NAME, ENTITIES_COUNT), seriesRequests);
    String sqlQuery = String.format("SELECT COUNT(*) " + "FROM \"%s\" " + "GROUP BY entity", METRIC_NAME);
    String[][] expectedRows = { { String.valueOf(ENTITIES_COUNT) } };
    assertSqlQueryRows("Large data query error", expectedRows, sqlQuery);
}
Also used : Series(com.axibase.tsd.api.model.series.Series) ArrayList(java.util.ArrayList) SeriesCommand(com.axibase.tsd.api.model.command.SeriesCommand) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test) SqlTest(com.axibase.tsd.api.method.sql.SqlTest)

Example 17 with SeriesCommand

use of com.axibase.tsd.api.model.command.SeriesCommand in project atsd-api-test by axibase.

the class DQuoteCharEscapeTest method testMetric.

@Issue("2854")
@Test
public void testMetric() throws Exception {
    Series series = new Series("series-command-test-e2", "series-command-test\"-m2");
    Sample sample = Sample.ofDateInteger(Mocks.ISO_TIME, 1);
    series.addSamples(sample);
    SeriesCommand seriesCommand = new SeriesCommand();
    seriesCommand.setTimeISO(sample.getRawDate());
    seriesCommand.setEntityName(series.getEntity());
    seriesCommand.setValues(Collections.singletonMap(series.getMetric(), sample.getValue().toString()));
    CommandMethod.send(seriesCommand);
    assertSeriesExisting(series);
}
Also used : Series(com.axibase.tsd.api.model.series.Series) Sample(com.axibase.tsd.api.model.series.Sample) SeriesCommand(com.axibase.tsd.api.model.command.SeriesCommand) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Example 18 with SeriesCommand

use of com.axibase.tsd.api.model.command.SeriesCommand in project atsd-api-test by axibase.

the class EqualCharEscapeTest method testEntity.

@Issue("2854")
@Test
public void testEntity() throws Exception {
    Series series = new Series("series-command-test=-e3", "series-command-test-m3");
    Sample sample = Sample.ofJavaDateInteger(TestUtil.getCurrentDate(), 1);
    series.addSamples(sample);
    SeriesCommand seriesCommand = new SeriesCommand();
    seriesCommand.setTimeISO(sample.getRawDate());
    seriesCommand.setEntityName(series.getEntity());
    seriesCommand.setValues(Collections.singletonMap(series.getMetric(), sample.getValue().toString()));
    CommandMethod.send(seriesCommand);
    assertSeriesExisting(series);
}
Also used : Series(com.axibase.tsd.api.model.series.Series) Sample(com.axibase.tsd.api.model.series.Sample) SeriesCommand(com.axibase.tsd.api.model.command.SeriesCommand) Issue(io.qameta.allure.Issue) SeriesTest(com.axibase.tsd.api.method.series.SeriesTest) Test(org.testng.annotations.Test)

Aggregations

SeriesCommand (com.axibase.tsd.api.model.command.SeriesCommand)18 Series (com.axibase.tsd.api.model.series.Series)16 Issue (io.qameta.allure.Issue)16 Test (org.testng.annotations.Test)16 Sample (com.axibase.tsd.api.model.series.Sample)8 SeriesTest (com.axibase.tsd.api.method.series.SeriesTest)6 CommandMethodTest (com.axibase.tsd.api.extended.CommandMethodTest)5 PlainCommand (com.axibase.tsd.api.model.command.PlainCommand)5 ArrayList (java.util.ArrayList)4 BigDecimal (java.math.BigDecimal)2 SqlTest (com.axibase.tsd.api.method.sql.SqlTest)1 CommandSendingResult (com.axibase.tsd.api.model.extended.CommandSendingResult)1 BeforeClass (org.testng.annotations.BeforeClass)1