ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From veit...@apache.org
Subject svn commit: r1103296 - in /webservices/commons/branches/modules/XmlSchema/1_4_X_BRANCH: ./ src/main/java/ src/main/java/org/apache/ws/commons/schema/resolver/ src/test/assembly/ src/test/java/ src/test/java/tests/
Date Sun, 15 May 2011 08:39:36 GMT
Author: veithen
Date: Sun May 15 08:39:36 2011
New Revision: 1103296

URL: http://svn.apache.org/viewvc?rev=1103296&view=rev
Log:
XMLSCHEMA-3: Merged r1103295 to the 1.4 branch (with changes).

Added:
    webservices/commons/branches/modules/XmlSchema/1_4_X_BRANCH/src/test/assembly/
      - copied from r1103295, webservices/xmlschema/trunk/xmlschema-core/src/test/assembly/
    webservices/commons/branches/modules/XmlSchema/1_4_X_BRANCH/src/test/assembly/test-zip.xml
      - copied, changed from r1103295, webservices/xmlschema/trunk/xmlschema-core/src/test/assembly/test-zip.xml
Modified:
    webservices/commons/branches/modules/XmlSchema/1_4_X_BRANCH/   (props changed)
    webservices/commons/branches/modules/XmlSchema/1_4_X_BRANCH/pom.xml
    webservices/commons/branches/modules/XmlSchema/1_4_X_BRANCH/src/main/java/   (props changed)
    webservices/commons/branches/modules/XmlSchema/1_4_X_BRANCH/src/main/java/org/apache/ws/commons/schema/resolver/DefaultURIResolver.java
    webservices/commons/branches/modules/XmlSchema/1_4_X_BRANCH/src/test/java/   (props changed)
    webservices/commons/branches/modules/XmlSchema/1_4_X_BRANCH/src/test/java/tests/ImportTest.java

Propchange: webservices/commons/branches/modules/XmlSchema/1_4_X_BRANCH/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sun May 15 08:39:36 2011
@@ -1,2 +1,3 @@
 /webservices/commons/branches/modules/XmlSchema/1.4.6-site-fix:992771-992797
 /webservices/commons/tags/XmlSchema/XmlSchema-1.4.6:938042-992770
+/webservices/xmlschema/trunk/xmlschema-core:1103295

Modified: webservices/commons/branches/modules/XmlSchema/1_4_X_BRANCH/pom.xml
URL: http://svn.apache.org/viewvc/webservices/commons/branches/modules/XmlSchema/1_4_X_BRANCH/pom.xml?rev=1103296&r1=1103295&r2=1103296&view=diff
==============================================================================
--- webservices/commons/branches/modules/XmlSchema/1_4_X_BRANCH/pom.xml (original)
+++ webservices/commons/branches/modules/XmlSchema/1_4_X_BRANCH/pom.xml Sun May 15 08:39:36
2011
@@ -119,6 +119,25 @@
         </executions>
       </plugin>
       <plugin>
+        <artifactId>maven-assembly-plugin</artifactId>
+        <executions>
+            <execution>
+                <id>generate-test-zip</id>
+                <phase>generate-test-resources</phase>
+                <goals>
+                    <goal>single</goal>
+                </goals>
+                <configuration>
+                    <descriptors>
+                        <descriptor>src/test/assembly/test-zip.xml</descriptor>
+                    </descriptors>
+                    <finalName>test-zip</finalName>
+                    <appendAssemblyId>false</appendAssemblyId>
+                </configuration>
+            </execution>
+        </executions>
+      </plugin>
+      <plugin>
           <groupId>org.apache.felix</groupId>
           <artifactId>maven-bundle-plugin</artifactId>
           <version>2.0.0</version>

Propchange: webservices/commons/branches/modules/XmlSchema/1_4_X_BRANCH/src/main/java/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sun May 15 08:39:36 2011
@@ -1,3 +1,3 @@
 /webservices/commons/branches/modules/XmlSchema/1.4.6-site-fix/src/main/java:992771-992797
 /webservices/commons/tags/XmlSchema/XmlSchema-1.4.6/src/main/java:938042-992770
-/webservices/xmlschema/trunk/xmlschema-core/src/main/java:1062248
+/webservices/xmlschema/trunk/xmlschema-core/src/main/java:1062248,1103295

Modified: webservices/commons/branches/modules/XmlSchema/1_4_X_BRANCH/src/main/java/org/apache/ws/commons/schema/resolver/DefaultURIResolver.java
URL: http://svn.apache.org/viewvc/webservices/commons/branches/modules/XmlSchema/1_4_X_BRANCH/src/main/java/org/apache/ws/commons/schema/resolver/DefaultURIResolver.java?rev=1103296&r1=1103295&r2=1103296&view=diff
==============================================================================
--- webservices/commons/branches/modules/XmlSchema/1_4_X_BRANCH/src/main/java/org/apache/ws/commons/schema/resolver/DefaultURIResolver.java
(original)
+++ webservices/commons/branches/modules/XmlSchema/1_4_X_BRANCH/src/main/java/org/apache/ws/commons/schema/resolver/DefaultURIResolver.java
Sun May 15 08:39:36 2011
@@ -21,8 +21,6 @@ package org.apache.ws.commons.schema.res
 import java.io.File;
 import java.io.IOException;
 import java.net.MalformedURLException;
