You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2012/01/17 22:41:17 UTC
svn commit: r1232593 - in /cxf/branches/2.5.x-fixes: ./
tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/
tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/
tool...
Author: dkulp
Date: Tue Jan 17 21:41:16 2012
New Revision: 1232593
URL: http://svn.apache.org/viewvc?rev=1232593&view=rev
Log:
Merged revisions 1232591 via svnmerge from
https://svn.apache.org/repos/asf/cxf/trunk
........
r1232591 | dkulp | 2012-01-17 16:37:01 -0500 (Tue, 17 Jan 2012) | 2 lines
[CXF-4039] If the wsdlLocation isn't a valid URL, don't output the "new
URL" style lookup in the code.
........
Modified:
cxf/branches/2.5.x-fixes/ (props changed)
cxf/branches/2.5.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/ServiceGenerator.java
cxf/branches/2.5.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/service.vm
cxf/branches/2.5.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenOptionTest.java
Propchange: cxf/branches/2.5.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified: cxf/branches/2.5.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/ServiceGenerator.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/ServiceGenerator.java?rev=1232593&r1=1232592&r2=1232593&view=diff
==============================================================================
--- cxf/branches/2.5.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/ServiceGenerator.java (original)
+++ cxf/branches/2.5.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/ServiceGenerator.java Tue Jan 17 21:41:16 2012
@@ -19,6 +19,8 @@
package org.apache.cxf.tools.wsdlto.frontend.jaxws.generators;
+import java.net.MalformedURLException;
+import java.net.URL;
import java.util.Map;
import javax.jws.HandlerChain;
@@ -129,8 +131,17 @@ public class ServiceGenerator extends Ab
}
clearAttributes();
+ boolean useGetResource = false;
+ try {
+ new URL(location);
+ } catch (MalformedURLException e) {
+ useGetResource = true;
+ }
+
+
setAttributes("service", js);
setAttributes("wsdlLocation", location);
+ setAttributes("useGetResource", useGetResource);
setAttributes("serviceSuperclass", serviceSuperclass);
if ("Service".equals(serviceSuperclass)) {
js.addImport("javax.xml.ws.Service");
Modified: cxf/branches/2.5.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/service.vm
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/service.vm?rev=1232593&r1=1232592&r2=1232593&view=diff
==============================================================================
--- cxf/branches/2.5.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/service.vm (original)
+++ cxf/branches/2.5.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/service.vm Tue Jan 17 21:41:16 2012
@@ -83,7 +83,15 @@ public class ${service.Name} extends ${s
if (url == null) {
url = ${service.Name}.class.getClassLoader().getResource("$wsdlLocation.substring(11)");
}
-#end
+#end
+ if (url == null) {
+ java.util.logging.Logger.getLogger(${service.Name}.class.getName())
+ .log(java.util.logging.Level.INFO,
+ "Can not initialize the default wsdl from {0}", "$wsdlLocation");
+ }
+ WSDL_LOCATION = url;
+#elseif ($useGetResource)
+ URL url = ${service.Name}.class.getResource("$wsdlLocation");
if (url == null) {
java.util.logging.Logger.getLogger(${service.Name}.class.getName())
.log(java.util.logging.Level.INFO,
Modified: cxf/branches/2.5.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenOptionTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenOptionTest.java?rev=1232593&r1=1232592&r2=1232593&view=diff
==============================================================================
--- cxf/branches/2.5.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenOptionTest.java (original)
+++ cxf/branches/2.5.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenOptionTest.java Tue Jan 17 21:41:16 2012
@@ -290,4 +290,31 @@ public class CodeGenOptionTest extends A
}
return count;
}
+
+
+ @Test
+ public void testResourceURLForWsdlLocation() throws Exception {
+ env.put(ToolConstants.CFG_WSDLURL, getLocation("/wsdl2java_wsdl/hello_world.wsdl"));
+ env.put(ToolConstants.CFG_WSDLLOCATION, "/wsdl2java_wsdl/hello_world.wsdl");
+ env.put(ToolConstants.CFG_COMPILE, null);
+ env.put(ToolConstants.CFG_CLASSDIR, null);
+ processor.setContext(env);
+ processor.execute();
+
+ File dir = new File(output, "org");
+ assertTrue("org directory is not found", dir.exists());
+ dir = new File(dir, "apache");
+ assertTrue("apache directory is not found", dir.exists());
+ dir = new File(dir, "cxf");
+ assertTrue("cxf directory is not found", dir.exists());
+ dir = new File(dir, "w2j");
+ assertTrue("w2j directory is not found", dir.exists());
+ dir = new File(dir, "hello_world_soap_http");
+ assertTrue("hello_world_soap_http directory is not found", dir.exists());
+
+ String str = IOUtils.readStringFromStream(new FileInputStream(new File(dir,
+ "SOAPService.java")));
+ assertTrue(str, str.contains("getResource"));
+ }
+
}