Search in sources :

Example 26 with TransactionRuntimeException

use of org.teiid.test.framework.exception.TransactionRuntimeException in project teiid by teiid.

the class TestClient method runScenario.

private void runScenario() throws Exception {
    String scenario_file = ConfigPropertyLoader.getInstance().getProperty(TestProperties.PROP_SCENARIO_FILE);
    if (scenario_file == null) {
        throw new TransactionRuntimeException(TestProperties.PROP_SCENARIO_FILE + " property was not defined");
    }
    String scenario_name = FileUtils.getBaseFileNameWithoutExtension(scenario_file);
    TestLogger.log("Starting scenario " + scenario_name);
    Properties sc_props = PropertiesUtils.load(scenario_file);
    // 1st perform substitution on the scenario file based on the config and system properties file
    // because the next substitution is based on the scenario file
    Properties sc_updates = getSubstitutedProperties(sc_props);
    if (!sc_updates.isEmpty()) {
        sc_props.putAll(sc_updates);
        this.overrides.putAll(sc_props);
    }
    ConfigPropertyLoader.getInstance().setProperties(sc_props);
    // 2nd perform substitution on current configuration - which will be based on the config properties file
    Properties config_updates = getSubstitutedProperties(ConfigPropertyLoader.getInstance().getProperties());
    if (!config_updates.isEmpty()) {
        this.overrides.putAll(config_updates);
        ConfigPropertyLoader.getInstance().setProperties(config_updates);
    }
    // update the URL with the vdb that is to be used
    String url = ConfigPropertyLoader.getInstance().getProperty(DriverConnection.DS_URL);
    String vdb_name = ConfigPropertyLoader.getInstance().getProperty(DataSourceConnection.DS_DATABASENAME);
    Assert.assertNotNull(DataSourceConnection.DS_DATABASENAME + " property not set, need it for the vdb name", vdb_name);
    url = StringUtil.replace(url, "${vdb}", vdb_name);
    ConfigPropertyLoader.getInstance().setProperty(DriverConnection.DS_URL, url);
    QueryScenario set = ClassFactory.createQueryScenario(scenario_name);
    TransactionContainer tc = getTransactionContainter();
    runTestCase(set, tc);
    TestLogger.log("Completed scenario " + scenario_name);
}
Also used : TransactionContainer(org.teiid.test.framework.TransactionContainer) TransactionRuntimeException(org.teiid.test.framework.exception.TransactionRuntimeException) Properties(java.util.Properties)

Aggregations

TransactionRuntimeException (org.teiid.test.framework.exception.TransactionRuntimeException)26 QueryTestFailedException (org.teiid.test.framework.exception.QueryTestFailedException)5 XAResource (javax.transaction.xa.XAResource)4 File (java.io.File)3 Properties (java.util.Properties)3 ConfigPropertyLoader (org.teiid.test.framework.ConfigPropertyLoader)3 IOException (java.io.IOException)2 ArrayList (java.util.ArrayList)2 XAConnection (javax.sql.XAConnection)2 TransactionContainer (org.teiid.test.framework.TransactionContainer)2 DataSource (org.teiid.test.framework.datasource.DataSource)2 InputStream (java.io.InputStream)1 Connection (java.sql.Connection)1 SQLException (java.sql.SQLException)1 Collection (java.util.Collection)1 InitialContext (javax.naming.InitialContext)1 Element (org.jdom.Element)1 JDOMException (org.jdom.JDOMException)1 JNDITransaction (org.teiid.test.framework.transaction.JNDITransaction)1 LocalTransaction (org.teiid.test.framework.transaction.LocalTransaction)1