cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sea...@apache.org
Subject svn commit: r691237 - in /cxf/trunk/tools: common/src/main/java/org/apache/cxf/tools/common/ wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/ wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/ wsdlto/test/src/test/resources/wsdl2java_ws...
Date Tue, 02 Sep 2008 13:22:32 GMT
Author: seanoc
Date: Tue Sep  2 06:22:29 2008
New Revision: 691237

URL: http://svn.apache.org/viewvc?rev=691237&view=rev
Log:
Fix for https://issues.apache.org/jira/browse/CXF-1662

Added:
    cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1662/
    cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1662/child.wsdl
    cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1662/child2.wsdl
    cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1662/test.wsdl
    cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1662/test2.wsdl
Modified:
    cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/ToolContext.java
    cxf/trunk/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java
    cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java

Modified: cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/ToolContext.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/ToolContext.java?rev=691237&r1=691236&r2=691237&view=diff
==============================================================================
--- cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/ToolContext.java (original)
+++ cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/ToolContext.java Tue
Sep  2 06:22:29 2008
@@ -39,6 +39,7 @@
     protected JavaModel javaModel;
     private Map<String, Object> paramMap;
     private String packageName;
+    private boolean packageNameChanged;
     private Map<String, String> namespacePackageMap = new HashMap<String, String>();
     private Map<String, String> excludeNamespacePackageMap = new HashMap<String,
String>();
     private List<InputSource> jaxbBindingFiles = new ArrayList<InputSource>();
@@ -191,6 +192,7 @@
 
     public void setPackageName(String pkgName) {
         this.packageName = pkgName;
+        packageNameChanged = true;
     }
 
     public String getPackageName() {
@@ -257,4 +259,8 @@
     public Map<String, String> getNamespacePackageMap() {
         return namespacePackageMap;
     }
+    
+    public boolean isPackageNameChanged() {
+        return packageNameChanged;
+    }
 }

Modified: cxf/trunk/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java?rev=691237&r1=691236&r2=691237&view=diff
==============================================================================
--- cxf/trunk/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java
(original)
+++ cxf/trunk/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java
Tue Sep  2 06:22:29 2008
@@ -169,6 +169,13 @@
                     }
                 }
             }
+            
+            if (context.isPackageNameChanged() && schemas.size() > 1 
+                && context.get(ToolConstants.CFG_NO_ADDRESS_BINDING) == null) {
+                throw new ToolException(new Message("-p option cannot be used "
+                    + "when wsdl contains mutiple schemas", LOG));
+            }
+            
             context.put(ToolConstants.SCHEMA_MAP, schemas);
             context.put(ToolConstants.PORTTYPE_MAP, interfaces);
             context.put(ClassCollector.class, new ClassCollector());
@@ -217,7 +224,6 @@
                 }
             }
         }
-
     }
 
     private boolean isSuppressCodeGen() {
@@ -237,6 +243,7 @@
             }
             throw ex;
         } catch (Exception ex) {
+            ex.printStackTrace();
             throw new ToolException(ex);
         } finally {
             tearDown();
@@ -341,6 +348,7 @@
                 }
             }
         }
+        
     }
 
     public void validate(ToolContext env) throws ToolException {

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=691237&r1=691236&r2=691237&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
Tue Sep  2 06:22:29 2008
@@ -36,6 +36,7 @@
 import org.apache.cxf.helpers.IOUtils;
 import org.apache.cxf.tools.common.ProcessorTestBase;
 import org.apache.cxf.tools.common.ToolConstants;
+import org.apache.cxf.tools.common.ToolException;
 import org.apache.cxf.tools.util.AnnotationUtil;
 import org.apache.cxf.tools.wsdlto.WSDLToJava;
 import org.apache.cxf.tools.wsdlto.core.DataBindingProfile;
@@ -81,7 +82,7 @@
         //processor = null;
         env = null;
     }
-    
+
     @Test
     // Test for CXF-1678
     public void testLogicalOnlyWSDL() throws Exception {
@@ -1055,4 +1056,30 @@
         }
     }
     
+    @Test
+    public void testCXF1662() throws Exception {
+        String[] args = new String[] {"-d", output.getCanonicalPath(), "-p", "org.cxf",
+                getLocation("/wsdl2java_wsdl/cxf1662/test.wsdl")};
+
+        try {
+            WSDLToJava.main(args);
+        } catch (ToolException tex) {
+            assertTrue(tex.getMessage().contains(" -p option cannot be used when "
+                + "wsdl contains mutiple schemas"));
+        }    
+        
+        
+        String[] args2 = new String[] {"-d", output.getCanonicalPath(), "-p", "org.cxf",
+                getLocation("/wsdl2java_wsdl/cxf1662/test2.wsdl")};       
+        try {
+            WSDLToJava.main(args2);
+        } catch (ToolException tex) {
+            assertNull(tex);
+        }
+        assertNotNull(output);
+        File file = new File(output, "org/cxf/package-info.java");
+        assertTrue(file.exists());
+        String str = FileUtils.getStringFromFile(file);
+        assertTrue(str.contains("http://child/xsd"));
+    }   
 }

