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));
}
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);
}
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);
}
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);
}
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());
}
Aggregations