use of com.axibase.tsd.api.model.sql.StringTable in project atsd-api-test by axibase.
the class SqlSelectMetricTagsTest method testSelectMetricSpecifiedTagCaseSensitivityTrue.
@Issue("3056")
@Test
public void testSelectMetricSpecifiedTagCaseSensitivityTrue() {
String sqlQuery = String.format("SELECT metric.tags.Tag %nFROM \"%s\" %nWHERE datetime = '2016-06-29T08:00:00.000Z'AND entity='%s'", TEST_METRIC_NAME, TEST_ENTITY_NAME);
StringTable resultTable = queryResponse(sqlQuery).readEntity(StringTable.class);
assertTableColumnsNames(Collections.singletonList("metric.tags.Tag"), resultTable);
List<List<String>> expectedRows = Collections.singletonList(Collections.singletonList("null"));
assertTableRowsExist(expectedRows, resultTable);
}
use of com.axibase.tsd.api.model.sql.StringTable in project atsd-api-test by axibase.
the class SqlClauseLimitOffsetTest method testCorrectOffsetByLimitClause.
@Issue("3229")
@Test
public void testCorrectOffsetByLimitClause() {
String sqlQuery = String.format("SELECT value FROM \"%s\" %nLIMIT 1,2", TEST_METRIC_NAME);
StringTable resultTable = queryResponse(sqlQuery).readEntity(StringTable.class);
List<String> expectedColumn = Arrays.asList("1", "2");
assertTableContainsColumnValues(expectedColumn, resultTable, "value");
}
use of com.axibase.tsd.api.model.sql.StringTable in project atsd-api-test by axibase.
the class SqlClauseOrderByAggregatedColumnAliasTest method testASC.
@Issue("3185")
@Test
public void testASC() {
String sqlQuery = String.format("SELECT entity, AVG(value) AS \"aggregated\" FROM \"%s\" %nGROUP BY entity %nORDER BY \"aggregated\"", TEST_METRIC_NAME);
StringTable resultTable = queryResponse(sqlQuery).readEntity(StringTable.class);
List<List<String>> expectedRows = Arrays.asList(Arrays.asList(TEST_ENTITY1_NAME, "2.0"), Arrays.asList(TEST_ENTITY2_NAME, "3.0"));
assertTableRowsExist(expectedRows, resultTable);
}
use of com.axibase.tsd.api.model.sql.StringTable in project atsd-api-test by axibase.
the class SqlClauseOrderByAggregatedColumnAliasTest method testOrderMultipleColumn.
@Issue("3185")
@Test
public void testOrderMultipleColumn() {
String sqlQuery = String.format("SELECT entity, AVG(value) AS \"aggregated\" FROM \"%s\" %nGROUP BY entity %nORDER BY entity ASC, \"aggregated\" DESC", TEST_METRIC_NAME);
StringTable resultTable = queryResponse(sqlQuery).readEntity(StringTable.class);
List<List<String>> expectedRows = Arrays.asList(Arrays.asList(TEST_ENTITY1_NAME, "2.0"), Arrays.asList(TEST_ENTITY2_NAME, "3.0"));
assertTableRowsExist(expectedRows, resultTable);
}
use of com.axibase.tsd.api.model.sql.StringTable in project atsd-api-test by axibase.
the class SqlEntityGroupsWhereClauseTest method testInEntityGroupsContainOneElement.
@Issue("3020")
@Test
public void testInEntityGroupsContainOneElement() {
EntityGroupMethod.addEntities(TEST_ENTITY_GROUP1_NAME, Collections.singletonList(TEST_ENTITY_NAME));
String sqlQuery = String.format("SELECT datetime, entity, value, entity.groups FROM \"%s\" %n" + "WHERE '%s' IN entity.groups %nAND datetime = '2016-07-14T15:00:07.000Z' %n", TEST_METRIC_NAME, TEST_ENTITY_GROUP1_NAME);
StringTable resultTable = queryResponse(sqlQuery).readEntity(StringTable.class);
List<List<String>> expectedRows = Collections.singletonList(Arrays.asList("2016-07-14T15:00:07.000Z", TEST_ENTITY_NAME, "0", TEST_ENTITY_GROUP1_NAME));
assertTableRowsExist(expectedRows, resultTable);
}
Aggregations