cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r695954 - in /cxf/branches/2.0.x-fixes: ./ tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/ tools/validator/src/test/java/org/apache/cxf/tools/validator/ tools/validator/src/test/resources/validator_wsdl/ tools/wsdlto/...
Date Tue, 16 Sep 2008 16:08:01 GMT
Author: dkulp
Date: Tue Sep 16 09:08:00 2008
New Revision: 695954

URL: http://svn.apache.org/viewvc?rev=695954&view=rev
Log:
Merged revisions 695555 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/branches/2.1.x-fixes

................
  r695555 | dkulp | 2008-09-15 13:19:37 -0400 (Mon, 15 Sep 2008) | 9 lines
  
  Merged revisions 695552 via svnmerge from 
  https://svn.apache.org/repos/asf/cxf/trunk
  
  ........
    r695552 | dkulp | 2008-09-15 13:13:26 -0400 (Mon, 15 Sep 2008) | 2 lines
    
    [CXF-1793] Consider soap headers when determining if an operation is "unique"
  ........
................

Added:
    cxf/branches/2.0.x-fixes/tools/validator/src/test/resources/validator_wsdl/cxf1793.wsdl
      - copied unchanged from r695555, cxf/branches/2.1.x-fixes/tools/validator/src/test/resources/validator_wsdl/cxf1793.wsdl
Modified:
    cxf/branches/2.0.x-fixes/   (props changed)
    cxf/branches/2.0.x-fixes/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/SchemaValidator.java
    cxf/branches/2.0.x-fixes/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/UniqueBodyPartsValidator.java
    cxf/branches/2.0.x-fixes/tools/validator/src/test/java/org/apache/cxf/tools/validator/WSDLValidationTest.java
    cxf/branches/2.0.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java

Propchange: cxf/branches/2.0.x-fixes/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Sep 16 09:08:00 2008
@@ -1,3 +1,3 @@
-/cxf/branches/2.1.x-fixes:673548,674485,674547,674551,674562,674601,674649,674764,674887,675644,675653,677048,677385,678004,678009,678559,678629,678808,678852,678891,678893,679248,679597,680435,681060,681165,681813,681816,682902,682951,683089,683290,683318,684099,684790-684793,684842,684862,684895-684918,685205,685253,686237,686283,686299,686333-686364,686765,686827,687097,687464-687465,689109,689112,689122,691316,691357,691491,691711,691715,691745,692162-692163,692468,692500,694466-694469,694472,694717,694748-694749,694870,695503,695509,695553
-/cxf/trunk:651669-686342,686344-686363,686764,686820,687096,687387,687463,688086,688102,688735,691271,691355,691488,691602,691706,691728,692116,692157,692466,692499,693653,693819,694179,694263,694417,694716,694744,694747,694869,695396,695484,695537
+/cxf/branches/2.1.x-fixes:673548,674485,674547,674551,674562,674601,674649,674764,674887,675644,675653,677048,677385,678004,678009,678559,678629,678808,678852,678891,678893,679248,679597,680435,681060,681165,681813,681816,682902,682951,683089,683290,683318,684099,684790-684793,684842,684862,684895-684918,685205,685253,686237,686283,686299,686333-686364,686765,686827,687097,687464-687465,689109,689112,689122,691316,691357,691491,691711,691715,691745,692162-692163,692468,692500,694466-694469,694472,694717,694748-694749,694870,695503,695509,695553,695555
+/cxf/trunk:651669-686342,686344-686363,686764,686820,687096,687387,687463,688086,688102,688735,691271,691355,691488,691602,691706,691728,692116,692157,692466,692499,693653,693819,694179,694263,694417,694716,694744,694747,694869,695396,695484,695537,695552
 /incubator/cxf/trunk:434594-651668

