cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject cxf git commit: Fix regression by storing namespace declarations from Body and Envelope element and later updating the SAAJ model with them
Date Fri, 22 May 2015 18:50:43 GMT
Repository: cxf
Updated Branches:
  refs/heads/master 6ef5be586 -> 5743d5e9b


Fix regression by storing namespace declarations from Body and Envelope
element and later updating the SAAJ model with them

- added integration test for this issue

This closes #70


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/5743d5e9
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/5743d5e9
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/5743d5e9

Branch: refs/heads/master
Commit: 5743d5e9bf547bcd0066b2369adadcbb5a8bacbd
Parents: 6ef5be5
Author: Tomas Hofman <thofman@redhat.com>
Authored: Mon May 11 15:08:55 2015 +0200
Committer: Daniel Kulp <dkulp@apache.org>
Committed: Fri May 22 14:50:09 2015 -0400

----------------------------------------------------------------------
 .../cxf/systest/cxf6319/Cxf6319TestCase.java    | 75 ++++++++++++++++++++
 .../cxf/systest/cxf6319/EmptyHandler.java       | 52 ++++++++++++++
 .../apache/cxf/systest/cxf6319/ServiceImpl.java | 34 +++++++++
 .../org/apache/cxf/systest/cxf6319/handler.xml  |  9 +++
 .../org/apache/cxf/systest/cxf6319/request.xml  | 27 +++++++
 5 files changed, 197 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/5743d5e9/systests/uncategorized/src/test/java/org/apache/cxf/systest/cxf6319/Cxf6319TestCase.java
