// Load mock object factory with mock datasource service that produces null datasources
StandaloneSpringPentahoObjectFactory factory = new StandaloneSpringPentahoObjectFactory();
factory.init( "test-res/solution/system/pentahoObjects.datasourceservice.null.spring.xml", null );
PentahoSystem.registerObjectFactory( factory );
AuditConnection auditConnection = new AuditConnection();
auditConnection.setUseNewDatasourceService( true ); // make sure we get a datasource from the object factory
auditConnection.initialize();
MockDataSourceService.setThrowExceptionOnGetConnection(true);
auditConnection.getAuditConnection();
fail( "Expected exception when no audit connection could be established" );
} catch ( SQLException ex ) {
ex.printStackTrace();
assertTrue( "Expected AUDSQLENT.ERROR_0001", ex.getMessage().contains( "AUDSQLENT.ERROR_0001" ) );
} finally {