use of org.teiid.test.framework.TransactionContainer in project teiid by teiid.
the class TransactionFactory method create.
public static TransactionContainer create(ConfigPropertyLoader config) throws QueryTestFailedException {
TransactionContainer transacton = null;
String type = config.getProperty(TRANSACTION_TYPE);
if (type == null) {
throw new TransactionRuntimeException(TRANSACTION_TYPE + " property was not specified");
}
TestLogger.logDebug("==== Create Transaction-Option: " + type);
if (type.equalsIgnoreCase(TRANSACTION_TYPES.LOCAL_TRANSACTION)) {
transacton = new LocalTransaction();
} else if (type.equalsIgnoreCase(TRANSACTION_TYPES.XATRANSACTION)) {
transacton = new XATransaction();
} else if (type.equalsIgnoreCase(TRANSACTION_TYPES.JNDI_TRANSACTION)) {
transacton = new JNDITransaction();
} else if (type.equalsIgnoreCase(TRANSACTION_TYPES.OFFWRAP_TRANSACTION)) {
transacton = new TxnAutoTransaction(TXN_AUTO_WRAP_OPTIONS.AUTO_WRAP_OFF);
} else if (type.equalsIgnoreCase(TRANSACTION_TYPES.ONWRAP_TRANSACTION)) {
transacton = new TxnAutoTransaction(TXN_AUTO_WRAP_OPTIONS.AUTO_WRAP_ON);
} else if (type.equalsIgnoreCase(TRANSACTION_TYPES.AUTOWRAP_TRANSACTION)) {
transacton = new TxnAutoTransaction(TXN_AUTO_WRAP_OPTIONS.AUTO_WRAP_AUTO);
} else {
throw new TransactionRuntimeException("Invalid property value of " + type + " for " + TRANSACTION_TYPE);
}
TestLogger.log("==== TransactionContainer: " + transacton.getClass().getName() + " option:" + type);
return transacton;
}
use of org.teiid.test.framework.TransactionContainer 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