Search in sources :

Example 41 with StringTable

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);
}
Also used : StringTable(com.axibase.tsd.api.model.sql.StringTable) List(java.util.List) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test) SqlTest(com.axibase.tsd.api.method.sql.SqlTest)

Example 42 with StringTable

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");
}
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 43 with StringTable

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);
}
Also used : StringTable(com.axibase.tsd.api.model.sql.StringTable) List(java.util.List) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test) SqlTest(com.axibase.tsd.api.method.sql.SqlTest)

Example 44 with StringTable

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);
}
Also used : StringTable(com.axibase.tsd.api.model.sql.StringTable) List(java.util.List) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test) SqlTest(com.axibase.tsd.api.method.sql.SqlTest)

Example 45 with StringTable

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);
}
Also used : StringTable(com.axibase.tsd.api.model.sql.StringTable) List(java.util.List) 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