ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From veit...@apache.org
Subject svn commit: r1609306 - in /webservices/axiom/trunk/testing: ./ saaj-testsuite/ saaj-testsuite/src/ saaj-testsuite/src/main/ saaj-testsuite/src/main/java/ saaj-testsuite/src/main/java/org/ saaj-testsuite/src/main/java/org/apache/ saaj-testsuite/src/main...
Date Wed, 09 Jul 2014 21:20:45 GMT
Author: veithen
Date: Wed Jul  9 21:20:44 2014
New Revision: 1609306

URL: http://svn.apache.org/r1609306
Log:
Add a SAAJ test suite. This will be used at a later stage in the project. In the meantime
it will be useful to test Axis2's SAAJ implementation.

Added:
    webservices/axiom/trunk/testing/saaj-testsuite/   (with props)
    webservices/axiom/trunk/testing/saaj-testsuite/pom.xml   (with props)
    webservices/axiom/trunk/testing/saaj-testsuite/src/
    webservices/axiom/trunk/testing/saaj-testsuite/src/main/
    webservices/axiom/trunk/testing/saaj-testsuite/src/main/java/
    webservices/axiom/trunk/testing/saaj-testsuite/src/main/java/org/
    webservices/axiom/trunk/testing/saaj-testsuite/src/main/java/org/apache/
    webservices/axiom/trunk/testing/saaj-testsuite/src/main/java/org/apache/axiom/
    webservices/axiom/trunk/testing/saaj-testsuite/src/main/java/org/apache/axiom/ts/
    webservices/axiom/trunk/testing/saaj-testsuite/src/main/java/org/apache/axiom/ts/saaj/
    webservices/axiom/trunk/testing/saaj-testsuite/src/main/java/org/apache/axiom/ts/saaj/FactorySelector.java
  (with props)
    webservices/axiom/trunk/testing/saaj-testsuite/src/main/java/org/apache/axiom/ts/saaj/SAAJImplementation.java
  (with props)
    webservices/axiom/trunk/testing/saaj-testsuite/src/main/java/org/apache/axiom/ts/saaj/SAAJTestCase.java
  (with props)
    webservices/axiom/trunk/testing/saaj-testsuite/src/main/java/org/apache/axiom/ts/saaj/SAAJTestSuiteBuilder.java
  (with props)
    webservices/axiom/trunk/testing/saaj-testsuite/src/main/java/org/apache/axiom/ts/saaj/SOAPSpecAdapterFactory.java
  (with props)
    webservices/axiom/trunk/testing/saaj-testsuite/src/main/java/org/apache/axiom/ts/saaj/TestExamineMustUnderstandHeaderElements.java
  (with props)
    webservices/axiom/trunk/testing/saaj-testsuite/src/main/resources/
    webservices/axiom/trunk/testing/saaj-testsuite/src/main/resources/META-INF/
    webservices/axiom/trunk/testing/saaj-testsuite/src/main/resources/META-INF/services/
    webservices/axiom/trunk/testing/saaj-testsuite/src/main/resources/META-INF/services/org.apache.axiom.ts.soap.AdapterFactory
    webservices/axiom/trunk/testing/saaj-testsuite/src/test/
    webservices/axiom/trunk/testing/saaj-testsuite/src/test/java/
    webservices/axiom/trunk/testing/saaj-testsuite/src/test/java/org/
    webservices/axiom/trunk/testing/saaj-testsuite/src/test/java/org/apache/
    webservices/axiom/trunk/testing/saaj-testsuite/src/test/java/org/apache/axiom/
    webservices/axiom/trunk/testing/saaj-testsuite/src/test/java/org/apache/axiom/ts/
    webservices/axiom/trunk/testing/saaj-testsuite/src/test/java/org/apache/axiom/ts/saaj/
    webservices/axiom/trunk/testing/saaj-testsuite/src/test/java/org/apache/axiom/ts/saaj/SAAJRITest.java
  (with props)
    webservices/axiom/trunk/testing/saaj-testsuite/src/test/resources/
    webservices/axiom/trunk/testing/soap-testsuite/src/main/resources/test-message/set/must-understand.xml
  (with props)
