cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject [2/3] cxf git commit: [CXF-6235] wsdl2java behaves differently from cxf-codegen-plugin This closes #50
Date Mon, 09 Feb 2015 16:26:21 GMT
[CXF-6235] wsdl2java behaves differently from cxf-codegen-plugin
This closes #50


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

Branch: refs/heads/master
Commit: db92bc6867137132ee742ec79fbd038682b8b540
Parents: 2fdf389
Author: gwuireland <gwuireland@gmail.com>
Authored: Fri Jan 30 16:49:08 2015 +0000
Committer: Daniel Kulp <dkulp@apache.org>
Committed: Mon Feb 9 10:57:04 2015 -0500

----------------------------------------------------------------------
 .../apache/cxf/tools/wsdlto/WSDLToJavaContainer.java    | 12 ++++++++++++
 .../cxf/tools/wsdlto/WSDLToJavaContainerTest.java       | 11 +++++++++++
 2 files changed, 23 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/db92bc68/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java
----------------------------------------------------------------------
diff --git a/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java
b/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java
index 4f7ed77..3b57251 100644
--- a/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java
+++ b/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java
@@ -553,11 +553,22 @@ public class WSDLToJavaContainer extends AbstractCXFToolContainer {
         if (!env.containsKey(ToolConstants.CFG_WSDLLOCATION)) {
             //make sure the "raw" form is used for the wsdlLocation
             //instead of the absolute URI that normalize may return
+            boolean assumeFileURI = false;
             try {
                 URI uri = new URI(wsdl);
+
+                String uriScheme = uri.getScheme();
+                if (uriScheme == null) {
+                    assumeFileURI = true;
+                }
+
                 wsdl = uri.toString();
             } catch (Exception e) {
                 //not a URL, assume file
+                assumeFileURI = true;
+            }
+
+            if (assumeFileURI) {
                 if (wsdl.indexOf(":") != -1 && !wsdl.startsWith("/")) {
                     wsdl = "file:/" + wsdl;
                 } else {
@@ -570,6 +581,7 @@ public class WSDLToJavaContainer extends AbstractCXFToolContainer {
                     //ignore... 
                 }
             }
+
             wsdl = wsdl.replace("\\", "/");
 
             env.put(ToolConstants.CFG_WSDLLOCATION, wsdl);

http://git-wip-us.apache.org/repos/asf/cxf/blob/db92bc68/tools/wsdlto/core/src/test/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainerTest.java
----------------------------------------------------------------------
diff --git a/tools/wsdlto/core/src/test/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainerTest.java
b/tools/wsdlto/core/src/test/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainerTest.java
index f4b7213..97d44f5 100644
--- a/tools/wsdlto/core/src/test/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainerTest.java
+++ b/tools/wsdlto/core/src/test/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainerTest.java
@@ -66,6 +66,17 @@ public class WSDLToJavaContainerTest extends Assert {
         assertTrue(context.optionSet(ToolConstants.CFG_SUPPRESS_WARNINGS));
     }
 
+    @Test
+    public void testWsdlLocationDefaultSchemeIsFile() throws Exception {
+        WSDLToJavaContainer container = new WSDLToJavaContainer("dummy", null);
+        ToolContext context = new ToolContext();
+        context.put(ToolConstants.CFG_WSDLURL, getLocation("hello_world.wsdl"));
+        container.setContext(context);
+        container.validate(context);
+        String wsdlLocation = (String)context.get(ToolConstants.CFG_WSDLLOCATION);
+        assertTrue("default scheme for wsdlLocation is file", wsdlLocation.startsWith("file:"));
+    }
+
     private String getLocation(String wsdlFile) throws URISyntaxException {
         return this.getClass().getResource(wsdlFile).toURI().getPath();
     }


Mime
View raw message