cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r655562 - in /cxf/trunk/tools/validator/src: main/java/org/apache/cxf/tools/validator/internal/ main/java/org/apache/cxf/tools/validator/internal/model/ test/java/org/apache/cxf/tools/validator/ test/resources/validator_wsdl/
Date Mon, 12 May 2008 17:02:14 GMT
Author: dkulp
Date: Mon May 12 10:02:14 2008
New Revision: 655562

URL: http://svn.apache.org/viewvc?rev=655562&view=rev
Log:
Fix and issue with not being able to validate a valid wsdl that uses defaults for portType
operation message names

Added:
    cxf/trunk/tools/validator/src/test/resources/validator_wsdl/defaultOpMessageNames.wsdl
  (with props)
Modified:
    cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/WSDLRefValidator.java
    cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/model/XNode.java
    cxf/trunk/tools/validator/src/test/java/org/apache/cxf/tools/validator/WSDLValidationTest.java

Modified: cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/WSDLRefValidator.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/WSDLRefValidator.java?rev=655562&r1=655561&r2=655562&view=diff
==============================================================================
--- cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/WSDLRefValidator.java
(original)
+++ cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/WSDLRefValidator.java
Mon May 12 10:02:14 2008
@@ -329,6 +329,10 @@
         XInput oNode = new XInput();
         oNode.setName(name);
         oNode.setParentNode(opVNode);
+        
+        if (name != null && name.equals(opVNode.getAttributeValue() + "Request"))
{
+            oNode.setDefaultAttributeValue(true);
+        }
         return oNode;
     }
 
@@ -336,6 +340,9 @@
         XOutput oNode = new XOutput();
         oNode.setName(name);
         oNode.setParentNode(opVNode);
+        if (name != null && name.equals(opVNode.getAttributeValue() + "Response"))
{
+            oNode.setDefaultAttributeValue(true);
+        }
         return oNode;
     }
 

Modified: cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/model/XNode.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/model/XNode.java?rev=655562&r1=655561&r2=655562&view=diff
==============================================================================
--- cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/model/XNode.java
(original)
+++ cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/model/XNode.java
Mon May 12 10:02:14 2008
@@ -32,6 +32,7 @@
     private QName name;
     private String attributeName;
     private String attributeValue;
+    private boolean isDefaultAttributeValue;
     private XNode parentNode;
 
     private XNode failurePoint;
@@ -77,7 +78,14 @@
     public void setAttributeValue(final String newAttributeValue) {
         this.attributeValue = newAttributeValue;
     }
-
+    
+    public void setDefaultAttributeValue(boolean b) {
+        this.isDefaultAttributeValue = b;
+    }
+    public boolean isDefaultAttributeValue() {
+        return this.isDefaultAttributeValue;
+    }
+    
     public XNode getParentNode() {
         return parentNode;
     }
@@ -118,11 +126,18 @@
         sb.append(":");
         sb.append(name.getLocalPart());
         if (!StringUtils.isEmpty(attributeName) && !StringUtils.isEmpty(attributeValue))
{
-            sb.append("[@");
+            sb.append("[");
+            if (isDefaultAttributeValue) {
+                sb.append("not(@");
+                sb.append(attributeName);
+                sb.append(") or ");
+            }
+            sb.append("@");
             sb.append(attributeName);
             sb.append("='");
             sb.append(attributeValue);
-            sb.append("']");
+            sb.append("'");
+            sb.append("]");
         }
         return sb.toString();
     }

Modified: cxf/trunk/tools/validator/src/test/java/org/apache/cxf/tools/validator/WSDLValidationTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/validator/src/test/java/org/apache/cxf/tools/validator/WSDLValidationTest.java?rev=655562&r1=655561&r2=655562&view=diff
==============================================================================
--- cxf/trunk/tools/validator/src/test/java/org/apache/cxf/tools/validator/WSDLValidationTest.java
(original)
+++ cxf/trunk/tools/validator/src/test/java/org/apache/cxf/tools/validator/WSDLValidationTest.java
Mon May 12 10:02:14 2008
@@ -31,6 +31,14 @@
     public void setUp() {
         super.setUp();
     }
