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 ve...@apache.org on 2012/06/25 08:10:57 UTC
svn commit: r1353394 - in /axis/axis2/java/core/trunk/modules/jaxbri: ./
src/test/java/org/apache/axis2/jaxbri/
src/test/java/org/apache/axis2/jaxbri/processor/ src/test/resources/
src/test/resources/org/ src/test/resources/org/apache/ src/test/resourc...
Author: veithen
Date: Mon Jun 25 06:10:55 2012
New Revision: 1353394
URL: http://svn.apache.org/viewvc?rev=1353394&view=rev
Log:
Added unit tests providing evidence for AXIS2-5147.
Added:
axis/axis2/java/core/trunk/modules/jaxbri/src/test/java/org/apache/axis2/jaxbri/processor/
axis/axis2/java/core/trunk/modules/jaxbri/src/test/java/org/apache/axis2/jaxbri/processor/ProcessorImpl.java (with props)
axis/axis2/java/core/trunk/modules/jaxbri/src/test/java/org/apache/axis2/jaxbri/processor/ProcessorTest.java (with props)
axis/axis2/java/core/trunk/modules/jaxbri/src/test/resources/
axis/axis2/java/core/trunk/modules/jaxbri/src/test/resources/org/
axis/axis2/java/core/trunk/modules/jaxbri/src/test/resources/org/apache/
axis/axis2/java/core/trunk/modules/jaxbri/src/test/resources/org/apache/axis2/
axis/axis2/java/core/trunk/modules/jaxbri/src/test/resources/org/apache/axis2/jaxbri/
axis/axis2/java/core/trunk/modules/jaxbri/src/test/resources/org/apache/axis2/jaxbri/processor/
axis/axis2/java/core/trunk/modules/jaxbri/src/test/resources/org/apache/axis2/jaxbri/processor/request.xml (with props)
axis/axis2/java/core/trunk/modules/jaxbri/src/test/resources/org/apache/axis2/jaxbri/processor/response.xml (with props)
axis/axis2/java/core/trunk/modules/jaxbri/src/test/wsdl/processor.wsdl
Modified:
axis/axis2/java/core/trunk/modules/jaxbri/pom.xml
axis/axis2/java/core/trunk/modules/jaxbri/src/test/java/org/apache/axis2/jaxbri/Test01Test.java
Modified: axis/axis2/java/core/trunk/modules/jaxbri/pom.xml
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxbri/pom.xml?rev=1353394&r1=1353393&r2=1353394&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/jaxbri/pom.xml (original)
+++ axis/axis2/java/core/trunk/modules/jaxbri/pom.xml Mon Jun 25 06:10:55 2012
@@ -115,7 +115,6 @@
<tasks unless="maven.test.skip">
<!-- Theres got to be a better way to do this -->
<property name="schema.source.dir" value="src/test/xsd" />
- <property name="wsdl.source.dir" value="src/test/wsdl" />
<property name="schema.output.base.dir" value="target/schema" />
<property name="schema.generated.src.dir" value="${schema.output.base.dir}/src" />
<property name="schema.generated.classes.dir" value="${schema.output.base.dir}/classes" />
@@ -128,16 +127,34 @@
<java classname="com.sun.tools.xjc.Driver" fork="true">
<classpath refid="maven.runtime.classpath" />
<classpath location="${compiled.classes.dir}" />
- <arg line="-d ${schema.generated.src.dir} -quiet -wsdl ${wsdl.source.dir}/DocLitBareService.wsdl" />
+ <arg line="-d ${schema.generated.src.dir} -quiet -wsdl src/test/wsdl/DocLitBareService.wsdl" />
+ </java>
+ </tasks>
+ </configuration>
+ </execution>
+ <execution>
+ <id>wsdl2java</id>
+ <phase>generate-test-sources</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <tasks unless="maven.test.skip">
+ <java classname="org.apache.axis2.wsdl.WSDL2Java" fork="true">
+ <classpath refid="maven.test.classpath" />
+ <arg line="-d jaxbri -ss -ssi -sd -t -o ${project.build.directory}/gen/Test01 -u -uri src/test/wsdl/Test01.wsdl" />
+ </java>
+ <java classname="org.apache.axis2.wsdl.WSDL2Java" fork="true">
+ <classpath refid="maven.test.classpath" />
+ <arg line="-d jaxbri -t -o ${project.build.directory}/gen/Test01 -u -uri src/test/wsdl/Test01.wsdl" />
</java>
- <echo>Generating Service / Service Client for Test01 test</echo>
<java classname="org.apache.axis2.wsdl.WSDL2Java" fork="true">
<classpath refid="maven.test.classpath" />
- <arg line="-d jaxbri -ss -ssi -sd -t -o ${project.build.directory}/gen/Test01 -u -uri ${wsdl.source.dir}/Test01.wsdl" />
+ <arg line="-d jaxbri -ss -ssi -sd -t -o ${project.build.directory}/gen/processor -u -uri src/test/wsdl/processor.wsdl -ns2p http://www.example.org/data=org.apache.axis2.jaxbri.processor.data,http://www.example.org/ws=org.apache.axis2.jaxbri.processor.service" />
</java>
<java classname="org.apache.axis2.wsdl.WSDL2Java" fork="true">
<classpath refid="maven.test.classpath" />
- <arg line="-d jaxbri -t -o ${project.build.directory}/gen/Test01 -u -uri ${wsdl.source.dir}/Test01.wsdl" />
+ <arg line="-d jaxbri -t -o ${project.build.directory}/gen/processor -u -uri src/test/wsdl/processor.wsdl -ns2p http://www.example.org/data=org.apache.axis2.jaxbri.processor.data,http://www.example.org/ws=org.apache.axis2.jaxbri.processor.client" />
</java>
</tasks>
</configuration>
@@ -172,6 +189,7 @@
<sources>
<source>${project.build.directory}/schema/src</source>
<source>${project.build.directory}/gen/Test01/src</source>
+ <source>${project.build.directory}/gen/processor/src</source>
</sources>
</configuration>
</execution>
@@ -181,7 +199,7 @@
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
- <id>create-repo</id>
+ <id>Test01-repo</id>
<phase>generate-test-resources</phase>
<goals>
<goal>copy-resources</goal>
@@ -199,6 +217,25 @@
</resources>
</configuration>
</execution>
+ <execution>
+ <id>processor-repo</id>
+ <phase>generate-test-resources</phase>
+ <goals>
+ <goal>copy-resources</goal>
+ </goals>
+ <configuration>
+ <outputDirectory>${project.build.directory}/repo/processor</outputDirectory>
+ <resources>
+ <resource>
+ <directory>src/test/repo</directory>
+ </resource>
+ <resource>
+ <directory>${project.build.directory}/gen/processor/resources</directory>
+ <targetPath>services/processor.aar/META-INF</targetPath>
+ </resource>
+ </resources>
+ </configuration>
+ </execution>
</executions>
</plugin>
<plugin>
Modified: axis/axis2/java/core/trunk/modules/jaxbri/src/test/java/org/apache/axis2/jaxbri/Test01Test.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxbri/src/test/java/org/apache/axis2/jaxbri/Test01Test.java?rev=1353394&r1=1353393&r2=1353394&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/jaxbri/src/test/java/org/apache/axis2/jaxbri/Test01Test.java (original)
+++ axis/axis2/java/core/trunk/modules/jaxbri/src/test/java/org/apache/axis2/jaxbri/Test01Test.java Mon Jun 25 06:10:55 2012
@@ -47,7 +47,7 @@ public class Test01Test {
}
@Test
- public void test1() throws Exception {
+ public void test() throws Exception {
Test01 stub = new Test01Stub(UtilServer.getConfigurationContext(), "http://127.0.0.1:" + UtilServer.TESTING_PORT + "/axis2/services/Test01");
Add add = new Add();
add.setArg1(3);
Added: axis/axis2/java/core/trunk/modules/jaxbri/src/test/java/org/apache/axis2/jaxbri/processor/ProcessorImpl.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxbri/src/test/java/org/apache/axis2/jaxbri/processor/ProcessorImpl.java?rev=1353394&view=auto
==============================================================================
--- axis/axis2/java/core/trunk/modules/jaxbri/src/test/java/org/apache/axis2/jaxbri/processor/ProcessorImpl.java (added)
+++ axis/axis2/java/core/trunk/modules/jaxbri/src/test/java/org/apache/axis2/jaxbri/processor/ProcessorImpl.java Mon Jun 25 06:10:55 2012
@@ -0,0 +1,32 @@
+/*
+ * 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.jaxbri.processor;
+
+import org.apache.axis2.jaxbri.processor.data.ReplyMessage;
+import org.apache.axis2.jaxbri.processor.data.RequestMessage;
+import org.apache.axis2.jaxbri.processor.service.ProcessorSkeletonInterface;
+
+public class ProcessorImpl implements ProcessorSkeletonInterface {
+ public ReplyMessage runTransaction(RequestMessage requestMessage) {
+ ReplyMessage reply = new ReplyMessage();
+ reply.setReplyID(requestMessage.getRequestID() + ".1");
+ reply.setReplyData("PROCESSED");
+ return reply;
+ }
+}
Propchange: axis/axis2/java/core/trunk/modules/jaxbri/src/test/java/org/apache/axis2/jaxbri/processor/ProcessorImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: axis/axis2/java/core/trunk/modules/jaxbri/src/test/java/org/apache/axis2/jaxbri/processor/ProcessorTest.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxbri/src/test/java/org/apache/axis2/jaxbri/processor/ProcessorTest.java?rev=1353394&view=auto
==============================================================================
--- axis/axis2/java/core/trunk/modules/jaxbri/src/test/java/org/apache/axis2/jaxbri/processor/ProcessorTest.java (added)
+++ axis/axis2/java/core/trunk/modules/jaxbri/src/test/java/org/apache/axis2/jaxbri/processor/ProcessorTest.java Mon Jun 25 06:10:55 2012
@@ -0,0 +1,112 @@
+/*
+ * 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.jaxbri.processor;
+
+import static org.junit.Assert.assertEquals;
+
+import java.io.InputStream;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMResult;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMXMLBuilderFactory;
+import org.apache.axis2.Constants;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.client.Options;
+import org.apache.axis2.client.ServiceClient;
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.engine.AxisConfiguration;
+import org.apache.axis2.jaxbri.processor.client.Processor;
+import org.apache.axis2.jaxbri.processor.client.ProcessorStub;
+import org.apache.axis2.jaxbri.processor.data.ReplyMessage;
+import org.apache.axis2.jaxbri.processor.data.RequestMessage;
+import org.apache.axis2.testutils.UtilServer;
+import org.custommonkey.xmlunit.XMLAssert;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.w3c.dom.Document;
+
+/**
+ * Regression test for AXIS2-5147.
+ */
+public class ProcessorTest {
+ private static final String ENDPOINT = "http://127.0.0.1:" + UtilServer.TESTING_PORT + "/axis2/services/Processor";
+
+ @BeforeClass
+ public static void startServer() throws Exception {
+ UtilServer.start(System.getProperty("basedir", ".") + "/target/repo/processor");
+ AxisConfiguration axisConfiguration = UtilServer.getConfigurationContext().getAxisConfiguration();
+ AxisService service = axisConfiguration.getService("Processor");
+ service.getParameter(Constants.SERVICE_CLASS).setValue(ProcessorImpl.class.getName());
+ }
+
+ @AfterClass
+ public static void stopServer() throws Exception {
+ UtilServer.stop();
+ }
+
+ @Test
+ public void testStub() throws Exception {
+ Processor stub = new ProcessorStub(UtilServer.getConfigurationContext(), ENDPOINT);
+ RequestMessage request = new RequestMessage();
+ request.setRequestID("A3TN39840");
+ request.setRequestData("DATA");
+ ReplyMessage reply = stub.runTransaction(request);
+ assertEquals("A3TN39840.1", reply.getReplyID());
+ assertEquals("PROCESSED", reply.getReplyData());
+ }
+
+ @Ignore
+ @Test
+ public void testServiceClient() throws Exception {
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ dbf.setNamespaceAware(true);
+ DocumentBuilder db = dbf.newDocumentBuilder();
+ Document response = db.newDocument();
+ InputStream in = ProcessorTest.class.getResourceAsStream("request.xml");
+ try {
+ OMElement request = OMXMLBuilderFactory.createOMBuilder(in).getDocumentElement();
+ ServiceClient client = new ServiceClient(UtilServer.getConfigurationContext(), null);
+ Options options = client.getOptions();
+ options.setTo(new EndpointReference(ENDPOINT));
+ try {
+ OMElement omResponse = client.sendReceive(request);
+ TransformerFactory.newInstance().newTransformer().transform(omResponse.getSAXSource(false), new DOMResult(response));
+ } finally {
+ client.cleanupTransport();
+ client.cleanup();
+ }
+ } finally {
+ in.close();
+ }
+ in = ProcessorTest.class.getResourceAsStream("response.xml");
+ Document expectedResponse;
+ try {
+ expectedResponse = db.parse(in);
+ } finally {
+ in.close();
+ }
+ XMLAssert.assertXMLEqual(expectedResponse, response);
+ }
+}
Propchange: axis/axis2/java/core/trunk/modules/jaxbri/src/test/java/org/apache/axis2/jaxbri/processor/ProcessorTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: axis/axis2/java/core/trunk/modules/jaxbri/src/test/resources/org/apache/axis2/jaxbri/processor/request.xml
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxbri/src/test/resources/org/apache/axis2/jaxbri/processor/request.xml?rev=1353394&view=auto
==============================================================================
--- axis/axis2/java/core/trunk/modules/jaxbri/src/test/resources/org/apache/axis2/jaxbri/processor/request.xml (added)
+++ axis/axis2/java/core/trunk/modules/jaxbri/src/test/resources/org/apache/axis2/jaxbri/processor/request.xml Mon Jun 25 06:10:55 2012
@@ -0,0 +1,23 @@
+<?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.
+ -->
+<requestMessage xmlns="http://www.example.org/data">
+ <requestID>00I64913</requestID>
+ <requestData>TNSKHZHENNCLYJS5296249</requestData>
+</requestMessage>
\ No newline at end of file
Propchange: axis/axis2/java/core/trunk/modules/jaxbri/src/test/resources/org/apache/axis2/jaxbri/processor/request.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: axis/axis2/java/core/trunk/modules/jaxbri/src/test/resources/org/apache/axis2/jaxbri/processor/response.xml
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxbri/src/test/resources/org/apache/axis2/jaxbri/processor/response.xml?rev=1353394&view=auto
==============================================================================
--- axis/axis2/java/core/trunk/modules/jaxbri/src/test/resources/org/apache/axis2/jaxbri/processor/response.xml (added)
+++ axis/axis2/java/core/trunk/modules/jaxbri/src/test/resources/org/apache/axis2/jaxbri/processor/response.xml Mon Jun 25 06:10:55 2012
@@ -0,0 +1,23 @@
+<?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.
+ -->
+<replyMessage xmlns="http://www.example.org/data">
+ <replyID>00I64913.1</replyID>
+ <replyData>PROCESSED</replyData>
+</replyMessage>
\ No newline at end of file
Propchange: axis/axis2/java/core/trunk/modules/jaxbri/src/test/resources/org/apache/axis2/jaxbri/processor/response.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: axis/axis2/java/core/trunk/modules/jaxbri/src/test/wsdl/processor.wsdl
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxbri/src/test/wsdl/processor.wsdl?rev=1353394&view=auto
==============================================================================
--- axis/axis2/java/core/trunk/modules/jaxbri/src/test/wsdl/processor.wsdl (added)
+++ axis/axis2/java/core/trunk/modules/jaxbri/src/test/wsdl/processor.wsdl Mon Jun 25 06:10:55 2012
@@ -0,0 +1,80 @@
+<?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.
+ -->
+<!-- This is a modified version of the WSDL attached to AXIS2-5147 -->
+<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:data="http://www.example.org/data"
+ xmlns:tns="http://www.example.org/ws"
+ name="ExampleTransactionWS"
+ targetNamespace="http://www.example.org/ws">
+ <wsdl:types>
+ <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ attributeFormDefault="unqualified"
+ elementFormDefault="qualified"
+ targetNamespace="http://www.example.org/data">
+ <xsd:element name="requestMessage">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element minOccurs="0" name="requestID" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="requestData" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="replyMessage">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element minOccurs="0" name="replyID" type="xsd:string"/>
+ <xsd:element minOccurs="0" name="replyData" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ </wsdl:types>
+ <wsdl:message name="messageIn">
+ <wsdl:part element="data:requestMessage" name="input"/>
+ </wsdl:message>
+ <wsdl:message name="messageOut">
+ <wsdl:part element="data:replyMessage" name="result"/>
+ </wsdl:message>
+ <wsdl:portType name="Processor">
+ <wsdl:operation name="runTransaction">
+ <wsdl:input message="tns:messageIn" name="inputMessageIn"/>
+ <wsdl:output message="tns:messageOut" name="outputMessageOut"/>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="ProcessorSOAP" type="tns:Processor">
+ <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="runTransaction">
+ <soap:operation soapAction="runTransaction" style="document"/>
+ <wsdl:input name="inputMessageIn">
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output name="outputMessageOut">
+ <soap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="Processor">
+ <wsdl:port binding="tns:ProcessorSOAP" name="ProcessorSOAP">
+ <soap:address location="https://127.0.0.1/processor"/>
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>