use of com.axibase.tsd.api.model.sql.StringTable in project atsd-api-test by axibase.
the class SqlEntityGroupsWhereClauseTest method testTwoEntityGroupsIntersectingOneElementSet.
@Issue("3020")
@Test
public void testTwoEntityGroupsIntersectingOneElementSet() {
EntityGroupMethod.addEntities(TEST_ENTITY_GROUP1_NAME, Collections.singletonList(TEST_ENTITY_NAME));
EntityGroupMethod.addEntities(TEST_ENTITY_GROUP2_NAME, Collections.singletonList(TEST_ENTITY_NAME));
String sqlQuery = String.format("SELECT datetime, entity, value, entity.groups FROM \"%s\" %n" + "WHERE entity.groups IN ('%s') %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 + ';' + TEST_ENTITY_GROUP2_NAME));
assertTableRowsExist(expectedRows, resultTable);
}
use of com.axibase.tsd.api.model.sql.StringTable in project atsd-api-test by axibase.
the class SqlEntityGroupsWhereClauseTest method testCaseSensitivityEntityGroupsNotInSet.
@Issue("3020")
@Test
public void testCaseSensitivityEntityGroupsNotInSet() {
EntityGroupMethod.addEntities(TEST_CASE_SENSITIVITY_GROUP_NAME, Collections.singletonList(TEST_ENTITY_NAME));
String sqlQuery = String.format("SELECT datetime, entity, value, entity.groups FROM \"%s\" %nWHERE entity.groups NOT IN ('%s') %n" + "AND datetime = '2016-07-14T15:00:07.000Z' %n", TEST_METRIC_NAME, TEST_CASE_SENSITIVITY_GROUP_NAME);
StringTable resultTable = queryResponse(sqlQuery).readEntity(StringTable.class);
List<List<String>> expectedRows = Collections.emptyList();
assertTableRowsExist(expectedRows, resultTable);
}
use of com.axibase.tsd.api.model.sql.StringTable in project atsd-api-test by axibase.
the class SqlEntityGroupsWhereClauseTest method testZeroEntityGroupsIntersectingTwoElementSet.
@Issue("3020")
@Test
public void testZeroEntityGroupsIntersectingTwoElementSet() {
String sqlQuery = String.format("SELECT datetime, entity, value, entity.groups FROM \"%s\" %n" + "WHERE entity.groups IN ('group-1', 'group-2') %nAND datetime = '2016-07-14T15:00:07.000Z' %n", TEST_METRIC_NAME);
StringTable resultTable = queryResponse(sqlQuery).readEntity(StringTable.class);
List<List<String>> expectedRows = Collections.emptyList();
assertTableRowsExist(expectedRows, resultTable);
}
use of com.axibase.tsd.api.model.sql.StringTable in project atsd-api-test by axibase.
the class SqlEntityGroupsWhereClauseTest method testZeroEntityGroupsNotIntersectingTwoElementSet.
@Issue("3020")
@Test
public void testZeroEntityGroupsNotIntersectingTwoElementSet() {
String sqlQuery = String.format("SELECT datetime, entity, value, entity.groups FROM \"%s\" %n" + "WHERE entity.groups NOT IN ('group-1', 'group-2') %nAND datetime = '2016-07-14T15:00:07.000Z' %n", TEST_METRIC_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", "null"));
assertTableRowsExist(expectedRows, resultTable);
}
use of com.axibase.tsd.api.model.sql.StringTable in project atsd-api-test by axibase.
the class SqlEntityGroupsWhereClauseTest method testCaseSensitivityEntityGroupsInSet.
@Issue("3020")
@Test
public void testCaseSensitivityEntityGroupsInSet() {
EntityGroupMethod.addEntities(TEST_CASE_SENSITIVITY_GROUP_NAME, Collections.singletonList(TEST_ENTITY_NAME));
String sqlQuery = String.format("SELECT datetime, entity, value, entity.groups FROM \"%s\" %n" + "WHERE entity.groups IN ('%s') %nAND datetime = '2016-07-14T15:00:07.000Z' %n", TEST_METRIC_NAME, TEST_CASE_SENSITIVITY_GROUP_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_CASE_SENSITIVITY_GROUP_NAME));
assertTableRowsExist(expectedRows, resultTable);
}
Aggregations