Search in sources :

Example 61 with StringTable

use of com.axibase.tsd.api.model.sql.StringTable in project atsd-api-test by axibase.

the class SqlClauseJoinValueOrderTest method testOrderAsc.

@Issue("3322")
@Test
public void testOrderAsc() {
    String sqlQuery = String.format("SELECT t1.value FROM \"%s\" t1%nOUTER JOIN \"%s\" t2%nORDER BY t1.value", TEST_METRIC1_NAME, TEST_METRIC2_NAME);
    StringTable resultTable = queryResponse(sqlQuery).readEntity(StringTable.class);
    String[][] expectedRows = { { "null" }, { "null" }, { "null" }, { "1" }, { "2" }, { "3" }, { "4" } };
    assertTableRowsExist(expectedRows, resultTable);
}
Also used : StringTable(com.axibase.tsd.api.model.sql.StringTable) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test) SqlTest(com.axibase.tsd.api.method.sql.SqlTest)

Example 62 with StringTable

use of com.axibase.tsd.api.model.sql.StringTable in project atsd-api-test by axibase.

the class LimitAggregationFunctionTest method testAggregateFunctionLimitWithPredicate.

@Issue("3600")
@Test(dataProvider = "aggregationFunctionProvider")
public void testAggregateFunctionLimitWithPredicate(String function) {
    String sqlQuery = String.format("SELECT %s(value) " + "FROM \"%s\" " + "WHERE datetime > '2016-06-03T09:23:00.000Z' AND datetime < '2016-06-03T09:23:10.000Z' ", function, testMetric);
    StringTable tableWithoutLimit = queryTable(sqlQuery);
    String limitSqlQuery = sqlQuery.concat("LIMIT 1");
    assertSqlQueryRows(tableWithoutLimit.getRows().subList(0, 1), limitSqlQuery);
}
Also used : StringTable(com.axibase.tsd.api.model.sql.StringTable) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test) SqlTest(com.axibase.tsd.api.method.sql.SqlTest)

Example 63 with StringTable

use of com.axibase.tsd.api.model.sql.StringTable in project atsd-api-test by axibase.

the class SqlSelectAllWithJoinTest method testSelectAllColumnsWithoutAlias.

@Issue("3033")
@Test
public void testSelectAllColumnsWithoutAlias() {
    String sqlQuery = "SELECT * FROM \"sql-select-all-join-metric-1\" " + "JOIN \"sql-select-all-join-metric-2\"";
    StringTable resultTable = queryResponse(sqlQuery).readEntity(StringTable.class);
    List<String> expectedColumnNames = Arrays.asList(TEST_METRIC1_NAME + ".time", TEST_METRIC1_NAME + ".datetime", TEST_METRIC1_NAME + ".value", TEST_METRIC1_NAME + ".text", TEST_METRIC1_NAME + ".metric", TEST_METRIC1_NAME + ".entity", TEST_METRIC1_NAME + ".tags", TEST_METRIC2_NAME + ".time", TEST_METRIC2_NAME + ".datetime", TEST_METRIC2_NAME + ".value", TEST_METRIC2_NAME + ".text", TEST_METRIC2_NAME + ".metric", TEST_METRIC2_NAME + ".entity", TEST_METRIC2_NAME + ".tags");
    assertTableColumnsNames(expectedColumnNames, resultTable, true);
}
Also used : StringTable(com.axibase.tsd.api.model.sql.StringTable) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test) SqlTest(com.axibase.tsd.api.method.sql.SqlTest)

Example 64 with StringTable

use of com.axibase.tsd.api.model.sql.StringTable in project atsd-api-test by axibase.

the class SqlSelectEntityTagsTest method testSelectTagsWithGroupByEntityTags.

@Issue("3062")
@Test
public void testSelectTagsWithGroupByEntityTags() {
    String sqlQuery = String.format("SELECT entity, COUNT(value), entity.tags FROM \"%s\" %n" + "WHERE datetime >= '2016-06-03T09:27:00.000Z' AND datetime < '2016-06-03T09:27:02.001Z' %n" + "AND entity = '%s' %nGROUP BY entity, value", TEST_METRIC_NAME, TEST_ENTITY3_NAME);
    StringTable resultTable = queryResponse(sqlQuery).readEntity(StringTable.class);
    List<String> expectedColumn = Collections.singletonList("null");
    assertTableContainsColumnValues(expectedColumn, resultTable, "entity.tags");
}
Also used : StringTable(com.axibase.tsd.api.model.sql.StringTable) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test) SqlTest(com.axibase.tsd.api.method.sql.SqlTest)

Example 65 with StringTable

use of com.axibase.tsd.api.model.sql.StringTable in project atsd-api-test by axibase.

the class SqlSelectEntityTagsTest method testSelectEntityTags.

@Issue("3062")
@Test
public void testSelectEntityTags() {
    String sqlQuery = String.format("SELECT entity, value, entity.tags FROM \"%s\" %n" + "WHERE datetime >= '2016-06-03T09:27:00.000Z' AND datetime < '2016-06-03T09:27:02.001Z' %n" + "AND entity = '%s' %nORDER BY datetime", TEST_METRIC_NAME, TEST_ENTITY1_NAME);
    StringTable resultTable = queryResponse(sqlQuery).readEntity(StringTable.class);
    List<String> expectedColumn = Collections.singletonList("a=b;b=c");
    assertTableContainsColumnValues(expectedColumn, resultTable, "entity.tags");
}
Also used : StringTable(com.axibase.tsd.api.model.sql.StringTable) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test) SqlTest(com.axibase.tsd.api.method.sql.SqlTest)

Aggregations

StringTable (com.axibase.tsd.api.model.sql.StringTable)277 Test (org.testng.annotations.Test)276 SqlTest (com.axibase.tsd.api.method.sql.SqlTest)275 Issue (io.qameta.allure.Issue)270 List (java.util.List)147 Response (javax.ws.rs.core.Response)49 ArrayList (java.util.ArrayList)23 Series (com.axibase.tsd.api.model.series.Series)4 BigDecimal (java.math.BigDecimal)1 Date (java.util.Date)1 BeforeTest (org.testng.annotations.BeforeTest)1