Search in sources :

Example 86 with StringTable

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

the class SqlFunctionDateFormatTimeExpressionTest method testNullFormattedOrderBy.

@Issue("3283")
@Test
public void testNullFormattedOrderBy() {
    String sqlQuery = String.format("SELECT date_format(time + 0/0) FROM \"%s\" ORDER BY datetime", TEST_METRIC_NAME);
    Response response = queryResponse(sqlQuery);
    StringTable resultTable = response.readEntity(StringTable.class);
    String[][] expectedRows = { { "null" } };
    assertTableRowsExist(expectedRows, resultTable);
}
Also used : Response(javax.ws.rs.core.Response) 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 87 with StringTable

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

the class SqlFunctionDateFormatTimeExpressionTest method testDivisionByZero.

@Issue("3283")
@Test
public void testDivisionByZero() {
    String sqlQuery = String.format("SELECT date_format(time/0) FROM \"%s\"", TEST_METRIC_NAME);
    Response response = queryResponse(sqlQuery);
    StringTable resultTable = response.readEntity(StringTable.class);
    String[][] expectedRows = { { Util.ISOFormat(new Date(Long.MAX_VALUE)) } };
    assertTableRowsExist(expectedRows, resultTable);
}
Also used : Response(javax.ws.rs.core.Response) StringTable(com.axibase.tsd.api.model.sql.StringTable) Date(java.util.Date) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test) SqlTest(com.axibase.tsd.api.method.sql.SqlTest)

Example 88 with StringTable

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

the class SqlFunctionDateFormatTimeExpressionTest method testDivisionWithRest.

@Issue("3283")
@Test
public void testDivisionWithRest() {
    String sqlQuery = String.format("SELECT date_format(time + 10/3) FROM \"%s\"", TEST_METRIC_NAME);
    Response response = queryResponse(sqlQuery);
    StringTable resultTable = response.readEntity(StringTable.class);
    String[][] expectedRows = { { "2016-06-03T09:41:00.003Z" } };
    assertTableRowsExist(expectedRows, resultTable);
}
Also used : Response(javax.ws.rs.core.Response) 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 89 with StringTable

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

the class SqlFunctionDateFormatTimeExpressionTest method testMinus.

@Issue("3283")
@Test
public void testMinus() {
    String sqlQuery = String.format("SELECT date_format(time-1) FROM \"%s\"", TEST_METRIC_NAME);
    Response response = queryResponse(sqlQuery);
    StringTable resultTable = response.readEntity(StringTable.class);
    String[][] expectedRows = { { "2016-06-03T09:40:59.999Z" } };
    assertTableRowsExist(expectedRows, resultTable);
}
Also used : Response(javax.ws.rs.core.Response) 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 90 with StringTable

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

the class SqlTimezoneFormatTest method testSimpleDateFormatWithZeroZone.

@Issue("2904")
@Test
public void testSimpleDateFormatWithZeroZone() throws JSONException {
    String sqlQuery = String.format("SELECT time, date_format(time, 'yyyy-MM-dd''T''HH:mm:ssZ') AS \"f-date\"" + "FROM \"%s\" WHERE datetime = '2016-06-03T09:23:00.000Z'", TEST_METRIC_NAME);
    StringTable resultTable = queryResponse(sqlQuery).readEntity(StringTable.class);
    List<String> expectedColumnValues = Collections.singletonList(formatDate(Util.parseDate("2016-06-03T09:23:00.000Z"), "yyyy-MM-dd'T'HH:mm:ssZ"));
    assertTableContainsColumnValues(expectedColumnValues, resultTable, "f-date");
}
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