----------------------------------------------------------------------
diff --git a/systests/uncategorized/src/test/java/org/apache/cxf/systest/cxf6319/Cxf6319TestCase.java
b/systests/uncategorized/src/test/java/org/apache/cxf/systest/cxf6319/Cxf6319TestCase.java
new file mode 100644
index 0000000..62375ca
--- /dev/null
+++ b/systests/uncategorized/src/test/java/org/apache/cxf/systest/cxf6319/Cxf6319TestCase.java
@@ -0,0 +1,75 @@
+/**
+ * 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.cxf.systest.cxf6319;
+
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.HttpURLConnection;
+
+import javax.xml.ws.Endpoint;
+
+import org.apache.cxf.helpers.IOUtils;
+import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
+import org.apache.cxf.testutil.common.TestUtil;
+import org.junit.Test;
+
+/**
+ * Test case for CXF-6319 - namespace declarations in body and envelope are not processed
correctly
+ * when there is a SOAPHandler.
+ *
+ * @author Tomas Hofman (thofman@redhat.com)
+ */
+public class Cxf6319TestCase extends AbstractBusClientServerTestBase {
+
+    static final String PORT = TestUtil.getPortNumber(Cxf6319TestCase.class);
+
+    @Test
+    public void testDeclarationsInEnvelope() throws Exception {
+        Endpoint ep = Endpoint.publish("http://localhost:" + PORT + "/SoapContext/SoapPort",
new ServiceImpl());
+
+        try {
+            HttpURLConnection httpConnection =
+                    getHttpConnection("http://localhost:" + PORT + "/SoapContext/SoapPort/echo");
+            httpConnection.setDoOutput(true);
+
+            InputStream reqin = getClass().getResourceAsStream("request.xml");
+            assertNotNull("could not load test data", reqin);
+
+            httpConnection.setRequestMethod("POST");
+            httpConnection.addRequestProperty("Content-Type", "text/xml");
+            OutputStream reqout = httpConnection.getOutputStream();
+            IOUtils.copy(reqin, reqout);
+            reqout.close();
+
+            int responseCode = httpConnection.getResponseCode();
+            InputStream errorStream = httpConnection.getErrorStream();
+            String error = null;
+            if (errorStream != null) {
+                error = IOUtils.readStringFromStream(errorStream);
+            }
+            assertEquals(error, 200, responseCode);
+        } catch (Exception e) {
+            e.printStackTrace();
+        } finally {
+            ep.stop();
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/5743d5e9/systests/uncategorized/src/test/java/org/apache/cxf/systest/cxf6319/EmptyHandler.java
----------------------------------------------------------------------
diff --git a/systests/uncategorized/src/test/java/org/apache/cxf/systest/cxf6319/EmptyHandler.java
b/systests/uncategorized/src/test/java/org/apache/cxf/systest/cxf6319/EmptyHandler.java
new file mode 100644
index 0000000..e501526
--- /dev/null
+++ b/systests/uncategorized/src/test/java/org/apache/cxf/systest/cxf6319/EmptyHandler.java
@@ -0,0 +1,52 @@
+/**
+ * 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.cxf.systest.cxf6319;
+
+import java.util.Set;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.handler.soap.SOAPHandler;
+import javax.xml.ws.handler.soap.SOAPMessageContext;
+
+/**
+ * @author Tomas Hofman (thofman@redhat.com)
+ */
+public class EmptyHandler implements SOAPHandler<SOAPMessageContext> {
+
+    @Override
+    public boolean handleMessage(SOAPMessageContext context) {
+        return true;
+    }
+
+    @Override
+    public boolean handleFault(SOAPMessageContext context) {
+        return true;
+    }
+
+    @Override
+    public void close(javax.xml.ws.handler.MessageContext context) {
+    }
+
+    @Override
+    public Set<QName> getHeaders() {
+        return null;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/5743d5e9/systests/uncategorized/src/test/java/org/apache/cxf/systest/cxf6319/ServiceImpl.java
----------------------------------------------------------------------
diff --git a/systests/uncategorized/src/test/java/org/apache/cxf/systest/cxf6319/ServiceImpl.java
b/systests/uncategorized/src/test/java/org/apache/cxf/systest/cxf6319/ServiceImpl.java
new file mode 100644
index 0000000..d781604
--- /dev/null
+++ b/systests/uncategorized/src/test/java/org/apache/cxf/systest/cxf6319/ServiceImpl.java
@@ -0,0 +1,34 @@
+/**
+ * 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.cxf.systest.cxf6319;
+
+import javax.jws.HandlerChain;
+import javax.jws.WebParam;
+
+@javax.jws.WebService(serviceName = "SOAPService",
+                      targetNamespace = "http://example.com")
+@HandlerChain(file = "handler.xml")
+public class ServiceImpl {
+
+    public String echo(@WebParam(name = "s", targetNamespace = "http://example.com") String
s) {
+        return s;
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/5743d5e9/systests/uncategorized/src/test/java/org/apache/cxf/systest/cxf6319/handler.xml
----------------------------------------------------------------------
diff --git a/systests/uncategorized/src/test/java/org/apache/cxf/systest/cxf6319/handler.xml
b/systests/uncategorized/src/test/java/org/apache/cxf/systest/cxf6319/handler.xml
new file mode 100644
index 0000000..16d401c
--- /dev/null
+++ b/systests/uncategorized/src/test/java/org/apache/cxf/systest/cxf6319/handler.xml
@@ -0,0 +1,9 @@
+<handler-chains xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+                xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://www.oracle.com/webfolder/technetwork/jsc/xml/ns/javaee/javaee_web_services_metadata_handler_2_0.xsd">
+    <handler-chain>
+        <handler>
+            <handler-name>ContextHandler</handler-name>
+            <handler-class>org.apache.cxf.systest.cxf6319.EmptyHandler</handler-class>
+        </handler>
+    </handler-chain>
+</handler-chains>

http://git-wip-us.apache.org/repos/asf/cxf/blob/5743d5e9/systests/uncategorized/src/test/java/org/apache/cxf/systest/cxf6319/request.xml
----------------------------------------------------------------------
diff --git a/systests/uncategorized/src/test/java/org/apache/cxf/systest/cxf6319/request.xml
b/systests/uncategorized/src/test/java/org/apache/cxf/systest/cxf6319/request.xml
new file mode 100644
index 0000000..27a362d
--- /dev/null
+++ b/systests/uncategorized/src/test/java/org/apache/cxf/systest/cxf6319/request.xml
@@ -0,0 +1,27 @@
+<?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.
+-->
+<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
+                   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+    <SOAP-ENV:Body xmlns:xs="http://www.w3.org/2001/XMLSchema">
+        <ns0:echo xmlns:ns0="http://example.com">
+            <ns0:s xsi:type="xs:string">hello</ns0:s>
+        </ns0:echo>
+    </SOAP-ENV:Body>
+</SOAP-ENV:Envelope>


Mime
View raw message