use of com.axibase.tsd.api.model.sql.StringTable in project atsd-api-test by axibase.
the class SqlExampleOrderByMultipleColumnsTest method test.
@Issue("3047")
@Test(description = "Test for alias documentation example. " + "https://github.com/axibase/atsd-docs/blob/master/api/sql/examples/order-by-value.md")
public void test() {
String sqlQuery = String.format("SELECT entity, tags.tag, delta(value) FROM \"%s\"%nGROUP BY entity, tags%nORDER BY tags.tag, DELTA(value) DESC", TEST_METRIC_NAME);
Response response = queryResponse(sqlQuery);
StringTable resultTable = response.readEntity(StringTable.class);
List<List<String>> expectedRows = Arrays.asList(Arrays.asList(TEST_ENTITY3_NAME, "a", "-2.0"), Arrays.asList(TEST_ENTITY1_NAME, "b", "-2.0"), Arrays.asList(TEST_ENTITY2_NAME, "c", "-2.0"));
assertTableRowsExist(expectedRows, resultTable);
}
use of com.axibase.tsd.api.model.sql.StringTable in project atsd-api-test by axibase.
the class SqlExampleOrderByValueTest method test.
@Issue("3047")
@Test(description = "Test for alias documentation example. " + "https://github.com/axibase/atsd-docs/blob/master/api/sql/examples/order-by-value.md")
public void test() {
String sqlQuery = String.format("SELECT entity, AVG(value) FROM \"%s\"%nGROUP BY entity%nORDER BY AVG(value) DESC", TEST_METRIC_NAME);
Response response = queryResponse(sqlQuery);
StringTable resultTable = response.readEntity(StringTable.class);
List<List<String>> expectedRows = Arrays.asList(Arrays.asList(TEST_ENTITY3_NAME, "5.0"), Arrays.asList(TEST_ENTITY2_NAME, "3.0"), Arrays.asList(TEST_ENTITY1_NAME, "1.0"));
assertTableRowsExist(expectedRows, resultTable);
}
use of com.axibase.tsd.api.model.sql.StringTable in project atsd-api-test by axibase.
the class SqlExampleQuoteEscapingTest method testExample1.
@Issue("3125")
@Test(description = "Test for query all tags documentation example. " + "https://github.com/axibase/atsd-docs/blob/master/api/sql/examples/select-escape-quote")
public void testExample1() {
String sqlQuery = String.format("SELECT tags.* %nFROM \"%s\" %nWHERE datetime > '2016-07-27T22:40:00.000Z'", TEST_METRIC_NAME);
StringTable resultTable = queryResponse(sqlQuery).readEntity(StringTable.class);
List<String> expectedColumnNames = Arrays.asList("tags.double\"quote", "tags.single'quote", "tags.both'quo\"tes");
List<List<String>> expectedRows = Collections.singletonList(Arrays.asList("tv3", "tv1", "tv2"));
assertTableColumnsNames(expectedColumnNames, resultTable);
assertTableRowsExist(expectedRows, resultTable);
}
use of com.axibase.tsd.api.model.sql.StringTable in project atsd-api-test by axibase.
the class SqlFunctionDateFormatTimeExpressionTest method testValueAsParam.
@Issue("3283")
@Test
public void testValueAsParam() {
String sqlQuery = String.format("SELECT date_format(value) FROM \"%s\" ORDER BY datetime", TEST_METRIC_NAME);
Response response = queryResponse(sqlQuery);
StringTable resultTable = response.readEntity(StringTable.class);
String[][] expectedRows = { { Util.ISOFormat(1) } };
assertTableRowsExist(expectedRows, resultTable);
}
use of com.axibase.tsd.api.model.sql.StringTable in project atsd-api-test by axibase.
the class SqlFunctionDateFormatTimeExpressionTest method testAllOperations.
@Issue("3283")
@Test
public void testAllOperations() {
String sqlQuery = String.format("SELECT date_format(time + 200/2 - 20*5) FROM \"%s\"", TEST_METRIC_NAME);
Response response = queryResponse(sqlQuery);
StringTable resultTable = response.readEntity(StringTable.class);
String[][] expectedRows = { { "2016-06-03T09:41:00.000Z" } };
assertTableRowsExist(expectedRows, resultTable);
}
Aggregations