Modified:
    webservices/axiom/trunk/testing/pom.xml
    webservices/axiom/trunk/testing/soap-testsuite/src/main/java/org/apache/axiom/ts/soap/ConvertedTestMessage.java
    webservices/axiom/trunk/testing/soap-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPSpec.java
    webservices/axiom/trunk/testing/soap-testsuite/src/main/java/org/apache/axiom/ts/soap/TestMessageSet.java

Modified: webservices/axiom/trunk/testing/pom.xml
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/testing/pom.xml?rev=1609306&r1=1609305&r2=1609306&view=diff
==============================================================================
--- webservices/axiom/trunk/testing/pom.xml (original)
+++ webservices/axiom/trunk/testing/pom.xml Wed Jul  9 21:20:44 2014
@@ -30,6 +30,7 @@
     <modules>
         <module>dom-testsuite</module>
         <module>jaxen-testsuite</module>
+        <module>saaj-testsuite</module>
         <module>soap-testsuite</module>
         <module>spring-ws-testsuite</module>
     </modules>

Propchange: webservices/axiom/trunk/testing/saaj-testsuite/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Jul  9 21:20:44 2014
@@ -0,0 +1,4 @@
+.settings
+target
+.classpath
+.project

Added: webservices/axiom/trunk/testing/saaj-testsuite/pom.xml
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/testing/saaj-testsuite/pom.xml?rev=1609306&view=auto
==============================================================================
--- webservices/axiom/trunk/testing/saaj-testsuite/pom.xml (added)
+++ webservices/axiom/trunk/testing/saaj-testsuite/pom.xml Wed Jul  9 21:20:44 2014
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ 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.
+  -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.ws.commons.axiom</groupId>
+        <artifactId>testing</artifactId>
+        <version>1.2.15-SNAPSHOT</version>
+    </parent>
+    <artifactId>saaj-testsuite</artifactId>
+    <name>SAAJ Test Suite</name>
+    <dependencies>
+        <dependency>
+            <groupId>${project.groupId}</groupId>
+            <artifactId>axiom-testutils</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>${project.groupId}</groupId>
+            <artifactId>soap-testsuite</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>com.sun.xml.messaging.saaj</groupId>
+            <artifactId>saaj-impl</artifactId>
+            <version>1.3.10</version>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+</project>

Propchange: webservices/axiom/trunk/testing/saaj-testsuite/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: webservices/axiom/trunk/testing/saaj-testsuite/src/main/java/org/apache/axiom/ts/saaj/FactorySelector.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/testing/saaj-testsuite/src/main/java/org/apache/axiom/ts/saaj/FactorySelector.java?rev=1609306&view=auto
==============================================================================
--- webservices/axiom/trunk/testing/saaj-testsuite/src/main/java/org/apache/axiom/ts/saaj/FactorySelector.java
(added)
+++ webservices/axiom/trunk/testing/saaj-testsuite/src/main/java/org/apache/axiom/ts/saaj/FactorySelector.java
Wed Jul  9 21:20:44 2014
@@ -0,0 +1,35 @@
+/*
+ * 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.
+ */
+package org.apache.axiom.ts.saaj;
+
+import javax.xml.soap.MessageFactory;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPFactory;
+
+import org.apache.axiom.ts.soap.AdapterType;
+import org.apache.axiom.ts.soap.SOAPSpec;
+
+/**
+ * {@link SOAPSpec} adapter that allows to retrieve the {@link MessageFactory} or
+ * {@link SOAPFactory} corresponding to the SOAP version from a {@link SAAJImplementation}.
+ */
+@AdapterType
+public interface FactorySelector {
+    MessageFactory newMessageFactory(SAAJImplementation saajImplementation, boolean dynamic)
throws SOAPException;
+}

