You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-commits@axis.apache.org by bi...@apache.org on 2020/04/14 20:01:41 UTC

[axis-axis2-java-core] 09/12: AXIS2-5694: Merge r1730180 to the 1.6 branch.

This is an automated email from the ASF dual-hosted git repository.

billblough pushed a commit to branch 1_6
in repository https://gitbox.apache.org/repos/asf/axis-axis2-java-core.git

commit bd7f0e6071390ad57538127d8faa3a20f4c64872
Author: Andreas Veithen <ve...@apache.org>
AuthorDate: Sun Feb 14 23:07:00 2016 +0000

    AXIS2-5694: Merge r1730180 to the 1.6 branch.
---
 modules/adb-tests/pom.xml                          | 145 +++++++++++++++++++++
 .../apache/axis2/databinding/mtom/MTOMTest.java    |  53 ++++++++
 .../databinding/mtom/service/MTOMServiceImpl.java  |  34 +++++
 modules/adb-tests/src/test/wsdl/MTOMService.wsdl   |  48 +++++++
 pom.xml                                            |   6 +
 5 files changed, 286 insertions(+)

diff --git a/modules/adb-tests/pom.xml b/modules/adb-tests/pom.xml
new file mode 100644
index 0000000..46d24ea
--- /dev/null
+++ b/modules/adb-tests/pom.xml
@@ -0,0 +1,145 @@
+<?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/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.axis2</groupId>
+        <artifactId>axis2</artifactId>
+        <version>1.6.5-SNAPSHOT</version>
+        <relativePath>../../pom.xml</relativePath>
+    </parent>
+
+    <artifactId>axis2-adb-tests</artifactId>
+    <name>Apache Axis2 - ADB Tests</name>
+    <description>ADB Tests</description>
+    <url>http://axis.apache.org/axis2/java/core/</url>
+    <scm>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/axis/axis2/java/core/trunk/modules/adb-tests</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/axis/axis2/java/core/trunk/modules/adb-tests</developerConnection>
+        <url>http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/adb-tests</url>
+    </scm>
+    <dependencies>
+        <dependency>
+            <groupId>${project.groupId}</groupId>
+            <artifactId>axis2-adb</artifactId>
+            <version>${project.version}</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>${project.groupId}</groupId>
+            <artifactId>axis2-transport-local</artifactId>
+            <version>${project.version}</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>${project.groupId}</groupId>
+            <artifactId>axis2-transport-http</artifactId>
+            <version>${project.version}</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.ws.commons.axiom</groupId>
+            <artifactId>testutils</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>com.sun.xml.ws</groupId>
+            <artifactId>jaxws-rt</artifactId>
+            <version>2.2.6</version>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>${project.groupId}</groupId>
+                <artifactId>axis2-wsdl2code-maven-plugin</artifactId>
+                <version>${project.version}</version>
+                <executions>
+                    <execution>
+                        <phase>generate-test-sources</phase>
+                        <goals>
+                            <goal>wsdl2code</goal>
+                        </goals>
+                        <configuration>
+                            <wsdlFile>src/test/wsdl/MTOMService.wsdl</wsdlFile>
+                            <databindingName>adb</databindingName>
+                            <syncMode>sync</syncMode>
+                            <packageName>org.apache.axis2.databinding.mtom.client</packageName>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>jaxws-maven-plugin</artifactId>
+                <version>2.4.1</version>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>wsimport-test</goal>
+                        </goals>
+                        <configuration>
+                            <wsdlFiles>
+                                <wsdlFile>${basedir}/src/test/wsdl/MTOMService.wsdl</wsdlFile>
+                            </wsdlFiles>
+                            <packageName>org.apache.axis2.databinding.mtom.service</packageName>
+                        </configuration>
+                    </execution>
+                </executions>
+                <dependencies>
+                    <dependency>
+                        <groupId>com.sun.xml.ws</groupId>
+                        <artifactId>jaxws-tools</artifactId>
+                        <version>2.2.6</version>
+                    </dependency>
+                </dependencies>
+            </plugin>
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>build-helper-maven-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <phase>process-test-resources</phase>
+                        <goals>
+                            <goal>add-test-source</goal>
+                        </goals>
+                        <configuration>
+                            <sources>
+                                <source>${project.build.directory}/generated-sources/axis2/wsdl2code/src</source>
+                            </sources>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <artifactId>maven-deploy-plugin</artifactId>
+                <configuration>
+                    <skip>true</skip>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+</project>
diff --git a/modules/adb-tests/src/test/java/org/apache/axis2/databinding/mtom/MTOMTest.java b/modules/adb-tests/src/test/java/org/apache/axis2/databinding/mtom/MTOMTest.java
new file mode 100644
index 0000000..6ae0a79
--- /dev/null
+++ b/modules/adb-tests/src/test/java/org/apache/axis2/databinding/mtom/MTOMTest.java
@@ -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.axis2.databinding.mtom;
+
+import javax.activation.DataHandler;
+import javax.xml.ws.Endpoint;
+
+import org.apache.axiom.testutils.PortAllocator;
+import org.apache.axiom.testutils.activation.RandomDataSource;
+import org.apache.axiom.testutils.io.IOTestUtils;
+import org.apache.axis2.Constants;
+import org.apache.axis2.databinding.mtom.client.MTOMServiceStub;
+import org.apache.axis2.databinding.mtom.client.MTOMServiceStub.GetContent;
+import org.apache.axis2.databinding.mtom.service.MTOMServiceImpl;
+import org.junit.Ignore;
+import org.junit.Test;
+
+public class MTOMTest {
+    @Test
+    @Ignore("AXIS2-5694")
+    public void test() throws Exception {
+        int port = PortAllocator.allocatePort();
+        String address = "http://localhost:" + port + "/mtom";
+        Endpoint endpoint = Endpoint.publish(address, new MTOMServiceImpl());
+        try {
+            MTOMServiceStub stub = new MTOMServiceStub(address);
+            // JAX-WS only produces an MTOM response if the request uses MTOM
+            stub._getServiceClient().getOptions().setProperty(Constants.Configuration.ENABLE_MTOM, Constants.VALUE_TRUE);
+            DataHandler content = stub.getContent(new GetContent()).getContent();
+            IOTestUtils.compareStreams(
+                    new RandomDataSource(654321L, 1000000).getInputStream(), "expected",
+                    content.getInputStream(), "actual");
+        } finally {
+            endpoint.stop();
+        }
+    }
+}
diff --git a/modules/adb-tests/src/test/java/org/apache/axis2/databinding/mtom/service/MTOMServiceImpl.java b/modules/adb-tests/src/test/java/org/apache/axis2/databinding/mtom/service/MTOMServiceImpl.java
new file mode 100644
index 0000000..c843d30
--- /dev/null
+++ b/modules/adb-tests/src/test/java/org/apache/axis2/databinding/mtom/service/MTOMServiceImpl.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.axis2.databinding.mtom.service;
+
+import javax.activation.DataHandler;
+import javax.jws.WebService;
+import javax.xml.ws.soap.MTOM;
+
+import org.apache.axiom.testutils.activation.RandomDataSource;
+
+@WebService(endpointInterface="org.apache.axis2.databinding.mtom.service.MTOMService")
+@MTOM
+public class MTOMServiceImpl implements MTOMService {
+    @Override
+    public DataHandler getContent() {
+        return new DataHandler(new RandomDataSource(654321L, 1000000));
+    }
+}
diff --git a/modules/adb-tests/src/test/wsdl/MTOMService.wsdl b/modules/adb-tests/src/test/wsdl/MTOMService.wsdl
new file mode 100644
index 0000000..c7b1613
--- /dev/null
+++ b/modules/adb-tests/src/test/wsdl/MTOMService.wsdl
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://apache.org/axis2/mtom" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="MTOMService" targetNamespace="http://apache.org/axis2/mtom">
+  <wsdl:types>
+    <xsd:schema targetNamespace="http://apache.org/axis2/mtom" xmlns:xmime="http://www.w3.org/2005/05/xmlmime">
+      <xsd:element name="GetContent">
+        <xsd:complexType>
+          <xsd:sequence/>
+        </xsd:complexType>
+      </xsd:element>
+      <xsd:element name="GetContentResponse">
+        <xsd:complexType>
+          <xsd:sequence>
+            <xsd:element name="content" type="xsd:base64Binary" xmime:expectedContentTypes="application/octet-stream"/>
+          </xsd:sequence>
+        </xsd:complexType>
+      </xsd:element>
+    </xsd:schema>
+  </wsdl:types>
+  <wsdl:message name="GetContentRequest">
+    <wsdl:part element="tns:GetContent" name="parameters"/>
+  </wsdl:message>
+  <wsdl:message name="GetContentResponse">
+    <wsdl:part element="tns:GetContentResponse" name="parameters"/>
+  </wsdl:message>
+  <wsdl:portType name="MTOMService">
+    <wsdl:operation name="GetContent">
+      <wsdl:input message="tns:GetContentRequest"/>
+      <wsdl:output message="tns:GetContentResponse"/>
+    </wsdl:operation>
+  </wsdl:portType>
+  <wsdl:binding name="MTOMServiceSOAP" type="tns:MTOMService">
+    <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+    <wsdl:operation name="GetContent">
+      <soap:operation soapAction="http://apache.org/axis2/mtom/GetContent"/>
+      <wsdl:input>
+        <soap:body use="literal"/>
+      </wsdl:input>
+      <wsdl:output>
+        <soap:body use="literal"/>
+      </wsdl:output>
+    </wsdl:operation>
+  </wsdl:binding>
+  <wsdl:service name="MTOMService">
+    <wsdl:port binding="tns:MTOMServiceSOAP" name="MTOMServiceSOAP">
+      <soap:address location="http://localhost:8080/mtom"/>
+    </wsdl:port>
+  </wsdl:service>
+</wsdl:definitions>
diff --git a/pom.xml b/pom.xml
index 9f92f05..300f83f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -42,6 +42,7 @@
         <module>apidocs</module>
         <module>modules/adb</module>
         <module>modules/adb-codegen</module>
+        <module>modules/adb-tests</module>
         <module>modules/addressing</module>
         <module>modules/codegen</module>
         <module>modules/fastinfoset</module>
@@ -681,6 +682,11 @@
             </dependency>
             <dependency>
                 <groupId>org.apache.ws.commons.axiom</groupId>
+                <artifactId>testutils</artifactId>
+                <version>${axiom.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.ws.commons.axiom</groupId>
                 <artifactId>xml-truth</artifactId>
                 <version>${axiom.version}</version>
             </dependency>