cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From asold...@apache.org
Subject [1/3] cxf git commit: [CXF-6621] integration of changes from cxf-2.7.x-fixes
Date Mon, 26 Oct 2015 17:25:19 GMT
Repository: cxf
Updated Branches:
  refs/heads/3.0.x-fixes ecb9139d1 -> 58ceaafe4


[CXF-6621] integration of changes from cxf-2.7.x-fixes


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/47fe9b86
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/47fe9b86
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/47fe9b86

Branch: refs/heads/3.0.x-fixes
Commit: 47fe9b86df8644447010af31023e7d528cf8859a
Parents: edcfc3b
Author: rsearls <rsearls@redhat.com>
Authored: Mon Oct 26 09:33:47 2015 -0400
Committer: Alessio Soldano <asoldano@redhat.com>
Committed: Mon Oct 26 18:21:10 2015 +0100

----------------------------------------------------------------------
 .../apache/cxf/common/util/URIParserUtil.java   |  18 +-
 .../org/apache/cxf/frontend/WSDLGetUtils.java   | 217 +++++++------------
 .../cxf/systest/jaxws/OASISCatalogTest.java     | 131 +++++++----
 .../systest/schemaimport/SchemaImportTest.java  |   4 +-
 .../main/resources/META-INF/jax-ws-catalog.xml  |   3 +
 .../others/hello_world_messages_catalog.wsdl    |  25 ++-
 .../others/hello_world_wsdl_import_catalog.wsdl |   2 +
 .../resources/wsdl/schemas/another-schema.xsd   |  29 +++
 .../wsdl/schemas/d/another-included.xsd         |  29 +++
 .../wsdl/schemas/d/d/another-included.xsd       |  27 +++
 .../resources/wsdl/schemas/d/d/included.xsd     |  27 +++
 .../main/resources/wsdl/schemas/d/included.xsd  |  29 +++
 .../src/main/resources/wsdl/schemas/schema.xsd  |  29 +++
 .../cxf/tools/util/URIParserUtilTest.java       |  25 +++
 14 files changed, 404 insertions(+), 191 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/47fe9b86/core/src/main/java/org/apache/cxf/common/util/URIParserUtil.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/cxf/common/util/URIParserUtil.java b/core/src/main/java/org/apache/cxf/common/util/URIParserUtil.java
index 98afa1f..158765c 100644
--- a/core/src/main/java/org/apache/cxf/common/util/URIParserUtil.java
+++ b/core/src/main/java/org/apache/cxf/common/util/URIParserUtil.java
@@ -26,13 +26,23 @@ import java.net.URI;
 import java.net.URISyntaxException;
 import java.net.URL;
 import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
 import java.util.List;
+import java.util.Set;
 import java.util.StringTokenizer;
 
 import org.apache.cxf.common.classloader.ClassLoaderUtils;
