Search in sources :

Example 1 with SeriesCheck

use of com.axibase.tsd.api.method.checks.SeriesCheck in project atsd-api-test by axibase.

the class EntityCreateOrReplaceTest method testSeriesRemain.

@Issue("1968")
@Test
public void testSeriesRemain() throws Exception {
    Series series = new Series("create-entity-17", "create-entity-metric-17");
    series.addSamples(Sample.ofDateInteger(MIN_STORABLE_DATE, 0));
    SeriesMethod.insertSeriesCheck(Collections.singletonList(series));
    Entity entity = new Entity();
    entity.setName(series.getEntity());
    createOrReplaceEntityCheck(entity);
    assertTrue("Inserted Series should remain", new SeriesCheck(Collections.singletonList(series)).isChecked());
}
Also used : Series(com.axibase.tsd.api.model.series.Series) Entity(com.axibase.tsd.api.model.entity.Entity) SeriesCheck(com.axibase.tsd.api.method.checks.SeriesCheck) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Example 2 with SeriesCheck

use of com.axibase.tsd.api.method.checks.SeriesCheck in project atsd-api-test by axibase.

the class LineBreakInsideSeriesCommandTest method sendAndCheck.

private void sendAndCheck(String message, Series insert, Series response, TestType type) {
    List<PlainCommand> commands = new ArrayList<>();
    commands.addAll(insert.toCommands());
    boolean checked;
    try {
        switch(type) {
            case NETWORK_API:
                TCPSender.sendChecked(new SeriesCheck(Collections.singletonList(response)), commands);
                break;
            case DATA_API:
                CommandMethod.send(commands);
                Checker.check(new SeriesCheck(Collections.singletonList(response)));
                break;
        }
        checked = true;
    } catch (IOException e) {
        e.printStackTrace();
        checked = false;
    }
    assertTrue(message, checked);
}
Also used : PlainCommand(com.axibase.tsd.api.model.command.PlainCommand) ArrayList(java.util.ArrayList) SeriesCheck(com.axibase.tsd.api.method.checks.SeriesCheck) IOException(java.io.IOException)

Example 3 with SeriesCheck

use of com.axibase.tsd.api.method.checks.SeriesCheck in project atsd-api-test by axibase.

the class CSVInsertTest method testMultipleISOFormat.

@Issue("2009")
@Test
public void testMultipleISOFormat() throws Exception {
    Series series = Mocks.series();
    series.setSamples(new ArrayList<Sample>());
    String header = String.format("date, %s%n", series.getMetric());
    StringBuilder payloadBuilder = new StringBuilder(header);
    String[][] dateTemplatePairs = new String[][] { { "2016-05-21T00:00:00.000Z", "yyyy-MM-dd'T'HH:mm:ss'Z'" }, { "2016-05-21T00:00:00.001Z", "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'" }, { "2016-05-21T00:00:15.000Z", "yyyy-MM-dd'T'HH:mm:ssXXX" }, { "2016-05-21T00:00:15.001Z", "yyyy-MM-dd'T'HH:mm:ss.SSSXXX" } };
    for (int i = 0; i < dateTemplatePairs.length; i++) {
        Date date = parseDate(dateTemplatePairs[i][0]);
        String pattern = dateTemplatePairs[i][1];
        String csvRow = String.format("%s, %s%n", formatISODate(date, pattern), Mocks.DECIMAL_VALUE);
        payloadBuilder.append(csvRow);
        series.addSamples(Sample.ofDateDecimal(dateTemplatePairs[i][0], Mocks.DECIMAL_VALUE));
    }
    String csvPayload = payloadBuilder.toString();
    csvInsertCheck(new SeriesCheck(singletonList(series)), series.getEntity(), csvPayload, series.getTags());
}
Also used : Series(com.axibase.tsd.api.model.series.Series) Sample(com.axibase.tsd.api.model.series.Sample) SeriesCheck(com.axibase.tsd.api.method.checks.SeriesCheck) Date(java.util.Date) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Example 4 with SeriesCheck

use of com.axibase.tsd.api.method.checks.SeriesCheck in project atsd-api-test by axibase.

the class CSVInsertTest method testTimeRangeInISO.

@Issue("2957")
@Test
public void testTimeRangeInISO() throws Exception {
    Series series = Mocks.series();
    series.setSamples(Arrays.asList(Sample.ofDateDecimal(MIN_STORABLE_DATE, Mocks.DECIMAL_VALUE), Sample.ofDateDecimal(MAX_STORABLE_DATE, Mocks.DECIMAL_VALUE)));
    String csvPayload = String.format("date, %s%n%s, %s%n%s, %s%n", series.getMetric(), MIN_STORABLE_DATE, Mocks.DECIMAL_VALUE, MAX_STORABLE_DATE, Mocks.DECIMAL_VALUE);
    csvInsertCheck(new SeriesCheck(singletonList(series)), series.getEntity(), csvPayload, series.getTags());
}
Also used : Series(com.axibase.tsd.api.model.series.Series) SeriesCheck(com.axibase.tsd.api.method.checks.SeriesCheck) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Example 5 with SeriesCheck

use of com.axibase.tsd.api.method.checks.SeriesCheck in project atsd-api-test by axibase.

the class TCPSenderTest method testSend.

@Test
public void testSend() throws Exception {
    Series series = Mocks.series();
    TCPSender.send(series.toCommands());
    assertCheck(new SeriesCheck(singletonList(series)));
}
Also used : Series(com.axibase.tsd.api.model.series.Series) SeriesCheck(com.axibase.tsd.api.method.checks.SeriesCheck) Test(org.testng.annotations.Test)

Aggregations

SeriesCheck (com.axibase.tsd.api.method.checks.SeriesCheck)9 Test (org.testng.annotations.Test)8 Series (com.axibase.tsd.api.model.series.Series)7 Issue (io.qameta.allure.Issue)6 MetricCheck (com.axibase.tsd.api.method.checks.MetricCheck)1 SqlTest (com.axibase.tsd.api.method.sql.SqlTest)1 PlainCommand (com.axibase.tsd.api.model.command.PlainCommand)1 Entity (com.axibase.tsd.api.model.entity.Entity)1 Metric (com.axibase.tsd.api.model.metric.Metric)1 Sample (com.axibase.tsd.api.model.series.Sample)1 SeriesQuery (com.axibase.tsd.api.model.series.query.SeriesQuery)1 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 Date (java.util.Date)1 Response (javax.ws.rs.core.Response)1