Author: midon
Date: Tue Jul  1 17:02:47 2008
New Revision: 673230

URL: http://svn.apache.org/viewvc?rev=673230&view=rev
Log:
split test file, separate ODE extensions from regular http binding

Added:
    ode/trunk/axis2/src/test/resources/http-binding-validator-ext.wsdl
Modified:
    
ode/trunk/axis2/src/test/java/org/apache/ode/axis2/httpbinding/HttpBindingValidatorTest.java
    ode/trunk/axis2/src/test/resources/http-binding-validator.wsdl

Modified: 
ode/trunk/axis2/src/test/java/org/apache/ode/axis2/httpbinding/HttpBindingValidatorTest.java
URL: 
http://svn.apache.org/viewvc/ode/trunk/axis2/src/test/java/org/apache/ode/axis2/httpbinding/HttpBindingValidatorTest.java?rev=673230&r1=673229&r2=673230&view=diff
==============================================================================
--- 
ode/trunk/axis2/src/test/java/org/apache/ode/axis2/httpbinding/HttpBindingValidatorTest.java
 (original)
+++ 
ode/trunk/axis2/src/test/java/org/apache/ode/axis2/httpbinding/HttpBindingValidatorTest.java
 Tue Jul  1 17:02:47 2008
@@ -43,45 +43,54 @@
 
     private static final Log log = 
LogFactory.getLog(HttpBindingValidatorTest.class);
 
-    private Definition definition;
+    private String[] resources = new String[]{"/http-binding-validator.wsdl", 
"/http-binding-validator-ext.wsdl"};
+    private Definition[] definitions;
     private static final String SHOULD_FAIL = "shouldFail";
     private static final String SHOULD_PASS = "shouldPass";
 
     protected void setUp() throws Exception {
         super.setUp();
-        URL wsdlURL = getClass().getResource("/http-binding-validator.wsdl");
+
         WSDLReader wsdlReader = WSDLFactory.newInstance().newWSDLReader();
         wsdlReader.setFeature("javax.wsdl.verbose", false);
-        definition = wsdlReader.readWSDL(wsdlURL.toURI().toString());
+        definitions = new Definition[resources.length];
+        for (int i = 0; i < resources.length; i++) {
+            URL wsdlURL = getClass().getResource(resources[i]);
+            definitions[i] = wsdlReader.readWSDL(wsdlURL.toURI().toString());
+        }
     }
 
