Search in sources :

Example 1 with Series

use of com.axibase.tsd.api.model.series.Series in project atsd-api-test by axibase.

the class CastTest method testImplicitCastInMathExpressionsRizesError.

@Issue("4020")
@Test
public void testImplicitCastInMathExpressionsRizesError() throws Exception {
    Series series = Mocks.series();
    SeriesMethod.insertSeriesCheck(series);
    String sql = String.format("SELECT CONCAT(value, '')+10%n" + "FROM \"%s\"", series.getMetric());
    assertBadRequest("Math expression with string variable applied", "Invalid expression: 'concat(value, '') + 10'", queryResponse(sql));
}
Also used : Series(com.axibase.tsd.api.model.series.Series) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test) SqlTest(com.axibase.tsd.api.method.sql.SqlTest)

Example 2 with Series

use of com.axibase.tsd.api.model.series.Series in project atsd-api-test by axibase.

the class EntityRecreateTest method testRecreateEntity.

@Issue("4037")
@Test
public void testRecreateEntity() throws Exception {
    final String metricName = metric();
    final String entityName1 = entity();
    final String entityName2 = entity();
    Series series1 = new Series(entityName1, metricName);
    series1.addSamples(Mocks.SAMPLE);
    Series series2 = new Series(entityName2, metricName);
    series2.addSamples(Mocks.SAMPLE);
    /* Insert first entity*/
    SeriesMethod.insertSeriesCheck(series1);
    /* Remove first entity*/
    EntityMethod.deleteEntity(entityName1);
    /* Insert second series */
    SeriesMethod.insertSeriesCheck(series2);
    String sqlQuery = String.format("SELECT entity FROM \"%s\" ORDER BY entity", metricName);
    String[][] expectedRows = { { entityName2 } };
    assertSqlQueryRows("Entity recreation gives wrong result", expectedRows, sqlQuery);
}
Also used : Series(com.axibase.tsd.api.model.series.Series) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Example 3 with Series

use of com.axibase.tsd.api.model.series.Series in project atsd-api-test by axibase.

the class DoubleBackslashCharEscapeTest method testMetric.

@Issue("2854")
@Issue("6319")
@Test
public void testMetric() throws Exception {
    Series series = new Series(Mocks.entity(), Mocks.metric().replaceAll("-", "\\\\\\\\"));
    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()));
    transport.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)

Example 4 with Series

use of com.axibase.tsd.api.model.series.Series in project atsd-api-test by axibase.

the class SeriesQueryTest method testSameDoubleSeriesQueryWithAggregation.

@Issue("4714")
@Test(description = "test same double series query")
public void testSameDoubleSeriesQueryWithAggregation() {
    SeriesQuery query = new SeriesQuery(TEST_SERIES3.getEntity(), TEST_SERIES3.getMetric());
    query.setStartDate("2017-01-01T00:01:00Z");
    query.setEndDate("2017-01-01T00:04:00Z");
    query.setAggregate(new Aggregate(AggregationType.SUM, new Period(3, TimeUnit.MINUTE, PeriodAlignment.START_TIME)));
    List<Series> seriesList = SeriesMethod.querySeriesAsList(query, query);
    List<Series> result = new ArrayList<>();
    for (Series series : seriesList) {
        result.add(pullCheckedFields(series));
    }
    Series expectedSeries = new Series();
    expectedSeries.setEntity(TEST_SERIES3.getEntity());
    expectedSeries.setMetric(TEST_SERIES3.getMetric());
    expectedSeries.setTags(Mocks.TAGS);
    expectedSeries.addSamples(Sample.ofDateDecimal("2017-01-01T00:01:00Z", new BigDecimal("6.0")));
    assertEquals("Incorrect query result with two same series requests", Arrays.asList(expectedSeries, expectedSeries), result);
}
Also used : Series(com.axibase.tsd.api.model.series.Series) SeriesQuery(com.axibase.tsd.api.model.series.query.SeriesQuery) Period(com.axibase.tsd.api.model.Period) Aggregate(com.axibase.tsd.api.model.series.query.transformation.aggregate.Aggregate) BigDecimal(java.math.BigDecimal) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Example 5 with Series

use of com.axibase.tsd.api.model.series.Series in project atsd-api-test by axibase.

the class SeriesQueryTest method testDateFilterRangeIsAfterStorableRange.

@Issue("3013")
@Test
public void testDateFilterRangeIsAfterStorableRange() throws Exception {
    String entityName = "e-query-range-15";
    String metricName = "m-query-range-15";
    BigDecimal v = new BigDecimal("7");
    Series series = new Series(entityName, metricName);
    series.addSamples(Sample.ofDateDecimal(MIN_STORABLE_DATE, v));
    insertSeriesCheck(Collections.singletonList(series));
    SeriesQuery seriesQuery = new SeriesQuery(series.getEntity(), series.getMetric(), addOneMS(MAX_STORABLE_DATE), MAX_QUERYABLE_DATE);
    List<Sample> data = querySeriesAsList(seriesQuery).get(0).getData();
    assertEquals("Not empty data for disjoint query and stored interval", 0, data.size());
}
Also used : Series(com.axibase.tsd.api.model.series.Series) SeriesQuery(com.axibase.tsd.api.model.series.query.SeriesQuery) Sample(com.axibase.tsd.api.model.series.Sample) BigDecimal(java.math.BigDecimal) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test)

Aggregations

Series (com.axibase.tsd.api.model.series.Series)434 Test (org.testng.annotations.Test)212 BeforeClass (org.testng.annotations.BeforeClass)180 Issue (io.qameta.allure.Issue)173 SeriesQuery (com.axibase.tsd.api.model.series.query.SeriesQuery)102 BigDecimal (java.math.BigDecimal)67 Sample (com.axibase.tsd.api.model.series.Sample)61 SqlTest (com.axibase.tsd.api.method.sql.SqlTest)42 ArrayList (java.util.ArrayList)41 Metric (com.axibase.tsd.api.model.metric.Metric)37 Response (javax.ws.rs.core.Response)36 Entity (com.axibase.tsd.api.model.entity.Entity)22 SeriesCheck (com.axibase.tsd.api.method.checks.SeriesCheck)18 Aggregate (com.axibase.tsd.api.model.series.query.transformation.aggregate.Aggregate)18 SeriesCommand (com.axibase.tsd.api.model.command.SeriesCommand)16 Period (com.axibase.tsd.api.model.Period)14 Group (com.axibase.tsd.api.model.series.query.transformation.group.Group)9 SeriesTest (com.axibase.tsd.api.method.series.SeriesTest)8 BeforeTest (org.testng.annotations.BeforeTest)7 Interval (com.axibase.tsd.api.model.series.query.Interval)6