[teiid-commits] teiid SVN: r2674 - in branches/7.1.x: engine/src/main/java/org/teiid/query/metadata and 2 other directories.

teiid-commits at lists.jboss.org teiid-commits at lists.jboss.org
Fri Oct 22 10:45:09 EDT 2010


Author: shawkins
Date: 2010-10-22 10:45:09 -0400 (Fri, 22 Oct 2010)
New Revision: 2674

Modified:
   branches/7.1.x/build/kits/jboss-container/teiid-releasenotes.html
   branches/7.1.x/engine/src/main/java/org/teiid/query/metadata/TransformationMetadata.java
   branches/7.1.x/engine/src/main/resources/org/teiid/query/i18n.properties
   branches/7.1.x/engine/src/test/java/org/teiid/query/metadata/TestTransformationMetadata.java
Log:
TEIID-1315 fix for parent relative paths for getting schemas.  also minor corrections to release notes and an i18n message

Modified: branches/7.1.x/build/kits/jboss-container/teiid-releasenotes.html
===================================================================
--- branches/7.1.x/build/kits/jboss-container/teiid-releasenotes.html	2010-10-21 21:05:20 UTC (rev 2673)
+++ branches/7.1.x/build/kits/jboss-container/teiid-releasenotes.html	2010-10-22 14:45:09 UTC (rev 2674)
@@ -53,7 +53,7 @@
   <li>Model visibility no longer restricts access to tables and procedures.  Setting visible to false will only hide entries from system tables.  Data roles should be used to restrict data access.
   <li>Admin API "getWorkManagerStats" methods renamed to "getWorkerPoolStats". Also, "setRuntimeProperty" and "getProcesses" methods were removed.
   <li>By default the "ENV" system function is now turned off. To enable it, edit the teiid-jboss-beans.xml configuration file.
-  <li>The use of VARIABLES.ROWCOUNT is now reserved. Use a different 
+  <li>The use of VARIABLES.ROWCOUNT is now reserved. 
   <li>Direct assignments in virtual procedures using stored procedures (e.g. var = EXEC foo()) are only valid if the procedure has a return parameter and no result set.  
 </ul>
 <h4>from 7.0</h4>

Modified: branches/7.1.x/engine/src/main/java/org/teiid/query/metadata/TransformationMetadata.java
===================================================================
--- branches/7.1.x/engine/src/main/java/org/teiid/query/metadata/TransformationMetadata.java	2010-10-21 21:05:20 UTC (rev 2673)
+++ branches/7.1.x/engine/src/main/java/org/teiid/query/metadata/TransformationMetadata.java	2010-10-22 14:45:09 UTC (rev 2674)
@@ -783,10 +783,22 @@
         	path = path.replace(File.separatorChar, '/');
         }
         for (String string : schemaPaths) {
-        	SQLXMLImpl schema = getVDBResourceAsSQLXML(string);
-        	
+        	String parentPath = path;
+        	boolean relative = false;
+        	while (string.startsWith("../")) { //$NON-NLS-1$
+        		relative = true;
+        		string = string.substring(3);
+        		parentPath = new File(parentPath).getParent();
+        	}
+        	SQLXMLImpl schema = null;
+        	if (!relative) {
+        		schema = getVDBResourceAsSQLXML(string);
+        	}
         	if (schema == null) {
-        		schema = getVDBResourceAsSQLXML(path + '/' + string);
+        		if (!parentPath.endsWith("/")) { //$NON-NLS-1$
+        			parentPath += "/"; //$NON-NLS-1$
+        		}
+        		schema = getVDBResourceAsSQLXML(parentPath + string);
         	}
         	
         	if (schema == null) {

Modified: branches/7.1.x/engine/src/main/resources/org/teiid/query/i18n.properties
===================================================================
--- branches/7.1.x/engine/src/main/resources/org/teiid/query/i18n.properties	2010-10-21 21:05:20 UTC (rev 2673)
+++ branches/7.1.x/engine/src/main/resources/org/teiid/query/i18n.properties	2010-10-22 14:45:09 UTC (rev 2674)
@@ -871,4 +871,4 @@
 RequestWorkItem.cache_nondeterministic=Caching command '{0}'' at a session level, but less deterministic functions were evaluated. 
 not_found_cache=Results not found in cache
 failed_to_unwrap_connection=Failed to unwrap the source connection.
-connection_factory_not_found=Failed to the Connection Factory with JNDI name {0}. Please check the name for spelling or deploy the Connection Factory with specified name. 
\ No newline at end of file
+connection_factory_not_found=Failed to find the Connection Factory with JNDI name {0}. Please check the name or deploy the Connection Factory with specified name. 
\ No newline at end of file

Modified: branches/7.1.x/engine/src/test/java/org/teiid/query/metadata/TestTransformationMetadata.java
===================================================================
--- branches/7.1.x/engine/src/test/java/org/teiid/query/metadata/TestTransformationMetadata.java	2010-10-21 21:05:20 UTC (rev 2673)
+++ branches/7.1.x/engine/src/test/java/org/teiid/query/metadata/TestTransformationMetadata.java	2010-10-22 14:45:09 UTC (rev 2674)
@@ -31,7 +31,9 @@
 import java.util.Map;
 import java.util.Properties;
 
+import org.jboss.virtual.VirtualFile;
 import org.junit.Test;
+import org.mockito.Mockito;
 import org.teiid.adminapi.Model;
 import org.teiid.adminapi.impl.ModelMetaData;
 import org.teiid.adminapi.impl.VDBMetaData;
@@ -42,6 +44,7 @@
 import org.teiid.metadata.Table;
 import org.teiid.query.metadata.CompositeMetadataStore;
 import org.teiid.query.metadata.TransformationMetadata;
+import org.teiid.query.metadata.TransformationMetadata.Resource;
 import org.teiid.query.unittest.FakeMetadataFactory;
 import org.teiid.translator.TranslatorException;
 
@@ -71,6 +74,14 @@
 		
 		MetadataFactory mf1 = new MetadataFactory("x1", datatypes, new Properties()); //$NON-NLS-1$
 		mf1.addProcedure("y"); //$NON-NLS-1$
+		
+		Table table = mf1.addTable("doc");
+		table.setSchemaPaths(Arrays.asList("../../x.xsd"));
+		table.setResourcePath("/a/b/doc.xmi");
+		
+		HashMap<String, Resource> resources = new HashMap<String, Resource>();
+		resources.put("/x.xsd", new Resource(Mockito.mock(VirtualFile.class), true));
+		
 		CompositeMetadataStore cms = new CompositeMetadataStore(Arrays.asList(mf.getMetadataStore(), mf1.getMetadataStore()));
 		
 		VDBMetaData vdb = new VDBMetaData();
@@ -79,8 +90,9 @@
 		
 		vdb.addModel(buildModel("x"));
 		vdb.addModel(buildModel("x1"));
+		vdb.addModel(buildModel("y"));
 		
-		return new TransformationMetadata(vdb, cms, null, null, FakeMetadataFactory.SFM.getSystemFunctions());
+		return new TransformationMetadata(vdb, cms, resources, null, FakeMetadataFactory.SFM.getSystemFunctions());
 	}
 	
 	ModelMetaData buildModel(String name) {
@@ -131,4 +143,9 @@
 		tm.getElementID("x.FoO.coL");
 	}
 	
+	@Test public void testRelativeSchemas() throws Exception {
+		TransformationMetadata tm = exampleTransformationMetadata();
+		assertEquals(1, tm.getXMLSchemas(tm.getGroupID("x1.doc")).size());
+	}
+	
 }



More information about the teiid-commits mailing list