ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From veit...@apache.org
Subject svn commit: r1598841 - in /webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap: SOAPSpec.java SOAPTestSuiteBuilder.java headerblock/TestSetMustUnderstandBoolean.java
Date Sat, 31 May 2014 09:20:22 GMT
Author: veithen
Date: Sat May 31 09:20:21 2014
New Revision: 1598841

URL: http://svn.apache.org/r1598841
Log:
Centralize all knowledge about boolean representations in different SOAP versions.

Modified:
    webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPSpec.java
    webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPTestSuiteBuilder.java
    webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/headerblock/TestSetMustUnderstandBoolean.java

Modified: webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPSpec.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPSpec.java?rev=1598841&r1=1598840&r2=1598841&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPSpec.java
(original)
+++ webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPSpec.java
Sat May 31 09:20:21 2014
@@ -50,6 +50,10 @@ public abstract class SOAPSpec {
         public String getEnvelopeNamespaceURI() {
             return SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI;
         }
+
+        public String getCanonicalRepresentation(boolean value) {
+            return value ? "1" : "0";
+        }
     };
 
     public static final SOAPSpec SOAP12 = new SOAPSpec(SOAP12Version.getSingleton(),
@@ -69,6 +73,10 @@ public abstract class SOAPSpec {
         public String getEnvelopeNamespaceURI() {
             return SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI;
         }
+
+        public String getCanonicalRepresentation(boolean value) {
+            return String.valueOf(value);
+        }
     };
 
     private final SOAPVersion version;
@@ -111,6 +119,16 @@ public abstract class SOAPSpec {
         return (BooleanLiteral[])booleanLiterals.clone();
     }
 
+    /**
+     * Get the canonical representation for the given boolean value as specified by this
SOAP
+     * version.
+     * 
+     * @param value
+     *            the boolean value
+     * @return the canonical representation
+     */
+    public abstract String getCanonicalRepresentation(boolean value);
+    
     public final String getNextRoleURI() {
         return version.getNextRoleURI();
     }

Modified: webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPTestSuiteBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPTestSuiteBuilder.java?rev=1598841&r1=1598840&r2=1598841&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPTestSuiteBuilder.java
(original)
+++ webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPTestSuiteBuilder.java
Sat May 31 09:20:21 2014
@@ -231,8 +231,8 @@ public class SOAPTestSuiteBuilder extend
         addTest(new org.apache.axiom.ts.soap.headerblock.TestGetMustUnderstand(metaFactory,
spec));
         addTest(new org.apache.axiom.ts.soap.headerblock.TestGetRole(metaFactory, spec));
         addTest(new org.apache.axiom.ts.soap.headerblock.TestGetVersion(metaFactory, spec));
-        addTest(new org.apache.axiom.ts.soap.headerblock.TestSetMustUnderstandBoolean(metaFactory,
spec, true, spec == SOAPSpec.SOAP11 ? "1" : "true"));
-        addTest(new org.apache.axiom.ts.soap.headerblock.TestSetMustUnderstandBoolean(metaFactory,
spec, false, spec == SOAPSpec.SOAP11 ? "0" : "false"));
+        addTest(new org.apache.axiom.ts.soap.headerblock.TestSetMustUnderstandBoolean(metaFactory,
spec, true));
+        addTest(new org.apache.axiom.ts.soap.headerblock.TestSetMustUnderstandBoolean(metaFactory,
spec, false));
         for (int i=0; i<booleanLiterals.length; i++) {
             addTest(new org.apache.axiom.ts.soap.headerblock.TestSetMustUnderstandString(metaFactory,
spec, booleanLiterals[i]));
         }

Modified: webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/headerblock/TestSetMustUnderstandBoolean.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/headerblock/TestSetMustUnderstandBoolean.java?rev=1598841&r1=1598840&r2=1598841&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/headerblock/TestSetMustUnderstandBoolean.java
(original)
+++ webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/headerblock/TestSetMustUnderstandBoolean.java
Sat May 31 09:20:21 2014
@@ -30,13 +30,11 @@ import org.apache.axiom.ts.soap.SOAPTest
 
 public class TestSetMustUnderstandBoolean extends SOAPTestCase {
     private final boolean value;
-    private final String stringValue;
     
-    public TestSetMustUnderstandBoolean(OMMetaFactory metaFactory, SOAPSpec spec, boolean
value, String stringValue) {
+    public TestSetMustUnderstandBoolean(OMMetaFactory metaFactory, SOAPSpec spec, boolean
value) {
         super(metaFactory, spec);
         addTestParameter("value", value);
         this.value = value;
-        this.stringValue = stringValue;
     }
 
     protected void runTest() throws Throwable {
@@ -49,7 +47,7 @@ public class TestSetMustUnderstandBoolea
         OMNamespace ns = att.getNamespace();
         assertEquals(spec.getEnvelopeNamespaceURI(), ns.getNamespaceURI());
         assertEquals(SOAPConstants.ATTR_MUSTUNDERSTAND, att.getLocalName());
-        assertEquals(stringValue, att.getAttributeValue());
+        assertEquals(spec.getCanonicalRepresentation(value), att.getAttributeValue());
         assertFalse(it.hasNext());
     }
 }



Mime
View raw message