cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gma...@apache.org
Subject svn commit: r586045 - in /incubator/cxf/trunk/tools/validator/src: main/java/org/apache/cxf/tools/validator/internal/WSIBPValidator.java test/java/org/apache/cxf/tools/validator/WSDLValidationTest.java
Date Thu, 18 Oct 2007 18:14:37 GMT
Author: gmazza
Date: Thu Oct 18 11:14:36 2007
New Revision: 586045

URL: http://svn.apache.org/viewvc?rev=586045&view=rev
Log:
Changed formatting of error messages for validation.

Modified:
    incubator/cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/WSIBPValidator.java
    incubator/cxf/trunk/tools/validator/src/test/java/org/apache/cxf/tools/validator/WSDLValidationTest.java

Modified: incubator/cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/WSIBPValidator.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/WSIBPValidator.java?rev=586045&r1=586044&r2=586045&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/WSIBPValidator.java
(original)
+++ incubator/cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/WSIBPValidator.java
Thu Oct 18 11:14:36 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/trunk/tools/validator/src/test/java/org/apache/cxf/tools/validator/WSDLValidationTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/validator/src/test/java/org/apache/cxf/tools/validator/WSDLValidationTest.java?rev=586045&r1=586044&r2=586045&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/validator/src/test/java/org/apache/cxf/tools/validator/WSDLValidationTest.java
(original)
+++ incubator/cxf/trunk/tools/validator/src/test/java/org/apache/cxf/tools/validator/WSDLValidationTest.java
Thu Oct 18 11:14:36 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);
         }
     }
 



Mime
View raw message