-import org.apache.cxf.helpers.JavaUtils;
 
 public final class URIParserUtil {
+    private static final Set<String> KEYWORDS = new HashSet<String>(Arrays
+        .asList(new String[] {"abstract", "boolean", "break", "byte", "case", "catch", "char", "class",
+                              "const", "continue", "default", "do", "double", "else", "extends", "final",
+                              "finally", "float", "for", "goto", "if", "implements", "import", "instanceof",
+                              "int", "interface", "long", "native", "new", "package", "private", "protected",
+                              "public", "return", "short", "static", "strictfp", "super", "switch",
+                              "synchronized", "this", "throw", "throws", "transient", "try", "void",
+                              "volatile", "while", "true", "false", "null", "assert", "enum"}));
     private static final String EXCLUDED_CHARS = "<>\"{}|\\^`";
     private static final String HEX_DIGITS = "0123456789abcdef";
 
@@ -213,7 +223,7 @@ public final class URIParserUtil {
     }
 
     public static boolean containsReservedKeywords(String token) {
-        return JavaUtils.isJavaKeyword(token);
+        return KEYWORDS.contains(token);
     }
 
     public static String escapeChars(String s) {
@@ -303,8 +313,8 @@ public final class URIParserUtil {
      * doing but is not actually doing when URI roots do not fully match.
      * See http://bugs.java.com/bugdatabase/view_bug.do?bug_id=6226081
      *
-     * @param base              The base URI
-     * @param toBeRelativized   The URI to be realivized
+     * @param baseURI           The base URI
+     * @param toBeRelativizedURI The URI to be realivized
      * @return                  The string value of the URI you'd expect to get as result
      *                          of calling baseURI.relativize(toBeRelativizedURI).
      *                          null is returned if the parameters are null or are not

http://git-wip-us.apache.org/repos/asf/cxf/blob/47fe9b86/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/WSDLGetUtils.java
----------------------------------------------------------------------
diff --git a/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/WSDLGetUtils.java b/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/WSDLGetUtils.java
index f114e47..3202bab 100644
--- a/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/WSDLGetUtils.java
+++ b/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/WSDLGetUtils.java
@@ -60,6 +60,7 @@ import org.apache.cxf.catalog.OASISCatalogManagerHelper;
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.common.util.URIParserUtil;
+import org.apache.cxf.common.util.UrlUtils;
 import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.helpers.DOMUtils;
 import org.apache.cxf.message.Message;
@@ -71,6 +72,7 @@ import org.apache.cxf.wsdl.WSDLManager;
 import org.apache.cxf.wsdl11.ResourceManagerWSDLLocator;
 import org.apache.cxf.wsdl11.ServiceWSDLBuilder;
 
+
 /**
  *
  */
@@ -356,7 +358,8 @@ public class WSDLGetUtils {
                                     Map<String, Definition> done,
                                     Map<String, SchemaReference> doneSchemas,
                                     String base,
-                                    String docBase) {
+                                    String docBase,
+                                    String parentResolvedLocation) {
         OASISCatalogManager catalogs = OASISCatalogManager.getCatalogManager(bus);
 
         Collection<List<?>> imports = CastUtils.cast((Collection<?>)def.getImports().values());
@@ -364,7 +367,7 @@ public class WSDLGetUtils {
             List<Import> impLst = CastUtils.cast(lst);
             for (Import imp : impLst) {
                 String start = imp.getLocationURI();
-                String decodedStart = null;
+                String decodedStart;
                 // Always use the URL decoded version to ensure that we have a
                 // canonical representation of the import URL for lookup.
 
@@ -391,13 +394,20 @@ public class WSDLGetUtils {
                             //ignore
                         }
                         if (done.put(decodedStart, imp.getDefinition()) == null) {
-                            updateDefinition(bus, imp.getDefinition(), done, doneSchemas, base, start);
+                            if (imp.getDefinition() != null && imp.getDefinition().getDocumentBaseURI() != null) {
+                                done.put(imp.getDefinition().getDocumentBaseURI(), imp.getDefinition());
+                            }
+                            updateDefinition(bus, imp.getDefinition(), done, doneSchemas, base, start, null);
                         }
                     }
                 } else {
                     if (done.put(decodedStart, imp.getDefinition()) == null) {
                         done.put(resolvedSchemaLocation, imp.getDefinition());
-                        updateDefinition(bus, imp.getDefinition(), done, doneSchemas, base, start);
+                        if (imp.getDefinition() != null && imp.getDefinition().getDocumentBaseURI() != null) {
+                            done.put(imp.getDefinition().getDocumentBaseURI(), imp.getDefinition());
+                        }
+                        updateDefinition(bus, imp.getDefinition(), done, doneSchemas, base, start,
+                                resolvedSchemaLocation);
                     }
                 }
             }
@@ -412,7 +422,7 @@ public class WSDLGetUtils {
             for (ExtensibilityElement el
                 : CastUtils.cast(types.getExtensibilityElements(), ExtensibilityElement.class)) {
                 if (el instanceof Schema) {
-                    updateSchemaImports(bus, (Schema)el, docBase, doneSchemas, base);
+                    updateSchemaImports(bus, (Schema)el, docBase, doneSchemas, base, parentResolvedLocation);
                 }
             }
         }
@@ -469,134 +479,84 @@ public class WSDLGetUtils {
                                        Schema schema,
                                        String docBase,
                                        Map<String, SchemaReference> doneSchemas,
-                                       String base) {
-        OASISCatalogManager catalogs = OASISCatalogManager.getCatalogManager(bus);
+                                       String base,
+                                       String parentResolved) {
         Collection<List<?>>  imports = CastUtils.cast((Collection<?>)schema.getImports().values());
         for (List<?> lst : imports) {
             List<SchemaImport> impLst = CastUtils.cast(lst);
             for (SchemaImport imp : impLst) {
-                String start = findSchemaLocation(doneSchemas, imp, docBase);
-
-                if (start != null) {
-                    String decodedStart = null;
-                    // Always use the URL decoded version to ensure that we have a
-                    // canonical representation of the import URL for lookup.
-                    try {
-                        decodedStart = URLDecoder.decode(start, "utf-8");
-                    } catch (UnsupportedEncodingException e) {
-                        throw new WSDLQueryException(
-                            new org.apache.cxf.common.i18n.Message("COULD_NOT_PROVIDE_WSDL",
-                                LOG,
-                                start), e);
-                    }
-
-                    if (!doneSchemas.containsKey(decodedStart)) {
-                        String resolvedSchemaLocation = resolveWithCatalogs(catalogs, start, base);
-                        if (resolvedSchemaLocation == null) {
-                            resolvedSchemaLocation = resolveWithCatalogs(catalogs, imp.getSchemaLocationURI(), base);
-                        }
-                        if (resolvedSchemaLocation == null) {
-                            try {
-                                //check to see if it's already in a URL format.  If so, leave it.
-                                new URL(start);
-                            } catch (MalformedURLException e) {
-                                if (doneSchemas.put(decodedStart, imp) == null) {
-                                    putResolvedSchemaLocationIfRelative(doneSchemas, decodedStart, imp);
-                                    updateSchemaImports(bus, imp.getReferencedSchema(), start, doneSchemas, base);
-                                }
-                            }
-                        } else {
-                            if (doneSchemas.put(decodedStart, imp) == null) {
-                                doneSchemas.put(resolvedSchemaLocation, imp);
-                                String p = getAndSaveRelativeSchemaLocationIfCatalogResolved(doneSchemas,
-                                    resolvedSchemaLocation,
-                                    schema,
-                                    imp);
-                                updateSchemaImports(bus, imp.getReferencedSchema(), p, doneSchemas, base);
-                            }
-                        }
-                    }
-                }
+                processSchemaReference(imp, bus, schema, docBase, doneSchemas, base, parentResolved);
             }
         }
 
         List<SchemaReference> includes = CastUtils.cast(schema.getIncludes());
         for (SchemaReference included : includes) {
-            String start = findSchemaLocation(doneSchemas, included, docBase);
-
-            if (start != null) {
-                String decodedStart = null;
-                // Always use the URL decoded version to ensure that we have a
-                // canonical representation of the import URL for lookup.
-                try {
-                    decodedStart = URLDecoder.decode(start, "utf-8");
-                } catch (UnsupportedEncodingException e) {
-                    throw new WSDLQueryException(
-                        new org.apache.cxf.common.i18n.Message("COULD_NOT_PROVIDE_WSDL",
-                            LOG,
-                            start), e);
-                }
-
-                String resolvedSchemaLocation = resolveWithCatalogs(catalogs, start, base);
-                if (resolvedSchemaLocation == null) {
-                    if (!doneSchemas.containsKey(decodedStart)) {
-                        try {
-                            //check to see if it's aleady in a URL format.  If so, leave it.
-                            new URL(start);
-                        } catch (MalformedURLException e) {
-                            if (doneSchemas.put(decodedStart, included) == null) {
-                                putResolvedSchemaLocationIfRelative(doneSchemas, decodedStart, included);
-                                updateSchemaImports(bus, included.getReferencedSchema(), start, doneSchemas, base);
-                            }
-                        }
-                    }
-                } else if (!doneSchemas.containsKey(decodedStart)
-                    || !doneSchemas.containsKey(resolvedSchemaLocation)) {
-                    doneSchemas.put(decodedStart, included);
-                    doneSchemas.put(resolvedSchemaLocation, included);
-                    String p = getAndSaveRelativeSchemaLocationIfCatalogResolved(doneSchemas,
-                        resolvedSchemaLocation,
-                        schema,
-                        included);
-                    updateSchemaImports(bus, included.getReferencedSchema(), p, doneSchemas, base);
-                }
-            }
+            processSchemaReference(included, bus, schema, docBase, doneSchemas, base, parentResolved);
         }
         List<SchemaReference> redefines = CastUtils.cast(schema.getRedefines());
         for (SchemaReference included : redefines) {
-            String start = findSchemaLocation(doneSchemas, included, docBase);
+            processSchemaReference(included, bus, schema, docBase, doneSchemas, base, parentResolved);
+        }
+    }
 
-            if (start != null) {
-                String decodedStart = null;
-                // Always use the URL decoded version to ensure that we have a
-                // canonical representation of the import URL for lookup.
-                try {
-                    decodedStart = URLDecoder.decode(start, "utf-8");
-                } catch (UnsupportedEncodingException e) {
-                    throw new WSDLQueryException(
+    private void processSchemaReference(SchemaReference schemaReference,
+                                        Bus bus,
+                                        Schema schema,
+                                        String docBase,
+                                        Map<String, SchemaReference> doneSchemas,
+                                        String base,
+                                        String parentResolved) {
+        OASISCatalogManager catalogs = OASISCatalogManager.getCatalogManager(bus);
+        String start = findSchemaLocation(doneSchemas, schemaReference, docBase);
+        String origLocation = schemaReference.getSchemaLocationURI();
+
+        if (start != null) {
+            String decodedStart;
+            String decodedOrigLocation;
+            // Always use the URL decoded version to ensure that we have a
+            // canonical representation of the import URL for lookup.
+            try {
+                decodedStart = URLDecoder.decode(start, "utf-8");
+                decodedOrigLocation = URLDecoder.decode(origLocation, "utf-8");
+            } catch (UnsupportedEncodingException e) {
+                throw new WSDLQueryException(
                         new org.apache.cxf.common.i18n.Message("COULD_NOT_PROVIDE_WSDL",
-                            LOG,
-                            start), e);
-                }
+                                LOG,
+                                start), e);
+            }
 
+            if (!doneSchemas.containsKey(decodedStart)) {
                 String resolvedSchemaLocation = resolveWithCatalogs(catalogs, start, base);
                 if (resolvedSchemaLocation == null) {
-                    if (!doneSchemas.containsKey(decodedStart)) {
+                    resolvedSchemaLocation =
+                            resolveWithCatalogs(catalogs, schemaReference.getSchemaLocationURI(), base);
+                }
+                if (resolvedSchemaLocation == null) {
+                    try {
+                        //check to see if it's already in a URL format.  If so, leave it.
+                        new URL(start);
+                    } catch (MalformedURLException e) {
+                        doneSchemas.put(decodedStart, schemaReference);
+                        doneSchemas.put(schemaReference.getReferencedSchema().getDocumentBaseURI(), schemaReference);
                         try {
-                            //check to see if it's aleady in a URL format.  If so, leave it.
-                            new URL(start);
-                        } catch (MalformedURLException e) {
-                            if (doneSchemas.put(decodedStart, included) == null) {
-                                putResolvedSchemaLocationIfRelative(doneSchemas, decodedStart, included);
-                                updateSchemaImports(bus, included.getReferencedSchema(), docBase, doneSchemas, base);
+                            if (!(new URI(origLocation).isAbsolute()) && parentResolved != null) {
+                                resolvedSchemaLocation = resolveRelativePath(parentResolved, decodedOrigLocation);
+                                doneSchemas.put(resolvedSchemaLocation, schemaReference);
                             }
+                        } catch (URISyntaxException e1) {
+                            // ignore
                         }
+                        updateSchemaImports(bus, schemaReference.getReferencedSchema(), start, doneSchemas, base,
+                                resolvedSchemaLocation);
                     }
-                } else if (!doneSchemas.containsKey(decodedStart)
-                    || !doneSchemas.containsKey(resolvedSchemaLocation)) {
-                    doneSchemas.put(decodedStart, included);
-                    doneSchemas.put(resolvedSchemaLocation, included);
-                    updateSchemaImports(bus, included.getReferencedSchema(), docBase, doneSchemas, base);
+                } else if (doneSchemas.put(decodedStart, schemaReference) == null) {
+                    doneSchemas.put(resolvedSchemaLocation, schemaReference);
+                    String p = getAndSaveRelativeSchemaLocationIfCatalogResolved(doneSchemas,
+                            resolvedSchemaLocation,
+                            schema,
+                            schemaReference);
+                    updateSchemaImports(bus, schemaReference.getReferencedSchema(), p, doneSchemas, base,
+                            resolvedSchemaLocation);
                 }
             }
         }
@@ -607,12 +567,12 @@ public class WSDLGetUtils {
      * 1) get a valid relative location to use for recursion into the imported schema
      * 2) add an entry to the doneSchemas map using such a valid relative location, as that's
      *    what will be used later for import links
-     *
+     * 
      * The valid relative location for the imported schema is computed by first obtaining the
      * relative uri that maps the importing schema resolved location into the imported schema
      * resolved location, then such value is resolved on top of the valid relative location
      * that's saved in the doneSchemas map for the importing schema.
-     *
+     * 
      * @param doneSchemas
      * @param resolvedSchemaLocation
      * @param currentSchema
@@ -646,25 +606,6 @@ public class WSDLGetUtils {
         return path;
     }
 
-    /**
-     * If given decodedStart is relative path, resolves a real location of given schema and puts it into schema map.
-     *
-     * @param doneSchemas schema map
-     * @param decodedStart path referencing schema
-     * @param schemaReference referenced schema
-     */
-    private void putResolvedSchemaLocationIfRelative(Map<String, SchemaReference> doneSchemas, String decodedStart,
-                                                     SchemaReference schemaReference) {
-        try {
-            if (!(new URI(decodedStart).isAbsolute())) {
-                String resolved = schemaReference.getReferencedSchema().getDocumentBaseURI();
-                doneSchemas.put(resolved, schemaReference);
-            }
-        } catch (URISyntaxException ex) {
-            // ignore
-        }
-    }
-
     private String findSchemaLocation(Map<String, SchemaReference> doneSchemas,
                                       SchemaReference imp,
                                       String docBase) {
@@ -691,6 +632,12 @@ public class WSDLGetUtils {
         return schemaLocationURI;
     }
 
+    private String resolveRelativePath(String parentUri, String relativePath) {
+        // can not use `new URI(uri).resolve(path)`, because that doesn't work with "jar:file:x!y" kind of URIs
+        String base = UrlUtils.getStem(parentUri);
+        return base + '/' + relativePath;
+    }
+
     /**
      * Write the contents of a wsdl Definition object to a file.
      *
@@ -710,7 +657,7 @@ public class WSDLGetUtils {
                                       String base,
                                       EndpointInfo endpointInfo) throws WSDLException {
 
-        Document doc = null;
+        Document doc;
         Bus bus = message.getExchange().getBus();
         Definition def = lookupDefinition(bus, mp, wsdl, base);
         String epurl = base;
@@ -818,7 +765,7 @@ public class WSDLGetUtils {
             Definition def = builder.build(new HashMap<String, SchemaInfo>());
 
             mp.put("", def);
-            updateDefinition(bus, def, mp, smp, base, "");
+            updateDefinition(bus, def, mp, smp, base, "", "");
         }
 
     }

http://git-wip-us.apache.org/repos/asf/cxf/blob/47fe9b86/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/OASISCatalogTest.java
----------------------------------------------------------------------
diff --git a/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/OASISCatalogTest.java b/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/OASISCatalogTest.java
index c826668..0be307f 100644
--- a/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/OASISCatalogTest.java
+++ b/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/OASISCatalogTest.java
@@ -63,29 +63,31 @@ public class OASISCatalogTest extends Assert {
         Endpoint ep = Endpoint.publish("http://localhost:" + PORT + "/SoapContext/SoapPort",
                                        new GreeterImpl());
 
-        String result = readUrl("http://localhost:" + PORT + "/SoapContext/SoapPort?"
-                + "xsd=hello_world_schema2.xsd");
-        assertTrue(result, result.contains("xsd=hello_world_schema.xsd"));
-        assertTrue(result, result.contains("xsd=hello_world_schema3.xsd"));
-        assertTrue(result, result.contains("xsd=d/hello_world_schema4.xsd"));
-
-        result = readUrl("http://localhost:" + PORT + "/SoapContext/SoapPort?"
-                + "xsd=hello_world_schema3.xsd");
-        assertTrue(result.length() > 0);
-
-        result = readUrl("http://localhost:" + PORT + "/SoapContext/SoapPort?"
-                + "xsd=d/hello_world_schema4.xsd");
-        assertTrue(result, result.contains("xsd=d/d/hello_world_schema4.xsd"));
-
-        result = readUrl("http://localhost:" + PORT + "/SoapContext/SoapPort"
-                + "?xsd=hello_world_schema.xsd");
-        assertTrue(result, result.contains("xsd=http://apache.org/hello_world/types2/hello_world_schema2.xsd"));
-
-        result = readUrl("http://localhost:" + PORT + "/SoapContext/SoapPort"
-                + "?wsdl=hello_world_messages_catalog.wsdl");
-        assertTrue(result, result.contains("xsd=hello_world_schema.xsd"));
-
-        ep.stop();
+        try {
+            String result = readUrl("http://localhost:" + PORT + "/SoapContext/SoapPort?"
+                    + "xsd=hello_world_schema2.xsd");
+            assertTrue(result, result.contains("xsd=hello_world_schema.xsd"));
+            assertTrue(result, result.contains("xsd=hello_world_schema3.xsd"));
+            assertTrue(result, result.contains("xsd=d/hello_world_schema4.xsd"));
+
+            result = readUrl("http://localhost:" + PORT + "/SoapContext/SoapPort?"
+                    + "xsd=hello_world_schema3.xsd");
+            assertTrue(result.length() > 0);
+
+            result = readUrl("http://localhost:" + PORT + "/SoapContext/SoapPort?"
+                    + "xsd=d/hello_world_schema4.xsd");
+            assertTrue(result, result.contains("xsd=d/d/hello_world_schema4.xsd"));
+
+            result = readUrl("http://localhost:" + PORT + "/SoapContext/SoapPort"
+                    + "?xsd=hello_world_schema.xsd");
+            assertTrue(result, result.contains("xsd=http://apache.org/hello_world/types2/hello_world_schema2.xsd"));
+
+            result = readUrl("http://localhost:" + PORT + "/SoapContext/SoapPort"
+                    + "?wsdl=hello_world_messages_catalog.wsdl");
+            assertTrue(result, result.contains("xsd=hello_world_schema.xsd"));
+        } finally {
+            ep.stop();
+        }
     }
 
     /**
@@ -101,30 +103,65 @@ public class OASISCatalogTest extends Assert {
     public void testWSDLPublishWithCatalogsRewritePaths() {
         Endpoint ep = Endpoint.publish("http://localhost:" + PORT + "/SoapContext/SoapPort",
                 new GreeterImpl());
-
-        String result = readUrl("http://localhost:" + PORT + "/SoapContext/SoapPort?"
-                + "xsd=http://apache.org/hello_world/types2/hello_world_schema2.xsd");
-        assertTrue(result, result.contains("xsd=http://apache.org/hello_world/types2/hello_world_schema.xsd"));
-        assertTrue(result, result.contains("xsd=http://apache.org/hello_world/types2/hello_world_schema3.xsd"));
-        assertTrue(result, result.contains("xsd=http://apache.org/hello_world/types2/d/hello_world_schema4.xsd"));
-
-        result = readUrl("http://localhost:" + PORT + "/SoapContext/SoapPort?"
-                + "xsd=http://apache.org/hello_world/types2/hello_world_schema.xsd");
-        assertTrue(result, result.contains("xsd=http://apache.org/hello_world/types2/hello_world_schema2.xsd"));
-
-        result = readUrl("http://localhost:" + PORT + "/SoapContext/SoapPort?"
-                + "xsd=http://apache.org/hello_world/types2/hello_world_schema3.xsd");
-        assertTrue(result.length() > 0);
-
-        result = readUrl("http://localhost:" + PORT + "/SoapContext/SoapPort?"
-                + "xsd=http://apache.org/hello_world/types2/d/hello_world_schema4.xsd");
-        assertTrue(result, result.contains("xsd=http://apache.org/hello_world/types2/d/d/hello_world_schema4.xsd"));
-
-        result = readUrl("http://localhost:" + PORT + "/SoapContext/SoapPort?"
-                + "xsd=http://apache.org/hello_world/types2/d/d/hello_world_schema4.xsd");
-        assertTrue(result.length() > 0);
-
-        ep.stop();
+        try {
+            // schemas in the same directory as WSDL
+
+            String result = readUrl("http://localhost:" + PORT + "/SoapContext/SoapPort?"
+                    + "xsd=http://apache.org/hello_world/types2/hello_world_schema2.xsd");
+            assertTrue(result, result.contains("xsd=http://apache.org/hello_world/types2/hello_world_schema.xsd"));
+            assertTrue(result, result.contains("xsd=http://apache.org/hello_world/types2/hello_world_schema3.xsd"));
+            assertTrue(result, result.contains("xsd=http://apache.org/hello_world/types2/d/hello_world_schema4.xsd"));
+
+            result = readUrl("http://localhost:" + PORT + "/SoapContext/SoapPort?"
+                    + "xsd=http://apache.org/hello_world/types2/hello_world_schema.xsd");
+            assertTrue(result, result.contains("xsd=http://apache.org/hello_world/types2/hello_world_schema2.xsd"));
+
+            result = readUrl("http://localhost:" + PORT + "/SoapContext/SoapPort?"
+                    + "xsd=http://apache.org/hello_world/types2/hello_world_schema3.xsd");
+            assertTrue(result.length() > 0);
+
+            result = readUrl("http://localhost:" + PORT + "/SoapContext/SoapPort?"
+                    + "xsd=http://apache.org/hello_world/types2/d/hello_world_schema4.xsd");
+            assertTrue(result, result.contains("xsd=http://apache.org/hello_world/types2/d/d/hello_world_schema4.xsd"));
+
+            result = readUrl("http://localhost:" + PORT + "/SoapContext/SoapPort?"
+                    + "xsd=http://apache.org/hello_world/types2/d/d/hello_world_schema4.xsd");
+            assertFalse(result.contains("schemaLocation"));
+
+            // schemas in separate directory which is not subdirectory of WSDL dir
+
+            result = readUrl("http://localhost:" + PORT + "/SoapContext/SoapPort?"
+                    + "wsdl=http://apache.org/hello_world/types2/hello_world_messages_catalog.wsdl");
+            assertTrue(result, result.contains("xsd=http://apache.org/hello_world/schemas-in-separate-dir/schema.xsd"));
+
+            result = readUrl("http://localhost:" + PORT + "/SoapContext/SoapPort?"
+                    + "xsd=http://apache.org/hello_world/schemas-in-separate-dir/schema.xsd");
+            assertTrue(result,
+                    result.contains("xsd=http://apache.org/hello_world/schemas-in-separate-dir/d/included.xsd"));
+
+            result = readUrl("http://localhost:" + PORT + "/SoapContext/SoapPort?"
+                    + "xsd=http://apache.org/hello_world/schemas-in-separate-dir/d/included.xsd");
+            assertTrue(result,
+                    result.contains("xsd=http://apache.org/hello_world/schemas-in-separate-dir/d/d/included.xsd"));
+
+            result = readUrl("http://localhost:" + PORT + "/SoapContext/SoapPort?"
+                    + "xsd=http://apache.org/hello_world/schemas-in-separate-dir/d/d/included.xsd");
+            assertFalse(result, result.contains("schemaLocation"));
+
+            // rewrite rule that doesn't begin with 'classpath:' but contains only the path
+
+            result = readUrl("http://localhost:" + PORT + "/SoapContext/SoapPort?"
+                    + "xsd=http://apache.org/hello_world/schemas-in-separate-dir-non-cp/another-schema.xsd");
+            assertTrue(result, result.contains("xsd=http://apache.org/hello_world/schemas-in-separate-dir-non-cp/d/"
+                    + "another-included.xsd"));
+
+            result = readUrl("http://localhost:" + PORT + "/SoapContext/SoapPort?"
+                    + "xsd=http://apache.org/hello_world/schemas-in-separate-dir-non-cp/d/another-included.xsd");
+            assertTrue(result, result.contains("xsd=http://apache.org/hello_world/schemas-in-separate-dir-non-cp/d/d/"
+                    + "another-included.xsd"));
+        } finally {
+            ep.stop();
+        }
     }
     
     @Test

http://git-wip-us.apache.org/repos/asf/cxf/blob/47fe9b86/systests/uncategorized/src/test/java/org/apache/cxf/systest/schemaimport/SchemaImportTest.java
----------------------------------------------------------------------
diff --git a/systests/uncategorized/src/test/java/org/apache/cxf/systest/schemaimport/SchemaImportTest.java b/systests/uncategorized/src/test/java/org/apache/cxf/systest/schemaimport/SchemaImportTest.java
index 7755f19..df458c2 100644
--- a/systests/uncategorized/src/test/java/org/apache/cxf/systest/schemaimport/SchemaImportTest.java
+++ b/systests/uncategorized/src/test/java/org/apache/cxf/systest/schemaimport/SchemaImportTest.java
@@ -57,9 +57,9 @@ public class SchemaImportTest extends AbstractBusClientServerTestBase {
     @Test
     public void testImportSchema2() throws Exception {
         String schemaURL = "http://localhost:" + PORT + "/schemaimport/sayHi2"
-            + "?xsd=../sayhi/sayhi/sayhi-schema1.xsd";
+                           + "?xsd=../sayhi/sayhi/sayhi-schema1.xsd";
         URL url = new URL(schemaURL);
-        try  {
+        try {
             InputStream ins = url.openStream();
             String output = IOUtils.toString(ins);
             assertTrue(output.indexOf("sayHiArray") > -1);

http://git-wip-us.apache.org/repos/asf/cxf/blob/47fe9b86/testutils/src/main/resources/META-INF/jax-ws-catalog.xml
----------------------------------------------------------------------
diff --git a/testutils/src/main/resources/META-INF/jax-ws-catalog.xml b/testutils/src/main/resources/META-INF/jax-ws-catalog.xml
index 28d5907..3b1f3cf 100644
--- a/testutils/src/main/resources/META-INF/jax-ws-catalog.xml
+++ b/testutils/src/main/resources/META-INF/jax-ws-catalog.xml
@@ -19,7 +19,10 @@
 -->
 <catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog" prefer="system">
     <rewriteSystem systemIdStartString="http://apache.org/hello_world/types2/" rewritePrefix="/wsdl/others/"/>
+    <rewriteSystem systemIdStartString="http://apache.org/hello_world/schemas-in-separate-dir/" rewritePrefix="classpath:/wsdl/schemas/"/>
+    <rewriteSystem systemIdStartString="http://apache.org/hello_world/schemas-in-separate-dir-non-cp/" rewritePrefix="/wsdl/schemas/"/>
     <rewriteSystem systemIdStartString="doesnotexist" rewritePrefix="../wsdl/catalog"/>
     <rewriteSystem systemIdStartString="nopath" rewritePrefix="../wsdl"/>
+
     <rewriteSystem systemIdStartString="testutils" rewritePrefix="classpath:/wsdl"/>
 </catalog>

http://git-wip-us.apache.org/repos/asf/cxf/blob/47fe9b86/testutils/src/main/resources/wsdl/others/hello_world_messages_catalog.wsdl
----------------------------------------------------------------------
diff --git a/testutils/src/main/resources/wsdl/others/hello_world_messages_catalog.wsdl b/testutils/src/main/resources/wsdl/others/hello_world_messages_catalog.wsdl
index 1597ef2..dce23a6 100644
--- a/testutils/src/main/resources/wsdl/others/hello_world_messages_catalog.wsdl
+++ b/testutils/src/main/resources/wsdl/others/hello_world_messages_catalog.wsdl
@@ -17,10 +17,29 @@
   specific language governing permissions and limitations
   under the License.
 -->
-<wsdl:definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://apache.org/hello_world/messages" xmlns:x1="http://apache.org/hello_world/types" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="HelloWorld" targetNamespace="http://apache.org/hello_world/messages">
+<wsdl:definitions name="HelloWorld"
+    xmlns="http://schemas.xmlsoap.org/wsdl/"
+    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+    xmlns:tns="http://apache.org/hello_world/messages"
+    xmlns:x1="http://apache.org/hello_world/types"
+    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+    targetNamespace="http://apache.org/hello_world/messages">
     <wsdl:types>
-        <schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://apache.org/hello_world/types/schema" elementFormDefault="qualified">
-            <xsd:import namespace="http://apache.org/hello_world/types" schemaLocation="hello_world_schema.xsd"/>
+        <schema targetNamespace="http://apache.org/hello_world/types/schema" 
+            xmlns="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
+            <xsd:import namespace="http://apache.org/hello_world/types" 
+                schemaLocation="hello_world_schema.xsd"/>
+        </schema>
+        <schema targetNamespace="http://apache.org/hello_world/schemas-in-separate-dir"
+                xmlns="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
+            <xsd:import namespace="http://apache.org/hello_world/schemas-in-separate-dir"
+                        schemaLocation="http://apache.org/hello_world/schemas-in-separate-dir/schema.xsd"/>
+        </schema>
+        <schema targetNamespace="http://apache.org/hello_world/schemas-in-separate-dir"
+                xmlns="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
+            <xsd:import namespace="http://apache.org/hello_world/schemas-in-separate-dir"
+                        schemaLocation="http://apache.org/hello_world/schemas-in-separate-dir-non-cp/another-schema.xsd"/>
         </schema>
     </wsdl:types>
     <wsdl:message name="sayHiRequest">

http://git-wip-us.apache.org/repos/asf/cxf/blob/47fe9b86/testutils/src/main/resources/wsdl/others/hello_world_wsdl_import_catalog.wsdl
----------------------------------------------------------------------
diff --git a/testutils/src/main/resources/wsdl/others/hello_world_wsdl_import_catalog.wsdl b/testutils/src/main/resources/wsdl/others/hello_world_wsdl_import_catalog.wsdl
index 23a03c9..12ed895 100644
--- a/testutils/src/main/resources/wsdl/others/hello_world_wsdl_import_catalog.wsdl
+++ b/testutils/src/main/resources/wsdl/others/hello_world_wsdl_import_catalog.wsdl
@@ -24,10 +24,12 @@
             <wsdl:input message="x1:sayHiRequest"/>
             <wsdl:output message="x1:sayHiResponse"/>
         </wsdl:operation>
+
         <wsdl:operation name="greetMe">
             <wsdl:input message="x1:greetMeRequest"/>
             <wsdl:output message="x1:greetMeResponse"/>
         </wsdl:operation>
+
         <wsdl:operation name="pingMe">
             <wsdl:input message="x1:pingMeRequest"/>
             <wsdl:output message="x1:pingMeResponse"/>

http://git-wip-us.apache.org/repos/asf/cxf/blob/47fe9b86/testutils/src/main/resources/wsdl/schemas/another-schema.xsd
----------------------------------------------------------------------
diff --git a/testutils/src/main/resources/wsdl/schemas/another-schema.xsd b/testutils/src/main/resources/wsdl/schemas/another-schema.xsd
new file mode 100644
index 0000000..1fa48f0
--- /dev/null
+++ b/testutils/src/main/resources/wsdl/schemas/another-schema.xsd
@@ -0,0 +1,29 @@
+<?xml version="1.0"?>
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+-->
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
+    targetNamespace="http://apache.org/hello_world/schemas-in-separate-dir"
+            elementFormDefault="qualified">
+
+    <xsd:import schemaLocation="d/another-included.xsd" namespace="http://apache.org/hello_world/schemas-in-separate-dir"/>
+
+    <xsd:element name="sayHi5">
+        <xsd:complexType/>
+    </xsd:element>
+</xsd:schema>

http://git-wip-us.apache.org/repos/asf/cxf/blob/47fe9b86/testutils/src/main/resources/wsdl/schemas/d/another-included.xsd
----------------------------------------------------------------------
diff --git a/testutils/src/main/resources/wsdl/schemas/d/another-included.xsd b/testutils/src/main/resources/wsdl/schemas/d/another-included.xsd
new file mode 100644
index 0000000..f262555
--- /dev/null
+++ b/testutils/src/main/resources/wsdl/schemas/d/another-included.xsd
@@ -0,0 +1,29 @@
+<?xml version="1.0"?>
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+-->
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
+    targetNamespace="http://apache.org/hello_world/schemas-in-separate-dir"
+            elementFormDefault="qualified">
+
+    <xsd:import schemaLocation="d/another-included.xsd" namespace="http://apache.org/hello_world/schemas-in-separate-dir"/>
+
+    <xsd:element name="sayHi6">
+        <xsd:complexType/>
+    </xsd:element>
+</xsd:schema>

http://git-wip-us.apache.org/repos/asf/cxf/blob/47fe9b86/testutils/src/main/resources/wsdl/schemas/d/d/another-included.xsd
----------------------------------------------------------------------
diff --git a/testutils/src/main/resources/wsdl/schemas/d/d/another-included.xsd b/testutils/src/main/resources/wsdl/schemas/d/d/another-included.xsd
new file mode 100644
index 0000000..7b5a3c6
--- /dev/null
+++ b/testutils/src/main/resources/wsdl/schemas/d/d/another-included.xsd
@@ -0,0 +1,27 @@
+<?xml version="1.0"?>
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+-->
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
+    targetNamespace="http://apache.org/hello_world/schemas-in-separate-dir"
+            elementFormDefault="qualified">
+
+    <xsd:element name="sayHi6">
+        <xsd:complexType/>
+    </xsd:element>
+</xsd:schema>

http://git-wip-us.apache.org/repos/asf/cxf/blob/47fe9b86/testutils/src/main/resources/wsdl/schemas/d/d/included.xsd
----------------------------------------------------------------------
diff --git a/testutils/src/main/resources/wsdl/schemas/d/d/included.xsd b/testutils/src/main/resources/wsdl/schemas/d/d/included.xsd
new file mode 100644
index 0000000..b825296
--- /dev/null
+++ b/testutils/src/main/resources/wsdl/schemas/d/d/included.xsd
@@ -0,0 +1,27 @@
+<?xml version="1.0"?>
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+-->
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
+    targetNamespace="http://apache.org/hello_world/schemas-in-separate-dir"
+            elementFormDefault="qualified">
+
+    <xsd:element name="sayHi4">
+        <xsd:complexType/>
+    </xsd:element>
+</xsd:schema>

http://git-wip-us.apache.org/repos/asf/cxf/blob/47fe9b86/testutils/src/main/resources/wsdl/schemas/d/included.xsd
----------------------------------------------------------------------
diff --git a/testutils/src/main/resources/wsdl/schemas/d/included.xsd b/testutils/src/main/resources/wsdl/schemas/d/included.xsd
new file mode 100644
index 0000000..2b306cc
--- /dev/null
+++ b/testutils/src/main/resources/wsdl/schemas/d/included.xsd
@@ -0,0 +1,29 @@
+<?xml version="1.0"?>
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+-->
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
+    targetNamespace="http://apache.org/hello_world/schemas-in-separate-dir"
+            elementFormDefault="qualified">
+
+    <xsd:import schemaLocation="d/included.xsd" namespace="http://apache.org/hello_world/schemas-in-separate-dir"/>
+
+    <xsd:element name="sayHi3">
+        <xsd:complexType/>
+    </xsd:element>
+</xsd:schema>

http://git-wip-us.apache.org/repos/asf/cxf/blob/47fe9b86/testutils/src/main/resources/wsdl/schemas/schema.xsd
----------------------------------------------------------------------
diff --git a/testutils/src/main/resources/wsdl/schemas/schema.xsd b/testutils/src/main/resources/wsdl/schemas/schema.xsd
new file mode 100644
index 0000000..325b231
--- /dev/null
+++ b/testutils/src/main/resources/wsdl/schemas/schema.xsd
@@ -0,0 +1,29 @@
+<?xml version="1.0"?>
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+-->
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
+    targetNamespace="http://apache.org/hello_world/schemas-in-separate-dir"
+            elementFormDefault="qualified">
+
+    <xsd:import schemaLocation="d/included.xsd" namespace="http://apache.org/hello_world/schemas-in-separate-dir"/>
+
+    <xsd:element name="sayHi2">
+        <xsd:complexType/>
+    </xsd:element>
+</xsd:schema>

http://git-wip-us.apache.org/repos/asf/cxf/blob/47fe9b86/tools/common/src/test/java/org/apache/cxf/tools/util/URIParserUtilTest.java
----------------------------------------------------------------------
diff --git a/tools/common/src/test/java/org/apache/cxf/tools/util/URIParserUtilTest.java b/tools/common/src/test/java/org/apache/cxf/tools/util/URIParserUtilTest.java
index 9bb3642..99a96b1 100644
--- a/tools/common/src/test/java/org/apache/cxf/tools/util/URIParserUtilTest.java
+++ b/tools/common/src/test/java/org/apache/cxf/tools/util/URIParserUtilTest.java
@@ -19,6 +19,7 @@
 
 package org.apache.cxf.tools.util;
 
+import java.net.URISyntaxException;
 import java.net.URLDecoder;
 
 import org.apache.cxf.common.util.URIParserUtil;
@@ -103,4 +104,28 @@ public class URIParserUtilTest extends Assert {
         String s = URIParserUtil.escapeChars(orig);
         assertEquals(orig, URLDecoder.decode(s, "UTF-8"));
     }
+
+    @Test
+    public void testRelativize() throws URISyntaxException {
+        assertNull(URIParserUtil.relativize(null, "foo"));
+        assertNull(URIParserUtil.relativize("foo", null));
+        assertEquals("", URIParserUtil.relativize("", ""));
+        assertEquals("", URIParserUtil.relativize("fds", ""));
+        assertEquals("../", URIParserUtil.relativize("fds/", ""));
+        assertEquals("fdsfs", URIParserUtil.relativize("", "fdsfs"));
+        assertEquals("fdsfs/a", URIParserUtil.relativize("", "fdsfs/a"));
+        assertEquals("../de", URIParserUtil.relativize("ab/cd", "de"));
+        assertEquals("../de/fe/gh", URIParserUtil.relativize("ab/cd", "de/fe/gh"));
+        assertEquals("../../../de/fe/gh", URIParserUtil.relativize("/abc/def/", "de/fe/gh"));
+        assertNull(URIParserUtil.relativize("file:/c:/abc/def/", "de/fe/gh")); // null as the URI obtained by
+        // the 2 strings are not both
+        // absolute or not absolute
+        assertEquals("pippo2.xsd", URIParserUtil.relativize("/abc/def/pippo1.xsd", "/abc/def/pippo2.xsd"));
+        assertEquals("../default/pippo2.xsd",
+                URIParserUtil.relativize("/abc/def/pippo1.xsd", "/abc/default/pippo2.xsd"));
+        assertEquals("def/pippo2.xsd", URIParserUtil.relativize("/abc/def", "/abc/def/pippo2.xsd"));
+        assertEquals("hello_world_schema2.xsd",
+                URIParserUtil.relativize("jar:file:/home/a.jar!/wsdl/others/",
+                        "jar:file:/home/a.jar!/wsdl/others/hello_world_schema2.xsd"));
+    }
 }


Mime
View raw message