Search in sources :

Example 96 with StringTable

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

the class SqlIsNullOperatorTest method testNotIsNotNullMetricSpecifiedTag.

@Issue("2937")
@Test
public void testNotIsNotNullMetricSpecifiedTag() {
    String sqlQuery = String.format("SELECT entity, datetime, value, tags.* %n" + "FROM \"%s\" %n" + "WHERE datetime >= '2016-06-19T11:00:00.000Z' and datetime < '2016-06-19T11:16:00.000Z' %n" + "AND NOT tags.tag4 IS NOT NULL %n", TEST_METRIC_NAME);
    StringTable resultTable = queryResponse(sqlQuery).readEntity(StringTable.class);
    List<List<String>> expectedRows = Arrays.asList(Arrays.asList(TEST_ENTITY1_NAME, "2016-06-19T11:00:00.000Z", "1", "val1", "null", "null"), Arrays.asList(TEST_ENTITY2_NAME, "2016-06-19T11:05:00.000Z", "2", "val2", "val2", "null"), Arrays.asList(TEST_ENTITY3_NAME, "2016-06-19T11:10:00.000Z", "3", "null", "val3", "null"));
    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 97 with StringTable

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

the class SqlModuloTest method testDividingPositiveByNegativeInteger.

@Issue("2922")
@Test
public void testDividingPositiveByNegativeInteger() {
    String sqlQuery = String.format("SELECT m1.value AS \"num\", m2.value AS \"den\", m1.value %s m2.value AS \"modulo\" FROM \"%s\" m1 %n " + "OUTER JOIN \"%s\" m2 %nWHERE m1.datetime = '2016-06-03T09:25:00.000Z' AND m1.entity = '%s'", "%", TEST_METRIC1_NAME, TEST_METRIC2_NAME, TEST_ENTITY_NAME);
    StringTable resultTable = queryResponse(sqlQuery).readEntity(StringTable.class);
    String[][] expectedRows = { { "12.0", "-2.0", "0.0" } };
    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 98 with StringTable

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

the class SqlModuloTest method testDividingPositiveByPositiveInteger.

@Issue("2922")
@Test
public void testDividingPositiveByPositiveInteger() {
    String sqlQuery = String.format("SELECT m1.value AS \"num\", m2.value AS \"den\", m1.value %s m2.value AS \"modulo\" FROM \"%s\" m1 %n " + "OUTER JOIN \"%s\" m2 %nWHERE m1.datetime = '2016-06-03T09:23:00.000Z' AND m1.entity = '%s'", "%", TEST_METRIC1_NAME, TEST_METRIC2_NAME, TEST_ENTITY_NAME);
    StringTable resultTable = queryResponse(sqlQuery).readEntity(StringTable.class);
    String[][] expectedRows = { { "7.0", "5.0", "2.0" } };
    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 99 with StringTable

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

the class SqlModuloTest method testDividingNullByNumber.

@Issue("2922")
@Test
public void testDividingNullByNumber() {
    String sqlQuery = String.format("SELECT m1.value AS \"num\", m2.value AS \"den\", m1.value %s m2.value AS \"modulo\" FROM \"%s\" m1 %n " + "OUTER JOIN \"%s\" m2 %nWHERE m1.datetime = '2016-06-03T09:27:00.000Z' AND m1.entity = '%s'", "%", TEST_METRIC1_NAME, TEST_METRIC2_NAME, TEST_ENTITY_NAME);
    StringTable resultTable = queryResponse(sqlQuery).readEntity(StringTable.class);
    String[][] expectedRows = { { "10.0", "null", "null" } };
    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 100 with StringTable

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

the class SqlModuloTest method testDividingNumberByNull.

@Issue("2922")
@Test
public void testDividingNumberByNull() {
    String sqlQuery = String.format("SELECT m2.value AS \"num\", m1.value AS \"den\", m2.value %s m1.value AS \"modulo\" FROM \"%s\" m1 %n " + "OUTER JOIN \"%s\" m2 %nWHERE m1.datetime = '2016-06-03T09:27:00.000Z' AND m1.entity = '%s'", "%", TEST_METRIC1_NAME, TEST_METRIC2_NAME, TEST_ENTITY_NAME);
    StringTable resultTable = queryResponse(sqlQuery).readEntity(StringTable.class);
    String[][] expectedRows = { { "null", "10.0", "null" } };
    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)

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