Propchange: cxf/branches/2.0.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.0.x-fixes/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/SchemaValidator.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.0.x-fixes/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/SchemaValidator.java?rev=695954&r1=695953&r2=695954&view=diff
==============================================================================
--- cxf/branches/2.0.x-fixes/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/SchemaValidator.java
(original)
+++ cxf/branches/2.0.x-fixes/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/SchemaValidator.java
Tue Sep 16 09:08:00 2008
@@ -132,7 +132,7 @@
 
         for (InputSource is : xsdsInJar) {
             Message msg = new Message("CREATE_SCHEMA_LOADED_FROM_JAR", LOG, is.getSystemId());
-            LOG.log(Level.INFO, msg.toString());
+            LOG.log(Level.FINE, msg.toString());
             Document doc = docBuilder.parse(is.getByteStream());
             DOMSource stream = new DOMSource(doc, is.getSystemId());
             stream.setSystemId(is.getSystemId());
@@ -361,7 +361,7 @@
     public LSInput resolveResource(String type, String namespaceURI, String publicId, String
systemId,
             String baseURI) {
         Message msg = new Message("RESOLVE_SCHEMA", LOG, namespaceURI, systemId, baseURI);
-        LOG.log(Level.INFO, msg.toString());
+        LOG.log(Level.FINE, msg.toString());
         if (NSFILEMAP.containsKey(namespaceURI)) {
             return loadLSInput(namespaceURI);
         }
@@ -398,7 +398,7 @@
                     lsin.setSystemId(resURL);
                     lsin.setByteStream(urlCon.getInputStream());
                     msg = new Message("RESOLVE_FROM_REMOTE", LOG, url);
-                    LOG.log(Level.INFO, msg.toString());
+                    LOG.log(Level.FINE, msg.toString());
                     return lsin;
                 } catch (Exception e) {
                     e.printStackTrace();
@@ -415,7 +415,7 @@
         URIResolver resolver;
         try {
             msg = new Message("RESOLVE_FROM_LOCAL", LOG, localFile);
-            LOG.log(Level.INFO, msg.toString());
+            LOG.log(Level.FINE, msg.toString());
 
             resolver = new URIResolver(localFile);
             if (resolver.isResolved()) {

Modified: cxf/branches/2.0.x-fixes/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/UniqueBodyPartsValidator.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.0.x-fixes/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/UniqueBodyPartsValidator.java?rev=695954&r1=695953&r2=695954&view=diff
==============================================================================
--- cxf/branches/2.0.x-fixes/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/UniqueBodyPartsValidator.java
(original)
+++ cxf/branches/2.0.x-fixes/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/UniqueBodyPartsValidator.java
Tue Sep 16 09:08:00 2008
@@ -19,17 +19,26 @@
 
 package org.apache.cxf.tools.validator.internal;
 
+import java.util.Collection;
 import java.util.HashMap;
-import java.util.Iterator;
+import java.util.HashSet;
+import java.util.List;
 import java.util.Map;
+import java.util.Set;
 
+import javax.wsdl.Binding;
+import javax.wsdl.BindingInput;
+import javax.wsdl.BindingOperation;
 import javax.wsdl.Definition;
 import javax.wsdl.Message;
 import javax.wsdl.Operation;
 import javax.wsdl.Part;
-import javax.wsdl.PortType;
+import javax.wsdl.extensions.ExtensibilityElement;
+import javax.wsdl.extensions.soap.SOAPHeader;
 import javax.xml.namespace.QName;
 
+import org.apache.cxf.helpers.CastUtils;
+
 public class UniqueBodyPartsValidator extends AbstractDefinitionValidator {
     private Map<QName, String> uniqueBodyPartsMap;
 
@@ -38,44 +47,65 @@
     }
 
     public boolean isValid() {
-        Iterator ite = def.getPortTypes().values().iterator();
-        while (ite.hasNext()) {
-            //
-            // Only check for unique body parts per portType.
-            // (Create a new Map for each portType.)
-            //
+        Collection<Binding> bindings = CastUtils.cast(def.getAllBindings().values());
+        for (Binding binding : bindings) {
             uniqueBodyPartsMap = new HashMap<QName, String>();
-            PortType portType = (PortType)ite.next();
-            Iterator ite2 = portType.getOperations().iterator();
-            while (ite2.hasNext()) {
-                Operation operation = (Operation)ite2.next();
+            List<BindingOperation> ops = CastUtils.cast(binding.getBindingOperations());
+            for (BindingOperation op : ops) {
+                Operation operation = op.getOperation();
                 if (operation.getInput() != null) {
                     Message inMessage = operation.getInput().getMessage();
-                    if (inMessage != null && !isUniqueBodyPart(operation.getName(),
inMessage)) {
+                    BindingInput bin = op.getBindingInput();
+                    Set<String> headers = new HashSet<String>();
+                    if (bin != null) {
+                        List<ExtensibilityElement> lst = CastUtils.cast(bin.getExtensibilityElements());
+                        for (ExtensibilityElement ext : lst) {
+                            if (!(ext instanceof SOAPHeader)) {
+                                continue;
+                            }
+                            SOAPHeader header = (SOAPHeader)ext;
+                            if (!header.getMessage().equals(inMessage.getQName())) {
+                                continue;
+                            }
+                            headers.add(header.getPart());
+                        }
+                    }
+                    
+                    //find the headers as they don't contribute to the body
+                    
+                    if (inMessage != null && !isUniqueBodyPart(operation.getName(),

+                                                               inMessage,
+                                                               headers,
+                                                               binding.getQName())) {
                         return false;
                     }
                 }
             }
         }
         return true;
-
     }
 
-    private boolean isUniqueBodyPart(String operationName, Message msg) {
-        Map partsMap = msg.getParts();
-        Iterator ite = partsMap.values().iterator();
-        if (ite.hasNext()) {
-            Part part = (Part)ite.next();
+    private boolean isUniqueBodyPart(String operationName, Message msg,
+                                     Collection<String> headers, QName bindingName)
{
+        List<Part> partList = CastUtils.cast(msg.getOrderedParts(null));
+        for (Part part : partList) {
+            if (headers.contains(part.getName())) {
+                continue;
+            }
             if (part.getElementName() == null) {
                 return true;
             }
             String opName = getOperationNameWithSamePart(operationName, part);
             if (opName != null) {
                 addErrorMessage("Non unique body parts, operation " + "[ " + opName + " ]
"
-                                + "and  operation [ " + operationName + " ] have the same
body block "
+                                + "and  operation [ " + operationName + " ] in binding "
+                                + bindingName.toString()
+                                + " have the same body block: "
                                 + part.getElementName());
                 return false;
             }
+            //just need to check the first element
+            return true;
         }
         return true;
     }

Modified: cxf/branches/2.0.x-fixes/tools/validator/src/test/java/org/apache/cxf/tools/validator/WSDLValidationTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.0.x-fixes/tools/validator/src/test/java/org/apache/cxf/tools/validator/WSDLValidationTest.java?rev=695954&r1=695953&r2=695954&view=diff
==============================================================================
--- cxf/branches/2.0.x-fixes/tools/validator/src/test/java/org/apache/cxf/tools/validator/WSDLValidationTest.java
(original)
+++ cxf/branches/2.0.x-fixes/tools/validator/src/test/java/org/apache/cxf/tools/validator/WSDLValidationTest.java
Tue Sep 16 09:08:00 2008
@@ -160,6 +160,14 @@
         }
 
     }
+    @Test
+    public void testSOAPHeadersInMultiOperations() throws Exception {
+        String[] args = new String[] {"-verbose",
+                                      getLocation("/validator_wsdl/cxf1793.wsdl")};
+        WSDLValidator.main(args);
+        assertTrue(getStdErr(), getStdOut().indexOf("Passed Validation : Valid WSDL") >
-1);
+    }
+
 
     @Test
     public void testWSIBP2210() throws Exception {

Modified: cxf/branches/2.0.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.0.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java?rev=695954&r1=695953&r2=695954&view=diff
==============================================================================
--- cxf/branches/2.0.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java
(original)
+++ cxf/branches/2.0.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java
Tue Sep 16 09:08:00 2008
@@ -1176,4 +1176,14 @@
         assertEquals(1, sei.getMethods().length);
         assertFalse(Void.TYPE.equals(sei.getMethods()[0].getReturnType()));
     }
+
+    @Test
+    public void testsafasdasf()  throws Exception {
+        env.put(ToolConstants.CFG_WSDLURL, 
+                "/tmp/cxf-1793/src/main/resources/com/edb/adnfond/transport/ws/misc/HeaderInRequestMsg.wsdl");
+        env.put(ToolConstants.CFG_EXTRA_SOAPHEADER, "TRUE");
+        env.put(ToolConstants.CFG_VALIDATE_WSDL, ToolConstants.CFG_VALIDATE_WSDL);
+        processor.setContext(env);
+        processor.execute();
+    }
 }



Mime
View raw message