cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1067065 - in /cxf/trunk/tools/wsdlto: frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/ frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/ test/src/test/java/org/apache/cxf/t...
Date Fri, 04 Feb 2011 02:31:02 GMT
Author: dkulp
Date: Fri Feb  4 02:31:01 2011
New Revision: 1067065

URL: http://svn.apache.org/viewvc?rev=1067065&view=rev
Log:
[CXF-3290] Fix problem of generating code with Service and SEI haveing
the same name, but different packages.

Added:
    cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf-3290/
    cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf-3290/bug.wsdl   (with
props)
    cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf-3290/bug2.wsdl   (with
props)
Modified:
    cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/ServiceGenerator.java
    cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/service.vm
    cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java

Modified: cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/ServiceGenerator.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/ServiceGenerator.java?rev=1067065&r1=1067064&r2=1067065&view=diff
==============================================================================
--- cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/ServiceGenerator.java
(original)
+++ cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/generators/ServiceGenerator.java
Fri Feb  4 02:31:01 2011
@@ -109,7 +109,8 @@ public class ServiceGenerator extends Ab
                 }
     
                 for (JavaPort port : js.getPorts()) {
-                    if (!port.getPackageName().equals(js.getPackageName())) {
+                    if (!port.getPackageName().equals(js.getPackageName())
+                        && !port.getInterfaceClass().equals(js.getName())) {
                         js.addImport(port.getFullClassName());
                     }
                 }

Modified: cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/service.vm
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/service.vm?rev=1067065&r1=1067064&r2=1067065&view=diff
==============================================================================
--- cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/service.vm
(original)
+++ cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/service.vm
Fri Feb  4 02:31:01 2011
@@ -144,6 +144,10 @@ public class ${service.Name} extends ${s
 #end
 
 #foreach ($port in $service.Ports)
+#set($portClassName = ${port.InterfaceClass})
+#if ($portClassName == ${service.Name}) 
+#set($portClassName = ${port.fullClassName})
+#end
     /**
      * 
      * @return
@@ -153,8 +157,8 @@ public class ${service.Name} extends ${s
 #if ($mark-generated == "true")
     @Generated(value = "org.apache.cxf.tools.wsdlto.WSDLToJava", date = "$currentdate")
 #end
-    public ${port.InterfaceClass} get${port.Name}() {
-        return super.getPort($port.Name, ${port.InterfaceClass}.class);
+    public ${portClassName} get${port.Name}() {
+        return super.getPort($port.Name, ${portClassName}.class);
     }
 
     /**
@@ -168,8 +172,8 @@ public class ${service.Name} extends ${s
 #if ($mark-generated == "true")
     @Generated(value = "org.apache.cxf.tools.wsdlto.WSDLToJava", date = "$currentdate")
 #end
-    public ${port.InterfaceClass} get${port.Name}(WebServiceFeature... features) {
-        return super.getPort($port.Name, ${port.InterfaceClass}.class, features);
+    public ${portClassName} get${port.Name}(WebServiceFeature... features) {
+        return super.getPort($port.Name, ${portClassName}.class, features);
     }
 #end
 

Modified: cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java?rev=1067065&r1=1067064&r2=1067065&view=diff
==============================================================================
--- cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
(original)
+++ cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
Fri Feb  4 02:31:01 2011
@@ -1161,4 +1161,18 @@ public class CodeGenBugTest extends Abst
         File f = new File(output, "org/apache/cxf/w2j/hello_world_soap_http/SayHi.java");
         assertTrue(f.exists());
     }
+    @Test
+    public void testCXF3290() throws Exception {
+        env.put(ToolConstants.CFG_COMPILE, "compile");
+        env.put(ToolConstants.CFG_OUTPUTDIR, output.getCanonicalPath());
+        env.put(ToolConstants.CFG_CLASSDIR, output.getCanonicalPath() + "/classes");
+        env.put(ToolConstants.CFG_WSDLURL, getLocation("/wsdl2java_wsdl/cxf-3290/bug.wsdl"));
+        processor.setContext(env);
+        processor.execute();
+        
+        Class<?> cls = classLoader.loadClass("org.apache.cxf.bugs3290.services.bug1.MyBugService");
+        Method m = cls.getMethod("getMyBug1");
+        assertEquals(classLoader.loadClass("org.apache.cxf.bugs3290.services.bug2.MyBugService"),
+                     m.getReturnType());
+    }
 }

Added: cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf-3290/bug.wsdl
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf-3290/bug.wsdl?rev=1067065&view=auto
==============================================================================
--- cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf-3290/bug.wsdl (added)
+++ cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf-3290/bug.wsdl Fri Feb
 4 02:31:01 2011
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<wsdl:definitions 
+    xmlns:tns="http://bugs3290.cxf.apache.org/services/bug1"
+    xmlns:bug2="http://bugs3290.cxf.apache.org/services/bug2"
+    xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
+    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 
+    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
+    targetNamespace="http://bugs3290.cxf.apache.org/services/bug1" 
+    name="bug1">
+
+<wsdl:import namespace="http://bugs3290.cxf.apache.org/services/bug2" location="bug2.wsdl"
/>
+
+	<wsdl:binding name="myBug1PortSoapBinding" type="bug2:myBugService">
+		<soap:binding style="document"
+			transport="http://schemas.xmlsoap.org/soap/http" />
+
+		<wsdl:operation name="myBug1">
+			<soap:operation style="document" />
+			<wsdl:input>
+				<soap:body use="literal" />
+			</wsdl:input>
+			<wsdl:output>
+				<soap:body use="literal" />
+			</wsdl:output>
+		</wsdl:operation>
+	</wsdl:binding>
+	<wsdl:service name="myBugService">
+		<wsdl:port name="myBug1" binding="tns:myBug1PortSoapBinding">
+			<soap:address location="http://REPLACE_WITH_HOST_INFO/myBug1" />
+		</wsdl:port>
+	</wsdl:service>
+
+</wsdl:definitions>

Propchange: cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf-3290/bug.wsdl
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf-3290/bug.wsdl
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf-3290/bug.wsdl
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf-3290/bug2.wsdl
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf-3290/bug2.wsdl?rev=1067065&view=auto
==============================================================================
--- cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf-3290/bug2.wsdl (added)
+++ cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf-3290/bug2.wsdl Fri Feb
 4 02:31:01 2011
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<wsdl:definitions 
+    xmlns:tns="http://bugs3290.cxf.apache.org/services/bug2"
+    xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
+    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 
+    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
+    targetNamespace="http://bugs3290.cxf.apache.org/services/bug2" 
+    name="bug2">
+
+	<wsdl:types>
+
+		<schema xmlns="http://www.w3.org/2001/XMLSchema"
+			elementFormDefault="qualified" attributeFormDefault="qualified"
+			targetNamespace="http://bugs3290.cxf.apache.org/services/bug2">
+
+			<xsd:complexType name="requestDataType">
+				<xsd:sequence>
+					<xsd:element name="myString1" type="xsd:string" />
+				</xsd:sequence>
+			</xsd:complexType>
+
+			<xsd:complexType name="responseDataType">
+				<xsd:sequence>
+					<xsd:element name="myString2" type="xsd:string" />
+				</xsd:sequence>
+			</xsd:complexType>
+
+			<element name="myBug1" type="tns:requestDataType" />
+			<element name="myBug1Response" type="tns:responseDataType" />
+		</schema>
+	</wsdl:types>
+
+	<wsdl:message name="myBug1RequestMessage">
+		<wsdl:part name="parameters" element="tns:myBug1" />
+	</wsdl:message>
+	<wsdl:message name="myBug1ResponseMessage">
+		<wsdl:part name="parameters" element="tns:myBug1Response" />
+	</wsdl:message>
+
+	<wsdl:portType name="myBugService">
+		<wsdl:operation name="myBug1">
+			<wsdl:input message="tns:myBug1RequestMessage" />
+			<wsdl:output message="tns:myBug1ResponseMessage" />
+		</wsdl:operation>
+	</wsdl:portType>
+
+</wsdl:definitions>

Propchange: cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf-3290/bug2.wsdl
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf-3290/bug2.wsdl
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf-3290/bug2.wsdl
------------------------------------------------------------------------------
    svn:mime-type = text/xml



Mime
View raw message