Propchange: webservices/axiom/trunk/testing/saaj-testsuite/src/main/java/org/apache/axiom/ts/saaj/FactorySelector.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: webservices/axiom/trunk/testing/saaj-testsuite/src/main/java/org/apache/axiom/ts/saaj/SAAJImplementation.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/testing/saaj-testsuite/src/main/java/org/apache/axiom/ts/saaj/SAAJImplementation.java?rev=1609306&view=auto
==============================================================================
--- webservices/axiom/trunk/testing/saaj-testsuite/src/main/java/org/apache/axiom/ts/saaj/SAAJImplementation.java
(added)
+++ webservices/axiom/trunk/testing/saaj-testsuite/src/main/java/org/apache/axiom/ts/saaj/SAAJImplementation.java
Wed Jul  9 21:20:44 2014
@@ -0,0 +1,64 @@
+/*
+ * 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.
+ */
+package org.apache.axiom.ts.saaj;
+
+import java.lang.reflect.Method;
+
+import javax.xml.soap.MessageFactory;
+import javax.xml.soap.SAAJMetaFactory;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPFactory;
+
+public final class SAAJImplementation {
+    private static final Method newMessageFactoryMethod;
+    private static final Method newSOAPFactoryMethod;
+    
+    static {
+        try {
+            newMessageFactoryMethod = SAAJMetaFactory.class.getDeclaredMethod("newMessageFactory",
String.class);
+            newMessageFactoryMethod.setAccessible(true);
+            newSOAPFactoryMethod = SAAJMetaFactory.class.getDeclaredMethod("newMessageFactory",
String.class);
+            newSOAPFactoryMethod.setAccessible(true);
+        } catch (Exception ex) {
+            throw new Error(ex);
+        }
+    }
+    
+    private final SAAJMetaFactory metaFactory;
+    
+    public SAAJImplementation(SAAJMetaFactory metaFactory) {
+        this.metaFactory = metaFactory;
+    }
+    
+    public MessageFactory newMessageFactory(String protocol) throws SOAPException {
+        try {
+            return (MessageFactory)newMessageFactoryMethod.invoke(metaFactory, protocol);
+        } catch (Exception ex) {
+            throw new Error(ex);
+        }
+    }
+    
+    public SOAPFactory newSOAPFactory(String protocol) throws SOAPException {
+        try {
+            return (SOAPFactory)newSOAPFactoryMethod.invoke(metaFactory, protocol);
+        } catch (Exception ex) {
+            throw new Error(ex);
+        }
+    }
+}

Propchange: webservices/axiom/trunk/testing/saaj-testsuite/src/main/java/org/apache/axiom/ts/saaj/SAAJImplementation.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: webservices/axiom/trunk/testing/saaj-testsuite/src/main/java/org/apache/axiom/ts/saaj/SAAJTestCase.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/testing/saaj-testsuite/src/main/java/org/apache/axiom/ts/saaj/SAAJTestCase.java?rev=1609306&view=auto
==============================================================================
--- webservices/axiom/trunk/testing/saaj-testsuite/src/main/java/org/apache/axiom/ts/saaj/SAAJTestCase.java
(added)
+++ webservices/axiom/trunk/testing/saaj-testsuite/src/main/java/org/apache/axiom/ts/saaj/SAAJTestCase.java
Wed Jul  9 21:20:44 2014
@@ -0,0 +1,29 @@
+/*
+ * 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.
+ */
+package org.apache.axiom.ts.saaj;
+
+import org.apache.axiom.testutils.suite.MatrixTestCase;
+
+public abstract class SAAJTestCase extends MatrixTestCase {
+    protected final SAAJImplementation saajImplementation;
+
+    public SAAJTestCase(SAAJImplementation saajImplementation) {
+        this.saajImplementation = saajImplementation;
+    }
+}

Propchange: webservices/axiom/trunk/testing/saaj-testsuite/src/main/java/org/apache/axiom/ts/saaj/SAAJTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: webservices/axiom/trunk/testing/saaj-testsuite/src/main/java/org/apache/axiom/ts/saaj/SAAJTestSuiteBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/testing/saaj-testsuite/src/main/java/org/apache/axiom/ts/saaj/SAAJTestSuiteBuilder.java?rev=1609306&view=auto
==============================================================================
--- webservices/axiom/trunk/testing/saaj-testsuite/src/main/java/org/apache/axiom/ts/saaj/SAAJTestSuiteBuilder.java
(added)
+++ webservices/axiom/trunk/testing/saaj-testsuite/src/main/java/org/apache/axiom/ts/saaj/SAAJTestSuiteBuilder.java
Wed Jul  9 21:20:44 2014
@@ -0,0 +1,40 @@
+/*
+ * 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.
+ */
+package org.apache.axiom.ts.saaj;
+
+import javax.xml.soap.SAAJMetaFactory;
+
+import org.apache.axiom.testutils.suite.MatrixTestSuiteBuilder;
+import org.apache.axiom.ts.soap.SOAPSpec;
+
+public class SAAJTestSuiteBuilder extends MatrixTestSuiteBuilder {
+    private final SAAJImplementation saajImplementation;
+
+    public SAAJTestSuiteBuilder(SAAJMetaFactory metaFactory) {
+        saajImplementation = new SAAJImplementation(metaFactory);
+    }
+
+    @Override
+    protected void addTests() {
+        addTest(new TestExamineMustUnderstandHeaderElements(saajImplementation, SOAPSpec.SOAP11,
false));
+        addTest(new TestExamineMustUnderstandHeaderElements(saajImplementation, SOAPSpec.SOAP12,
false));
+        addTest(new TestExamineMustUnderstandHeaderElements(saajImplementation, SOAPSpec.SOAP11,
true));
+        addTest(new TestExamineMustUnderstandHeaderElements(saajImplementation, SOAPSpec.SOAP12,
true));
+    }
+}