-import java.net.URI;
-import java.net.URISyntaxException;
 import java.net.URL;
 
 import org.xml.sax.InputSource;
@@ -65,12 +63,10 @@ public class DefaultURIResolver implemen
                 // if the schema location contain spaces URI parser gives errors
                 schemaLocation = schemaLocation.replace(" ","%20");
                 
-                String ref = new URI(baseUri).resolve(new URI(schemaLocation)).toString();
+                String ref = new URL(new URL(baseUri), schemaLocation).toString();
 
                 return new InputSource(ref);
-            }
-            catch (URISyntaxException e1)
-            {
+            } catch (MalformedURLException e1) {
                 throw new RuntimeException(e1);
             }
 

Copied: webservices/commons/branches/modules/XmlSchema/1_4_X_BRANCH/src/test/assembly/test-zip.xml
(from r1103295, webservices/xmlschema/trunk/xmlschema-core/src/test/assembly/test-zip.xml)
URL: http://svn.apache.org/viewvc/webservices/commons/branches/modules/XmlSchema/1_4_X_BRANCH/src/test/assembly/test-zip.xml?p2=webservices/commons/branches/modules/XmlSchema/1_4_X_BRANCH/src/test/assembly/test-zip.xml&p1=webservices/xmlschema/trunk/xmlschema-core/src/test/assembly/test-zip.xml&r1=1103295&r2=1103296&rev=1103296&view=diff
==============================================================================
--- webservices/xmlschema/trunk/xmlschema-core/src/test/assembly/test-zip.xml (original)
+++ webservices/commons/branches/modules/XmlSchema/1_4_X_BRANCH/src/test/assembly/test-zip.xml
Sun May 15 08:39:36 2011
@@ -25,7 +25,7 @@
     <includeBaseDirectory>false</includeBaseDirectory>
     <fileSets>
         <fileSet>
-            <directory>src/test/resources</directory>
+            <directory>src/test/test-resources</directory>
             <outputDirectory>test-dir</outputDirectory>
             <includes>
                 <include>import*.xsd</include>

Propchange: webservices/commons/branches/modules/XmlSchema/1_4_X_BRANCH/src/test/java/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sun May 15 08:39:36 2011
@@ -1,3 +1,3 @@
 /webservices/commons/branches/modules/XmlSchema/1.4.6-site-fix/src/test/java:992771-992797
 /webservices/commons/tags/XmlSchema/XmlSchema-1.4.6/src/test/java:938042-992770
-/webservices/xmlschema/trunk/xmlschema-core/src/test/java:1062248
+/webservices/xmlschema/trunk/xmlschema-core/src/test/java:1062248,1103295

Modified: webservices/commons/branches/modules/XmlSchema/1_4_X_BRANCH/src/test/java/tests/ImportTest.java
URL: http://svn.apache.org/viewvc/webservices/commons/branches/modules/XmlSchema/1_4_X_BRANCH/src/test/java/tests/ImportTest.java?rev=1103296&r1=1103295&r2=1103296&view=diff
==============================================================================
--- webservices/commons/branches/modules/XmlSchema/1_4_X_BRANCH/src/test/java/tests/ImportTest.java
(original)
+++ webservices/commons/branches/modules/XmlSchema/1_4_X_BRANCH/src/test/java/tests/ImportTest.java
Sun May 15 08:39:36 2011
@@ -30,6 +30,7 @@ import org.xml.sax.InputSource;
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.namespace.QName;
 import java.io.File;
+import java.net.URL;
 
 public class ImportTest extends TestCase {
 
@@ -106,4 +107,22 @@ public class ImportTest extends TestCase
         XmlSchema schema2 = schemaImport.getSchema();
         assertNotNull(schema2);
     }
+    
+    /**
+     * Tests that imports are properly resolved when loading a schema from a JAR (as will
generally
+     * be the case when loading a schema from the classpath).
+     * 
+     * @throws Exception
+     */
+    public void testImportWithJARURL() throws Exception {
+        String basedir = System.getProperty("basedir");
+        if (basedir == null) {
+            basedir = ".";
+        }
+        URL jarUrl = new File(basedir, "target/test-zip.zip").toURL();
+        URL schemaUrl = new URL("jar:" + jarUrl + "!/test-dir/importBase.xsd");
+        XmlSchemaCollection schemaCol = new XmlSchemaCollection();
+        XmlSchema schema = schemaCol.read(new InputSource(schemaUrl.toExternalForm()), null);
+        assertNotNull(schema);
+    }
 }



Mime
View raw message