[teiid-commits] teiid SVN: r3261 - in branches/7.4.x: test-integration/common/src/test/java/org/teiid/jdbc and 1 other directory.

teiid-commits at lists.jboss.org teiid-commits at lists.jboss.org
Thu Jun 23 11:19:08 EDT 2011


Author: shawkins
Date: 2011-06-23 11:19:05 -0400 (Thu, 23 Jun 2011)
New Revision: 3261

Modified:
   branches/7.4.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/JDBCMetdataProcessor.java
   branches/7.4.x/test-integration/common/src/test/java/org/teiid/jdbc/TestDymamicImportedMetaData.java
Log:
TEIID-1650 adding the importer property importer.useCatalogName

Modified: branches/7.4.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/JDBCMetdataProcessor.java
===================================================================
--- branches/7.4.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/JDBCMetdataProcessor.java	2011-06-23 12:07:40 UTC (rev 3260)
+++ branches/7.4.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/JDBCMetdataProcessor.java	2011-06-23 15:19:05 UTC (rev 3261)
@@ -85,6 +85,7 @@
 	private boolean widenUnsingedTypes = true;
 	private boolean quoteNameInSource = true;
 	private boolean useProcedureSpecificName;
+	private boolean useCatalogName = true;
 	
 	private Set<String> unsignedTypes = new HashSet<String>();
 	private String quoteString;
@@ -422,14 +423,12 @@
 		if (schemaName != null && schemaName.length() > 0) {
 			fullName = (quoted?quoteName(schemaName):schemaName) + AbstractMetadataRecord.NAME_DELIM_CHAR + fullName;
 		}
-		if (catalogName != null && catalogName.length() > 0) {
+		if (useCatalogName && catalogName != null && catalogName.length() > 0) {
 			fullName = (quoted?quoteName(catalogName):catalogName) + AbstractMetadataRecord.NAME_DELIM_CHAR + fullName;
 		}
 		return fullName;
 	}
-		
 
-
 	public void setTableNamePattern(String tableNamePattern) {
 		this.tableNamePattern = tableNamePattern;
 	}
@@ -483,4 +482,8 @@
 		this.useProcedureSpecificName = useProcedureSpecificName;
 	}
 	
+	public void setUseCatalogName(boolean useCatalog) {
+		this.useCatalogName = useCatalog;
+	}
+	
 }

Modified: branches/7.4.x/test-integration/common/src/test/java/org/teiid/jdbc/TestDymamicImportedMetaData.java
===================================================================
--- branches/7.4.x/test-integration/common/src/test/java/org/teiid/jdbc/TestDymamicImportedMetaData.java	2011-06-23 12:07:40 UTC (rev 3260)
+++ branches/7.4.x/test-integration/common/src/test/java/org/teiid/jdbc/TestDymamicImportedMetaData.java	2011-06-23 15:19:05 UTC (rev 3261)
@@ -74,7 +74,7 @@
     	assertEquals(1, p.getResultSet().getColumns().size());
     }
     
-    @Test public void testDuplicatException() throws Exception {
+    @Test public void testDuplicateException() throws Exception {
     	FakeServer server = new FakeServer();
     	MetadataFactory mf = createMetadataFactory("x", new Properties());
     	MetadataFactory mf1 = createMetadataFactory("y", new Properties());
@@ -93,8 +93,9 @@
     	
     	Properties importProperties = new Properties();
     	
-    	getMetadata(importProperties, conn);
-    	assertNotNull(mf.getMetadataStore().getSchemas().get("X").getTables().get("DUP"));
+    	mf = getMetadata(importProperties, conn);
+    	Table t = mf.getMetadataStore().getSchemas().get("TEST").getTables().get("TEST.X.DUP");
+    	assertEquals("\"test\".\"x\".\"dup\"", t.getNameInSource());
 
     	importProperties.setProperty("importer.useFullSchemaName", Boolean.FALSE.toString());
     	try {
@@ -104,5 +105,25 @@
     		
     	}
     }
+    
+    @Test public void testUseCatalog() throws Exception {
+    	FakeServer server = new FakeServer();
+    	MetadataFactory mf = createMetadataFactory("x", new Properties());
+    	
+    	Table dup = mf.addTable("dup");
+    	
+    	mf.addColumn("x", DataTypeManager.DefaultDataTypes.STRING, dup);
+    	
+    	MetadataStore ms = mf.getMetadataStore();
+    	
+    	server.deployVDB("test", ms, new LinkedHashMap<String, Resource>());
+    	Connection conn = server.createConnection("jdbc:teiid:test"); //$NON-NLS-1$
+    	
+    	Properties importProperties = new Properties();
+    	importProperties.setProperty("importer.useCatalogName", Boolean.FALSE.toString());
+    	mf = getMetadata(importProperties, conn);
+    	Table t = mf.getMetadataStore().getSchemas().get("TEST").getTables().get("X.DUP");
+    	assertEquals("\"x\".\"dup\"", t.getNameInSource());
+    }
 
 }



More information about the teiid-commits mailing list