You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ws.apache.org by ve...@apache.org on 2015/05/31 14:43:59 UTC
svn commit: r1682728 - in /webservices/axiom/trunk:
axiom-api/src/test/resources/soap/soap11/
axiom-api/src/test/resources/soap/soap12/
testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/
testing/axiom-testsuite/src/main/java/org/apache/axi...
Author: veithen
Date: Sun May 31 12:43:58 2015
New Revision: 1682728
URL: http://svn.apache.org/r1682728
Log:
Unify TestGetHeadersToProcessWithParser.
Added:
webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/HeaderBlockAttributeAdapterFactory.java
- copied, changed from r1682628, webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/BooleanAttributeAdapterFactory.java
webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/header/TestGetHeadersToProcessWithParser.java
- copied, changed from r1682726, webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap12/header/TestGetHeadersToProcessWithParser.java
webservices/axiom/trunk/testing/soap-testsuite/src/main/java/org/apache/axiom/ts/soap/HeaderBlockAttribute.java
- copied, changed from r1682628, webservices/axiom/trunk/testing/soap-testsuite/src/main/java/org/apache/axiom/ts/soap/BooleanAttribute.java
webservices/axiom/trunk/testing/soap-testsuite/src/main/resources/test-message/set/roles.xml
- copied, changed from r1682628, webservices/axiom/trunk/axiom-api/src/test/resources/soap/soap12/roleMessage.xml
Removed:
webservices/axiom/trunk/axiom-api/src/test/resources/soap/soap11/roleMessage.xml
webservices/axiom/trunk/axiom-api/src/test/resources/soap/soap12/roleMessage.xml
webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/BooleanAttributeAdapterFactory.java
webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap11/header/TestGetHeadersToProcessWithParser.java
webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap12/header/TestGetHeadersToProcessWithParser.java
webservices/axiom/trunk/testing/soap-testsuite/src/main/java/org/apache/axiom/ts/soap/BooleanAttribute.java
Modified:
webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/BooleanAttributeAccessor.java
webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPTestSuiteBuilder.java
webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/header/MyRolePlayer.java
webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/headerblock/BooleanAttributeTestCase.java
webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/headerblock/TestGetBooleanAttribute.java
webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/headerblock/TestGetBooleanAttributeDefault.java
webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/headerblock/TestGetBooleanAttributeInvalid.java
webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/headerblock/TestGetBooleanAttributeUnspported.java
webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/headerblock/TestSetBooleanAttribute.java
webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/headerblock/TestSetBooleanAttributeUnsupported.java
webservices/axiom/trunk/testing/axiom-testsuite/src/main/resources/META-INF/services/org.apache.axiom.testing.multiton.AdapterFactory
webservices/axiom/trunk/testing/soap-testsuite/src/main/java/org/apache/axiom/ts/soap/ConvertedSOAPSampleContent.java
webservices/axiom/trunk/testing/soap-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPSampleSet.java
Modified: webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/BooleanAttributeAccessor.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/BooleanAttributeAccessor.java?rev=1682728&r1=1682727&r2=1682728&view=diff
==============================================================================
--- webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/BooleanAttributeAccessor.java (original)
+++ webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/BooleanAttributeAccessor.java Sun May 31 12:43:58 2015
@@ -22,7 +22,7 @@ import org.apache.axiom.soap.SOAPHeaderB
import org.apache.axiom.testing.multiton.AdapterType;
/**
- * {@link BooleanAttribute} adapter that allows to invoke the getter and setter methods for the
+ * {@link HeaderBlockAttribute} adapter that allows to invoke the getter and setter methods for the
* attribute on a given {@link SOAPHeaderBlock}.
*/
@AdapterType
Copied: webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/HeaderBlockAttributeAdapterFactory.java (from r1682628, webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/BooleanAttributeAdapterFactory.java)
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/HeaderBlockAttributeAdapterFactory.java?p2=webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/HeaderBlockAttributeAdapterFactory.java&p1=webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/BooleanAttributeAdapterFactory.java&r1=1682628&r2=1682728&rev=1682728&view=diff
==============================================================================
--- webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/BooleanAttributeAdapterFactory.java (original)
+++ webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/HeaderBlockAttributeAdapterFactory.java Sun May 31 12:43:58 2015
@@ -22,9 +22,9 @@ import org.apache.axiom.soap.SOAPHeaderB
import org.apache.axiom.testing.multiton.AdapterFactory;
import org.apache.axiom.testing.multiton.Adapters;
-public class BooleanAttributeAdapterFactory implements AdapterFactory<BooleanAttribute> {
- public void createAdapters(BooleanAttribute attribute, Adapters adapters) {
- if (attribute == BooleanAttribute.MUST_UNDERSTAND) {
+public class HeaderBlockAttributeAdapterFactory implements AdapterFactory<HeaderBlockAttribute> {
+ public void createAdapters(HeaderBlockAttribute attribute, Adapters adapters) {
+ if (attribute == HeaderBlockAttribute.MUST_UNDERSTAND) {
adapters.add(new BooleanAttributeAccessor() {
public boolean getValue(SOAPHeaderBlock headerBlock) {
return headerBlock.getMustUnderstand();
@@ -34,7 +34,7 @@ public class BooleanAttributeAdapterFact
headerBlock.setMustUnderstand(value);
}
});
- } else if (attribute == BooleanAttribute.RELAY) {
+ } else if (attribute == HeaderBlockAttribute.RELAY) {
adapters.add(new BooleanAttributeAccessor() {
public boolean getValue(SOAPHeaderBlock headerBlock) {
return headerBlock.getRelay();
Modified: webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPTestSuiteBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPTestSuiteBuilder.java?rev=1682728&r1=1682727&r2=1682728&view=diff
==============================================================================
--- webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPTestSuiteBuilder.java (original)
+++ webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPTestSuiteBuilder.java Sun May 31 12:43:58 2015
@@ -229,20 +229,23 @@ public class SOAPTestSuiteBuilder extend
addTest(new org.apache.axiom.ts.soap.header.TestExtractAllHeaderBlocks(metaFactory, spec));
addTest(new org.apache.axiom.ts.soap.header.TestGetHeaderBlocksWithNSURI(metaFactory, spec));
addTest(new org.apache.axiom.ts.soap.header.TestGetHeadersToProcessWithNamespace(metaFactory, spec));
- for (BooleanAttribute attribute : getInstances(BooleanAttribute.class)) {
- if (attribute.isSupported(spec)) {
- for (int j=0; j<booleanLiterals.length; j++) {
- addTest(new org.apache.axiom.ts.soap.headerblock.TestGetBooleanAttribute(metaFactory, spec, attribute, booleanLiterals[j]));
- }
- addTest(new org.apache.axiom.ts.soap.headerblock.TestGetBooleanAttributeDefault(metaFactory, spec, attribute));
- for (int j=0; j<invalidBooleanLiterals.length; j++) {
- addTest(new org.apache.axiom.ts.soap.headerblock.TestGetBooleanAttributeInvalid(metaFactory, spec, attribute, invalidBooleanLiterals[j]));
+ addTest(new org.apache.axiom.ts.soap.header.TestGetHeadersToProcessWithParser(metaFactory, spec));
+ for (HeaderBlockAttribute attribute : getInstances(HeaderBlockAttribute.class)) {
+ if (attribute.isBoolean()) {
+ if (attribute.isSupported(spec)) {
+ for (int j=0; j<booleanLiterals.length; j++) {
+ addTest(new org.apache.axiom.ts.soap.headerblock.TestGetBooleanAttribute(metaFactory, spec, attribute, booleanLiterals[j]));
+ }
+ addTest(new org.apache.axiom.ts.soap.headerblock.TestGetBooleanAttributeDefault(metaFactory, spec, attribute));
+ for (int j=0; j<invalidBooleanLiterals.length; j++) {
+ addTest(new org.apache.axiom.ts.soap.headerblock.TestGetBooleanAttributeInvalid(metaFactory, spec, attribute, invalidBooleanLiterals[j]));
+ }
+ addTest(new org.apache.axiom.ts.soap.headerblock.TestSetBooleanAttribute(metaFactory, spec, attribute, true));
+ addTest(new org.apache.axiom.ts.soap.headerblock.TestSetBooleanAttribute(metaFactory, spec, attribute, false));
+ } else {
+ addTest(new org.apache.axiom.ts.soap.headerblock.TestGetBooleanAttributeUnspported(metaFactory, spec, attribute));
+ addTest(new org.apache.axiom.ts.soap.headerblock.TestSetBooleanAttributeUnsupported(metaFactory, spec, attribute));
}
- addTest(new org.apache.axiom.ts.soap.headerblock.TestSetBooleanAttribute(metaFactory, spec, attribute, true));
- addTest(new org.apache.axiom.ts.soap.headerblock.TestSetBooleanAttribute(metaFactory, spec, attribute, false));
- } else {
- addTest(new org.apache.axiom.ts.soap.headerblock.TestGetBooleanAttributeUnspported(metaFactory, spec, attribute));
- addTest(new org.apache.axiom.ts.soap.headerblock.TestSetBooleanAttributeUnsupported(metaFactory, spec, attribute));
}
}
if (supportsOMSourcedElement) {
@@ -323,7 +326,6 @@ public class SOAPTestSuiteBuilder extend
addTest(new org.apache.axiom.ts.soap11.header.TestExamineHeaderBlocksWithParser(metaFactory));
addTest(new org.apache.axiom.ts.soap11.header.TestExamineMustUnderstandHeaderBlocksWithParser(metaFactory));
addTest(new org.apache.axiom.ts.soap11.header.TestGetHeaderBlocksWithNSURIWithParser(metaFactory));
- addTest(new org.apache.axiom.ts.soap11.header.TestGetHeadersToProcessWithParser(metaFactory));
addTest(new org.apache.axiom.ts.soap11.headerblock.TestGetMustUnderstandWithParser(metaFactory));
addTest(new org.apache.axiom.ts.soap11.headerblock.TestGetRoleWithParser(metaFactory));
if (supportsOMSourcedElement) {
@@ -359,7 +361,6 @@ public class SOAPTestSuiteBuilder extend
addTest(new org.apache.axiom.ts.soap12.header.TestExamineMustUnderstandHeaderBlocks(metaFactory));
addTest(new org.apache.axiom.ts.soap12.header.TestExamineMustUnderstandHeaderBlocksWithParser(metaFactory));
addTest(new org.apache.axiom.ts.soap12.header.TestGetHeaderBlocksWithNSURIWithParser(metaFactory));
- addTest(new org.apache.axiom.ts.soap12.header.TestGetHeadersToProcessWithParser(metaFactory));
addTest(new org.apache.axiom.ts.soap12.headerblock.TestGetMustUnderstandWithParser(metaFactory));
addTest(new org.apache.axiom.ts.soap12.headerblock.TestGetRelayWithParser(metaFactory));
addTest(new org.apache.axiom.ts.soap12.headerblock.TestGetRoleWithParser(metaFactory));
Modified: webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/header/MyRolePlayer.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/header/MyRolePlayer.java?rev=1682728&r1=1682727&r2=1682728&view=diff
==============================================================================
--- webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/header/MyRolePlayer.java (original)
+++ webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/header/MyRolePlayer.java Sun May 31 12:43:58 2015
@@ -24,8 +24,6 @@ import java.util.List;
import org.apache.axiom.soap.RolePlayer;
public final class MyRolePlayer implements RolePlayer {
- public static final String CUSTOM_ROLE = "http://example.org/myCustomRole";
-
boolean ultimateReceiver;
List roles;
public MyRolePlayer(boolean ultimateReceiver) {
Copied: webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/header/TestGetHeadersToProcessWithParser.java (from r1682726, webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap12/header/TestGetHeadersToProcessWithParser.java)
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/header/TestGetHeadersToProcessWithParser.java?p2=webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/header/TestGetHeadersToProcessWithParser.java&p1=webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap12/header/TestGetHeadersToProcessWithParser.java&r1=1682726&r2=1682728&rev=1682728&view=diff
==============================================================================
--- webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap12/header/TestGetHeadersToProcessWithParser.java (original)
+++ webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/header/TestGetHeadersToProcessWithParser.java Sun May 31 12:43:58 2015
@@ -17,7 +17,7 @@
* under the License.
*/
-package org.apache.axiom.ts.soap12.header;
+package org.apache.axiom.ts.soap.header;
import java.util.Iterator;
@@ -25,21 +25,20 @@ import org.apache.axiom.soap.RolePlayer;
import org.apache.axiom.soap.SOAPEnvelope;
import org.apache.axiom.soap.SOAPHeader;
import org.apache.axiom.soap.SOAPHeaderBlock;
+import org.apache.axiom.ts.soap.SOAPSampleSet;
import org.apache.axiom.ts.soap.SOAPSpec;
-import org.apache.axiom.ts.soap.SOAPTestCase;
-import org.apache.axiom.ts.soap.header.MyRolePlayer;
+import org.apache.axiom.ts.soap.SampleBasedSOAPTestCase;
import org.apache.axiom.om.OMMetaFactory;
-public class TestGetHeadersToProcessWithParser extends SOAPTestCase {
- public TestGetHeadersToProcessWithParser(OMMetaFactory metaFactory) {
- super(metaFactory, SOAPSpec.SOAP12);
+public class TestGetHeadersToProcessWithParser extends SampleBasedSOAPTestCase {
+ public TestGetHeadersToProcessWithParser(OMMetaFactory metaFactory, SOAPSpec spec) {
+ super(metaFactory, spec, SOAPSampleSet.ROLES);
}
- protected void runTest() throws Throwable {
- SOAPEnvelope env = getTestMessage("roleMessage.xml");
- SOAPHeader soapHeader = env.getHeader();
+ protected void runTest(SOAPEnvelope envelope) throws Throwable {
+ SOAPHeader soapHeader = envelope.getHeader();
- String roles [] = { MyRolePlayer.CUSTOM_ROLE };
+ String roles [] = { "http://example.org/myCustomRole" };
RolePlayer rp = new MyRolePlayer(true, roles);
Iterator headers = soapHeader.getHeadersToProcess(rp);
@@ -79,7 +78,5 @@ public class TestGetHeadersToProcessWith
}
assertEquals("Didn't get right number of headers (no custom role)", 1, numHeaders);
-
- env.close(false);
}
}
Modified: webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/headerblock/BooleanAttributeTestCase.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/headerblock/BooleanAttributeTestCase.java?rev=1682728&r1=1682727&r2=1682728&view=diff
==============================================================================
--- webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/headerblock/BooleanAttributeTestCase.java (original)
+++ webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/headerblock/BooleanAttributeTestCase.java Sun May 31 12:43:58 2015
@@ -19,16 +19,16 @@
package org.apache.axiom.ts.soap.headerblock;
import org.apache.axiom.om.OMMetaFactory;
-import org.apache.axiom.ts.soap.BooleanAttribute;
+import org.apache.axiom.ts.soap.HeaderBlockAttribute;
import org.apache.axiom.ts.soap.SOAPSpec;
import org.apache.axiom.ts.soap.SOAPTestCase;
public abstract class BooleanAttributeTestCase extends SOAPTestCase {
- protected final BooleanAttribute attribute;
+ protected final HeaderBlockAttribute attribute;
- public BooleanAttributeTestCase(OMMetaFactory metaFactory, SOAPSpec spec, BooleanAttribute attribute) {
+ public BooleanAttributeTestCase(OMMetaFactory metaFactory, SOAPSpec spec, HeaderBlockAttribute attribute) {
super(metaFactory, spec);
this.attribute = attribute;
- addTestParameter("attribute", attribute.getName());
+ addTestParameter("attribute", attribute.getName(spec));
}
}
Modified: webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/headerblock/TestGetBooleanAttribute.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/headerblock/TestGetBooleanAttribute.java?rev=1682728&r1=1682727&r2=1682728&view=diff
==============================================================================
--- webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/headerblock/TestGetBooleanAttribute.java (original)
+++ webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/headerblock/TestGetBooleanAttribute.java Sun May 31 12:43:58 2015
@@ -23,7 +23,7 @@ import javax.xml.namespace.QName;
import org.apache.axiom.om.OMMetaFactory;
import org.apache.axiom.soap.SOAPHeader;
import org.apache.axiom.soap.SOAPHeaderBlock;
-import org.apache.axiom.ts.soap.BooleanAttribute;
+import org.apache.axiom.ts.soap.HeaderBlockAttribute;
import org.apache.axiom.ts.soap.BooleanAttributeAccessor;
import org.apache.axiom.ts.soap.BooleanLiteral;
import org.apache.axiom.ts.soap.SOAPSpec;
@@ -31,7 +31,7 @@ import org.apache.axiom.ts.soap.SOAPSpec
public class TestGetBooleanAttribute extends BooleanAttributeTestCase {
private final BooleanLiteral literal;
- public TestGetBooleanAttribute(OMMetaFactory metaFactory, SOAPSpec spec, BooleanAttribute attribute, BooleanLiteral literal) {
+ public TestGetBooleanAttribute(OMMetaFactory metaFactory, SOAPSpec spec, HeaderBlockAttribute attribute, BooleanLiteral literal) {
super(metaFactory, spec, attribute);
this.literal = literal;
addTestParameter("literal", literal.getLexicalRepresentation());
@@ -40,7 +40,7 @@ public class TestGetBooleanAttribute ext
protected void runTest() throws Throwable {
SOAPHeader header = soapFactory.getDefaultEnvelope().getOrCreateHeader();
SOAPHeaderBlock headerBlock = header.addHeaderBlock(new QName("http://example.org", "test", "h"));
- headerBlock.addAttribute(attribute.getName(), literal.getLexicalRepresentation(), header.getNamespace());
+ headerBlock.addAttribute(attribute.getName(spec), literal.getLexicalRepresentation(), header.getNamespace());
assertEquals(literal.getValue(), attribute.getAdapter(BooleanAttributeAccessor.class).getValue(headerBlock));
}
}
Modified: webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/headerblock/TestGetBooleanAttributeDefault.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/headerblock/TestGetBooleanAttributeDefault.java?rev=1682728&r1=1682727&r2=1682728&view=diff
==============================================================================
--- webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/headerblock/TestGetBooleanAttributeDefault.java (original)
+++ webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/headerblock/TestGetBooleanAttributeDefault.java Sun May 31 12:43:58 2015
@@ -23,7 +23,7 @@ import javax.xml.namespace.QName;
import org.apache.axiom.om.OMMetaFactory;
import org.apache.axiom.soap.SOAPHeader;
import org.apache.axiom.soap.SOAPHeaderBlock;
-import org.apache.axiom.ts.soap.BooleanAttribute;
+import org.apache.axiom.ts.soap.HeaderBlockAttribute;
import org.apache.axiom.ts.soap.BooleanAttributeAccessor;
import org.apache.axiom.ts.soap.SOAPSpec;
@@ -33,7 +33,7 @@ import org.apache.axiom.ts.soap.SOAPSpec
* absent.
*/
public class TestGetBooleanAttributeDefault extends BooleanAttributeTestCase {
- public TestGetBooleanAttributeDefault(OMMetaFactory metaFactory, SOAPSpec spec, BooleanAttribute attribute) {
+ public TestGetBooleanAttributeDefault(OMMetaFactory metaFactory, SOAPSpec spec, HeaderBlockAttribute attribute) {
super(metaFactory, spec, attribute);
}
Modified: webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/headerblock/TestGetBooleanAttributeInvalid.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/headerblock/TestGetBooleanAttributeInvalid.java?rev=1682728&r1=1682727&r2=1682728&view=diff
==============================================================================
--- webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/headerblock/TestGetBooleanAttributeInvalid.java (original)
+++ webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/headerblock/TestGetBooleanAttributeInvalid.java Sun May 31 12:43:58 2015
@@ -24,7 +24,7 @@ import org.apache.axiom.om.OMMetaFactory
import org.apache.axiom.soap.SOAPHeader;
import org.apache.axiom.soap.SOAPHeaderBlock;
import org.apache.axiom.soap.SOAPProcessingException;
-import org.apache.axiom.ts.soap.BooleanAttribute;
+import org.apache.axiom.ts.soap.HeaderBlockAttribute;
import org.apache.axiom.ts.soap.BooleanAttributeAccessor;
import org.apache.axiom.ts.soap.SOAPSpec;
@@ -36,7 +36,7 @@ import org.apache.axiom.ts.soap.SOAPSpec
public class TestGetBooleanAttributeInvalid extends BooleanAttributeTestCase {
private final String value;
- public TestGetBooleanAttributeInvalid(OMMetaFactory metaFactory, SOAPSpec spec, BooleanAttribute attribute, String value) {
+ public TestGetBooleanAttributeInvalid(OMMetaFactory metaFactory, SOAPSpec spec, HeaderBlockAttribute attribute, String value) {
super(metaFactory, spec, attribute);
this.value = value;
addTestParameter("value", value);
@@ -45,7 +45,7 @@ public class TestGetBooleanAttributeInva
protected void runTest() throws Throwable {
SOAPHeader header = soapFactory.getDefaultEnvelope().getOrCreateHeader();
SOAPHeaderBlock headerBlock = header.addHeaderBlock(new QName("urn:test", "test", "p"));
- headerBlock.addAttribute(attribute.getName(), value, header.getNamespace());
+ headerBlock.addAttribute(attribute.getName(spec), value, header.getNamespace());
try {
attribute.getAdapter(BooleanAttributeAccessor.class).getValue(headerBlock);
fail("Expected SOAPProcessingException");
Modified: webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/headerblock/TestGetBooleanAttributeUnspported.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/headerblock/TestGetBooleanAttributeUnspported.java?rev=1682728&r1=1682727&r2=1682728&view=diff
==============================================================================
--- webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/headerblock/TestGetBooleanAttributeUnspported.java (original)
+++ webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/headerblock/TestGetBooleanAttributeUnspported.java Sun May 31 12:43:58 2015
@@ -23,7 +23,7 @@ import javax.xml.namespace.QName;
import org.apache.axiom.om.OMMetaFactory;
import org.apache.axiom.soap.SOAPHeader;
import org.apache.axiom.soap.SOAPHeaderBlock;
-import org.apache.axiom.ts.soap.BooleanAttribute;
+import org.apache.axiom.ts.soap.HeaderBlockAttribute;
import org.apache.axiom.ts.soap.BooleanAttributeAccessor;
import org.apache.axiom.ts.soap.SOAPSpec;
@@ -32,7 +32,7 @@ import org.apache.axiom.ts.soap.SOAPSpec
* SOAP 1.1 messages.
*/
public class TestGetBooleanAttributeUnspported extends BooleanAttributeTestCase {
- public TestGetBooleanAttributeUnspported(OMMetaFactory metaFactory, SOAPSpec spec, BooleanAttribute attribute) {
+ public TestGetBooleanAttributeUnspported(OMMetaFactory metaFactory, SOAPSpec spec, HeaderBlockAttribute attribute) {
super(metaFactory, spec, attribute);
}
Modified: webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/headerblock/TestSetBooleanAttribute.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/headerblock/TestSetBooleanAttribute.java?rev=1682728&r1=1682727&r2=1682728&view=diff
==============================================================================
--- webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/headerblock/TestSetBooleanAttribute.java (original)
+++ webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/headerblock/TestSetBooleanAttribute.java Sun May 31 12:43:58 2015
@@ -24,14 +24,14 @@ import org.apache.axiom.om.OMAttribute;
import org.apache.axiom.om.OMMetaFactory;
import org.apache.axiom.om.OMNamespace;
import org.apache.axiom.soap.SOAPHeaderBlock;
-import org.apache.axiom.ts.soap.BooleanAttribute;
+import org.apache.axiom.ts.soap.HeaderBlockAttribute;
import org.apache.axiom.ts.soap.BooleanAttributeAccessor;
import org.apache.axiom.ts.soap.SOAPSpec;
public class TestSetBooleanAttribute extends BooleanAttributeTestCase {
private final boolean value;
- public TestSetBooleanAttribute(OMMetaFactory metaFactory, SOAPSpec spec, BooleanAttribute attribute, boolean value) {
+ public TestSetBooleanAttribute(OMMetaFactory metaFactory, SOAPSpec spec, HeaderBlockAttribute attribute, boolean value) {
super(metaFactory, spec, attribute);
addTestParameter("value", value);
this.value = value;
@@ -47,7 +47,7 @@ public class TestSetBooleanAttribute ext
OMAttribute att = (OMAttribute)it.next();
OMNamespace ns = att.getNamespace();
assertEquals(spec.getEnvelopeNamespaceURI(), ns.getNamespaceURI());
- assertEquals(attribute.getName(), att.getLocalName());
+ assertEquals(attribute.getName(spec), att.getLocalName());
assertEquals(spec.getCanonicalRepresentation(value), att.getAttributeValue());
assertFalse(it.hasNext());
}
Modified: webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/headerblock/TestSetBooleanAttributeUnsupported.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/headerblock/TestSetBooleanAttributeUnsupported.java?rev=1682728&r1=1682727&r2=1682728&view=diff
==============================================================================
--- webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/headerblock/TestSetBooleanAttributeUnsupported.java (original)
+++ webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/headerblock/TestSetBooleanAttributeUnsupported.java Sun May 31 12:43:58 2015
@@ -23,12 +23,12 @@ import javax.xml.namespace.QName;
import org.apache.axiom.om.OMMetaFactory;
import org.apache.axiom.soap.SOAPHeader;
import org.apache.axiom.soap.SOAPHeaderBlock;
-import org.apache.axiom.ts.soap.BooleanAttribute;
+import org.apache.axiom.ts.soap.HeaderBlockAttribute;
import org.apache.axiom.ts.soap.BooleanAttributeAccessor;
import org.apache.axiom.ts.soap.SOAPSpec;
public class TestSetBooleanAttributeUnsupported extends BooleanAttributeTestCase {
- public TestSetBooleanAttributeUnsupported(OMMetaFactory metaFactory, SOAPSpec spec, BooleanAttribute attribute) {
+ public TestSetBooleanAttributeUnsupported(OMMetaFactory metaFactory, SOAPSpec spec, HeaderBlockAttribute attribute) {
super(metaFactory, spec, attribute);
}
Modified: webservices/axiom/trunk/testing/axiom-testsuite/src/main/resources/META-INF/services/org.apache.axiom.testing.multiton.AdapterFactory
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/testing/axiom-testsuite/src/main/resources/META-INF/services/org.apache.axiom.testing.multiton.AdapterFactory?rev=1682728&r1=1682727&r2=1682728&view=diff
==============================================================================
--- webservices/axiom/trunk/testing/axiom-testsuite/src/main/resources/META-INF/services/org.apache.axiom.testing.multiton.AdapterFactory (original)
+++ webservices/axiom/trunk/testing/axiom-testsuite/src/main/resources/META-INF/services/org.apache.axiom.testing.multiton.AdapterFactory Sun May 31 12:43:58 2015
@@ -17,7 +17,7 @@
# under the License.
#
org.apache.axiom.ts.StreamTypeAdapterFactory
-org.apache.axiom.ts.soap.BooleanAttributeAdapterFactory
+org.apache.axiom.ts.soap.HeaderBlockAttributeAdapterFactory
org.apache.axiom.ts.soap.SOAPElementTypeAdapterFactory
org.apache.axiom.ts.soap.SOAPSampleAdapterFactory
org.apache.axiom.ts.soap.SOAPSpecAdapterFactory
Modified: webservices/axiom/trunk/testing/soap-testsuite/src/main/java/org/apache/axiom/ts/soap/ConvertedSOAPSampleContent.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/testing/soap-testsuite/src/main/java/org/apache/axiom/ts/soap/ConvertedSOAPSampleContent.java?rev=1682728&r1=1682727&r2=1682728&view=diff
==============================================================================
--- webservices/axiom/trunk/testing/soap-testsuite/src/main/java/org/apache/axiom/ts/soap/ConvertedSOAPSampleContent.java (original)
+++ webservices/axiom/trunk/testing/soap-testsuite/src/main/java/org/apache/axiom/ts/soap/ConvertedSOAPSampleContent.java Sun May 31 12:43:58 2015
@@ -30,6 +30,7 @@ import javax.xml.transform.TransformerFa
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
+import org.apache.axiom.testing.multiton.Multiton;
import org.apache.axiom.ts.xml.ComputedMessageContent;
import org.w3c.dom.Attr;
import org.w3c.dom.Document;
@@ -94,14 +95,21 @@ final class ConvertedSOAPSampleContent e
}
}
if (type == SOAPElementType.HEADER) {
- NodeList children = element.getChildNodes();
- for (int i=0; i<children.getLength(); i++) {
- Node child = children.item(i);
+ Node child = element.getFirstChild();
+ while (child != null) {
+ Node nextChild = child.getNextSibling();
if (child.getNodeType() == Node.ELEMENT_NODE) {
Element headerBlock = (Element)child;
- processBooleanAttribute(headerBlock, BooleanAttribute.MUST_UNDERSTAND);
- processBooleanAttribute(headerBlock, BooleanAttribute.RELAY);
+ Attr roleAttr = headerBlock.getAttributeNodeNS(SOAPSpec.SOAP12.getEnvelopeNamespaceURI(), HeaderBlockAttribute.ROLE.getName(SOAPSpec.SOAP12));
+ if (roleAttr != null && roleAttr.getValue().equals("http://www.w3.org/2003/05/soap-envelope/role/none")) {
+ element.removeChild(headerBlock);
+ } else {
+ for (HeaderBlockAttribute attribute : Multiton.getInstances(HeaderBlockAttribute.class)) {
+ processAttribute(headerBlock, attribute);
+ }
+ }
}
+ child = nextChild;
}
} else if (type == SOAPFaultChild.CODE) {
final Element value = getChild(element, SOAPFaultChild.VALUE);
@@ -146,22 +154,30 @@ final class ConvertedSOAPSampleContent e
}
}
- private static void processBooleanAttribute(Element headerBlock, BooleanAttribute booleanAttribute) {
- String localName = booleanAttribute.getName();
- Attr attr = headerBlock.getAttributeNodeNS(SOAPSpec.SOAP12.getEnvelopeNamespaceURI(), localName);
+ private static void processAttribute(Element headerBlock, HeaderBlockAttribute attribute) {
+ Attr attr = headerBlock.getAttributeNodeNS(SOAPSpec.SOAP12.getEnvelopeNamespaceURI(), attribute.getName(SOAPSpec.SOAP12));
if (attr != null) {
- if (booleanAttribute.isSupported(SOAPSpec.SOAP11)) {
+ if (attribute.isSupported(SOAPSpec.SOAP11)) {
String prefix = attr.getPrefix();
- attr = (Attr)attr.getOwnerDocument().renameNode(attr, SOAPSpec.SOAP11.getEnvelopeNamespaceURI(), prefix + ":" + localName);
- String stringValue = attr.getValue();
- boolean value = false;
- for (BooleanLiteral booleanLiteral : SOAPSpec.SOAP12.getBooleanLiterals()) {
- if (stringValue.equals(booleanLiteral.getLexicalRepresentation())) {
- value = booleanLiteral.getValue();
- break;
+ attr = (Attr)attr.getOwnerDocument().renameNode(attr, SOAPSpec.SOAP11.getEnvelopeNamespaceURI(), prefix + ":" + attribute.getName(SOAPSpec.SOAP11));
+ if (attribute.isBoolean()) {
+ String stringValue = attr.getValue();
+ boolean value = false;
+ for (BooleanLiteral booleanLiteral : SOAPSpec.SOAP12.getBooleanLiterals()) {
+ if (stringValue.equals(booleanLiteral.getLexicalRepresentation())) {
+ value = booleanLiteral.getValue();
+ break;
+ }
+ }
+ attr.setValue(SOAPSpec.SOAP11.getCanonicalRepresentation(value));
+ } else if (attribute == HeaderBlockAttribute.ROLE) {
+ String value = attr.getValue();
+ if (value.equals(SOAPSpec.SOAP12.getNextRoleURI())) {
+ attr.setValue(SOAPSpec.SOAP11.getNextRoleURI());
+ } else if (value.equals("http://www.w3.org/2003/05/soap-envelope/role/ultimateReceiver")) {
+ headerBlock.removeAttributeNode(attr);
}
}
- attr.setValue(SOAPSpec.SOAP11.getCanonicalRepresentation(value));
} else {
headerBlock.removeAttributeNode(attr);
}
Copied: webservices/axiom/trunk/testing/soap-testsuite/src/main/java/org/apache/axiom/ts/soap/HeaderBlockAttribute.java (from r1682628, webservices/axiom/trunk/testing/soap-testsuite/src/main/java/org/apache/axiom/ts/soap/BooleanAttribute.java)
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/testing/soap-testsuite/src/main/java/org/apache/axiom/ts/soap/HeaderBlockAttribute.java?p2=webservices/axiom/trunk/testing/soap-testsuite/src/main/java/org/apache/axiom/ts/soap/HeaderBlockAttribute.java&p1=webservices/axiom/trunk/testing/soap-testsuite/src/main/java/org/apache/axiom/ts/soap/BooleanAttribute.java&r1=1682628&r2=1682728&rev=1682728&view=diff
==============================================================================
--- webservices/axiom/trunk/testing/soap-testsuite/src/main/java/org/apache/axiom/ts/soap/BooleanAttribute.java (original)
+++ webservices/axiom/trunk/testing/soap-testsuite/src/main/java/org/apache/axiom/ts/soap/HeaderBlockAttribute.java Sun May 31 12:43:58 2015
@@ -21,26 +21,49 @@ package org.apache.axiom.ts.soap;
import org.apache.axiom.testing.multiton.Multiton;
/**
- * Describes a boolean attribute that can appear on a SOAP header block. This includes the
- * <tt>mustUnderstand</tt> attribute in all SOAP versions as well as the <tt>relay</tt> attribute
- * defined by SOAP 1.2.
+ * Describes an attribute that can appear on a SOAP header block.
*/
-public abstract class BooleanAttribute extends Multiton {
- public static final BooleanAttribute MUST_UNDERSTAND = new BooleanAttribute() {
- public String getName() {
+public abstract class HeaderBlockAttribute extends Multiton {
+ public static final HeaderBlockAttribute MUST_UNDERSTAND = new HeaderBlockAttribute() {
+ public String getName(SOAPSpec spec) {
return "mustUnderstand";
}
+ @Override
+ public boolean isBoolean() {
+ return true;
+ }
+
public boolean isSupported(SOAPSpec spec) {
return true;
}
};
- public static final BooleanAttribute RELAY = new BooleanAttribute() {
- public String getName() {
+ public static final HeaderBlockAttribute ROLE = new HeaderBlockAttribute() {
+ public String getName(SOAPSpec spec) {
+ return spec == SOAPSpec.SOAP11 ? "actor" : "role";
+ }
+
+ @Override
+ public boolean isBoolean() {
+ return false;
+ }
+
+ public boolean isSupported(SOAPSpec spec) {
+ return true;
+ }
+ };
+
+ public static final HeaderBlockAttribute RELAY = new HeaderBlockAttribute() {
+ public String getName(SOAPSpec spec) {
return "relay";
}
+ @Override
+ public boolean isBoolean() {
+ return true;
+ }
+
public boolean isSupported(SOAPSpec spec) {
return spec == SOAPSpec.SOAP12;
}
@@ -49,9 +72,18 @@ public abstract class BooleanAttribute e
/**
* Get the name of the attribute.
*
- * @return the name of the attribute (<tt>mustUnderstand</tt> or <tt>relay</tt>)
+ * @param spec
+ * identifies the SOAP version
+ * @return the name of the attribute in the given SOAP version
+ */
+ public abstract String getName(SOAPSpec spec);
+
+ /**
+ * Determine if the attribute is a boolean attribute.
+ *
+ * @return <code>true</code> if this is a boolean attribute
*/
- public abstract String getName();
+ public abstract boolean isBoolean();
/**
* Determine if the attribute is supported by the given SOAP version.
Modified: webservices/axiom/trunk/testing/soap-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPSampleSet.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/testing/soap-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPSampleSet.java?rev=1682728&r1=1682727&r2=1682728&view=diff
==============================================================================
--- webservices/axiom/trunk/testing/soap-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPSampleSet.java (original)
+++ webservices/axiom/trunk/testing/soap-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPSampleSet.java Sun May 31 12:43:58 2015
@@ -65,6 +65,11 @@ public final class SOAPSampleSet extends
*/
public static final SOAPSampleSet FAULT_DETAIL_DEFAULT_NAMESPACE = new SOAPSampleSet("fault-detail-default-namespace");
+ /**
+ * A SOAP request with header blocks configured with different roles.
+ */
+ public static final SOAPSampleSet ROLES = new SOAPSampleSet("roles");
+
private final SOAPSample soap11Message;
private final SOAPSample soap12Message;
Copied: webservices/axiom/trunk/testing/soap-testsuite/src/main/resources/test-message/set/roles.xml (from r1682628, webservices/axiom/trunk/axiom-api/src/test/resources/soap/soap12/roleMessage.xml)
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/testing/soap-testsuite/src/main/resources/test-message/set/roles.xml?p2=webservices/axiom/trunk/testing/soap-testsuite/src/main/resources/test-message/set/roles.xml&p1=webservices/axiom/trunk/axiom-api/src/test/resources/soap/soap12/roleMessage.xml&r1=1682628&r2=1682728&rev=1682728&view=diff
==============================================================================
--- webservices/axiom/trunk/axiom-api/src/test/resources/soap/soap12/roleMessage.xml (original)
+++ webservices/axiom/trunk/testing/soap-testsuite/src/main/resources/test-message/set/roles.xml Sun May 31 12:43:58 2015
@@ -1,22 +1,3 @@
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one
- ~ or more contributor license agreements. See the NOTICE file
- ~ distributed with this work for additional information
- ~ regarding copyright ownership. The ASF licenses this file
- ~ to you under the Apache License, Version 2.0 (the
- ~ "License"); you may not use this file except in compliance
- ~ with the License. You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing,
- ~ software distributed under the License is distributed on an
- ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- ~ KIND, either express or implied. See the License for the
- ~ specific language governing permissions and limitations
- ~ under the License.
- -->
-
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:xml="http://www.w3.org/XML/1998/namespace">
<env:Header xmlns:test="http://example.org/RoleTest">
<test:h1 env:role="http://www.w3.org/2003/05/soap-envelope/role/ultimateReceiver"