-    public void testAll(){
-        for (Iterator it = definition.getBindings().entrySet().iterator(); 
it.hasNext();) {
-            Map.Entry e = (Map.Entry) it.next();
-            QName name = (QName) e.getKey();
-            String localName = name.getLocalPart();
-            Binding binding = (Binding) e.getValue();
-            Element documentationElement = binding.getDocumentationElement();
-            if(documentationElement==null){
-                log.warn("Binding skipped : "+ localName +", 
<wsdl:documentation> missing ");
-                continue;
-            }
-            String doc = DOMUtils.getTextContent(documentationElement);
-            boolean shouldFail = doc.startsWith(SHOULD_FAIL);
-            boolean shouldPass = doc.startsWith(SHOULD_PASS);
-            if(!shouldFail && !shouldPass) {
-                fail("Binding: "+ localName +", <wsdl:documentation> content 
must start with '"+SHOULD_FAIL+"' or '"+SHOULD_PASS+"'. ");
-            }
+    public void testAll() {
+        for (int i = 0; i < definitions.length; i++) {
+            Definition def = definitions[i];
+            for (Iterator it = def.getBindings().entrySet().iterator(); 
it.hasNext();) {
+                Map.Entry e = (Map.Entry) it.next();
+                QName name = (QName) e.getKey();
+                String localName = name.getLocalPart();
+                Binding binding = (Binding) e.getValue();
+                Element documentationElement = 
binding.getDocumentationElement();
+                if (documentationElement == null) {
+                    log.warn("Binding skipped : " + localName + ", 
<wsdl:documentation> missing ");
+                    continue;
+                }
+                String doc = DOMUtils.getTextContent(documentationElement);
+                boolean shouldFail = doc.startsWith(SHOULD_FAIL);
+                boolean shouldPass = doc.startsWith(SHOULD_PASS);
+                if (!shouldFail && !shouldPass) {
+                    fail("Binding: " + localName + ", <wsdl:documentation> 
content must start with '" + SHOULD_FAIL + "' or '" + SHOULD_PASS + "'. ");
+                }
 
-            log.debug("Testing Binding : "+localName);
-            String msg = localName + " : " + doc;
-            try {
-                new HttpBindingValidator(binding).validate();
-                assertTrue(msg, shouldPass);
-            } catch (IllegalArgumentException e1) {
-                msg += " / Exception Msg is : "+e1.getMessage();
-                assertTrue(msg, shouldFail);
+                log.debug("Testing Binding : " + localName);
+                String msg = localName + " : " + doc;
+                try {
+                    new HttpBindingValidator(binding).validate();
+                    assertTrue(msg, shouldPass);
+                } catch (IllegalArgumentException e1) {
+                    msg += " / Exception Msg is : " + e1.getMessage();
+                    assertTrue(msg, shouldFail);
+                }
             }
         }
+
     }
 }

Added: ode/trunk/axis2/src/test/resources/http-binding-validator-ext.wsdl
URL: 
http://svn.apache.org/viewvc/ode/trunk/axis2/src/test/resources/http-binding-validator-ext.wsdl?rev=673230&view=auto
==============================================================================
--- ode/trunk/axis2/src/test/resources/http-binding-validator-ext.wsdl (added)
+++ ode/trunk/axis2/src/test/resources/http-binding-validator-ext.wsdl Tue Jul  
1 17:02:47 2008
@@ -0,0 +1,134 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/";
+                  xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/";
+                  xmlns:ns0="http://axis2.ode.apache.org/xsd";
+                  xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/";
+                  xmlns:http="http://schemas.xmlsoap.org/wsdl/http/";
+                  xmlns:ns1="http://axis2.ode.apache.org";
+                  xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl";
+                  xmlns:xs="http://www.w3.org/2001/XMLSchema";
+                  xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/";
+                  xmlns:odex="http://www.apache.org/ode/type/extension/http";
+                  targetNamespace="http://axis2.ode.apache.org";>
+    <wsdl:message name="helloRequest">
+        <wsdl:part name="part_0" type="xs:string"/>
+    </wsdl:message>
+    <wsdl:message name="helloResponse">
+        <wsdl:part name="part_0" type="xs:string"/>
+        <wsdl:part name="part_1" type="xs:string"/>
+    </wsdl:message>
+    <wsdl:portType name="DummyServicePortType">
+        <wsdl:operation name="hello">
+            <wsdl:input message="ns1:helloRequest" wsaw:Action="urn:hello"/>
+            <wsdl:output message="ns1:helloResponse" 
wsaw:Action="urn:helloResponse"/>
+        </wsdl:operation>
+    </wsdl:portType>
+
+    <wsdl:binding 
name="DummyServiceHttpBinding_get+urlReplacement+missing_part" 
type="ns1:DummyServicePortType">
+        <wsdl:documentation>
+            shouldPass # WSLD spec requires that all message parts must be in 
the url pattern when urlReplacement is used.
+            However ODE relaxes this.
+        </wsdl:documentation>
+        <http:binding verb="GET"/>
+        <wsdl:operation name="hello">
+            <http:operation location="DummyService/hello"/>
+            <wsdl:input>
+                <http:urlReplacement/>
+            </wsdl:input>
+            <wsdl:output>
+                <mime:content type="text/xml" part="hello"/>
+            </wsdl:output>
+        </wsdl:operation>
+    </wsdl:binding>
+    <wsdl:binding 
name="DummyServiceHttpBinding_get+urlReplacement+empty_pattern" 
type="ns1:DummyServicePortType">
+        <wsdl:documentation>
+            shouldPass # Operation-location may be empty. For instance, REST 
connector will not fill it.
+        </wsdl:documentation>
+        <http:binding verb="GET"/>
+        <wsdl:operation name="hello">
+            <http:operation location=""/>
+            <wsdl:input>
+                <http:urlReplacement/>
+            </wsdl:input>
+            <wsdl:output>
+                <mime:content type="text/xml" part="hello"/>
+            </wsdl:output>
+        </wsdl:operation>
+    </wsdl:binding>
+
+    <!-- ###################################### -->
+    <!-- Verb at the operation level -->
+    <!-- ###################################### -->
+    <wsdl:binding name="DummyServiceHttpBinding_no_verb" 
type="ns1:DummyServicePortType">
+        <wsdl:documentation>
+            shouldFail # A verb must be defined: it could be in the port tag, 
or in the operation
+        </wsdl:documentation>
+        <wsdl:operation name="hello">
+            <http:operation location="DummyService/hello"/>
+            <wsdl:input>
+                <http:urlEncoded/>
+            </wsdl:input>
+            <wsdl:output>
+                <mime:content type="text/xml" part="hello"/>
+            </wsdl:output>
+        </wsdl:operation>
+    </wsdl:binding>
+    <wsdl:binding name="DummyServiceHttpBinding_no_verb" 
type="ns1:DummyServicePortType">
+        <wsdl:documentation>
+            shouldFail # A verb must be defined for each operation: it could 
be in the port tag, or in the operation
+        </wsdl:documentation>
+        <wsdl:operation name="hello">
+            <http:operation location="DummyService/hello"/>
+            <odex:binding verb="GET"/>
+            <wsdl:input>
+                <http:urlEncoded/>
+            </wsdl:input>
+            <wsdl:output>
+                <mime:content type="text/xml" part="hello"/>
+            </wsdl:output>
+        </wsdl:operation>
+        <wsdl:operation name="bye">
+            <http:operation location="DummyService/bye"/>
+            <wsdl:input>
+                <http:urlEncoded/>
+            </wsdl:input>
+            <wsdl:output>
+                <mime:content type="text/xml" part="hello"/>
+            </wsdl:output>
+        </wsdl:operation>
+    </wsdl:binding>
+    <wsdl:binding name="DummyServiceHttpBinding_no_verb_in_port" 
type="ns1:DummyServicePortType">
+        <wsdl:documentation>
+            shouldPass # Verb may be defined in the operation
+        </wsdl:documentation>
+        <wsdl:operation name="hello">
+            <http:operation location="DummyService/hello"/>
+            <odex:binding verb="GET"/>
+            <wsdl:input>
+                <http:urlEncoded/>
+            </wsdl:input>
+            <wsdl:output>
+                <mime:content type="text/xml" part="hello"/>
+            </wsdl:output>
+        </wsdl:operation>
+    </wsdl:binding>
+    <wsdl:binding name="DummyServiceHttpBinding_verb_overridden" 
type="ns1:DummyServicePortType">
+        <wsdl:documentation>
+            shouldPass # Operation may override the verb defined in the port.
+        </wsdl:documentation>
+        <http:binding verb="GET"/>
+        <wsdl:operation name="hello">
+            <http:operation location="DummyService/hello"/>
+            <odex:binding verb="POST"/>
+            <wsdl:input>
+                <http:urlEncoded/>
+            </wsdl:input>
+            <wsdl:output>
+                <mime:content type="text/xml" part="hello"/>
+            </wsdl:output>
+        </wsdl:operation>
+    </wsdl:binding>
+
+
+    <!-- no <service> tags needed -->
+</wsdl:definitions>

Modified: ode/trunk/axis2/src/test/resources/http-binding-validator.wsdl
URL: 
http://svn.apache.org/viewvc/ode/trunk/axis2/src/test/resources/http-binding-validator.wsdl?rev=673230&r1=673229&r2=673230&view=diff
==============================================================================
--- ode/trunk/axis2/src/test/resources/http-binding-validator.wsdl (original)
+++ ode/trunk/axis2/src/test/resources/http-binding-validator.wsdl Tue Jul  1 
17:02:47 2008
@@ -396,110 +396,5 @@
             </wsdl:output>
         </wsdl:operation>
     </wsdl:binding>
-    <wsdl:binding 
name="DummyServiceHttpBinding_get+urlReplacement+twice_the_same_part" 
type="ns1:DummyServicePortType">
-        <wsdl:documentation>
-            shouldFail # When urlReplacement used, message parts must not be 
more than ONCE in the url pattern
-        </wsdl:documentation>
-        <http:binding verb="GET"/>
-        <wsdl:operation name="hello">
-            <http:operation 
location="DummyService/hello/(TestPart)/(TestPart)"/>
-            <wsdl:input>
-                <http:urlReplacement/>
-            </wsdl:input>
-            <wsdl:output>
-                <mime:content type="text/xml" part="hello"/>
-            </wsdl:output>
-        </wsdl:operation>
-    </wsdl:binding>
-    <wsdl:binding 
name="DummyServiceHttpBinding_get+urlReplacement+empty_pattern" 
type="ns1:DummyServicePortType">
-        <wsdl:documentation>
-            shouldPass # Operation-location may be empty. REST connector will 
not fill it for instance.
-        </wsdl:documentation>
-        <http:binding verb="GET"/>
-        <wsdl:operation name="hello">
-            <http:operation location=""/>
-            <wsdl:input>
-                <http:urlReplacement/>
-            </wsdl:input>
-            <wsdl:output>
-                <mime:content type="text/xml" part="hello"/>
-            </wsdl:output>
-        </wsdl:operation>
-    </wsdl:binding>
-
-    <!-- ###################################### -->
-    <!-- Verb at the operation level -->
-    <!-- ###################################### -->
-    <wsdl:binding name="DummyServiceHttpBinding_no_verb" 
type="ns1:DummyServicePortType">
-        <wsdl:documentation>
-            shouldFail # A verb must be defined: it could be in the port tag, 
or in the operation
-        </wsdl:documentation>
-        <wsdl:operation name="hello">
-            <http:operation location="DummyService/hello"/>
-            <wsdl:input>
-                <http:urlEncoded/>
-            </wsdl:input>
-            <wsdl:output>
-                <mime:content type="text/xml" part="hello"/>
-            </wsdl:output>
-        </wsdl:operation>
-    </wsdl:binding>
-    <wsdl:binding name="DummyServiceHttpBinding_no_verb" 
type="ns1:DummyServicePortType">
-        <wsdl:documentation>
-            shouldFail # A verb must be defined for each operation: it could 
be in the port tag, or in the operation
-        </wsdl:documentation>
-        <wsdl:operation name="hello">
-            <http:operation location="DummyService/hello"/>
-            <odex:binding verb="GET"/>
-            <wsdl:input>
-                <http:urlEncoded/>
-            </wsdl:input>
-            <wsdl:output>
-                <mime:content type="text/xml" part="hello"/>
-            </wsdl:output>
-        </wsdl:operation>
-        <wsdl:operation name="bye">
-            <http:operation location="DummyService/bye"/>
-            <wsdl:input>
-                <http:urlEncoded/>
-            </wsdl:input>
-            <wsdl:output>
-                <mime:content type="text/xml" part="hello"/>
-            </wsdl:output>
-        </wsdl:operation>
-    </wsdl:binding>
-    <wsdl:binding name="DummyServiceHttpBinding_no_verb_in_port" 
type="ns1:DummyServicePortType">
-        <wsdl:documentation>
-            shouldPass # Verb may be defined in the operation
-        </wsdl:documentation>
-        <wsdl:operation name="hello">
-            <http:operation location="DummyService/hello"/>
-            <odex:binding verb="GET"/>
-            <wsdl:input>
-                <http:urlEncoded/>
-            </wsdl:input>
-            <wsdl:output>
-                <mime:content type="text/xml" part="hello"/>
-            </wsdl:output>
-        </wsdl:operation>
-    </wsdl:binding>
-    <wsdl:binding name="DummyServiceHttpBinding_verb_overridden" 
type="ns1:DummyServicePortType">
-        <wsdl:documentation>
-            shouldPass # Operation may override the verb defined in the port.
-        </wsdl:documentation>
-        <http:binding verb="GET"/>
-        <wsdl:operation name="hello">
-            <http:operation location="DummyService/hello"/>
-            <odex:binding verb="POST"/>
-            <wsdl:input>
-                <http:urlEncoded/>
-            </wsdl:input>
-            <wsdl:output>
-                <mime:content type="text/xml" part="hello"/>
-            </wsdl:output>
-        </wsdl:operation>
-    </wsdl:binding>
-
-
     <!-- no <service> tags needed -->
 </wsdl:definitions>


Reply via email to