use of mondrian.spi.impl.PostgreSqlDialect in project mondrian by pentaho.
the class CodeSetTest method testSucces_CodeSetContainsOnlyCodeForPostgresDialect.
/**
* ISSUE MONDRIAN-2335 If SqlQuery.CodeSet contains only sql code
* for dialect="postgres", this code should be chosen.
* No error should be thrown
*
* @throws Exception
*/
public void testSucces_CodeSetContainsOnlyCodeForPostgresDialect() throws Exception {
PostgreSqlDialect postgreSqlDialect = new PostgreSqlDialect(mockConnection(POSTGRESQL_PRODUCT_NAME, POSTGRESQL_PRODUCT_VERSION));
codeSet = new SqlQuery.CodeSet();
codeSet.put(POSTGRES_DIALECT, SQL_CODE_FOR_POSTGRES_DIALECT);
try {
String chooseQuery = codeSet.chooseQuery(postgreSqlDialect);
assertEquals(SQL_CODE_FOR_POSTGRES_DIALECT, chooseQuery);
} catch (MondrianException mExc) {
fail("Not expected any MondrianException but it occured: " + mExc.getLocalizedMessage());
}
}
use of mondrian.spi.impl.PostgreSqlDialect in project mondrian by pentaho.
the class CodeSetTest method testMondrianExceptionThrown_WhenCodeSetContainsNOCodeForDialect.
/**
* If SqlQuery.CodeSet contains no sql code with specified dialect at all
* (even 'generic'), the MondrianException should be thrown.
*
* @throws Exception
*/
public void testMondrianExceptionThrown_WhenCodeSetContainsNOCodeForDialect() throws Exception {
PostgreSqlDialect postgreSqlDialect = new PostgreSqlDialect(mockConnection(POSTGRESQL_PRODUCT_NAME, POSTGRESQL_PRODUCT_VERSION));
codeSet = new SqlQuery.CodeSet();
try {
String chooseQuery = codeSet.chooseQuery(postgreSqlDialect);
fail("Expected MondrianException but not occured");
assertEquals(SQL_CODE_FOR_GENERIC_DIALECT, chooseQuery);
} catch (MondrianException mExc) {
assertEquals(MONDRIAN_ERROR_NO_GENERIC_VARIANT, mExc.getLocalizedMessage());
}
}
use of mondrian.spi.impl.PostgreSqlDialect in project mondrian by pentaho.
the class CodeSetTest method testSucces_CodeSetContainsCodeForBothPostgresAndGenericDialects.
/**
* ISSUE MONDRIAN-2335 If SqlQuery.CodeSet contains sql code
* for both dialect="postgres" and dialect="generic",
* the code for dialect="postgres"should be chosen. No error should be thrown
*
* @throws Exception
*/
public void testSucces_CodeSetContainsCodeForBothPostgresAndGenericDialects() throws Exception {
PostgreSqlDialect postgreSqlDialect = new PostgreSqlDialect(mockConnection(POSTGRESQL_PRODUCT_NAME, POSTGRESQL_PRODUCT_VERSION));
codeSet = new SqlQuery.CodeSet();
codeSet.put(POSTGRES_DIALECT, SQL_CODE_FOR_POSTGRES_DIALECT);
codeSet.put(GENERIC_DIALECT, SQL_CODE_FOR_GENERIC_DIALECT);
try {
String chooseQuery = codeSet.chooseQuery(postgreSqlDialect);
assertEquals(SQL_CODE_FOR_POSTGRES_DIALECT, chooseQuery);
} catch (MondrianException mExc) {
fail("Not expected any MondrianException but it occured: " + mExc.getLocalizedMessage());
}
}
use of mondrian.spi.impl.PostgreSqlDialect in project mondrian by pentaho.
the class CodeSetTest method testSucces_CodeSetContainsOnlyCodeForGenericlDialect.
/**
* If SqlQuery.CodeSet contains sql code for dialect="generic" ,
* the code for dialect="generic" should be chosen. No error should be thrown
*
* @throws Exception
*/
public void testSucces_CodeSetContainsOnlyCodeForGenericlDialect() throws Exception {
PostgreSqlDialect postgreSqlDialect = new PostgreSqlDialect(mockConnection(POSTGRESQL_PRODUCT_NAME, POSTGRESQL_PRODUCT_VERSION));
codeSet = new SqlQuery.CodeSet();
codeSet.put(GENERIC_DIALECT, SQL_CODE_FOR_GENERIC_DIALECT);
try {
String chooseQuery = codeSet.chooseQuery(postgreSqlDialect);
assertEquals(SQL_CODE_FOR_GENERIC_DIALECT, chooseQuery);
} catch (MondrianException mExc) {
fail("Not expected any MondrianException but it occured: " + mExc.getLocalizedMessage());
}
}
use of mondrian.spi.impl.PostgreSqlDialect in project mondrian by pentaho.
the class CodeSetTest method testSucces_CodeSetContainsCodeForBothPostgresAndPostgresqlDialects.
/**
* ISSUE MONDRIAN-2335 If SqlQuery.CodeSet contains sql code
* for both dialect="postgres" and dialect="postgresql",
* the code for dialect="postgres"should be chosen. No error should be thrown
*
* @throws Exception
*/
public void testSucces_CodeSetContainsCodeForBothPostgresAndPostgresqlDialects() throws Exception {
PostgreSqlDialect postgreSqlDialect = new PostgreSqlDialect(mockConnection(POSTGRESQL_PRODUCT_NAME, POSTGRESQL_PRODUCT_VERSION));
codeSet = new SqlQuery.CodeSet();
codeSet.put(POSTGRES_DIALECT, SQL_CODE_FOR_POSTGRES_DIALECT);
codeSet.put(POSTGRESQL_DIALECT, SQL_CODE_FOR_POSTGRESQL_DIALECT);
try {
String chooseQuery = codeSet.chooseQuery(postgreSqlDialect);
assertEquals(SQL_CODE_FOR_POSTGRES_DIALECT, chooseQuery);
} catch (MondrianException mExc) {
fail("Not expected any MondrianException but it occured: " + mExc.getLocalizedMessage());
}
}
Aggregations