+    
+    @Test
+    public void testValidateDefaultOpMessageNames() throws Exception {
+        String[] args = new String[] {"-verbose",
+                                      getLocation("/validator_wsdl/defaultOpMessageNames.wsdl")};
+        WSDLValidator.main(args);
+        assertTrue(this.getStdOut().contains("Valid WSDL"));
+    }
 
     @Test
     public void testValidateUniqueBody() throws Exception {

Added: cxf/trunk/tools/validator/src/test/resources/validator_wsdl/defaultOpMessageNames.wsdl
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/validator/src/test/resources/validator_wsdl/defaultOpMessageNames.wsdl?rev=655562&view=auto
==============================================================================
--- cxf/trunk/tools/validator/src/test/resources/validator_wsdl/defaultOpMessageNames.wsdl
(added)
+++ cxf/trunk/tools/validator/src/test/resources/validator_wsdl/defaultOpMessageNames.wsdl
Mon May 12 10:02:14 2008
@@ -0,0 +1,118 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<definitions name="defaults.wsdl" 
+
+   targetNamespace="http://www.iona.com/artix/defaults" 
+
+   xmlns="http://schemas.xmlsoap.org/wsdl/" 
+
+   xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 
+
+   xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" 
+
+   xmlns:tns="http://www.iona.com/artix/defaults" 
+
+   xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
+
+   xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+   <types>
+
+       <xsd:schema targetNamespace="http://www.iona.com/artix/defaults"
+
+
+           xmlns="http://www.iona.com/artix/defaults" 
+
+           xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+           <xsd:complexType name="TestType">
+
+               <xsd:sequence>
+
+                   <xsd:element maxOccurs="1" minOccurs="1" name="msg"
+type="xsd:string"/>
+
+                   <xsd:element maxOccurs="1" minOccurs="1" name="num"
+type="xsd:int"/>
+
+               </xsd:sequence>
+
+           </xsd:complexType>
+
+           <xsd:element name="Test" type="TestType"/>
+
+       </xsd:schema>
+
+   </types>
+
+
+
+   <message name="TestMessage">
+
+       <part element="tns:Test" name="params"/>
+
+   </message>
+
+
+
+   <portType name="TestPortType">
+
+       <operation name="Test">
+
+           <input message="tns:TestMessage"/>
+
+           <output message="tns:TestMessage"/>
+
+       </operation>
+
+   </portType>
+
+
+
+   <binding name="TestPortTypeDefaults" type="tns:TestPortType">
+
+       <soap:binding style="document"
+transport="http://schemas.xmlsoap.org/soap/http"/>
+
+       <operation name="Test">
+
+           <soap:operation soapAction="" style="document"/>
+
+
+
+           <input name="TestRequest">
+
+               <soap:body use="literal"/>
+
+           </input>
+
+
+
+           <output name="TestResponse">
+
+               <soap:body use="literal"/>
+
+           </output>
+
+
+
+       </operation>
+
+   </binding>
+
+
+
+   <service name="TestService">
+
+       <port binding="tns:TestPortTypeDefaults" name="TestPort">
+
+           <soap:address location="http://localhost:9100/TestService"/>
+
+       </port>
+
+   </service>
+
+
+
+</definitions>
+

Propchange: cxf/trunk/tools/validator/src/test/resources/validator_wsdl/defaultOpMessageNames.wsdl
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/tools/validator/src/test/resources/validator_wsdl/defaultOpMessageNames.wsdl
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: cxf/trunk/tools/validator/src/test/resources/validator_wsdl/defaultOpMessageNames.wsdl
------------------------------------------------------------------------------
    svn:mime-type = text/xml



Mime
View raw message