You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by ke...@apache.org on 2009/02/27 10:05:12 UTC
svn commit: r748447 [1/2] - in /webservices/axis2/trunk/java/modules:
integration/ integration/test-resources/jaxrs/
integration/test-resources/jaxrs/archiveTestModule/
integration/test-resources/jaxrs/archiveTestModule/META-INF/
integration/test-resou...
Author: keithc
Date: Fri Feb 27 09:05:11 2009
New Revision: 748447
URL: http://svn.apache.org/viewvc?rev=748447&view=rev
Log:
Applying the patch given by Pradeep for AXIS2-4237. Thanks Pradeep for these test cases
Added:
webservices/axis2/trunk/java/modules/integration/test-resources/jaxrs/
webservices/axis2/trunk/java/modules/integration/test-resources/jaxrs/archiveTestModule/
webservices/axis2/trunk/java/modules/integration/test-resources/jaxrs/archiveTestModule/META-INF/
webservices/axis2/trunk/java/modules/integration/test-resources/jaxrs/archiveTestModule/META-INF/Services.xml
webservices/axis2/trunk/java/modules/integration/test-resources/jaxrs/archiveTestModule/build.xml
webservices/axis2/trunk/java/modules/integration/test-resources/jaxrs/archiveTestModule/org/
webservices/axis2/trunk/java/modules/integration/test-resources/jaxrs/archiveTestModule/org/apache/
webservices/axis2/trunk/java/modules/integration/test-resources/jaxrs/archiveTestModule/org/apache/jaxrs/
webservices/axis2/trunk/java/modules/integration/test-resources/jaxrs/archiveTestModule/org/apache/jaxrs/Service.java
webservices/axis2/trunk/java/modules/integration/test-resources/jaxrs/pojo-enabled-axis2.xml
webservices/axis2/trunk/java/modules/integration/test-resources/jaxrs/pojoTestModule/
webservices/axis2/trunk/java/modules/integration/test-resources/jaxrs/pojoTestModule/PojoService.java
webservices/axis2/trunk/java/modules/integration/test-resources/jaxrs/pojoTestModule/build.xml
webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/jaxrs/
webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/jaxrs/ArchiveDeploymentTest.java
webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/jaxrs/PojoTest.java
webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/jaxrs/TestUtil.java
Modified:
webservices/axis2/trunk/java/modules/integration/itest-build.xml
webservices/axis2/trunk/java/modules/integration/pom.xml
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/JAXRS/JAXRSModel.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/JAXRS/JAXRSUtils.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/util/Utils.java
Modified: webservices/axis2/trunk/java/modules/integration/itest-build.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/integration/itest-build.xml?rev=748447&r1=748446&r2=748447&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/itest-build.xml (original)
+++ webservices/axis2/trunk/java/modules/integration/itest-build.xml Fri Feb 27 09:05:11 2009
@@ -309,7 +309,8 @@
<mkdir dir="target/perf/build/repo/modules"/>
<copy file="../addressing/target/addressing-${addressing_version}.mar"
tofile="target/perf/build/repo/modules/addressing-${addressing_version}.mar"/>
- </target>
+ <antcall target="build-jaxrs-services"/>
+ </target>
<target name="build-soap12-services">
<ant antfile="build.xml" inheritall="true" inheritrefs="true"
dir="test-resources/SOAP12Testing/SOAP12TestModuleB"/>
@@ -320,4 +321,17 @@
<ant antfile="build.xml" inheritall="true" inheritrefs="true"
dir="test-resources/SOAP12Testing/SOAP12TestServiceC"/>
</target>
+
+ <target name="build-jaxrs-services">
+ <ant antfile="build.xml" inheritall="true" inheritrefs="true"
+ dir="test-resources/jaxrs/archiveTestModule"/>
+ <ant antfile="build.xml" inheritall="true" inheritrefs="true"
+ dir="test-resources/jaxrs/pojoTestModule"/>
+ <mkdir dir="target/test-resources/jaxrs-repository/conf/"/>
+ <copy file="test-resources/jaxrs/pojo-enabled-axis2.xml"
+ tofile="target/test-resources/jaxrs-repository/conf/axis2.xml"/>
+ <mkdir dir="target/test-resources/jaxrs-repository/modules"/>
+ <copy file="../addressing/target/addressing-SNAPSHOT.mar"
+ tofile="target/test-resources/jaxrs-repository/modules/addressing-SNAPSHOT.mar"/>
+ </target>
</project>
Modified: webservices/axis2/trunk/java/modules/integration/pom.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/integration/pom.xml?rev=748447&r1=748446&r2=748447&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/pom.xml (original)
+++ webservices/axis2/trunk/java/modules/integration/pom.xml Fri Feb 27 09:05:11 2009
@@ -517,6 +517,8 @@
<property name="addressing_version" value="${version}"/>
<property name="groovy.all.version" value="${groovy.all.version}"/>
<property name="maven.repo.local" value="${settings.localRepository}"/>
+ <property name="maven.class.path" refid="maven.runtime.classpath"/>
+
<path id="maven.dependency.classpath">
<path refid="maven.compile.classpath"/>
<path refid="maven.runtime.classpath"/>
Added: webservices/axis2/trunk/java/modules/integration/test-resources/jaxrs/archiveTestModule/META-INF/Services.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/integration/test-resources/jaxrs/archiveTestModule/META-INF/Services.xml?rev=748447&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test-resources/jaxrs/archiveTestModule/META-INF/Services.xml (added)
+++ webservices/axis2/trunk/java/modules/integration/test-resources/jaxrs/archiveTestModule/META-INF/Services.xml Fri Feb 27 09:05:11 2009
@@ -0,0 +1,41 @@
+<!--
+ ~ 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.
+ -->
+
+<service name="AnnotationService" scope="application">
+ <description>
+ Just to check my Annotations
+ </description>
+ <messageReceivers>
+ <messageReceiver
+ mep="http://www.w3.org/2004/08/wsdl/in-only"
+ class="org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver"/>
+ <messageReceiver
+ mep="http://www.w3.org/2004/08/wsdl/in-out"
+ class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/>
+ </messageReceivers>
+ <parameter name="ServiceClass">
+ org.apache.jaxrs.Service
+ </parameter>
+ <operation name="checkServicesXMLoverriding">
+ <parameter name="RESTMethod">POST</parameter>
+ <parameter name="RESTLocation">/serviceroot/check</parameter>
+ <parameter name="RESTInputSerialization"> application/xml</parameter>
+ <parameter name="RESTOutputSerialization">application/xml</parameter>
+ </operation>
+</service>
Added: webservices/axis2/trunk/java/modules/integration/test-resources/jaxrs/archiveTestModule/build.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/integration/test-resources/jaxrs/archiveTestModule/build.xml?rev=748447&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test-resources/jaxrs/archiveTestModule/build.xml (added)
+++ webservices/axis2/trunk/java/modules/integration/test-resources/jaxrs/archiveTestModule/build.xml Fri Feb 27 09:05:11 2009
@@ -0,0 +1,71 @@
+<?xml version="1.0"?>
+
+<!--
+ ~ 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 basedir="." default="jar">
+ <property name="src" location="."/>
+ <property name="build" location="build"/>
+ <property name="build.classes" location="${build}/classes"/>
+ <property name="build.lib" location="${build}/lib"/>
+ <property name="lib" location="lib"/>
+ <property name="root" location="../../../"/>
+ <property name="jar.dir" location="${root}/target/test-resources/jaxrs-repository/services/"/>
+
+ <path id="axis.test.classpath">
+ <pathelement path="${java.class.path}"/>
+ <pathelement path="${maven.class.path}"/>
+ <pathelement location="../../../target/classes"/> <!-- this relative path should be changed -->
+ </path>
+
+ <target name="compile" depends="init" unless="jars.uptodate">
+ <mkdir dir="${build.classes}"/>
+ <javac fork="true" destdir="${build.classes}" debug="on">
+ <classpath refid="axis.test.classpath"/>
+ <src path="${src}"/>
+ </javac>
+ </target>
+
+ <target name="jar" depends="compile" unless="jars.uptodate">
+ <copy todir="${build.classes}/META-INF">
+ <fileset dir="META-INF/">
+ <include name="**/*.xml"/>
+ <exclude name="build.xml"/>
+ </fileset>
+ </copy>
+
+ <mkdir dir="${jar.dir}"/>
+ <jar jarfile="${jar.dir}/jaxrsService.jar" basedir="${build.classes}">
+ <include name="**"/>
+ </jar>
+ <delete dir="${build}"/>
+ </target>
+
+ <target name="init">
+ <uptodate property="jars.uptodate" targetfile="${jar.dir}/jaxrsService.jar">
+ <srcfiles dir="${src}">
+ <include name="org.apache.jaxrs.java"/>
+ <include name="META-INF/Services.xml"/>
+ <exclude name="${build}/**"/>
+ </srcfiles>
+ </uptodate>
+ <echo message="the files are up to date =${jars.uptodate}"></echo>
+ </target>
+
+</project>
Added: webservices/axis2/trunk/java/modules/integration/test-resources/jaxrs/archiveTestModule/org/apache/jaxrs/Service.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/integration/test-resources/jaxrs/archiveTestModule/org/apache/jaxrs/Service.java?rev=748447&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test-resources/jaxrs/archiveTestModule/org/apache/jaxrs/Service.java (added)
+++ webservices/axis2/trunk/java/modules/integration/test-resources/jaxrs/archiveTestModule/org/apache/jaxrs/Service.java Fri Feb 27 09:05:11 2009
@@ -0,0 +1,208 @@
+/*
+ * 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.jaxrs;
+
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.description.AxisBindingOperation;
+import org.apache.axis2.description.AxisEndpoint;
+import org.apache.axis2.description.AxisBinding;
+import org.apache.axis2.description.WSDL2Constants;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.xml.namespace.QName;
+import java.util.Iterator;
+
+//root level annotations. some of these can be overriden by method level annotations.
+@Path("testroot/")
+@Consumes(value={"text/xml","application/xml"})
+@Produces("text/xml")
+public class Service {
+/*
+ * These are some operations for testing with plain archive deployment. here we try to test
+ * proper functionality of http:location & http:method. since these values can be overriden in the Services xml
+ * there are some test methods to test that behaviour too.
+ */
+ // uses the root path, root input-output serialization & default httpMethod
+
+ @Path("add/{data1}")
+ public String addDataFromURL(String data1){
+
+ return data1+" created";
+ }
+
+ @POST
+ @Path("getFromBody/{data1}")
+ @Consumes("application/xml")
+ @Produces("text/xml")
+ public String addDataFromURLandBody(String data1,String data2){
+
+ return data1+" and "+data2+" created";
+
+ }
+
+ @PUT
+ @Produces("application/xml")
+ @Path("update/{data1}")
+ public String updateDataFromURL(String data1){
+ return data1+" updated";
+
+ }
+
+ @PUT
+ @Path("getFromBody/{data1}")
+ public String updateDataFromURLandBody(String data1,String data2){
+
+ return data1+" and "+data2+" updated";
+ }
+
+ @GET
+ @Path("get/{data1}")
+ public String getDataFromURL(String data1){
+
+ return data1+" read";
+
+
+ }
+
+ @GET
+ @Path("getFromBody/{data1}")
+ public String getDataFromURLandBody(String data1,String data2){
+
+ return data1+" and "+data2+" read";
+ }
+
+ @DELETE
+ @Path("delete/{data1}")
+ public String deleteDataFromURL(String data1){
+
+ return data1+" deleted";
+ }
+
+ @DELETE
+ @Path("getFromBody/{data1}")
+ public String deleteDataFromURLandBody(String data1,String data2){
+
+ return data1+" and "+data2+" deleted";
+
+ }
+
+
+ @POST
+ @Path("wrong/error/{data1}")
+ public String checkServicesXMLoverriding(String data1,String data2){
+
+ return data1+" and "+data2+" correct";
+
+ }
+
+
+ public boolean checkTypePublishing(){
+
+ MessageContext msgctx= MessageContext.getCurrentMessageContext();
+ AxisService axisServce= msgctx.getAxisService();
+ AxisEndpoint axisEndpoint= axisServce.getEndpoint("AnnotationServiceHttpEndpoint");
+ AxisBinding axisBinding=axisEndpoint.getBinding();
+ AxisBindingOperation axisBindingOperation;
+ Iterator<AxisBindingOperation> iterator=axisBinding.getChildren();
+
+
+ while(iterator.hasNext()){
+ axisBindingOperation=iterator.next();
+ if(axisBindingOperation.getName().equals(new QName("addDataFromURLandBody"))){
+ if(!axisBindingOperation.getProperty(WSDL2Constants.ATTR_WHTTP_LOCATION).equals("testroot/getFromBody/{data1}")){
+ System.out.println("wrong http location : found : "+axisBindingOperation.getProperty(WSDL2Constants.ATTR_WHTTP_LOCATION)+" expected : testroot/getFromBody/{data1}" );
+ return false;
+ }
+ if(!axisBindingOperation.getProperty(WSDL2Constants.ATTR_WHTTP_METHOD).equals("POST")){
+ System.out.println("wrong http method : found : "+axisBindingOperation.getProperty(WSDL2Constants.ATTR_WHTTP_METHOD)+" expected : POST" );
+ return false;
+ }
+
+ if(!axisBindingOperation.getProperty(WSDL2Constants.ATTR_WHTTP_INPUT_SERIALIZATION).equals("application/xml")){
+ System.out.println("INPUT SERIALIZATION TESTS");
+ System.out.println("wrong input serialization : found : "+ axisBindingOperation.getProperty(WSDL2Constants.ATTR_WHTTP_INPUT_SERIALIZATION) +" expected : application/xml" );
+ return false;
+ }
+
+ if(!axisBindingOperation.getProperty(WSDL2Constants.ATTR_WHTTP_OUTPUT_SERIALIZATION).equals("text/xml")){
+ System.out.println("OUTPUT SERIALIZATION TEST");
+ System.out.println("wrong output serialization : found : "+axisBindingOperation.getProperty(WSDL2Constants.ATTR_WHTTP_OUTPUT_SERIALIZATION)+" expected : text/xml" );
+ return false;
+ }
+ System.out.println("Type publishing test \"addDataFromURLandBody\" OK.........");
+ }
+
+ if(axisBindingOperation.getName().equals(new QName("updateDataFromURL"))){
+
+ if(!axisBindingOperation.getProperty(WSDL2Constants.ATTR_WHTTP_LOCATION).equals("testroot/update/{data1}")){
+ System.out.println("wrong http location : found : "+axisBindingOperation.getProperty(WSDL2Constants.ATTR_WHTTP_LOCATION)+" expected : testroot/update/{data1}" );
+ return false;
+ }
+ if(!axisBindingOperation.getProperty(WSDL2Constants.ATTR_WHTTP_METHOD).equals("PUT")){
+ System.out.println("wrong http method : found : "+axisBindingOperation.getProperty(WSDL2Constants.ATTR_WHTTP_METHOD)+" expected : PUT" );
+ return false;
+ }
+ if(!axisBindingOperation.getProperty(WSDL2Constants.ATTR_WHTTP_INPUT_SERIALIZATION).equals("text/xml")){
+ System.out.println("wrong input serialization : found : "+axisBindingOperation.getProperty(WSDL2Constants.ATTR_WHTTP_INPUT_SERIALIZATION)+" expected : text/xml" );
+ return false;
+ }
+ if(!axisBindingOperation.getProperty(WSDL2Constants.ATTR_WHTTP_OUTPUT_SERIALIZATION).equals("application/xml")) {
+ System.out.println("wrong output serialization : found : "+axisBindingOperation.getProperty(WSDL2Constants.ATTR_WHTTP_OUTPUT_SERIALIZATION)+" expected : application/xml" );
+ return false;
+ }
+ System.out.println("Type publishing test \"updateDataFromURL\" OK.........");
+ }
+
+ if(axisBindingOperation.getName().equals(new QName("checkServicesXMLoverriding"))){
+ if(!axisBindingOperation.getProperty(WSDL2Constants.ATTR_WHTTP_LOCATION).equals("serviceroot/check")){
+ System.out.println("wrong http location : found : "+axisBindingOperation.getProperty(WSDL2Constants.ATTR_WHTTP_LOCATION)+" expected : serviceroot/check" );
+ return false;
+ }
+ if(!axisBindingOperation.getProperty(WSDL2Constants.ATTR_WHTTP_METHOD).equals("POST")){
+ System.out.println("wrong http method : found : "+axisBindingOperation.getProperty(WSDL2Constants.ATTR_WHTTP_METHOD)+" expected : POST" );
+ return false;
+ }
+ if(!axisBindingOperation.getProperty(WSDL2Constants.ATTR_WHTTP_INPUT_SERIALIZATION).equals("application/xml")){
+ System.out.println("wrong input serialization : found : "+axisBindingOperation.getProperty(WSDL2Constants.ATTR_WHTTP_INPUT_SERIALIZATION)+" expected : application/xml" );
+ return false;
+ }
+ if(!axisBindingOperation.getProperty(WSDL2Constants.ATTR_WHTTP_OUTPUT_SERIALIZATION).equals("application/xml")) {
+ System.out.println("wrong output serialization : found : "+axisBindingOperation.getProperty(WSDL2Constants.ATTR_WHTTP_OUTPUT_SERIALIZATION)+" expected : application/xml" );
+ return false;
+ }
+ System.out.println("Type publishing test \"checkServicesXMLoverriding\" OK.........");
+ }
+ }
+ return true; // all the test are ok
+ }
+
+
+
+}
+
+
+
Added: webservices/axis2/trunk/java/modules/integration/test-resources/jaxrs/pojo-enabled-axis2.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/integration/test-resources/jaxrs/pojo-enabled-axis2.xml?rev=748447&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test-resources/jaxrs/pojo-enabled-axis2.xml (added)
+++ webservices/axis2/trunk/java/modules/integration/test-resources/jaxrs/pojo-enabled-axis2.xml Fri Feb 27 09:05:11 2009
@@ -0,0 +1,478 @@
+<!--
+ ~ 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="enableSwA">false</parameter>
+
+ <!--Uncomment if you want to enable file caching for attachments -->
+ <!--parameter name="cacheAttachments">true</parameter>
+ <parameter name="attachmentDIR"></parameter>
+ <parameter name="sizeThreshold">4000</parameter-->
+
+ <!--Uncomment if you want to plugin your own attachments lifecycle implementation -->
+ <!--<attachmentsLifecycleManager class="org.apache.axiom.attachments.lifecycle.impl.LifecycleManagerImpl"/>-->
+
+
+ <!--Uncomment if you want to enable the reduction of the in-memory cache of WSDL definitions -->
+ <!--In some server environments, the available memory heap is limited and can fill up under load -->
+ <!--Since in-memory copies of WSDL definitions can be large, some steps can be taken-->
+ <!--to reduce the memory needed for the cached WSDL definitions. -->
+ <!--parameter name="reduceWSDLMemoryCache">true</parameter-->
+
+ <!--This will give out the timout of the configuration contexts, in milliseconds-->
+ <parameter name="ConfigContextTimeoutInterval">30000</parameter>
+
+ <!--During a fault, stack trace can be sent with the fault message. The following flag will control -->
+ <!--that behavior.-->
+ <parameter name="sendStacktraceDetailsWithFaults">false</parameter>
+
+ <!--If there aren't any information available to find out the fault reason, we set the message of the exception-->
+ <!--as the faultreason/Reason. But when a fault is thrown from a service or some where, it will be -->
+ <!--wrapped by different levels. Due to this the initial exception message can be lost. If this flag-->
+ <!--is set, then Axis2 tries to get the first exception and set its message as the faultreason/Reason.-->
+ <parameter name="DrillDownToRootCauseForFaultReason">false</parameter>
+
+ <parameter name="userName">admin</parameter>
+ <parameter name="password">axis2</parameter>
+
+ <!--To override repository/services you need to uncomment following parameter and value SHOULD be absolute file path.-->
+ <!--ServicesDirectory only works on the following cases-->
+ <!---File based configurator and in that case the value should be a file URL (http:// not allowed)-->
+ <!---When creating URL Based configurator with URL file:// -->
+ <!--- War based configurator with expanded case , -->
+
+ <!--All the other scenarios it will be ignored.-->
+ <!--<parameter name="ServicesDirectory">service</parameter>-->
+ <!--To override repository/modules you need to uncomment following parameter and value SHOULD be absolute file path-->
+ <!--<parameter name="ModulesDirectory">modules</parameter>-->
+
+
+
+ <!--Following params will set the proper context paths for invocations. All the endpoints will have a commons context-->
+ <!--root which can configured using the following contextRoot parameter-->
+ <!--<parameter name="contextRoot">axis2</parameter>-->
+
+ <!--Our HTTP endpoints can handle both REST and SOAP. Following parameters can be used to distinguiush those endpoints-->
+ <!--In case of a servlet, if you change this you have to manually change the settings of your servlet container to map this -->
+ <!--context path to proper Axis2 servlets-->
+ <!--<parameter name="servicePath">services</parameter>-->
+ <!--<parameter name="restPath">rest</parameter>-->
+
+ <!-- Following parameter will completely disable REST handling in Axis2-->
+ <parameter name="disableREST" locked="false">false</parameter>
+
+ <!-- Following parameter will suppress generation of SOAP 1.2 bindings in auto-generated WSDL files -->
+ <parameter name="disableSOAP12" locked="true">false</parameter>
+
+ <!--POJO deployer , this will alow users to drop .class file and make that into a service-->
+ <deployer extension=".class" directory="pojo" class="org.apache.axis2.deployment.POJODeployer"/>
+ <deployer extension=".jar" directory="pojo" class="org.apache.axis2.deployment.POJODeployer"/>
+
+
+ <!--<deployer extension=".jsa" directory="rmiservices" class="org.apache.axis2.rmi.deploy.RMIServiceDeployer"/>-->
+
+
+ <!-- Following parameter will set the host name for the epr-->
+ <!--<parameter name="hostname" locked="true">myhost.com</parameter>-->
+
+ <!-- If you have a front end 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>-->
+
+ <threadContextMigrators>
+ <threadContextMigrator listId="JAXWS-ThreadContextMigrator-List" class="org.apache.axis2.jaxws.addressing.migrator.EndpointContextMapMigrator"/>
+ </threadContextMigrators>
+
+ <!-- ================================================= -->
+ <!-- Message Receivers -->
+ <!-- ================================================= -->
+ <!--This is the deafult MessageReceiver 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 ovrride this for a particular service by adding the same element with your requirement-->
+ <messageReceivers>
+ <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-only"
+ class="org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver"/>
+ <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out"
+ class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
+ <messageReceiver mep="http://www.w3.org/2006/01/wsdl/in-only"
+ class="org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver"/>
+ <messageReceiver mep="http://www.w3.org/2006/01/wsdl/in-out"
+ class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
+ </messageReceivers>
+
+ <!-- ================================================= -->
+ <!-- Message Formatter -->
+ <!-- ================================================= -->
+ <!--Following content type to message formatter mapping can be used to implement support for different message -->
+ <!--format serialization in Axis2. These message formats are expected to be resolved based on the content type. -->
+ <messageFormatters>
+ <messageFormatter contentType="application/x-www-form-urlencoded"
+ class="org.apache.axis2.transport.http.XFormURLEncodedFormatter"/>
+ <messageFormatter contentType="multipart/form-data"
+ class="org.apache.axis2.transport.http.MultipartFormDataFormatter"/>
+ <messageFormatter contentType="application/xml"
+ class="org.apache.axis2.transport.http.ApplicationXMLFormatter"/>
+ <messageFormatter contentType="text/xml"
+ class="org.apache.axis2.transport.http.SOAPMessageFormatter"/>
+ <messageFormatter contentType="application/soap+xml"
+ class="org.apache.axis2.transport.http.SOAPMessageFormatter"/>
+ </messageFormatters>
+
+ <!-- ================================================= -->
+ <!-- Message Builders -->
+ <!-- ================================================= -->
+ <!--Following content type to builder mapping can be used to implement support for different message -->
+ <!--formats in Axis2. These message formats are expected to be resolved based on the content type. -->
+ <messageBuilders>
+ <messageBuilder contentType="application/xml"
+ class="org.apache.axis2.builder.ApplicationXMLBuilder"/>
+ <messageBuilder contentType="application/xml"
+ class="org.apache.axis2.builder.ApplicationXMLBuilder"/>
+ <messageBuilder contentType="application/x-www-form-urlencoded"
+ class="org.apache.axis2.builder.XFormURLEncodedBuilder"/>
+ <messageBuilder contentType="multipart/form-data"
+ class="org.apache.axis2.builder.MultipartFormDataBuilder"/>
+ </messageBuilders>
+
+ <!-- ================================================= -->
+ <!-- Transport Ins -->
+ <!-- ================================================= -->
+ <transportReceiver name="http"
+ class="org.apache.axis2.transport.http.SimpleHTTPServer">
+ <parameter name="port">8080</parameter>
+ <!-- Here is the complete list of supported parameters (see example settings further below):
+ port: the port to listen on (default 6060)
+ hostname: if non-null, url prefix used in reply-to endpoint references (default null)
+ originServer: value of http Server header in outgoing messages (default "Simple-Server/1.1")
+ requestTimeout: value in millis of time that requests can wait for data (default 20000)
+ requestTcpNoDelay: true to maximize performance and minimize latency (default true)
+ false to minimize bandwidth consumption by combining segments
+ requestCoreThreadPoolSize: number of threads available for request processing (unless queue fills up) (default 25)
+ requestMaxThreadPoolSize: number of threads available for request processing if queue fills up (default 150)
+ note that default queue never fills up: see HttpFactory
+ threadKeepAliveTime: time to keep threads in excess of core size alive while inactive (default 180)
+ note that no such threads can exist with default unbounded request queue
+ threadKeepAliveTimeUnit: TimeUnit of value in threadKeepAliveTime (default SECONDS) (default SECONDS)
+ -->
+ <!-- <parameter name="hostname">http://www.myApp.com/ws</parameter> -->
+ <!-- <parameter name="originServer">My-Server/1.1</parameter> -->
+ <!-- <parameter name="requestTimeout">10000</parameter> -->
+ <!-- <parameter name="requestTcpNoDelay">false</parameter> -->
+ <!-- <parameter name="requestCoreThreadPoolSize">50</parameter> -->
+ <!-- <parameter name="requestMaxThreadPoolSize">100</parameter> -->
+ <!-- <parameter name="threadKeepAliveTime">240000</parameter> -->
+ <!-- <parameter name="threadKeepAliveTimeUnit">MILLISECONDS</parameter> -->
+ </transportReceiver>
+
+ <!--Uncomment this and configure as appropriate for JMS transport support, after setting up your JMS environment (e.g. ActiveMQ)
+ <transportReceiver name="jms" class="org.apache.axis2.transport.jms.JMSListener">
+ <parameter name="myTopicConnectionFactory">
+ <parameter name="java.naming.factory.initial">org.apache.activemq.jndi.ActiveMQInitialContextFactory</parameter>
+ <parameter name="java.naming.provider.url">tcp://localhost:61616</parameter>
+ <parameter name="transport.jms.ConnectionFactoryJNDIName">TopicConnectionFactory</parameter>
+ </parameter>
+
+ <parameter name="myQueueConnectionFactory">
+ <parameter name="java.naming.factory.initial">org.apache.activemq.jndi.ActiveMQInitialContextFactory</parameter>
+ <parameter name="java.naming.provider.url">tcp://localhost:61616</parameter>
+ <parameter name="transport.jms.ConnectionFactoryJNDIName">QueueConnectionFactory</parameter>
+ </parameter>
+
+ <parameter name="default">
+ <parameter name="java.naming.factory.initial">org.apache.activemq.jndi.ActiveMQInitialContextFactory</parameter>
+ <parameter name="java.naming.provider.url">tcp://localhost:61616</parameter>
+ <parameter name="transport.jms.ConnectionFactoryJNDIName">QueueConnectionFactory</parameter>
+ </parameter>
+ </transportReceiver>-->
+
+ <!-- ================================================= -->
+ <!-- Non-blocking http/s Transport Listener -->
+
+ <!-- the non blocking http transport based on HttpCore + NIO extensions
+ <transportReceiver name="http" class="org.apache.axis2.transport.nhttp.HttpCoreNIOListener">
+ <parameter name="port" locked="false">9000</parameter>
+ <parameter name="non-blocking" locked="false">true</parameter>
+ </transportReceiver>-->
+
+ <!-- the non blocking https transport based on HttpCore + SSL-NIO extensions
+ <transportReceiver name="https" class="org.apache.axis2.transport.nhttp.HttpCoreNIOSSLListener">
+ <parameter name="port" locked="false">9002</parameter>
+ <parameter name="non-blocking" locked="false">true</parameter>
+ <parameter name="keystore" locked="false">
+ <KeyStore>
+ <Location>identity.jks</Location>
+ <Type>JKS</Type>
+ <Password>password</Password>
+ <KeyPassword>password</KeyPassword>
+ </KeyStore>
+ </parameter>
+ <parameter name="truststore" locked="false">
+ <TrustStore>
+ <Location>trust.jks</Location>
+ <Type>JKS</Type>
+ <Password>password</Password>
+ </TrustStore>
+ </parameter>-->
+ <!--<parameter name="SSLVerifyClient">require</parameter>
+ supports optional|require or defaults to none -->
+ <!--</transportReceiver>-->
+
+ <!-- ================================================= -->
+ <!-- Mail Transport Listener -->
+ <!-- This is a sample configuration. It assumes a mail server running in localhost.
+ Listener pops messages that comes to the email address red@localhost. Users
+ password is red. Listener connect to the server every 3000 milliseconds.
+ Parameters with "transport." prefix is Axis2 specific. Others are all from Java Mail API.
+ http://people.apache.org/~pzf/SMTPBase64Binding-0.2.html
+ -->
+ <!-- ================================================= -->
+ <!--<transportReceiver name="mailto" class="org.apache.axis2.transport.mail.SimpleMailListener">
+ <parameter name="mail.pop3.host">localhost</parameter>
+ <parameter name="mail.pop3.user">red</parameter>
+ <parameter name="mail.store.protocol">pop3</parameter>
+ <parameter name="transport.mail.pop3.password">red</parameter>
+ <parameter name="transport.mail.replyToAddress">red@localhost</parameter>
+ <parameter name="transport.listener.interval">3000</parameter>
+ </transportReceiver>-->
+
+ <!--Uncomment if you want to have TCP transport support-->
+ <!--transportReceiver name="tcp"
+ class="org.apache.axis2.transport.tcp.TCPServer">
+ <parameter name="port">6060</parameter-->>
+ <!--If you want to give your own host address for EPR generation-->
+ <!--uncomment the following paramter , and set it as you required.-->
+ <!--<parameter name="hostname">tcp://myApp.com/ws</parameter>-->
+ <!-- /transportReceiver -->
+
+ <!-- ================================================= -->
+ <!-- Transport Outs -->
+ <!-- ================================================= -->
+
+ <transportSender name="tcp"
+ class="org.apache.axis2.transport.tcp.TCPTransportSender"/>
+ <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>
+
+ <!-- If following is set to 'true', optional action part of the Content-Type will not be added to the SOAP 1.2 messages -->
+ <!-- <parameter name="OmitSOAP12Action">true</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>
+
+ <!-- Please enable this if you need the java transport -->
+ <!-- <transportSender name="java"
+ class="org.apache.axis2.transport.java.JavaTransportSender"/> -->
+
+ <!--<transportSender name="jms"-->
+ <!--class="org.apache.axis2.transport.jms.JMSSender"/>-->
+
+ <!-- ================================================= -->
+ <!-- Non-blocking http/s Transport Sender -->
+
+ <!-- the non-blocking http transport sender based on HttpCore + NIO extensions
+ <transportSender name="http" class="org.apache.axis2.transport.nhttp.HttpCoreNIOSender">
+ <parameter name="non-blocking" locked="false">true</parameter>
+ </transportSender>-->
+
+ <!-- the non-blocking https transport sender based on HttpCore + NIO SSL extensions
+ <transportSender name="https" class="org.apache.axis2.transport.nhttp.HttpCoreNIOSSLSender">
+ <parameter name="non-blocking" locked="false">true</parameter>
+ <parameter name="keystore" locked="false">
+ <KeyStore>
+ <Location>identity.jks</Location>
+ <Type>JKS</Type>
+ <Password>password</Password>
+ <KeyPassword>password</KeyPassword>
+ </KeyStore>
+ </parameter>
+ <parameter name="truststore" locked="false">
+ <TrustStore>
+ <Location>trust.jks</Location>
+ <Type>JKS</Type>
+ <Password>password</Password>
+ </TrustStore>
+ </parameter>-->
+ <!--<parameter name="HostnameVerifier">DefaultAndLocalhost</parameter>
+ supports Strict|AllowAll|DefaultAndLocalhost or the default if none specified -->
+ <!--</transportSender>-->
+
+ <!-- ================================================= -->
+ <!-- Mail Transport Sender -->
+ <!--Only need to uncomment the sender. Configuration is achieved with every client.
+ At any instant mail host should be given. Sample configuration has been given.
+ http://people.apache.org/~pzf/SMTPBase64Binding-0.2.html
+ -->
+ <!-- ================================================= -->
+ <!--<transportSender name="mailto" class="org.apache.axis2.transport.mail.MailTransportSender">
+ <parameter name="mail.smtp.host">localhost</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>-->
+
+ <!-- ================================================= -->
+ <!-- Clustering -->
+ <!-- ================================================= -->
+ <!-- Configure and uncomment following for preparing Axis2 to a clustered environment -->
+ <!--
+ <cluster class="org.apache.axis2.cluster.tribes.TribesClusterManager">
+ <parameter name="param1">value1</parameter>
+ <parameter name="domain">apache.axis2.domain</parameter>
+ <parameter name="synchronizeAll">true</parameter>
+ <parameter name="maxRetries">10</parameter>
+ <configurationManager class="org.apache.axis2.cluster.configuration.TribesConfigurationManager">
+ <listener class="org.apache.axis2.cluster.configuration.DefaultConfigurationManagerListener"/>
+ </configurationManager>
+ <contextManager class="org.apache.axis2.cluster.context.TribesContextManager">
+ <listener class="org.apache.axis2.cluster.context.DefaultContextManagerListener"/>
+ </contextManager>
+ </cluster>
+ -->
+
+ <!-- ================================================= -->
+ <!-- Phases -->
+ <!-- ================================================= -->
+ <phaseOrder type="InFlow">
+ <!-- System predefined phases -->
+ <phase name="Transport">
+ <handler name="RequestURIBasedDispatcher"
+ class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher">
+ <order phase="Transport"/>
+ </handler>
+ <handler name="SOAPActionBasedDispatcher"
+ class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher">
+ <order phase="Transport"/>
+ </handler>
+ </phase>
+ <phase name="Addressing">
+ <handler name="AddressingBasedDispatcher"
+ class="org.apache.axis2.dispatchers.AddressingBasedDispatcher">
+ <order phase="Addressing"/>
+ </handler>
+ </phase>
+ <phase name="Security"/>
+ <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="RequestURIOperationDispatcher"
+ class="org.apache.axis2.dispatchers.RequestURIOperationDispatcher"/>
+ <handler name="SOAPMessageBodyBasedDispatcher"
+ class="org.apache.axis2.dispatchers.SOAPMessageBodyBasedDispatcher"/>
+ <handler name="HTTPLocationBasedDispatcher"
+ class="org.apache.axis2.dispatchers.HTTPLocationBasedDispatcher"/>
+ <handler name="GenericProviderDispatcher"
+ class="org.apache.axis2.jaxws.dispatchers.GenericProviderDispatcher"/>
+ <handler name="MustUnderstandValidationDispatcher"
+ class="org.apache.axis2.jaxws.dispatchers.MustUnderstandValidationDispatcher"/>
+ </phase>
+ <phase name="RMPhase"/>
+ <!-- System predefined phases -->
+ <!-- After Postdispatch phase module author or service author can add any phase he want -->
+ <phase name="OperationInPhase">
+ <handler name="MustUnderstandChecker"
+ class="org.apache.axis2.jaxws.dispatchers.MustUnderstandChecker">
+ <order phase="OperationInPhase"/>
+ </handler>
+ </phase>
+ <phase name="soapmonitorPhase"/>
+ </phaseOrder>
+ <phaseOrder type="OutFlow">
+ <!-- user can add his own phases to this area -->
+ <phase name="soapmonitorPhase"/>
+ <phase name="OperationOutPhase"/>
+ <!--system predefined phase-->
+ <!--these phase will run irrespective of the service-->
+ <phase name="RMPhase"/>
+ <phase name="PolicyDetermination"/>
+ <phase name="MessageOut"/>
+ <phase name="Security"/>
+ </phaseOrder>
+ <phaseOrder type="InFaultFlow">
+ <phase name="Addressing">
+ <handler name="AddressingBasedDispatcher"
+ class="org.apache.axis2.dispatchers.AddressingBasedDispatcher">
+ <order phase="Addressing"/>
+ </handler>
+ </phase>
+ <phase name="Security"/>
+ <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="RequestURIOperationDispatcher"
+ class="org.apache.axis2.dispatchers.RequestURIOperationDispatcher"/>
+ <handler name="SOAPMessageBodyBasedDispatcher"
+ class="org.apache.axis2.dispatchers.SOAPMessageBodyBasedDispatcher"/>
+ <handler name="HTTPLocationBasedDispatcher"
+ class="org.apache.axis2.dispatchers.HTTPLocationBasedDispatcher"/>
+ <handler name="GenericProviderDispatcher"
+ class="org.apache.axis2.jaxws.dispatchers.GenericProviderDispatcher"/>
+ <handler name="MustUnderstandValidationDispatcher"
+ class="org.apache.axis2.jaxws.dispatchers.MustUnderstandValidationDispatcher"/>
+ </phase>
+ <phase name="RMPhase"/>
+ <!-- user can add his own phases to this area -->
+ <phase name="OperationInFaultPhase"/>
+ <phase name="soapmonitorPhase"/>
+ </phaseOrder>
+ <phaseOrder type="OutFaultFlow">
+ <!-- user can add his own phases to this area -->
+ <phase name="soapmonitorPhase"/>
+ <phase name="OperationOutFaultPhase"/>
+ <phase name="RMPhase"/>
+ <phase name="PolicyDetermination"/>
+ <phase name="MessageOut"/>
+ <phase name="Security"/>
+ </phaseOrder>
+</axisconfig>
+
Added: webservices/axis2/trunk/java/modules/integration/test-resources/jaxrs/pojoTestModule/PojoService.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/integration/test-resources/jaxrs/pojoTestModule/PojoService.java?rev=748447&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test-resources/jaxrs/pojoTestModule/PojoService.java (added)
+++ webservices/axis2/trunk/java/modules/integration/test-resources/jaxrs/pojoTestModule/PojoService.java Fri Feb 27 09:05:11 2009
@@ -0,0 +1,104 @@
+/*
+ * 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.
+ */
+
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.GET;
+import javax.ws.rs.HEAD;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.DELETE;
+
+//root level annotations some of these can be overriden by method level annotations.
+@Path("testroot/")
+@Consumes(value={"text/xml","application/xml"})
+@Produces("text/xml")
+public class PojoService {
+/*
+ * These are some operations for testing with plain old java deployment
+ */
+ @Path("add/{data1}")
+ public String addDataFromURL(String data1){
+
+ return data1+" created";
+ }
+
+ @POST
+ @Path("getFromBody/{data1}")
+ @Consumes("application/xml")
+ public String addDataFromURLandBody(String data1,String data2){
+
+ return data1+" and "+data2+" created";
+
+ }
+
+ @PUT
+ @Path("update/{data1}")
+ public String updateDataFromURL(String data1){
+ return data1+" updated";
+
+ }
+
+ @PUT
+ @Path("getFromBody/{data1}")
+ public String updateDataFromURLandBody(String data1,String data2){
+
+ return data1+" and "+data2+" updated";
+ }
+
+ @GET
+ @Path("get/{data1}")
+ public String getDataFromURL(String data1){
+
+ return data1+" read";
+
+
+ }
+
+ @GET
+ @Path("getFromBody/{data1}")
+ public String getDataFromURLandBody(String data1,String data2){
+
+ return data1+" and "+data2+" read";
+ }
+
+ @DELETE
+ @Path("delete/{data1}")
+ public String deleteDataFromURL(String data1){
+
+ return data1+" deleted";
+ }
+
+ @DELETE
+ @Path("getFromBody/{data1}")
+ public String deleteDataFromURLandBody(String data1,String data2){
+
+ return data1+" and "+data2+" deleted";
+
+ }
+
+
+
+
+}
+
+
+
Added: webservices/axis2/trunk/java/modules/integration/test-resources/jaxrs/pojoTestModule/build.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/integration/test-resources/jaxrs/pojoTestModule/build.xml?rev=748447&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test-resources/jaxrs/pojoTestModule/build.xml (added)
+++ webservices/axis2/trunk/java/modules/integration/test-resources/jaxrs/pojoTestModule/build.xml Fri Feb 27 09:05:11 2009
@@ -0,0 +1,52 @@
+<?xml version="1.0"?>
+
+<!--
+ ~ 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 basedir="." default="compile">
+ <property name="src" location="."/>
+ <property name="root" location="../../../"/>
+ <property name="pojo.dir" location="${root}/target/test-resources/jaxrs-repository/pojo/"/>
+
+ <path id="axis.test.classpath">
+ <pathelement path="${java.class.path}"/>
+ <pathelement path="${maven.class.path}"/>
+ <pathelement location="../../../target/classes"/> <!-- this relative path should be changed -->
+ </path>
+
+ <target name="compile" depends="init" unless="pojo.uptodate">
+ <mkdir dir="${pojo.dir}"/>
+ <javac fork="true" destdir="${pojo.dir}" debug="on">
+ <classpath refid="axis.test.classpath"/>
+ <src path="${src}"/>
+ </javac>
+ </target>
+
+
+
+ <target name="init">
+ <uptodate property="pojo.uptodate" targetfile="${pojo.dir}/PojoService.class">
+ <srcfiles dir="${src}">
+ <include name="**/*.java"/>
+ </srcfiles>
+ </uptodate>
+ <echo message="the files are up to date = ${pojo.uptodate}"></echo>
+ </target>
+
+</project>
Added: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/jaxrs/ArchiveDeploymentTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/jaxrs/ArchiveDeploymentTest.java?rev=748447&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/jaxrs/ArchiveDeploymentTest.java (added)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/jaxrs/ArchiveDeploymentTest.java Fri Feb 27 09:05:11 2009
@@ -0,0 +1,249 @@
+/*
+ * 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.jaxrs;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.impl.llom.util.AXIOMUtil;
+import org.apache.axis2.Constants;
+import org.apache.axis2.client.Options;
+import org.apache.axis2.client.ServiceClient;
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.description.WSDL2Constants;
+import org.apache.axis2.integration.TestingUtils;
+import org.apache.axis2.integration.UtilServerBasedTestCase;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.xml.namespace.QName;
+
+public class ArchiveDeploymentTest extends UtilServerBasedTestCase {
+
+ private static final Log log = LogFactory.getLog(ArchiveDeploymentTest.class);
+ private AxisService axisService;
+ private static String repoPath;
+
+
+ public ArchiveDeploymentTest(){
+ super(ArchiveDeploymentTest.class.getName());
+
+ }
+
+ public ArchiveDeploymentTest(String name) {
+ super(name);
+
+ }
+
+ public static Test suite() {
+ return getTestSetup2(new TestSuite(ArchiveDeploymentTest.class),
+ repoPath=TestingUtils.prefixBaseDirectory(
+ Constants.TESTING_PATH + "jaxrs-repository"));
+ }
+
+ /**
+ *
+ * @throws Exception
+ */
+ public void testAddDataFromURL() throws Exception{
+
+ Options options= TestUtil.getArchiveTestOptions();
+ // setting test case dependent settings
+ options.setProperty(WSDL2Constants.ATTR_WHTTP_LOCATION,"testroot/add/{data1}");
+ options.setProperty(Constants.Configuration.HTTP_METHOD,Constants.Configuration.HTTP_METHOD_POST);
+ options.setProperty(Constants.Configuration.CONTENT_TYPE, Constants.MIME_CT_TEXT_XML);
+
+ ServiceClient sender= TestUtil.getArchiveTestServiceClient(options);
+ String stringPayload = "<addDataFromURL xmlns=\"http://jaxrs.apache.org\"><data1>account</data1></addDataFromURL>";
+ OMElement payload= AXIOMUtil.stringToOM(stringPayload);
+ OMElement respond=sender.sendReceive(payload);
+ OMElement returnElem=respond.getFirstChildWithName(new QName("http://jaxrs.apache.org","return"));
+ assertEquals("account created", returnElem.getText() );
+
+ }
+
+ public void testAddDataFromURLandBody() throws Exception{
+
+ Options options= TestUtil.getArchiveTestOptions();
+ // setting test case dependent settings
+ options.setProperty(WSDL2Constants.ATTR_WHTTP_LOCATION,"testroot/getFromBody/{data1}");
+ options.setProperty(Constants.Configuration.HTTP_METHOD,Constants.Configuration.HTTP_METHOD_POST);
+ options.setProperty(Constants.Configuration.CONTENT_TYPE, Constants.MIME_CT_TEXT_XML);
+
+ ServiceClient sender= TestUtil.getArchiveTestServiceClient(options);
+ String stringPayload = "<addDataFromURLandBody xmlns=\"http://jaxrs.apache.org\"><data1>account</data1><data2>password</data2></addDataFromURLandBody>";
+ OMElement payload= AXIOMUtil.stringToOM(stringPayload);
+ OMElement respond=sender.sendReceive(payload);
+ OMElement returnElem=respond.getFirstChildWithName(new QName("http://jaxrs.apache.org","return"));
+ assertEquals("account and password created", returnElem.getText() );
+
+ }
+
+
+ public void testUpdateDataFromURL() throws Exception{
+
+ Options options= TestUtil.getArchiveTestOptions();
+ // setting test case dependent settings
+ options.setProperty(WSDL2Constants.ATTR_WHTTP_LOCATION,"testroot/update/{data1}");
+ options.setProperty(Constants.Configuration.HTTP_METHOD,Constants.Configuration.HTTP_METHOD_PUT);
+ options.setProperty(Constants.Configuration.CONTENT_TYPE, Constants.MIME_CT_TEXT_XML);
+
+ ServiceClient sender= TestUtil.getArchiveTestServiceClient(options);
+ String stringPayload = "<addDataFromURL xmlns=\"http://jaxrs.apache.org\"><data1>account</data1></addDataFromURL>";
+ OMElement payload= AXIOMUtil.stringToOM(stringPayload);
+ OMElement respond=sender.sendReceive(payload);
+ OMElement returnElem=respond.getFirstChildWithName(new QName("http://jaxrs.apache.org","return"));
+ assertEquals("account updated", returnElem.getText() );
+
+ }
+
+ public void testUpdateDataFromURLandBody() throws Exception{
+
+ Options options= TestUtil.getArchiveTestOptions();
+ // setting test case dependent settings
+ options.setProperty(WSDL2Constants.ATTR_WHTTP_LOCATION,"testroot/getFromBody/{data1}");
+ options.setProperty(Constants.Configuration.HTTP_METHOD,Constants.Configuration.HTTP_METHOD_PUT);
+ options.setProperty(Constants.Configuration.CONTENT_TYPE, Constants.MIME_CT_TEXT_XML);
+
+ ServiceClient sender= TestUtil.getArchiveTestServiceClient(options);
+ String stringPayload = "<addDataFromURLandBody xmlns=\"http://jaxrs.apache.org\"><data1>account</data1><data2>password</data2></addDataFromURLandBody>";
+ OMElement payload= AXIOMUtil.stringToOM(stringPayload);
+ OMElement respond=sender.sendReceive(payload);
+ OMElement returnElem=respond.getFirstChildWithName(new QName("http://jaxrs.apache.org","return"));
+ assertEquals("account and password updated", returnElem.getText() );
+
+ }
+
+
+ public void testGetDataFromURL() throws Exception{
+
+ Options options= TestUtil.getArchiveTestOptions();
+ // setting test case dependent settings
+ options.setProperty(WSDL2Constants.ATTR_WHTTP_LOCATION,"testroot/get/{data1}");
+ options.setProperty(Constants.Configuration.HTTP_METHOD,Constants.Configuration.HTTP_METHOD_GET);
+ options.setProperty(Constants.Configuration.CONTENT_TYPE, Constants.MIME_CT_TEXT_XML);
+
+ ServiceClient sender= TestUtil.getArchiveTestServiceClient(options);
+ String stringPayload = "<getDataFromURL xmlns=\"http://jaxrs.apache.org\"><data1>account</data1></getDataFromURL>";
+ OMElement payload= AXIOMUtil.stringToOM(stringPayload);
+ OMElement respond=sender.sendReceive(payload);
+ OMElement returnElem=respond.getFirstChildWithName(new QName("http://jaxrs.apache.org","return"));
+ assertEquals("account read", returnElem.getText() );
+
+ }
+
+ public void testGetDataFromURLandBody() throws Exception{
+
+ Options options= TestUtil.getArchiveTestOptions();
+ // setting test case dependent settings
+ options.setProperty(WSDL2Constants.ATTR_WHTTP_LOCATION,"testroot/getFromBody/{data1}");
+ options.setProperty(Constants.Configuration.HTTP_METHOD,Constants.Configuration.HTTP_METHOD_GET);
+ options.setProperty(Constants.Configuration.CONTENT_TYPE, Constants.MIME_CT_TEXT_XML);
+
+ ServiceClient sender= TestUtil.getArchiveTestServiceClient(options);
+ String stringPayload = "<addDataFromURLandBody xmlns=\"http://jaxrs.apache.org\"><data1>account</data1><data2>password</data2></addDataFromURLandBody>";
+ OMElement payload= AXIOMUtil.stringToOM(stringPayload);
+ OMElement respond=sender.sendReceive(payload);
+ OMElement returnElem=respond.getFirstChildWithName(new QName("http://jaxrs.apache.org","return"));
+ assertEquals("account and password read", returnElem.getText() );
+
+ }
+
+
+
+ public void testDeleteDataFromURL() throws Exception{
+
+ Options options= TestUtil.getArchiveTestOptions();
+ // setting test case dependent settings
+ options.setProperty(WSDL2Constants.ATTR_WHTTP_LOCATION,"testroot/delete/{data1}");
+ options.setProperty(Constants.Configuration.HTTP_METHOD,Constants.Configuration.HTTP_METHOD_DELETE);
+ options.setProperty(Constants.Configuration.CONTENT_TYPE, Constants.MIME_CT_TEXT_XML);
+
+ ServiceClient sender= TestUtil.getArchiveTestServiceClient(options);
+ String stringPayload = "<deleteDataFromURL xmlns=\"http://jaxrs.apache.org\"><data1>account</data1></deleteDataFromURL>";
+ OMElement payload= AXIOMUtil.stringToOM(stringPayload);
+ OMElement respond=sender.sendReceive(payload);
+ OMElement returnElem=respond.getFirstChildWithName(new QName("http://jaxrs.apache.org","return"));
+ assertEquals("account deleted", returnElem.getText() );
+
+ }
+
+ public void testDeleteDataFromURLandBody() throws Exception{
+
+ Options options= TestUtil.getArchiveTestOptions();
+ // setting test case dependent settings
+ options.setProperty(WSDL2Constants.ATTR_WHTTP_LOCATION,"testroot/getFromBody/{data1}");
+ options.setProperty(Constants.Configuration.HTTP_METHOD,Constants.Configuration.HTTP_METHOD_DELETE);
+ options.setProperty(Constants.Configuration.CONTENT_TYPE, Constants.MIME_CT_TEXT_XML);
+
+ ServiceClient sender= TestUtil.getArchiveTestServiceClient(options);
+ String stringPayload = "<addDataFromURLandBody xmlns=\"http://jaxrs.apache.org\"><data1>account</data1><data2>password</data2></addDataFromURLandBody>";
+ OMElement payload= AXIOMUtil.stringToOM(stringPayload);
+ OMElement respond=sender.sendReceive(payload);
+ OMElement returnElem=respond.getFirstChildWithName(new QName("http://jaxrs.apache.org","return"));
+ assertEquals("account and password deleted", returnElem.getText() );
+
+ }
+
+ public void testCheckServicesXMLoverriding() throws Exception{
+
+ Options options= TestUtil.getArchiveTestOptions();
+ // setting test case dependent settings
+ options.setProperty(WSDL2Constants.ATTR_WHTTP_LOCATION,"serviceroot/check");
+ options.setProperty(Constants.Configuration.HTTP_METHOD,Constants.Configuration.HTTP_METHOD_POST);
+ options.setProperty(Constants.Configuration.CONTENT_TYPE, Constants.MIME_CT_APPLICATION_XML);
+
+ ServiceClient sender= TestUtil.getArchiveTestServiceClient(options);
+ String stringPayload = "<checkServicesXMLoverriding xmlns=\"http://jaxrs.apache.org\"><data1>account</data1><data2>password</data2></checkServicesXMLoverriding>";
+ OMElement payload= AXIOMUtil.stringToOM(stringPayload);
+ OMElement respond=sender.sendReceive(payload);
+ OMElement returnElem=respond.getFirstChildWithName(new QName("http://jaxrs.apache.org","return"));
+ assertEquals("account and password correct", returnElem.getText() );
+
+ }
+
+ public void testCheckTypepublishing() throws Exception{
+
+ Options options= TestUtil.getArchiveTestOptions();
+ // setting test case dependent settings
+ options.setProperty(WSDL2Constants.ATTR_WHTTP_LOCATION,"testroot");
+ options.setProperty(Constants.Configuration.HTTP_METHOD,Constants.Configuration.HTTP_METHOD_POST);
+ options.setProperty(Constants.Configuration.CONTENT_TYPE, Constants.MIME_CT_TEXT_XML);
+
+ ServiceClient sender= TestUtil.getArchiveTestServiceClient(options);
+ String stringPayload = "<checkTypePublishing xmlns=\"http://jaxrs.apache.org\">null</checkTypePublishing>";
+ OMElement payload= AXIOMUtil.stringToOM(stringPayload);
+ OMElement respond=sender.sendReceive(payload);
+ OMElement returnElem=respond.getFirstChildWithName(new QName("http://jaxrs.apache.org","return"));
+ assertEquals("true",returnElem.getText());
+
+ }
+
+ protected void setUp() throws Exception {
+ //setting up any pre requirements if available
+ }
+
+ protected void tearDown() throws Exception {
+ //relesing any resources.
+ }
+
+
+
+}
Added: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/jaxrs/PojoTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/jaxrs/PojoTest.java?rev=748447&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/jaxrs/PojoTest.java (added)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/jaxrs/PojoTest.java Fri Feb 27 09:05:11 2009
@@ -0,0 +1,200 @@
+/*
+ * 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.jaxrs;
+
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import org.apache.axis2.client.Options;
+import org.apache.axis2.client.ServiceClient;
+import org.apache.axis2.description.WSDL2Constants;
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.Constants;
+import org.apache.axis2.integration.TestingUtils;
+import org.apache.axis2.integration.UtilServerBasedTestCase;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.impl.llom.util.AXIOMUtil;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.xml.namespace.QName;
+
+public class PojoTest extends UtilServerBasedTestCase{
+
+ private static final Log log = LogFactory.getLog(PojoTest.class);
+ private AxisService axisService;
+
+
+ public PojoTest(){
+ super(PojoTest.class.getName());
+
+ }
+
+ public PojoTest(String name) {
+ super(name);
+
+ }
+
+ public static Test suite() {
+ return getTestSetup2(new TestSuite(PojoTest.class),
+ TestingUtils.prefixBaseDirectory(
+ Constants.TESTING_PATH + "jaxrs-repository"));
+ }
+
+
+ public void testAddDataFromURL() throws Exception{
+
+ Options options= TestUtil.getPojoTestOptions();
+ // setting test case dependent settings
+ options.setProperty(WSDL2Constants.ATTR_WHTTP_LOCATION,"testroot/add/{data1}");
+ options.setProperty(Constants.Configuration.HTTP_METHOD,Constants.Configuration.HTTP_METHOD_POST);
+ options.setProperty(Constants.Configuration.CONTENT_TYPE, Constants.MIME_CT_TEXT_XML);
+
+ ServiceClient sender= TestUtil.getPojoTestServiceClient(options);
+ String stringPayload = "<addDataFromURL xmlns=\"http://ws.apache.org/axis2\"><data1>account</data1></addDataFromURL>";
+ OMElement payload= AXIOMUtil.stringToOM(stringPayload);
+ OMElement respond=sender.sendReceive(payload);
+ OMElement returnElem=respond.getFirstChildWithName(new QName("return"));
+ assertEquals("account created", returnElem.getText() );
+
+ }
+
+ public void testAddDataFromURLandBody() throws Exception{
+
+ Options options= TestUtil.getPojoTestOptions();
+ // setting test case dependent settings
+ options.setProperty(WSDL2Constants.ATTR_WHTTP_LOCATION,"testroot/getFromBody/{data1}");
+ options.setProperty(Constants.Configuration.HTTP_METHOD,Constants.Configuration.HTTP_METHOD_POST);
+ options.setProperty(Constants.Configuration.CONTENT_TYPE, Constants.MIME_CT_TEXT_XML);
+
+ ServiceClient sender= TestUtil.getPojoTestServiceClient(options);
+ String stringPayload = "<addDataFromURLandBody xmlns=\"http://ws.apache.org/axis2\"><data1>account</data1><data2>password</data2></addDataFromURLandBody>";
+ OMElement payload= AXIOMUtil.stringToOM(stringPayload);
+ OMElement respond=sender.sendReceive(payload);
+ OMElement returnElem=respond.getFirstChildWithName(new QName("return"));
+ assertEquals("account and password created", returnElem.getText() );
+
+ }
+
+
+ public void testUpdateDataFromURL() throws Exception{
+
+ Options options= TestUtil.getPojoTestOptions();
+ // setting test case dependent settings
+ options.setProperty(WSDL2Constants.ATTR_WHTTP_LOCATION,"testroot/update/{data1}");
+ options.setProperty(Constants.Configuration.HTTP_METHOD,Constants.Configuration.HTTP_METHOD_PUT);
+ options.setProperty(Constants.Configuration.CONTENT_TYPE, Constants.MIME_CT_TEXT_XML);
+
+ ServiceClient sender= TestUtil.getPojoTestServiceClient(options);
+ String stringPayload = "<addDataFromURL xmlns=\"http://ws.apache.org/axis2\"><data1>account</data1></addDataFromURL>";
+ OMElement payload= AXIOMUtil.stringToOM(stringPayload);
+ OMElement respond=sender.sendReceive(payload);
+ OMElement returnElem=respond.getFirstChildWithName(new QName("return"));
+ assertEquals("account updated", returnElem.getText() );
+
+ }
+
+ public void testUpdateDataFromURLandBody() throws Exception{
+
+ Options options= TestUtil.getPojoTestOptions();
+ // setting test case dependent settings
+ options.setProperty(WSDL2Constants.ATTR_WHTTP_LOCATION,"testroot/getFromBody/{data1}");
+ options.setProperty(Constants.Configuration.HTTP_METHOD,Constants.Configuration.HTTP_METHOD_PUT);
+ options.setProperty(Constants.Configuration.CONTENT_TYPE, Constants.MIME_CT_TEXT_XML);
+
+ ServiceClient sender= TestUtil.getPojoTestServiceClient(options);
+ String stringPayload = "<addDataFromURLandBody xmlns=\"http://ws.apache.org/axis2\"><data1>account</data1><data2>password</data2></addDataFromURLandBody>";
+ OMElement payload= AXIOMUtil.stringToOM(stringPayload);
+ OMElement respond=sender.sendReceive(payload);
+ OMElement returnElem=respond.getFirstChildWithName(new QName("return"));
+ assertEquals("account and password updated", returnElem.getText() );
+
+ }
+
+ public void testGetDataFromURL() throws Exception{
+
+ Options options= TestUtil.getPojoTestOptions();
+ // setting test case dependent settings
+ options.setProperty(WSDL2Constants.ATTR_WHTTP_LOCATION,"testroot/get/{data1}");
+ options.setProperty(Constants.Configuration.HTTP_METHOD,Constants.Configuration.HTTP_METHOD_GET);
+ options.setProperty(Constants.Configuration.CONTENT_TYPE, Constants.MIME_CT_TEXT_XML);
+
+ ServiceClient sender= TestUtil.getPojoTestServiceClient(options);
+ String stringPayload = "<getDataFromURL xmlns=\"http://ws.apache.org/axis2\"><data1>account</data1></getDataFromURL>";
+ OMElement payload= AXIOMUtil.stringToOM(stringPayload);
+ OMElement respond=sender.sendReceive(payload);
+ OMElement returnElem=respond.getFirstChildWithName(new QName("return"));
+ assertEquals("account read", returnElem.getText() );
+
+ }
+
+ public void testGetDataFromURLandBody() throws Exception{
+
+ Options options= TestUtil.getPojoTestOptions();
+ // setting test case dependent settings
+ options.setProperty(WSDL2Constants.ATTR_WHTTP_LOCATION,"testroot/getFromBody/{data1}");
+ options.setProperty(Constants.Configuration.HTTP_METHOD,Constants.Configuration.HTTP_METHOD_GET);
+ options.setProperty(Constants.Configuration.CONTENT_TYPE, Constants.MIME_CT_TEXT_XML);
+
+ ServiceClient sender= TestUtil.getPojoTestServiceClient(options);
+ String stringPayload = "<addDataFromURLandBody xmlns=\"http://ws.apache.org/axis2\"><data1>account</data1><data2>password</data2></addDataFromURLandBody>";
+ OMElement payload= AXIOMUtil.stringToOM(stringPayload);
+ OMElement respond=sender.sendReceive(payload);
+ OMElement returnElem=respond.getFirstChildWithName(new QName("return"));
+ assertEquals("account and password read", returnElem.getText() );
+
+ }
+
+
+
+ public void testDeleteDataFromURL() throws Exception{
+
+ Options options= TestUtil.getPojoTestOptions();
+ // setting test case dependent settings
+ options.setProperty(WSDL2Constants.ATTR_WHTTP_LOCATION,"testroot/delete/{data1}");
+ options.setProperty(Constants.Configuration.HTTP_METHOD,Constants.Configuration.HTTP_METHOD_DELETE);
+ options.setProperty(Constants.Configuration.CONTENT_TYPE, Constants.MIME_CT_TEXT_XML);
+
+ ServiceClient sender= TestUtil.getPojoTestServiceClient(options);
+ String stringPayload = "<deleteDataFromURL xmlns=\"http://ws.apache.org/axis2\"><data1>account</data1></deleteDataFromURL>";
+ OMElement payload= AXIOMUtil.stringToOM(stringPayload);
+ OMElement respond=sender.sendReceive(payload);
+ OMElement returnElem=respond.getFirstChildWithName(new QName("return"));
+ assertEquals("account deleted", returnElem.getText() );
+
+ }
+
+ public void testDeleteDataFromURLandBody() throws Exception{
+
+ Options options= TestUtil.getPojoTestOptions();
+ // setting test case dependent settings
+ options.setProperty(WSDL2Constants.ATTR_WHTTP_LOCATION,"testroot/getFromBody/{data1}");
+ options.setProperty(Constants.Configuration.HTTP_METHOD,Constants.Configuration.HTTP_METHOD_DELETE);
+ options.setProperty(Constants.Configuration.CONTENT_TYPE, Constants.MIME_CT_TEXT_XML);
+
+ ServiceClient sender= TestUtil.getPojoTestServiceClient(options);
+ String stringPayload = "<addDataFromURLandBody xmlns=\"http://ws.apache.org/axis2\"><data1>account</data1><data2>password</data2></addDataFromURLandBody>";
+ OMElement payload= AXIOMUtil.stringToOM(stringPayload);
+ OMElement respond=sender.sendReceive(payload);
+ OMElement returnElem=respond.getFirstChildWithName(new QName("return"));
+ assertEquals("account and password deleted", returnElem.getText() );
+
+ }
+
+}
Added: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/jaxrs/TestUtil.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/jaxrs/TestUtil.java?rev=748447&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/jaxrs/TestUtil.java (added)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/jaxrs/TestUtil.java Fri Feb 27 09:05:11 2009
@@ -0,0 +1,130 @@
+/*
+ * 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.jaxrs;
+
+import org.apache.axis2.client.ServiceClient;
+import org.apache.axis2.client.Options;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.ConfigurationContextFactory;
+import org.apache.axis2.integration.TestingUtils;
+import org.apache.axis2.integration.UtilServer;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.Constants;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+
+public class TestUtil {
+
+ public static final String ToArchiveTestEPR="http://127.0.0.1:"+ UtilServer.TESTING_PORT+"/axis2/services/AnnotationService.AnnotationServiceHttpEndpoint/";
+ public static final String ToPojoTestEPR="http://127.0.0.1:"+UtilServer.TESTING_PORT+"/axis2/services/PojoService.PojoServiceHttpEndpoint/";
+
+ private static ServiceClient archiveTestserviceClient;
+ private static ServiceClient pojoTestserviceClient;
+
+ private static Options ArchiveTestOptions;
+ private static Options pojoTestOptions;
+
+ private static ConfigurationContext configContext;
+
+
+
+ private static final Log log = LogFactory.getLog(TestUtil.class);
+
+
+ public static ServiceClient getArchiveTestServiceClient(Options options){
+ if(TestUtil.archiveTestserviceClient!=null){
+ TestUtil.archiveTestserviceClient.setOptions(options);
+ return TestUtil.archiveTestserviceClient;
+ }else{
+
+ try {
+ configContext =
+ ConfigurationContextFactory.createConfigurationContextFromFileSystem(
+ TestingUtils.prefixBaseDirectory("target/test-resources/integrationRepo"), null);
+ } catch (AxisFault axisFault) {
+ log.error("could not create Configuration context : test failed",axisFault);
+
+ }
+ try {
+ archiveTestserviceClient=new ServiceClient(configContext,null);
+ } catch (AxisFault axisFault) {
+ log.error("failed to create the service client : test failed",axisFault);
+ }
+ archiveTestserviceClient.setOptions(options);
+ return archiveTestserviceClient;
+ }
+
+
+ }
+
+ public static Options getArchiveTestOptions(){
+
+ if(ArchiveTestOptions!=null){
+ return ArchiveTestOptions;
+ }else{
+ ArchiveTestOptions=new Options();
+ ArchiveTestOptions.setTo(new EndpointReference(TestUtil.ToArchiveTestEPR));
+ ArchiveTestOptions.setProperty(Constants.Configuration.ENABLE_REST, Constants.VALUE_TRUE);
+ return ArchiveTestOptions;
+ }
+
+ }
+
+
+ public static ServiceClient getPojoTestServiceClient(Options options){
+ if(TestUtil.pojoTestserviceClient!=null){
+ TestUtil.pojoTestserviceClient.setOptions(options);
+ return TestUtil.pojoTestserviceClient;
+ }else{
+
+ try {
+ configContext =
+ ConfigurationContextFactory.createConfigurationContextFromFileSystem(
+ TestingUtils.prefixBaseDirectory("target/test-resources/integrationRepo"), null);
+ } catch (AxisFault axisFault) {
+ log.error("could not create Configuration context : test failed",axisFault);
+
+ }
+ try {
+ pojoTestserviceClient=new ServiceClient(configContext,null);
+ } catch (AxisFault axisFault) {
+ log.error("failed to create the service client : test failed",axisFault);
+ }
+ pojoTestserviceClient.setOptions(options);
+ return pojoTestserviceClient;
+ }
+
+ }
+ public static Options getPojoTestOptions(){
+
+ if(pojoTestOptions!=null){
+ return pojoTestOptions;
+ }else{
+ pojoTestOptions=new Options();
+ pojoTestOptions.setTo(new EndpointReference(TestUtil.ToPojoTestEPR));
+ pojoTestOptions.setProperty(Constants.Configuration.ENABLE_REST, Constants.VALUE_TRUE);
+ return pojoTestOptions;
+ }
+
+ }
+
+}
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/JAXRS/JAXRSModel.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/JAXRS/JAXRSModel.java?rev=748447&r1=748446&r2=748447&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/JAXRS/JAXRSModel.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/JAXRS/JAXRSModel.java Fri Feb 27 09:05:11 2009
@@ -62,6 +62,11 @@
return ((this.Path != null) && (!this.Path.equals(""))) ? this.Path : null;
}
+
+ /**
+ * only returns the one mime type as wsdl 2.0 can publish only one mime type for an operation
+ * @return
+ */
public String getConsumes() {
if((this.Consumes != null) && (!this.Consumes.equals(""))){
String[] array=this.Consumes.split(",");
@@ -77,6 +82,10 @@
}
+ /**
+ * only returns the one mime type as wsdl 2.0 can publish only one mime type for an operation
+ * @return
+ */
public String getProduces() {
if((this.Produces != null) && (!this.Produces.equals(""))){
String[] array=this.Produces.split(",");