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);
}
Aggregations