[teiid-commits] teiid SVN: r1458 - in trunk/test-integration/db/src/main/java/org/teiid/test/framework: connection and 1 other directories.

teiid-commits at lists.jboss.org teiid-commits at lists.jboss.org
Tue Sep 22 16:00:10 EDT 2009


Author: vhalbert at redhat.com
Date: 2009-09-22 16:00:09 -0400 (Tue, 22 Sep 2009)
New Revision: 1458

Modified:
   trunk/test-integration/db/src/main/java/org/teiid/test/framework/ConfigPropertyLoader.java
   trunk/test-integration/db/src/main/java/org/teiid/test/framework/connection/ConnectionStrategyFactory.java
   trunk/test-integration/db/src/main/java/org/teiid/test/framework/datasource/DataSourceMgr.java
Log:
Teiid 773 - setting up the xa transaction tests

Modified: trunk/test-integration/db/src/main/java/org/teiid/test/framework/ConfigPropertyLoader.java
===================================================================
--- trunk/test-integration/db/src/main/java/org/teiid/test/framework/ConfigPropertyLoader.java	2009-09-22 19:59:09 UTC (rev 1457)
+++ trunk/test-integration/db/src/main/java/org/teiid/test/framework/ConfigPropertyLoader.java	2009-09-22 20:00:09 UTC (rev 1458)
@@ -49,6 +49,13 @@
 		    }
 		}
 		
+		public static void cleanup() {
+            Properties p = System.getProperties();
+            p.remove(ConfigPropertyNames.CONFIG_FILE);
+            p.remove(ConfigPropertyNames.EXCLUDE_DATASBASE_TYPES_PROP);
+			
+		}
+		
 		public static void main(String[] args) {
 			System.setProperty("test", "value");
 			

Modified: trunk/test-integration/db/src/main/java/org/teiid/test/framework/connection/ConnectionStrategyFactory.java
===================================================================
--- trunk/test-integration/db/src/main/java/org/teiid/test/framework/connection/ConnectionStrategyFactory.java	2009-09-22 19:59:09 UTC (rev 1457)
+++ trunk/test-integration/db/src/main/java/org/teiid/test/framework/connection/ConnectionStrategyFactory.java	2009-09-22 20:00:09 UTC (rev 1458)
@@ -47,9 +47,7 @@
 	    }    
 	    
 	    private void shutdown() {
-            Properties p = System.getProperties();
-            p.remove(ConfigPropertyNames.CONFIG_FILE);
-
+	    	ConfigPropertyLoader.cleanup();
             
             if (driversources != null) {
             	shutDownSources(driversources);

Modified: trunk/test-integration/db/src/main/java/org/teiid/test/framework/datasource/DataSourceMgr.java
===================================================================
--- trunk/test-integration/db/src/main/java/org/teiid/test/framework/datasource/DataSourceMgr.java	2009-09-22 19:59:09 UTC (rev 1457)
+++ trunk/test-integration/db/src/main/java/org/teiid/test/framework/datasource/DataSourceMgr.java	2009-09-22 20:00:09 UTC (rev 1458)
@@ -6,6 +6,7 @@
 
 import java.io.IOException;
 import java.io.InputStream;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
@@ -55,7 +56,6 @@
 	private Set<String> assignedDataSources = new HashSet<String>();
 	
 	private int lastassigned = 0;
-	private Set<String> excludedDBTypes = null;
 
 
 	private DataSourceMgr() {
@@ -78,15 +78,20 @@
 		return _instance;
 	}
 	
+	/**
+	 * reset is called when a predetermined set of datasources are going to be set
+	 * This is to ensure any exclusions / inclusions are considered for the 
+	 * next executed set of test.
+	 * 
+	 *
+	 * @since
+	 */
 	public static synchronized void reset() {
-		
-		_instance.dstypeMap.clear();
-		_instance.allDatasourcesMap.clear();
+
+		//
 		_instance.modelToDatasourceMap.clear();
 		_instance.assignedDataSources.clear();
 		
-		_instance = null;
-		
 	}
 	
 	public int numberOfAvailDataSources() {
@@ -95,18 +100,9 @@
 	
 	public boolean hasAvailableDataSource(int numRequiredDataSources) {
 		// reset the mapping at the start of each test
-		_instance.modelToDatasourceMap.clear();
-		excludedDBTypes = new HashSet<String>(3);
+		_instance.modelToDatasourceMap.clear();		
 		
-		
-		String excludeprop = ConfigPropertyLoader.getProperty(ConfigPropertyNames.EXCLUDE_DATASBASE_TYPES_PROP);
-		
-		if (excludeprop == null || excludeprop.length() == 0) {
-			return (numRequiredDataSources <= numberOfAvailDataSources());
-		}
-		
-		List<String> eprops = StringUtil.split(excludeprop, ",");
-		excludedDBTypes.addAll(eprops);
+		Set excludedDBTypes = getExcludedDBTypes();
 		        
     	int cntexcluded = 0;
 		Iterator<DataSource> it= allDatasourcesMap.values().iterator();
@@ -121,7 +117,22 @@
 		
 	}
 	
+	private Set getExcludedDBTypes() {
+
+		String excludeprop = ConfigPropertyLoader.getProperty(ConfigPropertyNames.EXCLUDE_DATASBASE_TYPES_PROP);
+		
+		if (excludeprop == null || excludeprop.length() == 0) {
+			return  Collections.EMPTY_SET;
+		}
+		Set<String> excludedDBTypes = new HashSet<String>(3);
+
+		List<String> eprops = StringUtil.split(excludeprop, ",");
+		excludedDBTypes.addAll(eprops);
+		return excludedDBTypes;
 	
+	}
+	
+	
 	public DataSource getDatasource(String datasourceid, String modelName)
 			throws QueryTestFailedException {
 		DataSource ds = null;
@@ -141,7 +152,8 @@
 			return modelToDatasourceMap.get(key);
 		} 
 
-		
+		Set excludedDBTypes = getExcludedDBTypes();
+
 		if (dstypeMap.containsKey(datasourceid)) {
 
 			Map datasources = dstypeMap.get(datasourceid);



More information about the teiid-commits mailing list