Search in sources :

Example 91 with Issue

use of io.qameta.allure.Issue in project atsd-api-test by axibase.

the class CastTest method testCastNumberAsStringApplied.

@Issue("3770")
@Test(dataProvider = "castNumberArgumentsProvider")
public void testCastNumberAsStringApplied(String castArgument) throws Exception {
    Series series = castNumberAsStringSeries;
    String sqlQuery = String.format("SELECT CAST(%s AS string) FROM \"%s\"", castArgument, series.getMetric());
    StringTable resultTable = SqlMethod.queryTable(sqlQuery);
    assertEquals("Bad column type for CAST as string column", "string", resultTable.getColumnMetaData(0).getDataType());
}
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 92 with Issue

use of io.qameta.allure.Issue in project atsd-api-test by axibase.

the class CastTest method testCastNumberAsStringPassedToStringFunction.

@Issue("3770")
@Test(dataProvider = "castNumberArgumentsProvider")
public void testCastNumberAsStringPassedToStringFunction(String castArgument) throws Exception {
    Series series = castNumberAsStringSeries;
    String sqlQuery = String.format("SELECT CONCAT('foo', CAST(%s AS string)) FROM \"%s\"", castArgument, series.getMetric());
    StringTable resultTable = SqlMethod.queryTable(sqlQuery);
    assertEquals("'foo' has not been concatenated with casted number", "foo", resultTable.getValueAt(0, 0).substring(0, 3));
}
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 93 with Issue

use of io.qameta.allure.Issue 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 94 with Issue

use of io.qameta.allure.Issue in project atsd-api-test by axibase.

the class CastTest method testImplicitCastToNumberInFunction.

@Issue("4020")
@Test
public void testImplicitCastToNumberInFunction() throws Exception {
    Series series = Mocks.series();
    SeriesMethod.insertSeriesCheck(series);
    String sql = String.format("SELECT ABS('10')%n" + "FROM \"%s\"", series.getMetric());
    String[][] expected = { { "10" } };
    assertSqlQueryRows("String constant argument was not implicitly casted to number", expected, sql);
}
Also used : Series(com.axibase.tsd.api.model.series.Series) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test) SqlTest(com.axibase.tsd.api.method.sql.SqlTest)

Example 95 with Issue

use of io.qameta.allure.Issue in project atsd-api-test by axibase.

the class CastTest method testImplicitCastOfStringFunctionResult.

@Issue("4020")
@Test
public void testImplicitCastOfStringFunctionResult() throws Exception {
    Series series = Mocks.series();
    series.setSamples(Collections.singletonList(Sample.ofDateInteger(Mocks.ISO_TIME, 10)));
    SeriesMethod.insertSeriesCheck(series);
    String sql = String.format("SELECT ABS(CONCAT(value, ''))%n" + "FROM \"%s\"", series.getMetric());
    String[][] expected = { { "10" } };
    assertSqlQueryRows("String function result was not implicitly casted to number", expected, sql);
}
Also used : Series(com.axibase.tsd.api.model.series.Series) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test) SqlTest(com.axibase.tsd.api.method.sql.SqlTest)

Aggregations

Issue (io.qameta.allure.Issue)858 Test (org.testng.annotations.Test)857 SqlTest (com.axibase.tsd.api.method.sql.SqlTest)377 StringTable (com.axibase.tsd.api.model.sql.StringTable)270 Response (javax.ws.rs.core.Response)234 List (java.util.List)166 SeriesQuery (com.axibase.tsd.api.model.series.query.SeriesQuery)145 Series (com.axibase.tsd.api.model.series.Series)88 Property (com.axibase.tsd.api.model.property.Property)84 BigDecimal (java.math.BigDecimal)53 Metric (com.axibase.tsd.api.model.metric.Metric)50 Period (com.axibase.tsd.api.model.Period)47 PropertyQuery (com.axibase.tsd.api.model.property.PropertyQuery)44 Entity (com.axibase.tsd.api.model.entity.Entity)43 ArrayList (java.util.ArrayList)37 Message (com.axibase.tsd.api.model.message.Message)32 PlainCommand (com.axibase.tsd.api.model.command.PlainCommand)31 HashMap (java.util.HashMap)30 EntityGroup (com.axibase.tsd.api.model.entitygroup.EntityGroup)29 Aggregate (com.axibase.tsd.api.model.series.query.transformation.aggregate.Aggregate)29