Author: vhalbert(a)redhat.com
Date: 2009-11-16 15:59:28 -0500 (Mon, 16 Nov 2009)
New Revision: 1558
Modified:
trunk/test-integration/db/src/test/java/org/teiid/test/testcases/BaseAbstractTransactionTestCase.java
Log:
Teiid 773 - cleanup and refactoring so that the assumption is there will be 2 datasources
required in order to run the test.
Modified:
trunk/test-integration/db/src/test/java/org/teiid/test/testcases/BaseAbstractTransactionTestCase.java
===================================================================
---
trunk/test-integration/db/src/test/java/org/teiid/test/testcases/BaseAbstractTransactionTestCase.java 2009-11-16
20:59:07 UTC (rev 1557)
+++
trunk/test-integration/db/src/test/java/org/teiid/test/testcases/BaseAbstractTransactionTestCase.java 2009-11-16
20:59:28 UTC (rev 1558)
@@ -1,61 +1,58 @@
-/*
- * Copyright (c) 2000-2007 MetaMatrix, Inc.
- * All rights reserved.
- */
package org.teiid.test.testcases;
-
-
import junit.framework.TestCase;
import org.teiid.test.framework.ConfigPropertyLoader;
import org.teiid.test.framework.TransactionContainer;
-import org.teiid.test.framework.exception.QueryTestFailedException;
-import org.teiid.test.framework.transaction.TransactionFactory;
+import org.teiid.test.framework.datasource.DataSourceFactory;
+import org.teiid.test.framework.exception.TransactionRuntimeException;
-public class BaseAbstractTransactionTestCase extends TestCase {
+public abstract class BaseAbstractTransactionTestCase extends TestCase {
+
+ protected ConfigPropertyLoader config = null;
+ protected TransactionContainer container = null;
+ protected boolean setupData = true;
- protected ConfigPropertyLoader config = null;
-
public BaseAbstractTransactionTestCase(String name) {
- super(name);
+ super(name);
+
+
}
-
+
+ protected abstract TransactionContainer getTransactionContainter();
-
- @Override
- protected void setUp() throws Exception {
- // TODO Auto-generated method stub
- super.setUp();
-
- config = ConfigPropertyLoader.createInstance();
- }
-
-
protected ConfigPropertyLoader getConfig() {
- return this.config;
+ return this.config;
}
- protected void addProperty(String key, String value) {
- config.setProperty(key, value);
- }
-
- /**
- * Call to assign a specific database type to the model. When a datasource is
requested for this model,
- * a datasource of the specific dbtype will be returned. See {@link DataSourceFactory}
for the logic that
- * controls this behavior.
- * @param modelName
- * @param dbtype
- *
- * @since
- */
- protected void setAssignModelToDatabaseType(String modelName, String dbtype) {
- config.setModelAssignedToDatabaseType(modelName, dbtype);
+ protected void addProperty(String key, String value) {
+ if (config == null) {
+ try {
+ setUp();
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ throw new TransactionRuntimeException(e);
+ }
}
-
- protected TransactionContainer getTransactionContainter() throws
QueryTestFailedException {
- return TransactionFactory.create(config);
- }
+ config.setProperty(key, value);
+ }
+ /**
+ * Call to assign a specific database type to the model. When a datasource
+ * is requested for this model, a datasource of the specific dbtype will be
+ * returned. See {@link DataSourceFactory} for the logic that controls this
+ * behavior.
+ *
+ * @param modelName
+ * @param dbtype
+ *
+ * @since
+ */
+ protected void setAssignModelToDatabaseType(String modelName, String dbtype) {
+ config.setModelAssignedToDatabaseType(modelName, dbtype);
+ }
+
+
+
}
Show replies by date