Author: veithen Date: Sun Jun 24 17:05:54 2012 New Revision: 1353296 URL: http://svn.apache.org/viewvc?rev=1353296&view=rev Log: Ensure non zero test coverage for axis2-jaxbri.
Added: axis/axis2/java/core/trunk/modules/jaxbri/src/test/java/org/apache/ axis/axis2/java/core/trunk/modules/jaxbri/src/test/java/org/apache/axis2/ axis/axis2/java/core/trunk/modules/jaxbri/src/test/java/org/apache/axis2/jaxbri/ axis/axis2/java/core/trunk/modules/jaxbri/src/test/java/org/apache/axis2/jaxbri/Test01Impl.java (with props) axis/axis2/java/core/trunk/modules/jaxbri/src/test/java/org/apache/axis2/jaxbri/Test01Test.java (with props) axis/axis2/java/core/trunk/modules/jaxbri/src/test/repo/ axis/axis2/java/core/trunk/modules/jaxbri/src/test/repo/conf/ axis/axis2/java/core/trunk/modules/jaxbri/src/test/repo/conf/axis2.xml (with props) axis/axis2/java/core/trunk/modules/testutils/src/main/java/org/apache/axis2/testutils/UtilServer.java - copied, changed from r1353277, axis/axis2/java/core/trunk/modules/jibx/src/test/java/org/apache/axis2/jibx/UtilServer.java Removed: axis/axis2/java/core/trunk/modules/jibx/src/test/java/org/apache/axis2/jibx/UtilServer.java Modified: axis/axis2/java/core/trunk/modules/jaxbri/pom.xml axis/axis2/java/core/trunk/modules/jibx/src/test/java/org/apache/axis2/jibx/Test.java axis/axis2/java/core/trunk/modules/jibx/src/test/java/org/apache/axis2/jibx/library/unwrapped/LibraryTest.java axis/axis2/java/core/trunk/modules/jibx/src/test/java/org/apache/axis2/jibx/library/wrapped/LibraryTest.java axis/axis2/java/core/trunk/modules/testutils/pom.xml 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=1353296&r1=1353295&r2=1353296&view=diff ============================================================================== --- axis/axis2/java/core/trunk/modules/jaxbri/pom.xml (original) +++ axis/axis2/java/core/trunk/modules/jaxbri/pom.xml Sun Jun 24 17:05:54 2012 @@ -63,6 +63,12 @@ <artifactId>xmlunit</artifactId> <scope>test</scope> </dependency> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>axis2-testutils</artifactId> + <version>${project.version}</version> + <scope>test</scope> + </dependency> </dependencies> <url>http://axis.apache.org/axis2/java/core/</url> <scm> @@ -126,9 +132,12 @@ </java> <echo>Generating Service / Service Client for Test01 test</echo> <java classname="org.apache.axis2.wsdl.WSDL2Java" fork="true"> - <classpath refid="maven.runtime.classpath" /> - <classpath location="${compiled.classes.dir}" /> - <arg line="-d jaxbri -ss -sd -t -o ${project.build.directory}/gen/Test01 -u -uri ${wsdl.source.dir}/Test01.wsdl" /> + <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" /> + </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" /> </java> </tasks> </configuration> @@ -169,6 +178,30 @@ </executions> </plugin> <plugin> + <artifactId>maven-resources-plugin</artifactId> + <executions> + <execution> + <id>create-repo</id> + <phase>generate-test-resources</phase> + <goals> + <goal>copy-resources</goal> + </goals> + <configuration> + <outputDirectory>${project.build.directory}/repo/Test01</outputDirectory> + <resources> + <resource> + <directory>src/test/repo</directory> + </resource> + <resource> + <directory>${project.build.directory}/gen/Test01/resources</directory> + <targetPath>services/Test01.aar/META-INF</targetPath> + </resource> + </resources> + </configuration> + </execution> + </executions> + </plugin> + <plugin> <artifactId>maven-surefire-plugin</artifactId> <inherited>true</inherited> <configuration> Added: axis/axis2/java/core/trunk/modules/jaxbri/src/test/java/org/apache/axis2/jaxbri/Test01Impl.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxbri/src/test/java/org/apache/axis2/jaxbri/Test01Impl.java?rev=1353296&view=auto ============================================================================== --- axis/axis2/java/core/trunk/modules/jaxbri/src/test/java/org/apache/axis2/jaxbri/Test01Impl.java (added) +++ axis/axis2/java/core/trunk/modules/jaxbri/src/test/java/org/apache/axis2/jaxbri/Test01Impl.java Sun Jun 24 17:05:54 2012 @@ -0,0 +1,28 @@ +/* + * 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; + +import com.foo.wsns.axis2.test01.Test01SkeletonInterface; +import com.foo.xmlns.axis2.test01.Add; + +public class Test01Impl implements Test01SkeletonInterface { + public int add(Add add) { + return add.getArg1() + add.getArg2(); + } +} Propchange: axis/axis2/java/core/trunk/modules/jaxbri/src/test/java/org/apache/axis2/jaxbri/Test01Impl.java ------------------------------------------------------------------------------ svn:eol-style = native Added: 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=1353296&view=auto ============================================================================== --- axis/axis2/java/core/trunk/modules/jaxbri/src/test/java/org/apache/axis2/jaxbri/Test01Test.java (added) +++ axis/axis2/java/core/trunk/modules/jaxbri/src/test/java/org/apache/axis2/jaxbri/Test01Test.java Sun Jun 24 17:05:54 2012 @@ -0,0 +1,57 @@ +/* + * 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; + +import static org.junit.Assert.assertEquals; + +import org.apache.axis2.Constants; +import org.apache.axis2.description.AxisService; +import org.apache.axis2.engine.AxisConfiguration; +import org.apache.axis2.testutils.UtilServer; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +import com.foo.wsns.axis2.test01.Test01; +import com.foo.wsns.axis2.test01.Test01Stub; +import com.foo.xmlns.axis2.test01.Add; + +public class Test01Test { + @BeforeClass + public static void startServer() throws Exception { + UtilServer.start(System.getProperty("basedir", ".") + "/target/repo/Test01"); + AxisConfiguration axisConfiguration = UtilServer.getConfigurationContext().getAxisConfiguration(); + AxisService service = axisConfiguration.getService("Test01"); + service.getParameter(Constants.SERVICE_CLASS).setValue(Test01Impl.class.getName()); + } + + @AfterClass + public static void stopServer() throws Exception { + UtilServer.stop(); + } + + @Test + public void test1() 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); + add.setArg2(4); + assertEquals(7, stub.add(add)); + } +} Propchange: axis/axis2/java/core/trunk/modules/jaxbri/src/test/java/org/apache/axis2/jaxbri/Test01Test.java ------------------------------------------------------------------------------ svn:eol-style = native Added: axis/axis2/java/core/trunk/modules/jaxbri/src/test/repo/conf/axis2.xml URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxbri/src/test/repo/conf/axis2.xml?rev=1353296&view=auto ============================================================================== --- axis/axis2/java/core/trunk/modules/jaxbri/src/test/repo/conf/axis2.xml (added) +++ axis/axis2/java/core/trunk/modules/jaxbri/src/test/repo/conf/axis2.xml Sun Jun 24 17:05:54 2012 @@ -0,0 +1,163 @@ +<!-- + ~ 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. + --> + +<axisconfig name="AxisJava2.0"> + <!-- ================================================= --> + <!-- Parameters --> + <!-- ================================================= --> + <parameter name="hotdeployment">true</parameter> + <parameter name="hotupdate">false</parameter> + <parameter name="enableMTOM">false</parameter> + <parameter name="sendStacktraceDetailsWithFaults">true</parameter> + + <parameter name="userName">admin</parameter> + <parameter name="password">axis2</parameter> + + <!-- If you have a frontend host which exposes this webservice using a different public URL --> + <!-- use this parameter to override autodetected url --> + <!--<parameter name="httpFrontendHostUrl">https://someotherhost/context</parameter>--> + + + <!-- The way of adding listener to the system--> + <!-- <listener class="org.apache.axis2.ObserverIMPL">--> + <!-- <parameter name="RSS_URL">http://127.0.0.1/rss</parameter>--> + <!-- </listener>--> + + <!-- ================================================= --> + <!-- Deployers --> + <!-- ================================================= --> + + <!--Service deployer , this will alow users to deploy AAR or exploded AAR as axis2 services--> + <deployer extension=".aar" directory="services" class="org.apache.axis2.deployment.ServiceDeployer"> + <serviceBuilderExtension name ="jwsbuilderExt" class="org.apache.axis2.jaxws.framework.JAXWSServiceBuilderExtension"/> + <serviceBuilderExtension name ="wsdlbuilderExt" class="org.apache.axis2.deployment.WSDLServiceBuilderExtension"/> + </deployer> + + <!-- ================================================= --> + <!-- Message Receivers --> + <!-- ================================================= --> + <!--This is the Deafult Message Receiver for the system , if you want to have MessageReceivers for --> + <!--all the other MEP implement it and add the correct entry to here , so that you can refer from--> + <!--any operation --> + <!--Note : You can ovride this for particular service by adding the same element with your requirement--> + <messageReceivers> + <messageReceiver mep="http://www.w3.org/ns/wsdl/in-only" + class="org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver"/> + <messageReceiver mep="http://www.w3.org/ns/wsdl/in-out" + class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/> + </messageReceivers> + <!-- ================================================= --> + <!-- Transport Ins --> + <!-- ================================================= --> + <transportReceiver name="http" + class="org.apache.axis2.transport.http.SimpleHTTPServer"> + <parameter name="port">6060</parameter> + <!--If you want to give your own host address for EPR generation--> + <!--uncommet following paramter , and set as you required.--> + <!--<parameter name="hostname">http://myApp.com/ws</parameter>--> + </transportReceiver> + + <!-- ================================================= --> + <!-- Transport Outs --> + <!-- ================================================= --> + + <transportSender name="local" + class="org.apache.axis2.transport.local.LocalTransportSender"/> + <transportSender name="http" + class="org.apache.axis2.transport.http.CommonsHTTPTransportSender"> + <parameter name="PROTOCOL">HTTP/1.1</parameter> + <parameter name="Transfer-Encoding">chunked</parameter> + </transportSender> + <transportSender name="https" + class="org.apache.axis2.transport.http.CommonsHTTPTransportSender"> + <parameter name="PROTOCOL">HTTP/1.1</parameter> + <parameter name="Transfer-Encoding">chunked</parameter> + </transportSender> + + <!-- ================================================= --> + <!-- Global Modules --> + <!-- ================================================= --> + <!-- Comment this to disable Addressing --> +<!-- <module ref="addressing"/> --> + + <!--Configuring module , providing parameters for modules whether they refer or not--> + <!--<moduleConfig name="addressing">--> + <!--<parameter name="addressingPara">N/A</parameter>--> + <!--</moduleConfig>--> + + <!-- ================================================= --> + <!-- Phases --> + <!-- ================================================= --> + <phaseOrder type="InFlow"> + <!-- System pre defined phases --> + <phase name="Transport"> + <handler name="RequestURIBasedDispatcher" + class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher"/> + <handler name="RequestURIBasedOperationDispatcher" + class="org.apache.axis2.dispatchers.RequestURIBasedOperationDispatcher"/> + <handler name="SOAPActionBasedDispatcher" + class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher"/> + </phase> + <phase name="Security"/> + <phase name="PreDispatch"/> + <phase name="Dispatch" class="org.apache.axis2.engine.DispatchPhase"> + <handler name="AddressingBasedDispatcher" + class="org.apache.axis2.dispatchers.AddressingBasedDispatcher"/> + + <handler name="SOAPMessageBodyBasedDispatcher" + class="org.apache.axis2.dispatchers.SOAPMessageBodyBasedDispatcher"/> + </phase> + <!-- System pre defined phases --> + <!-- After Postdispatch phase module author or or service author can add any phase he want --> + <phase name="OperationInPhase"/> + </phaseOrder> + <phaseOrder type="OutFlow"> + <!-- user can add his own phases to this area --> + <phase name="OperationOutPhase"/> + <!--system predefined phase--> + <!--these phase will run irrespective of the service--> + <phase name="PolicyDetermination"/> + <phase name="MessageOut"/> + </phaseOrder> + <phaseOrder type="InFaultFlow"> + <phase name="PreDispatch"/> + <phase name="Dispatch" class="org.apache.axis2.engine.DispatchPhase"> + <handler name="RequestURIBasedDispatcher" + class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher"/> + + <handler name="SOAPActionBasedDispatcher" + class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher"/> + + <handler name="AddressingBasedDispatcher" + class="org.apache.axis2.dispatchers.AddressingBasedDispatcher"/> + + <handler name="SOAPMessageBodyBasedDispatcher" + class="org.apache.axis2.dispatchers.SOAPMessageBodyBasedDispatcher"/> + </phase> + <!-- user can add his own phases to this area --> + <phase name="OperationInFaultPhase"/> + </phaseOrder> + <phaseOrder type="OutFaultFlow"> + <!-- user can add his own phases to this area --> + <phase name="OperationOutFaultPhase"/> + <phase name="PolicyDetermination"/> + <phase name="MessageOut"/> + </phaseOrder> +</axisconfig> + Propchange: axis/axis2/java/core/trunk/modules/jaxbri/src/test/repo/conf/axis2.xml ------------------------------------------------------------------------------ svn:eol-style = native Modified: axis/axis2/java/core/trunk/modules/jibx/src/test/java/org/apache/axis2/jibx/Test.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jibx/src/test/java/org/apache/axis2/jibx/Test.java?rev=1353296&r1=1353295&r2=1353296&view=diff ============================================================================== --- axis/axis2/java/core/trunk/modules/jibx/src/test/java/org/apache/axis2/jibx/Test.java (original) +++ axis/axis2/java/core/trunk/modules/jibx/src/test/java/org/apache/axis2/jibx/Test.java Sun Jun 24 17:05:54 2012 @@ -22,6 +22,7 @@ package org.apache.axis2.jibx; import junit.framework.TestCase; import org.apache.axis2.description.AxisService; import org.apache.axis2.jibx.customer.EchoCustomerServiceStub; +import org.apache.axis2.testutils.UtilServer; import org.apache.axis2.util.Utils; import javax.xml.namespace.QName; Modified: axis/axis2/java/core/trunk/modules/jibx/src/test/java/org/apache/axis2/jibx/library/unwrapped/LibraryTest.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jibx/src/test/java/org/apache/axis2/jibx/library/unwrapped/LibraryTest.java?rev=1353296&r1=1353295&r2=1353296&view=diff ============================================================================== --- axis/axis2/java/core/trunk/modules/jibx/src/test/java/org/apache/axis2/jibx/library/unwrapped/LibraryTest.java (original) +++ axis/axis2/java/core/trunk/modules/jibx/src/test/java/org/apache/axis2/jibx/library/unwrapped/LibraryTest.java Sun Jun 24 17:05:54 2012 @@ -24,10 +24,10 @@ import static org.junit.Assert.assertNot import org.apache.axis2.Constants; import org.apache.axis2.description.AxisService; import org.apache.axis2.engine.AxisConfiguration; -import org.apache.axis2.jibx.UtilServer; import org.apache.axis2.jibx.beans.Book; import org.apache.axis2.jibx.library.unwrapped.client.LibraryStub; import org.apache.axis2.jibx.library.unwrapped.service.LibraryImpl; +import org.apache.axis2.testutils.UtilServer; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; Modified: axis/axis2/java/core/trunk/modules/jibx/src/test/java/org/apache/axis2/jibx/library/wrapped/LibraryTest.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jibx/src/test/java/org/apache/axis2/jibx/library/wrapped/LibraryTest.java?rev=1353296&r1=1353295&r2=1353296&view=diff ============================================================================== --- axis/axis2/java/core/trunk/modules/jibx/src/test/java/org/apache/axis2/jibx/library/wrapped/LibraryTest.java (original) +++ axis/axis2/java/core/trunk/modules/jibx/src/test/java/org/apache/axis2/jibx/library/wrapped/LibraryTest.java Sun Jun 24 17:05:54 2012 @@ -21,11 +21,11 @@ package org.apache.axis2.jibx.library.wr import org.apache.axis2.Constants; import org.apache.axis2.description.AxisService; import org.apache.axis2.engine.AxisConfiguration; -import org.apache.axis2.jibx.UtilServer; import org.apache.axis2.jibx.beans.Book; import org.apache.axis2.jibx.library.wrapped.client.LibraryStub; import org.apache.axis2.jibx.library.wrapped.service.LibraryImpl; import org.apache.axis2.jibx.wrappers.AddBookRequest; +import org.apache.axis2.testutils.UtilServer; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; Modified: axis/axis2/java/core/trunk/modules/testutils/pom.xml URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/testutils/pom.xml?rev=1353296&r1=1353295&r2=1353296&view=diff ============================================================================== --- axis/axis2/java/core/trunk/modules/testutils/pom.xml (original) +++ axis/axis2/java/core/trunk/modules/testutils/pom.xml Sun Jun 24 17:05:54 2012 @@ -30,6 +30,16 @@ <description>Contains utility classes used by the unit tests in Axis2.</description> <dependencies> <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>axis2-kernel</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>axis2-transport-http</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <scope>compile</scope> Copied: axis/axis2/java/core/trunk/modules/testutils/src/main/java/org/apache/axis2/testutils/UtilServer.java (from r1353277, axis/axis2/java/core/trunk/modules/jibx/src/test/java/org/apache/axis2/jibx/UtilServer.java) URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/testutils/src/main/java/org/apache/axis2/testutils/UtilServer.java?p2=axis/axis2/java/core/trunk/modules/testutils/src/main/java/org/apache/axis2/testutils/UtilServer.java&p1=axis/axis2/java/core/trunk/modules/jibx/src/test/java/org/apache/axis2/jibx/UtilServer.java&r1=1353277&r2=1353296&rev=1353296&view=diff ============================================================================== --- axis/axis2/java/core/trunk/modules/jibx/src/test/java/org/apache/axis2/jibx/UtilServer.java (original) +++ axis/axis2/java/core/trunk/modules/testutils/src/main/java/org/apache/axis2/testutils/UtilServer.java Sun Jun 24 17:05:54 2012 @@ -17,14 +17,13 @@ * under the License. */ -package org.apache.axis2.jibx; +package org.apache.axis2.testutils; import org.apache.axis2.AxisFault; import org.apache.axis2.context.ConfigurationContext; import org.apache.axis2.context.ConfigurationContextFactory; import org.apache.axis2.description.AxisService; import org.apache.axis2.engine.ListenerManager; -import org.apache.axis2.testutils.PortAllocator; import org.apache.axis2.transport.http.SimpleHTTPServer; import javax.xml.namespace.QName;