use of mondrian.olap.MondrianException 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.olap.MondrianException 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.olap.MondrianException 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.olap.MondrianException 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.olap.MondrianException in project mondrian by pentaho.
the class SchemaVersionTest method testSchema4withVersion.
public void testSchema4withVersion() {
TestContext testContext = TestContext.instance().withSchema(SCHEMA_4_HEADER + SCHEMA_4_BODY);
Util.PropertyList connectInfo = testContext.getConnectionProperties();
try {
Connection conn = DriverManager.getConnection(connectInfo, null);
conn.close();
Assert.fail("No exception thrown for version 4 schema.");
} catch (MondrianException e) {
assertTrue(e.getMessage().contains("Schema version"));
}
}
Aggregations