Propchange: webservices/axiom/trunk/testing/saaj-testsuite/src/main/java/org/apache/axiom/ts/saaj/SAAJTestSuiteBuilder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: webservices/axiom/trunk/testing/saaj-testsuite/src/main/java/org/apache/axiom/ts/saaj/SOAPSpecAdapterFactory.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/testing/saaj-testsuite/src/main/java/org/apache/axiom/ts/saaj/SOAPSpecAdapterFactory.java?rev=1609306&view=auto
==============================================================================
--- webservices/axiom/trunk/testing/saaj-testsuite/src/main/java/org/apache/axiom/ts/saaj/SOAPSpecAdapterFactory.java
(added)
+++ webservices/axiom/trunk/testing/saaj-testsuite/src/main/java/org/apache/axiom/ts/saaj/SOAPSpecAdapterFactory.java
Wed Jul  9 21:20:44 2014
@@ -0,0 +1,53 @@
+/*
+ * 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.
+ */
+package org.apache.axiom.ts.saaj;
+
+import javax.xml.soap.MessageFactory;
+import javax.xml.soap.SOAPConstants;
+import javax.xml.soap.SOAPException;
+
+import org.apache.axiom.ts.soap.AdapterFactory;
+import org.apache.axiom.ts.soap.Adapters;
+import org.apache.axiom.ts.soap.SOAPSpec;
+
+public class SOAPSpecAdapterFactory implements AdapterFactory<SOAPSpec> {
+    public void createAdapters(SOAPSpec spec, Adapters adapters) {
+        if (spec == SOAPSpec.SOAP11) {
+            adapters.add(new FactorySelector() {
+                @Override
+                public MessageFactory newMessageFactory(SAAJImplementation saajImplementation,
+                        boolean dynamic) throws SOAPException {
+                    return saajImplementation.newMessageFactory(dynamic
+                            ? SOAPConstants.DYNAMIC_SOAP_PROTOCOL
+                            : SOAPConstants.SOAP_1_1_PROTOCOL);
+                }
+            });
+        } else if (spec == SOAPSpec.SOAP12) {
+            adapters.add(new FactorySelector() {
+                @Override
+                public MessageFactory newMessageFactory(SAAJImplementation saajImplementation,
+                        boolean dynamic) throws SOAPException {
+                    return saajImplementation.newMessageFactory(dynamic
+                            ? SOAPConstants.DYNAMIC_SOAP_PROTOCOL
+                            : SOAPConstants.SOAP_1_2_PROTOCOL);
+                }
+            });
+        }
+    }
+}

