Search in sources :

Example 11 with StringTable

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

the class CastTest method testCastConstantAsStringAppliesFormat.

@Issue("3770")
@Test(dataProvider = "constNumbersWithFormatProvider")
public void testCastConstantAsStringAppliesFormat(String castArgument, String expected) throws Exception {
    /**
     * Proper format of number is #.##
     */
    Series series = castNumberAsStringSeries;
    String sqlQuery = String.format("SELECT CAST(%s AS string) FROM \"%s\"", castArgument, series.getMetric());
    StringTable resultTable = SqlMethod.queryTable(sqlQuery);
    String castValue = resultTable.getValueAt(0, 0);
    assertEquals("Inproper format applied", expected, castValue);
}
Also used : Series(com.axibase.tsd.api.model.series.Series) 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 12 with StringTable

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

the class IsNullTest method testIsNullInExpression.

@Issue("3844")
@Test
public void testIsNullInExpression() throws Exception {
    String sqlQuery = String.format("SELECT ROUND(100 - ISNULL(value, 0)) FROM \"%s\"", TEST_METRIC);
    StringTable resultTable = queryResponse(sqlQuery).readEntity(StringTable.class);
    String[][] expectedRows = { { "-23.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 13 with StringTable

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

the class IsNullTest method testTypePreserved.

@Issue("3675")
@Test(dataProvider = "typeCheckTestProvider")
public void testTypePreserved(String from, String to, String type) throws Exception {
    String sqlQuery = String.format("SELECT ISNULL(%s, %s) FROM \"m-test-type-preserve-1\"", from, to);
    StringTable table = queryTable(sqlQuery, 1);
    assertEquals("wrong ISNULL result data type", type, table.getColumnMetaData(0).getDataType());
}
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 14 with StringTable

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

the class LikeOperatorTest method testMultipleLikeMetricOperatorsAnd.

@Issue("4083")
@Test
public void testMultipleLikeMetricOperatorsAnd() {
    String sqlQuery = String.format("SELECT metric " + "FROM atsd_series " + "WHERE metric LIKE '%1$s-first-__' AND metric LIKE '%1$s-first-2%%'" + "ORDER BY metric ", TEST_METRIC_PREFIX);
    StringTable table = SqlMethod.queryTable(sqlQuery);
    assertTableContainsColumnValues(TEST_METRICS.subList(20, 30), table, "metric");
}
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 15 with StringTable

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

the class LikeOperatorTest method testLikeMetricOperatorAndGreaterOrEquals.

@Issue("4152")
@Test
public void testLikeMetricOperatorAndGreaterOrEquals() {
    String sqlQuery = String.format("SELECT metric " + "FROM atsd_series " + "WHERE metric LIKE '%1$s-first-%%' AND metric >= '%1$s-first-40' " + "ORDER BY metric ", TEST_METRIC_PREFIX);
    StringTable table = SqlMethod.queryTable(sqlQuery);
    assertTableContainsColumnValues(TEST_METRICS.subList(40, 50), table, "metric");
}
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