Search in sources :

Example 6 with SeriesCheck

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

the class SeriesInsertTest method testXTextFieldExplicitNull.

@Issue("3480")
@Test
public void testXTextFieldExplicitNull() throws Exception {
    String entityName = "e-series-insert-text-null-1";
    String metricName = "m-series-insert-text-null-1";
    Series series = new Series(entityName, metricName);
    Sample sample = Sample.ofDateInteger("2016-10-11T13:00:00.000Z", 1);
    series.addSamples(sample);
    String commandJsonFormat = "[{'entity':'%s','metric':'%s','data':[{'d':'%s','v':%s,'x':null}]}]";
    commandJsonFormat = commandJsonFormat.replace('\'', '"');
    String json = String.format(commandJsonFormat, series.getEntity(), series.getMetric(), sample.getRawDate(), sample.getValue());
    Response response = insertSeries(json);
    assertEquals("Bad insertion request status code", OK.getStatusCode(), response.getStatus());
    Checker.check(new SeriesCheck(Collections.singletonList(series)));
    SeriesQuery seriesQuery = new SeriesQuery(series);
    List<Series> seriesList = querySeriesAsList(seriesQuery);
    assertEquals("Stored series are incorrect", Collections.singletonList(series), seriesList);
}
Also used : Response(javax.ws.rs.core.Response) SeriesQuery(com.axibase.tsd.api.model.series.query.SeriesQuery) SeriesCheck(com.axibase.tsd.api.method.checks.SeriesCheck) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Example 7 with SeriesCheck

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

the class TcpParsingTest method testNetworkParser.

/*
        The main problem of #4411 was that series command after metric command with newlines
        is interpreted as metric command also.

        For example

        metric m:"metric-name" d:"Some
        description"
        series e:"entity-name" m:"some-other-metric-name"=123
     */
@Issue("4411")
@Test(description = "Test that series command that follows metric command with newline " + "is parsed correctly")
public void testNetworkParser() throws Exception {
    Metric expectedMetric = new Metric(METRIC_NAME);
    expectedMetric.setDescription(METRIC_DESCRIPTION);
    Series expectedSeries = new Series(ENTITY_NAME, METRIC_NAME);
    expectedSeries.addSamples(Sample.ofDateInteger(Mocks.ISO_TIME, METRIC_VALUE));
    TCPSender.send(NETWORK_COMMAND);
    Checker.check(new MetricCheck(expectedMetric));
    Checker.check(new SeriesCheck(Collections.singletonList(expectedSeries)));
}
Also used : Series(com.axibase.tsd.api.model.series.Series) MetricCheck(com.axibase.tsd.api.method.checks.MetricCheck) SeriesCheck(com.axibase.tsd.api.method.checks.SeriesCheck) Metric(com.axibase.tsd.api.model.metric.Metric) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Example 8 with SeriesCheck

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

the class CompressedPayloadTest method gzipPayloadTest.

@Test
public void gzipPayloadTest() {
    Series series = new Series(entityName, metricName);
    series.addSamples(Sample.ofDateInteger(Mocks.ISO_TIME, 1));
    CommandMethod.sendGzipCompressedBytes(gzipOutput);
    Checker.check(new SeriesCheck(Collections.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) SqlTest(com.axibase.tsd.api.method.sql.SqlTest)

Example 9 with SeriesCheck

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

the class CSVInsertTest method testTimeRangeInMS.

@Issue("2957")
@Test
public void testTimeRangeInMS() {
    Series series = Mocks.series();
    series.setSamples(new ArrayList<>());
    series.addSamples(Sample.ofDateDecimal(MIN_STORABLE_DATE, Mocks.DECIMAL_VALUE), Sample.ofDateDecimal(MAX_STORABLE_DATE, Mocks.DECIMAL_VALUE));
    String csvPayload = String.format("time, %s%n%s, %s%n%s, %s%n", series.getMetric(), Util.parseDate(MIN_STORABLE_DATE).getTime(), Mocks.DECIMAL_VALUE, Util.parseDate(MAX_STORABLE_DATE).getTime(), 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)

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