Propchange: webservices/axiom/trunk/testing/saaj-testsuite/src/main/java/org/apache/axiom/ts/saaj/SOAPSpecAdapterFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: webservices/axiom/trunk/testing/saaj-testsuite/src/main/java/org/apache/axiom/ts/saaj/TestExamineMustUnderstandHeaderElements.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/testing/saaj-testsuite/src/main/java/org/apache/axiom/ts/saaj/TestExamineMustUnderstandHeaderElements.java?rev=1609306&view=auto
==============================================================================
--- webservices/axiom/trunk/testing/saaj-testsuite/src/main/java/org/apache/axiom/ts/saaj/TestExamineMustUnderstandHeaderElements.java
(added)
+++ webservices/axiom/trunk/testing/saaj-testsuite/src/main/java/org/apache/axiom/ts/saaj/TestExamineMustUnderstandHeaderElements.java
Wed Jul  9 21:20:44 2014
@@ -0,0 +1,62 @@
+/*
+ * 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.
+ */
+package org.apache.axiom.ts.saaj;
+
+import java.io.InputStream;
+import java.util.Iterator;
+
+import javax.xml.soap.MessageFactory;
+import javax.xml.soap.MimeHeaders;
+import javax.xml.soap.SOAPHeader;
+import javax.xml.soap.SOAPHeaderElement;
+import javax.xml.soap.SOAPMessage;
+
+import org.apache.axiom.ts.soap.SOAPSpec;
+import org.apache.axiom.ts.soap.TestMessageSet;
+
+public class TestExamineMustUnderstandHeaderElements extends SAAJTestCase {
+    private final SOAPSpec spec;
+    private final boolean dynamic;
+    
+    public TestExamineMustUnderstandHeaderElements(SAAJImplementation saajImplementation,
SOAPSpec spec, boolean dynamic) {
+        super(saajImplementation);
+        this.spec = spec;
+        this.dynamic = dynamic;
+        addTestParameter("spec", spec.getName());
+        addTestParameter("dynamic", dynamic);
+    }
+
+    @Override
+    protected void runTest() throws Throwable {
+        MessageFactory messageFactory = spec.getAdapter(FactorySelector.class).newMessageFactory(saajImplementation,
dynamic);
+        MimeHeaders mimeHeaders = new MimeHeaders();
+        mimeHeaders.addHeader("Content-Type", spec.getContentType());
+        InputStream in = TestMessageSet.MUST_UNDERSTAND.getMessage(spec).getInputStream();
+        try {
+            SOAPMessage message = messageFactory.createMessage(mimeHeaders, in);
+            SOAPHeader header = message.getSOAPHeader();
+            Iterator it = header.examineMustUnderstandHeaderElements(null);
+            assertTrue(it.hasNext());
+            assertTrue(it.next() instanceof SOAPHeaderElement);
+            assertFalse(it.hasNext());
+        } finally {
+            in.close();
+        }
+    }
+}

Propchange: webservices/axiom/trunk/testing/saaj-testsuite/src/main/java/org/apache/axiom/ts/saaj/TestExamineMustUnderstandHeaderElements.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: webservices/axiom/trunk/testing/saaj-testsuite/src/main/resources/META-INF/services/org.apache.axiom.ts.soap.AdapterFactory
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/testing/saaj-testsuite/src/main/resources/META-INF/services/org.apache.axiom.ts.soap.AdapterFactory?rev=1609306&view=auto
==============================================================================
--- webservices/axiom/trunk/testing/saaj-testsuite/src/main/resources/META-INF/services/org.apache.axiom.ts.soap.AdapterFactory
(added)
+++ webservices/axiom/trunk/testing/saaj-testsuite/src/main/resources/META-INF/services/org.apache.axiom.ts.soap.AdapterFactory
Wed Jul  9 21:20:44 2014
@@ -0,0 +1,19 @@
+#
+# 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.
+#
+org.apache.axiom.ts.saaj.SOAPSpecAdapterFactory

Added: webservices/axiom/trunk/testing/saaj-testsuite/src/test/java/org/apache/axiom/ts/saaj/SAAJRITest.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/testing/saaj-testsuite/src/test/java/org/apache/axiom/ts/saaj/SAAJRITest.java?rev=1609306&view=auto
==============================================================================
--- webservices/axiom/trunk/testing/saaj-testsuite/src/test/java/org/apache/axiom/ts/saaj/SAAJRITest.java
(added)
+++ webservices/axiom/trunk/testing/saaj-testsuite/src/test/java/org/apache/axiom/ts/saaj/SAAJRITest.java
Wed Jul  9 21:20:44 2014
@@ -0,0 +1,30 @@
+/*
+ * 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.
+ */
+package org.apache.axiom.ts.saaj;
+
+import com.sun.xml.messaging.saaj.soap.SAAJMetaFactoryImpl;
+
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+public class SAAJRITest extends TestCase {
+    public static TestSuite suite() throws Exception {
+        return new SAAJTestSuiteBuilder(new SAAJMetaFactoryImpl()).build();
+    }
+}

