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/26 00:01:56 UTC

svn commit: r1681658 - in /webservices/axiom/trunk: systests/spring-ws-tests/src/test/java/org/apache/axiom/systest/springws/ testing/spring-ws-testsuite/src/main/java/org/apache/axiom/ts/springws/soap/messagefactory/

Author: veithen
Date: Mon May 25 22:01:56 2015
New Revision: 1681658

URL: http://svn.apache.org/r1681658
Log:
The argument to SoapMessageFactory#createWebServiceMessage(InputStream) is expected to be a TransportInputStream.

Added:
    webservices/axiom/trunk/testing/spring-ws-testsuite/src/main/java/org/apache/axiom/ts/springws/soap/messagefactory/TransportInputStreamImpl.java   (with props)
Modified:
    webservices/axiom/trunk/systests/spring-ws-tests/src/test/java/org/apache/axiom/systest/springws/SpringWSTest.java
    webservices/axiom/trunk/testing/spring-ws-testsuite/src/main/java/org/apache/axiom/ts/springws/soap/messagefactory/TestCreateWebServiceMessageFromInputStream.java

Modified: webservices/axiom/trunk/systests/spring-ws-tests/src/test/java/org/apache/axiom/systest/springws/SpringWSTest.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/systests/spring-ws-tests/src/test/java/org/apache/axiom/systest/springws/SpringWSTest.java?rev=1681658&r1=1681657&r2=1681658&view=diff
==============================================================================
--- webservices/axiom/trunk/systests/spring-ws-tests/src/test/java/org/apache/axiom/systest/springws/SpringWSTest.java (original)
+++ webservices/axiom/trunk/systests/spring-ws-tests/src/test/java/org/apache/axiom/systest/springws/SpringWSTest.java Mon May 25 22:01:56 2015
@@ -28,7 +28,6 @@ import org.apache.axiom.ts.springws.scen
 import org.apache.axiom.ts.springws.scenario.jaxb2.JAXB2Test;
 import org.apache.axiom.ts.springws.scenario.jdom.ClientServerTest;
 import org.apache.axiom.ts.springws.scenario.secureecho.SecureEchoTest;
-import org.apache.axiom.ts.springws.soap.messagefactory.TestCreateWebServiceMessageFromInputStream;
 
 public class SpringWSTest extends TestCase {
     public static TestSuite suite() {
@@ -37,7 +36,6 @@ public class SpringWSTest extends TestCa
                 MessageFactoryConfigurator.SAAJ);
         
         // TODO: investigate
-        builder.exclude(TestCreateWebServiceMessageFromInputStream.class);
         builder.exclude(ClientServerTest.class);
         builder.exclude(JAXB2Test.class);
         builder.exclude(CastorTest.class);

Modified: webservices/axiom/trunk/testing/spring-ws-testsuite/src/main/java/org/apache/axiom/ts/springws/soap/messagefactory/TestCreateWebServiceMessageFromInputStream.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/testing/spring-ws-testsuite/src/main/java/org/apache/axiom/ts/springws/soap/messagefactory/TestCreateWebServiceMessageFromInputStream.java?rev=1681658&r1=1681657&r2=1681658&view=diff
==============================================================================
--- webservices/axiom/trunk/testing/spring-ws-testsuite/src/main/java/org/apache/axiom/ts/springws/soap/messagefactory/TestCreateWebServiceMessageFromInputStream.java (original)
+++ webservices/axiom/trunk/testing/spring-ws-testsuite/src/main/java/org/apache/axiom/ts/springws/soap/messagefactory/TestCreateWebServiceMessageFromInputStream.java Mon May 25 22:01:56 2015
@@ -39,7 +39,8 @@ public class TestCreateWebServiceMessage
 
     @Override
     protected void runTest(SoapMessageFactory messageFactory) throws Throwable {
-        SoapMessage message = messageFactory.createWebServiceMessage(SOAPSampleSet.NO_HEADER.getMessage(spec).getInputStream());
+        SoapMessage message = messageFactory.createWebServiceMessage(
+                new TransportInputStreamImpl(SOAPSampleSet.NO_HEADER.getMessage(spec)));
         SoapEnvelope env = message.getEnvelope();
         assertNull(env.getHeader());
         assertNotNull(env.getBody());

Added: webservices/axiom/trunk/testing/spring-ws-testsuite/src/main/java/org/apache/axiom/ts/springws/soap/messagefactory/TransportInputStreamImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/testing/spring-ws-testsuite/src/main/java/org/apache/axiom/ts/springws/soap/messagefactory/TransportInputStreamImpl.java?rev=1681658&view=auto
==============================================================================
--- webservices/axiom/trunk/testing/spring-ws-testsuite/src/main/java/org/apache/axiom/ts/springws/soap/messagefactory/TransportInputStreamImpl.java (added)
+++ webservices/axiom/trunk/testing/spring-ws-testsuite/src/main/java/org/apache/axiom/ts/springws/soap/messagefactory/TransportInputStreamImpl.java Mon May 25 22:01:56 2015
@@ -0,0 +1,56 @@
+/*
+ * 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.springws.soap.messagefactory;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Collections;
+import java.util.Iterator;
+
+import org.apache.axiom.ts.soap.SOAPSample;
+import org.springframework.ws.transport.TransportInputStream;
+
+final class TransportInputStreamImpl extends TransportInputStream {
+    private final SOAPSample sample;
+
+    TransportInputStreamImpl(SOAPSample sample) {
+        this.sample = sample;
+    }
+
+    @Override
+    protected InputStream createInputStream() throws IOException {
+        return sample.getInputStream();
+    }
+
+    @Override
+    public Iterator<String> getHeaderNames() throws IOException {
+        return Collections.singleton("Content-Type").iterator();
+    }
+
+    @Override
+    public Iterator<String> getHeaders(String name) throws IOException {
+        if (name.equalsIgnoreCase("Content-Type")) {
+            return Collections.singleton(
+                    sample.getSOAPSpec().getContentType() + "; charset=\"" + sample.getEncoding()
+                            + "\"").iterator();
+        } else {
+            return Collections.<String>emptySet().iterator();
+        }
+    }
+}

Propchange: webservices/axiom/trunk/testing/spring-ws-testsuite/src/main/java/org/apache/axiom/ts/springws/soap/messagefactory/TransportInputStreamImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native