You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2007/10/20 21:16:45 UTC

svn commit: r586779 - in /incubator/cxf/branches/2.0.x-fixes: ./ tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/WSIBPValidator.java tools/validator/src/test/java/org/apache/cxf/tools/validator/WSDLValidationTest.java

Author: dkulp
Date: Sat Oct 20 12:16:44 2007
New Revision: 586779

URL: http://svn.apache.org/viewvc?rev=586779&view=rev
Log:
Merged revisions 586045 via svnmerge from 
https://svn.apache.org/repos/asf/incubator/cxf/trunk

........
  r586045 | gmazza | 2007-10-18 14:14:36 -0400 (Thu, 18 Oct 2007) | 1 line
  
  Changed formatting of error messages for validation.
........

Modified:
    incubator/cxf/branches/2.0.x-fixes/   (props changed)
    incubator/cxf/branches/2.0.x-fixes/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/WSIBPValidator.java
    incubator/cxf/branches/2.0.x-fixes/tools/validator/src/test/java/org/apache/cxf/tools/validator/WSDLValidationTest.java

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

Modified: incubator/cxf/branches/2.0.x-fixes/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/WSIBPValidator.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/WSIBPValidator.java?rev=586779&r1=586778&r2=586779&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/WSIBPValidator.java (original)
+++ incubator/cxf/branches/2.0.x-fixes/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/WSIBPValidator.java Sat Oct 20 12:16:44 2007
@@ -78,7 +78,7 @@
         SoapBody outSoapBody = SOAPBindingUtil.getBindingOutputSOAPBody(bop);
         if (inSoapBody != null && !StringUtils.isEmpty(inSoapBody.getNamespaceURI())
             || outSoapBody != null && !StringUtils.isEmpty(outSoapBody.getNamespaceURI())) {
-            addErrorMessage("Violate WSI-BP-1.0 R2716 operation '"
+            addErrorMessage(getErrorPrefix("WSI-BP-1.0 R2716") + "Operation '"
                             + bop.getName() + "' soapBody MUST NOT have namespace attribute");
             return false;
         }
@@ -87,7 +87,7 @@
         SoapHeader outSoapHeader = SOAPBindingUtil.getBindingOutputSOAPHeader(bop);
         if (inSoapHeader != null && !StringUtils.isEmpty(inSoapHeader.getNamespaceURI())
             || outSoapHeader != null && !StringUtils.isEmpty(outSoapHeader.getNamespaceURI())) {
-            addErrorMessage("Violate WSI-BP-1.0 R2716 operation '"
+            addErrorMessage(getErrorPrefix("WSI-BP-1.0 R2716") + "Operation '"
                             + bop.getName() + "' soapHeader MUST NOT have namespace attribute");
             return false;
         }
@@ -95,7 +95,7 @@
         List<SoapFault> soapFaults = SOAPBindingUtil.getBindingOperationSoapFaults(bop);
         for (SoapFault fault : soapFaults) {
             if (!StringUtils.isEmpty(fault.getNamespaceURI())) {
-                addErrorMessage("Violate WSI-BP-1.0 R2716 operation '"
+                addErrorMessage(getErrorPrefix("WSI-BP-1.0 R2716") + "Operation '"
                                 + bop.getName() + "' soapFault MUST NOT have namespace attribute");
                 return false;
             }
@@ -111,8 +111,9 @@
         SoapBody outSoapBody = SOAPBindingUtil.getBindingOutputSOAPBody(bop);
         if (inSoapBody != null && StringUtils.isEmpty(inSoapBody.getNamespaceURI())
             || outSoapBody != null && StringUtils.isEmpty(outSoapBody.getNamespaceURI())) {
-            addErrorMessage("Violate WSI-BP-1.0 R2717 soapBody in the input/output of the binding operation '"
-                            + bop.getName() + "' MUST have namespace attribute");
+            addErrorMessage(getErrorPrefix("WSI-BP-1.0 R2717")  
+                + "soapBody in the input/output of the binding operation '"
+                + bop.getName() + "' MUST have namespace attribute");
             return false;
         }
 
@@ -120,7 +121,7 @@
         SoapHeader outSoapHeader = SOAPBindingUtil.getBindingOutputSOAPHeader(bop);
         if (inSoapHeader != null && !StringUtils.isEmpty(inSoapHeader.getNamespaceURI())
             || outSoapHeader != null && !StringUtils.isEmpty(outSoapHeader.getNamespaceURI())) {
-            addErrorMessage("Violate WSI-BP-1.0 R2726 operation '"
+            addErrorMessage(getErrorPrefix("WSI-BP-1.0 R2726") + "Operation '"
                             + bop.getName() + "' soapHeader MUST NOT have namespace attribute");
             return false;
         }
@@ -128,7 +129,7 @@
         List<SoapFault> soapFaults = SOAPBindingUtil.getBindingOperationSoapFaults(bop);
         for (SoapFault fault : soapFaults) {
             if (!StringUtils.isEmpty(fault.getNamespaceURI())) {
-                addErrorMessage("Violate WSI-BP-1.0 R2726 operation '"
+                addErrorMessage(getErrorPrefix("WSI-BP-1.0 R2726") + "Operation '"
                                 + bop.getName() + "' soapFault MUST NOT have namespace attribute");
                 return false;
             }
@@ -163,7 +164,7 @@
                         }
                     }
                     if (!isDefined) {
-                        addErrorMessage("Violate WSI-BP-1.0 R2201 operation '"
+                        addErrorMessage(getErrorPrefix("WSI-BP-1.0 R2201") + "Operation '"
                                         + operation.getName() + "' soapBody parts : "
                                         + partName + " not found in the message, wrong WSDL");
                         return false;
@@ -171,7 +172,7 @@
                 }
             } else {
                 if (partsList.size() > 1) {
-                    addErrorMessage("Violate WSI-BP-1.0 R2210:  operation '" + operation.getName()
+                    addErrorMessage(getErrorPrefix("WSI-BP-1.0 R2210") + "Operation '" + operation.getName()
                                     + "' more than one part bound to body");
                     return false;
                 }
@@ -179,7 +180,7 @@
 
 
             if (boundPartSize > 1) {
-                addErrorMessage("Violate WSI-BP-1.0  R2201 operation '" + operation.getName()
+                addErrorMessage(getErrorPrefix("WSI-BP-1.0 R2201") + "Operation '" + operation.getName()
                                 + "' more than one part bound to body");
                 return false;
             }
@@ -212,7 +213,7 @@
                         }
                     }
                     if (!isDefined) {
-                        addErrorMessage("Violate WSI-BP-1.0 R2201 operation '"
+                        addErrorMessage(getErrorPrefix("WSI-BP-1.0 R2201") + "Operation '"
                                         + operation.getName() + "' soapBody parts : "
                                         + partName + " not found in the message, wrong WSDL");
                         return false;
@@ -221,14 +222,14 @@
                 }
             } else {
                 if (wsdlHelper.getOutMessageParts(operation).size() > 1) {
-                    addErrorMessage("Violate WSI-BP-1.0 R2210:  operation '" + operation.getName()
+                    addErrorMessage(getErrorPrefix("WSI-BP-1.0 R2210") + "Operation '" + operation.getName()
                                     + "' more than one part bound to body");
                     return false;
                 }
             }
 
             if (boundPartSize > 1) {
-                addErrorMessage("Violate WSI-BP-1.0 R2201 operation '" + operation.getName()
+                addErrorMessage(getErrorPrefix("WSI-BP-1.0 R2201") + "Operation '" + operation.getName()
                                 + "' more than one part bound to body");
                 return false;
             }
@@ -373,9 +374,9 @@
                     Collection<Part> parts = message.getParts().values();
                     for (Part part : parts) {
                         if (part.getElementName() == null) {
-                            addErrorMessage("Violate WSI-BP-1.0 R2205: In Message " + message.getQName()
-                                            + ", part " + part.getName()
-                                            + " must specify a 'element' attribute");
+                            addErrorMessage(getErrorPrefix("WSI-BP-1.0 R2205") + "In Message " 
+                                + message.getQName() + ", part " + part.getName()
+                                    + " must specify a 'element' attribute");
                             return false;
                         }
                     }
@@ -407,4 +408,7 @@
         return false;
     }
 
+    private static String getErrorPrefix(String ruleBroken) {
+        return ruleBroken + " violation: ";
+    }
 }

Modified: incubator/cxf/branches/2.0.x-fixes/tools/validator/src/test/java/org/apache/cxf/tools/validator/WSDLValidationTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/tools/validator/src/test/java/org/apache/cxf/tools/validator/WSDLValidationTest.java?rev=586779&r1=586778&r2=586779&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/tools/validator/src/test/java/org/apache/cxf/tools/validator/WSDLValidationTest.java (original)
+++ incubator/cxf/branches/2.0.x-fixes/tools/validator/src/test/java/org/apache/cxf/tools/validator/WSDLValidationTest.java Sat Oct 20 12:16:44 2007
@@ -227,8 +227,8 @@
                                           getLocation("/validator_wsdl/cxf996.wsdl")};
             WSDLValidator.main(args);
         } catch (Exception e) {
-            assertTrue(getStdErr().indexOf("WSI-BP-1.0 R2717:  ") == -1);
-            assertTrue(getStdErr().indexOf("WSI-BP-1.0 R2210:  ") != -1);
+            assertTrue(getStdErr().indexOf("WSI-BP-1.0 R2717") == -1);
+            assertTrue(getStdErr().indexOf("WSI-BP-1.0 R2210") != -1);
         }
 
         try {
@@ -236,7 +236,7 @@
                                           getLocation("/validator_wsdl/bp2717.wsdl")};
             WSDLValidator.main(args);
         } catch (Exception e) {
-            assertTrue(getStdErr().indexOf("WSI-BP-1.0 R2717:  ") != -1);
+            assertTrue(getStdErr().indexOf("WSI-BP-1.0 R2717") != -1);
         }
     }