Added: cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1662/child.wsdl
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1662/child.wsdl?rev=691237&view=auto
==============================================================================
--- cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1662/child.wsdl (added)
+++ cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1662/child.wsdl Tue Sep
 2 06:22:29 2008
@@ -0,0 +1,39 @@
+<wsdl:definitions name="Child"
+  xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+  xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+  xmlns:xs="http://www.w3.org/2001/XMLSchema"
+  xmlns:tns="http://child/"
+  xmlns:xsd="http://child/xsd"
+  targetNamespace="http://child/">
+  <wsdl:types>
+    <xs:schema targetNamespace="http://child/xsd">
+      <xs:element name="Message">
+        <xs:complexType>
+          <xs:sequence/>
+        </xs:complexType>
+      </xs:element>
+    </xs:schema>
+  </wsdl:types>
+  <wsdl:message name="Message">
+    <wsdl:part name="msg" element="xsd:Message"/>
+  </wsdl:message>
+  <wsdl:portType name="PortType">
+    <wsdl:operation name="Operation">
+      <wsdl:input message="tns:Message"/>
+    </wsdl:operation>
+  </wsdl:portType>
+  <wsdl:binding name="Binding" type="tns:PortType">
+        <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"
/>
+    <wsdl:operation name="Operation">
+      <soap:operation style="document"/>
+      <wsdl:input>
+        <soap:body use="literal"/>
+      </wsdl:input>
+    </wsdl:operation>
+  </wsdl:binding>
+  <wsdl:service name="Service">
+        <wsdl:port name="Port" binding="tns:Binding">
+            <soap:address location="http://localhost/service" />
+        </wsdl:port>
+  </wsdl:service>
+</wsdl:definitions>
\ No newline at end of file

Added: cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1662/child2.wsdl
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1662/child2.wsdl?rev=691237&view=auto
==============================================================================
--- cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1662/child2.wsdl (added)
+++ cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1662/child2.wsdl Tue
Sep  2 06:22:29 2008
@@ -0,0 +1,39 @@
+<wsdl:definitions name="Child2"
+  xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+  xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+  xmlns:xs="http://www.w3.org/2001/XMLSchema"
+  xmlns:tns="http://child2/"
+  xmlns:xsd="http://child2/xsd"
+  targetNamespace="http://child2/">
+  <wsdl:types>
+    <xs:schema targetNamespace="http://child2/xsd">
+      <xs:element name="Child2Message">
+        <xs:complexType>
+          <xs:sequence/>
+        </xs:complexType>
+      </xs:element>
+    </xs:schema>
+  </wsdl:types>
+  <wsdl:message name="Child2Message">
+    <wsdl:part name="msg" element="xsd:Child2Message"/>
+  </wsdl:message>
+  <wsdl:portType name="Child2PortType">
+    <wsdl:operation name="Child2Operation">
+      <wsdl:input message="tns:Child2Message"/>
+    </wsdl:operation>
+  </wsdl:portType>
+  <wsdl:binding name="Child2Binding" type="tns:Child2PortType">
+        <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"
/>
+    <wsdl:operation name="Child2Operation">
+      <soap:operation style="document"/>
+      <wsdl:input>
+        <soap:body use="literal"/>
+      </wsdl:input>
+    </wsdl:operation>
+  </wsdl:binding>
+  <wsdl:service name="Child2Service">
+        <wsdl:port name="Child2Port" binding="tns:Child2Binding">
+            <soap:address location="http://localhost/service/child2" />
+        </wsdl:port>
+  </wsdl:service>
+</wsdl:definitions>
\ No newline at end of file

Added: cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1662/test.wsdl
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1662/test.wsdl?rev=691237&view=auto
==============================================================================
--- cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1662/test.wsdl (added)
+++ cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1662/test.wsdl Tue Sep
 2 06:22:29 2008
@@ -0,0 +1,4 @@
+<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" name="Parent">
+    <wsdl:import namespace="http://child/" location="child.wsdl" />
+    <wsdl:import namespace="http://child2/" location="child2.wsdl" />
+</wsdl:definitions>
\ No newline at end of file

Added: cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1662/test2.wsdl
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1662/test2.wsdl?rev=691237&view=auto
==============================================================================
--- cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1662/test2.wsdl (added)
+++ cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1662/test2.wsdl Tue Sep
 2 06:22:29 2008
@@ -0,0 +1,3 @@
+<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" name="Parent">
+    <wsdl:import namespace="http://child/" location="child.wsdl" />
+</wsdl:definitions>
\ No newline at end of file



Mime
View raw message