Search in sources :

Example 46 with StringTable

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

the class SqlMerticTagsTest method testDoubleTagFiltersOr.

@Issue("4180")
@Test(dataProvider = "provideDoubleOperatorsOr", description = "Test all filters connected with complex filter equals to OR. (A OR B) AND (A OR B) = A OR B." + "Each filter will be tested with all other filters in his group, i.e. cross-product." + "Expected result is a union of first and second filter expected tags")
public void testDoubleTagFiltersOr(Filter filter) {
    String sqlQuery = String.format("SELECT tags.tag FROM \"%1$s\" WHERE (%2$s) AND (%2$s)", TEST_METRICS[0], filter.getExpression());
    StringTable table = queryTable(sqlQuery);
    assertEquals(String.format("Wrong query result using double tag filters: %s", filter.getExpression()), Sets.newHashSet(table.columnValues("tags.tag")), filter.getExpectedResultSet());
}
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 47 with StringTable

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

the class SqlMerticTagsTest method testDoubleTagFiltersAtsdSeriesAnd.

@Issue("4180")
@Test(dataProvider = "provideDoubleOperatorsAnd", description = "Test all filters select from atsd_series connected with complex filter equals to AND. " + "(A AND B) OR (A AND B) = A AND B." + "Each filter will be tested with all other filters in his group, i.e. cross-product." + "Expected result is a intersection of first and second filter expected tags")
public void testDoubleTagFiltersAtsdSeriesAnd(Filter filter) {
    // Logically similar to A AND B
    String sqlQuery = String.format("SELECT tags.tag " + "FROM atsd_series " + "WHERE metric IN ('%1$s', '%2$s') AND ((%3$s) OR (%3$s)) " + "ORDER BY tags.tag", TEST_METRICS[0], TEST_METRICS[1], filter.getExpression());
    StringTable table = queryTable(sqlQuery);
    assertEquals(String.format("Wrong atsd_series query result using double tag filters: %s", filter.getExpression()), Sets.newHashSet(table.columnValues("tags.tag")), filter.getExpectedResultSet());
}
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 48 with StringTable

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

the class SqlMerticTagsTest method testSingleTagFilter.

@Issue("4180")
@Test(dataProvider = "provideAllSingleOperators", description = "Test single tag filter")
public void testSingleTagFilter(Filter<String> filter) {
    String sqlQuery = String.format("SELECT tags.tag FROM \"%s\" WHERE %s ORDER BY tags.tag", TEST_METRICS[0], filter.getExpression());
    StringTable table = queryTable(sqlQuery);
    assertEquals(String.format("Wrong query result using single tag filter: %s", filter), Sets.newHashSet(table.columnValues("tags.tag")), filter.getExpectedResultSet());
}
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 49 with StringTable

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

the class SqlMerticTagsTest method testDoubleTagFiltersAtsdSeriesOr.

@Issue("4180")
@Test(dataProvider = "provideDoubleOperatorsOr", description = "Test all filters select from atsd_series connected with complex filter equals to OR. " + "(A OR B) AND (A OR B) = A OR B." + "Each filter will be tested with all other filters in his group, i.e. cross-product." + "Expected result is a union of first and second filter expected tags")
public void testDoubleTagFiltersAtsdSeriesOr(Filter filter) {
    // Logically similar to A OR B
    String sqlQuery = String.format("SELECT tags.tag " + "FROM atsd_series " + "WHERE metric IN ('%1$s', '%2$s') AND ((%3$s) AND (%3$s)) " + "ORDER BY tags.tag", TEST_METRICS[0], TEST_METRICS[1], filter.getExpression());
    StringTable table = queryTable(sqlQuery);
    assertEquals(String.format("Wrong atsd_series query result using double tag filters: %s", filter.getExpression()), Sets.newHashSet(table.columnValues("tags.tag")), filter.getExpectedResultSet());
}
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 50 with StringTable

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

the class SqlSelectMetricTagsTest method testSelectMetricSpecifiedTag.

@Issue("3056")
@Test
public void testSelectMetricSpecifiedTag() {
    String sqlQuery = String.format("SELECT metric.tags.a %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.a"), resultTable);
    List<List<String>> expectedRows = Collections.singletonList(Collections.singletonList("b"));
    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