Propchange: webservices/axiom/trunk/testing/saaj-testsuite/src/test/java/org/apache/axiom/ts/saaj/SAAJRITest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: webservices/axiom/trunk/testing/soap-testsuite/src/main/java/org/apache/axiom/ts/soap/ConvertedTestMessage.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/testing/soap-testsuite/src/main/java/org/apache/axiom/ts/soap/ConvertedTestMessage.java?rev=1609306&r1=1609305&r2=1609306&view=diff
==============================================================================
--- webservices/axiom/trunk/testing/soap-testsuite/src/main/java/org/apache/axiom/ts/soap/ConvertedTestMessage.java
(original)
+++ webservices/axiom/trunk/testing/soap-testsuite/src/main/java/org/apache/axiom/ts/soap/ConvertedTestMessage.java
Wed Jul  9 21:20:44 2014
@@ -28,6 +28,7 @@ import javax.xml.transform.TransformerFa
 import javax.xml.transform.dom.DOMSource;
 import javax.xml.transform.stream.StreamResult;
 
+import org.w3c.dom.Attr;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
@@ -80,7 +81,17 @@ final class ConvertedTestMessage extends
         }
         element = (Element)element.getOwnerDocument().renameNode(element, newName.getNamespaceURI(),
                 prefix == null ? newName.getLocalPart() : prefix + ":" + newName.getLocalPart());
-        if (type == SOAPFaultChild.CODE) {
+        if (type == SOAPElementType.HEADER) {
+            NodeList children = element.getChildNodes();
+            for (int i=0; i<children.getLength(); i++) {
+                Node child = children.item(i);
+                if (child.getNodeType() == Node.ELEMENT_NODE) {
+                    Element headerBlock = (Element)child;
+                    processBooleanAttribute(headerBlock, BooleanAttribute.MUST_UNDERSTAND);
+                    processBooleanAttribute(headerBlock, BooleanAttribute.RELAY);
+                }
+            }
+        } else if (type == SOAPFaultChild.CODE) {
             Element value = getChild(element, SOAPFaultChild.VALUE);
             // TODO: should translate fault code as well
             element.setTextContent(value.getTextContent());
@@ -107,6 +118,28 @@ final class ConvertedTestMessage extends
         }
     }
     
