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 578df916e85b8b799ab71d58a752d516a022940b Author: Andreas Veithen <veit...@apache.org> AuthorDate: Wed Mar 16 22:55:13 2016 +0000 AXIS2-5749: Merge r1735331 (unit test only) to the 1.6 branch. --- modules/adb-tests/pom.xml | 35 ++++++++++++ .../axis2/databinding/axis2_5749/ServiceTest.java | 54 +++++++++++++++++++ .../axis2_5749/service/ColorServiceImpl.java | 36 +++++++++++++ modules/adb-tests/src/test/wsdl/AXIS2-5749.wsdl | 62 ++++++++++++++++++++++ modules/adb-tests/src/test/xslt/AXIS2-5749.xsl | 11 ++++ 5 files changed, 198 insertions(+) diff --git a/modules/adb-tests/pom.xml b/modules/adb-tests/pom.xml index 43a11ef..36722f4 100644 --- a/modules/adb-tests/pom.xml +++ b/modules/adb-tests/pom.xml @@ -105,6 +105,20 @@ <outputDirectory>${project.build.directory}/wsdl2code/AXIS2-5741</outputDirectory> </configuration> </execution> + <execution> + <id>wsdl2code-axis2-5749</id> + <phase>generate-test-sources</phase> + <goals> + <goal>wsdl2code</goal> + </goals> + <configuration> + <wsdlFile>src/test/wsdl/AXIS2-5749.wsdl</wsdlFile> + <packageName>org.apache.axis2.databinding.axis2_5749.service</packageName> + <generateServerSide>true</generateServerSide> + <generateServicesXml>true</generateServicesXml> + <outputDirectory>${project.build.directory}/wsdl2code/AXIS2-5749</outputDirectory> + </configuration> + </execution> </executions> <configuration> <databindingName>adb</databindingName> @@ -130,6 +144,14 @@ <stylesheet>src/test/xslt/AXIS2-5741.xsl</stylesheet> <outputDir>${project.build.directory}/repo/AXIS2-5741/services/FiverxLinkService/META-INF</outputDir> </transformationSet> + <transformationSet> + <dir>${project.build.directory}/wsdl2code/AXIS2-5749/resources</dir> + <includes> + <include>services.xml</include> + </includes> + <stylesheet>src/test/xslt/AXIS2-5749.xsl</stylesheet> + <outputDir>${project.build.directory}/repo/AXIS2-5749/services/ColorService/META-INF</outputDir> + </transformationSet> </transformationSets> </configuration> </execution> @@ -164,6 +186,18 @@ <packageName>org.apache.axis2.databinding.axis2_5741.client</packageName> </configuration> </execution> + <execution> + <id>wsimport-axis2-5749</id> + <goals> + <goal>wsimport-test</goal> + </goals> + <configuration> + <wsdlFiles> + <wsdlFile>${basedir}/src/test/wsdl/AXIS2-5749.wsdl</wsdlFile> + </wsdlFiles> + <packageName>org.apache.axis2.databinding.axis2_5749.client</packageName> + </configuration> + </execution> </executions> <dependencies> <dependency> @@ -186,6 +220,7 @@ <sources> <source>${project.build.directory}/wsdl2code/mtom/src</source> <source>${project.build.directory}/wsdl2code/AXIS2-5741/src</source> + <source>${project.build.directory}/wsdl2code/AXIS2-5749/src</source> </sources> </configuration> </execution> diff --git a/modules/adb-tests/src/test/java/org/apache/axis2/databinding/axis2_5749/ServiceTest.java b/modules/adb-tests/src/test/java/org/apache/axis2/databinding/axis2_5749/ServiceTest.java new file mode 100644 index 0000000..316e389 --- /dev/null +++ b/modules/adb-tests/src/test/java/org/apache/axis2/databinding/axis2_5749/ServiceTest.java @@ -0,0 +1,54 @@ +/* + * 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.axis2_5749; + +import static com.google.common.truth.Truth.assertThat; + +import javax.xml.ws.BindingProvider; + +import org.apache.axiom.testutils.PortAllocator; +import org.apache.axis2.context.ConfigurationContext; +import org.apache.axis2.context.ConfigurationContextFactory; +import org.apache.axis2.databinding.axis2_5749.client.Color; +import org.apache.axis2.databinding.axis2_5749.client.ColorService; +import org.apache.axis2.databinding.axis2_5749.client.ColorService_Service; +import org.apache.axis2.transport.http.SimpleHTTPServer; +import org.junit.Test; + +public class ServiceTest { + @Test + public void test() throws Exception { + int port = PortAllocator.allocatePort(); + ConfigurationContext configurationContext = + ConfigurationContextFactory.createConfigurationContextFromFileSystem("target/repo/AXIS2-5749"); + SimpleHTTPServer server = new SimpleHTTPServer(configurationContext, port); + server.start(); + try { + ColorService client = new ColorService_Service().getColorServiceSOAP(); + ((BindingProvider)client).getRequestContext().put( + BindingProvider.ENDPOINT_ADDRESS_PROPERTY, + "http://localhost:" + port + "/axis2/services/ColorService"); + Color color = new Color(); + color.setIn("RED"); + assertThat(client.test(color).getOut()).isEqualTo("Red is good!"); + } finally { + server.stop(); + } + } +} diff --git a/modules/adb-tests/src/test/java/org/apache/axis2/databinding/axis2_5749/service/ColorServiceImpl.java b/modules/adb-tests/src/test/java/org/apache/axis2/databinding/axis2_5749/service/ColorServiceImpl.java new file mode 100644 index 0000000..6e736c3 --- /dev/null +++ b/modules/adb-tests/src/test/java/org/apache/axis2/databinding/axis2_5749/service/ColorServiceImpl.java @@ -0,0 +1,36 @@ +/* + * 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.axis2_5749.service; + +import com.ise_online.colorservice.Color; +import com.ise_online.colorservice.ColorResponse; +import com.ise_online.colorservice.In_type1; + +public class ColorServiceImpl extends ColorServiceSkeleton { + @Override + public ColorResponse test(Color color) { + ColorResponse response = new ColorResponse(); + if (color.getIn() == In_type1.RED) { + response.setOut("Red is good!"); + } else { + response.setOut("Don't like that color..."); + } + return response; + } +} diff --git a/modules/adb-tests/src/test/wsdl/AXIS2-5749.wsdl b/modules/adb-tests/src/test/wsdl/AXIS2-5749.wsdl new file mode 100644 index 0000000..719fdd2 --- /dev/null +++ b/modules/adb-tests/src/test/wsdl/AXIS2-5749.wsdl @@ -0,0 +1,62 @@ +<?xml version="1.0" encoding="UTF-8"?> +<wsdl:definitions name="ColorService" targetNamespace="http://ise-online.com/ColorService/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://ise-online.com/ColorService/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"> + <wsdl:types> + <xsd:schema targetNamespace="http://ise-online.com/ColorService/"> + <xsd:element name="Color"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="in"> + <xsd:simpleType> + <xsd:restriction base="xsd:string"> + <xsd:enumeration value="RED"/> + <xsd:enumeration value="GREEN"/> + <xsd:enumeration value="BLUE"/> + </xsd:restriction> + </xsd:simpleType> + </xsd:element> + </xsd:sequence> + </xsd:complexType> + </xsd:element> + <xsd:element name="ColorResponse"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="out" type="xsd:string"/> + </xsd:sequence> + </xsd:complexType> + </xsd:element> + </xsd:schema> + </wsdl:types> + <wsdl:message name="TestRequest"> + <wsdl:part name="parameters" element="tns:Color"> + </wsdl:part> + </wsdl:message> + <wsdl:message name="TestResponse"> + <wsdl:part name="parameters" element="tns:ColorResponse"> + </wsdl:part> + </wsdl:message> + <wsdl:portType name="ColorService"> + <wsdl:operation name="Test"> + <wsdl:input message="tns:TestRequest"> + </wsdl:input> + <wsdl:output message="tns:TestResponse"> + </wsdl:output> + </wsdl:operation> + </wsdl:portType> + <wsdl:binding name="ColorServiceSOAP" type="tns:ColorService"> + <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/> + <wsdl:operation name="Test"> + <soap:operation soapAction="http://ise-online.com/ColorService/Test"/> + <wsdl:input> + <soap:body use="literal"/> + </wsdl:input> + <wsdl:output> + <soap:body use="literal"/> + </wsdl:output> + </wsdl:operation> + </wsdl:binding> + <wsdl:service name="ColorService"> + <wsdl:port name="ColorServiceSOAP" binding="tns:ColorServiceSOAP"> + <soap:address location="http://www.example.org/"/> + </wsdl:port> + </wsdl:service> +</wsdl:definitions> diff --git a/modules/adb-tests/src/test/xslt/AXIS2-5749.xsl b/modules/adb-tests/src/test/xslt/AXIS2-5749.xsl new file mode 100644 index 0000000..4fae41e --- /dev/null +++ b/modules/adb-tests/src/test/xslt/AXIS2-5749.xsl @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="UTF-8"?> +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + <xsl:template match="/serviceGroup/service[@name='ColorService']/parameter[@name='ServiceClass']/text()"> + org.apache.axis2.databinding.axis2_5749.service.ColorServiceImpl + </xsl:template> + <xsl:template match="@*|node()"> + <xsl:copy> + <xsl:apply-templates select="@*|node()"/> + </xsl:copy> + </xsl:template> +</xsl:stylesheet>