+    private static void processBooleanAttribute(Element headerBlock, BooleanAttribute booleanAttribute)
{
+        String localName = booleanAttribute.getName();
+        Attr attr = headerBlock.getAttributeNodeNS(SOAPSpec.SOAP12.getEnvelopeNamespaceURI(),
localName);
+        if (attr != null) {
+            if (booleanAttribute.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.setValue(SOAPSpec.SOAP11.getCanonicalRepresentation(value));
+            } else {
+                headerBlock.removeAttributeNode(attr);
+            }
+        }
+    }
+    
     private static boolean hasName(Element element, QName name) {
         String namespaceURI = element.getNamespaceURI();
         if (namespaceURI == null) {

Modified: webservices/axiom/trunk/testing/soap-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPSpec.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/testing/soap-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPSpec.java?rev=1609306&r1=1609305&r2=1609306&view=diff
==============================================================================
--- webservices/axiom/trunk/testing/soap-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPSpec.java
(original)
+++ webservices/axiom/trunk/testing/soap-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPSpec.java
Wed Jul  9 21:20:44 2014
@@ -33,7 +33,9 @@ import javax.xml.validation.SchemaFactor
  * Describes the characteristics of a given SOAP version.
  */
 public abstract class SOAPSpec extends Adaptable {
-    public static final SOAPSpec SOAP11 = new SOAPSpec("soap11", "http://schemas.xmlsoap.org/soap/envelope/",
+    public static final SOAPSpec SOAP11 = new SOAPSpec("soap11",
+            "text/xml",
+            "http://schemas.xmlsoap.org/soap/envelope/",
             new BooleanLiteral[] { BooleanLiteral.ONE, BooleanLiteral.ZERO },
             new QName("faultcode"),
             null,
@@ -56,7 +58,9 @@ public abstract class SOAPSpec extends A
         }
     };
 
-    public static final SOAPSpec SOAP12 = new SOAPSpec("soap12", "http://www.w3.org/2003/05/soap-envelope",
+    public static final SOAPSpec SOAP12 = new SOAPSpec("soap12",
+            "application/soap+xml",
+            "http://www.w3.org/2003/05/soap-envelope",
             new BooleanLiteral[] { BooleanLiteral.TRUE, BooleanLiteral.FALSE, BooleanLiteral.ONE,
BooleanLiteral.ZERO },
             new QName("http://www.w3.org/2003/05/soap-envelope", "Code"),
             new QName("http://www.w3.org/2003/05/soap-envelope", "Value"),
@@ -80,6 +84,7 @@ public abstract class SOAPSpec extends A
     };
 
     private final String name;
+    private final String contentType;
     private final String envelopeNamespaceURI;
     private final BooleanLiteral[] booleanLiterals;
     private final QName envelopeQName;
@@ -100,12 +105,13 @@ public abstract class SOAPSpec extends A
     private final String[] schemaResources;
     private Schema schema;
     
-    public SOAPSpec(String name, String envelopeNamespaceURI, BooleanLiteral[] booleanLiterals,
+    public SOAPSpec(String name, String contentType, String envelopeNamespaceURI, BooleanLiteral[]
booleanLiterals,
             QName faultCodeQName, QName faultValueQName, QName faultSubCodeQName, QName faultReasonQName,
             QName faultTextQName, QName faultNodeQName, QName faultRoleQName, QName faultDetailQName,
             String nextRoleURI, QName senderFaultCode, QName receiverFaultCode,
             String[] schemaResources) {
         this.name = name;
+        this.contentType = contentType;
         this.envelopeNamespaceURI = envelopeNamespaceURI;
         this.booleanLiterals = booleanLiterals;
         envelopeQName = new QName(envelopeNamespaceURI, "Envelope");
@@ -138,6 +144,10 @@ public abstract class SOAPSpec extends A
      */
     public abstract SOAPSpec getAltSpec();
     
+    public final String getContentType() {
+        return contentType;
+    }
+
     public final String getEnvelopeNamespaceURI() {
         return envelopeNamespaceURI;
     }

Modified: webservices/axiom/trunk/testing/soap-testsuite/src/main/java/org/apache/axiom/ts/soap/TestMessageSet.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/testing/soap-testsuite/src/main/java/org/apache/axiom/ts/soap/TestMessageSet.java?rev=1609306&r1=1609305&r2=1609306&view=diff
==============================================================================
--- webservices/axiom/trunk/testing/soap-testsuite/src/main/java/org/apache/axiom/ts/soap/TestMessageSet.java
(original)
+++ webservices/axiom/trunk/testing/soap-testsuite/src/main/java/org/apache/axiom/ts/soap/TestMessageSet.java
Wed Jul  9 21:20:44 2014
@@ -58,6 +58,11 @@ public final class TestMessageSet extend
      */
     public static final TestMessageSet CUSTOM_ROLE_FAULT = new TestMessageSet("custom-role-fault");
     
+    /**
+     * A SOAP request with a single mustUnderstand header.
+     */
+    public static final TestMessageSet MUST_UNDERSTAND = new TestMessageSet("must-understand");
+    
     private final TestMessage soap11Message;
     private final TestMessage soap12Message;
     

Added: webservices/axiom/trunk/testing/soap-testsuite/src/main/resources/test-message/set/must-understand.xml
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/testing/soap-testsuite/src/main/resources/test-message/set/must-understand.xml?rev=1609306&view=auto
==============================================================================
--- webservices/axiom/trunk/testing/soap-testsuite/src/main/resources/test-message/set/must-understand.xml
(added)
+++ webservices/axiom/trunk/testing/soap-testsuite/src/main/resources/test-message/set/must-understand.xml
Wed Jul  9 21:20:44 2014
@@ -0,0 +1,10 @@
+<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope">
+   <SOAP-ENV:Header>
+       <t:Transaction xmlns:t="urn:tx" SOAP-ENV:mustUnderstand="true">5</t:Transaction>
+   </SOAP-ENV:Header>
+   <SOAP-ENV:Body>
+       <m:GetLastTradePrice xmlns:m="urn:trade">
+           <symbol>DEF</symbol>
+       </m:GetLastTradePrice>
+   </SOAP-ENV:Body>
+</SOAP-ENV:Envelope>
\ No newline at end of file

Propchange: webservices/axiom/trunk/testing/soap-testsuite/src/main/resources/test-message/set/must-understand.xml
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message