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 Andreas Veithen <an...@gmail.com> on 2010/07/14 20:44:40 UTC
Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws:
./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/
test/org/apache/axis2/jaxws/wrapper/ test/org/apache/axis2/jaxws/wrapper/beans/
Nikhil,
I have some issues with the tools and jaxws-tools dependencies
introduced by this change:
* The change causes a build failure in Hudson. There will also be
additional issues with tools.jar, because the way to declare this as a
system dependency varies from one JDK to another. For example, I
remember that on Mac OS X, it is completely different than on other
JDKs.
* I don't like the fact that jaxws-tools becomes a dependency of
axis2-jaxws in scope compile, because it looks like this is only
needed during the build and/or during the tests.
I didn't review the change in detail, but wouldn't it be smarter to
use one of the existing Maven plugins to do the wsgen stuff? They will
take care of the tools.jar stuff as well.
Andreas
On Tue, Jul 13, 2010 at 00:16, <nt...@apache.org> wrote:
> Author: nthaker
> Date: Mon Jul 12 22:16:54 2010
> New Revision: 963508
>
> URL: http://svn.apache.org/viewvc?rev=963508&view=rev
> Log:
> AXIS2-4775
> This change ensures that we will use Request and Response wrapper Bean packaged by customer or we will Generate Wrappers if they are not packaged.
>
> Added:
> axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/
> axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/
> axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
> axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
> axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
> axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml
> Modified:
> axis/axis2/java/core/trunk/modules/jaxws/pom.xml
> axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
>
> Modified: axis/axis2/java/core/trunk/modules/jaxws/pom.xml
> URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/pom.xml?rev=963508&r1=963507&r2=963508&view=diff
> ==============================================================================
> --- axis/axis2/java/core/trunk/modules/jaxws/pom.xml (original)
> +++ axis/axis2/java/core/trunk/modules/jaxws/pom.xml Mon Jul 12 22:16:54 2010
> @@ -1,5 +1,4 @@
> <?xml version="1.0" encoding="UTF-8"?>
> -
> <!--
> ~ Licensed to the Apache Software Foundation (ASF) under one
> ~ or more contributor license agreements. See the NOTICE file
> @@ -20,7 +19,7 @@
> -->
>
> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
> <modelVersion>4.0.0</modelVersion>
> <parent>
> <groupId>org.apache.axis2</groupId>
> @@ -98,7 +97,25 @@
> <version>${version}</version>
> <scope>test</scope>
> </dependency>
> + <dependency>
> + <groupId>wsdl4j</groupId>
> + <artifactId>wsdl4j</artifactId>
> + </dependency>
> + <dependency>
> + <groupId>com.sun.xml.ws</groupId>
> + <artifactId>jaxws-tools</artifactId>
> + <version>2.1.3</version>
> + </dependency>
> + <!-- If we dont include tools.jar as dependency, maven throws NoClassDefFound on wsGen run -->
> + <dependency>
> + <groupId>java</groupId>
> + <artifactId>tools</artifactId>
> + <version>$version</version>
> + <scope>system</scope>
> + <systemPath>${JAVA_HOME}/lib/tools.jar</systemPath>
> + </dependency>
> </dependencies>
> +
> <build>
> <sourceDirectory>src</sourceDirectory>
> <testSourceDirectory>test</testSourceDirectory>
> @@ -203,34 +220,39 @@
> <compilerVersion>1.5</compilerVersion>
> <source>1.5</source>
> <target>1.5</target>
> +
> </configuration>
> </plugin>
> <plugin>
> <groupId>org.apache.maven.plugins</groupId>
> <artifactId>maven-antrun-plugin</artifactId>
> +
> <executions>
> <execution>
> <id>gen-ts</id>
> <phase>generate-test-sources</phase>
> <configuration>
> - <tasks unless="maven.test.skip">
> + <tasks unless="maven.test.skip">
> <!-- Theres got to be a better way to do this -->
> <property name="schema.source.dir" value="test-resources/xsd"/>
> <property name="wsdl.source.dir" value="test-resources/wsdl"/>
> - <property name="schema.output.base.dir" value="target/schema"/>
> + <property name="schema.output.base.dir" value="target/schema"/>
> <property name="schema.generated.src.dir" value="${schema.output.base.dir}/src"/>
> <property name="schema.generated.classes.dir"
> value="${schema.output.base.dir}/classes"/>
> +
> <!-- make the dirs -->
> <mkdir dir="${schema.output.base.dir}"/>
> <mkdir dir="${schema.generated.src.dir}"/>
> <mkdir dir="${schema.generated.classes.dir}"/>
> +
> <!-- Run JAXB schema compiler with designated schemas -->
> <echo>Generating JAX-B classes from XSDs</echo>
>
> <echo>Generating java from echo.xsd</echo>
> <java classname="com.sun.tools.xjc.Driver" fork="true">
> <classpath refid="maven.runtime.classpath"/>
> +
> <classpath location="${compiled.classes.dir}"/>
> <arg line="-d ${schema.generated.src.dir} -quiet ${schema.source.dir}/echo.xsd"/>
> </java>
> @@ -266,7 +288,7 @@
> <classpath refid="maven.runtime.classpath"/>
> <classpath location="${compiled.classes.dir}"/>
> <arg line="-d ${schema.generated.src.dir} -quiet -wsdl ${wsdl.source.dir}/AddNumbers.wsdl"/>
> - </java>
> + </java>
> </tasks>
> </configuration>
> <goals>
> @@ -287,6 +309,22 @@
> <property name="addressing_version" value="${version}"/>
> <ant antfile="build.xml" inheritall="true" inheritrefs="true"
> dir="." target="build-repo"/>
> +
> + <property name="compile_classpath" refid="maven.compile.classpath" />
> + <property name="runtime_classpath" refid="maven.runtime.classpath" />
> + <property name="test_classpath" refid="maven.test.classpath" />
> + <property name="plugin_classpath" refid="maven.plugin.classpath" />
> +
> + <!-- Defining wsGen task -->
> + <taskdef name="wsgen" loaderRef="refwsgen" classname="com.sun.tools.ws.ant.WsGen">
> + <classpath>
> + <path refid="maven.runtime.classpath" />
> + <path refid="maven.compile.classpath" />
> + </classpath>
> + </taskdef>
> + <!-- Invoking test cases that need to generate artifacts using wsGen -->
> + <ant antfile="wsgen-tests.xml" inheritall="true" inheritrefs="true"
> + dir="." target="run-wsgen-tests"/>
> </tasks>
> </configuration>
> <goals>
> @@ -374,6 +412,13 @@
> <plugin>
> <groupId>org.apache.maven.plugins</groupId>
> <artifactId>maven-surefire-report-plugin</artifactId>
> + <reportSets>
> + <reportSet>
> + <reports>
> + <report>report-only</report>
> + </reports>
> + </reportSet>
> + </reportSets>
> </plugin>
> </plugins>
> </reporting>
>
> Modified: axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
> URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java?rev=963508&r1=963507&r2=963508&view=diff
> ==============================================================================
> --- axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java (original)
> +++ axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java Mon Jul 12 22:16:54 2010
> @@ -238,12 +238,27 @@ class ArtifactProcessor {
> wrapperClass = newValue;
> }
> }
> - if(cls==null && (type.equals("@WebFault")|| type.equals("faultInfo"))){
> +
> + if(cls==null &&
> + (type.equals("@RequestWrapper")|| type.equals("@ResponseWrapper")||type.equals("@WebFault")|| type.equals("faultInfo"))){
> +
> + //Support for Fault Bean Generation
> //As per JAX-WS 2.2 Specification section 3.7 an application programmer can choose not to
> //package the faultBeans, if we have reached this point in the code then user has choosen
> //not to package the fault bean. If there is a cache of generated artifacts available then
> //lets look for the missing faultBean there.
> -
> +
> + //Support for Wrapper Bean Generation
> + //As per JAX-WS 2.2 Specificaiton section 3.6.2.1 pg 41 an application programmer does not use
> + //the wrapper bean classes, so the application need not package these classes. If we have reached
> + //this point in the code then user has choosen not to package these beans.
> +
> + //NOTE:If we find Generated artifacts from cache this guarantees that we will not use
> + //DocLitWrappedMinimum marshaller code. The advantage of normal DocLitWrappedMarshaller is
> + //that it is very robust and has support of lot more datatypes than in DocLitWrappedMinimum.
> + if(log.isDebugEnabled()){
> + log.debug("Adding cache to classpath");
> + }
> ClassFinderFactory cff =
> (ClassFinderFactory)FactoryRegistry.getFactory(ClassFinderFactory.class);
> ClassFinder cf = cff.getClassFinder();
> @@ -317,11 +332,26 @@ class ArtifactProcessor {
> if (cls2 == null) {
> cls2 = loadClassOrNull(defaultValue, altClassLoader);
> }
> - if(cls2==null && (type.equals("faultInfo")|| type.equals("@WebFault"))){
> - //As per JAX-WS 2.2 Specification section 3.7 an application programmer can choose not to
> - //package the faultBeans, if we have reached this point in the code then user has choosen
> - //not to package the fault bean. If there is a cache of generated artifacts available then
> - //lets look for the missing faultBean there.
> + if(cls2==null &&
> + (type.equals("@RequestWrapper")|| type.equals("@ResponseWrapper")||type.equals("@WebFault")|| type.equals("faultInfo"))){
> +
> + //Support for Fault Bean Generation
> + //As per JAX-WS 2.2 Specification section 3.7 an application programmer can choose not to
> + //package the faultBeans, if we have reached this point in the code then user has choosen
> + //not to package the fault bean. If there is a cache of generated artifacts available then
> + //lets look for the missing faultBean there.
> +
> + //Support for Wrapper Bean Generation
> + //As per JAX-WS 2.2 Specificaiton section 3.6.2.1 pg 41 an application programmer does not use
> + //the wrapper bean classes, so the application need not package these classes. If we have reached
> + //this point in the code then user has choosen not to package these beans.
> +
> + //NOTE:If we find Generated artifacts from cache this guarantees that we will not use
> + //DocLitWrappedMinimum marshaller code. The advantage of normal DocLitWrappedMarshaller is
> + //that it is very robust and has support of lot more datatypes than in DocLitWrappedMinimum.
> + if(log.isDebugEnabled()){
> + log.debug("Adding cache to classpath");
> + }
> if(log.isDebugEnabled()){
> log.debug("Adding cache to classpath");
> }
>
> Added: axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
> URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java?rev=963508&view=auto
> ==============================================================================
> --- axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java (added)
> +++ axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java Mon Jul 12 22:16:54 2010
> @@ -0,0 +1,18 @@
> +
> +package org.apache.axis2.jaxws.wrapper.beans;
> +
> +import javax.xml.ws.WebFault;
> +
> +@WebFault(name = "AddNumbersFault", targetNamespace = "http://org/test/addnumbers")
> +public class AddNumbersException extends Exception
> +{
> +
> + private String message = null;
> + public AddNumbersException(){}
> + public AddNumbersException(String message){
> + this.message = message;
> + }
> + public String getInfo(){
> + return message;
> + }
> +}
>
> Added: axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
> URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java?rev=963508&view=auto
> ==============================================================================
> --- axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java (added)
> +++ axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java Mon Jul 12 22:16:54 2010
> @@ -0,0 +1,15 @@
> +package org.apache.axis2.jaxws.wrapper.beans;
> +
> +
> +
> +@javax.jws.WebService (targetNamespace="http://org/test/addnumbers", serviceName="AddNumbersService", portName="AddNumbersPort")
> +public class AddNumbersService{
> +
> + public int addNumbers(int arg0, int arg1) throws AddNumbersException {
> + if(arg0+arg1<0){
> + throw new AddNumbersException("sum is less than 0");
> + }
> + return arg0+arg1;
> + }
> +
> +}
> \ No newline at end of file
>
> Added: axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
> URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java?rev=963508&view=auto
> ==============================================================================
> --- axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java (added)
> +++ axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java Mon Jul 12 22:16:54 2010
> @@ -0,0 +1,114 @@
> +/**
> + *
> + */
> +package org.apache.axis2.jaxws.wrapper.beans;
> +
> +
> +import org.apache.axis2.jaxws.Constants;
> +import org.apache.axis2.jaxws.description.DescriptionFactory;
> +import org.apache.axis2.jaxws.description.EndpointDescription;
> +import org.apache.axis2.jaxws.description.EndpointDescriptionJava;
> +import org.apache.axis2.jaxws.description.OperationDescription;
> +import org.apache.axis2.jaxws.description.ServiceDescription;
> +import org.apache.axis2.jaxws.marshaller.MethodMarshaller;
> +import org.apache.axis2.jaxws.marshaller.factory.MethodMarshallerFactory;
> +import org.apache.axis2.jaxws.marshaller.impl.alt.DocLitWrappedMinimalMethodMarshaller;
> +import org.apache.axis2.jaxws.unitTest.TestLogger;
> +
> +import java.io.File;
> +
> +import junit.framework.TestCase;
> +
> +public class WrapperBeanMarshallTests extends TestCase {
> + /**
> + * This is the negative test case, when we do not use generated artifacts from cache
> + * and user did not package wrapper beans, we should see use of DocLitWrappedMinumumMarshaller.
> + */
> + public void testGetMarshallerOperationDescriptionBooleanNegative() {
> + TestLogger.logger.debug("---------------------------------------");
> + TestLogger.logger.debug("test: " + getName());
> +
> + String cache_location = "/target/wscache/classes";
> + try{
> + String baseDir = new File(System.getProperty("basedir",".")).getCanonicalPath();
> + cache_location = new File(baseDir+cache_location).getAbsolutePath();
> + TestLogger.logger.debug("cache location ="+cache_location);
> +
> + //Get EndpointDescription.
> + //Set location on AxisConfiguraiton.
> + Class sei = AddNumbersService.class;
> + EndpointDescription description = getEndpointDesc(sei);
> + TestLogger.logger.debug("description objects where created successfully");
> + OperationDescription[] ops =description.getEndpointInterfaceDescription().getOperations();
> + assertNotNull( "OperationDescriptions where null", ops);
> + assertTrue("No Operation Descriptions where found", ops.length>0);
> + OperationDescription op = ops[0];
> + TestLogger.logger.debug("operation found, java methodName="+op.getJavaMethodName());
> + //Don not Set cache on AxisConfiguration.
> + //get Marshaller, verify its not DoclitWrappedMinimum.
> + TestLogger.logger.debug("ws_cache location NOT set on AxisConfigContext, location="+cache_location);
> + MethodMarshaller mm = MethodMarshallerFactory.getMarshaller(op, false);
> + assertNotNull("getMarshaller returned null", mm );
> + TestLogger.logger.debug("MethodMarshaller was created, type="+mm.getClass().getName());
> + assertTrue("Generated artifacts not found, Method marshaller should be DocLitWrappedMinimumMarshaller", (mm instanceof DocLitWrappedMinimalMethodMarshaller));
> + }catch(Exception e){
> + TestLogger.logger.debug("Exception ="+e.getMessage());
> + fail(e.getMessage());
> + }
> +
> + }
> + /**
> + * In this test case user did not package wrapper beans but we add generated artifacts from cache, we should see use of
> + * DocLitWrappedMarshaller.
> + * Test method for {@link org.apache.axis2.jaxws.marshaller.factory.MethodMarshallerFactory#getMarshaller(org.apache.axis2.jaxws.description.OperationDescription, boolean)}.
> + */
> + public void testGetMarshallerOperationDescriptionBoolean() {
> + TestLogger.logger.debug("---------------------------------------");
> + TestLogger.logger.debug("test: " + getName());
> +
> + String cache_location = "/target/wscache/classes";
> + try{
> + String baseDir = new File(System.getProperty("basedir",".")).getCanonicalPath();
> + cache_location = new File(baseDir+cache_location).getAbsolutePath();
> + TestLogger.logger.debug("cache location ="+cache_location);
> +
> + //Get EndpointDescription.
> + //Set location on AxisConfiguraiton.
> + Class sei = AddNumbersService.class;
> + EndpointDescription description = getEndpointDesc(sei);
> + TestLogger.logger.debug("description objects where created successfully");
> + OperationDescription[] ops =description.getEndpointInterfaceDescription().getOperations();
> + assertNotNull( "OperationDescriptions where null", ops);
> + assertTrue("No Operation Descriptions where found", ops.length>0);
> + OperationDescription op = ops[0];
> + TestLogger.logger.debug("operation found, java methodName="+op.getJavaMethodName());
> + //Set cache on AxisConfiguration.
> + //get Marshaller, verify its not DoclitWrappedMinimum.
> + description.getServiceDescription().getAxisConfigContext().setProperty(Constants.WS_CACHE, cache_location);
> + TestLogger.logger.debug("ws_cache location set on AxisConfigContext, location="+cache_location);
> + MethodMarshaller mm = MethodMarshallerFactory.getMarshaller(op, false);
> + assertNotNull("getMarshaller returned null", mm );
> + TestLogger.logger.debug("MethodMarshaller was created, type="+mm.getClass().getName());
> + assertTrue("Generated artifacts are in cache, Method marshaller should not be DocLitWrappedMinimumMarshaller", !(mm instanceof DocLitWrappedMinimalMethodMarshaller));
> + }catch(Exception e){
> + TestLogger.logger.debug("Exception ="+e.getMessage());
> + fail(e.getMessage());
> + }
> +
> + }
> +
> + private EndpointDescription getEndpointDesc(Class implementationClass) {
> + // Use the description factory directly; this will be done within the JAX-WS runtime
> + ServiceDescription serviceDesc =
> + DescriptionFactory.createServiceDescription(implementationClass);
> + assertNotNull(serviceDesc);
> +
> + EndpointDescription[] endpointDesc = serviceDesc.getEndpointDescriptions();
> + assertNotNull(endpointDesc);
> + assertEquals(1, endpointDesc.length);
> +
> + // TODO: How will the JAX-WS dispatcher get the appropriate port (i.e. endpoint)? Currently assumes [0]
> + EndpointDescription testEndpointDesc = endpointDesc[0];
> + return testEndpointDesc;
> + }
> +}
>
> Added: axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml
> URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml?rev=963508&view=auto
> ==============================================================================
> --- axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml (added)
> +++ axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml Mon Jul 12 22:16:54 2010
> @@ -0,0 +1,34 @@
> +<?xml version="1.0" encoding="UTF-8"?>
> +
> +<project basedir="." default="run-wsgen-tests" name="wsgen-tests">
> +
> + <property name="wscache.output.base.dir" value="target/wscache" />
> + <property name="wscache.generated.src.dir" value="${wscache.output.base.dir}/src" />
> + <property name="wscache.generated.classes.dir" value="${wscache.output.base.dir}/classes" />
> + <property name="compile.test.classes" value="target/test-classes" />
> +
> +
> + <target name="run-wsgen-tests" depends="wrapper-beans"/>
> +
> +
> + <target name="create-cache">
> + <mkdir dir="${wscache.output.base.dir}" />
> + <mkdir dir="${wscache.generated.src.dir}" />
> + <mkdir dir="${wscache.generated.classes.dir}" />
> + </target>
> +
> + <target name="wrapper-beans" depends="create-cache">
> + <echo>Generating artifacts for org.apache.axis2.jaxws.wrapper.beans.AddNumbersService </echo>
> + <wsgen
> + sei="org.apache.axis2.jaxws.wrapper.beans.AddNumbersService"
> + destdir="${wscache.generated.classes.dir}"
> + resourcedestdir="${wscache.generated.src.dir}"
> + keep="false"
> + verbose="false"
> + genwsdl="true">
> + <classpath>
> + <pathelement path="${compile.test.classes}" />
> + </classpath>
> + </wsgen>
> + </target>
> +</project>
> \ No newline at end of file
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org
Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws: ./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/
test/org/apache/axis2/jaxws/wrapper/ test/org/apache/axis2/jaxws/wrapper/beans/
Posted by Nikhil V Thaker <ni...@us.ibm.com>.
Andreas - Use of wsGen and Test case Changes have been backed out. There
should not be any dependency on jaxws-tools.jar and also reference to
tools.jar have been removed from pom. Changes in revision #964185.
Thanks,
Nikhil Thaker
office: 919 254 9964
nvthaker@us.ibm.com
Nikhil V Thaker/Columbus/IBM@IBMUS
07/14/2010 03:00 PM
Please respond to
java-dev@axis.apache.org
To
java-dev@axis.apache.org
cc
java-dev@axis.apache.org
Subject
Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws: ./
src/org/apache/axis2/jaxws/runtime/description/marshal/impl/
test/org/apache/axis2/jaxws/wrapper/
test/org/apache/axis2/jaxws/wrapper/beans/
Yes Andreas,
I am running antrun plugin as the wsGen plugin has errors and is not
fully matured, here's the URL that explains the issue I ran into
http://jira.codehaus.org/browse/MNG-3586.
So since I cannot run wsGen or cannot include generated artifacts I will
just remove the test case. I will commit the changes soon.
Regards,
Nikhil Thaker
office: 919 254 9964
nvthaker@us.ibm.com
Andreas Veithen <an...@gmail.com>
07/14/2010 02:48 PM
Please respond to
java-dev@axis.apache.org
To
java-dev@axis.apache.org
cc
Subject
Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws:
./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/
test/org/apache/axis2/jaxws/wrapper/
test/org/apache/axis2/jaxws/wrapper/beans/
No, you are using the antrun plugin to execute the wsgen ant task.
What I meant was to use a real Maven plugin (either the one from
java.net or the one from CXF).
-1 to commit any generated stuff into SVN.
Andreas
On Wed, Jul 14, 2010 at 21:42, Nikhil V Thaker
<ni...@us.ibm.com> wrote:
>
> Andreas - I had to add the tools.jar bit because maven plugin for wsGen
gave NoClassDef Found errors for classes packaged in tools.jar.
>
> Since this is causing a problem I will just package the generated
artifacts and remove the wsGen dependency.
>
> Thanks,
>
> Nikhil Thaker
> office: 919 254 9964
> nvthaker@us.ibm.com
>
>
> Andreas Veithen <an...@gmail.com>
>
> 07/14/2010 01:44 PM
>
> Please respond to
> java-dev@axis.apache.org
> To
> java-dev@axis.apache.org
> cc
> Subject
> Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws:
./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/
test/org/apache/axis2/jaxws/wrapper/
test/org/apache/axis2/jaxws/wrapper/beans/
>
>
>
>
> Nikhil,
>
> I have some issues with the tools and jaxws-tools dependencies
> introduced by this change:
>
> * The change causes a build failure in Hudson. There will also be
> additional issues with tools.jar, because the way to declare this as a
> system dependency varies from one JDK to another. For example, I
> remember that on Mac OS X, it is completely different than on other
> JDKs.
>
> * I don't like the fact that jaxws-tools becomes a dependency of
> axis2-jaxws in scope compile, because it looks like this is only
> needed during the build and/or during the tests.
>
> I didn't review the change in detail, but wouldn't it be smarter to
> use one of the existing Maven plugins to do the wsgen stuff? They will
> take care of the tools.jar stuff as well.
>
> Andreas
>
> On Tue, Jul 13, 2010 at 00:16, <nt...@apache.org> wrote:
> > Author: nthaker
> > Date: Mon Jul 12 22:16:54 2010
> > New Revision: 963508
> >
> > URL: http://svn.apache.org/viewvc?rev=963508&view=rev
> > Log:
> > AXIS2-4775
> > This change ensures that we will use Request and Response wrapper Bean
packaged by customer or we will Generate Wrappers if they are not
packaged.
> >
> > Added:
> >
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/
> >
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/
> >
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
> >
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
> >
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
> > axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml
> > Modified:
> > axis/axis2/java/core/trunk/modules/jaxws/pom.xml
> >
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
> >
> > Modified: axis/axis2/java/core/trunk/modules/jaxws/pom.xml
> > URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/pom.xml?rev=963508&r1=963507&r2=963508&view=diff
> >
==============================================================================
> > --- axis/axis2/java/core/trunk/modules/jaxws/pom.xml (original)
> > +++ axis/axis2/java/core/trunk/modules/jaxws/pom.xml Mon Jul 12
22:16:54 2010
> > @@ -1,5 +1,4 @@
> > <?xml version="1.0" encoding="UTF-8"?>
> > -
> > <!-- > ~ Licensed to the Apache Software Foundation (ASF) under one
> > ~ or more contributor license agreements. See the NOTICE file
> > @@ -20,7 +19,7 @@
> > -->
> >
> > <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"
> > - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
> > + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
> > <modelVersion>4.0.0</modelVersion>
> > <parent>
> > <groupId>org.apache.axis2</groupId>
> > @@ -98,7 +97,25 @@
> > <version>${version}</version>
> > <scope>test</scope>
> > </dependency>
> > + <dependency>
> > + <groupId>wsdl4j</groupId>
> > + <artifactId>wsdl4j</artifactId>
> > + </dependency>
> > + <dependency>
> > + <groupId>com.sun.xml.ws</groupId>
> > + <artifactId>jaxws-tools</artifactId>
> > + <version>2.1.3</version>
> > + </dependency>
> > + <!-- If we dont include tools.jar as dependency, maven throws
NoClassDefFound on wsGen run -->
> > + <dependency>
> > + <groupId>java</groupId>
> > + <artifactId>tools</artifactId>
> > + <version>$version</version>
> > + <scope>system</scope>
> > + <systemPath>${JAVA_HOME}/lib/tools.jar</systemPath>
> > + </dependency>
> > </dependencies>
> > +
> > <build>
> > <sourceDirectory>src</sourceDirectory>
> > <testSourceDirectory>test</testSourceDirectory>
> > @@ -203,34 +220,39 @@
> > <compilerVersion>1.5</compilerVersion>
> > <source>1.5</source>
> > <target>1.5</target>
> > +
> > </configuration>
> > </plugin>
> > <plugin>
> > <groupId>org.apache.maven.plugins</groupId>
> > <artifactId>maven-antrun-plugin</artifactId>
> > +
> > <executions>
> > <execution>
> > <id>gen-ts</id>
> > <phase>generate-test-sources</phase>
> > <configuration>
> > - <tasks unless="maven.test.skip">
> > + <tasks unless="maven.test.skip">
> > <!-- Theres got to be a better way to
do this -->
> > <property name="schema.source.dir"
value="test-resources/xsd"/>
> > <property name="wsdl.source.dir"
value="test-resources/wsdl"/>
> > - <property
name="schema.output.base.dir" value="target/schema"/>
> > + <property
name="schema.output.base.dir" value="target/schema"/>
> > <property
name="schema.generated.src.dir" value="${schema.output.base.dir}/src"/>
> > <property
name="schema.generated.classes.dir"
> > value="${schema.output.base.dir}/classes"/>
> > +
> > <!-- make the dirs -->
> > <mkdir
dir="${schema.output.base.dir}"/>
> > <mkdir
dir="${schema.generated.src.dir}"/>
> > <mkdir
dir="${schema.generated.classes.dir}"/>
> > +
> > <!-- Run JAXB schema compiler with
designated schemas -->
> > <echo>Generating JAX-B classes from
XSDs</echo>
> >
> > <echo>Generating java from
echo.xsd</echo>
> > <java
classname="com.sun.tools.xjc.Driver" fork="true">
> > <classpath
refid="maven.runtime.classpath"/>
> > +
> > <classpath
location="${compiled.classes.dir}"/>
> > <arg line="-d
${schema.generated.src.dir} -quiet ${schema.source.dir}/echo.xsd"/>
> > </java>
> > @@ -266,7 +288,7 @@
> > <classpath
refid="maven.runtime.classpath"/>
> > <classpath
location="${compiled.classes.dir}"/>
> > <arg line="-d
${schema.generated.src.dir} -quiet -wsdl
${wsdl.source.dir}/AddNumbers.wsdl"/>
> > - </java>
> > + </java>
> > </tasks>
> > </configuration>
> > <goals>
> > @@ -287,6 +309,22 @@
> > <property name="addressing_version"
value="${version}"/>
> > <ant antfile="build.xml"
inheritall="true" inheritrefs="true"
> > dir="." target="build-repo"/>
> > +
> > + <property name="compile_classpath" refid="maven.compile.classpath"
/>
> > + <property name="runtime_classpath" refid="maven.runtime.classpath"
/>
> > + <property name="test_classpath" refid="maven.test.classpath" />
> > + <property name="plugin_classpath" refid="maven.plugin.classpath" />
> > +
> > + <!-- Defining wsGen task -->
> > + <taskdef name="wsgen" loaderRef="refwsgen"
classname="com.sun.tools.ws.ant.WsGen">
> > + <classpath>
> > + <path refid="maven.runtime.classpath" />
> > + <path refid="maven.compile.classpath" />
> > + </classpath>
> > + </taskdef>
> > + <!--
Invoking test cases that need to generate artifacts using wsGen -->
> > + <ant antfile="wsgen-tests.xml"
inheritall="true" inheritrefs="true"
> > + dir="."
target="run-wsgen-tests"/>
> > </tasks>
> > </configuration>
> > <goals>
> > @@ -374,6 +412,13 @@
> > <plugin>
> > <groupId>org.apache.maven.plugins</groupId>
> > <artifactId>maven-surefire-report-plugin</artifactId>
> > + <reportSets>
> > + <reportSet>
> > + <reports>
> > + <report>report-only</report>
> > + </reports>
> > + </reportSet>
> > + </reportSets>
> > </plugin>
> > </plugins>
> > </reporting>
> >
> > Modified:
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
> > URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java?rev=963508&r1=963507&r2=963508&view=diff
> >
==============================================================================
> > ---
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
(original)
> > +++
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
Mon Jul 12 22:16:54 2010
> > @@ -238,12 +238,27 @@ class ArtifactProcessor {
> > wrapperClass = newValue;
> > }
> > }
> > - if(cls==null && (type.equals("@WebFault")||
type.equals("faultInfo"))){
> > +
> > + if(cls==null &&
> > + (type.equals("@RequestWrapper")||
type.equals("@ResponseWrapper")||type.equals("@WebFault")||
type.equals("faultInfo"))){
> > +
> > + //Support for Fault Bean Generation
> > //As per JAX-WS 2.2 Specification section
3.7 an application programmer can choose not to
> > //package the faultBeans, if we have
reached this point in the code then user has choosen
> > //not to package the fault bean. If there
is a cache of generated artifacts available then
> > //lets look for the missing faultBean
there.
> > -
> > +
> > + //Support for Wrapper Bean Generation
> > + //As per JAX-WS 2.2 Specificaiton section
3.6.2.1 pg 41 an application programmer does not use
> > + //the wrapper bean classes, so the
application need not package these classes. If we have reached
> > + //this point in the code then user has
choosen not to package these beans.
> > +
> > + //NOTE:If we find Generated artifacts
from cache this guarantees that we will not use
> > + //DocLitWrappedMinimum marshaller code.
The advantage of normal DocLitWrappedMarshaller is
> > + //that it is very robust and has support
of lot more datatypes than in DocLitWrappedMinimum.
> > + if(log.isDebugEnabled()){
> > + log.debug("Adding cache to
classpath");
> > + }
> > ClassFinderFactory cff =
> >
(ClassFinderFactory)FactoryRegistry.getFactory(ClassFinderFactory.class);
> > ClassFinder cf = cff.getClassFinder();
> > @@ -317,11 +332,26 @@ class ArtifactProcessor {
> > if (cls2 == null) {
> > cls2 = loadClassOrNull(defaultValue,
altClassLoader);
> > }
> > - if(cls2==null && (type.equals("faultInfo")||
type.equals("@WebFault"))){
> > - //As per JAX-WS 2.2 Specification section
3.7 an application programmer can choose not to
> > - //package the faultBeans, if we have
reached this point in the code then user has choosen
> > - //not to package the fault bean. If there
is a cache of generated artifacts available then
> > - //lets look for the missing faultBean
there.
> > + if(cls2==null &&
> > + (type.equals("@RequestWrapper")||
type.equals("@ResponseWrapper")||type.equals("@WebFault")||
type.equals("faultInfo"))){
> > +
> > + //Support for Fault Bean Generation
> > + //As per JAX-WS 2.2 Specification
section 3.7 an application programmer can choose not to
> > + //package the faultBeans, if we have
reached this point in the code then user has choosen
> > + //not to package the fault bean. If
there is a cache of generated artifacts available then
> > + //lets look for the missing faultBean
there.
> > +
> > + //Support for Wrapper Bean Generation
> > + //As per JAX-WS 2.2 Specificaiton
section 3.6.2.1 pg 41 an application programmer does not use
> > + //the wrapper bean classes, so the
application need not package these classes. If we have reached
> > + //this point in the code then user has
choosen not to package these beans.
> > +
> > + //NOTE:If we find Generated artifacts
from cache this guarantees that we will not use
> > + //DocLitWrappedMinimum marshaller
code. The advantage of normal DocLitWrappedMarshaller is
> > + //that it is very robust and has
support of lot more datatypes than in DocLitWrappedMinimum.
> > + if(log.isDebugEnabled()){
> > + log.debug("Adding cache to
classpath");
> > + }
> > if(log.isDebugEnabled()){
> > log.debug("Adding cache to
classpath");
> > }
> >
> > Added:
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
> > URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java?rev=963508&view=auto
> >
==============================================================================
> > ---
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
(added)
> > +++
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
Mon Jul 12 22:16:54 2010
> > @@ -0,0 +1,18 @@
> > +
> > +package org.apache.axis2.jaxws.wrapper.beans;
> > +
> > +import javax.xml.ws.WebFault;
> > +
> > +@WebFault(name = "AddNumbersFault", targetNamespace = "
http://org/test/addnumbers")
> > +public class AddNumbersException extends Exception
> > +{
> > +
> > + private String message = null;
> > + public AddNumbersException(){}
> > + public AddNumbersException(String message){
> > + this.message = message;
> > + }
> > + public String getInfo(){
> > + return message;
> > + }
> > +}
> >
> > Added:
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
> > URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java?rev=963508&view=auto
> >
==============================================================================
> > ---
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
(added)
> > +++
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
Mon Jul 12 22:16:54 2010
> > @@ -0,0 +1,15 @@
> > +package org.apache.axis2.jaxws.wrapper.beans;
> > +
> > +
> > +
> > +@javax.jws.WebService (targetNamespace="http://org/test/addnumbers",
serviceName="AddNumbersService", portName="AddNumbersPort")
> > +public class AddNumbersService{
> > +
> > + public int addNumbers(int arg0, int arg1) throws
AddNumbersException {
> > + if(arg0+arg1<0){
> > + throw new AddNumbersException("sum is less
than 0");
> > + }
> > + return arg0+arg1;
> > + }
> > +
> > +}
> > \ No newline at end of file
> >
> > Added:
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
> > URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java?rev=963508&view=auto
> >
==============================================================================
> > ---
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
(added)
> > +++
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
Mon Jul 12 22:16:54 2010
> > @@ -0,0 +1,114 @@
> > +/**
> > + *
> > + */
> > +package org.apache.axis2.jaxws.wrapper.beans;
> > +
> > +
> > +import org.apache.axis2.jaxws.Constants;
> > +import org.apache.axis2.jaxws.description.DescriptionFactory;
> > +import org.apache.axis2.jaxws.description.EndpointDescription;
> > +import org.apache.axis2.jaxws.description.EndpointDescriptionJava;
> > +import org.apache.axis2.jaxws.description.OperationDescription;
> > +import org.apache.axis2.jaxws.description.ServiceDescription;
> > +import org.apache.axis2.jaxws.marshaller.MethodMarshaller;
> > +import
org.apache.axis2.jaxws.marshaller.factory.MethodMarshallerFactory;
> > +import
org.apache.axis2.jaxws.marshaller.impl.alt.DocLitWrappedMinimalMethodMarshaller;
> > +import org.apache.axis2.jaxws.unitTest.TestLogger;
> > +
> > +import java.io.File;
> > +
> > +import junit.framework.TestCase;
> > +
> > +public class WrapperBeanMarshallTests extends TestCase {
> > + /**
> > + * This is the negative test case, when we do not use generated
artifacts from cache
> > + * and user did not package wrapper beans, we should see use of
DocLitWrappedMinumumMarshaller.
> > + */
> > + public void
testGetMarshallerOperationDescriptionBooleanNegative() {
> > + TestLogger.logger.debug("---------------------------------------");
> > + TestLogger.logger.debug("test: " + getName());
> > +
> > + String cache_location = "/target/wscache/classes";
> > + try{
> > + String baseDir = new
File(System.getProperty("basedir",".")).getCanonicalPath();
> > + cache_location = new
File(baseDir+cache_location).getAbsolutePath();
> > + TestLogger.logger.debug("cache location
="+cache_location);
> > +
> > + //Get EndpointDescription.
> > + //Set location on AxisConfiguraiton.
> > + Class sei = AddNumbersService.class;
> > + EndpointDescription description = getEndpointDesc(sei);
> > + TestLogger.logger.debug("description objects where
created successfully");
> > + OperationDescription[] ops
=description.getEndpointInterfaceDescription().getOperations();
> > + assertNotNull( "OperationDescriptions where null", ops);
> > + assertTrue("No Operation Descriptions where found",
ops.length>0);
> > + OperationDescription op = ops[0];
> > + TestLogger.logger.debug("operation found, java
methodName="+op.getJavaMethodName());
> > + //Don not Set cache on AxisConfiguration.
> > + //get Marshaller, verify its not DoclitWrappedMinimum.
> > + TestLogger.logger.debug("ws_cache location NOT set on
AxisConfigContext, location="+cache_location);
> > + MethodMarshaller mm =
MethodMarshallerFactory.getMarshaller(op, false);
> > + assertNotNull("getMarshaller returned null", mm );
> > + TestLogger.logger.debug("MethodMarshaller was created,
type="+mm.getClass().getName());
> > + assertTrue("Generated artifacts not found, Method
marshaller should be DocLitWrappedMinimumMarshaller", (mm instanceof
DocLitWrappedMinimalMethodMarshaller));
> > + }catch(Exception e){
> > + TestLogger.logger.debug("Exception ="+e.getMessage());
> > + fail(e.getMessage());
> > + }
> > +
> > + }
> > + /**
> > + * In this test case user did not package wrapper beans but we
add generated artifacts from cache, we should see use of
> > + * DocLitWrappedMarshaller.
> > + * Test method for {@link
org.apache.axis2.jaxws.marshaller.factory.MethodMarshallerFactory#getMarshaller(org.apache.axis2.jaxws.description.OperationDescription,
boolean)}.
> > + */
> > + public void testGetMarshallerOperationDescriptionBoolean() {
> > + TestLogger.logger.debug("---------------------------------------");
> > + TestLogger.logger.debug("test: " + getName());
> > +
> > + String cache_location = "/target/wscache/classes";
> > + try{
> > + String baseDir = new
File(System.getProperty("basedir",".")).getCanonicalPath();
> > + cache_location = new
File(baseDir+cache_location).getAbsolutePath();
> > + TestLogger.logger.debug("cache location
="+cache_location);
> > +
> > + //Get EndpointDescription.
> > + //Set location on AxisConfiguraiton.
> > + Class sei = AddNumbersService.class;
> > + EndpointDescription description = getEndpointDesc(sei);
> > + TestLogger.logger.debug("description objects where
created successfully");
> > + OperationDescription[] ops
=description.getEndpointInterfaceDescription().getOperations();
> > + assertNotNull( "OperationDescriptions where null", ops);
> > + assertTrue("No Operation Descriptions where found",
ops.length>0);
> > + OperationDescription op = ops[0];
> > + TestLogger.logger.debug("operation found, java
methodName="+op.getJavaMethodName());
> > + //Set cache on AxisConfiguration.
> > + //get Marshaller, verify its not DoclitWrappedMinimum.
> > +
description.getServiceDescription().getAxisConfigContext().setProperty(Constants.WS_CACHE,
cache_location);
> > + TestLogger.logger.debug("ws_cache location set on
AxisConfigContext, location="+cache_location);
> > + MethodMarshaller mm =
MethodMarshallerFactory.getMarshaller(op, false);
> > + assertNotNull("getMarshaller returned null", mm );
> > + TestLogger.logger.debug("MethodMarshaller was created,
type="+mm.getClass().getName());
> > + assertTrue("Generated artifacts are in cache, Method
marshaller should not be DocLitWrappedMinimumMarshaller", !(mm instanceof
DocLitWrappedMinimalMethodMarshaller));
> > + }catch(Exception e){
> > + TestLogger.logger.debug("Exception ="+e.getMessage());
> > + fail(e.getMessage());
> > + }
> > +
> > + }
> > +
> > + private EndpointDescription getEndpointDesc(Class
implementationClass) {
> > + // Use the description factory directly; this will be done
within the JAX-WS runtime
> > + ServiceDescription serviceDesc =
> > + DescriptionFactory.createServiceDescription(implementationClass);
> > + assertNotNull(serviceDesc);
> > +
> > + EndpointDescription[] endpointDesc =
serviceDesc.getEndpointDescriptions();
> > + assertNotNull(endpointDesc);
> > + assertEquals(1, endpointDesc.length);
> > +
> > + // TODO: How will the JAX-WS dispatcher get the appropriate
port (i.e. endpoint)? Currently assumes [0]
> > + EndpointDescription testEndpointDesc = endpointDesc[0];
> > + return testEndpointDesc;
> > + }
> > +}
> >
> > Added: axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml
> > URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml?rev=963508&view=auto
> >
==============================================================================
> > --- axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml (added)
> > +++ axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml Mon Jul
12 22:16:54 2010
> > @@ -0,0 +1,34 @@
> > +<?xml version="1.0" encoding="UTF-8"?>
> > +
> > +<project basedir="." default="run-wsgen-tests" name="wsgen-tests">
> > +
> > + <property name="wscache.output.base.dir"
value="target/wscache" />
> > + <property name="wscache.generated.src.dir"
value="${wscache.output.base.dir}/src" />
> > + <property name="wscache.generated.classes.dir"
value="${wscache.output.base.dir}/classes" />
> > + <property name="compile.test.classes"
value="target/test-classes" />
> > +
> > +
> > + <target name="run-wsgen-tests" depends="wrapper-beans"/>
> > +
> > +
> > + <target name="create-cache">
> > + <mkdir dir="${wscache.output.base.dir}" />
> > + <mkdir dir="${wscache.generated.src.dir}" />
> > + <mkdir dir="${wscache.generated.classes.dir}" />
> > + </target>
> > +
> > + <target name="wrapper-beans" depends="create-cache">
> > + <echo>Generating artifacts for
org.apache.axis2.jaxws.wrapper.beans.AddNumbersService </echo>
> > + <wsgen
> > + sei="org.apache.axis2.jaxws.wrapper.beans.AddNumbersService"
> > + destdir="${wscache.generated.classes.dir}"
> > + resourcedestdir="${wscache.generated.src.dir}"
> > + keep="false"
> > + verbose="false"
> > + genwsdl="true">
> > + <classpath>
> > + <pathelement path="${compile.test.classes}" />
> > + </classpath>
> > + </wsgen>
> > + </target>
> > +</project>
> > \ No newline at end of file
> >
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-dev-help@axis.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org
Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws: ./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/
test/org/apache/axis2/jaxws/wrapper/ test/org/apache/axis2/jaxws/wrapper/beans/
Posted by Nikhil V Thaker <ni...@us.ibm.com>.
Andreas - Use of wsGen and Test case Changes have been backed out. There
should not be any dependency on jaxws-tools.jar and also reference to
tools.jar have been removed from pom. Changes in revision #964185.
Thanks,
Nikhil Thaker
office: 919 254 9964
nvthaker@us.ibm.com
Nikhil V Thaker/Columbus/IBM@IBMUS
07/14/2010 03:00 PM
Please respond to
java-dev@axis.apache.org
To
java-dev@axis.apache.org
cc
java-dev@axis.apache.org
Subject
Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws: ./
src/org/apache/axis2/jaxws/runtime/description/marshal/impl/
test/org/apache/axis2/jaxws/wrapper/
test/org/apache/axis2/jaxws/wrapper/beans/
Yes Andreas,
I am running antrun plugin as the wsGen plugin has errors and is not
fully matured, here's the URL that explains the issue I ran into
http://jira.codehaus.org/browse/MNG-3586.
So since I cannot run wsGen or cannot include generated artifacts I will
just remove the test case. I will commit the changes soon.
Regards,
Nikhil Thaker
office: 919 254 9964
nvthaker@us.ibm.com
Andreas Veithen <an...@gmail.com>
07/14/2010 02:48 PM
Please respond to
java-dev@axis.apache.org
To
java-dev@axis.apache.org
cc
Subject
Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws:
./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/
test/org/apache/axis2/jaxws/wrapper/
test/org/apache/axis2/jaxws/wrapper/beans/
No, you are using the antrun plugin to execute the wsgen ant task.
What I meant was to use a real Maven plugin (either the one from
java.net or the one from CXF).
-1 to commit any generated stuff into SVN.
Andreas
On Wed, Jul 14, 2010 at 21:42, Nikhil V Thaker
<ni...@us.ibm.com> wrote:
>
> Andreas - I had to add the tools.jar bit because maven plugin for wsGen
gave NoClassDef Found errors for classes packaged in tools.jar.
>
> Since this is causing a problem I will just package the generated
artifacts and remove the wsGen dependency.
>
> Thanks,
>
> Nikhil Thaker
> office: 919 254 9964
> nvthaker@us.ibm.com
>
>
> Andreas Veithen <an...@gmail.com>
>
> 07/14/2010 01:44 PM
>
> Please respond to
> java-dev@axis.apache.org
> To
> java-dev@axis.apache.org
> cc
> Subject
> Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws:
./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/
test/org/apache/axis2/jaxws/wrapper/
test/org/apache/axis2/jaxws/wrapper/beans/
>
>
>
>
> Nikhil,
>
> I have some issues with the tools and jaxws-tools dependencies
> introduced by this change:
>
> * The change causes a build failure in Hudson. There will also be
> additional issues with tools.jar, because the way to declare this as a
> system dependency varies from one JDK to another. For example, I
> remember that on Mac OS X, it is completely different than on other
> JDKs.
>
> * I don't like the fact that jaxws-tools becomes a dependency of
> axis2-jaxws in scope compile, because it looks like this is only
> needed during the build and/or during the tests.
>
> I didn't review the change in detail, but wouldn't it be smarter to
> use one of the existing Maven plugins to do the wsgen stuff? They will
> take care of the tools.jar stuff as well.
>
> Andreas
>
> On Tue, Jul 13, 2010 at 00:16, <nt...@apache.org> wrote:
> > Author: nthaker
> > Date: Mon Jul 12 22:16:54 2010
> > New Revision: 963508
> >
> > URL: http://svn.apache.org/viewvc?rev=963508&view=rev
> > Log:
> > AXIS2-4775
> > This change ensures that we will use Request and Response wrapper Bean
packaged by customer or we will Generate Wrappers if they are not
packaged.
> >
> > Added:
> >
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/
> >
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/
> >
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
> >
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
> >
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
> > axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml
> > Modified:
> > axis/axis2/java/core/trunk/modules/jaxws/pom.xml
> >
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
> >
> > Modified: axis/axis2/java/core/trunk/modules/jaxws/pom.xml
> > URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/pom.xml?rev=963508&r1=963507&r2=963508&view=diff
> >
==============================================================================
> > --- axis/axis2/java/core/trunk/modules/jaxws/pom.xml (original)
> > +++ axis/axis2/java/core/trunk/modules/jaxws/pom.xml Mon Jul 12
22:16:54 2010
> > @@ -1,5 +1,4 @@
> > <?xml version="1.0" encoding="UTF-8"?>
> > -
> > <!-- > ~ Licensed to the Apache Software Foundation (ASF) under one
> > ~ or more contributor license agreements. See the NOTICE file
> > @@ -20,7 +19,7 @@
> > -->
> >
> > <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"
> > - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
> > + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
> > <modelVersion>4.0.0</modelVersion>
> > <parent>
> > <groupId>org.apache.axis2</groupId>
> > @@ -98,7 +97,25 @@
> > <version>${version}</version>
> > <scope>test</scope>
> > </dependency>
> > + <dependency>
> > + <groupId>wsdl4j</groupId>
> > + <artifactId>wsdl4j</artifactId>
> > + </dependency>
> > + <dependency>
> > + <groupId>com.sun.xml.ws</groupId>
> > + <artifactId>jaxws-tools</artifactId>
> > + <version>2.1.3</version>
> > + </dependency>
> > + <!-- If we dont include tools.jar as dependency, maven throws
NoClassDefFound on wsGen run -->
> > + <dependency>
> > + <groupId>java</groupId>
> > + <artifactId>tools</artifactId>
> > + <version>$version</version>
> > + <scope>system</scope>
> > + <systemPath>${JAVA_HOME}/lib/tools.jar</systemPath>
> > + </dependency>
> > </dependencies>
> > +
> > <build>
> > <sourceDirectory>src</sourceDirectory>
> > <testSourceDirectory>test</testSourceDirectory>
> > @@ -203,34 +220,39 @@
> > <compilerVersion>1.5</compilerVersion>
> > <source>1.5</source>
> > <target>1.5</target>
> > +
> > </configuration>
> > </plugin>
> > <plugin>
> > <groupId>org.apache.maven.plugins</groupId>
> > <artifactId>maven-antrun-plugin</artifactId>
> > +
> > <executions>
> > <execution>
> > <id>gen-ts</id>
> > <phase>generate-test-sources</phase>
> > <configuration>
> > - <tasks unless="maven.test.skip">
> > + <tasks unless="maven.test.skip">
> > <!-- Theres got to be a better way to
do this -->
> > <property name="schema.source.dir"
value="test-resources/xsd"/>
> > <property name="wsdl.source.dir"
value="test-resources/wsdl"/>
> > - <property
name="schema.output.base.dir" value="target/schema"/>
> > + <property
name="schema.output.base.dir" value="target/schema"/>
> > <property
name="schema.generated.src.dir" value="${schema.output.base.dir}/src"/>
> > <property
name="schema.generated.classes.dir"
> > value="${schema.output.base.dir}/classes"/>
> > +
> > <!-- make the dirs -->
> > <mkdir
dir="${schema.output.base.dir}"/>
> > <mkdir
dir="${schema.generated.src.dir}"/>
> > <mkdir
dir="${schema.generated.classes.dir}"/>
> > +
> > <!-- Run JAXB schema compiler with
designated schemas -->
> > <echo>Generating JAX-B classes from
XSDs</echo>
> >
> > <echo>Generating java from
echo.xsd</echo>
> > <java
classname="com.sun.tools.xjc.Driver" fork="true">
> > <classpath
refid="maven.runtime.classpath"/>
> > +
> > <classpath
location="${compiled.classes.dir}"/>
> > <arg line="-d
${schema.generated.src.dir} -quiet ${schema.source.dir}/echo.xsd"/>
> > </java>
> > @@ -266,7 +288,7 @@
> > <classpath
refid="maven.runtime.classpath"/>
> > <classpath
location="${compiled.classes.dir}"/>
> > <arg line="-d
${schema.generated.src.dir} -quiet -wsdl
${wsdl.source.dir}/AddNumbers.wsdl"/>
> > - </java>
> > + </java>
> > </tasks>
> > </configuration>
> > <goals>
> > @@ -287,6 +309,22 @@
> > <property name="addressing_version"
value="${version}"/>
> > <ant antfile="build.xml"
inheritall="true" inheritrefs="true"
> > dir="." target="build-repo"/>
> > +
> > + <property name="compile_classpath" refid="maven.compile.classpath"
/>
> > + <property name="runtime_classpath" refid="maven.runtime.classpath"
/>
> > + <property name="test_classpath" refid="maven.test.classpath" />
> > + <property name="plugin_classpath" refid="maven.plugin.classpath" />
> > +
> > + <!-- Defining wsGen task -->
> > + <taskdef name="wsgen" loaderRef="refwsgen"
classname="com.sun.tools.ws.ant.WsGen">
> > + <classpath>
> > + <path refid="maven.runtime.classpath" />
> > + <path refid="maven.compile.classpath" />
> > + </classpath>
> > + </taskdef>
> > + <!--
Invoking test cases that need to generate artifacts using wsGen -->
> > + <ant antfile="wsgen-tests.xml"
inheritall="true" inheritrefs="true"
> > + dir="."
target="run-wsgen-tests"/>
> > </tasks>
> > </configuration>
> > <goals>
> > @@ -374,6 +412,13 @@
> > <plugin>
> > <groupId>org.apache.maven.plugins</groupId>
> > <artifactId>maven-surefire-report-plugin</artifactId>
> > + <reportSets>
> > + <reportSet>
> > + <reports>
> > + <report>report-only</report>
> > + </reports>
> > + </reportSet>
> > + </reportSets>
> > </plugin>
> > </plugins>
> > </reporting>
> >
> > Modified:
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
> > URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java?rev=963508&r1=963507&r2=963508&view=diff
> >
==============================================================================
> > ---
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
(original)
> > +++
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
Mon Jul 12 22:16:54 2010
> > @@ -238,12 +238,27 @@ class ArtifactProcessor {
> > wrapperClass = newValue;
> > }
> > }
> > - if(cls==null && (type.equals("@WebFault")||
type.equals("faultInfo"))){
> > +
> > + if(cls==null &&
> > + (type.equals("@RequestWrapper")||
type.equals("@ResponseWrapper")||type.equals("@WebFault")||
type.equals("faultInfo"))){
> > +
> > + //Support for Fault Bean Generation
> > //As per JAX-WS 2.2 Specification section
3.7 an application programmer can choose not to
> > //package the faultBeans, if we have
reached this point in the code then user has choosen
> > //not to package the fault bean. If there
is a cache of generated artifacts available then
> > //lets look for the missing faultBean
there.
> > -
> > +
> > + //Support for Wrapper Bean Generation
> > + //As per JAX-WS 2.2 Specificaiton section
3.6.2.1 pg 41 an application programmer does not use
> > + //the wrapper bean classes, so the
application need not package these classes. If we have reached
> > + //this point in the code then user has
choosen not to package these beans.
> > +
> > + //NOTE:If we find Generated artifacts
from cache this guarantees that we will not use
> > + //DocLitWrappedMinimum marshaller code.
The advantage of normal DocLitWrappedMarshaller is
> > + //that it is very robust and has support
of lot more datatypes than in DocLitWrappedMinimum.
> > + if(log.isDebugEnabled()){
> > + log.debug("Adding cache to
classpath");
> > + }
> > ClassFinderFactory cff =
> >
(ClassFinderFactory)FactoryRegistry.getFactory(ClassFinderFactory.class);
> > ClassFinder cf = cff.getClassFinder();
> > @@ -317,11 +332,26 @@ class ArtifactProcessor {
> > if (cls2 == null) {
> > cls2 = loadClassOrNull(defaultValue,
altClassLoader);
> > }
> > - if(cls2==null && (type.equals("faultInfo")||
type.equals("@WebFault"))){
> > - //As per JAX-WS 2.2 Specification section
3.7 an application programmer can choose not to
> > - //package the faultBeans, if we have
reached this point in the code then user has choosen
> > - //not to package the fault bean. If there
is a cache of generated artifacts available then
> > - //lets look for the missing faultBean
there.
> > + if(cls2==null &&
> > + (type.equals("@RequestWrapper")||
type.equals("@ResponseWrapper")||type.equals("@WebFault")||
type.equals("faultInfo"))){
> > +
> > + //Support for Fault Bean Generation
> > + //As per JAX-WS 2.2 Specification
section 3.7 an application programmer can choose not to
> > + //package the faultBeans, if we have
reached this point in the code then user has choosen
> > + //not to package the fault bean. If
there is a cache of generated artifacts available then
> > + //lets look for the missing faultBean
there.
> > +
> > + //Support for Wrapper Bean Generation
> > + //As per JAX-WS 2.2 Specificaiton
section 3.6.2.1 pg 41 an application programmer does not use
> > + //the wrapper bean classes, so the
application need not package these classes. If we have reached
> > + //this point in the code then user has
choosen not to package these beans.
> > +
> > + //NOTE:If we find Generated artifacts
from cache this guarantees that we will not use
> > + //DocLitWrappedMinimum marshaller
code. The advantage of normal DocLitWrappedMarshaller is
> > + //that it is very robust and has
support of lot more datatypes than in DocLitWrappedMinimum.
> > + if(log.isDebugEnabled()){
> > + log.debug("Adding cache to
classpath");
> > + }
> > if(log.isDebugEnabled()){
> > log.debug("Adding cache to
classpath");
> > }
> >
> > Added:
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
> > URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java?rev=963508&view=auto
> >
==============================================================================
> > ---
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
(added)
> > +++
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
Mon Jul 12 22:16:54 2010
> > @@ -0,0 +1,18 @@
> > +
> > +package org.apache.axis2.jaxws.wrapper.beans;
> > +
> > +import javax.xml.ws.WebFault;
> > +
> > +@WebFault(name = "AddNumbersFault", targetNamespace = "
http://org/test/addnumbers")
> > +public class AddNumbersException extends Exception
> > +{
> > +
> > + private String message = null;
> > + public AddNumbersException(){}
> > + public AddNumbersException(String message){
> > + this.message = message;
> > + }
> > + public String getInfo(){
> > + return message;
> > + }
> > +}
> >
> > Added:
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
> > URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java?rev=963508&view=auto
> >
==============================================================================
> > ---
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
(added)
> > +++
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
Mon Jul 12 22:16:54 2010
> > @@ -0,0 +1,15 @@
> > +package org.apache.axis2.jaxws.wrapper.beans;
> > +
> > +
> > +
> > +@javax.jws.WebService (targetNamespace="http://org/test/addnumbers",
serviceName="AddNumbersService", portName="AddNumbersPort")
> > +public class AddNumbersService{
> > +
> > + public int addNumbers(int arg0, int arg1) throws
AddNumbersException {
> > + if(arg0+arg1<0){
> > + throw new AddNumbersException("sum is less
than 0");
> > + }
> > + return arg0+arg1;
> > + }
> > +
> > +}
> > \ No newline at end of file
> >
> > Added:
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
> > URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java?rev=963508&view=auto
> >
==============================================================================
> > ---
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
(added)
> > +++
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
Mon Jul 12 22:16:54 2010
> > @@ -0,0 +1,114 @@
> > +/**
> > + *
> > + */
> > +package org.apache.axis2.jaxws.wrapper.beans;
> > +
> > +
> > +import org.apache.axis2.jaxws.Constants;
> > +import org.apache.axis2.jaxws.description.DescriptionFactory;
> > +import org.apache.axis2.jaxws.description.EndpointDescription;
> > +import org.apache.axis2.jaxws.description.EndpointDescriptionJava;
> > +import org.apache.axis2.jaxws.description.OperationDescription;
> > +import org.apache.axis2.jaxws.description.ServiceDescription;
> > +import org.apache.axis2.jaxws.marshaller.MethodMarshaller;
> > +import
org.apache.axis2.jaxws.marshaller.factory.MethodMarshallerFactory;
> > +import
org.apache.axis2.jaxws.marshaller.impl.alt.DocLitWrappedMinimalMethodMarshaller;
> > +import org.apache.axis2.jaxws.unitTest.TestLogger;
> > +
> > +import java.io.File;
> > +
> > +import junit.framework.TestCase;
> > +
> > +public class WrapperBeanMarshallTests extends TestCase {
> > + /**
> > + * This is the negative test case, when we do not use generated
artifacts from cache
> > + * and user did not package wrapper beans, we should see use of
DocLitWrappedMinumumMarshaller.
> > + */
> > + public void
testGetMarshallerOperationDescriptionBooleanNegative() {
> > + TestLogger.logger.debug("---------------------------------------");
> > + TestLogger.logger.debug("test: " + getName());
> > +
> > + String cache_location = "/target/wscache/classes";
> > + try{
> > + String baseDir = new
File(System.getProperty("basedir",".")).getCanonicalPath();
> > + cache_location = new
File(baseDir+cache_location).getAbsolutePath();
> > + TestLogger.logger.debug("cache location
="+cache_location);
> > +
> > + //Get EndpointDescription.
> > + //Set location on AxisConfiguraiton.
> > + Class sei = AddNumbersService.class;
> > + EndpointDescription description = getEndpointDesc(sei);
> > + TestLogger.logger.debug("description objects where
created successfully");
> > + OperationDescription[] ops
=description.getEndpointInterfaceDescription().getOperations();
> > + assertNotNull( "OperationDescriptions where null", ops);
> > + assertTrue("No Operation Descriptions where found",
ops.length>0);
> > + OperationDescription op = ops[0];
> > + TestLogger.logger.debug("operation found, java
methodName="+op.getJavaMethodName());
> > + //Don not Set cache on AxisConfiguration.
> > + //get Marshaller, verify its not DoclitWrappedMinimum.
> > + TestLogger.logger.debug("ws_cache location NOT set on
AxisConfigContext, location="+cache_location);
> > + MethodMarshaller mm =
MethodMarshallerFactory.getMarshaller(op, false);
> > + assertNotNull("getMarshaller returned null", mm );
> > + TestLogger.logger.debug("MethodMarshaller was created,
type="+mm.getClass().getName());
> > + assertTrue("Generated artifacts not found, Method
marshaller should be DocLitWrappedMinimumMarshaller", (mm instanceof
DocLitWrappedMinimalMethodMarshaller));
> > + }catch(Exception e){
> > + TestLogger.logger.debug("Exception ="+e.getMessage());
> > + fail(e.getMessage());
> > + }
> > +
> > + }
> > + /**
> > + * In this test case user did not package wrapper beans but we
add generated artifacts from cache, we should see use of
> > + * DocLitWrappedMarshaller.
> > + * Test method for {@link
org.apache.axis2.jaxws.marshaller.factory.MethodMarshallerFactory#getMarshaller(org.apache.axis2.jaxws.description.OperationDescription,
boolean)}.
> > + */
> > + public void testGetMarshallerOperationDescriptionBoolean() {
> > + TestLogger.logger.debug("---------------------------------------");
> > + TestLogger.logger.debug("test: " + getName());
> > +
> > + String cache_location = "/target/wscache/classes";
> > + try{
> > + String baseDir = new
File(System.getProperty("basedir",".")).getCanonicalPath();
> > + cache_location = new
File(baseDir+cache_location).getAbsolutePath();
> > + TestLogger.logger.debug("cache location
="+cache_location);
> > +
> > + //Get EndpointDescription.
> > + //Set location on AxisConfiguraiton.
> > + Class sei = AddNumbersService.class;
> > + EndpointDescription description = getEndpointDesc(sei);
> > + TestLogger.logger.debug("description objects where
created successfully");
> > + OperationDescription[] ops
=description.getEndpointInterfaceDescription().getOperations();
> > + assertNotNull( "OperationDescriptions where null", ops);
> > + assertTrue("No Operation Descriptions where found",
ops.length>0);
> > + OperationDescription op = ops[0];
> > + TestLogger.logger.debug("operation found, java
methodName="+op.getJavaMethodName());
> > + //Set cache on AxisConfiguration.
> > + //get Marshaller, verify its not DoclitWrappedMinimum.
> > +
description.getServiceDescription().getAxisConfigContext().setProperty(Constants.WS_CACHE,
cache_location);
> > + TestLogger.logger.debug("ws_cache location set on
AxisConfigContext, location="+cache_location);
> > + MethodMarshaller mm =
MethodMarshallerFactory.getMarshaller(op, false);
> > + assertNotNull("getMarshaller returned null", mm );
> > + TestLogger.logger.debug("MethodMarshaller was created,
type="+mm.getClass().getName());
> > + assertTrue("Generated artifacts are in cache, Method
marshaller should not be DocLitWrappedMinimumMarshaller", !(mm instanceof
DocLitWrappedMinimalMethodMarshaller));
> > + }catch(Exception e){
> > + TestLogger.logger.debug("Exception ="+e.getMessage());
> > + fail(e.getMessage());
> > + }
> > +
> > + }
> > +
> > + private EndpointDescription getEndpointDesc(Class
implementationClass) {
> > + // Use the description factory directly; this will be done
within the JAX-WS runtime
> > + ServiceDescription serviceDesc =
> > + DescriptionFactory.createServiceDescription(implementationClass);
> > + assertNotNull(serviceDesc);
> > +
> > + EndpointDescription[] endpointDesc =
serviceDesc.getEndpointDescriptions();
> > + assertNotNull(endpointDesc);
> > + assertEquals(1, endpointDesc.length);
> > +
> > + // TODO: How will the JAX-WS dispatcher get the appropriate
port (i.e. endpoint)? Currently assumes [0]
> > + EndpointDescription testEndpointDesc = endpointDesc[0];
> > + return testEndpointDesc;
> > + }
> > +}
> >
> > Added: axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml
> > URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml?rev=963508&view=auto
> >
==============================================================================
> > --- axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml (added)
> > +++ axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml Mon Jul
12 22:16:54 2010
> > @@ -0,0 +1,34 @@
> > +<?xml version="1.0" encoding="UTF-8"?>
> > +
> > +<project basedir="." default="run-wsgen-tests" name="wsgen-tests">
> > +
> > + <property name="wscache.output.base.dir"
value="target/wscache" />
> > + <property name="wscache.generated.src.dir"
value="${wscache.output.base.dir}/src" />
> > + <property name="wscache.generated.classes.dir"
value="${wscache.output.base.dir}/classes" />
> > + <property name="compile.test.classes"
value="target/test-classes" />
> > +
> > +
> > + <target name="run-wsgen-tests" depends="wrapper-beans"/>
> > +
> > +
> > + <target name="create-cache">
> > + <mkdir dir="${wscache.output.base.dir}" />
> > + <mkdir dir="${wscache.generated.src.dir}" />
> > + <mkdir dir="${wscache.generated.classes.dir}" />
> > + </target>
> > +
> > + <target name="wrapper-beans" depends="create-cache">
> > + <echo>Generating artifacts for
org.apache.axis2.jaxws.wrapper.beans.AddNumbersService </echo>
> > + <wsgen
> > + sei="org.apache.axis2.jaxws.wrapper.beans.AddNumbersService"
> > + destdir="${wscache.generated.classes.dir}"
> > + resourcedestdir="${wscache.generated.src.dir}"
> > + keep="false"
> > + verbose="false"
> > + genwsdl="true">
> > + <classpath>
> > + <pathelement path="${compile.test.classes}" />
> > + </classpath>
> > + </wsgen>
> > + </target>
> > +</project>
> > \ No newline at end of file
> >
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-dev-help@axis.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org
Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws:
./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/
test/org/apache/axis2/jaxws/wrapper/ test/org/apache/axis2/jaxws/wrapper/beans/
Posted by Andreas Veithen <an...@gmail.com>.
Jarek, you got my point. There is of course no objection to add
jaxws-tools as a _test_ dependency. For the tools.jar dependency, I
don't know exactly how system dependencies behave with respect to
transitive dependencies, but anyway, if tools.jar is only required for
the ant task, it would be easier to add it to the classpath in the ant
script. The reason is that to add tools.jar as a Maven dependencies
requires defining several profiles. This is because on Mac OS X, there
is no tools.jar and all classes are always available from the system
classpath. Thus you need to have profiles that are activated when
building with a Sun or IBM JDK, but not on Mac OS X.
Andreas
On Thu, Jul 15, 2010 at 05:55, Jarek Gawor <jg...@gmail.com> wrote:
> Nikhil,
>
> I don't think there is an objection for adding jaxws-tools as a _test_
> dependency. So as long you add the jaxws-tools dependency with
> <scope>test</scope> there shouldn't be a problem.
>
> Jarek
>
> On Wed, Jul 14, 2010 at 10:40 PM, Nikhil V Thaker
> <ni...@us.ibm.com> wrote:
>>
>> Thanks Jarek for the suggestion.
>>
>> The fact that there is an objection to putting jaxws-tools.jar as a dependency would mean we cannot run wsGen. Unless I misunderstood Andreas comments. To me we should always have jaxws-tools as dependency to jaxws module, after all jaxws tools are prerequisite to jaxws runtime, a user of jaxws runtime has to run wsGen or wsImport to build webservices application.
>>
>> Anyways, I will look and see if there is an alternate way to add these test cases.
>>
>> Regards,
>>
>> Nikhil Thaker
>> office: 919 254 9964
>> nvthaker@us.ibm.com
>>
>>
>> Jarek Gawor <jg...@gmail.com>
>>
>> 07/14/2010 03:38 PM
>>
>> Please respond to
>> java-dev@axis.apache.org
>> To
>> java-dev@axis.apache.org
>> cc
>> Subject
>> Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws: ./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ test/org/apache/axis2/jaxws/wrapper/ test/org/apache/axis2/jaxws/wrapper/beans/
>>
>>
>>
>>
>> Just a couple of thoughts:
>>
>> 1) Since you already have wsgen-tests.xml ant script to run the wsgen
>> you could setup the appropriate classpath to the tools.jar or
>> classes.jar or whatever in it. You just might need to fork the ant
>> process.
>>
>> 2) I don't think it's that horrible to commit some generate code
>> especially if there isn't too much of it and the test case is
>> important. Besides, Axis2 already has some generated code checked it.
>>
>> Jarek
>>
>> On Wed, Jul 14, 2010 at 4:00 PM, Nikhil V Thaker
>> <ni...@us.ibm.com> wrote:
>> >
>> > Yes Andreas,
>> > I am running antrun plugin as the wsGen plugin has errors and is not fully matured, here's the URL that explains the issue I ran into http://jira.codehaus.org/browse/MNG-3586.
>> >
>> > So since I cannot run wsGen or cannot include generated artifacts I will just remove the test case. I will commit the changes soon.
>> >
>> > Regards,
>> >
>> > Nikhil Thaker
>> > office: 919 254 9964
>> > nvthaker@us.ibm.com
>> >
>> >
>> > Andreas Veithen <an...@gmail.com>
>> >
>> > 07/14/2010 02:48 PM
>> >
>> > Please respond to
>> > java-dev@axis.apache.org
>> > To
>> > java-dev@axis.apache.org
>> > cc
>> > Subject
>> > Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws: ./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ test/org/apache/axis2/jaxws/wrapper/ test/org/apache/axis2/jaxws/wrapper/beans/
>> >
>> >
>> >
>> >
>> > No, you are using the antrun plugin to execute the wsgen ant task.
>> > What I meant was to use a real Maven plugin (either the one from
>> > java.net or the one from CXF).
>> >
>> > -1 to commit any generated stuff into SVN.
>> >
>> > Andreas
>> >
>> > On Wed, Jul 14, 2010 at 21:42, Nikhil V Thaker
>> > <ni...@us.ibm.com> wrote:
>> > >
>> > > Andreas - I had to add the tools.jar bit because maven plugin for wsGen gave NoClassDef Found errors for classes packaged in tools.jar.
>> > >
>> > > Since this is causing a problem I will just package the generated artifacts and remove the wsGen dependency.
>> > >
>> > > Thanks,
>> > >
>> > > Nikhil Thaker
>> > > office: 919 254 9964
>> > > nvthaker@us.ibm.com
>> > >
>> > >
>> > > Andreas Veithen <an...@gmail.com>
>> > >
>> > > 07/14/2010 01:44 PM
>> > >
>> > > Please respond to
>> > > java-dev@axis.apache.org
>> > > To
>> > > java-dev@axis.apache.org
>> > > cc
>> > > Subject
>> > > Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws: ./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ test/org/apache/axis2/jaxws/wrapper/ test/org/apache/axis2/jaxws/wrapper/beans/
>> > >
>> > >
>> > >
>> > >
>> > > Nikhil,
>> > >
>> > > I have some issues with the tools and jaxws-tools dependencies
>> > > introduced by this change:
>> > >
>> > > * The change causes a build failure in Hudson. There will also be
>> > > additional issues with tools.jar, because the way to declare this as a
>> > > system dependency varies from one JDK to another. For example, I
>> > > remember that on Mac OS X, it is completely different than on other
>> > > JDKs.
>> > >
>> > > * I don't like the fact that jaxws-tools becomes a dependency of
>> > > axis2-jaxws in scope compile, because it looks like this is only
>> > > needed during the build and/or during the tests.
>> > >
>> > > I didn't review the change in detail, but wouldn't it be smarter to
>> > > use one of the existing Maven plugins to do the wsgen stuff? They will
>> > > take care of the tools.jar stuff as well.
>> > >
>> > > Andreas
>> > >
>> > > On Tue, Jul 13, 2010 at 00:16, <nt...@apache.org> wrote:
>> > > > Author: nthaker
>> > > > Date: Mon Jul 12 22:16:54 2010
>> > > > New Revision: 963508
>> > > >
>> > > > URL: http://svn.apache.org/viewvc?rev=963508&view=rev
>> > > > Log:
>> > > > AXIS2-4775
>> > > > This change ensures that we will use Request and Response wrapper Bean packaged by customer or we will Generate Wrappers if they are not packaged.
>> > > >
>> > > > Added:
>> > > > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/
>> > > > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/
>> > > > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
>> > > > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
>> > > > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
>> > > > axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml
>> > > > Modified:
>> > > > axis/axis2/java/core/trunk/modules/jaxws/pom.xml
>> > > > axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
>> > > >
>> > > > Modified: axis/axis2/java/core/trunk/modules/jaxws/pom.xml
>> > > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/pom.xml?rev=963508&r1=963507&r2=963508&view=diff
>> > > > ==============================================================================
>> > > > --- axis/axis2/java/core/trunk/modules/jaxws/pom.xml (original)
>> > > > +++ axis/axis2/java/core/trunk/modules/jaxws/pom.xml Mon Jul 12 22:16:54 2010
>> > > > @@ -1,5 +1,4 @@
>> > > > <?xml version="1.0" encoding="UTF-8"?>
>> > > > -
>> > > > <!-- > ~ Licensed to the Apache Software Foundation (ASF) under one
>> > > > ~ or more contributor license agreements. See the NOTICE file
>> > > > @@ -20,7 +19,7 @@
>> > > > -->
>> > > >
>> > > > <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> > > > - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
>> > > > + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
>> > > > <modelVersion>4.0.0</modelVersion>
>> > > > <parent>
>> > > > <groupId>org.apache.axis2</groupId>
>> > > > @@ -98,7 +97,25 @@
>> > > > <version>${version}</version>
>> > > > <scope>test</scope>
>> > > > </dependency>
>> > > > + <dependency>
>> > > > + <groupId>wsdl4j</groupId>
>> > > > + <artifactId>wsdl4j</artifactId>
>> > > > + </dependency>
>> > > > + <dependency>
>> > > > + <groupId>com.sun.xml.ws</groupId>
>> > > > + <artifactId>jaxws-tools</artifactId>
>> > > > + <version>2.1.3</version>
>> > > > + </dependency>
>> > > > + <!-- If we dont include tools.jar as dependency, maven throws NoClassDefFound on wsGen run -->
>> > > > + <dependency>
>> > > > + <groupId>java</groupId>
>> > > > + <artifactId>tools</artifactId>
>> > > > + <version>$version</version>
>> > > > + <scope>system</scope>
>> > > > + <systemPath>${JAVA_HOME}/lib/tools.jar</systemPath>
>> > > > + </dependency>
>> > > > </dependencies>
>> > > > +
>> > > > <build>
>> > > > <sourceDirectory>src</sourceDirectory>
>> > > > <testSourceDirectory>test</testSourceDirectory>
>> > > > @@ -203,34 +220,39 @@
>> > > > <compilerVersion>1.5</compilerVersion>
>> > > > <source>1.5</source>
>> > > > <target>1.5</target>
>> > > > +
>> > > > </configuration>
>> > > > </plugin>
>> > > > <plugin>
>> > > > <groupId>org.apache.maven.plugins</groupId>
>> > > > <artifactId>maven-antrun-plugin</artifactId>
>> > > > +
>> > > > <executions>
>> > > > <execution>
>> > > > <id>gen-ts</id>
>> > > > <phase>generate-test-sources</phase>
>> > > > <configuration>
>> > > > - <tasks unless="maven.test.skip">
>> > > > + <tasks unless="maven.test.skip">
>> > > > <!-- Theres got to be a better way to do this -->
>> > > > <property name="schema.source.dir" value="test-resources/xsd"/>
>> > > > <property name="wsdl.source.dir" value="test-resources/wsdl"/>
>> > > > - <property name="schema.output.base.dir" value="target/schema"/>
>> > > > + <property name="schema.output.base.dir" value="target/schema"/>
>> > > > <property name="schema.generated.src.dir" value="${schema.output.base.dir}/src"/>
>> > > > <property name="schema.generated.classes.dir"
>> > > > value="${schema.output.base.dir}/classes"/>
>> > > > +
>> > > > <!-- make the dirs -->
>> > > > <mkdir dir="${schema.output.base.dir}"/>
>> > > > <mkdir dir="${schema.generated.src.dir}"/>
>> > > > <mkdir dir="${schema.generated.classes.dir}"/>
>> > > > +
>> > > > <!-- Run JAXB schema compiler with designated schemas -->
>> > > > <echo>Generating JAX-B classes from XSDs</echo>
>> > > >
>> > > > <echo>Generating java from echo.xsd</echo>
>> > > > <java classname="com.sun.tools.xjc.Driver" fork="true">
>> > > > <classpath refid="maven.runtime.classpath"/>
>> > > > +
>> > > > <classpath location="${compiled.classes.dir}"/>
>> > > > <arg line="-d ${schema.generated.src.dir} -quiet ${schema.source.dir}/echo.xsd"/>
>> > > > </java>
>> > > > @@ -266,7 +288,7 @@
>> > > > <classpath refid="maven.runtime.classpath"/>
>> > > > <classpath location="${compiled.classes.dir}"/>
>> > > > <arg line="-d ${schema.generated.src.dir} -quiet -wsdl ${wsdl.source.dir}/AddNumbers.wsdl"/>
>> > > > - </java>
>> > > > + </java>
>> > > > </tasks>
>> > > > </configuration>
>> > > > <goals>
>> > > > @@ -287,6 +309,22 @@
>> > > > <property name="addressing_version" value="${version}"/>
>> > > > <ant antfile="build.xml" inheritall="true" inheritrefs="true"
>> > > > dir="." target="build-repo"/>
>> > > > +
>> > > > + <property name="compile_classpath" refid="maven.compile.classpath" />
>> > > > + <property name="runtime_classpath" refid="maven.runtime.classpath" />
>> > > > + <property name="test_classpath" refid="maven.test.classpath" />
>> > > > + <property name="plugin_classpath" refid="maven.plugin.classpath" />
>> > > > +
>> > > > + <!-- Defining wsGen task -->
>> > > > + <taskdef name="wsgen" loaderRef="refwsgen" classname="com.sun.tools.ws.ant.WsGen">
>> > > > + <classpath>
>> > > > + <path refid="maven.runtime.classpath" />
>> > > > + <path refid="maven.compile.classpath" />
>> > > > + </classpath>
>> > > > + </taskdef>
>> > > > + <!-- Invoking test cases that need to generate artifacts using wsGen -->
>> > > > + <ant antfile="wsgen-tests.xml" inheritall="true" inheritrefs="true"
>> > > > + dir="." target="run-wsgen-tests"/>
>> > > > </tasks>
>> > > > </configuration>
>> > > > <goals>
>> > > > @@ -374,6 +412,13 @@
>> > > > <plugin>
>> > > > <groupId>org.apache.maven.plugins</groupId>
>> > > > <artifactId>maven-surefire-report-plugin</artifactId>
>> > > > + <reportSets>
>> > > > + <reportSet>
>> > > > + <reports>
>> > > > + <report>report-only</report>
>> > > > + </reports>
>> > > > + </reportSet>
>> > > > + </reportSets>
>> > > > </plugin>
>> > > > </plugins>
>> > > > </reporting>
>> > > >
>> > > > Modified: axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
>> > > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java?rev=963508&r1=963507&r2=963508&view=diff
>> > > > ==============================================================================
>> > > > --- axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java (original)
>> > > > +++ axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java Mon Jul 12 22:16:54 2010
>> > > > @@ -238,12 +238,27 @@ class ArtifactProcessor {
>> > > > wrapperClass = newValue;
>> > > > }
>> > > > }
>> > > > - if(cls==null && (type.equals("@WebFault")|| type.equals("faultInfo"))){
>> > > > +
>> > > > + if(cls==null &&
>> > > > + (type.equals("@RequestWrapper")|| type.equals("@ResponseWrapper")||type.equals("@WebFault")|| type.equals("faultInfo"))){
>> > > > +
>> > > > + //Support for Fault Bean Generation
>> > > > //As per JAX-WS 2.2 Specification section 3.7 an application programmer can choose not to
>> > > > //package the faultBeans, if we have reached this point in the code then user has choosen
>> > > > //not to package the fault bean. If there is a cache of generated artifacts available then
>> > > > //lets look for the missing faultBean there.
>> > > > -
>> > > > +
>> > > > + //Support for Wrapper Bean Generation
>> > > > + //As per JAX-WS 2.2 Specificaiton section 3.6.2.1 pg 41 an application programmer does not use
>> > > > + //the wrapper bean classes, so the application need not package these classes. If we have reached
>> > > > + //this point in the code then user has choosen not to package these beans.
>> > > > +
>> > > > + //NOTE:If we find Generated artifacts from cache this guarantees that we will not use
>> > > > + //DocLitWrappedMinimum marshaller code. The advantage of normal DocLitWrappedMarshaller is
>> > > > + //that it is very robust and has support of lot more datatypes than in DocLitWrappedMinimum.
>> > > > + if(log.isDebugEnabled()){
>> > > > + log.debug("Adding cache to classpath");
>> > > > + }
>> > > > ClassFinderFactory cff =
>> > > > (ClassFinderFactory)FactoryRegistry.getFactory(ClassFinderFactory.class);
>> > > > ClassFinder cf = cff.getClassFinder();
>> > > > @@ -317,11 +332,26 @@ class ArtifactProcessor {
>> > > > if (cls2 == null) {
>> > > > cls2 = loadClassOrNull(defaultValue, altClassLoader);
>> > > > }
>> > > > - if(cls2==null && (type.equals("faultInfo")|| type.equals("@WebFault"))){
>> > > > - //As per JAX-WS 2.2 Specification section 3.7 an application programmer can choose not to
>> > > > - //package the faultBeans, if we have reached this point in the code then user has choosen
>> > > > - //not to package the fault bean. If there is a cache of generated artifacts available then
>> > > > - //lets look for the missing faultBean there.
>> > > > + if(cls2==null &&
>> > > > + (type.equals("@RequestWrapper")|| type.equals("@ResponseWrapper")||type.equals("@WebFault")|| type.equals("faultInfo"))){
>> > > > +
>> > > > + //Support for Fault Bean Generation
>> > > > + //As per JAX-WS 2.2 Specification section 3.7 an application programmer can choose not to
>> > > > + //package the faultBeans, if we have reached this point in the code then user has choosen
>> > > > + //not to package the fault bean. If there is a cache of generated artifacts available then
>> > > > + //lets look for the missing faultBean there.
>> > > > +
>> > > > + //Support for Wrapper Bean Generation
>> > > > + //As per JAX-WS 2.2 Specificaiton section 3.6.2.1 pg 41 an application programmer does not use
>> > > > + //the wrapper bean classes, so the application need not package these classes. If we have reached
>> > > > + //this point in the code then user has choosen not to package these beans.
>> > > > +
>> > > > + //NOTE:If we find Generated artifacts from cache this guarantees that we will not use
>> > > > + //DocLitWrappedMinimum marshaller code. The advantage of normal DocLitWrappedMarshaller is
>> > > > + //that it is very robust and has support of lot more datatypes than in DocLitWrappedMinimum.
>> > > > + if(log.isDebugEnabled()){
>> > > > + log.debug("Adding cache to classpath");
>> > > > + }
>> > > > if(log.isDebugEnabled()){
>> > > > log.debug("Adding cache to classpath");
>> > > > }
>> > > >
>> > > > Added: axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
>> > > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java?rev=963508&view=auto
>> > > > ==============================================================================
>> > > > --- axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java (added)
>> > > > +++ axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java Mon Jul 12 22:16:54 2010
>> > > > @@ -0,0 +1,18 @@
>> > > > +
>> > > > +package org.apache.axis2.jaxws.wrapper.beans;
>> > > > +
>> > > > +import javax.xml.ws.WebFault;
>> > > > +
>> > > > +@WebFault(name = "AddNumbersFault", targetNamespace = "http://org/test/addnumbers")
>> > > > +public class AddNumbersException extends Exception
>> > > > +{
>> > > > +
>> > > > + private String message = null;
>> > > > + public AddNumbersException(){}
>> > > > + public AddNumbersException(String message){
>> > > > + this.message = message;
>> > > > + }
>> > > > + public String getInfo(){
>> > > > + return message;
>> > > > + }
>> > > > +}
>> > > >
>> > > > Added: axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
>> > > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java?rev=963508&view=auto
>> > > > ==============================================================================
>> > > > --- axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java (added)
>> > > > +++ axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java Mon Jul 12 22:16:54 2010
>> > > > @@ -0,0 +1,15 @@
>> > > > +package org.apache.axis2.jaxws.wrapper.beans;
>> > > > +
>> > > > +
>> > > > +
>> > > > +@javax.jws.WebService (targetNamespace="http://org/test/addnumbers", serviceName="AddNumbersService", portName="AddNumbersPort")
>> > > > +public class AddNumbersService{
>> > > > +
>> > > > + public int addNumbers(int arg0, int arg1) throws AddNumbersException {
>> > > > + if(arg0+arg1<0){
>> > > > + throw new AddNumbersException("sum is less than 0");
>> > > > + }
>> > > > + return arg0+arg1;
>> > > > + }
>> > > > +
>> > > > +}
>> > > > \ No newline at end of file
>> > > >
>> > > > Added: axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
>> > > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java?rev=963508&view=auto
>> > > > ==============================================================================
>> > > > --- axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java (added)
>> > > > +++ axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java Mon Jul 12 22:16:54 2010
>> > > > @@ -0,0 +1,114 @@
>> > > > +/**
>> > > > + *
>> > > > + */
>> > > > +package org.apache.axis2.jaxws.wrapper.beans;
>> > > > +
>> > > > +
>> > > > +import org.apache.axis2.jaxws.Constants;
>> > > > +import org.apache.axis2.jaxws.description.DescriptionFactory;
>> > > > +import org.apache.axis2.jaxws.description.EndpointDescription;
>> > > > +import org.apache.axis2.jaxws.description.EndpointDescriptionJava;
>> > > > +import org.apache.axis2.jaxws.description.OperationDescription;
>> > > > +import org.apache.axis2.jaxws.description.ServiceDescription;
>> > > > +import org.apache.axis2.jaxws.marshaller.MethodMarshaller;
>> > > > +import org.apache.axis2.jaxws.marshaller.factory.MethodMarshallerFactory;
>> > > > +import org.apache.axis2.jaxws.marshaller.impl.alt.DocLitWrappedMinimalMethodMarshaller;
>> > > > +import org.apache.axis2.jaxws.unitTest.TestLogger;
>> > > > +
>> > > > +import java.io.File;
>> > > > +
>> > > > +import junit.framework.TestCase;
>> > > > +
>> > > > +public class WrapperBeanMarshallTests extends TestCase {
>> > > > + /**
>> > > > + * This is the negative test case, when we do not use generated artifacts from cache
>> > > > + * and user did not package wrapper beans, we should see use of DocLitWrappedMinumumMarshaller.
>> > > > + */
>> > > > + public void testGetMarshallerOperationDescriptionBooleanNegative() {
>> > > > + TestLogger.logger.debug("---------------------------------------");
>> > > > + TestLogger.logger.debug("test: " + getName());
>> > > > +
>> > > > + String cache_location = "/target/wscache/classes";
>> > > > + try{
>> > > > + String baseDir = new File(System.getProperty("basedir",".")).getCanonicalPath();
>> > > > + cache_location = new File(baseDir+cache_location).getAbsolutePath();
>> > > > + TestLogger.logger.debug("cache location ="+cache_location);
>> > > > +
>> > > > + //Get EndpointDescription.
>> > > > + //Set location on AxisConfiguraiton.
>> > > > + Class sei = AddNumbersService.class;
>> > > > + EndpointDescription description = getEndpointDesc(sei);
>> > > > + TestLogger.logger.debug("description objects where created successfully");
>> > > > + OperationDescription[] ops =description.getEndpointInterfaceDescription().getOperations();
>> > > > + assertNotNull( "OperationDescriptions where null", ops);
>> > > > + assertTrue("No Operation Descriptions where found", ops.length>0);
>> > > > + OperationDescription op = ops[0];
>> > > > + TestLogger.logger.debug("operation found, java methodName="+op.getJavaMethodName());
>> > > > + //Don not Set cache on AxisConfiguration.
>> > > > + //get Marshaller, verify its not DoclitWrappedMinimum.
>> > > > + TestLogger.logger.debug("ws_cache location NOT set on AxisConfigContext, location="+cache_location);
>> > > > + MethodMarshaller mm = MethodMarshallerFactory.getMarshaller(op, false);
>> > > > + assertNotNull("getMarshaller returned null", mm );
>> > > > + TestLogger.logger.debug("MethodMarshaller was created, type="+mm.getClass().getName());
>> > > > + assertTrue("Generated artifacts not found, Method marshaller should be DocLitWrappedMinimumMarshaller", (mm instanceof DocLitWrappedMinimalMethodMarshaller));
>> > > > + }catch(Exception e){
>> > > > + TestLogger.logger.debug("Exception ="+e.getMessage());
>> > > > + fail(e.getMessage());
>> > > > + }
>> > > > +
>> > > > + }
>> > > > + /**
>> > > > + * In this test case user did not package wrapper beans but we add generated artifacts from cache, we should see use of
>> > > > + * DocLitWrappedMarshaller.
>> > > > + * Test method for {@link org.apache.axis2.jaxws.marshaller.factory.MethodMarshallerFactory#getMarshaller(org.apache.axis2.jaxws.description.OperationDescription, boolean)}.
>> > > > + */
>> > > > + public void testGetMarshallerOperationDescriptionBoolean() {
>> > > > + TestLogger.logger.debug("---------------------------------------");
>> > > > + TestLogger.logger.debug("test: " + getName());
>> > > > +
>> > > > + String cache_location = "/target/wscache/classes";
>> > > > + try{
>> > > > + String baseDir = new File(System.getProperty("basedir",".")).getCanonicalPath();
>> > > > + cache_location = new File(baseDir+cache_location).getAbsolutePath();
>> > > > + TestLogger.logger.debug("cache location ="+cache_location);
>> > > > +
>> > > > + //Get EndpointDescription.
>> > > > + //Set location on AxisConfiguraiton.
>> > > > + Class sei = AddNumbersService.class;
>> > > > + EndpointDescription description = getEndpointDesc(sei);
>> > > > + TestLogger.logger.debug("description objects where created successfully");
>> > > > + OperationDescription[] ops =description.getEndpointInterfaceDescription().getOperations();
>> > > > + assertNotNull( "OperationDescriptions where null", ops);
>> > > > + assertTrue("No Operation Descriptions where found", ops.length>0);
>> > > > + OperationDescription op = ops[0];
>> > > > + TestLogger.logger.debug("operation found, java methodName="+op.getJavaMethodName());
>> > > > + //Set cache on AxisConfiguration.
>> > > > + //get Marshaller, verify its not DoclitWrappedMinimum.
>> > > > + description.getServiceDescription().getAxisConfigContext().setProperty(Constants.WS_CACHE, cache_location);
>> > > > + TestLogger.logger.debug("ws_cache location set on AxisConfigContext, location="+cache_location);
>> > > > + MethodMarshaller mm = MethodMarshallerFactory.getMarshaller(op, false);
>> > > > + assertNotNull("getMarshaller returned null", mm );
>> > > > + TestLogger.logger.debug("MethodMarshaller was created, type="+mm.getClass().getName());
>> > > > + assertTrue("Generated artifacts are in cache, Method marshaller should not be DocLitWrappedMinimumMarshaller", !(mm instanceof DocLitWrappedMinimalMethodMarshaller));
>> > > > + }catch(Exception e){
>> > > > + TestLogger.logger.debug("Exception ="+e.getMessage());
>> > > > + fail(e.getMessage());
>> > > > + }
>> > > > +
>> > > > + }
>> > > > +
>> > > > + private EndpointDescription getEndpointDesc(Class implementationClass) {
>> > > > + // Use the description factory directly; this will be done within the JAX-WS runtime
>> > > > + ServiceDescription serviceDesc =
>> > > > + DescriptionFactory.createServiceDescription(implementationClass);
>> > > > + assertNotNull(serviceDesc);
>> > > > +
>> > > > + EndpointDescription[] endpointDesc = serviceDesc.getEndpointDescriptions();
>> > > > + assertNotNull(endpointDesc);
>> > > > + assertEquals(1, endpointDesc.length);
>> > > > +
>> > > > + // TODO: How will the JAX-WS dispatcher get the appropriate port (i.e. endpoint)? Currently assumes [0]
>> > > > + EndpointDescription testEndpointDesc = endpointDesc[0];
>> > > > + return testEndpointDesc;
>> > > > + }
>> > > > +}
>> > > >
>> > > > Added: axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml
>> > > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml?rev=963508&view=auto
>> > > > ==============================================================================
>> > > > --- axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml (added)
>> > > > +++ axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml Mon Jul 12 22:16:54 2010
>> > > > @@ -0,0 +1,34 @@
>> > > > +<?xml version="1.0" encoding="UTF-8"?>
>> > > > +
>> > > > +<project basedir="." default="run-wsgen-tests" name="wsgen-tests">
>> > > > +
>> > > > + <property name="wscache.output.base.dir" value="target/wscache" />
>> > > > + <property name="wscache.generated.src.dir" value="${wscache.output.base.dir}/src" />
>> > > > + <property name="wscache.generated.classes.dir" value="${wscache.output.base.dir}/classes" />
>> > > > + <property name="compile.test.classes" value="target/test-classes" />
>> > > > +
>> > > > +
>> > > > + <target name="run-wsgen-tests" depends="wrapper-beans"/>
>> > > > +
>> > > > +
>> > > > + <target name="create-cache">
>> > > > + <mkdir dir="${wscache.output.base.dir}" />
>> > > > + <mkdir dir="${wscache.generated.src.dir}" />
>> > > > + <mkdir dir="${wscache.generated.classes.dir}" />
>> > > > + </target>
>> > > > +
>> > > > + <target name="wrapper-beans" depends="create-cache">
>> > > > + <echo>Generating artifacts for org.apache.axis2.jaxws.wrapper.beans.AddNumbersService </echo>
>> > > > + <wsgen
>> > > > + sei="org.apache.axis2.jaxws.wrapper.beans.AddNumbersService"
>> > > > + destdir="${wscache.generated.classes.dir}"
>> > > > + resourcedestdir="${wscache.generated.src.dir}"
>> > > > + keep="false"
>> > > > + verbose="false"
>> > > > + genwsdl="true">
>> > > > + <classpath>
>> > > > + <pathelement path="${compile.test.classes}" />
>> > > > + </classpath>
>> > > > + </wsgen>
>> > > > + </target>
>> > > > +</project>
>> > > > \ No newline at end of file
>> > > >
>> > > >
>> > > >
>> > >
>> > > ---------------------------------------------------------------------
>> > > To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
>> > > For additional commands, e-mail: java-dev-help@axis.apache.org
>> > >
>> > >
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
>> > For additional commands, e-mail: java-dev-help@axis.apache.org
>> >
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
>> For additional commands, e-mail: java-dev-help@axis.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-dev-help@axis.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org
Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws:
./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/
test/org/apache/axis2/jaxws/wrapper/ test/org/apache/axis2/jaxws/wrapper/beans/
Posted by Andreas Veithen <an...@gmail.com>.
Jarek, you got my point. There is of course no objection to add
jaxws-tools as a _test_ dependency. For the tools.jar dependency, I
don't know exactly how system dependencies behave with respect to
transitive dependencies, but anyway, if tools.jar is only required for
the ant task, it would be easier to add it to the classpath in the ant
script. The reason is that to add tools.jar as a Maven dependencies
requires defining several profiles. This is because on Mac OS X, there
is no tools.jar and all classes are always available from the system
classpath. Thus you need to have profiles that are activated when
building with a Sun or IBM JDK, but not on Mac OS X.
Andreas
On Thu, Jul 15, 2010 at 05:55, Jarek Gawor <jg...@gmail.com> wrote:
> Nikhil,
>
> I don't think there is an objection for adding jaxws-tools as a _test_
> dependency. So as long you add the jaxws-tools dependency with
> <scope>test</scope> there shouldn't be a problem.
>
> Jarek
>
> On Wed, Jul 14, 2010 at 10:40 PM, Nikhil V Thaker
> <ni...@us.ibm.com> wrote:
>>
>> Thanks Jarek for the suggestion.
>>
>> The fact that there is an objection to putting jaxws-tools.jar as a dependency would mean we cannot run wsGen. Unless I misunderstood Andreas comments. To me we should always have jaxws-tools as dependency to jaxws module, after all jaxws tools are prerequisite to jaxws runtime, a user of jaxws runtime has to run wsGen or wsImport to build webservices application.
>>
>> Anyways, I will look and see if there is an alternate way to add these test cases.
>>
>> Regards,
>>
>> Nikhil Thaker
>> office: 919 254 9964
>> nvthaker@us.ibm.com
>>
>>
>> Jarek Gawor <jg...@gmail.com>
>>
>> 07/14/2010 03:38 PM
>>
>> Please respond to
>> java-dev@axis.apache.org
>> To
>> java-dev@axis.apache.org
>> cc
>> Subject
>> Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws: ./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ test/org/apache/axis2/jaxws/wrapper/ test/org/apache/axis2/jaxws/wrapper/beans/
>>
>>
>>
>>
>> Just a couple of thoughts:
>>
>> 1) Since you already have wsgen-tests.xml ant script to run the wsgen
>> you could setup the appropriate classpath to the tools.jar or
>> classes.jar or whatever in it. You just might need to fork the ant
>> process.
>>
>> 2) I don't think it's that horrible to commit some generate code
>> especially if there isn't too much of it and the test case is
>> important. Besides, Axis2 already has some generated code checked it.
>>
>> Jarek
>>
>> On Wed, Jul 14, 2010 at 4:00 PM, Nikhil V Thaker
>> <ni...@us.ibm.com> wrote:
>> >
>> > Yes Andreas,
>> > I am running antrun plugin as the wsGen plugin has errors and is not fully matured, here's the URL that explains the issue I ran into http://jira.codehaus.org/browse/MNG-3586.
>> >
>> > So since I cannot run wsGen or cannot include generated artifacts I will just remove the test case. I will commit the changes soon.
>> >
>> > Regards,
>> >
>> > Nikhil Thaker
>> > office: 919 254 9964
>> > nvthaker@us.ibm.com
>> >
>> >
>> > Andreas Veithen <an...@gmail.com>
>> >
>> > 07/14/2010 02:48 PM
>> >
>> > Please respond to
>> > java-dev@axis.apache.org
>> > To
>> > java-dev@axis.apache.org
>> > cc
>> > Subject
>> > Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws: ./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ test/org/apache/axis2/jaxws/wrapper/ test/org/apache/axis2/jaxws/wrapper/beans/
>> >
>> >
>> >
>> >
>> > No, you are using the antrun plugin to execute the wsgen ant task.
>> > What I meant was to use a real Maven plugin (either the one from
>> > java.net or the one from CXF).
>> >
>> > -1 to commit any generated stuff into SVN.
>> >
>> > Andreas
>> >
>> > On Wed, Jul 14, 2010 at 21:42, Nikhil V Thaker
>> > <ni...@us.ibm.com> wrote:
>> > >
>> > > Andreas - I had to add the tools.jar bit because maven plugin for wsGen gave NoClassDef Found errors for classes packaged in tools.jar.
>> > >
>> > > Since this is causing a problem I will just package the generated artifacts and remove the wsGen dependency.
>> > >
>> > > Thanks,
>> > >
>> > > Nikhil Thaker
>> > > office: 919 254 9964
>> > > nvthaker@us.ibm.com
>> > >
>> > >
>> > > Andreas Veithen <an...@gmail.com>
>> > >
>> > > 07/14/2010 01:44 PM
>> > >
>> > > Please respond to
>> > > java-dev@axis.apache.org
>> > > To
>> > > java-dev@axis.apache.org
>> > > cc
>> > > Subject
>> > > Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws: ./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ test/org/apache/axis2/jaxws/wrapper/ test/org/apache/axis2/jaxws/wrapper/beans/
>> > >
>> > >
>> > >
>> > >
>> > > Nikhil,
>> > >
>> > > I have some issues with the tools and jaxws-tools dependencies
>> > > introduced by this change:
>> > >
>> > > * The change causes a build failure in Hudson. There will also be
>> > > additional issues with tools.jar, because the way to declare this as a
>> > > system dependency varies from one JDK to another. For example, I
>> > > remember that on Mac OS X, it is completely different than on other
>> > > JDKs.
>> > >
>> > > * I don't like the fact that jaxws-tools becomes a dependency of
>> > > axis2-jaxws in scope compile, because it looks like this is only
>> > > needed during the build and/or during the tests.
>> > >
>> > > I didn't review the change in detail, but wouldn't it be smarter to
>> > > use one of the existing Maven plugins to do the wsgen stuff? They will
>> > > take care of the tools.jar stuff as well.
>> > >
>> > > Andreas
>> > >
>> > > On Tue, Jul 13, 2010 at 00:16, <nt...@apache.org> wrote:
>> > > > Author: nthaker
>> > > > Date: Mon Jul 12 22:16:54 2010
>> > > > New Revision: 963508
>> > > >
>> > > > URL: http://svn.apache.org/viewvc?rev=963508&view=rev
>> > > > Log:
>> > > > AXIS2-4775
>> > > > This change ensures that we will use Request and Response wrapper Bean packaged by customer or we will Generate Wrappers if they are not packaged.
>> > > >
>> > > > Added:
>> > > > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/
>> > > > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/
>> > > > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
>> > > > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
>> > > > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
>> > > > axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml
>> > > > Modified:
>> > > > axis/axis2/java/core/trunk/modules/jaxws/pom.xml
>> > > > axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
>> > > >
>> > > > Modified: axis/axis2/java/core/trunk/modules/jaxws/pom.xml
>> > > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/pom.xml?rev=963508&r1=963507&r2=963508&view=diff
>> > > > ==============================================================================
>> > > > --- axis/axis2/java/core/trunk/modules/jaxws/pom.xml (original)
>> > > > +++ axis/axis2/java/core/trunk/modules/jaxws/pom.xml Mon Jul 12 22:16:54 2010
>> > > > @@ -1,5 +1,4 @@
>> > > > <?xml version="1.0" encoding="UTF-8"?>
>> > > > -
>> > > > <!-- > ~ Licensed to the Apache Software Foundation (ASF) under one
>> > > > ~ or more contributor license agreements. See the NOTICE file
>> > > > @@ -20,7 +19,7 @@
>> > > > -->
>> > > >
>> > > > <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> > > > - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
>> > > > + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
>> > > > <modelVersion>4.0.0</modelVersion>
>> > > > <parent>
>> > > > <groupId>org.apache.axis2</groupId>
>> > > > @@ -98,7 +97,25 @@
>> > > > <version>${version}</version>
>> > > > <scope>test</scope>
>> > > > </dependency>
>> > > > + <dependency>
>> > > > + <groupId>wsdl4j</groupId>
>> > > > + <artifactId>wsdl4j</artifactId>
>> > > > + </dependency>
>> > > > + <dependency>
>> > > > + <groupId>com.sun.xml.ws</groupId>
>> > > > + <artifactId>jaxws-tools</artifactId>
>> > > > + <version>2.1.3</version>
>> > > > + </dependency>
>> > > > + <!-- If we dont include tools.jar as dependency, maven throws NoClassDefFound on wsGen run -->
>> > > > + <dependency>
>> > > > + <groupId>java</groupId>
>> > > > + <artifactId>tools</artifactId>
>> > > > + <version>$version</version>
>> > > > + <scope>system</scope>
>> > > > + <systemPath>${JAVA_HOME}/lib/tools.jar</systemPath>
>> > > > + </dependency>
>> > > > </dependencies>
>> > > > +
>> > > > <build>
>> > > > <sourceDirectory>src</sourceDirectory>
>> > > > <testSourceDirectory>test</testSourceDirectory>
>> > > > @@ -203,34 +220,39 @@
>> > > > <compilerVersion>1.5</compilerVersion>
>> > > > <source>1.5</source>
>> > > > <target>1.5</target>
>> > > > +
>> > > > </configuration>
>> > > > </plugin>
>> > > > <plugin>
>> > > > <groupId>org.apache.maven.plugins</groupId>
>> > > > <artifactId>maven-antrun-plugin</artifactId>
>> > > > +
>> > > > <executions>
>> > > > <execution>
>> > > > <id>gen-ts</id>
>> > > > <phase>generate-test-sources</phase>
>> > > > <configuration>
>> > > > - <tasks unless="maven.test.skip">
>> > > > + <tasks unless="maven.test.skip">
>> > > > <!-- Theres got to be a better way to do this -->
>> > > > <property name="schema.source.dir" value="test-resources/xsd"/>
>> > > > <property name="wsdl.source.dir" value="test-resources/wsdl"/>
>> > > > - <property name="schema.output.base.dir" value="target/schema"/>
>> > > > + <property name="schema.output.base.dir" value="target/schema"/>
>> > > > <property name="schema.generated.src.dir" value="${schema.output.base.dir}/src"/>
>> > > > <property name="schema.generated.classes.dir"
>> > > > value="${schema.output.base.dir}/classes"/>
>> > > > +
>> > > > <!-- make the dirs -->
>> > > > <mkdir dir="${schema.output.base.dir}"/>
>> > > > <mkdir dir="${schema.generated.src.dir}"/>
>> > > > <mkdir dir="${schema.generated.classes.dir}"/>
>> > > > +
>> > > > <!-- Run JAXB schema compiler with designated schemas -->
>> > > > <echo>Generating JAX-B classes from XSDs</echo>
>> > > >
>> > > > <echo>Generating java from echo.xsd</echo>
>> > > > <java classname="com.sun.tools.xjc.Driver" fork="true">
>> > > > <classpath refid="maven.runtime.classpath"/>
>> > > > +
>> > > > <classpath location="${compiled.classes.dir}"/>
>> > > > <arg line="-d ${schema.generated.src.dir} -quiet ${schema.source.dir}/echo.xsd"/>
>> > > > </java>
>> > > > @@ -266,7 +288,7 @@
>> > > > <classpath refid="maven.runtime.classpath"/>
>> > > > <classpath location="${compiled.classes.dir}"/>
>> > > > <arg line="-d ${schema.generated.src.dir} -quiet -wsdl ${wsdl.source.dir}/AddNumbers.wsdl"/>
>> > > > - </java>
>> > > > + </java>
>> > > > </tasks>
>> > > > </configuration>
>> > > > <goals>
>> > > > @@ -287,6 +309,22 @@
>> > > > <property name="addressing_version" value="${version}"/>
>> > > > <ant antfile="build.xml" inheritall="true" inheritrefs="true"
>> > > > dir="." target="build-repo"/>
>> > > > +
>> > > > + <property name="compile_classpath" refid="maven.compile.classpath" />
>> > > > + <property name="runtime_classpath" refid="maven.runtime.classpath" />
>> > > > + <property name="test_classpath" refid="maven.test.classpath" />
>> > > > + <property name="plugin_classpath" refid="maven.plugin.classpath" />
>> > > > +
>> > > > + <!-- Defining wsGen task -->
>> > > > + <taskdef name="wsgen" loaderRef="refwsgen" classname="com.sun.tools.ws.ant.WsGen">
>> > > > + <classpath>
>> > > > + <path refid="maven.runtime.classpath" />
>> > > > + <path refid="maven.compile.classpath" />
>> > > > + </classpath>
>> > > > + </taskdef>
>> > > > + <!-- Invoking test cases that need to generate artifacts using wsGen -->
>> > > > + <ant antfile="wsgen-tests.xml" inheritall="true" inheritrefs="true"
>> > > > + dir="." target="run-wsgen-tests"/>
>> > > > </tasks>
>> > > > </configuration>
>> > > > <goals>
>> > > > @@ -374,6 +412,13 @@
>> > > > <plugin>
>> > > > <groupId>org.apache.maven.plugins</groupId>
>> > > > <artifactId>maven-surefire-report-plugin</artifactId>
>> > > > + <reportSets>
>> > > > + <reportSet>
>> > > > + <reports>
>> > > > + <report>report-only</report>
>> > > > + </reports>
>> > > > + </reportSet>
>> > > > + </reportSets>
>> > > > </plugin>
>> > > > </plugins>
>> > > > </reporting>
>> > > >
>> > > > Modified: axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
>> > > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java?rev=963508&r1=963507&r2=963508&view=diff
>> > > > ==============================================================================
>> > > > --- axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java (original)
>> > > > +++ axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java Mon Jul 12 22:16:54 2010
>> > > > @@ -238,12 +238,27 @@ class ArtifactProcessor {
>> > > > wrapperClass = newValue;
>> > > > }
>> > > > }
>> > > > - if(cls==null && (type.equals("@WebFault")|| type.equals("faultInfo"))){
>> > > > +
>> > > > + if(cls==null &&
>> > > > + (type.equals("@RequestWrapper")|| type.equals("@ResponseWrapper")||type.equals("@WebFault")|| type.equals("faultInfo"))){
>> > > > +
>> > > > + //Support for Fault Bean Generation
>> > > > //As per JAX-WS 2.2 Specification section 3.7 an application programmer can choose not to
>> > > > //package the faultBeans, if we have reached this point in the code then user has choosen
>> > > > //not to package the fault bean. If there is a cache of generated artifacts available then
>> > > > //lets look for the missing faultBean there.
>> > > > -
>> > > > +
>> > > > + //Support for Wrapper Bean Generation
>> > > > + //As per JAX-WS 2.2 Specificaiton section 3.6.2.1 pg 41 an application programmer does not use
>> > > > + //the wrapper bean classes, so the application need not package these classes. If we have reached
>> > > > + //this point in the code then user has choosen not to package these beans.
>> > > > +
>> > > > + //NOTE:If we find Generated artifacts from cache this guarantees that we will not use
>> > > > + //DocLitWrappedMinimum marshaller code. The advantage of normal DocLitWrappedMarshaller is
>> > > > + //that it is very robust and has support of lot more datatypes than in DocLitWrappedMinimum.
>> > > > + if(log.isDebugEnabled()){
>> > > > + log.debug("Adding cache to classpath");
>> > > > + }
>> > > > ClassFinderFactory cff =
>> > > > (ClassFinderFactory)FactoryRegistry.getFactory(ClassFinderFactory.class);
>> > > > ClassFinder cf = cff.getClassFinder();
>> > > > @@ -317,11 +332,26 @@ class ArtifactProcessor {
>> > > > if (cls2 == null) {
>> > > > cls2 = loadClassOrNull(defaultValue, altClassLoader);
>> > > > }
>> > > > - if(cls2==null && (type.equals("faultInfo")|| type.equals("@WebFault"))){
>> > > > - //As per JAX-WS 2.2 Specification section 3.7 an application programmer can choose not to
>> > > > - //package the faultBeans, if we have reached this point in the code then user has choosen
>> > > > - //not to package the fault bean. If there is a cache of generated artifacts available then
>> > > > - //lets look for the missing faultBean there.
>> > > > + if(cls2==null &&
>> > > > + (type.equals("@RequestWrapper")|| type.equals("@ResponseWrapper")||type.equals("@WebFault")|| type.equals("faultInfo"))){
>> > > > +
>> > > > + //Support for Fault Bean Generation
>> > > > + //As per JAX-WS 2.2 Specification section 3.7 an application programmer can choose not to
>> > > > + //package the faultBeans, if we have reached this point in the code then user has choosen
>> > > > + //not to package the fault bean. If there is a cache of generated artifacts available then
>> > > > + //lets look for the missing faultBean there.
>> > > > +
>> > > > + //Support for Wrapper Bean Generation
>> > > > + //As per JAX-WS 2.2 Specificaiton section 3.6.2.1 pg 41 an application programmer does not use
>> > > > + //the wrapper bean classes, so the application need not package these classes. If we have reached
>> > > > + //this point in the code then user has choosen not to package these beans.
>> > > > +
>> > > > + //NOTE:If we find Generated artifacts from cache this guarantees that we will not use
>> > > > + //DocLitWrappedMinimum marshaller code. The advantage of normal DocLitWrappedMarshaller is
>> > > > + //that it is very robust and has support of lot more datatypes than in DocLitWrappedMinimum.
>> > > > + if(log.isDebugEnabled()){
>> > > > + log.debug("Adding cache to classpath");
>> > > > + }
>> > > > if(log.isDebugEnabled()){
>> > > > log.debug("Adding cache to classpath");
>> > > > }
>> > > >
>> > > > Added: axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
>> > > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java?rev=963508&view=auto
>> > > > ==============================================================================
>> > > > --- axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java (added)
>> > > > +++ axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java Mon Jul 12 22:16:54 2010
>> > > > @@ -0,0 +1,18 @@
>> > > > +
>> > > > +package org.apache.axis2.jaxws.wrapper.beans;
>> > > > +
>> > > > +import javax.xml.ws.WebFault;
>> > > > +
>> > > > +@WebFault(name = "AddNumbersFault", targetNamespace = "http://org/test/addnumbers")
>> > > > +public class AddNumbersException extends Exception
>> > > > +{
>> > > > +
>> > > > + private String message = null;
>> > > > + public AddNumbersException(){}
>> > > > + public AddNumbersException(String message){
>> > > > + this.message = message;
>> > > > + }
>> > > > + public String getInfo(){
>> > > > + return message;
>> > > > + }
>> > > > +}
>> > > >
>> > > > Added: axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
>> > > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java?rev=963508&view=auto
>> > > > ==============================================================================
>> > > > --- axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java (added)
>> > > > +++ axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java Mon Jul 12 22:16:54 2010
>> > > > @@ -0,0 +1,15 @@
>> > > > +package org.apache.axis2.jaxws.wrapper.beans;
>> > > > +
>> > > > +
>> > > > +
>> > > > +@javax.jws.WebService (targetNamespace="http://org/test/addnumbers", serviceName="AddNumbersService", portName="AddNumbersPort")
>> > > > +public class AddNumbersService{
>> > > > +
>> > > > + public int addNumbers(int arg0, int arg1) throws AddNumbersException {
>> > > > + if(arg0+arg1<0){
>> > > > + throw new AddNumbersException("sum is less than 0");
>> > > > + }
>> > > > + return arg0+arg1;
>> > > > + }
>> > > > +
>> > > > +}
>> > > > \ No newline at end of file
>> > > >
>> > > > Added: axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
>> > > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java?rev=963508&view=auto
>> > > > ==============================================================================
>> > > > --- axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java (added)
>> > > > +++ axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java Mon Jul 12 22:16:54 2010
>> > > > @@ -0,0 +1,114 @@
>> > > > +/**
>> > > > + *
>> > > > + */
>> > > > +package org.apache.axis2.jaxws.wrapper.beans;
>> > > > +
>> > > > +
>> > > > +import org.apache.axis2.jaxws.Constants;
>> > > > +import org.apache.axis2.jaxws.description.DescriptionFactory;
>> > > > +import org.apache.axis2.jaxws.description.EndpointDescription;
>> > > > +import org.apache.axis2.jaxws.description.EndpointDescriptionJava;
>> > > > +import org.apache.axis2.jaxws.description.OperationDescription;
>> > > > +import org.apache.axis2.jaxws.description.ServiceDescription;
>> > > > +import org.apache.axis2.jaxws.marshaller.MethodMarshaller;
>> > > > +import org.apache.axis2.jaxws.marshaller.factory.MethodMarshallerFactory;
>> > > > +import org.apache.axis2.jaxws.marshaller.impl.alt.DocLitWrappedMinimalMethodMarshaller;
>> > > > +import org.apache.axis2.jaxws.unitTest.TestLogger;
>> > > > +
>> > > > +import java.io.File;
>> > > > +
>> > > > +import junit.framework.TestCase;
>> > > > +
>> > > > +public class WrapperBeanMarshallTests extends TestCase {
>> > > > + /**
>> > > > + * This is the negative test case, when we do not use generated artifacts from cache
>> > > > + * and user did not package wrapper beans, we should see use of DocLitWrappedMinumumMarshaller.
>> > > > + */
>> > > > + public void testGetMarshallerOperationDescriptionBooleanNegative() {
>> > > > + TestLogger.logger.debug("---------------------------------------");
>> > > > + TestLogger.logger.debug("test: " + getName());
>> > > > +
>> > > > + String cache_location = "/target/wscache/classes";
>> > > > + try{
>> > > > + String baseDir = new File(System.getProperty("basedir",".")).getCanonicalPath();
>> > > > + cache_location = new File(baseDir+cache_location).getAbsolutePath();
>> > > > + TestLogger.logger.debug("cache location ="+cache_location);
>> > > > +
>> > > > + //Get EndpointDescription.
>> > > > + //Set location on AxisConfiguraiton.
>> > > > + Class sei = AddNumbersService.class;
>> > > > + EndpointDescription description = getEndpointDesc(sei);
>> > > > + TestLogger.logger.debug("description objects where created successfully");
>> > > > + OperationDescription[] ops =description.getEndpointInterfaceDescription().getOperations();
>> > > > + assertNotNull( "OperationDescriptions where null", ops);
>> > > > + assertTrue("No Operation Descriptions where found", ops.length>0);
>> > > > + OperationDescription op = ops[0];
>> > > > + TestLogger.logger.debug("operation found, java methodName="+op.getJavaMethodName());
>> > > > + //Don not Set cache on AxisConfiguration.
>> > > > + //get Marshaller, verify its not DoclitWrappedMinimum.
>> > > > + TestLogger.logger.debug("ws_cache location NOT set on AxisConfigContext, location="+cache_location);
>> > > > + MethodMarshaller mm = MethodMarshallerFactory.getMarshaller(op, false);
>> > > > + assertNotNull("getMarshaller returned null", mm );
>> > > > + TestLogger.logger.debug("MethodMarshaller was created, type="+mm.getClass().getName());
>> > > > + assertTrue("Generated artifacts not found, Method marshaller should be DocLitWrappedMinimumMarshaller", (mm instanceof DocLitWrappedMinimalMethodMarshaller));
>> > > > + }catch(Exception e){
>> > > > + TestLogger.logger.debug("Exception ="+e.getMessage());
>> > > > + fail(e.getMessage());
>> > > > + }
>> > > > +
>> > > > + }
>> > > > + /**
>> > > > + * In this test case user did not package wrapper beans but we add generated artifacts from cache, we should see use of
>> > > > + * DocLitWrappedMarshaller.
>> > > > + * Test method for {@link org.apache.axis2.jaxws.marshaller.factory.MethodMarshallerFactory#getMarshaller(org.apache.axis2.jaxws.description.OperationDescription, boolean)}.
>> > > > + */
>> > > > + public void testGetMarshallerOperationDescriptionBoolean() {
>> > > > + TestLogger.logger.debug("---------------------------------------");
>> > > > + TestLogger.logger.debug("test: " + getName());
>> > > > +
>> > > > + String cache_location = "/target/wscache/classes";
>> > > > + try{
>> > > > + String baseDir = new File(System.getProperty("basedir",".")).getCanonicalPath();
>> > > > + cache_location = new File(baseDir+cache_location).getAbsolutePath();
>> > > > + TestLogger.logger.debug("cache location ="+cache_location);
>> > > > +
>> > > > + //Get EndpointDescription.
>> > > > + //Set location on AxisConfiguraiton.
>> > > > + Class sei = AddNumbersService.class;
>> > > > + EndpointDescription description = getEndpointDesc(sei);
>> > > > + TestLogger.logger.debug("description objects where created successfully");
>> > > > + OperationDescription[] ops =description.getEndpointInterfaceDescription().getOperations();
>> > > > + assertNotNull( "OperationDescriptions where null", ops);
>> > > > + assertTrue("No Operation Descriptions where found", ops.length>0);
>> > > > + OperationDescription op = ops[0];
>> > > > + TestLogger.logger.debug("operation found, java methodName="+op.getJavaMethodName());
>> > > > + //Set cache on AxisConfiguration.
>> > > > + //get Marshaller, verify its not DoclitWrappedMinimum.
>> > > > + description.getServiceDescription().getAxisConfigContext().setProperty(Constants.WS_CACHE, cache_location);
>> > > > + TestLogger.logger.debug("ws_cache location set on AxisConfigContext, location="+cache_location);
>> > > > + MethodMarshaller mm = MethodMarshallerFactory.getMarshaller(op, false);
>> > > > + assertNotNull("getMarshaller returned null", mm );
>> > > > + TestLogger.logger.debug("MethodMarshaller was created, type="+mm.getClass().getName());
>> > > > + assertTrue("Generated artifacts are in cache, Method marshaller should not be DocLitWrappedMinimumMarshaller", !(mm instanceof DocLitWrappedMinimalMethodMarshaller));
>> > > > + }catch(Exception e){
>> > > > + TestLogger.logger.debug("Exception ="+e.getMessage());
>> > > > + fail(e.getMessage());
>> > > > + }
>> > > > +
>> > > > + }
>> > > > +
>> > > > + private EndpointDescription getEndpointDesc(Class implementationClass) {
>> > > > + // Use the description factory directly; this will be done within the JAX-WS runtime
>> > > > + ServiceDescription serviceDesc =
>> > > > + DescriptionFactory.createServiceDescription(implementationClass);
>> > > > + assertNotNull(serviceDesc);
>> > > > +
>> > > > + EndpointDescription[] endpointDesc = serviceDesc.getEndpointDescriptions();
>> > > > + assertNotNull(endpointDesc);
>> > > > + assertEquals(1, endpointDesc.length);
>> > > > +
>> > > > + // TODO: How will the JAX-WS dispatcher get the appropriate port (i.e. endpoint)? Currently assumes [0]
>> > > > + EndpointDescription testEndpointDesc = endpointDesc[0];
>> > > > + return testEndpointDesc;
>> > > > + }
>> > > > +}
>> > > >
>> > > > Added: axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml
>> > > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml?rev=963508&view=auto
>> > > > ==============================================================================
>> > > > --- axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml (added)
>> > > > +++ axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml Mon Jul 12 22:16:54 2010
>> > > > @@ -0,0 +1,34 @@
>> > > > +<?xml version="1.0" encoding="UTF-8"?>
>> > > > +
>> > > > +<project basedir="." default="run-wsgen-tests" name="wsgen-tests">
>> > > > +
>> > > > + <property name="wscache.output.base.dir" value="target/wscache" />
>> > > > + <property name="wscache.generated.src.dir" value="${wscache.output.base.dir}/src" />
>> > > > + <property name="wscache.generated.classes.dir" value="${wscache.output.base.dir}/classes" />
>> > > > + <property name="compile.test.classes" value="target/test-classes" />
>> > > > +
>> > > > +
>> > > > + <target name="run-wsgen-tests" depends="wrapper-beans"/>
>> > > > +
>> > > > +
>> > > > + <target name="create-cache">
>> > > > + <mkdir dir="${wscache.output.base.dir}" />
>> > > > + <mkdir dir="${wscache.generated.src.dir}" />
>> > > > + <mkdir dir="${wscache.generated.classes.dir}" />
>> > > > + </target>
>> > > > +
>> > > > + <target name="wrapper-beans" depends="create-cache">
>> > > > + <echo>Generating artifacts for org.apache.axis2.jaxws.wrapper.beans.AddNumbersService </echo>
>> > > > + <wsgen
>> > > > + sei="org.apache.axis2.jaxws.wrapper.beans.AddNumbersService"
>> > > > + destdir="${wscache.generated.classes.dir}"
>> > > > + resourcedestdir="${wscache.generated.src.dir}"
>> > > > + keep="false"
>> > > > + verbose="false"
>> > > > + genwsdl="true">
>> > > > + <classpath>
>> > > > + <pathelement path="${compile.test.classes}" />
>> > > > + </classpath>
>> > > > + </wsgen>
>> > > > + </target>
>> > > > +</project>
>> > > > \ No newline at end of file
>> > > >
>> > > >
>> > > >
>> > >
>> > > ---------------------------------------------------------------------
>> > > To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
>> > > For additional commands, e-mail: java-dev-help@axis.apache.org
>> > >
>> > >
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
>> > For additional commands, e-mail: java-dev-help@axis.apache.org
>> >
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
>> For additional commands, e-mail: java-dev-help@axis.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-dev-help@axis.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org
Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws:
./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/
test/org/apache/axis2/jaxws/wrapper/ test/org/apache/axis2/jaxws/wrapper/beans/
Posted by Andreas Veithen <an...@gmail.com>.
Jarek, you got my point. There is of course no objection to add
jaxws-tools as a _test_ dependency. For the tools.jar dependency, I
don't know exactly how system dependencies behave with respect to
transitive dependencies, but anyway, if tools.jar is only required for
the ant task, it would be easier to add it to the classpath in the ant
script. The reason is that to add tools.jar as a Maven dependencies
requires defining several profiles. This is because on Mac OS X, there
is no tools.jar and all classes are always available from the system
classpath. Thus you need to have profiles that are activated when
building with a Sun or IBM JDK, but not on Mac OS X.
Andreas
On Thu, Jul 15, 2010 at 05:55, Jarek Gawor <jg...@gmail.com> wrote:
> Nikhil,
>
> I don't think there is an objection for adding jaxws-tools as a _test_
> dependency. So as long you add the jaxws-tools dependency with
> <scope>test</scope> there shouldn't be a problem.
>
> Jarek
>
> On Wed, Jul 14, 2010 at 10:40 PM, Nikhil V Thaker
> <ni...@us.ibm.com> wrote:
>>
>> Thanks Jarek for the suggestion.
>>
>> The fact that there is an objection to putting jaxws-tools.jar as a dependency would mean we cannot run wsGen. Unless I misunderstood Andreas comments. To me we should always have jaxws-tools as dependency to jaxws module, after all jaxws tools are prerequisite to jaxws runtime, a user of jaxws runtime has to run wsGen or wsImport to build webservices application.
>>
>> Anyways, I will look and see if there is an alternate way to add these test cases.
>>
>> Regards,
>>
>> Nikhil Thaker
>> office: 919 254 9964
>> nvthaker@us.ibm.com
>>
>>
>> Jarek Gawor <jg...@gmail.com>
>>
>> 07/14/2010 03:38 PM
>>
>> Please respond to
>> java-dev@axis.apache.org
>> To
>> java-dev@axis.apache.org
>> cc
>> Subject
>> Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws: ./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ test/org/apache/axis2/jaxws/wrapper/ test/org/apache/axis2/jaxws/wrapper/beans/
>>
>>
>>
>>
>> Just a couple of thoughts:
>>
>> 1) Since you already have wsgen-tests.xml ant script to run the wsgen
>> you could setup the appropriate classpath to the tools.jar or
>> classes.jar or whatever in it. You just might need to fork the ant
>> process.
>>
>> 2) I don't think it's that horrible to commit some generate code
>> especially if there isn't too much of it and the test case is
>> important. Besides, Axis2 already has some generated code checked it.
>>
>> Jarek
>>
>> On Wed, Jul 14, 2010 at 4:00 PM, Nikhil V Thaker
>> <ni...@us.ibm.com> wrote:
>> >
>> > Yes Andreas,
>> > I am running antrun plugin as the wsGen plugin has errors and is not fully matured, here's the URL that explains the issue I ran into http://jira.codehaus.org/browse/MNG-3586.
>> >
>> > So since I cannot run wsGen or cannot include generated artifacts I will just remove the test case. I will commit the changes soon.
>> >
>> > Regards,
>> >
>> > Nikhil Thaker
>> > office: 919 254 9964
>> > nvthaker@us.ibm.com
>> >
>> >
>> > Andreas Veithen <an...@gmail.com>
>> >
>> > 07/14/2010 02:48 PM
>> >
>> > Please respond to
>> > java-dev@axis.apache.org
>> > To
>> > java-dev@axis.apache.org
>> > cc
>> > Subject
>> > Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws: ./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ test/org/apache/axis2/jaxws/wrapper/ test/org/apache/axis2/jaxws/wrapper/beans/
>> >
>> >
>> >
>> >
>> > No, you are using the antrun plugin to execute the wsgen ant task.
>> > What I meant was to use a real Maven plugin (either the one from
>> > java.net or the one from CXF).
>> >
>> > -1 to commit any generated stuff into SVN.
>> >
>> > Andreas
>> >
>> > On Wed, Jul 14, 2010 at 21:42, Nikhil V Thaker
>> > <ni...@us.ibm.com> wrote:
>> > >
>> > > Andreas - I had to add the tools.jar bit because maven plugin for wsGen gave NoClassDef Found errors for classes packaged in tools.jar.
>> > >
>> > > Since this is causing a problem I will just package the generated artifacts and remove the wsGen dependency.
>> > >
>> > > Thanks,
>> > >
>> > > Nikhil Thaker
>> > > office: 919 254 9964
>> > > nvthaker@us.ibm.com
>> > >
>> > >
>> > > Andreas Veithen <an...@gmail.com>
>> > >
>> > > 07/14/2010 01:44 PM
>> > >
>> > > Please respond to
>> > > java-dev@axis.apache.org
>> > > To
>> > > java-dev@axis.apache.org
>> > > cc
>> > > Subject
>> > > Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws: ./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ test/org/apache/axis2/jaxws/wrapper/ test/org/apache/axis2/jaxws/wrapper/beans/
>> > >
>> > >
>> > >
>> > >
>> > > Nikhil,
>> > >
>> > > I have some issues with the tools and jaxws-tools dependencies
>> > > introduced by this change:
>> > >
>> > > * The change causes a build failure in Hudson. There will also be
>> > > additional issues with tools.jar, because the way to declare this as a
>> > > system dependency varies from one JDK to another. For example, I
>> > > remember that on Mac OS X, it is completely different than on other
>> > > JDKs.
>> > >
>> > > * I don't like the fact that jaxws-tools becomes a dependency of
>> > > axis2-jaxws in scope compile, because it looks like this is only
>> > > needed during the build and/or during the tests.
>> > >
>> > > I didn't review the change in detail, but wouldn't it be smarter to
>> > > use one of the existing Maven plugins to do the wsgen stuff? They will
>> > > take care of the tools.jar stuff as well.
>> > >
>> > > Andreas
>> > >
>> > > On Tue, Jul 13, 2010 at 00:16, <nt...@apache.org> wrote:
>> > > > Author: nthaker
>> > > > Date: Mon Jul 12 22:16:54 2010
>> > > > New Revision: 963508
>> > > >
>> > > > URL: http://svn.apache.org/viewvc?rev=963508&view=rev
>> > > > Log:
>> > > > AXIS2-4775
>> > > > This change ensures that we will use Request and Response wrapper Bean packaged by customer or we will Generate Wrappers if they are not packaged.
>> > > >
>> > > > Added:
>> > > > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/
>> > > > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/
>> > > > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
>> > > > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
>> > > > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
>> > > > axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml
>> > > > Modified:
>> > > > axis/axis2/java/core/trunk/modules/jaxws/pom.xml
>> > > > axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
>> > > >
>> > > > Modified: axis/axis2/java/core/trunk/modules/jaxws/pom.xml
>> > > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/pom.xml?rev=963508&r1=963507&r2=963508&view=diff
>> > > > ==============================================================================
>> > > > --- axis/axis2/java/core/trunk/modules/jaxws/pom.xml (original)
>> > > > +++ axis/axis2/java/core/trunk/modules/jaxws/pom.xml Mon Jul 12 22:16:54 2010
>> > > > @@ -1,5 +1,4 @@
>> > > > <?xml version="1.0" encoding="UTF-8"?>
>> > > > -
>> > > > <!-- > ~ Licensed to the Apache Software Foundation (ASF) under one
>> > > > ~ or more contributor license agreements. See the NOTICE file
>> > > > @@ -20,7 +19,7 @@
>> > > > -->
>> > > >
>> > > > <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> > > > - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
>> > > > + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
>> > > > <modelVersion>4.0.0</modelVersion>
>> > > > <parent>
>> > > > <groupId>org.apache.axis2</groupId>
>> > > > @@ -98,7 +97,25 @@
>> > > > <version>${version}</version>
>> > > > <scope>test</scope>
>> > > > </dependency>
>> > > > + <dependency>
>> > > > + <groupId>wsdl4j</groupId>
>> > > > + <artifactId>wsdl4j</artifactId>
>> > > > + </dependency>
>> > > > + <dependency>
>> > > > + <groupId>com.sun.xml.ws</groupId>
>> > > > + <artifactId>jaxws-tools</artifactId>
>> > > > + <version>2.1.3</version>
>> > > > + </dependency>
>> > > > + <!-- If we dont include tools.jar as dependency, maven throws NoClassDefFound on wsGen run -->
>> > > > + <dependency>
>> > > > + <groupId>java</groupId>
>> > > > + <artifactId>tools</artifactId>
>> > > > + <version>$version</version>
>> > > > + <scope>system</scope>
>> > > > + <systemPath>${JAVA_HOME}/lib/tools.jar</systemPath>
>> > > > + </dependency>
>> > > > </dependencies>
>> > > > +
>> > > > <build>
>> > > > <sourceDirectory>src</sourceDirectory>
>> > > > <testSourceDirectory>test</testSourceDirectory>
>> > > > @@ -203,34 +220,39 @@
>> > > > <compilerVersion>1.5</compilerVersion>
>> > > > <source>1.5</source>
>> > > > <target>1.5</target>
>> > > > +
>> > > > </configuration>
>> > > > </plugin>
>> > > > <plugin>
>> > > > <groupId>org.apache.maven.plugins</groupId>
>> > > > <artifactId>maven-antrun-plugin</artifactId>
>> > > > +
>> > > > <executions>
>> > > > <execution>
>> > > > <id>gen-ts</id>
>> > > > <phase>generate-test-sources</phase>
>> > > > <configuration>
>> > > > - <tasks unless="maven.test.skip">
>> > > > + <tasks unless="maven.test.skip">
>> > > > <!-- Theres got to be a better way to do this -->
>> > > > <property name="schema.source.dir" value="test-resources/xsd"/>
>> > > > <property name="wsdl.source.dir" value="test-resources/wsdl"/>
>> > > > - <property name="schema.output.base.dir" value="target/schema"/>
>> > > > + <property name="schema.output.base.dir" value="target/schema"/>
>> > > > <property name="schema.generated.src.dir" value="${schema.output.base.dir}/src"/>
>> > > > <property name="schema.generated.classes.dir"
>> > > > value="${schema.output.base.dir}/classes"/>
>> > > > +
>> > > > <!-- make the dirs -->
>> > > > <mkdir dir="${schema.output.base.dir}"/>
>> > > > <mkdir dir="${schema.generated.src.dir}"/>
>> > > > <mkdir dir="${schema.generated.classes.dir}"/>
>> > > > +
>> > > > <!-- Run JAXB schema compiler with designated schemas -->
>> > > > <echo>Generating JAX-B classes from XSDs</echo>
>> > > >
>> > > > <echo>Generating java from echo.xsd</echo>
>> > > > <java classname="com.sun.tools.xjc.Driver" fork="true">
>> > > > <classpath refid="maven.runtime.classpath"/>
>> > > > +
>> > > > <classpath location="${compiled.classes.dir}"/>
>> > > > <arg line="-d ${schema.generated.src.dir} -quiet ${schema.source.dir}/echo.xsd"/>
>> > > > </java>
>> > > > @@ -266,7 +288,7 @@
>> > > > <classpath refid="maven.runtime.classpath"/>
>> > > > <classpath location="${compiled.classes.dir}"/>
>> > > > <arg line="-d ${schema.generated.src.dir} -quiet -wsdl ${wsdl.source.dir}/AddNumbers.wsdl"/>
>> > > > - </java>
>> > > > + </java>
>> > > > </tasks>
>> > > > </configuration>
>> > > > <goals>
>> > > > @@ -287,6 +309,22 @@
>> > > > <property name="addressing_version" value="${version}"/>
>> > > > <ant antfile="build.xml" inheritall="true" inheritrefs="true"
>> > > > dir="." target="build-repo"/>
>> > > > +
>> > > > + <property name="compile_classpath" refid="maven.compile.classpath" />
>> > > > + <property name="runtime_classpath" refid="maven.runtime.classpath" />
>> > > > + <property name="test_classpath" refid="maven.test.classpath" />
>> > > > + <property name="plugin_classpath" refid="maven.plugin.classpath" />
>> > > > +
>> > > > + <!-- Defining wsGen task -->
>> > > > + <taskdef name="wsgen" loaderRef="refwsgen" classname="com.sun.tools.ws.ant.WsGen">
>> > > > + <classpath>
>> > > > + <path refid="maven.runtime.classpath" />
>> > > > + <path refid="maven.compile.classpath" />
>> > > > + </classpath>
>> > > > + </taskdef>
>> > > > + <!-- Invoking test cases that need to generate artifacts using wsGen -->
>> > > > + <ant antfile="wsgen-tests.xml" inheritall="true" inheritrefs="true"
>> > > > + dir="." target="run-wsgen-tests"/>
>> > > > </tasks>
>> > > > </configuration>
>> > > > <goals>
>> > > > @@ -374,6 +412,13 @@
>> > > > <plugin>
>> > > > <groupId>org.apache.maven.plugins</groupId>
>> > > > <artifactId>maven-surefire-report-plugin</artifactId>
>> > > > + <reportSets>
>> > > > + <reportSet>
>> > > > + <reports>
>> > > > + <report>report-only</report>
>> > > > + </reports>
>> > > > + </reportSet>
>> > > > + </reportSets>
>> > > > </plugin>
>> > > > </plugins>
>> > > > </reporting>
>> > > >
>> > > > Modified: axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
>> > > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java?rev=963508&r1=963507&r2=963508&view=diff
>> > > > ==============================================================================
>> > > > --- axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java (original)
>> > > > +++ axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java Mon Jul 12 22:16:54 2010
>> > > > @@ -238,12 +238,27 @@ class ArtifactProcessor {
>> > > > wrapperClass = newValue;
>> > > > }
>> > > > }
>> > > > - if(cls==null && (type.equals("@WebFault")|| type.equals("faultInfo"))){
>> > > > +
>> > > > + if(cls==null &&
>> > > > + (type.equals("@RequestWrapper")|| type.equals("@ResponseWrapper")||type.equals("@WebFault")|| type.equals("faultInfo"))){
>> > > > +
>> > > > + //Support for Fault Bean Generation
>> > > > //As per JAX-WS 2.2 Specification section 3.7 an application programmer can choose not to
>> > > > //package the faultBeans, if we have reached this point in the code then user has choosen
>> > > > //not to package the fault bean. If there is a cache of generated artifacts available then
>> > > > //lets look for the missing faultBean there.
>> > > > -
>> > > > +
>> > > > + //Support for Wrapper Bean Generation
>> > > > + //As per JAX-WS 2.2 Specificaiton section 3.6.2.1 pg 41 an application programmer does not use
>> > > > + //the wrapper bean classes, so the application need not package these classes. If we have reached
>> > > > + //this point in the code then user has choosen not to package these beans.
>> > > > +
>> > > > + //NOTE:If we find Generated artifacts from cache this guarantees that we will not use
>> > > > + //DocLitWrappedMinimum marshaller code. The advantage of normal DocLitWrappedMarshaller is
>> > > > + //that it is very robust and has support of lot more datatypes than in DocLitWrappedMinimum.
>> > > > + if(log.isDebugEnabled()){
>> > > > + log.debug("Adding cache to classpath");
>> > > > + }
>> > > > ClassFinderFactory cff =
>> > > > (ClassFinderFactory)FactoryRegistry.getFactory(ClassFinderFactory.class);
>> > > > ClassFinder cf = cff.getClassFinder();
>> > > > @@ -317,11 +332,26 @@ class ArtifactProcessor {
>> > > > if (cls2 == null) {
>> > > > cls2 = loadClassOrNull(defaultValue, altClassLoader);
>> > > > }
>> > > > - if(cls2==null && (type.equals("faultInfo")|| type.equals("@WebFault"))){
>> > > > - //As per JAX-WS 2.2 Specification section 3.7 an application programmer can choose not to
>> > > > - //package the faultBeans, if we have reached this point in the code then user has choosen
>> > > > - //not to package the fault bean. If there is a cache of generated artifacts available then
>> > > > - //lets look for the missing faultBean there.
>> > > > + if(cls2==null &&
>> > > > + (type.equals("@RequestWrapper")|| type.equals("@ResponseWrapper")||type.equals("@WebFault")|| type.equals("faultInfo"))){
>> > > > +
>> > > > + //Support for Fault Bean Generation
>> > > > + //As per JAX-WS 2.2 Specification section 3.7 an application programmer can choose not to
>> > > > + //package the faultBeans, if we have reached this point in the code then user has choosen
>> > > > + //not to package the fault bean. If there is a cache of generated artifacts available then
>> > > > + //lets look for the missing faultBean there.
>> > > > +
>> > > > + //Support for Wrapper Bean Generation
>> > > > + //As per JAX-WS 2.2 Specificaiton section 3.6.2.1 pg 41 an application programmer does not use
>> > > > + //the wrapper bean classes, so the application need not package these classes. If we have reached
>> > > > + //this point in the code then user has choosen not to package these beans.
>> > > > +
>> > > > + //NOTE:If we find Generated artifacts from cache this guarantees that we will not use
>> > > > + //DocLitWrappedMinimum marshaller code. The advantage of normal DocLitWrappedMarshaller is
>> > > > + //that it is very robust and has support of lot more datatypes than in DocLitWrappedMinimum.
>> > > > + if(log.isDebugEnabled()){
>> > > > + log.debug("Adding cache to classpath");
>> > > > + }
>> > > > if(log.isDebugEnabled()){
>> > > > log.debug("Adding cache to classpath");
>> > > > }
>> > > >
>> > > > Added: axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
>> > > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java?rev=963508&view=auto
>> > > > ==============================================================================
>> > > > --- axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java (added)
>> > > > +++ axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java Mon Jul 12 22:16:54 2010
>> > > > @@ -0,0 +1,18 @@
>> > > > +
>> > > > +package org.apache.axis2.jaxws.wrapper.beans;
>> > > > +
>> > > > +import javax.xml.ws.WebFault;
>> > > > +
>> > > > +@WebFault(name = "AddNumbersFault", targetNamespace = "http://org/test/addnumbers")
>> > > > +public class AddNumbersException extends Exception
>> > > > +{
>> > > > +
>> > > > + private String message = null;
>> > > > + public AddNumbersException(){}
>> > > > + public AddNumbersException(String message){
>> > > > + this.message = message;
>> > > > + }
>> > > > + public String getInfo(){
>> > > > + return message;
>> > > > + }
>> > > > +}
>> > > >
>> > > > Added: axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
>> > > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java?rev=963508&view=auto
>> > > > ==============================================================================
>> > > > --- axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java (added)
>> > > > +++ axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java Mon Jul 12 22:16:54 2010
>> > > > @@ -0,0 +1,15 @@
>> > > > +package org.apache.axis2.jaxws.wrapper.beans;
>> > > > +
>> > > > +
>> > > > +
>> > > > +@javax.jws.WebService (targetNamespace="http://org/test/addnumbers", serviceName="AddNumbersService", portName="AddNumbersPort")
>> > > > +public class AddNumbersService{
>> > > > +
>> > > > + public int addNumbers(int arg0, int arg1) throws AddNumbersException {
>> > > > + if(arg0+arg1<0){
>> > > > + throw new AddNumbersException("sum is less than 0");
>> > > > + }
>> > > > + return arg0+arg1;
>> > > > + }
>> > > > +
>> > > > +}
>> > > > \ No newline at end of file
>> > > >
>> > > > Added: axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
>> > > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java?rev=963508&view=auto
>> > > > ==============================================================================
>> > > > --- axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java (added)
>> > > > +++ axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java Mon Jul 12 22:16:54 2010
>> > > > @@ -0,0 +1,114 @@
>> > > > +/**
>> > > > + *
>> > > > + */
>> > > > +package org.apache.axis2.jaxws.wrapper.beans;
>> > > > +
>> > > > +
>> > > > +import org.apache.axis2.jaxws.Constants;
>> > > > +import org.apache.axis2.jaxws.description.DescriptionFactory;
>> > > > +import org.apache.axis2.jaxws.description.EndpointDescription;
>> > > > +import org.apache.axis2.jaxws.description.EndpointDescriptionJava;
>> > > > +import org.apache.axis2.jaxws.description.OperationDescription;
>> > > > +import org.apache.axis2.jaxws.description.ServiceDescription;
>> > > > +import org.apache.axis2.jaxws.marshaller.MethodMarshaller;
>> > > > +import org.apache.axis2.jaxws.marshaller.factory.MethodMarshallerFactory;
>> > > > +import org.apache.axis2.jaxws.marshaller.impl.alt.DocLitWrappedMinimalMethodMarshaller;
>> > > > +import org.apache.axis2.jaxws.unitTest.TestLogger;
>> > > > +
>> > > > +import java.io.File;
>> > > > +
>> > > > +import junit.framework.TestCase;
>> > > > +
>> > > > +public class WrapperBeanMarshallTests extends TestCase {
>> > > > + /**
>> > > > + * This is the negative test case, when we do not use generated artifacts from cache
>> > > > + * and user did not package wrapper beans, we should see use of DocLitWrappedMinumumMarshaller.
>> > > > + */
>> > > > + public void testGetMarshallerOperationDescriptionBooleanNegative() {
>> > > > + TestLogger.logger.debug("---------------------------------------");
>> > > > + TestLogger.logger.debug("test: " + getName());
>> > > > +
>> > > > + String cache_location = "/target/wscache/classes";
>> > > > + try{
>> > > > + String baseDir = new File(System.getProperty("basedir",".")).getCanonicalPath();
>> > > > + cache_location = new File(baseDir+cache_location).getAbsolutePath();
>> > > > + TestLogger.logger.debug("cache location ="+cache_location);
>> > > > +
>> > > > + //Get EndpointDescription.
>> > > > + //Set location on AxisConfiguraiton.
>> > > > + Class sei = AddNumbersService.class;
>> > > > + EndpointDescription description = getEndpointDesc(sei);
>> > > > + TestLogger.logger.debug("description objects where created successfully");
>> > > > + OperationDescription[] ops =description.getEndpointInterfaceDescription().getOperations();
>> > > > + assertNotNull( "OperationDescriptions where null", ops);
>> > > > + assertTrue("No Operation Descriptions where found", ops.length>0);
>> > > > + OperationDescription op = ops[0];
>> > > > + TestLogger.logger.debug("operation found, java methodName="+op.getJavaMethodName());
>> > > > + //Don not Set cache on AxisConfiguration.
>> > > > + //get Marshaller, verify its not DoclitWrappedMinimum.
>> > > > + TestLogger.logger.debug("ws_cache location NOT set on AxisConfigContext, location="+cache_location);
>> > > > + MethodMarshaller mm = MethodMarshallerFactory.getMarshaller(op, false);
>> > > > + assertNotNull("getMarshaller returned null", mm );
>> > > > + TestLogger.logger.debug("MethodMarshaller was created, type="+mm.getClass().getName());
>> > > > + assertTrue("Generated artifacts not found, Method marshaller should be DocLitWrappedMinimumMarshaller", (mm instanceof DocLitWrappedMinimalMethodMarshaller));
>> > > > + }catch(Exception e){
>> > > > + TestLogger.logger.debug("Exception ="+e.getMessage());
>> > > > + fail(e.getMessage());
>> > > > + }
>> > > > +
>> > > > + }
>> > > > + /**
>> > > > + * In this test case user did not package wrapper beans but we add generated artifacts from cache, we should see use of
>> > > > + * DocLitWrappedMarshaller.
>> > > > + * Test method for {@link org.apache.axis2.jaxws.marshaller.factory.MethodMarshallerFactory#getMarshaller(org.apache.axis2.jaxws.description.OperationDescription, boolean)}.
>> > > > + */
>> > > > + public void testGetMarshallerOperationDescriptionBoolean() {
>> > > > + TestLogger.logger.debug("---------------------------------------");
>> > > > + TestLogger.logger.debug("test: " + getName());
>> > > > +
>> > > > + String cache_location = "/target/wscache/classes";
>> > > > + try{
>> > > > + String baseDir = new File(System.getProperty("basedir",".")).getCanonicalPath();
>> > > > + cache_location = new File(baseDir+cache_location).getAbsolutePath();
>> > > > + TestLogger.logger.debug("cache location ="+cache_location);
>> > > > +
>> > > > + //Get EndpointDescription.
>> > > > + //Set location on AxisConfiguraiton.
>> > > > + Class sei = AddNumbersService.class;
>> > > > + EndpointDescription description = getEndpointDesc(sei);
>> > > > + TestLogger.logger.debug("description objects where created successfully");
>> > > > + OperationDescription[] ops =description.getEndpointInterfaceDescription().getOperations();
>> > > > + assertNotNull( "OperationDescriptions where null", ops);
>> > > > + assertTrue("No Operation Descriptions where found", ops.length>0);
>> > > > + OperationDescription op = ops[0];
>> > > > + TestLogger.logger.debug("operation found, java methodName="+op.getJavaMethodName());
>> > > > + //Set cache on AxisConfiguration.
>> > > > + //get Marshaller, verify its not DoclitWrappedMinimum.
>> > > > + description.getServiceDescription().getAxisConfigContext().setProperty(Constants.WS_CACHE, cache_location);
>> > > > + TestLogger.logger.debug("ws_cache location set on AxisConfigContext, location="+cache_location);
>> > > > + MethodMarshaller mm = MethodMarshallerFactory.getMarshaller(op, false);
>> > > > + assertNotNull("getMarshaller returned null", mm );
>> > > > + TestLogger.logger.debug("MethodMarshaller was created, type="+mm.getClass().getName());
>> > > > + assertTrue("Generated artifacts are in cache, Method marshaller should not be DocLitWrappedMinimumMarshaller", !(mm instanceof DocLitWrappedMinimalMethodMarshaller));
>> > > > + }catch(Exception e){
>> > > > + TestLogger.logger.debug("Exception ="+e.getMessage());
>> > > > + fail(e.getMessage());
>> > > > + }
>> > > > +
>> > > > + }
>> > > > +
>> > > > + private EndpointDescription getEndpointDesc(Class implementationClass) {
>> > > > + // Use the description factory directly; this will be done within the JAX-WS runtime
>> > > > + ServiceDescription serviceDesc =
>> > > > + DescriptionFactory.createServiceDescription(implementationClass);
>> > > > + assertNotNull(serviceDesc);
>> > > > +
>> > > > + EndpointDescription[] endpointDesc = serviceDesc.getEndpointDescriptions();
>> > > > + assertNotNull(endpointDesc);
>> > > > + assertEquals(1, endpointDesc.length);
>> > > > +
>> > > > + // TODO: How will the JAX-WS dispatcher get the appropriate port (i.e. endpoint)? Currently assumes [0]
>> > > > + EndpointDescription testEndpointDesc = endpointDesc[0];
>> > > > + return testEndpointDesc;
>> > > > + }
>> > > > +}
>> > > >
>> > > > Added: axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml
>> > > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml?rev=963508&view=auto
>> > > > ==============================================================================
>> > > > --- axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml (added)
>> > > > +++ axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml Mon Jul 12 22:16:54 2010
>> > > > @@ -0,0 +1,34 @@
>> > > > +<?xml version="1.0" encoding="UTF-8"?>
>> > > > +
>> > > > +<project basedir="." default="run-wsgen-tests" name="wsgen-tests">
>> > > > +
>> > > > + <property name="wscache.output.base.dir" value="target/wscache" />
>> > > > + <property name="wscache.generated.src.dir" value="${wscache.output.base.dir}/src" />
>> > > > + <property name="wscache.generated.classes.dir" value="${wscache.output.base.dir}/classes" />
>> > > > + <property name="compile.test.classes" value="target/test-classes" />
>> > > > +
>> > > > +
>> > > > + <target name="run-wsgen-tests" depends="wrapper-beans"/>
>> > > > +
>> > > > +
>> > > > + <target name="create-cache">
>> > > > + <mkdir dir="${wscache.output.base.dir}" />
>> > > > + <mkdir dir="${wscache.generated.src.dir}" />
>> > > > + <mkdir dir="${wscache.generated.classes.dir}" />
>> > > > + </target>
>> > > > +
>> > > > + <target name="wrapper-beans" depends="create-cache">
>> > > > + <echo>Generating artifacts for org.apache.axis2.jaxws.wrapper.beans.AddNumbersService </echo>
>> > > > + <wsgen
>> > > > + sei="org.apache.axis2.jaxws.wrapper.beans.AddNumbersService"
>> > > > + destdir="${wscache.generated.classes.dir}"
>> > > > + resourcedestdir="${wscache.generated.src.dir}"
>> > > > + keep="false"
>> > > > + verbose="false"
>> > > > + genwsdl="true">
>> > > > + <classpath>
>> > > > + <pathelement path="${compile.test.classes}" />
>> > > > + </classpath>
>> > > > + </wsgen>
>> > > > + </target>
>> > > > +</project>
>> > > > \ No newline at end of file
>> > > >
>> > > >
>> > > >
>> > >
>> > > ---------------------------------------------------------------------
>> > > To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
>> > > For additional commands, e-mail: java-dev-help@axis.apache.org
>> > >
>> > >
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
>> > For additional commands, e-mail: java-dev-help@axis.apache.org
>> >
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
>> For additional commands, e-mail: java-dev-help@axis.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-dev-help@axis.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org
Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws:
./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/
test/org/apache/axis2/jaxws/wrapper/ test/org/apache/axis2/jaxws/wrapper/beans/
Posted by Andreas Veithen <an...@gmail.com>.
Jarek, you got my point. There is of course no objection to add
jaxws-tools as a _test_ dependency. For the tools.jar dependency, I
don't know exactly how system dependencies behave with respect to
transitive dependencies, but anyway, if tools.jar is only required for
the ant task, it would be easier to add it to the classpath in the ant
script. The reason is that to add tools.jar as a Maven dependencies
requires defining several profiles. This is because on Mac OS X, there
is no tools.jar and all classes are always available from the system
classpath. Thus you need to have profiles that are activated when
building with a Sun or IBM JDK, but not on Mac OS X.
Andreas
On Thu, Jul 15, 2010 at 05:55, Jarek Gawor <jg...@gmail.com> wrote:
> Nikhil,
>
> I don't think there is an objection for adding jaxws-tools as a _test_
> dependency. So as long you add the jaxws-tools dependency with
> <scope>test</scope> there shouldn't be a problem.
>
> Jarek
>
> On Wed, Jul 14, 2010 at 10:40 PM, Nikhil V Thaker
> <ni...@us.ibm.com> wrote:
>>
>> Thanks Jarek for the suggestion.
>>
>> The fact that there is an objection to putting jaxws-tools.jar as a dependency would mean we cannot run wsGen. Unless I misunderstood Andreas comments. To me we should always have jaxws-tools as dependency to jaxws module, after all jaxws tools are prerequisite to jaxws runtime, a user of jaxws runtime has to run wsGen or wsImport to build webservices application.
>>
>> Anyways, I will look and see if there is an alternate way to add these test cases.
>>
>> Regards,
>>
>> Nikhil Thaker
>> office: 919 254 9964
>> nvthaker@us.ibm.com
>>
>>
>> Jarek Gawor <jg...@gmail.com>
>>
>> 07/14/2010 03:38 PM
>>
>> Please respond to
>> java-dev@axis.apache.org
>> To
>> java-dev@axis.apache.org
>> cc
>> Subject
>> Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws: ./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ test/org/apache/axis2/jaxws/wrapper/ test/org/apache/axis2/jaxws/wrapper/beans/
>>
>>
>>
>>
>> Just a couple of thoughts:
>>
>> 1) Since you already have wsgen-tests.xml ant script to run the wsgen
>> you could setup the appropriate classpath to the tools.jar or
>> classes.jar or whatever in it. You just might need to fork the ant
>> process.
>>
>> 2) I don't think it's that horrible to commit some generate code
>> especially if there isn't too much of it and the test case is
>> important. Besides, Axis2 already has some generated code checked it.
>>
>> Jarek
>>
>> On Wed, Jul 14, 2010 at 4:00 PM, Nikhil V Thaker
>> <ni...@us.ibm.com> wrote:
>> >
>> > Yes Andreas,
>> > I am running antrun plugin as the wsGen plugin has errors and is not fully matured, here's the URL that explains the issue I ran into http://jira.codehaus.org/browse/MNG-3586.
>> >
>> > So since I cannot run wsGen or cannot include generated artifacts I will just remove the test case. I will commit the changes soon.
>> >
>> > Regards,
>> >
>> > Nikhil Thaker
>> > office: 919 254 9964
>> > nvthaker@us.ibm.com
>> >
>> >
>> > Andreas Veithen <an...@gmail.com>
>> >
>> > 07/14/2010 02:48 PM
>> >
>> > Please respond to
>> > java-dev@axis.apache.org
>> > To
>> > java-dev@axis.apache.org
>> > cc
>> > Subject
>> > Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws: ./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ test/org/apache/axis2/jaxws/wrapper/ test/org/apache/axis2/jaxws/wrapper/beans/
>> >
>> >
>> >
>> >
>> > No, you are using the antrun plugin to execute the wsgen ant task.
>> > What I meant was to use a real Maven plugin (either the one from
>> > java.net or the one from CXF).
>> >
>> > -1 to commit any generated stuff into SVN.
>> >
>> > Andreas
>> >
>> > On Wed, Jul 14, 2010 at 21:42, Nikhil V Thaker
>> > <ni...@us.ibm.com> wrote:
>> > >
>> > > Andreas - I had to add the tools.jar bit because maven plugin for wsGen gave NoClassDef Found errors for classes packaged in tools.jar.
>> > >
>> > > Since this is causing a problem I will just package the generated artifacts and remove the wsGen dependency.
>> > >
>> > > Thanks,
>> > >
>> > > Nikhil Thaker
>> > > office: 919 254 9964
>> > > nvthaker@us.ibm.com
>> > >
>> > >
>> > > Andreas Veithen <an...@gmail.com>
>> > >
>> > > 07/14/2010 01:44 PM
>> > >
>> > > Please respond to
>> > > java-dev@axis.apache.org
>> > > To
>> > > java-dev@axis.apache.org
>> > > cc
>> > > Subject
>> > > Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws: ./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ test/org/apache/axis2/jaxws/wrapper/ test/org/apache/axis2/jaxws/wrapper/beans/
>> > >
>> > >
>> > >
>> > >
>> > > Nikhil,
>> > >
>> > > I have some issues with the tools and jaxws-tools dependencies
>> > > introduced by this change:
>> > >
>> > > * The change causes a build failure in Hudson. There will also be
>> > > additional issues with tools.jar, because the way to declare this as a
>> > > system dependency varies from one JDK to another. For example, I
>> > > remember that on Mac OS X, it is completely different than on other
>> > > JDKs.
>> > >
>> > > * I don't like the fact that jaxws-tools becomes a dependency of
>> > > axis2-jaxws in scope compile, because it looks like this is only
>> > > needed during the build and/or during the tests.
>> > >
>> > > I didn't review the change in detail, but wouldn't it be smarter to
>> > > use one of the existing Maven plugins to do the wsgen stuff? They will
>> > > take care of the tools.jar stuff as well.
>> > >
>> > > Andreas
>> > >
>> > > On Tue, Jul 13, 2010 at 00:16, <nt...@apache.org> wrote:
>> > > > Author: nthaker
>> > > > Date: Mon Jul 12 22:16:54 2010
>> > > > New Revision: 963508
>> > > >
>> > > > URL: http://svn.apache.org/viewvc?rev=963508&view=rev
>> > > > Log:
>> > > > AXIS2-4775
>> > > > This change ensures that we will use Request and Response wrapper Bean packaged by customer or we will Generate Wrappers if they are not packaged.
>> > > >
>> > > > Added:
>> > > > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/
>> > > > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/
>> > > > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
>> > > > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
>> > > > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
>> > > > axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml
>> > > > Modified:
>> > > > axis/axis2/java/core/trunk/modules/jaxws/pom.xml
>> > > > axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
>> > > >
>> > > > Modified: axis/axis2/java/core/trunk/modules/jaxws/pom.xml
>> > > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/pom.xml?rev=963508&r1=963507&r2=963508&view=diff
>> > > > ==============================================================================
>> > > > --- axis/axis2/java/core/trunk/modules/jaxws/pom.xml (original)
>> > > > +++ axis/axis2/java/core/trunk/modules/jaxws/pom.xml Mon Jul 12 22:16:54 2010
>> > > > @@ -1,5 +1,4 @@
>> > > > <?xml version="1.0" encoding="UTF-8"?>
>> > > > -
>> > > > <!-- > ~ Licensed to the Apache Software Foundation (ASF) under one
>> > > > ~ or more contributor license agreements. See the NOTICE file
>> > > > @@ -20,7 +19,7 @@
>> > > > -->
>> > > >
>> > > > <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> > > > - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
>> > > > + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
>> > > > <modelVersion>4.0.0</modelVersion>
>> > > > <parent>
>> > > > <groupId>org.apache.axis2</groupId>
>> > > > @@ -98,7 +97,25 @@
>> > > > <version>${version}</version>
>> > > > <scope>test</scope>
>> > > > </dependency>
>> > > > + <dependency>
>> > > > + <groupId>wsdl4j</groupId>
>> > > > + <artifactId>wsdl4j</artifactId>
>> > > > + </dependency>
>> > > > + <dependency>
>> > > > + <groupId>com.sun.xml.ws</groupId>
>> > > > + <artifactId>jaxws-tools</artifactId>
>> > > > + <version>2.1.3</version>
>> > > > + </dependency>
>> > > > + <!-- If we dont include tools.jar as dependency, maven throws NoClassDefFound on wsGen run -->
>> > > > + <dependency>
>> > > > + <groupId>java</groupId>
>> > > > + <artifactId>tools</artifactId>
>> > > > + <version>$version</version>
>> > > > + <scope>system</scope>
>> > > > + <systemPath>${JAVA_HOME}/lib/tools.jar</systemPath>
>> > > > + </dependency>
>> > > > </dependencies>
>> > > > +
>> > > > <build>
>> > > > <sourceDirectory>src</sourceDirectory>
>> > > > <testSourceDirectory>test</testSourceDirectory>
>> > > > @@ -203,34 +220,39 @@
>> > > > <compilerVersion>1.5</compilerVersion>
>> > > > <source>1.5</source>
>> > > > <target>1.5</target>
>> > > > +
>> > > > </configuration>
>> > > > </plugin>
>> > > > <plugin>
>> > > > <groupId>org.apache.maven.plugins</groupId>
>> > > > <artifactId>maven-antrun-plugin</artifactId>
>> > > > +
>> > > > <executions>
>> > > > <execution>
>> > > > <id>gen-ts</id>
>> > > > <phase>generate-test-sources</phase>
>> > > > <configuration>
>> > > > - <tasks unless="maven.test.skip">
>> > > > + <tasks unless="maven.test.skip">
>> > > > <!-- Theres got to be a better way to do this -->
>> > > > <property name="schema.source.dir" value="test-resources/xsd"/>
>> > > > <property name="wsdl.source.dir" value="test-resources/wsdl"/>
>> > > > - <property name="schema.output.base.dir" value="target/schema"/>
>> > > > + <property name="schema.output.base.dir" value="target/schema"/>
>> > > > <property name="schema.generated.src.dir" value="${schema.output.base.dir}/src"/>
>> > > > <property name="schema.generated.classes.dir"
>> > > > value="${schema.output.base.dir}/classes"/>
>> > > > +
>> > > > <!-- make the dirs -->
>> > > > <mkdir dir="${schema.output.base.dir}"/>
>> > > > <mkdir dir="${schema.generated.src.dir}"/>
>> > > > <mkdir dir="${schema.generated.classes.dir}"/>
>> > > > +
>> > > > <!-- Run JAXB schema compiler with designated schemas -->
>> > > > <echo>Generating JAX-B classes from XSDs</echo>
>> > > >
>> > > > <echo>Generating java from echo.xsd</echo>
>> > > > <java classname="com.sun.tools.xjc.Driver" fork="true">
>> > > > <classpath refid="maven.runtime.classpath"/>
>> > > > +
>> > > > <classpath location="${compiled.classes.dir}"/>
>> > > > <arg line="-d ${schema.generated.src.dir} -quiet ${schema.source.dir}/echo.xsd"/>
>> > > > </java>
>> > > > @@ -266,7 +288,7 @@
>> > > > <classpath refid="maven.runtime.classpath"/>
>> > > > <classpath location="${compiled.classes.dir}"/>
>> > > > <arg line="-d ${schema.generated.src.dir} -quiet -wsdl ${wsdl.source.dir}/AddNumbers.wsdl"/>
>> > > > - </java>
>> > > > + </java>
>> > > > </tasks>
>> > > > </configuration>
>> > > > <goals>
>> > > > @@ -287,6 +309,22 @@
>> > > > <property name="addressing_version" value="${version}"/>
>> > > > <ant antfile="build.xml" inheritall="true" inheritrefs="true"
>> > > > dir="." target="build-repo"/>
>> > > > +
>> > > > + <property name="compile_classpath" refid="maven.compile.classpath" />
>> > > > + <property name="runtime_classpath" refid="maven.runtime.classpath" />
>> > > > + <property name="test_classpath" refid="maven.test.classpath" />
>> > > > + <property name="plugin_classpath" refid="maven.plugin.classpath" />
>> > > > +
>> > > > + <!-- Defining wsGen task -->
>> > > > + <taskdef name="wsgen" loaderRef="refwsgen" classname="com.sun.tools.ws.ant.WsGen">
>> > > > + <classpath>
>> > > > + <path refid="maven.runtime.classpath" />
>> > > > + <path refid="maven.compile.classpath" />
>> > > > + </classpath>
>> > > > + </taskdef>
>> > > > + <!-- Invoking test cases that need to generate artifacts using wsGen -->
>> > > > + <ant antfile="wsgen-tests.xml" inheritall="true" inheritrefs="true"
>> > > > + dir="." target="run-wsgen-tests"/>
>> > > > </tasks>
>> > > > </configuration>
>> > > > <goals>
>> > > > @@ -374,6 +412,13 @@
>> > > > <plugin>
>> > > > <groupId>org.apache.maven.plugins</groupId>
>> > > > <artifactId>maven-surefire-report-plugin</artifactId>
>> > > > + <reportSets>
>> > > > + <reportSet>
>> > > > + <reports>
>> > > > + <report>report-only</report>
>> > > > + </reports>
>> > > > + </reportSet>
>> > > > + </reportSets>
>> > > > </plugin>
>> > > > </plugins>
>> > > > </reporting>
>> > > >
>> > > > Modified: axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
>> > > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java?rev=963508&r1=963507&r2=963508&view=diff
>> > > > ==============================================================================
>> > > > --- axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java (original)
>> > > > +++ axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java Mon Jul 12 22:16:54 2010
>> > > > @@ -238,12 +238,27 @@ class ArtifactProcessor {
>> > > > wrapperClass = newValue;
>> > > > }
>> > > > }
>> > > > - if(cls==null && (type.equals("@WebFault")|| type.equals("faultInfo"))){
>> > > > +
>> > > > + if(cls==null &&
>> > > > + (type.equals("@RequestWrapper")|| type.equals("@ResponseWrapper")||type.equals("@WebFault")|| type.equals("faultInfo"))){
>> > > > +
>> > > > + //Support for Fault Bean Generation
>> > > > //As per JAX-WS 2.2 Specification section 3.7 an application programmer can choose not to
>> > > > //package the faultBeans, if we have reached this point in the code then user has choosen
>> > > > //not to package the fault bean. If there is a cache of generated artifacts available then
>> > > > //lets look for the missing faultBean there.
>> > > > -
>> > > > +
>> > > > + //Support for Wrapper Bean Generation
>> > > > + //As per JAX-WS 2.2 Specificaiton section 3.6.2.1 pg 41 an application programmer does not use
>> > > > + //the wrapper bean classes, so the application need not package these classes. If we have reached
>> > > > + //this point in the code then user has choosen not to package these beans.
>> > > > +
>> > > > + //NOTE:If we find Generated artifacts from cache this guarantees that we will not use
>> > > > + //DocLitWrappedMinimum marshaller code. The advantage of normal DocLitWrappedMarshaller is
>> > > > + //that it is very robust and has support of lot more datatypes than in DocLitWrappedMinimum.
>> > > > + if(log.isDebugEnabled()){
>> > > > + log.debug("Adding cache to classpath");
>> > > > + }
>> > > > ClassFinderFactory cff =
>> > > > (ClassFinderFactory)FactoryRegistry.getFactory(ClassFinderFactory.class);
>> > > > ClassFinder cf = cff.getClassFinder();
>> > > > @@ -317,11 +332,26 @@ class ArtifactProcessor {
>> > > > if (cls2 == null) {
>> > > > cls2 = loadClassOrNull(defaultValue, altClassLoader);
>> > > > }
>> > > > - if(cls2==null && (type.equals("faultInfo")|| type.equals("@WebFault"))){
>> > > > - //As per JAX-WS 2.2 Specification section 3.7 an application programmer can choose not to
>> > > > - //package the faultBeans, if we have reached this point in the code then user has choosen
>> > > > - //not to package the fault bean. If there is a cache of generated artifacts available then
>> > > > - //lets look for the missing faultBean there.
>> > > > + if(cls2==null &&
>> > > > + (type.equals("@RequestWrapper")|| type.equals("@ResponseWrapper")||type.equals("@WebFault")|| type.equals("faultInfo"))){
>> > > > +
>> > > > + //Support for Fault Bean Generation
>> > > > + //As per JAX-WS 2.2 Specification section 3.7 an application programmer can choose not to
>> > > > + //package the faultBeans, if we have reached this point in the code then user has choosen
>> > > > + //not to package the fault bean. If there is a cache of generated artifacts available then
>> > > > + //lets look for the missing faultBean there.
>> > > > +
>> > > > + //Support for Wrapper Bean Generation
>> > > > + //As per JAX-WS 2.2 Specificaiton section 3.6.2.1 pg 41 an application programmer does not use
>> > > > + //the wrapper bean classes, so the application need not package these classes. If we have reached
>> > > > + //this point in the code then user has choosen not to package these beans.
>> > > > +
>> > > > + //NOTE:If we find Generated artifacts from cache this guarantees that we will not use
>> > > > + //DocLitWrappedMinimum marshaller code. The advantage of normal DocLitWrappedMarshaller is
>> > > > + //that it is very robust and has support of lot more datatypes than in DocLitWrappedMinimum.
>> > > > + if(log.isDebugEnabled()){
>> > > > + log.debug("Adding cache to classpath");
>> > > > + }
>> > > > if(log.isDebugEnabled()){
>> > > > log.debug("Adding cache to classpath");
>> > > > }
>> > > >
>> > > > Added: axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
>> > > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java?rev=963508&view=auto
>> > > > ==============================================================================
>> > > > --- axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java (added)
>> > > > +++ axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java Mon Jul 12 22:16:54 2010
>> > > > @@ -0,0 +1,18 @@
>> > > > +
>> > > > +package org.apache.axis2.jaxws.wrapper.beans;
>> > > > +
>> > > > +import javax.xml.ws.WebFault;
>> > > > +
>> > > > +@WebFault(name = "AddNumbersFault", targetNamespace = "http://org/test/addnumbers")
>> > > > +public class AddNumbersException extends Exception
>> > > > +{
>> > > > +
>> > > > + private String message = null;
>> > > > + public AddNumbersException(){}
>> > > > + public AddNumbersException(String message){
>> > > > + this.message = message;
>> > > > + }
>> > > > + public String getInfo(){
>> > > > + return message;
>> > > > + }
>> > > > +}
>> > > >
>> > > > Added: axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
>> > > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java?rev=963508&view=auto
>> > > > ==============================================================================
>> > > > --- axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java (added)
>> > > > +++ axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java Mon Jul 12 22:16:54 2010
>> > > > @@ -0,0 +1,15 @@
>> > > > +package org.apache.axis2.jaxws.wrapper.beans;
>> > > > +
>> > > > +
>> > > > +
>> > > > +@javax.jws.WebService (targetNamespace="http://org/test/addnumbers", serviceName="AddNumbersService", portName="AddNumbersPort")
>> > > > +public class AddNumbersService{
>> > > > +
>> > > > + public int addNumbers(int arg0, int arg1) throws AddNumbersException {
>> > > > + if(arg0+arg1<0){
>> > > > + throw new AddNumbersException("sum is less than 0");
>> > > > + }
>> > > > + return arg0+arg1;
>> > > > + }
>> > > > +
>> > > > +}
>> > > > \ No newline at end of file
>> > > >
>> > > > Added: axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
>> > > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java?rev=963508&view=auto
>> > > > ==============================================================================
>> > > > --- axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java (added)
>> > > > +++ axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java Mon Jul 12 22:16:54 2010
>> > > > @@ -0,0 +1,114 @@
>> > > > +/**
>> > > > + *
>> > > > + */
>> > > > +package org.apache.axis2.jaxws.wrapper.beans;
>> > > > +
>> > > > +
>> > > > +import org.apache.axis2.jaxws.Constants;
>> > > > +import org.apache.axis2.jaxws.description.DescriptionFactory;
>> > > > +import org.apache.axis2.jaxws.description.EndpointDescription;
>> > > > +import org.apache.axis2.jaxws.description.EndpointDescriptionJava;
>> > > > +import org.apache.axis2.jaxws.description.OperationDescription;
>> > > > +import org.apache.axis2.jaxws.description.ServiceDescription;
>> > > > +import org.apache.axis2.jaxws.marshaller.MethodMarshaller;
>> > > > +import org.apache.axis2.jaxws.marshaller.factory.MethodMarshallerFactory;
>> > > > +import org.apache.axis2.jaxws.marshaller.impl.alt.DocLitWrappedMinimalMethodMarshaller;
>> > > > +import org.apache.axis2.jaxws.unitTest.TestLogger;
>> > > > +
>> > > > +import java.io.File;
>> > > > +
>> > > > +import junit.framework.TestCase;
>> > > > +
>> > > > +public class WrapperBeanMarshallTests extends TestCase {
>> > > > + /**
>> > > > + * This is the negative test case, when we do not use generated artifacts from cache
>> > > > + * and user did not package wrapper beans, we should see use of DocLitWrappedMinumumMarshaller.
>> > > > + */
>> > > > + public void testGetMarshallerOperationDescriptionBooleanNegative() {
>> > > > + TestLogger.logger.debug("---------------------------------------");
>> > > > + TestLogger.logger.debug("test: " + getName());
>> > > > +
>> > > > + String cache_location = "/target/wscache/classes";
>> > > > + try{
>> > > > + String baseDir = new File(System.getProperty("basedir",".")).getCanonicalPath();
>> > > > + cache_location = new File(baseDir+cache_location).getAbsolutePath();
>> > > > + TestLogger.logger.debug("cache location ="+cache_location);
>> > > > +
>> > > > + //Get EndpointDescription.
>> > > > + //Set location on AxisConfiguraiton.
>> > > > + Class sei = AddNumbersService.class;
>> > > > + EndpointDescription description = getEndpointDesc(sei);
>> > > > + TestLogger.logger.debug("description objects where created successfully");
>> > > > + OperationDescription[] ops =description.getEndpointInterfaceDescription().getOperations();
>> > > > + assertNotNull( "OperationDescriptions where null", ops);
>> > > > + assertTrue("No Operation Descriptions where found", ops.length>0);
>> > > > + OperationDescription op = ops[0];
>> > > > + TestLogger.logger.debug("operation found, java methodName="+op.getJavaMethodName());
>> > > > + //Don not Set cache on AxisConfiguration.
>> > > > + //get Marshaller, verify its not DoclitWrappedMinimum.
>> > > > + TestLogger.logger.debug("ws_cache location NOT set on AxisConfigContext, location="+cache_location);
>> > > > + MethodMarshaller mm = MethodMarshallerFactory.getMarshaller(op, false);
>> > > > + assertNotNull("getMarshaller returned null", mm );
>> > > > + TestLogger.logger.debug("MethodMarshaller was created, type="+mm.getClass().getName());
>> > > > + assertTrue("Generated artifacts not found, Method marshaller should be DocLitWrappedMinimumMarshaller", (mm instanceof DocLitWrappedMinimalMethodMarshaller));
>> > > > + }catch(Exception e){
>> > > > + TestLogger.logger.debug("Exception ="+e.getMessage());
>> > > > + fail(e.getMessage());
>> > > > + }
>> > > > +
>> > > > + }
>> > > > + /**
>> > > > + * In this test case user did not package wrapper beans but we add generated artifacts from cache, we should see use of
>> > > > + * DocLitWrappedMarshaller.
>> > > > + * Test method for {@link org.apache.axis2.jaxws.marshaller.factory.MethodMarshallerFactory#getMarshaller(org.apache.axis2.jaxws.description.OperationDescription, boolean)}.
>> > > > + */
>> > > > + public void testGetMarshallerOperationDescriptionBoolean() {
>> > > > + TestLogger.logger.debug("---------------------------------------");
>> > > > + TestLogger.logger.debug("test: " + getName());
>> > > > +
>> > > > + String cache_location = "/target/wscache/classes";
>> > > > + try{
>> > > > + String baseDir = new File(System.getProperty("basedir",".")).getCanonicalPath();
>> > > > + cache_location = new File(baseDir+cache_location).getAbsolutePath();
>> > > > + TestLogger.logger.debug("cache location ="+cache_location);
>> > > > +
>> > > > + //Get EndpointDescription.
>> > > > + //Set location on AxisConfiguraiton.
>> > > > + Class sei = AddNumbersService.class;
>> > > > + EndpointDescription description = getEndpointDesc(sei);
>> > > > + TestLogger.logger.debug("description objects where created successfully");
>> > > > + OperationDescription[] ops =description.getEndpointInterfaceDescription().getOperations();
>> > > > + assertNotNull( "OperationDescriptions where null", ops);
>> > > > + assertTrue("No Operation Descriptions where found", ops.length>0);
>> > > > + OperationDescription op = ops[0];
>> > > > + TestLogger.logger.debug("operation found, java methodName="+op.getJavaMethodName());
>> > > > + //Set cache on AxisConfiguration.
>> > > > + //get Marshaller, verify its not DoclitWrappedMinimum.
>> > > > + description.getServiceDescription().getAxisConfigContext().setProperty(Constants.WS_CACHE, cache_location);
>> > > > + TestLogger.logger.debug("ws_cache location set on AxisConfigContext, location="+cache_location);
>> > > > + MethodMarshaller mm = MethodMarshallerFactory.getMarshaller(op, false);
>> > > > + assertNotNull("getMarshaller returned null", mm );
>> > > > + TestLogger.logger.debug("MethodMarshaller was created, type="+mm.getClass().getName());
>> > > > + assertTrue("Generated artifacts are in cache, Method marshaller should not be DocLitWrappedMinimumMarshaller", !(mm instanceof DocLitWrappedMinimalMethodMarshaller));
>> > > > + }catch(Exception e){
>> > > > + TestLogger.logger.debug("Exception ="+e.getMessage());
>> > > > + fail(e.getMessage());
>> > > > + }
>> > > > +
>> > > > + }
>> > > > +
>> > > > + private EndpointDescription getEndpointDesc(Class implementationClass) {
>> > > > + // Use the description factory directly; this will be done within the JAX-WS runtime
>> > > > + ServiceDescription serviceDesc =
>> > > > + DescriptionFactory.createServiceDescription(implementationClass);
>> > > > + assertNotNull(serviceDesc);
>> > > > +
>> > > > + EndpointDescription[] endpointDesc = serviceDesc.getEndpointDescriptions();
>> > > > + assertNotNull(endpointDesc);
>> > > > + assertEquals(1, endpointDesc.length);
>> > > > +
>> > > > + // TODO: How will the JAX-WS dispatcher get the appropriate port (i.e. endpoint)? Currently assumes [0]
>> > > > + EndpointDescription testEndpointDesc = endpointDesc[0];
>> > > > + return testEndpointDesc;
>> > > > + }
>> > > > +}
>> > > >
>> > > > Added: axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml
>> > > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml?rev=963508&view=auto
>> > > > ==============================================================================
>> > > > --- axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml (added)
>> > > > +++ axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml Mon Jul 12 22:16:54 2010
>> > > > @@ -0,0 +1,34 @@
>> > > > +<?xml version="1.0" encoding="UTF-8"?>
>> > > > +
>> > > > +<project basedir="." default="run-wsgen-tests" name="wsgen-tests">
>> > > > +
>> > > > + <property name="wscache.output.base.dir" value="target/wscache" />
>> > > > + <property name="wscache.generated.src.dir" value="${wscache.output.base.dir}/src" />
>> > > > + <property name="wscache.generated.classes.dir" value="${wscache.output.base.dir}/classes" />
>> > > > + <property name="compile.test.classes" value="target/test-classes" />
>> > > > +
>> > > > +
>> > > > + <target name="run-wsgen-tests" depends="wrapper-beans"/>
>> > > > +
>> > > > +
>> > > > + <target name="create-cache">
>> > > > + <mkdir dir="${wscache.output.base.dir}" />
>> > > > + <mkdir dir="${wscache.generated.src.dir}" />
>> > > > + <mkdir dir="${wscache.generated.classes.dir}" />
>> > > > + </target>
>> > > > +
>> > > > + <target name="wrapper-beans" depends="create-cache">
>> > > > + <echo>Generating artifacts for org.apache.axis2.jaxws.wrapper.beans.AddNumbersService </echo>
>> > > > + <wsgen
>> > > > + sei="org.apache.axis2.jaxws.wrapper.beans.AddNumbersService"
>> > > > + destdir="${wscache.generated.classes.dir}"
>> > > > + resourcedestdir="${wscache.generated.src.dir}"
>> > > > + keep="false"
>> > > > + verbose="false"
>> > > > + genwsdl="true">
>> > > > + <classpath>
>> > > > + <pathelement path="${compile.test.classes}" />
>> > > > + </classpath>
>> > > > + </wsgen>
>> > > > + </target>
>> > > > +</project>
>> > > > \ No newline at end of file
>> > > >
>> > > >
>> > > >
>> > >
>> > > ---------------------------------------------------------------------
>> > > To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
>> > > For additional commands, e-mail: java-dev-help@axis.apache.org
>> > >
>> > >
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
>> > For additional commands, e-mail: java-dev-help@axis.apache.org
>> >
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
>> For additional commands, e-mail: java-dev-help@axis.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-dev-help@axis.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org
Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws:
./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/
test/org/apache/axis2/jaxws/wrapper/ test/org/apache/axis2/jaxws/wrapper/beans/
Posted by Andreas Veithen <an...@gmail.com>.
Jarek, you got my point. There is of course no objection to add
jaxws-tools as a _test_ dependency. For the tools.jar dependency, I
don't know exactly how system dependencies behave with respect to
transitive dependencies, but anyway, if tools.jar is only required for
the ant task, it would be easier to add it to the classpath in the ant
script. The reason is that to add tools.jar as a Maven dependencies
requires defining several profiles. This is because on Mac OS X, there
is no tools.jar and all classes are always available from the system
classpath. Thus you need to have profiles that are activated when
building with a Sun or IBM JDK, but not on Mac OS X.
Andreas
On Thu, Jul 15, 2010 at 05:55, Jarek Gawor <jg...@gmail.com> wrote:
> Nikhil,
>
> I don't think there is an objection for adding jaxws-tools as a _test_
> dependency. So as long you add the jaxws-tools dependency with
> <scope>test</scope> there shouldn't be a problem.
>
> Jarek
>
> On Wed, Jul 14, 2010 at 10:40 PM, Nikhil V Thaker
> <ni...@us.ibm.com> wrote:
>>
>> Thanks Jarek for the suggestion.
>>
>> The fact that there is an objection to putting jaxws-tools.jar as a dependency would mean we cannot run wsGen. Unless I misunderstood Andreas comments. To me we should always have jaxws-tools as dependency to jaxws module, after all jaxws tools are prerequisite to jaxws runtime, a user of jaxws runtime has to run wsGen or wsImport to build webservices application.
>>
>> Anyways, I will look and see if there is an alternate way to add these test cases.
>>
>> Regards,
>>
>> Nikhil Thaker
>> office: 919 254 9964
>> nvthaker@us.ibm.com
>>
>>
>> Jarek Gawor <jg...@gmail.com>
>>
>> 07/14/2010 03:38 PM
>>
>> Please respond to
>> java-dev@axis.apache.org
>> To
>> java-dev@axis.apache.org
>> cc
>> Subject
>> Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws: ./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ test/org/apache/axis2/jaxws/wrapper/ test/org/apache/axis2/jaxws/wrapper/beans/
>>
>>
>>
>>
>> Just a couple of thoughts:
>>
>> 1) Since you already have wsgen-tests.xml ant script to run the wsgen
>> you could setup the appropriate classpath to the tools.jar or
>> classes.jar or whatever in it. You just might need to fork the ant
>> process.
>>
>> 2) I don't think it's that horrible to commit some generate code
>> especially if there isn't too much of it and the test case is
>> important. Besides, Axis2 already has some generated code checked it.
>>
>> Jarek
>>
>> On Wed, Jul 14, 2010 at 4:00 PM, Nikhil V Thaker
>> <ni...@us.ibm.com> wrote:
>> >
>> > Yes Andreas,
>> > I am running antrun plugin as the wsGen plugin has errors and is not fully matured, here's the URL that explains the issue I ran into http://jira.codehaus.org/browse/MNG-3586.
>> >
>> > So since I cannot run wsGen or cannot include generated artifacts I will just remove the test case. I will commit the changes soon.
>> >
>> > Regards,
>> >
>> > Nikhil Thaker
>> > office: 919 254 9964
>> > nvthaker@us.ibm.com
>> >
>> >
>> > Andreas Veithen <an...@gmail.com>
>> >
>> > 07/14/2010 02:48 PM
>> >
>> > Please respond to
>> > java-dev@axis.apache.org
>> > To
>> > java-dev@axis.apache.org
>> > cc
>> > Subject
>> > Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws: ./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ test/org/apache/axis2/jaxws/wrapper/ test/org/apache/axis2/jaxws/wrapper/beans/
>> >
>> >
>> >
>> >
>> > No, you are using the antrun plugin to execute the wsgen ant task.
>> > What I meant was to use a real Maven plugin (either the one from
>> > java.net or the one from CXF).
>> >
>> > -1 to commit any generated stuff into SVN.
>> >
>> > Andreas
>> >
>> > On Wed, Jul 14, 2010 at 21:42, Nikhil V Thaker
>> > <ni...@us.ibm.com> wrote:
>> > >
>> > > Andreas - I had to add the tools.jar bit because maven plugin for wsGen gave NoClassDef Found errors for classes packaged in tools.jar.
>> > >
>> > > Since this is causing a problem I will just package the generated artifacts and remove the wsGen dependency.
>> > >
>> > > Thanks,
>> > >
>> > > Nikhil Thaker
>> > > office: 919 254 9964
>> > > nvthaker@us.ibm.com
>> > >
>> > >
>> > > Andreas Veithen <an...@gmail.com>
>> > >
>> > > 07/14/2010 01:44 PM
>> > >
>> > > Please respond to
>> > > java-dev@axis.apache.org
>> > > To
>> > > java-dev@axis.apache.org
>> > > cc
>> > > Subject
>> > > Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws: ./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ test/org/apache/axis2/jaxws/wrapper/ test/org/apache/axis2/jaxws/wrapper/beans/
>> > >
>> > >
>> > >
>> > >
>> > > Nikhil,
>> > >
>> > > I have some issues with the tools and jaxws-tools dependencies
>> > > introduced by this change:
>> > >
>> > > * The change causes a build failure in Hudson. There will also be
>> > > additional issues with tools.jar, because the way to declare this as a
>> > > system dependency varies from one JDK to another. For example, I
>> > > remember that on Mac OS X, it is completely different than on other
>> > > JDKs.
>> > >
>> > > * I don't like the fact that jaxws-tools becomes a dependency of
>> > > axis2-jaxws in scope compile, because it looks like this is only
>> > > needed during the build and/or during the tests.
>> > >
>> > > I didn't review the change in detail, but wouldn't it be smarter to
>> > > use one of the existing Maven plugins to do the wsgen stuff? They will
>> > > take care of the tools.jar stuff as well.
>> > >
>> > > Andreas
>> > >
>> > > On Tue, Jul 13, 2010 at 00:16, <nt...@apache.org> wrote:
>> > > > Author: nthaker
>> > > > Date: Mon Jul 12 22:16:54 2010
>> > > > New Revision: 963508
>> > > >
>> > > > URL: http://svn.apache.org/viewvc?rev=963508&view=rev
>> > > > Log:
>> > > > AXIS2-4775
>> > > > This change ensures that we will use Request and Response wrapper Bean packaged by customer or we will Generate Wrappers if they are not packaged.
>> > > >
>> > > > Added:
>> > > > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/
>> > > > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/
>> > > > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
>> > > > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
>> > > > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
>> > > > axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml
>> > > > Modified:
>> > > > axis/axis2/java/core/trunk/modules/jaxws/pom.xml
>> > > > axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
>> > > >
>> > > > Modified: axis/axis2/java/core/trunk/modules/jaxws/pom.xml
>> > > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/pom.xml?rev=963508&r1=963507&r2=963508&view=diff
>> > > > ==============================================================================
>> > > > --- axis/axis2/java/core/trunk/modules/jaxws/pom.xml (original)
>> > > > +++ axis/axis2/java/core/trunk/modules/jaxws/pom.xml Mon Jul 12 22:16:54 2010
>> > > > @@ -1,5 +1,4 @@
>> > > > <?xml version="1.0" encoding="UTF-8"?>
>> > > > -
>> > > > <!-- > ~ Licensed to the Apache Software Foundation (ASF) under one
>> > > > ~ or more contributor license agreements. See the NOTICE file
>> > > > @@ -20,7 +19,7 @@
>> > > > -->
>> > > >
>> > > > <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> > > > - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
>> > > > + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
>> > > > <modelVersion>4.0.0</modelVersion>
>> > > > <parent>
>> > > > <groupId>org.apache.axis2</groupId>
>> > > > @@ -98,7 +97,25 @@
>> > > > <version>${version}</version>
>> > > > <scope>test</scope>
>> > > > </dependency>
>> > > > + <dependency>
>> > > > + <groupId>wsdl4j</groupId>
>> > > > + <artifactId>wsdl4j</artifactId>
>> > > > + </dependency>
>> > > > + <dependency>
>> > > > + <groupId>com.sun.xml.ws</groupId>
>> > > > + <artifactId>jaxws-tools</artifactId>
>> > > > + <version>2.1.3</version>
>> > > > + </dependency>
>> > > > + <!-- If we dont include tools.jar as dependency, maven throws NoClassDefFound on wsGen run -->
>> > > > + <dependency>
>> > > > + <groupId>java</groupId>
>> > > > + <artifactId>tools</artifactId>
>> > > > + <version>$version</version>
>> > > > + <scope>system</scope>
>> > > > + <systemPath>${JAVA_HOME}/lib/tools.jar</systemPath>
>> > > > + </dependency>
>> > > > </dependencies>
>> > > > +
>> > > > <build>
>> > > > <sourceDirectory>src</sourceDirectory>
>> > > > <testSourceDirectory>test</testSourceDirectory>
>> > > > @@ -203,34 +220,39 @@
>> > > > <compilerVersion>1.5</compilerVersion>
>> > > > <source>1.5</source>
>> > > > <target>1.5</target>
>> > > > +
>> > > > </configuration>
>> > > > </plugin>
>> > > > <plugin>
>> > > > <groupId>org.apache.maven.plugins</groupId>
>> > > > <artifactId>maven-antrun-plugin</artifactId>
>> > > > +
>> > > > <executions>
>> > > > <execution>
>> > > > <id>gen-ts</id>
>> > > > <phase>generate-test-sources</phase>
>> > > > <configuration>
>> > > > - <tasks unless="maven.test.skip">
>> > > > + <tasks unless="maven.test.skip">
>> > > > <!-- Theres got to be a better way to do this -->
>> > > > <property name="schema.source.dir" value="test-resources/xsd"/>
>> > > > <property name="wsdl.source.dir" value="test-resources/wsdl"/>
>> > > > - <property name="schema.output.base.dir" value="target/schema"/>
>> > > > + <property name="schema.output.base.dir" value="target/schema"/>
>> > > > <property name="schema.generated.src.dir" value="${schema.output.base.dir}/src"/>
>> > > > <property name="schema.generated.classes.dir"
>> > > > value="${schema.output.base.dir}/classes"/>
>> > > > +
>> > > > <!-- make the dirs -->
>> > > > <mkdir dir="${schema.output.base.dir}"/>
>> > > > <mkdir dir="${schema.generated.src.dir}"/>
>> > > > <mkdir dir="${schema.generated.classes.dir}"/>
>> > > > +
>> > > > <!-- Run JAXB schema compiler with designated schemas -->
>> > > > <echo>Generating JAX-B classes from XSDs</echo>
>> > > >
>> > > > <echo>Generating java from echo.xsd</echo>
>> > > > <java classname="com.sun.tools.xjc.Driver" fork="true">
>> > > > <classpath refid="maven.runtime.classpath"/>
>> > > > +
>> > > > <classpath location="${compiled.classes.dir}"/>
>> > > > <arg line="-d ${schema.generated.src.dir} -quiet ${schema.source.dir}/echo.xsd"/>
>> > > > </java>
>> > > > @@ -266,7 +288,7 @@
>> > > > <classpath refid="maven.runtime.classpath"/>
>> > > > <classpath location="${compiled.classes.dir}"/>
>> > > > <arg line="-d ${schema.generated.src.dir} -quiet -wsdl ${wsdl.source.dir}/AddNumbers.wsdl"/>
>> > > > - </java>
>> > > > + </java>
>> > > > </tasks>
>> > > > </configuration>
>> > > > <goals>
>> > > > @@ -287,6 +309,22 @@
>> > > > <property name="addressing_version" value="${version}"/>
>> > > > <ant antfile="build.xml" inheritall="true" inheritrefs="true"
>> > > > dir="." target="build-repo"/>
>> > > > +
>> > > > + <property name="compile_classpath" refid="maven.compile.classpath" />
>> > > > + <property name="runtime_classpath" refid="maven.runtime.classpath" />
>> > > > + <property name="test_classpath" refid="maven.test.classpath" />
>> > > > + <property name="plugin_classpath" refid="maven.plugin.classpath" />
>> > > > +
>> > > > + <!-- Defining wsGen task -->
>> > > > + <taskdef name="wsgen" loaderRef="refwsgen" classname="com.sun.tools.ws.ant.WsGen">
>> > > > + <classpath>
>> > > > + <path refid="maven.runtime.classpath" />
>> > > > + <path refid="maven.compile.classpath" />
>> > > > + </classpath>
>> > > > + </taskdef>
>> > > > + <!-- Invoking test cases that need to generate artifacts using wsGen -->
>> > > > + <ant antfile="wsgen-tests.xml" inheritall="true" inheritrefs="true"
>> > > > + dir="." target="run-wsgen-tests"/>
>> > > > </tasks>
>> > > > </configuration>
>> > > > <goals>
>> > > > @@ -374,6 +412,13 @@
>> > > > <plugin>
>> > > > <groupId>org.apache.maven.plugins</groupId>
>> > > > <artifactId>maven-surefire-report-plugin</artifactId>
>> > > > + <reportSets>
>> > > > + <reportSet>
>> > > > + <reports>
>> > > > + <report>report-only</report>
>> > > > + </reports>
>> > > > + </reportSet>
>> > > > + </reportSets>
>> > > > </plugin>
>> > > > </plugins>
>> > > > </reporting>
>> > > >
>> > > > Modified: axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
>> > > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java?rev=963508&r1=963507&r2=963508&view=diff
>> > > > ==============================================================================
>> > > > --- axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java (original)
>> > > > +++ axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java Mon Jul 12 22:16:54 2010
>> > > > @@ -238,12 +238,27 @@ class ArtifactProcessor {
>> > > > wrapperClass = newValue;
>> > > > }
>> > > > }
>> > > > - if(cls==null && (type.equals("@WebFault")|| type.equals("faultInfo"))){
>> > > > +
>> > > > + if(cls==null &&
>> > > > + (type.equals("@RequestWrapper")|| type.equals("@ResponseWrapper")||type.equals("@WebFault")|| type.equals("faultInfo"))){
>> > > > +
>> > > > + //Support for Fault Bean Generation
>> > > > //As per JAX-WS 2.2 Specification section 3.7 an application programmer can choose not to
>> > > > //package the faultBeans, if we have reached this point in the code then user has choosen
>> > > > //not to package the fault bean. If there is a cache of generated artifacts available then
>> > > > //lets look for the missing faultBean there.
>> > > > -
>> > > > +
>> > > > + //Support for Wrapper Bean Generation
>> > > > + //As per JAX-WS 2.2 Specificaiton section 3.6.2.1 pg 41 an application programmer does not use
>> > > > + //the wrapper bean classes, so the application need not package these classes. If we have reached
>> > > > + //this point in the code then user has choosen not to package these beans.
>> > > > +
>> > > > + //NOTE:If we find Generated artifacts from cache this guarantees that we will not use
>> > > > + //DocLitWrappedMinimum marshaller code. The advantage of normal DocLitWrappedMarshaller is
>> > > > + //that it is very robust and has support of lot more datatypes than in DocLitWrappedMinimum.
>> > > > + if(log.isDebugEnabled()){
>> > > > + log.debug("Adding cache to classpath");
>> > > > + }
>> > > > ClassFinderFactory cff =
>> > > > (ClassFinderFactory)FactoryRegistry.getFactory(ClassFinderFactory.class);
>> > > > ClassFinder cf = cff.getClassFinder();
>> > > > @@ -317,11 +332,26 @@ class ArtifactProcessor {
>> > > > if (cls2 == null) {
>> > > > cls2 = loadClassOrNull(defaultValue, altClassLoader);
>> > > > }
>> > > > - if(cls2==null && (type.equals("faultInfo")|| type.equals("@WebFault"))){
>> > > > - //As per JAX-WS 2.2 Specification section 3.7 an application programmer can choose not to
>> > > > - //package the faultBeans, if we have reached this point in the code then user has choosen
>> > > > - //not to package the fault bean. If there is a cache of generated artifacts available then
>> > > > - //lets look for the missing faultBean there.
>> > > > + if(cls2==null &&
>> > > > + (type.equals("@RequestWrapper")|| type.equals("@ResponseWrapper")||type.equals("@WebFault")|| type.equals("faultInfo"))){
>> > > > +
>> > > > + //Support for Fault Bean Generation
>> > > > + //As per JAX-WS 2.2 Specification section 3.7 an application programmer can choose not to
>> > > > + //package the faultBeans, if we have reached this point in the code then user has choosen
>> > > > + //not to package the fault bean. If there is a cache of generated artifacts available then
>> > > > + //lets look for the missing faultBean there.
>> > > > +
>> > > > + //Support for Wrapper Bean Generation
>> > > > + //As per JAX-WS 2.2 Specificaiton section 3.6.2.1 pg 41 an application programmer does not use
>> > > > + //the wrapper bean classes, so the application need not package these classes. If we have reached
>> > > > + //this point in the code then user has choosen not to package these beans.
>> > > > +
>> > > > + //NOTE:If we find Generated artifacts from cache this guarantees that we will not use
>> > > > + //DocLitWrappedMinimum marshaller code. The advantage of normal DocLitWrappedMarshaller is
>> > > > + //that it is very robust and has support of lot more datatypes than in DocLitWrappedMinimum.
>> > > > + if(log.isDebugEnabled()){
>> > > > + log.debug("Adding cache to classpath");
>> > > > + }
>> > > > if(log.isDebugEnabled()){
>> > > > log.debug("Adding cache to classpath");
>> > > > }
>> > > >
>> > > > Added: axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
>> > > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java?rev=963508&view=auto
>> > > > ==============================================================================
>> > > > --- axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java (added)
>> > > > +++ axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java Mon Jul 12 22:16:54 2010
>> > > > @@ -0,0 +1,18 @@
>> > > > +
>> > > > +package org.apache.axis2.jaxws.wrapper.beans;
>> > > > +
>> > > > +import javax.xml.ws.WebFault;
>> > > > +
>> > > > +@WebFault(name = "AddNumbersFault", targetNamespace = "http://org/test/addnumbers")
>> > > > +public class AddNumbersException extends Exception
>> > > > +{
>> > > > +
>> > > > + private String message = null;
>> > > > + public AddNumbersException(){}
>> > > > + public AddNumbersException(String message){
>> > > > + this.message = message;
>> > > > + }
>> > > > + public String getInfo(){
>> > > > + return message;
>> > > > + }
>> > > > +}
>> > > >
>> > > > Added: axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
>> > > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java?rev=963508&view=auto
>> > > > ==============================================================================
>> > > > --- axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java (added)
>> > > > +++ axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java Mon Jul 12 22:16:54 2010
>> > > > @@ -0,0 +1,15 @@
>> > > > +package org.apache.axis2.jaxws.wrapper.beans;
>> > > > +
>> > > > +
>> > > > +
>> > > > +@javax.jws.WebService (targetNamespace="http://org/test/addnumbers", serviceName="AddNumbersService", portName="AddNumbersPort")
>> > > > +public class AddNumbersService{
>> > > > +
>> > > > + public int addNumbers(int arg0, int arg1) throws AddNumbersException {
>> > > > + if(arg0+arg1<0){
>> > > > + throw new AddNumbersException("sum is less than 0");
>> > > > + }
>> > > > + return arg0+arg1;
>> > > > + }
>> > > > +
>> > > > +}
>> > > > \ No newline at end of file
>> > > >
>> > > > Added: axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
>> > > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java?rev=963508&view=auto
>> > > > ==============================================================================
>> > > > --- axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java (added)
>> > > > +++ axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java Mon Jul 12 22:16:54 2010
>> > > > @@ -0,0 +1,114 @@
>> > > > +/**
>> > > > + *
>> > > > + */
>> > > > +package org.apache.axis2.jaxws.wrapper.beans;
>> > > > +
>> > > > +
>> > > > +import org.apache.axis2.jaxws.Constants;
>> > > > +import org.apache.axis2.jaxws.description.DescriptionFactory;
>> > > > +import org.apache.axis2.jaxws.description.EndpointDescription;
>> > > > +import org.apache.axis2.jaxws.description.EndpointDescriptionJava;
>> > > > +import org.apache.axis2.jaxws.description.OperationDescription;
>> > > > +import org.apache.axis2.jaxws.description.ServiceDescription;
>> > > > +import org.apache.axis2.jaxws.marshaller.MethodMarshaller;
>> > > > +import org.apache.axis2.jaxws.marshaller.factory.MethodMarshallerFactory;
>> > > > +import org.apache.axis2.jaxws.marshaller.impl.alt.DocLitWrappedMinimalMethodMarshaller;
>> > > > +import org.apache.axis2.jaxws.unitTest.TestLogger;
>> > > > +
>> > > > +import java.io.File;
>> > > > +
>> > > > +import junit.framework.TestCase;
>> > > > +
>> > > > +public class WrapperBeanMarshallTests extends TestCase {
>> > > > + /**
>> > > > + * This is the negative test case, when we do not use generated artifacts from cache
>> > > > + * and user did not package wrapper beans, we should see use of DocLitWrappedMinumumMarshaller.
>> > > > + */
>> > > > + public void testGetMarshallerOperationDescriptionBooleanNegative() {
>> > > > + TestLogger.logger.debug("---------------------------------------");
>> > > > + TestLogger.logger.debug("test: " + getName());
>> > > > +
>> > > > + String cache_location = "/target/wscache/classes";
>> > > > + try{
>> > > > + String baseDir = new File(System.getProperty("basedir",".")).getCanonicalPath();
>> > > > + cache_location = new File(baseDir+cache_location).getAbsolutePath();
>> > > > + TestLogger.logger.debug("cache location ="+cache_location);
>> > > > +
>> > > > + //Get EndpointDescription.
>> > > > + //Set location on AxisConfiguraiton.
>> > > > + Class sei = AddNumbersService.class;
>> > > > + EndpointDescription description = getEndpointDesc(sei);
>> > > > + TestLogger.logger.debug("description objects where created successfully");
>> > > > + OperationDescription[] ops =description.getEndpointInterfaceDescription().getOperations();
>> > > > + assertNotNull( "OperationDescriptions where null", ops);
>> > > > + assertTrue("No Operation Descriptions where found", ops.length>0);
>> > > > + OperationDescription op = ops[0];
>> > > > + TestLogger.logger.debug("operation found, java methodName="+op.getJavaMethodName());
>> > > > + //Don not Set cache on AxisConfiguration.
>> > > > + //get Marshaller, verify its not DoclitWrappedMinimum.
>> > > > + TestLogger.logger.debug("ws_cache location NOT set on AxisConfigContext, location="+cache_location);
>> > > > + MethodMarshaller mm = MethodMarshallerFactory.getMarshaller(op, false);
>> > > > + assertNotNull("getMarshaller returned null", mm );
>> > > > + TestLogger.logger.debug("MethodMarshaller was created, type="+mm.getClass().getName());
>> > > > + assertTrue("Generated artifacts not found, Method marshaller should be DocLitWrappedMinimumMarshaller", (mm instanceof DocLitWrappedMinimalMethodMarshaller));
>> > > > + }catch(Exception e){
>> > > > + TestLogger.logger.debug("Exception ="+e.getMessage());
>> > > > + fail(e.getMessage());
>> > > > + }
>> > > > +
>> > > > + }
>> > > > + /**
>> > > > + * In this test case user did not package wrapper beans but we add generated artifacts from cache, we should see use of
>> > > > + * DocLitWrappedMarshaller.
>> > > > + * Test method for {@link org.apache.axis2.jaxws.marshaller.factory.MethodMarshallerFactory#getMarshaller(org.apache.axis2.jaxws.description.OperationDescription, boolean)}.
>> > > > + */
>> > > > + public void testGetMarshallerOperationDescriptionBoolean() {
>> > > > + TestLogger.logger.debug("---------------------------------------");
>> > > > + TestLogger.logger.debug("test: " + getName());
>> > > > +
>> > > > + String cache_location = "/target/wscache/classes";
>> > > > + try{
>> > > > + String baseDir = new File(System.getProperty("basedir",".")).getCanonicalPath();
>> > > > + cache_location = new File(baseDir+cache_location).getAbsolutePath();
>> > > > + TestLogger.logger.debug("cache location ="+cache_location);
>> > > > +
>> > > > + //Get EndpointDescription.
>> > > > + //Set location on AxisConfiguraiton.
>> > > > + Class sei = AddNumbersService.class;
>> > > > + EndpointDescription description = getEndpointDesc(sei);
>> > > > + TestLogger.logger.debug("description objects where created successfully");
>> > > > + OperationDescription[] ops =description.getEndpointInterfaceDescription().getOperations();
>> > > > + assertNotNull( "OperationDescriptions where null", ops);
>> > > > + assertTrue("No Operation Descriptions where found", ops.length>0);
>> > > > + OperationDescription op = ops[0];
>> > > > + TestLogger.logger.debug("operation found, java methodName="+op.getJavaMethodName());
>> > > > + //Set cache on AxisConfiguration.
>> > > > + //get Marshaller, verify its not DoclitWrappedMinimum.
>> > > > + description.getServiceDescription().getAxisConfigContext().setProperty(Constants.WS_CACHE, cache_location);
>> > > > + TestLogger.logger.debug("ws_cache location set on AxisConfigContext, location="+cache_location);
>> > > > + MethodMarshaller mm = MethodMarshallerFactory.getMarshaller(op, false);
>> > > > + assertNotNull("getMarshaller returned null", mm );
>> > > > + TestLogger.logger.debug("MethodMarshaller was created, type="+mm.getClass().getName());
>> > > > + assertTrue("Generated artifacts are in cache, Method marshaller should not be DocLitWrappedMinimumMarshaller", !(mm instanceof DocLitWrappedMinimalMethodMarshaller));
>> > > > + }catch(Exception e){
>> > > > + TestLogger.logger.debug("Exception ="+e.getMessage());
>> > > > + fail(e.getMessage());
>> > > > + }
>> > > > +
>> > > > + }
>> > > > +
>> > > > + private EndpointDescription getEndpointDesc(Class implementationClass) {
>> > > > + // Use the description factory directly; this will be done within the JAX-WS runtime
>> > > > + ServiceDescription serviceDesc =
>> > > > + DescriptionFactory.createServiceDescription(implementationClass);
>> > > > + assertNotNull(serviceDesc);
>> > > > +
>> > > > + EndpointDescription[] endpointDesc = serviceDesc.getEndpointDescriptions();
>> > > > + assertNotNull(endpointDesc);
>> > > > + assertEquals(1, endpointDesc.length);
>> > > > +
>> > > > + // TODO: How will the JAX-WS dispatcher get the appropriate port (i.e. endpoint)? Currently assumes [0]
>> > > > + EndpointDescription testEndpointDesc = endpointDesc[0];
>> > > > + return testEndpointDesc;
>> > > > + }
>> > > > +}
>> > > >
>> > > > Added: axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml
>> > > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml?rev=963508&view=auto
>> > > > ==============================================================================
>> > > > --- axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml (added)
>> > > > +++ axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml Mon Jul 12 22:16:54 2010
>> > > > @@ -0,0 +1,34 @@
>> > > > +<?xml version="1.0" encoding="UTF-8"?>
>> > > > +
>> > > > +<project basedir="." default="run-wsgen-tests" name="wsgen-tests">
>> > > > +
>> > > > + <property name="wscache.output.base.dir" value="target/wscache" />
>> > > > + <property name="wscache.generated.src.dir" value="${wscache.output.base.dir}/src" />
>> > > > + <property name="wscache.generated.classes.dir" value="${wscache.output.base.dir}/classes" />
>> > > > + <property name="compile.test.classes" value="target/test-classes" />
>> > > > +
>> > > > +
>> > > > + <target name="run-wsgen-tests" depends="wrapper-beans"/>
>> > > > +
>> > > > +
>> > > > + <target name="create-cache">
>> > > > + <mkdir dir="${wscache.output.base.dir}" />
>> > > > + <mkdir dir="${wscache.generated.src.dir}" />
>> > > > + <mkdir dir="${wscache.generated.classes.dir}" />
>> > > > + </target>
>> > > > +
>> > > > + <target name="wrapper-beans" depends="create-cache">
>> > > > + <echo>Generating artifacts for org.apache.axis2.jaxws.wrapper.beans.AddNumbersService </echo>
>> > > > + <wsgen
>> > > > + sei="org.apache.axis2.jaxws.wrapper.beans.AddNumbersService"
>> > > > + destdir="${wscache.generated.classes.dir}"
>> > > > + resourcedestdir="${wscache.generated.src.dir}"
>> > > > + keep="false"
>> > > > + verbose="false"
>> > > > + genwsdl="true">
>> > > > + <classpath>
>> > > > + <pathelement path="${compile.test.classes}" />
>> > > > + </classpath>
>> > > > + </wsgen>
>> > > > + </target>
>> > > > +</project>
>> > > > \ No newline at end of file
>> > > >
>> > > >
>> > > >
>> > >
>> > > ---------------------------------------------------------------------
>> > > To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
>> > > For additional commands, e-mail: java-dev-help@axis.apache.org
>> > >
>> > >
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
>> > For additional commands, e-mail: java-dev-help@axis.apache.org
>> >
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
>> For additional commands, e-mail: java-dev-help@axis.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-dev-help@axis.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org
Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws:
./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/
test/org/apache/axis2/jaxws/wrapper/ test/org/apache/axis2/jaxws/wrapper/beans/
Posted by Jarek Gawor <jg...@gmail.com>.
Nikhil,
I don't think there is an objection for adding jaxws-tools as a _test_
dependency. So as long you add the jaxws-tools dependency with
<scope>test</scope> there shouldn't be a problem.
Jarek
On Wed, Jul 14, 2010 at 10:40 PM, Nikhil V Thaker
<ni...@us.ibm.com> wrote:
>
> Thanks Jarek for the suggestion.
>
> The fact that there is an objection to putting jaxws-tools.jar as a dependency would mean we cannot run wsGen. Unless I misunderstood Andreas comments. To me we should always have jaxws-tools as dependency to jaxws module, after all jaxws tools are prerequisite to jaxws runtime, a user of jaxws runtime has to run wsGen or wsImport to build webservices application.
>
> Anyways, I will look and see if there is an alternate way to add these test cases.
>
> Regards,
>
> Nikhil Thaker
> office: 919 254 9964
> nvthaker@us.ibm.com
>
>
> Jarek Gawor <jg...@gmail.com>
>
> 07/14/2010 03:38 PM
>
> Please respond to
> java-dev@axis.apache.org
> To
> java-dev@axis.apache.org
> cc
> Subject
> Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws: ./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ test/org/apache/axis2/jaxws/wrapper/ test/org/apache/axis2/jaxws/wrapper/beans/
>
>
>
>
> Just a couple of thoughts:
>
> 1) Since you already have wsgen-tests.xml ant script to run the wsgen
> you could setup the appropriate classpath to the tools.jar or
> classes.jar or whatever in it. You just might need to fork the ant
> process.
>
> 2) I don't think it's that horrible to commit some generate code
> especially if there isn't too much of it and the test case is
> important. Besides, Axis2 already has some generated code checked it.
>
> Jarek
>
> On Wed, Jul 14, 2010 at 4:00 PM, Nikhil V Thaker
> <ni...@us.ibm.com> wrote:
> >
> > Yes Andreas,
> > I am running antrun plugin as the wsGen plugin has errors and is not fully matured, here's the URL that explains the issue I ran into http://jira.codehaus.org/browse/MNG-3586.
> >
> > So since I cannot run wsGen or cannot include generated artifacts I will just remove the test case. I will commit the changes soon.
> >
> > Regards,
> >
> > Nikhil Thaker
> > office: 919 254 9964
> > nvthaker@us.ibm.com
> >
> >
> > Andreas Veithen <an...@gmail.com>
> >
> > 07/14/2010 02:48 PM
> >
> > Please respond to
> > java-dev@axis.apache.org
> > To
> > java-dev@axis.apache.org
> > cc
> > Subject
> > Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws: ./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ test/org/apache/axis2/jaxws/wrapper/ test/org/apache/axis2/jaxws/wrapper/beans/
> >
> >
> >
> >
> > No, you are using the antrun plugin to execute the wsgen ant task.
> > What I meant was to use a real Maven plugin (either the one from
> > java.net or the one from CXF).
> >
> > -1 to commit any generated stuff into SVN.
> >
> > Andreas
> >
> > On Wed, Jul 14, 2010 at 21:42, Nikhil V Thaker
> > <ni...@us.ibm.com> wrote:
> > >
> > > Andreas - I had to add the tools.jar bit because maven plugin for wsGen gave NoClassDef Found errors for classes packaged in tools.jar.
> > >
> > > Since this is causing a problem I will just package the generated artifacts and remove the wsGen dependency.
> > >
> > > Thanks,
> > >
> > > Nikhil Thaker
> > > office: 919 254 9964
> > > nvthaker@us.ibm.com
> > >
> > >
> > > Andreas Veithen <an...@gmail.com>
> > >
> > > 07/14/2010 01:44 PM
> > >
> > > Please respond to
> > > java-dev@axis.apache.org
> > > To
> > > java-dev@axis.apache.org
> > > cc
> > > Subject
> > > Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws: ./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ test/org/apache/axis2/jaxws/wrapper/ test/org/apache/axis2/jaxws/wrapper/beans/
> > >
> > >
> > >
> > >
> > > Nikhil,
> > >
> > > I have some issues with the tools and jaxws-tools dependencies
> > > introduced by this change:
> > >
> > > * The change causes a build failure in Hudson. There will also be
> > > additional issues with tools.jar, because the way to declare this as a
> > > system dependency varies from one JDK to another. For example, I
> > > remember that on Mac OS X, it is completely different than on other
> > > JDKs.
> > >
> > > * I don't like the fact that jaxws-tools becomes a dependency of
> > > axis2-jaxws in scope compile, because it looks like this is only
> > > needed during the build and/or during the tests.
> > >
> > > I didn't review the change in detail, but wouldn't it be smarter to
> > > use one of the existing Maven plugins to do the wsgen stuff? They will
> > > take care of the tools.jar stuff as well.
> > >
> > > Andreas
> > >
> > > On Tue, Jul 13, 2010 at 00:16, <nt...@apache.org> wrote:
> > > > Author: nthaker
> > > > Date: Mon Jul 12 22:16:54 2010
> > > > New Revision: 963508
> > > >
> > > > URL: http://svn.apache.org/viewvc?rev=963508&view=rev
> > > > Log:
> > > > AXIS2-4775
> > > > This change ensures that we will use Request and Response wrapper Bean packaged by customer or we will Generate Wrappers if they are not packaged.
> > > >
> > > > Added:
> > > > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/
> > > > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/
> > > > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
> > > > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
> > > > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
> > > > axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml
> > > > Modified:
> > > > axis/axis2/java/core/trunk/modules/jaxws/pom.xml
> > > > axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
> > > >
> > > > Modified: axis/axis2/java/core/trunk/modules/jaxws/pom.xml
> > > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/pom.xml?rev=963508&r1=963507&r2=963508&view=diff
> > > > ==============================================================================
> > > > --- axis/axis2/java/core/trunk/modules/jaxws/pom.xml (original)
> > > > +++ axis/axis2/java/core/trunk/modules/jaxws/pom.xml Mon Jul 12 22:16:54 2010
> > > > @@ -1,5 +1,4 @@
> > > > <?xml version="1.0" encoding="UTF-8"?>
> > > > -
> > > > <!-- > ~ Licensed to the Apache Software Foundation (ASF) under one
> > > > ~ or more contributor license agreements. See the NOTICE file
> > > > @@ -20,7 +19,7 @@
> > > > -->
> > > >
> > > > <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> > > > - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
> > > > + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
> > > > <modelVersion>4.0.0</modelVersion>
> > > > <parent>
> > > > <groupId>org.apache.axis2</groupId>
> > > > @@ -98,7 +97,25 @@
> > > > <version>${version}</version>
> > > > <scope>test</scope>
> > > > </dependency>
> > > > + <dependency>
> > > > + <groupId>wsdl4j</groupId>
> > > > + <artifactId>wsdl4j</artifactId>
> > > > + </dependency>
> > > > + <dependency>
> > > > + <groupId>com.sun.xml.ws</groupId>
> > > > + <artifactId>jaxws-tools</artifactId>
> > > > + <version>2.1.3</version>
> > > > + </dependency>
> > > > + <!-- If we dont include tools.jar as dependency, maven throws NoClassDefFound on wsGen run -->
> > > > + <dependency>
> > > > + <groupId>java</groupId>
> > > > + <artifactId>tools</artifactId>
> > > > + <version>$version</version>
> > > > + <scope>system</scope>
> > > > + <systemPath>${JAVA_HOME}/lib/tools.jar</systemPath>
> > > > + </dependency>
> > > > </dependencies>
> > > > +
> > > > <build>
> > > > <sourceDirectory>src</sourceDirectory>
> > > > <testSourceDirectory>test</testSourceDirectory>
> > > > @@ -203,34 +220,39 @@
> > > > <compilerVersion>1.5</compilerVersion>
> > > > <source>1.5</source>
> > > > <target>1.5</target>
> > > > +
> > > > </configuration>
> > > > </plugin>
> > > > <plugin>
> > > > <groupId>org.apache.maven.plugins</groupId>
> > > > <artifactId>maven-antrun-plugin</artifactId>
> > > > +
> > > > <executions>
> > > > <execution>
> > > > <id>gen-ts</id>
> > > > <phase>generate-test-sources</phase>
> > > > <configuration>
> > > > - <tasks unless="maven.test.skip">
> > > > + <tasks unless="maven.test.skip">
> > > > <!-- Theres got to be a better way to do this -->
> > > > <property name="schema.source.dir" value="test-resources/xsd"/>
> > > > <property name="wsdl.source.dir" value="test-resources/wsdl"/>
> > > > - <property name="schema.output.base.dir" value="target/schema"/>
> > > > + <property name="schema.output.base.dir" value="target/schema"/>
> > > > <property name="schema.generated.src.dir" value="${schema.output.base.dir}/src"/>
> > > > <property name="schema.generated.classes.dir"
> > > > value="${schema.output.base.dir}/classes"/>
> > > > +
> > > > <!-- make the dirs -->
> > > > <mkdir dir="${schema.output.base.dir}"/>
> > > > <mkdir dir="${schema.generated.src.dir}"/>
> > > > <mkdir dir="${schema.generated.classes.dir}"/>
> > > > +
> > > > <!-- Run JAXB schema compiler with designated schemas -->
> > > > <echo>Generating JAX-B classes from XSDs</echo>
> > > >
> > > > <echo>Generating java from echo.xsd</echo>
> > > > <java classname="com.sun.tools.xjc.Driver" fork="true">
> > > > <classpath refid="maven.runtime.classpath"/>
> > > > +
> > > > <classpath location="${compiled.classes.dir}"/>
> > > > <arg line="-d ${schema.generated.src.dir} -quiet ${schema.source.dir}/echo.xsd"/>
> > > > </java>
> > > > @@ -266,7 +288,7 @@
> > > > <classpath refid="maven.runtime.classpath"/>
> > > > <classpath location="${compiled.classes.dir}"/>
> > > > <arg line="-d ${schema.generated.src.dir} -quiet -wsdl ${wsdl.source.dir}/AddNumbers.wsdl"/>
> > > > - </java>
> > > > + </java>
> > > > </tasks>
> > > > </configuration>
> > > > <goals>
> > > > @@ -287,6 +309,22 @@
> > > > <property name="addressing_version" value="${version}"/>
> > > > <ant antfile="build.xml" inheritall="true" inheritrefs="true"
> > > > dir="." target="build-repo"/>
> > > > +
> > > > + <property name="compile_classpath" refid="maven.compile.classpath" />
> > > > + <property name="runtime_classpath" refid="maven.runtime.classpath" />
> > > > + <property name="test_classpath" refid="maven.test.classpath" />
> > > > + <property name="plugin_classpath" refid="maven.plugin.classpath" />
> > > > +
> > > > + <!-- Defining wsGen task -->
> > > > + <taskdef name="wsgen" loaderRef="refwsgen" classname="com.sun.tools.ws.ant.WsGen">
> > > > + <classpath>
> > > > + <path refid="maven.runtime.classpath" />
> > > > + <path refid="maven.compile.classpath" />
> > > > + </classpath>
> > > > + </taskdef>
> > > > + <!-- Invoking test cases that need to generate artifacts using wsGen -->
> > > > + <ant antfile="wsgen-tests.xml" inheritall="true" inheritrefs="true"
> > > > + dir="." target="run-wsgen-tests"/>
> > > > </tasks>
> > > > </configuration>
> > > > <goals>
> > > > @@ -374,6 +412,13 @@
> > > > <plugin>
> > > > <groupId>org.apache.maven.plugins</groupId>
> > > > <artifactId>maven-surefire-report-plugin</artifactId>
> > > > + <reportSets>
> > > > + <reportSet>
> > > > + <reports>
> > > > + <report>report-only</report>
> > > > + </reports>
> > > > + </reportSet>
> > > > + </reportSets>
> > > > </plugin>
> > > > </plugins>
> > > > </reporting>
> > > >
> > > > Modified: axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
> > > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java?rev=963508&r1=963507&r2=963508&view=diff
> > > > ==============================================================================
> > > > --- axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java (original)
> > > > +++ axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java Mon Jul 12 22:16:54 2010
> > > > @@ -238,12 +238,27 @@ class ArtifactProcessor {
> > > > wrapperClass = newValue;
> > > > }
> > > > }
> > > > - if(cls==null && (type.equals("@WebFault")|| type.equals("faultInfo"))){
> > > > +
> > > > + if(cls==null &&
> > > > + (type.equals("@RequestWrapper")|| type.equals("@ResponseWrapper")||type.equals("@WebFault")|| type.equals("faultInfo"))){
> > > > +
> > > > + //Support for Fault Bean Generation
> > > > //As per JAX-WS 2.2 Specification section 3.7 an application programmer can choose not to
> > > > //package the faultBeans, if we have reached this point in the code then user has choosen
> > > > //not to package the fault bean. If there is a cache of generated artifacts available then
> > > > //lets look for the missing faultBean there.
> > > > -
> > > > +
> > > > + //Support for Wrapper Bean Generation
> > > > + //As per JAX-WS 2.2 Specificaiton section 3.6.2.1 pg 41 an application programmer does not use
> > > > + //the wrapper bean classes, so the application need not package these classes. If we have reached
> > > > + //this point in the code then user has choosen not to package these beans.
> > > > +
> > > > + //NOTE:If we find Generated artifacts from cache this guarantees that we will not use
> > > > + //DocLitWrappedMinimum marshaller code. The advantage of normal DocLitWrappedMarshaller is
> > > > + //that it is very robust and has support of lot more datatypes than in DocLitWrappedMinimum.
> > > > + if(log.isDebugEnabled()){
> > > > + log.debug("Adding cache to classpath");
> > > > + }
> > > > ClassFinderFactory cff =
> > > > (ClassFinderFactory)FactoryRegistry.getFactory(ClassFinderFactory.class);
> > > > ClassFinder cf = cff.getClassFinder();
> > > > @@ -317,11 +332,26 @@ class ArtifactProcessor {
> > > > if (cls2 == null) {
> > > > cls2 = loadClassOrNull(defaultValue, altClassLoader);
> > > > }
> > > > - if(cls2==null && (type.equals("faultInfo")|| type.equals("@WebFault"))){
> > > > - //As per JAX-WS 2.2 Specification section 3.7 an application programmer can choose not to
> > > > - //package the faultBeans, if we have reached this point in the code then user has choosen
> > > > - //not to package the fault bean. If there is a cache of generated artifacts available then
> > > > - //lets look for the missing faultBean there.
> > > > + if(cls2==null &&
> > > > + (type.equals("@RequestWrapper")|| type.equals("@ResponseWrapper")||type.equals("@WebFault")|| type.equals("faultInfo"))){
> > > > +
> > > > + //Support for Fault Bean Generation
> > > > + //As per JAX-WS 2.2 Specification section 3.7 an application programmer can choose not to
> > > > + //package the faultBeans, if we have reached this point in the code then user has choosen
> > > > + //not to package the fault bean. If there is a cache of generated artifacts available then
> > > > + //lets look for the missing faultBean there.
> > > > +
> > > > + //Support for Wrapper Bean Generation
> > > > + //As per JAX-WS 2.2 Specificaiton section 3.6.2.1 pg 41 an application programmer does not use
> > > > + //the wrapper bean classes, so the application need not package these classes. If we have reached
> > > > + //this point in the code then user has choosen not to package these beans.
> > > > +
> > > > + //NOTE:If we find Generated artifacts from cache this guarantees that we will not use
> > > > + //DocLitWrappedMinimum marshaller code. The advantage of normal DocLitWrappedMarshaller is
> > > > + //that it is very robust and has support of lot more datatypes than in DocLitWrappedMinimum.
> > > > + if(log.isDebugEnabled()){
> > > > + log.debug("Adding cache to classpath");
> > > > + }
> > > > if(log.isDebugEnabled()){
> > > > log.debug("Adding cache to classpath");
> > > > }
> > > >
> > > > Added: axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
> > > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java?rev=963508&view=auto
> > > > ==============================================================================
> > > > --- axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java (added)
> > > > +++ axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java Mon Jul 12 22:16:54 2010
> > > > @@ -0,0 +1,18 @@
> > > > +
> > > > +package org.apache.axis2.jaxws.wrapper.beans;
> > > > +
> > > > +import javax.xml.ws.WebFault;
> > > > +
> > > > +@WebFault(name = "AddNumbersFault", targetNamespace = "http://org/test/addnumbers")
> > > > +public class AddNumbersException extends Exception
> > > > +{
> > > > +
> > > > + private String message = null;
> > > > + public AddNumbersException(){}
> > > > + public AddNumbersException(String message){
> > > > + this.message = message;
> > > > + }
> > > > + public String getInfo(){
> > > > + return message;
> > > > + }
> > > > +}
> > > >
> > > > Added: axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
> > > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java?rev=963508&view=auto
> > > > ==============================================================================
> > > > --- axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java (added)
> > > > +++ axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java Mon Jul 12 22:16:54 2010
> > > > @@ -0,0 +1,15 @@
> > > > +package org.apache.axis2.jaxws.wrapper.beans;
> > > > +
> > > > +
> > > > +
> > > > +@javax.jws.WebService (targetNamespace="http://org/test/addnumbers", serviceName="AddNumbersService", portName="AddNumbersPort")
> > > > +public class AddNumbersService{
> > > > +
> > > > + public int addNumbers(int arg0, int arg1) throws AddNumbersException {
> > > > + if(arg0+arg1<0){
> > > > + throw new AddNumbersException("sum is less than 0");
> > > > + }
> > > > + return arg0+arg1;
> > > > + }
> > > > +
> > > > +}
> > > > \ No newline at end of file
> > > >
> > > > Added: axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
> > > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java?rev=963508&view=auto
> > > > ==============================================================================
> > > > --- axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java (added)
> > > > +++ axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java Mon Jul 12 22:16:54 2010
> > > > @@ -0,0 +1,114 @@
> > > > +/**
> > > > + *
> > > > + */
> > > > +package org.apache.axis2.jaxws.wrapper.beans;
> > > > +
> > > > +
> > > > +import org.apache.axis2.jaxws.Constants;
> > > > +import org.apache.axis2.jaxws.description.DescriptionFactory;
> > > > +import org.apache.axis2.jaxws.description.EndpointDescription;
> > > > +import org.apache.axis2.jaxws.description.EndpointDescriptionJava;
> > > > +import org.apache.axis2.jaxws.description.OperationDescription;
> > > > +import org.apache.axis2.jaxws.description.ServiceDescription;
> > > > +import org.apache.axis2.jaxws.marshaller.MethodMarshaller;
> > > > +import org.apache.axis2.jaxws.marshaller.factory.MethodMarshallerFactory;
> > > > +import org.apache.axis2.jaxws.marshaller.impl.alt.DocLitWrappedMinimalMethodMarshaller;
> > > > +import org.apache.axis2.jaxws.unitTest.TestLogger;
> > > > +
> > > > +import java.io.File;
> > > > +
> > > > +import junit.framework.TestCase;
> > > > +
> > > > +public class WrapperBeanMarshallTests extends TestCase {
> > > > + /**
> > > > + * This is the negative test case, when we do not use generated artifacts from cache
> > > > + * and user did not package wrapper beans, we should see use of DocLitWrappedMinumumMarshaller.
> > > > + */
> > > > + public void testGetMarshallerOperationDescriptionBooleanNegative() {
> > > > + TestLogger.logger.debug("---------------------------------------");
> > > > + TestLogger.logger.debug("test: " + getName());
> > > > +
> > > > + String cache_location = "/target/wscache/classes";
> > > > + try{
> > > > + String baseDir = new File(System.getProperty("basedir",".")).getCanonicalPath();
> > > > + cache_location = new File(baseDir+cache_location).getAbsolutePath();
> > > > + TestLogger.logger.debug("cache location ="+cache_location);
> > > > +
> > > > + //Get EndpointDescription.
> > > > + //Set location on AxisConfiguraiton.
> > > > + Class sei = AddNumbersService.class;
> > > > + EndpointDescription description = getEndpointDesc(sei);
> > > > + TestLogger.logger.debug("description objects where created successfully");
> > > > + OperationDescription[] ops =description.getEndpointInterfaceDescription().getOperations();
> > > > + assertNotNull( "OperationDescriptions where null", ops);
> > > > + assertTrue("No Operation Descriptions where found", ops.length>0);
> > > > + OperationDescription op = ops[0];
> > > > + TestLogger.logger.debug("operation found, java methodName="+op.getJavaMethodName());
> > > > + //Don not Set cache on AxisConfiguration.
> > > > + //get Marshaller, verify its not DoclitWrappedMinimum.
> > > > + TestLogger.logger.debug("ws_cache location NOT set on AxisConfigContext, location="+cache_location);
> > > > + MethodMarshaller mm = MethodMarshallerFactory.getMarshaller(op, false);
> > > > + assertNotNull("getMarshaller returned null", mm );
> > > > + TestLogger.logger.debug("MethodMarshaller was created, type="+mm.getClass().getName());
> > > > + assertTrue("Generated artifacts not found, Method marshaller should be DocLitWrappedMinimumMarshaller", (mm instanceof DocLitWrappedMinimalMethodMarshaller));
> > > > + }catch(Exception e){
> > > > + TestLogger.logger.debug("Exception ="+e.getMessage());
> > > > + fail(e.getMessage());
> > > > + }
> > > > +
> > > > + }
> > > > + /**
> > > > + * In this test case user did not package wrapper beans but we add generated artifacts from cache, we should see use of
> > > > + * DocLitWrappedMarshaller.
> > > > + * Test method for {@link org.apache.axis2.jaxws.marshaller.factory.MethodMarshallerFactory#getMarshaller(org.apache.axis2.jaxws.description.OperationDescription, boolean)}.
> > > > + */
> > > > + public void testGetMarshallerOperationDescriptionBoolean() {
> > > > + TestLogger.logger.debug("---------------------------------------");
> > > > + TestLogger.logger.debug("test: " + getName());
> > > > +
> > > > + String cache_location = "/target/wscache/classes";
> > > > + try{
> > > > + String baseDir = new File(System.getProperty("basedir",".")).getCanonicalPath();
> > > > + cache_location = new File(baseDir+cache_location).getAbsolutePath();
> > > > + TestLogger.logger.debug("cache location ="+cache_location);
> > > > +
> > > > + //Get EndpointDescription.
> > > > + //Set location on AxisConfiguraiton.
> > > > + Class sei = AddNumbersService.class;
> > > > + EndpointDescription description = getEndpointDesc(sei);
> > > > + TestLogger.logger.debug("description objects where created successfully");
> > > > + OperationDescription[] ops =description.getEndpointInterfaceDescription().getOperations();
> > > > + assertNotNull( "OperationDescriptions where null", ops);
> > > > + assertTrue("No Operation Descriptions where found", ops.length>0);
> > > > + OperationDescription op = ops[0];
> > > > + TestLogger.logger.debug("operation found, java methodName="+op.getJavaMethodName());
> > > > + //Set cache on AxisConfiguration.
> > > > + //get Marshaller, verify its not DoclitWrappedMinimum.
> > > > + description.getServiceDescription().getAxisConfigContext().setProperty(Constants.WS_CACHE, cache_location);
> > > > + TestLogger.logger.debug("ws_cache location set on AxisConfigContext, location="+cache_location);
> > > > + MethodMarshaller mm = MethodMarshallerFactory.getMarshaller(op, false);
> > > > + assertNotNull("getMarshaller returned null", mm );
> > > > + TestLogger.logger.debug("MethodMarshaller was created, type="+mm.getClass().getName());
> > > > + assertTrue("Generated artifacts are in cache, Method marshaller should not be DocLitWrappedMinimumMarshaller", !(mm instanceof DocLitWrappedMinimalMethodMarshaller));
> > > > + }catch(Exception e){
> > > > + TestLogger.logger.debug("Exception ="+e.getMessage());
> > > > + fail(e.getMessage());
> > > > + }
> > > > +
> > > > + }
> > > > +
> > > > + private EndpointDescription getEndpointDesc(Class implementationClass) {
> > > > + // Use the description factory directly; this will be done within the JAX-WS runtime
> > > > + ServiceDescription serviceDesc =
> > > > + DescriptionFactory.createServiceDescription(implementationClass);
> > > > + assertNotNull(serviceDesc);
> > > > +
> > > > + EndpointDescription[] endpointDesc = serviceDesc.getEndpointDescriptions();
> > > > + assertNotNull(endpointDesc);
> > > > + assertEquals(1, endpointDesc.length);
> > > > +
> > > > + // TODO: How will the JAX-WS dispatcher get the appropriate port (i.e. endpoint)? Currently assumes [0]
> > > > + EndpointDescription testEndpointDesc = endpointDesc[0];
> > > > + return testEndpointDesc;
> > > > + }
> > > > +}
> > > >
> > > > Added: axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml
> > > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml?rev=963508&view=auto
> > > > ==============================================================================
> > > > --- axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml (added)
> > > > +++ axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml Mon Jul 12 22:16:54 2010
> > > > @@ -0,0 +1,34 @@
> > > > +<?xml version="1.0" encoding="UTF-8"?>
> > > > +
> > > > +<project basedir="." default="run-wsgen-tests" name="wsgen-tests">
> > > > +
> > > > + <property name="wscache.output.base.dir" value="target/wscache" />
> > > > + <property name="wscache.generated.src.dir" value="${wscache.output.base.dir}/src" />
> > > > + <property name="wscache.generated.classes.dir" value="${wscache.output.base.dir}/classes" />
> > > > + <property name="compile.test.classes" value="target/test-classes" />
> > > > +
> > > > +
> > > > + <target name="run-wsgen-tests" depends="wrapper-beans"/>
> > > > +
> > > > +
> > > > + <target name="create-cache">
> > > > + <mkdir dir="${wscache.output.base.dir}" />
> > > > + <mkdir dir="${wscache.generated.src.dir}" />
> > > > + <mkdir dir="${wscache.generated.classes.dir}" />
> > > > + </target>
> > > > +
> > > > + <target name="wrapper-beans" depends="create-cache">
> > > > + <echo>Generating artifacts for org.apache.axis2.jaxws.wrapper.beans.AddNumbersService </echo>
> > > > + <wsgen
> > > > + sei="org.apache.axis2.jaxws.wrapper.beans.AddNumbersService"
> > > > + destdir="${wscache.generated.classes.dir}"
> > > > + resourcedestdir="${wscache.generated.src.dir}"
> > > > + keep="false"
> > > > + verbose="false"
> > > > + genwsdl="true">
> > > > + <classpath>
> > > > + <pathelement path="${compile.test.classes}" />
> > > > + </classpath>
> > > > + </wsgen>
> > > > + </target>
> > > > +</project>
> > > > \ No newline at end of file
> > > >
> > > >
> > > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
> > > For additional commands, e-mail: java-dev-help@axis.apache.org
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
> > For additional commands, e-mail: java-dev-help@axis.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-dev-help@axis.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org
Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws:
./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/
test/org/apache/axis2/jaxws/wrapper/ test/org/apache/axis2/jaxws/wrapper/beans/
Posted by Jarek Gawor <jg...@gmail.com>.
Nikhil,
I don't think there is an objection for adding jaxws-tools as a _test_
dependency. So as long you add the jaxws-tools dependency with
<scope>test</scope> there shouldn't be a problem.
Jarek
On Wed, Jul 14, 2010 at 10:40 PM, Nikhil V Thaker
<ni...@us.ibm.com> wrote:
>
> Thanks Jarek for the suggestion.
>
> The fact that there is an objection to putting jaxws-tools.jar as a dependency would mean we cannot run wsGen. Unless I misunderstood Andreas comments. To me we should always have jaxws-tools as dependency to jaxws module, after all jaxws tools are prerequisite to jaxws runtime, a user of jaxws runtime has to run wsGen or wsImport to build webservices application.
>
> Anyways, I will look and see if there is an alternate way to add these test cases.
>
> Regards,
>
> Nikhil Thaker
> office: 919 254 9964
> nvthaker@us.ibm.com
>
>
> Jarek Gawor <jg...@gmail.com>
>
> 07/14/2010 03:38 PM
>
> Please respond to
> java-dev@axis.apache.org
> To
> java-dev@axis.apache.org
> cc
> Subject
> Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws: ./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ test/org/apache/axis2/jaxws/wrapper/ test/org/apache/axis2/jaxws/wrapper/beans/
>
>
>
>
> Just a couple of thoughts:
>
> 1) Since you already have wsgen-tests.xml ant script to run the wsgen
> you could setup the appropriate classpath to the tools.jar or
> classes.jar or whatever in it. You just might need to fork the ant
> process.
>
> 2) I don't think it's that horrible to commit some generate code
> especially if there isn't too much of it and the test case is
> important. Besides, Axis2 already has some generated code checked it.
>
> Jarek
>
> On Wed, Jul 14, 2010 at 4:00 PM, Nikhil V Thaker
> <ni...@us.ibm.com> wrote:
> >
> > Yes Andreas,
> > I am running antrun plugin as the wsGen plugin has errors and is not fully matured, here's the URL that explains the issue I ran into http://jira.codehaus.org/browse/MNG-3586.
> >
> > So since I cannot run wsGen or cannot include generated artifacts I will just remove the test case. I will commit the changes soon.
> >
> > Regards,
> >
> > Nikhil Thaker
> > office: 919 254 9964
> > nvthaker@us.ibm.com
> >
> >
> > Andreas Veithen <an...@gmail.com>
> >
> > 07/14/2010 02:48 PM
> >
> > Please respond to
> > java-dev@axis.apache.org
> > To
> > java-dev@axis.apache.org
> > cc
> > Subject
> > Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws: ./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ test/org/apache/axis2/jaxws/wrapper/ test/org/apache/axis2/jaxws/wrapper/beans/
> >
> >
> >
> >
> > No, you are using the antrun plugin to execute the wsgen ant task.
> > What I meant was to use a real Maven plugin (either the one from
> > java.net or the one from CXF).
> >
> > -1 to commit any generated stuff into SVN.
> >
> > Andreas
> >
> > On Wed, Jul 14, 2010 at 21:42, Nikhil V Thaker
> > <ni...@us.ibm.com> wrote:
> > >
> > > Andreas - I had to add the tools.jar bit because maven plugin for wsGen gave NoClassDef Found errors for classes packaged in tools.jar.
> > >
> > > Since this is causing a problem I will just package the generated artifacts and remove the wsGen dependency.
> > >
> > > Thanks,
> > >
> > > Nikhil Thaker
> > > office: 919 254 9964
> > > nvthaker@us.ibm.com
> > >
> > >
> > > Andreas Veithen <an...@gmail.com>
> > >
> > > 07/14/2010 01:44 PM
> > >
> > > Please respond to
> > > java-dev@axis.apache.org
> > > To
> > > java-dev@axis.apache.org
> > > cc
> > > Subject
> > > Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws: ./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ test/org/apache/axis2/jaxws/wrapper/ test/org/apache/axis2/jaxws/wrapper/beans/
> > >
> > >
> > >
> > >
> > > Nikhil,
> > >
> > > I have some issues with the tools and jaxws-tools dependencies
> > > introduced by this change:
> > >
> > > * The change causes a build failure in Hudson. There will also be
> > > additional issues with tools.jar, because the way to declare this as a
> > > system dependency varies from one JDK to another. For example, I
> > > remember that on Mac OS X, it is completely different than on other
> > > JDKs.
> > >
> > > * I don't like the fact that jaxws-tools becomes a dependency of
> > > axis2-jaxws in scope compile, because it looks like this is only
> > > needed during the build and/or during the tests.
> > >
> > > I didn't review the change in detail, but wouldn't it be smarter to
> > > use one of the existing Maven plugins to do the wsgen stuff? They will
> > > take care of the tools.jar stuff as well.
> > >
> > > Andreas
> > >
> > > On Tue, Jul 13, 2010 at 00:16, <nt...@apache.org> wrote:
> > > > Author: nthaker
> > > > Date: Mon Jul 12 22:16:54 2010
> > > > New Revision: 963508
> > > >
> > > > URL: http://svn.apache.org/viewvc?rev=963508&view=rev
> > > > Log:
> > > > AXIS2-4775
> > > > This change ensures that we will use Request and Response wrapper Bean packaged by customer or we will Generate Wrappers if they are not packaged.
> > > >
> > > > Added:
> > > > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/
> > > > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/
> > > > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
> > > > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
> > > > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
> > > > axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml
> > > > Modified:
> > > > axis/axis2/java/core/trunk/modules/jaxws/pom.xml
> > > > axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
> > > >
> > > > Modified: axis/axis2/java/core/trunk/modules/jaxws/pom.xml
> > > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/pom.xml?rev=963508&r1=963507&r2=963508&view=diff
> > > > ==============================================================================
> > > > --- axis/axis2/java/core/trunk/modules/jaxws/pom.xml (original)
> > > > +++ axis/axis2/java/core/trunk/modules/jaxws/pom.xml Mon Jul 12 22:16:54 2010
> > > > @@ -1,5 +1,4 @@
> > > > <?xml version="1.0" encoding="UTF-8"?>
> > > > -
> > > > <!-- > ~ Licensed to the Apache Software Foundation (ASF) under one
> > > > ~ or more contributor license agreements. See the NOTICE file
> > > > @@ -20,7 +19,7 @@
> > > > -->
> > > >
> > > > <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> > > > - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
> > > > + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
> > > > <modelVersion>4.0.0</modelVersion>
> > > > <parent>
> > > > <groupId>org.apache.axis2</groupId>
> > > > @@ -98,7 +97,25 @@
> > > > <version>${version}</version>
> > > > <scope>test</scope>
> > > > </dependency>
> > > > + <dependency>
> > > > + <groupId>wsdl4j</groupId>
> > > > + <artifactId>wsdl4j</artifactId>
> > > > + </dependency>
> > > > + <dependency>
> > > > + <groupId>com.sun.xml.ws</groupId>
> > > > + <artifactId>jaxws-tools</artifactId>
> > > > + <version>2.1.3</version>
> > > > + </dependency>
> > > > + <!-- If we dont include tools.jar as dependency, maven throws NoClassDefFound on wsGen run -->
> > > > + <dependency>
> > > > + <groupId>java</groupId>
> > > > + <artifactId>tools</artifactId>
> > > > + <version>$version</version>
> > > > + <scope>system</scope>
> > > > + <systemPath>${JAVA_HOME}/lib/tools.jar</systemPath>
> > > > + </dependency>
> > > > </dependencies>
> > > > +
> > > > <build>
> > > > <sourceDirectory>src</sourceDirectory>
> > > > <testSourceDirectory>test</testSourceDirectory>
> > > > @@ -203,34 +220,39 @@
> > > > <compilerVersion>1.5</compilerVersion>
> > > > <source>1.5</source>
> > > > <target>1.5</target>
> > > > +
> > > > </configuration>
> > > > </plugin>
> > > > <plugin>
> > > > <groupId>org.apache.maven.plugins</groupId>
> > > > <artifactId>maven-antrun-plugin</artifactId>
> > > > +
> > > > <executions>
> > > > <execution>
> > > > <id>gen-ts</id>
> > > > <phase>generate-test-sources</phase>
> > > > <configuration>
> > > > - <tasks unless="maven.test.skip">
> > > > + <tasks unless="maven.test.skip">
> > > > <!-- Theres got to be a better way to do this -->
> > > > <property name="schema.source.dir" value="test-resources/xsd"/>
> > > > <property name="wsdl.source.dir" value="test-resources/wsdl"/>
> > > > - <property name="schema.output.base.dir" value="target/schema"/>
> > > > + <property name="schema.output.base.dir" value="target/schema"/>
> > > > <property name="schema.generated.src.dir" value="${schema.output.base.dir}/src"/>
> > > > <property name="schema.generated.classes.dir"
> > > > value="${schema.output.base.dir}/classes"/>
> > > > +
> > > > <!-- make the dirs -->
> > > > <mkdir dir="${schema.output.base.dir}"/>
> > > > <mkdir dir="${schema.generated.src.dir}"/>
> > > > <mkdir dir="${schema.generated.classes.dir}"/>
> > > > +
> > > > <!-- Run JAXB schema compiler with designated schemas -->
> > > > <echo>Generating JAX-B classes from XSDs</echo>
> > > >
> > > > <echo>Generating java from echo.xsd</echo>
> > > > <java classname="com.sun.tools.xjc.Driver" fork="true">
> > > > <classpath refid="maven.runtime.classpath"/>
> > > > +
> > > > <classpath location="${compiled.classes.dir}"/>
> > > > <arg line="-d ${schema.generated.src.dir} -quiet ${schema.source.dir}/echo.xsd"/>
> > > > </java>
> > > > @@ -266,7 +288,7 @@
> > > > <classpath refid="maven.runtime.classpath"/>
> > > > <classpath location="${compiled.classes.dir}"/>
> > > > <arg line="-d ${schema.generated.src.dir} -quiet -wsdl ${wsdl.source.dir}/AddNumbers.wsdl"/>
> > > > - </java>
> > > > + </java>
> > > > </tasks>
> > > > </configuration>
> > > > <goals>
> > > > @@ -287,6 +309,22 @@
> > > > <property name="addressing_version" value="${version}"/>
> > > > <ant antfile="build.xml" inheritall="true" inheritrefs="true"
> > > > dir="." target="build-repo"/>
> > > > +
> > > > + <property name="compile_classpath" refid="maven.compile.classpath" />
> > > > + <property name="runtime_classpath" refid="maven.runtime.classpath" />
> > > > + <property name="test_classpath" refid="maven.test.classpath" />
> > > > + <property name="plugin_classpath" refid="maven.plugin.classpath" />
> > > > +
> > > > + <!-- Defining wsGen task -->
> > > > + <taskdef name="wsgen" loaderRef="refwsgen" classname="com.sun.tools.ws.ant.WsGen">
> > > > + <classpath>
> > > > + <path refid="maven.runtime.classpath" />
> > > > + <path refid="maven.compile.classpath" />
> > > > + </classpath>
> > > > + </taskdef>
> > > > + <!-- Invoking test cases that need to generate artifacts using wsGen -->
> > > > + <ant antfile="wsgen-tests.xml" inheritall="true" inheritrefs="true"
> > > > + dir="." target="run-wsgen-tests"/>
> > > > </tasks>
> > > > </configuration>
> > > > <goals>
> > > > @@ -374,6 +412,13 @@
> > > > <plugin>
> > > > <groupId>org.apache.maven.plugins</groupId>
> > > > <artifactId>maven-surefire-report-plugin</artifactId>
> > > > + <reportSets>
> > > > + <reportSet>
> > > > + <reports>
> > > > + <report>report-only</report>
> > > > + </reports>
> > > > + </reportSet>
> > > > + </reportSets>
> > > > </plugin>
> > > > </plugins>
> > > > </reporting>
> > > >
> > > > Modified: axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
> > > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java?rev=963508&r1=963507&r2=963508&view=diff
> > > > ==============================================================================
> > > > --- axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java (original)
> > > > +++ axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java Mon Jul 12 22:16:54 2010
> > > > @@ -238,12 +238,27 @@ class ArtifactProcessor {
> > > > wrapperClass = newValue;
> > > > }
> > > > }
> > > > - if(cls==null && (type.equals("@WebFault")|| type.equals("faultInfo"))){
> > > > +
> > > > + if(cls==null &&
> > > > + (type.equals("@RequestWrapper")|| type.equals("@ResponseWrapper")||type.equals("@WebFault")|| type.equals("faultInfo"))){
> > > > +
> > > > + //Support for Fault Bean Generation
> > > > //As per JAX-WS 2.2 Specification section 3.7 an application programmer can choose not to
> > > > //package the faultBeans, if we have reached this point in the code then user has choosen
> > > > //not to package the fault bean. If there is a cache of generated artifacts available then
> > > > //lets look for the missing faultBean there.
> > > > -
> > > > +
> > > > + //Support for Wrapper Bean Generation
> > > > + //As per JAX-WS 2.2 Specificaiton section 3.6.2.1 pg 41 an application programmer does not use
> > > > + //the wrapper bean classes, so the application need not package these classes. If we have reached
> > > > + //this point in the code then user has choosen not to package these beans.
> > > > +
> > > > + //NOTE:If we find Generated artifacts from cache this guarantees that we will not use
> > > > + //DocLitWrappedMinimum marshaller code. The advantage of normal DocLitWrappedMarshaller is
> > > > + //that it is very robust and has support of lot more datatypes than in DocLitWrappedMinimum.
> > > > + if(log.isDebugEnabled()){
> > > > + log.debug("Adding cache to classpath");
> > > > + }
> > > > ClassFinderFactory cff =
> > > > (ClassFinderFactory)FactoryRegistry.getFactory(ClassFinderFactory.class);
> > > > ClassFinder cf = cff.getClassFinder();
> > > > @@ -317,11 +332,26 @@ class ArtifactProcessor {
> > > > if (cls2 == null) {
> > > > cls2 = loadClassOrNull(defaultValue, altClassLoader);
> > > > }
> > > > - if(cls2==null && (type.equals("faultInfo")|| type.equals("@WebFault"))){
> > > > - //As per JAX-WS 2.2 Specification section 3.7 an application programmer can choose not to
> > > > - //package the faultBeans, if we have reached this point in the code then user has choosen
> > > > - //not to package the fault bean. If there is a cache of generated artifacts available then
> > > > - //lets look for the missing faultBean there.
> > > > + if(cls2==null &&
> > > > + (type.equals("@RequestWrapper")|| type.equals("@ResponseWrapper")||type.equals("@WebFault")|| type.equals("faultInfo"))){
> > > > +
> > > > + //Support for Fault Bean Generation
> > > > + //As per JAX-WS 2.2 Specification section 3.7 an application programmer can choose not to
> > > > + //package the faultBeans, if we have reached this point in the code then user has choosen
> > > > + //not to package the fault bean. If there is a cache of generated artifacts available then
> > > > + //lets look for the missing faultBean there.
> > > > +
> > > > + //Support for Wrapper Bean Generation
> > > > + //As per JAX-WS 2.2 Specificaiton section 3.6.2.1 pg 41 an application programmer does not use
> > > > + //the wrapper bean classes, so the application need not package these classes. If we have reached
> > > > + //this point in the code then user has choosen not to package these beans.
> > > > +
> > > > + //NOTE:If we find Generated artifacts from cache this guarantees that we will not use
> > > > + //DocLitWrappedMinimum marshaller code. The advantage of normal DocLitWrappedMarshaller is
> > > > + //that it is very robust and has support of lot more datatypes than in DocLitWrappedMinimum.
> > > > + if(log.isDebugEnabled()){
> > > > + log.debug("Adding cache to classpath");
> > > > + }
> > > > if(log.isDebugEnabled()){
> > > > log.debug("Adding cache to classpath");
> > > > }
> > > >
> > > > Added: axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
> > > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java?rev=963508&view=auto
> > > > ==============================================================================
> > > > --- axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java (added)
> > > > +++ axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java Mon Jul 12 22:16:54 2010
> > > > @@ -0,0 +1,18 @@
> > > > +
> > > > +package org.apache.axis2.jaxws.wrapper.beans;
> > > > +
> > > > +import javax.xml.ws.WebFault;
> > > > +
> > > > +@WebFault(name = "AddNumbersFault", targetNamespace = "http://org/test/addnumbers")
> > > > +public class AddNumbersException extends Exception
> > > > +{
> > > > +
> > > > + private String message = null;
> > > > + public AddNumbersException(){}
> > > > + public AddNumbersException(String message){
> > > > + this.message = message;
> > > > + }
> > > > + public String getInfo(){
> > > > + return message;
> > > > + }
> > > > +}
> > > >
> > > > Added: axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
> > > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java?rev=963508&view=auto
> > > > ==============================================================================
> > > > --- axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java (added)
> > > > +++ axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java Mon Jul 12 22:16:54 2010
> > > > @@ -0,0 +1,15 @@
> > > > +package org.apache.axis2.jaxws.wrapper.beans;
> > > > +
> > > > +
> > > > +
> > > > +@javax.jws.WebService (targetNamespace="http://org/test/addnumbers", serviceName="AddNumbersService", portName="AddNumbersPort")
> > > > +public class AddNumbersService{
> > > > +
> > > > + public int addNumbers(int arg0, int arg1) throws AddNumbersException {
> > > > + if(arg0+arg1<0){
> > > > + throw new AddNumbersException("sum is less than 0");
> > > > + }
> > > > + return arg0+arg1;
> > > > + }
> > > > +
> > > > +}
> > > > \ No newline at end of file
> > > >
> > > > Added: axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
> > > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java?rev=963508&view=auto
> > > > ==============================================================================
> > > > --- axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java (added)
> > > > +++ axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java Mon Jul 12 22:16:54 2010
> > > > @@ -0,0 +1,114 @@
> > > > +/**
> > > > + *
> > > > + */
> > > > +package org.apache.axis2.jaxws.wrapper.beans;
> > > > +
> > > > +
> > > > +import org.apache.axis2.jaxws.Constants;
> > > > +import org.apache.axis2.jaxws.description.DescriptionFactory;
> > > > +import org.apache.axis2.jaxws.description.EndpointDescription;
> > > > +import org.apache.axis2.jaxws.description.EndpointDescriptionJava;
> > > > +import org.apache.axis2.jaxws.description.OperationDescription;
> > > > +import org.apache.axis2.jaxws.description.ServiceDescription;
> > > > +import org.apache.axis2.jaxws.marshaller.MethodMarshaller;
> > > > +import org.apache.axis2.jaxws.marshaller.factory.MethodMarshallerFactory;
> > > > +import org.apache.axis2.jaxws.marshaller.impl.alt.DocLitWrappedMinimalMethodMarshaller;
> > > > +import org.apache.axis2.jaxws.unitTest.TestLogger;
> > > > +
> > > > +import java.io.File;
> > > > +
> > > > +import junit.framework.TestCase;
> > > > +
> > > > +public class WrapperBeanMarshallTests extends TestCase {
> > > > + /**
> > > > + * This is the negative test case, when we do not use generated artifacts from cache
> > > > + * and user did not package wrapper beans, we should see use of DocLitWrappedMinumumMarshaller.
> > > > + */
> > > > + public void testGetMarshallerOperationDescriptionBooleanNegative() {
> > > > + TestLogger.logger.debug("---------------------------------------");
> > > > + TestLogger.logger.debug("test: " + getName());
> > > > +
> > > > + String cache_location = "/target/wscache/classes";
> > > > + try{
> > > > + String baseDir = new File(System.getProperty("basedir",".")).getCanonicalPath();
> > > > + cache_location = new File(baseDir+cache_location).getAbsolutePath();
> > > > + TestLogger.logger.debug("cache location ="+cache_location);
> > > > +
> > > > + //Get EndpointDescription.
> > > > + //Set location on AxisConfiguraiton.
> > > > + Class sei = AddNumbersService.class;
> > > > + EndpointDescription description = getEndpointDesc(sei);
> > > > + TestLogger.logger.debug("description objects where created successfully");
> > > > + OperationDescription[] ops =description.getEndpointInterfaceDescription().getOperations();
> > > > + assertNotNull( "OperationDescriptions where null", ops);
> > > > + assertTrue("No Operation Descriptions where found", ops.length>0);
> > > > + OperationDescription op = ops[0];
> > > > + TestLogger.logger.debug("operation found, java methodName="+op.getJavaMethodName());
> > > > + //Don not Set cache on AxisConfiguration.
> > > > + //get Marshaller, verify its not DoclitWrappedMinimum.
> > > > + TestLogger.logger.debug("ws_cache location NOT set on AxisConfigContext, location="+cache_location);
> > > > + MethodMarshaller mm = MethodMarshallerFactory.getMarshaller(op, false);
> > > > + assertNotNull("getMarshaller returned null", mm );
> > > > + TestLogger.logger.debug("MethodMarshaller was created, type="+mm.getClass().getName());
> > > > + assertTrue("Generated artifacts not found, Method marshaller should be DocLitWrappedMinimumMarshaller", (mm instanceof DocLitWrappedMinimalMethodMarshaller));
> > > > + }catch(Exception e){
> > > > + TestLogger.logger.debug("Exception ="+e.getMessage());
> > > > + fail(e.getMessage());
> > > > + }
> > > > +
> > > > + }
> > > > + /**
> > > > + * In this test case user did not package wrapper beans but we add generated artifacts from cache, we should see use of
> > > > + * DocLitWrappedMarshaller.
> > > > + * Test method for {@link org.apache.axis2.jaxws.marshaller.factory.MethodMarshallerFactory#getMarshaller(org.apache.axis2.jaxws.description.OperationDescription, boolean)}.
> > > > + */
> > > > + public void testGetMarshallerOperationDescriptionBoolean() {
> > > > + TestLogger.logger.debug("---------------------------------------");
> > > > + TestLogger.logger.debug("test: " + getName());
> > > > +
> > > > + String cache_location = "/target/wscache/classes";
> > > > + try{
> > > > + String baseDir = new File(System.getProperty("basedir",".")).getCanonicalPath();
> > > > + cache_location = new File(baseDir+cache_location).getAbsolutePath();
> > > > + TestLogger.logger.debug("cache location ="+cache_location);
> > > > +
> > > > + //Get EndpointDescription.
> > > > + //Set location on AxisConfiguraiton.
> > > > + Class sei = AddNumbersService.class;
> > > > + EndpointDescription description = getEndpointDesc(sei);
> > > > + TestLogger.logger.debug("description objects where created successfully");
> > > > + OperationDescription[] ops =description.getEndpointInterfaceDescription().getOperations();
> > > > + assertNotNull( "OperationDescriptions where null", ops);
> > > > + assertTrue("No Operation Descriptions where found", ops.length>0);
> > > > + OperationDescription op = ops[0];
> > > > + TestLogger.logger.debug("operation found, java methodName="+op.getJavaMethodName());
> > > > + //Set cache on AxisConfiguration.
> > > > + //get Marshaller, verify its not DoclitWrappedMinimum.
> > > > + description.getServiceDescription().getAxisConfigContext().setProperty(Constants.WS_CACHE, cache_location);
> > > > + TestLogger.logger.debug("ws_cache location set on AxisConfigContext, location="+cache_location);
> > > > + MethodMarshaller mm = MethodMarshallerFactory.getMarshaller(op, false);
> > > > + assertNotNull("getMarshaller returned null", mm );
> > > > + TestLogger.logger.debug("MethodMarshaller was created, type="+mm.getClass().getName());
> > > > + assertTrue("Generated artifacts are in cache, Method marshaller should not be DocLitWrappedMinimumMarshaller", !(mm instanceof DocLitWrappedMinimalMethodMarshaller));
> > > > + }catch(Exception e){
> > > > + TestLogger.logger.debug("Exception ="+e.getMessage());
> > > > + fail(e.getMessage());
> > > > + }
> > > > +
> > > > + }
> > > > +
> > > > + private EndpointDescription getEndpointDesc(Class implementationClass) {
> > > > + // Use the description factory directly; this will be done within the JAX-WS runtime
> > > > + ServiceDescription serviceDesc =
> > > > + DescriptionFactory.createServiceDescription(implementationClass);
> > > > + assertNotNull(serviceDesc);
> > > > +
> > > > + EndpointDescription[] endpointDesc = serviceDesc.getEndpointDescriptions();
> > > > + assertNotNull(endpointDesc);
> > > > + assertEquals(1, endpointDesc.length);
> > > > +
> > > > + // TODO: How will the JAX-WS dispatcher get the appropriate port (i.e. endpoint)? Currently assumes [0]
> > > > + EndpointDescription testEndpointDesc = endpointDesc[0];
> > > > + return testEndpointDesc;
> > > > + }
> > > > +}
> > > >
> > > > Added: axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml
> > > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml?rev=963508&view=auto
> > > > ==============================================================================
> > > > --- axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml (added)
> > > > +++ axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml Mon Jul 12 22:16:54 2010
> > > > @@ -0,0 +1,34 @@
> > > > +<?xml version="1.0" encoding="UTF-8"?>
> > > > +
> > > > +<project basedir="." default="run-wsgen-tests" name="wsgen-tests">
> > > > +
> > > > + <property name="wscache.output.base.dir" value="target/wscache" />
> > > > + <property name="wscache.generated.src.dir" value="${wscache.output.base.dir}/src" />
> > > > + <property name="wscache.generated.classes.dir" value="${wscache.output.base.dir}/classes" />
> > > > + <property name="compile.test.classes" value="target/test-classes" />
> > > > +
> > > > +
> > > > + <target name="run-wsgen-tests" depends="wrapper-beans"/>
> > > > +
> > > > +
> > > > + <target name="create-cache">
> > > > + <mkdir dir="${wscache.output.base.dir}" />
> > > > + <mkdir dir="${wscache.generated.src.dir}" />
> > > > + <mkdir dir="${wscache.generated.classes.dir}" />
> > > > + </target>
> > > > +
> > > > + <target name="wrapper-beans" depends="create-cache">
> > > > + <echo>Generating artifacts for org.apache.axis2.jaxws.wrapper.beans.AddNumbersService </echo>
> > > > + <wsgen
> > > > + sei="org.apache.axis2.jaxws.wrapper.beans.AddNumbersService"
> > > > + destdir="${wscache.generated.classes.dir}"
> > > > + resourcedestdir="${wscache.generated.src.dir}"
> > > > + keep="false"
> > > > + verbose="false"
> > > > + genwsdl="true">
> > > > + <classpath>
> > > > + <pathelement path="${compile.test.classes}" />
> > > > + </classpath>
> > > > + </wsgen>
> > > > + </target>
> > > > +</project>
> > > > \ No newline at end of file
> > > >
> > > >
> > > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
> > > For additional commands, e-mail: java-dev-help@axis.apache.org
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
> > For additional commands, e-mail: java-dev-help@axis.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-dev-help@axis.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org
Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws:
./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/
test/org/apache/axis2/jaxws/wrapper/ test/org/apache/axis2/jaxws/wrapper/beans/
Posted by Jarek Gawor <jg...@gmail.com>.
Nikhil,
I don't think there is an objection for adding jaxws-tools as a _test_
dependency. So as long you add the jaxws-tools dependency with
<scope>test</scope> there shouldn't be a problem.
Jarek
On Wed, Jul 14, 2010 at 10:40 PM, Nikhil V Thaker
<ni...@us.ibm.com> wrote:
>
> Thanks Jarek for the suggestion.
>
> The fact that there is an objection to putting jaxws-tools.jar as a dependency would mean we cannot run wsGen. Unless I misunderstood Andreas comments. To me we should always have jaxws-tools as dependency to jaxws module, after all jaxws tools are prerequisite to jaxws runtime, a user of jaxws runtime has to run wsGen or wsImport to build webservices application.
>
> Anyways, I will look and see if there is an alternate way to add these test cases.
>
> Regards,
>
> Nikhil Thaker
> office: 919 254 9964
> nvthaker@us.ibm.com
>
>
> Jarek Gawor <jg...@gmail.com>
>
> 07/14/2010 03:38 PM
>
> Please respond to
> java-dev@axis.apache.org
> To
> java-dev@axis.apache.org
> cc
> Subject
> Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws: ./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ test/org/apache/axis2/jaxws/wrapper/ test/org/apache/axis2/jaxws/wrapper/beans/
>
>
>
>
> Just a couple of thoughts:
>
> 1) Since you already have wsgen-tests.xml ant script to run the wsgen
> you could setup the appropriate classpath to the tools.jar or
> classes.jar or whatever in it. You just might need to fork the ant
> process.
>
> 2) I don't think it's that horrible to commit some generate code
> especially if there isn't too much of it and the test case is
> important. Besides, Axis2 already has some generated code checked it.
>
> Jarek
>
> On Wed, Jul 14, 2010 at 4:00 PM, Nikhil V Thaker
> <ni...@us.ibm.com> wrote:
> >
> > Yes Andreas,
> > I am running antrun plugin as the wsGen plugin has errors and is not fully matured, here's the URL that explains the issue I ran into http://jira.codehaus.org/browse/MNG-3586.
> >
> > So since I cannot run wsGen or cannot include generated artifacts I will just remove the test case. I will commit the changes soon.
> >
> > Regards,
> >
> > Nikhil Thaker
> > office: 919 254 9964
> > nvthaker@us.ibm.com
> >
> >
> > Andreas Veithen <an...@gmail.com>
> >
> > 07/14/2010 02:48 PM
> >
> > Please respond to
> > java-dev@axis.apache.org
> > To
> > java-dev@axis.apache.org
> > cc
> > Subject
> > Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws: ./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ test/org/apache/axis2/jaxws/wrapper/ test/org/apache/axis2/jaxws/wrapper/beans/
> >
> >
> >
> >
> > No, you are using the antrun plugin to execute the wsgen ant task.
> > What I meant was to use a real Maven plugin (either the one from
> > java.net or the one from CXF).
> >
> > -1 to commit any generated stuff into SVN.
> >
> > Andreas
> >
> > On Wed, Jul 14, 2010 at 21:42, Nikhil V Thaker
> > <ni...@us.ibm.com> wrote:
> > >
> > > Andreas - I had to add the tools.jar bit because maven plugin for wsGen gave NoClassDef Found errors for classes packaged in tools.jar.
> > >
> > > Since this is causing a problem I will just package the generated artifacts and remove the wsGen dependency.
> > >
> > > Thanks,
> > >
> > > Nikhil Thaker
> > > office: 919 254 9964
> > > nvthaker@us.ibm.com
> > >
> > >
> > > Andreas Veithen <an...@gmail.com>
> > >
> > > 07/14/2010 01:44 PM
> > >
> > > Please respond to
> > > java-dev@axis.apache.org
> > > To
> > > java-dev@axis.apache.org
> > > cc
> > > Subject
> > > Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws: ./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ test/org/apache/axis2/jaxws/wrapper/ test/org/apache/axis2/jaxws/wrapper/beans/
> > >
> > >
> > >
> > >
> > > Nikhil,
> > >
> > > I have some issues with the tools and jaxws-tools dependencies
> > > introduced by this change:
> > >
> > > * The change causes a build failure in Hudson. There will also be
> > > additional issues with tools.jar, because the way to declare this as a
> > > system dependency varies from one JDK to another. For example, I
> > > remember that on Mac OS X, it is completely different than on other
> > > JDKs.
> > >
> > > * I don't like the fact that jaxws-tools becomes a dependency of
> > > axis2-jaxws in scope compile, because it looks like this is only
> > > needed during the build and/or during the tests.
> > >
> > > I didn't review the change in detail, but wouldn't it be smarter to
> > > use one of the existing Maven plugins to do the wsgen stuff? They will
> > > take care of the tools.jar stuff as well.
> > >
> > > Andreas
> > >
> > > On Tue, Jul 13, 2010 at 00:16, <nt...@apache.org> wrote:
> > > > Author: nthaker
> > > > Date: Mon Jul 12 22:16:54 2010
> > > > New Revision: 963508
> > > >
> > > > URL: http://svn.apache.org/viewvc?rev=963508&view=rev
> > > > Log:
> > > > AXIS2-4775
> > > > This change ensures that we will use Request and Response wrapper Bean packaged by customer or we will Generate Wrappers if they are not packaged.
> > > >
> > > > Added:
> > > > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/
> > > > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/
> > > > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
> > > > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
> > > > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
> > > > axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml
> > > > Modified:
> > > > axis/axis2/java/core/trunk/modules/jaxws/pom.xml
> > > > axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
> > > >
> > > > Modified: axis/axis2/java/core/trunk/modules/jaxws/pom.xml
> > > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/pom.xml?rev=963508&r1=963507&r2=963508&view=diff
> > > > ==============================================================================
> > > > --- axis/axis2/java/core/trunk/modules/jaxws/pom.xml (original)
> > > > +++ axis/axis2/java/core/trunk/modules/jaxws/pom.xml Mon Jul 12 22:16:54 2010
> > > > @@ -1,5 +1,4 @@
> > > > <?xml version="1.0" encoding="UTF-8"?>
> > > > -
> > > > <!-- > ~ Licensed to the Apache Software Foundation (ASF) under one
> > > > ~ or more contributor license agreements. See the NOTICE file
> > > > @@ -20,7 +19,7 @@
> > > > -->
> > > >
> > > > <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> > > > - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
> > > > + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
> > > > <modelVersion>4.0.0</modelVersion>
> > > > <parent>
> > > > <groupId>org.apache.axis2</groupId>
> > > > @@ -98,7 +97,25 @@
> > > > <version>${version}</version>
> > > > <scope>test</scope>
> > > > </dependency>
> > > > + <dependency>
> > > > + <groupId>wsdl4j</groupId>
> > > > + <artifactId>wsdl4j</artifactId>
> > > > + </dependency>
> > > > + <dependency>
> > > > + <groupId>com.sun.xml.ws</groupId>
> > > > + <artifactId>jaxws-tools</artifactId>
> > > > + <version>2.1.3</version>
> > > > + </dependency>
> > > > + <!-- If we dont include tools.jar as dependency, maven throws NoClassDefFound on wsGen run -->
> > > > + <dependency>
> > > > + <groupId>java</groupId>
> > > > + <artifactId>tools</artifactId>
> > > > + <version>$version</version>
> > > > + <scope>system</scope>
> > > > + <systemPath>${JAVA_HOME}/lib/tools.jar</systemPath>
> > > > + </dependency>
> > > > </dependencies>
> > > > +
> > > > <build>
> > > > <sourceDirectory>src</sourceDirectory>
> > > > <testSourceDirectory>test</testSourceDirectory>
> > > > @@ -203,34 +220,39 @@
> > > > <compilerVersion>1.5</compilerVersion>
> > > > <source>1.5</source>
> > > > <target>1.5</target>
> > > > +
> > > > </configuration>
> > > > </plugin>
> > > > <plugin>
> > > > <groupId>org.apache.maven.plugins</groupId>
> > > > <artifactId>maven-antrun-plugin</artifactId>
> > > > +
> > > > <executions>
> > > > <execution>
> > > > <id>gen-ts</id>
> > > > <phase>generate-test-sources</phase>
> > > > <configuration>
> > > > - <tasks unless="maven.test.skip">
> > > > + <tasks unless="maven.test.skip">
> > > > <!-- Theres got to be a better way to do this -->
> > > > <property name="schema.source.dir" value="test-resources/xsd"/>
> > > > <property name="wsdl.source.dir" value="test-resources/wsdl"/>
> > > > - <property name="schema.output.base.dir" value="target/schema"/>
> > > > + <property name="schema.output.base.dir" value="target/schema"/>
> > > > <property name="schema.generated.src.dir" value="${schema.output.base.dir}/src"/>
> > > > <property name="schema.generated.classes.dir"
> > > > value="${schema.output.base.dir}/classes"/>
> > > > +
> > > > <!-- make the dirs -->
> > > > <mkdir dir="${schema.output.base.dir}"/>
> > > > <mkdir dir="${schema.generated.src.dir}"/>
> > > > <mkdir dir="${schema.generated.classes.dir}"/>
> > > > +
> > > > <!-- Run JAXB schema compiler with designated schemas -->
> > > > <echo>Generating JAX-B classes from XSDs</echo>
> > > >
> > > > <echo>Generating java from echo.xsd</echo>
> > > > <java classname="com.sun.tools.xjc.Driver" fork="true">
> > > > <classpath refid="maven.runtime.classpath"/>
> > > > +
> > > > <classpath location="${compiled.classes.dir}"/>
> > > > <arg line="-d ${schema.generated.src.dir} -quiet ${schema.source.dir}/echo.xsd"/>
> > > > </java>
> > > > @@ -266,7 +288,7 @@
> > > > <classpath refid="maven.runtime.classpath"/>
> > > > <classpath location="${compiled.classes.dir}"/>
> > > > <arg line="-d ${schema.generated.src.dir} -quiet -wsdl ${wsdl.source.dir}/AddNumbers.wsdl"/>
> > > > - </java>
> > > > + </java>
> > > > </tasks>
> > > > </configuration>
> > > > <goals>
> > > > @@ -287,6 +309,22 @@
> > > > <property name="addressing_version" value="${version}"/>
> > > > <ant antfile="build.xml" inheritall="true" inheritrefs="true"
> > > > dir="." target="build-repo"/>
> > > > +
> > > > + <property name="compile_classpath" refid="maven.compile.classpath" />
> > > > + <property name="runtime_classpath" refid="maven.runtime.classpath" />
> > > > + <property name="test_classpath" refid="maven.test.classpath" />
> > > > + <property name="plugin_classpath" refid="maven.plugin.classpath" />
> > > > +
> > > > + <!-- Defining wsGen task -->
> > > > + <taskdef name="wsgen" loaderRef="refwsgen" classname="com.sun.tools.ws.ant.WsGen">
> > > > + <classpath>
> > > > + <path refid="maven.runtime.classpath" />
> > > > + <path refid="maven.compile.classpath" />
> > > > + </classpath>
> > > > + </taskdef>
> > > > + <!-- Invoking test cases that need to generate artifacts using wsGen -->
> > > > + <ant antfile="wsgen-tests.xml" inheritall="true" inheritrefs="true"
> > > > + dir="." target="run-wsgen-tests"/>
> > > > </tasks>
> > > > </configuration>
> > > > <goals>
> > > > @@ -374,6 +412,13 @@
> > > > <plugin>
> > > > <groupId>org.apache.maven.plugins</groupId>
> > > > <artifactId>maven-surefire-report-plugin</artifactId>
> > > > + <reportSets>
> > > > + <reportSet>
> > > > + <reports>
> > > > + <report>report-only</report>
> > > > + </reports>
> > > > + </reportSet>
> > > > + </reportSets>
> > > > </plugin>
> > > > </plugins>
> > > > </reporting>
> > > >
> > > > Modified: axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
> > > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java?rev=963508&r1=963507&r2=963508&view=diff
> > > > ==============================================================================
> > > > --- axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java (original)
> > > > +++ axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java Mon Jul 12 22:16:54 2010
> > > > @@ -238,12 +238,27 @@ class ArtifactProcessor {
> > > > wrapperClass = newValue;
> > > > }
> > > > }
> > > > - if(cls==null && (type.equals("@WebFault")|| type.equals("faultInfo"))){
> > > > +
> > > > + if(cls==null &&
> > > > + (type.equals("@RequestWrapper")|| type.equals("@ResponseWrapper")||type.equals("@WebFault")|| type.equals("faultInfo"))){
> > > > +
> > > > + //Support for Fault Bean Generation
> > > > //As per JAX-WS 2.2 Specification section 3.7 an application programmer can choose not to
> > > > //package the faultBeans, if we have reached this point in the code then user has choosen
> > > > //not to package the fault bean. If there is a cache of generated artifacts available then
> > > > //lets look for the missing faultBean there.
> > > > -
> > > > +
> > > > + //Support for Wrapper Bean Generation
> > > > + //As per JAX-WS 2.2 Specificaiton section 3.6.2.1 pg 41 an application programmer does not use
> > > > + //the wrapper bean classes, so the application need not package these classes. If we have reached
> > > > + //this point in the code then user has choosen not to package these beans.
> > > > +
> > > > + //NOTE:If we find Generated artifacts from cache this guarantees that we will not use
> > > > + //DocLitWrappedMinimum marshaller code. The advantage of normal DocLitWrappedMarshaller is
> > > > + //that it is very robust and has support of lot more datatypes than in DocLitWrappedMinimum.
> > > > + if(log.isDebugEnabled()){
> > > > + log.debug("Adding cache to classpath");
> > > > + }
> > > > ClassFinderFactory cff =
> > > > (ClassFinderFactory)FactoryRegistry.getFactory(ClassFinderFactory.class);
> > > > ClassFinder cf = cff.getClassFinder();
> > > > @@ -317,11 +332,26 @@ class ArtifactProcessor {
> > > > if (cls2 == null) {
> > > > cls2 = loadClassOrNull(defaultValue, altClassLoader);
> > > > }
> > > > - if(cls2==null && (type.equals("faultInfo")|| type.equals("@WebFault"))){
> > > > - //As per JAX-WS 2.2 Specification section 3.7 an application programmer can choose not to
> > > > - //package the faultBeans, if we have reached this point in the code then user has choosen
> > > > - //not to package the fault bean. If there is a cache of generated artifacts available then
> > > > - //lets look for the missing faultBean there.
> > > > + if(cls2==null &&
> > > > + (type.equals("@RequestWrapper")|| type.equals("@ResponseWrapper")||type.equals("@WebFault")|| type.equals("faultInfo"))){
> > > > +
> > > > + //Support for Fault Bean Generation
> > > > + //As per JAX-WS 2.2 Specification section 3.7 an application programmer can choose not to
> > > > + //package the faultBeans, if we have reached this point in the code then user has choosen
> > > > + //not to package the fault bean. If there is a cache of generated artifacts available then
> > > > + //lets look for the missing faultBean there.
> > > > +
> > > > + //Support for Wrapper Bean Generation
> > > > + //As per JAX-WS 2.2 Specificaiton section 3.6.2.1 pg 41 an application programmer does not use
> > > > + //the wrapper bean classes, so the application need not package these classes. If we have reached
> > > > + //this point in the code then user has choosen not to package these beans.
> > > > +
> > > > + //NOTE:If we find Generated artifacts from cache this guarantees that we will not use
> > > > + //DocLitWrappedMinimum marshaller code. The advantage of normal DocLitWrappedMarshaller is
> > > > + //that it is very robust and has support of lot more datatypes than in DocLitWrappedMinimum.
> > > > + if(log.isDebugEnabled()){
> > > > + log.debug("Adding cache to classpath");
> > > > + }
> > > > if(log.isDebugEnabled()){
> > > > log.debug("Adding cache to classpath");
> > > > }
> > > >
> > > > Added: axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
> > > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java?rev=963508&view=auto
> > > > ==============================================================================
> > > > --- axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java (added)
> > > > +++ axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java Mon Jul 12 22:16:54 2010
> > > > @@ -0,0 +1,18 @@
> > > > +
> > > > +package org.apache.axis2.jaxws.wrapper.beans;
> > > > +
> > > > +import javax.xml.ws.WebFault;
> > > > +
> > > > +@WebFault(name = "AddNumbersFault", targetNamespace = "http://org/test/addnumbers")
> > > > +public class AddNumbersException extends Exception
> > > > +{
> > > > +
> > > > + private String message = null;
> > > > + public AddNumbersException(){}
> > > > + public AddNumbersException(String message){
> > > > + this.message = message;
> > > > + }
> > > > + public String getInfo(){
> > > > + return message;
> > > > + }
> > > > +}
> > > >
> > > > Added: axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
> > > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java?rev=963508&view=auto
> > > > ==============================================================================
> > > > --- axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java (added)
> > > > +++ axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java Mon Jul 12 22:16:54 2010
> > > > @@ -0,0 +1,15 @@
> > > > +package org.apache.axis2.jaxws.wrapper.beans;
> > > > +
> > > > +
> > > > +
> > > > +@javax.jws.WebService (targetNamespace="http://org/test/addnumbers", serviceName="AddNumbersService", portName="AddNumbersPort")
> > > > +public class AddNumbersService{
> > > > +
> > > > + public int addNumbers(int arg0, int arg1) throws AddNumbersException {
> > > > + if(arg0+arg1<0){
> > > > + throw new AddNumbersException("sum is less than 0");
> > > > + }
> > > > + return arg0+arg1;
> > > > + }
> > > > +
> > > > +}
> > > > \ No newline at end of file
> > > >
> > > > Added: axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
> > > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java?rev=963508&view=auto
> > > > ==============================================================================
> > > > --- axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java (added)
> > > > +++ axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java Mon Jul 12 22:16:54 2010
> > > > @@ -0,0 +1,114 @@
> > > > +/**
> > > > + *
> > > > + */
> > > > +package org.apache.axis2.jaxws.wrapper.beans;
> > > > +
> > > > +
> > > > +import org.apache.axis2.jaxws.Constants;
> > > > +import org.apache.axis2.jaxws.description.DescriptionFactory;
> > > > +import org.apache.axis2.jaxws.description.EndpointDescription;
> > > > +import org.apache.axis2.jaxws.description.EndpointDescriptionJava;
> > > > +import org.apache.axis2.jaxws.description.OperationDescription;
> > > > +import org.apache.axis2.jaxws.description.ServiceDescription;
> > > > +import org.apache.axis2.jaxws.marshaller.MethodMarshaller;
> > > > +import org.apache.axis2.jaxws.marshaller.factory.MethodMarshallerFactory;
> > > > +import org.apache.axis2.jaxws.marshaller.impl.alt.DocLitWrappedMinimalMethodMarshaller;
> > > > +import org.apache.axis2.jaxws.unitTest.TestLogger;
> > > > +
> > > > +import java.io.File;
> > > > +
> > > > +import junit.framework.TestCase;
> > > > +
> > > > +public class WrapperBeanMarshallTests extends TestCase {
> > > > + /**
> > > > + * This is the negative test case, when we do not use generated artifacts from cache
> > > > + * and user did not package wrapper beans, we should see use of DocLitWrappedMinumumMarshaller.
> > > > + */
> > > > + public void testGetMarshallerOperationDescriptionBooleanNegative() {
> > > > + TestLogger.logger.debug("---------------------------------------");
> > > > + TestLogger.logger.debug("test: " + getName());
> > > > +
> > > > + String cache_location = "/target/wscache/classes";
> > > > + try{
> > > > + String baseDir = new File(System.getProperty("basedir",".")).getCanonicalPath();
> > > > + cache_location = new File(baseDir+cache_location).getAbsolutePath();
> > > > + TestLogger.logger.debug("cache location ="+cache_location);
> > > > +
> > > > + //Get EndpointDescription.
> > > > + //Set location on AxisConfiguraiton.
> > > > + Class sei = AddNumbersService.class;
> > > > + EndpointDescription description = getEndpointDesc(sei);
> > > > + TestLogger.logger.debug("description objects where created successfully");
> > > > + OperationDescription[] ops =description.getEndpointInterfaceDescription().getOperations();
> > > > + assertNotNull( "OperationDescriptions where null", ops);
> > > > + assertTrue("No Operation Descriptions where found", ops.length>0);
> > > > + OperationDescription op = ops[0];
> > > > + TestLogger.logger.debug("operation found, java methodName="+op.getJavaMethodName());
> > > > + //Don not Set cache on AxisConfiguration.
> > > > + //get Marshaller, verify its not DoclitWrappedMinimum.
> > > > + TestLogger.logger.debug("ws_cache location NOT set on AxisConfigContext, location="+cache_location);
> > > > + MethodMarshaller mm = MethodMarshallerFactory.getMarshaller(op, false);
> > > > + assertNotNull("getMarshaller returned null", mm );
> > > > + TestLogger.logger.debug("MethodMarshaller was created, type="+mm.getClass().getName());
> > > > + assertTrue("Generated artifacts not found, Method marshaller should be DocLitWrappedMinimumMarshaller", (mm instanceof DocLitWrappedMinimalMethodMarshaller));
> > > > + }catch(Exception e){
> > > > + TestLogger.logger.debug("Exception ="+e.getMessage());
> > > > + fail(e.getMessage());
> > > > + }
> > > > +
> > > > + }
> > > > + /**
> > > > + * In this test case user did not package wrapper beans but we add generated artifacts from cache, we should see use of
> > > > + * DocLitWrappedMarshaller.
> > > > + * Test method for {@link org.apache.axis2.jaxws.marshaller.factory.MethodMarshallerFactory#getMarshaller(org.apache.axis2.jaxws.description.OperationDescription, boolean)}.
> > > > + */
> > > > + public void testGetMarshallerOperationDescriptionBoolean() {
> > > > + TestLogger.logger.debug("---------------------------------------");
> > > > + TestLogger.logger.debug("test: " + getName());
> > > > +
> > > > + String cache_location = "/target/wscache/classes";
> > > > + try{
> > > > + String baseDir = new File(System.getProperty("basedir",".")).getCanonicalPath();
> > > > + cache_location = new File(baseDir+cache_location).getAbsolutePath();
> > > > + TestLogger.logger.debug("cache location ="+cache_location);
> > > > +
> > > > + //Get EndpointDescription.
> > > > + //Set location on AxisConfiguraiton.
> > > > + Class sei = AddNumbersService.class;
> > > > + EndpointDescription description = getEndpointDesc(sei);
> > > > + TestLogger.logger.debug("description objects where created successfully");
> > > > + OperationDescription[] ops =description.getEndpointInterfaceDescription().getOperations();
> > > > + assertNotNull( "OperationDescriptions where null", ops);
> > > > + assertTrue("No Operation Descriptions where found", ops.length>0);
> > > > + OperationDescription op = ops[0];
> > > > + TestLogger.logger.debug("operation found, java methodName="+op.getJavaMethodName());
> > > > + //Set cache on AxisConfiguration.
> > > > + //get Marshaller, verify its not DoclitWrappedMinimum.
> > > > + description.getServiceDescription().getAxisConfigContext().setProperty(Constants.WS_CACHE, cache_location);
> > > > + TestLogger.logger.debug("ws_cache location set on AxisConfigContext, location="+cache_location);
> > > > + MethodMarshaller mm = MethodMarshallerFactory.getMarshaller(op, false);
> > > > + assertNotNull("getMarshaller returned null", mm );
> > > > + TestLogger.logger.debug("MethodMarshaller was created, type="+mm.getClass().getName());
> > > > + assertTrue("Generated artifacts are in cache, Method marshaller should not be DocLitWrappedMinimumMarshaller", !(mm instanceof DocLitWrappedMinimalMethodMarshaller));
> > > > + }catch(Exception e){
> > > > + TestLogger.logger.debug("Exception ="+e.getMessage());
> > > > + fail(e.getMessage());
> > > > + }
> > > > +
> > > > + }
> > > > +
> > > > + private EndpointDescription getEndpointDesc(Class implementationClass) {
> > > > + // Use the description factory directly; this will be done within the JAX-WS runtime
> > > > + ServiceDescription serviceDesc =
> > > > + DescriptionFactory.createServiceDescription(implementationClass);
> > > > + assertNotNull(serviceDesc);
> > > > +
> > > > + EndpointDescription[] endpointDesc = serviceDesc.getEndpointDescriptions();
> > > > + assertNotNull(endpointDesc);
> > > > + assertEquals(1, endpointDesc.length);
> > > > +
> > > > + // TODO: How will the JAX-WS dispatcher get the appropriate port (i.e. endpoint)? Currently assumes [0]
> > > > + EndpointDescription testEndpointDesc = endpointDesc[0];
> > > > + return testEndpointDesc;
> > > > + }
> > > > +}
> > > >
> > > > Added: axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml
> > > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml?rev=963508&view=auto
> > > > ==============================================================================
> > > > --- axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml (added)
> > > > +++ axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml Mon Jul 12 22:16:54 2010
> > > > @@ -0,0 +1,34 @@
> > > > +<?xml version="1.0" encoding="UTF-8"?>
> > > > +
> > > > +<project basedir="." default="run-wsgen-tests" name="wsgen-tests">
> > > > +
> > > > + <property name="wscache.output.base.dir" value="target/wscache" />
> > > > + <property name="wscache.generated.src.dir" value="${wscache.output.base.dir}/src" />
> > > > + <property name="wscache.generated.classes.dir" value="${wscache.output.base.dir}/classes" />
> > > > + <property name="compile.test.classes" value="target/test-classes" />
> > > > +
> > > > +
> > > > + <target name="run-wsgen-tests" depends="wrapper-beans"/>
> > > > +
> > > > +
> > > > + <target name="create-cache">
> > > > + <mkdir dir="${wscache.output.base.dir}" />
> > > > + <mkdir dir="${wscache.generated.src.dir}" />
> > > > + <mkdir dir="${wscache.generated.classes.dir}" />
> > > > + </target>
> > > > +
> > > > + <target name="wrapper-beans" depends="create-cache">
> > > > + <echo>Generating artifacts for org.apache.axis2.jaxws.wrapper.beans.AddNumbersService </echo>
> > > > + <wsgen
> > > > + sei="org.apache.axis2.jaxws.wrapper.beans.AddNumbersService"
> > > > + destdir="${wscache.generated.classes.dir}"
> > > > + resourcedestdir="${wscache.generated.src.dir}"
> > > > + keep="false"
> > > > + verbose="false"
> > > > + genwsdl="true">
> > > > + <classpath>
> > > > + <pathelement path="${compile.test.classes}" />
> > > > + </classpath>
> > > > + </wsgen>
> > > > + </target>
> > > > +</project>
> > > > \ No newline at end of file
> > > >
> > > >
> > > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
> > > For additional commands, e-mail: java-dev-help@axis.apache.org
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
> > For additional commands, e-mail: java-dev-help@axis.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-dev-help@axis.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org
Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws:
./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/
test/org/apache/axis2/jaxws/wrapper/ test/org/apache/axis2/jaxws/wrapper/beans/
Posted by Jarek Gawor <jg...@gmail.com>.
Nikhil,
I don't think there is an objection for adding jaxws-tools as a _test_
dependency. So as long you add the jaxws-tools dependency with
<scope>test</scope> there shouldn't be a problem.
Jarek
On Wed, Jul 14, 2010 at 10:40 PM, Nikhil V Thaker
<ni...@us.ibm.com> wrote:
>
> Thanks Jarek for the suggestion.
>
> The fact that there is an objection to putting jaxws-tools.jar as a dependency would mean we cannot run wsGen. Unless I misunderstood Andreas comments. To me we should always have jaxws-tools as dependency to jaxws module, after all jaxws tools are prerequisite to jaxws runtime, a user of jaxws runtime has to run wsGen or wsImport to build webservices application.
>
> Anyways, I will look and see if there is an alternate way to add these test cases.
>
> Regards,
>
> Nikhil Thaker
> office: 919 254 9964
> nvthaker@us.ibm.com
>
>
> Jarek Gawor <jg...@gmail.com>
>
> 07/14/2010 03:38 PM
>
> Please respond to
> java-dev@axis.apache.org
> To
> java-dev@axis.apache.org
> cc
> Subject
> Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws: ./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ test/org/apache/axis2/jaxws/wrapper/ test/org/apache/axis2/jaxws/wrapper/beans/
>
>
>
>
> Just a couple of thoughts:
>
> 1) Since you already have wsgen-tests.xml ant script to run the wsgen
> you could setup the appropriate classpath to the tools.jar or
> classes.jar or whatever in it. You just might need to fork the ant
> process.
>
> 2) I don't think it's that horrible to commit some generate code
> especially if there isn't too much of it and the test case is
> important. Besides, Axis2 already has some generated code checked it.
>
> Jarek
>
> On Wed, Jul 14, 2010 at 4:00 PM, Nikhil V Thaker
> <ni...@us.ibm.com> wrote:
> >
> > Yes Andreas,
> > I am running antrun plugin as the wsGen plugin has errors and is not fully matured, here's the URL that explains the issue I ran into http://jira.codehaus.org/browse/MNG-3586.
> >
> > So since I cannot run wsGen or cannot include generated artifacts I will just remove the test case. I will commit the changes soon.
> >
> > Regards,
> >
> > Nikhil Thaker
> > office: 919 254 9964
> > nvthaker@us.ibm.com
> >
> >
> > Andreas Veithen <an...@gmail.com>
> >
> > 07/14/2010 02:48 PM
> >
> > Please respond to
> > java-dev@axis.apache.org
> > To
> > java-dev@axis.apache.org
> > cc
> > Subject
> > Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws: ./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ test/org/apache/axis2/jaxws/wrapper/ test/org/apache/axis2/jaxws/wrapper/beans/
> >
> >
> >
> >
> > No, you are using the antrun plugin to execute the wsgen ant task.
> > What I meant was to use a real Maven plugin (either the one from
> > java.net or the one from CXF).
> >
> > -1 to commit any generated stuff into SVN.
> >
> > Andreas
> >
> > On Wed, Jul 14, 2010 at 21:42, Nikhil V Thaker
> > <ni...@us.ibm.com> wrote:
> > >
> > > Andreas - I had to add the tools.jar bit because maven plugin for wsGen gave NoClassDef Found errors for classes packaged in tools.jar.
> > >
> > > Since this is causing a problem I will just package the generated artifacts and remove the wsGen dependency.
> > >
> > > Thanks,
> > >
> > > Nikhil Thaker
> > > office: 919 254 9964
> > > nvthaker@us.ibm.com
> > >
> > >
> > > Andreas Veithen <an...@gmail.com>
> > >
> > > 07/14/2010 01:44 PM
> > >
> > > Please respond to
> > > java-dev@axis.apache.org
> > > To
> > > java-dev@axis.apache.org
> > > cc
> > > Subject
> > > Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws: ./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ test/org/apache/axis2/jaxws/wrapper/ test/org/apache/axis2/jaxws/wrapper/beans/
> > >
> > >
> > >
> > >
> > > Nikhil,
> > >
> > > I have some issues with the tools and jaxws-tools dependencies
> > > introduced by this change:
> > >
> > > * The change causes a build failure in Hudson. There will also be
> > > additional issues with tools.jar, because the way to declare this as a
> > > system dependency varies from one JDK to another. For example, I
> > > remember that on Mac OS X, it is completely different than on other
> > > JDKs.
> > >
> > > * I don't like the fact that jaxws-tools becomes a dependency of
> > > axis2-jaxws in scope compile, because it looks like this is only
> > > needed during the build and/or during the tests.
> > >
> > > I didn't review the change in detail, but wouldn't it be smarter to
> > > use one of the existing Maven plugins to do the wsgen stuff? They will
> > > take care of the tools.jar stuff as well.
> > >
> > > Andreas
> > >
> > > On Tue, Jul 13, 2010 at 00:16, <nt...@apache.org> wrote:
> > > > Author: nthaker
> > > > Date: Mon Jul 12 22:16:54 2010
> > > > New Revision: 963508
> > > >
> > > > URL: http://svn.apache.org/viewvc?rev=963508&view=rev
> > > > Log:
> > > > AXIS2-4775
> > > > This change ensures that we will use Request and Response wrapper Bean packaged by customer or we will Generate Wrappers if they are not packaged.
> > > >
> > > > Added:
> > > > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/
> > > > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/
> > > > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
> > > > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
> > > > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
> > > > axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml
> > > > Modified:
> > > > axis/axis2/java/core/trunk/modules/jaxws/pom.xml
> > > > axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
> > > >
> > > > Modified: axis/axis2/java/core/trunk/modules/jaxws/pom.xml
> > > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/pom.xml?rev=963508&r1=963507&r2=963508&view=diff
> > > > ==============================================================================
> > > > --- axis/axis2/java/core/trunk/modules/jaxws/pom.xml (original)
> > > > +++ axis/axis2/java/core/trunk/modules/jaxws/pom.xml Mon Jul 12 22:16:54 2010
> > > > @@ -1,5 +1,4 @@
> > > > <?xml version="1.0" encoding="UTF-8"?>
> > > > -
> > > > <!-- > ~ Licensed to the Apache Software Foundation (ASF) under one
> > > > ~ or more contributor license agreements. See the NOTICE file
> > > > @@ -20,7 +19,7 @@
> > > > -->
> > > >
> > > > <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> > > > - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
> > > > + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
> > > > <modelVersion>4.0.0</modelVersion>
> > > > <parent>
> > > > <groupId>org.apache.axis2</groupId>
> > > > @@ -98,7 +97,25 @@
> > > > <version>${version}</version>
> > > > <scope>test</scope>
> > > > </dependency>
> > > > + <dependency>
> > > > + <groupId>wsdl4j</groupId>
> > > > + <artifactId>wsdl4j</artifactId>
> > > > + </dependency>
> > > > + <dependency>
> > > > + <groupId>com.sun.xml.ws</groupId>
> > > > + <artifactId>jaxws-tools</artifactId>
> > > > + <version>2.1.3</version>
> > > > + </dependency>
> > > > + <!-- If we dont include tools.jar as dependency, maven throws NoClassDefFound on wsGen run -->
> > > > + <dependency>
> > > > + <groupId>java</groupId>
> > > > + <artifactId>tools</artifactId>
> > > > + <version>$version</version>
> > > > + <scope>system</scope>
> > > > + <systemPath>${JAVA_HOME}/lib/tools.jar</systemPath>
> > > > + </dependency>
> > > > </dependencies>
> > > > +
> > > > <build>
> > > > <sourceDirectory>src</sourceDirectory>
> > > > <testSourceDirectory>test</testSourceDirectory>
> > > > @@ -203,34 +220,39 @@
> > > > <compilerVersion>1.5</compilerVersion>
> > > > <source>1.5</source>
> > > > <target>1.5</target>
> > > > +
> > > > </configuration>
> > > > </plugin>
> > > > <plugin>
> > > > <groupId>org.apache.maven.plugins</groupId>
> > > > <artifactId>maven-antrun-plugin</artifactId>
> > > > +
> > > > <executions>
> > > > <execution>
> > > > <id>gen-ts</id>
> > > > <phase>generate-test-sources</phase>
> > > > <configuration>
> > > > - <tasks unless="maven.test.skip">
> > > > + <tasks unless="maven.test.skip">
> > > > <!-- Theres got to be a better way to do this -->
> > > > <property name="schema.source.dir" value="test-resources/xsd"/>
> > > > <property name="wsdl.source.dir" value="test-resources/wsdl"/>
> > > > - <property name="schema.output.base.dir" value="target/schema"/>
> > > > + <property name="schema.output.base.dir" value="target/schema"/>
> > > > <property name="schema.generated.src.dir" value="${schema.output.base.dir}/src"/>
> > > > <property name="schema.generated.classes.dir"
> > > > value="${schema.output.base.dir}/classes"/>
> > > > +
> > > > <!-- make the dirs -->
> > > > <mkdir dir="${schema.output.base.dir}"/>
> > > > <mkdir dir="${schema.generated.src.dir}"/>
> > > > <mkdir dir="${schema.generated.classes.dir}"/>
> > > > +
> > > > <!-- Run JAXB schema compiler with designated schemas -->
> > > > <echo>Generating JAX-B classes from XSDs</echo>
> > > >
> > > > <echo>Generating java from echo.xsd</echo>
> > > > <java classname="com.sun.tools.xjc.Driver" fork="true">
> > > > <classpath refid="maven.runtime.classpath"/>
> > > > +
> > > > <classpath location="${compiled.classes.dir}"/>
> > > > <arg line="-d ${schema.generated.src.dir} -quiet ${schema.source.dir}/echo.xsd"/>
> > > > </java>
> > > > @@ -266,7 +288,7 @@
> > > > <classpath refid="maven.runtime.classpath"/>
> > > > <classpath location="${compiled.classes.dir}"/>
> > > > <arg line="-d ${schema.generated.src.dir} -quiet -wsdl ${wsdl.source.dir}/AddNumbers.wsdl"/>
> > > > - </java>
> > > > + </java>
> > > > </tasks>
> > > > </configuration>
> > > > <goals>
> > > > @@ -287,6 +309,22 @@
> > > > <property name="addressing_version" value="${version}"/>
> > > > <ant antfile="build.xml" inheritall="true" inheritrefs="true"
> > > > dir="." target="build-repo"/>
> > > > +
> > > > + <property name="compile_classpath" refid="maven.compile.classpath" />
> > > > + <property name="runtime_classpath" refid="maven.runtime.classpath" />
> > > > + <property name="test_classpath" refid="maven.test.classpath" />
> > > > + <property name="plugin_classpath" refid="maven.plugin.classpath" />
> > > > +
> > > > + <!-- Defining wsGen task -->
> > > > + <taskdef name="wsgen" loaderRef="refwsgen" classname="com.sun.tools.ws.ant.WsGen">
> > > > + <classpath>
> > > > + <path refid="maven.runtime.classpath" />
> > > > + <path refid="maven.compile.classpath" />
> > > > + </classpath>
> > > > + </taskdef>
> > > > + <!-- Invoking test cases that need to generate artifacts using wsGen -->
> > > > + <ant antfile="wsgen-tests.xml" inheritall="true" inheritrefs="true"
> > > > + dir="." target="run-wsgen-tests"/>
> > > > </tasks>
> > > > </configuration>
> > > > <goals>
> > > > @@ -374,6 +412,13 @@
> > > > <plugin>
> > > > <groupId>org.apache.maven.plugins</groupId>
> > > > <artifactId>maven-surefire-report-plugin</artifactId>
> > > > + <reportSets>
> > > > + <reportSet>
> > > > + <reports>
> > > > + <report>report-only</report>
> > > > + </reports>
> > > > + </reportSet>
> > > > + </reportSets>
> > > > </plugin>
> > > > </plugins>
> > > > </reporting>
> > > >
> > > > Modified: axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
> > > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java?rev=963508&r1=963507&r2=963508&view=diff
> > > > ==============================================================================
> > > > --- axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java (original)
> > > > +++ axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java Mon Jul 12 22:16:54 2010
> > > > @@ -238,12 +238,27 @@ class ArtifactProcessor {
> > > > wrapperClass = newValue;
> > > > }
> > > > }
> > > > - if(cls==null && (type.equals("@WebFault")|| type.equals("faultInfo"))){
> > > > +
> > > > + if(cls==null &&
> > > > + (type.equals("@RequestWrapper")|| type.equals("@ResponseWrapper")||type.equals("@WebFault")|| type.equals("faultInfo"))){
> > > > +
> > > > + //Support for Fault Bean Generation
> > > > //As per JAX-WS 2.2 Specification section 3.7 an application programmer can choose not to
> > > > //package the faultBeans, if we have reached this point in the code then user has choosen
> > > > //not to package the fault bean. If there is a cache of generated artifacts available then
> > > > //lets look for the missing faultBean there.
> > > > -
> > > > +
> > > > + //Support for Wrapper Bean Generation
> > > > + //As per JAX-WS 2.2 Specificaiton section 3.6.2.1 pg 41 an application programmer does not use
> > > > + //the wrapper bean classes, so the application need not package these classes. If we have reached
> > > > + //this point in the code then user has choosen not to package these beans.
> > > > +
> > > > + //NOTE:If we find Generated artifacts from cache this guarantees that we will not use
> > > > + //DocLitWrappedMinimum marshaller code. The advantage of normal DocLitWrappedMarshaller is
> > > > + //that it is very robust and has support of lot more datatypes than in DocLitWrappedMinimum.
> > > > + if(log.isDebugEnabled()){
> > > > + log.debug("Adding cache to classpath");
> > > > + }
> > > > ClassFinderFactory cff =
> > > > (ClassFinderFactory)FactoryRegistry.getFactory(ClassFinderFactory.class);
> > > > ClassFinder cf = cff.getClassFinder();
> > > > @@ -317,11 +332,26 @@ class ArtifactProcessor {
> > > > if (cls2 == null) {
> > > > cls2 = loadClassOrNull(defaultValue, altClassLoader);
> > > > }
> > > > - if(cls2==null && (type.equals("faultInfo")|| type.equals("@WebFault"))){
> > > > - //As per JAX-WS 2.2 Specification section 3.7 an application programmer can choose not to
> > > > - //package the faultBeans, if we have reached this point in the code then user has choosen
> > > > - //not to package the fault bean. If there is a cache of generated artifacts available then
> > > > - //lets look for the missing faultBean there.
> > > > + if(cls2==null &&
> > > > + (type.equals("@RequestWrapper")|| type.equals("@ResponseWrapper")||type.equals("@WebFault")|| type.equals("faultInfo"))){
> > > > +
> > > > + //Support for Fault Bean Generation
> > > > + //As per JAX-WS 2.2 Specification section 3.7 an application programmer can choose not to
> > > > + //package the faultBeans, if we have reached this point in the code then user has choosen
> > > > + //not to package the fault bean. If there is a cache of generated artifacts available then
> > > > + //lets look for the missing faultBean there.
> > > > +
> > > > + //Support for Wrapper Bean Generation
> > > > + //As per JAX-WS 2.2 Specificaiton section 3.6.2.1 pg 41 an application programmer does not use
> > > > + //the wrapper bean classes, so the application need not package these classes. If we have reached
> > > > + //this point in the code then user has choosen not to package these beans.
> > > > +
> > > > + //NOTE:If we find Generated artifacts from cache this guarantees that we will not use
> > > > + //DocLitWrappedMinimum marshaller code. The advantage of normal DocLitWrappedMarshaller is
> > > > + //that it is very robust and has support of lot more datatypes than in DocLitWrappedMinimum.
> > > > + if(log.isDebugEnabled()){
> > > > + log.debug("Adding cache to classpath");
> > > > + }
> > > > if(log.isDebugEnabled()){
> > > > log.debug("Adding cache to classpath");
> > > > }
> > > >
> > > > Added: axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
> > > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java?rev=963508&view=auto
> > > > ==============================================================================
> > > > --- axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java (added)
> > > > +++ axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java Mon Jul 12 22:16:54 2010
> > > > @@ -0,0 +1,18 @@
> > > > +
> > > > +package org.apache.axis2.jaxws.wrapper.beans;
> > > > +
> > > > +import javax.xml.ws.WebFault;
> > > > +
> > > > +@WebFault(name = "AddNumbersFault", targetNamespace = "http://org/test/addnumbers")
> > > > +public class AddNumbersException extends Exception
> > > > +{
> > > > +
> > > > + private String message = null;
> > > > + public AddNumbersException(){}
> > > > + public AddNumbersException(String message){
> > > > + this.message = message;
> > > > + }
> > > > + public String getInfo(){
> > > > + return message;
> > > > + }
> > > > +}
> > > >
> > > > Added: axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
> > > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java?rev=963508&view=auto
> > > > ==============================================================================
> > > > --- axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java (added)
> > > > +++ axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java Mon Jul 12 22:16:54 2010
> > > > @@ -0,0 +1,15 @@
> > > > +package org.apache.axis2.jaxws.wrapper.beans;
> > > > +
> > > > +
> > > > +
> > > > +@javax.jws.WebService (targetNamespace="http://org/test/addnumbers", serviceName="AddNumbersService", portName="AddNumbersPort")
> > > > +public class AddNumbersService{
> > > > +
> > > > + public int addNumbers(int arg0, int arg1) throws AddNumbersException {
> > > > + if(arg0+arg1<0){
> > > > + throw new AddNumbersException("sum is less than 0");
> > > > + }
> > > > + return arg0+arg1;
> > > > + }
> > > > +
> > > > +}
> > > > \ No newline at end of file
> > > >
> > > > Added: axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
> > > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java?rev=963508&view=auto
> > > > ==============================================================================
> > > > --- axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java (added)
> > > > +++ axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java Mon Jul 12 22:16:54 2010
> > > > @@ -0,0 +1,114 @@
> > > > +/**
> > > > + *
> > > > + */
> > > > +package org.apache.axis2.jaxws.wrapper.beans;
> > > > +
> > > > +
> > > > +import org.apache.axis2.jaxws.Constants;
> > > > +import org.apache.axis2.jaxws.description.DescriptionFactory;
> > > > +import org.apache.axis2.jaxws.description.EndpointDescription;
> > > > +import org.apache.axis2.jaxws.description.EndpointDescriptionJava;
> > > > +import org.apache.axis2.jaxws.description.OperationDescription;
> > > > +import org.apache.axis2.jaxws.description.ServiceDescription;
> > > > +import org.apache.axis2.jaxws.marshaller.MethodMarshaller;
> > > > +import org.apache.axis2.jaxws.marshaller.factory.MethodMarshallerFactory;
> > > > +import org.apache.axis2.jaxws.marshaller.impl.alt.DocLitWrappedMinimalMethodMarshaller;
> > > > +import org.apache.axis2.jaxws.unitTest.TestLogger;
> > > > +
> > > > +import java.io.File;
> > > > +
> > > > +import junit.framework.TestCase;
> > > > +
> > > > +public class WrapperBeanMarshallTests extends TestCase {
> > > > + /**
> > > > + * This is the negative test case, when we do not use generated artifacts from cache
> > > > + * and user did not package wrapper beans, we should see use of DocLitWrappedMinumumMarshaller.
> > > > + */
> > > > + public void testGetMarshallerOperationDescriptionBooleanNegative() {
> > > > + TestLogger.logger.debug("---------------------------------------");
> > > > + TestLogger.logger.debug("test: " + getName());
> > > > +
> > > > + String cache_location = "/target/wscache/classes";
> > > > + try{
> > > > + String baseDir = new File(System.getProperty("basedir",".")).getCanonicalPath();
> > > > + cache_location = new File(baseDir+cache_location).getAbsolutePath();
> > > > + TestLogger.logger.debug("cache location ="+cache_location);
> > > > +
> > > > + //Get EndpointDescription.
> > > > + //Set location on AxisConfiguraiton.
> > > > + Class sei = AddNumbersService.class;
> > > > + EndpointDescription description = getEndpointDesc(sei);
> > > > + TestLogger.logger.debug("description objects where created successfully");
> > > > + OperationDescription[] ops =description.getEndpointInterfaceDescription().getOperations();
> > > > + assertNotNull( "OperationDescriptions where null", ops);
> > > > + assertTrue("No Operation Descriptions where found", ops.length>0);
> > > > + OperationDescription op = ops[0];
> > > > + TestLogger.logger.debug("operation found, java methodName="+op.getJavaMethodName());
> > > > + //Don not Set cache on AxisConfiguration.
> > > > + //get Marshaller, verify its not DoclitWrappedMinimum.
> > > > + TestLogger.logger.debug("ws_cache location NOT set on AxisConfigContext, location="+cache_location);
> > > > + MethodMarshaller mm = MethodMarshallerFactory.getMarshaller(op, false);
> > > > + assertNotNull("getMarshaller returned null", mm );
> > > > + TestLogger.logger.debug("MethodMarshaller was created, type="+mm.getClass().getName());
> > > > + assertTrue("Generated artifacts not found, Method marshaller should be DocLitWrappedMinimumMarshaller", (mm instanceof DocLitWrappedMinimalMethodMarshaller));
> > > > + }catch(Exception e){
> > > > + TestLogger.logger.debug("Exception ="+e.getMessage());
> > > > + fail(e.getMessage());
> > > > + }
> > > > +
> > > > + }
> > > > + /**
> > > > + * In this test case user did not package wrapper beans but we add generated artifacts from cache, we should see use of
> > > > + * DocLitWrappedMarshaller.
> > > > + * Test method for {@link org.apache.axis2.jaxws.marshaller.factory.MethodMarshallerFactory#getMarshaller(org.apache.axis2.jaxws.description.OperationDescription, boolean)}.
> > > > + */
> > > > + public void testGetMarshallerOperationDescriptionBoolean() {
> > > > + TestLogger.logger.debug("---------------------------------------");
> > > > + TestLogger.logger.debug("test: " + getName());
> > > > +
> > > > + String cache_location = "/target/wscache/classes";
> > > > + try{
> > > > + String baseDir = new File(System.getProperty("basedir",".")).getCanonicalPath();
> > > > + cache_location = new File(baseDir+cache_location).getAbsolutePath();
> > > > + TestLogger.logger.debug("cache location ="+cache_location);
> > > > +
> > > > + //Get EndpointDescription.
> > > > + //Set location on AxisConfiguraiton.
> > > > + Class sei = AddNumbersService.class;
> > > > + EndpointDescription description = getEndpointDesc(sei);
> > > > + TestLogger.logger.debug("description objects where created successfully");
> > > > + OperationDescription[] ops =description.getEndpointInterfaceDescription().getOperations();
> > > > + assertNotNull( "OperationDescriptions where null", ops);
> > > > + assertTrue("No Operation Descriptions where found", ops.length>0);
> > > > + OperationDescription op = ops[0];
> > > > + TestLogger.logger.debug("operation found, java methodName="+op.getJavaMethodName());
> > > > + //Set cache on AxisConfiguration.
> > > > + //get Marshaller, verify its not DoclitWrappedMinimum.
> > > > + description.getServiceDescription().getAxisConfigContext().setProperty(Constants.WS_CACHE, cache_location);
> > > > + TestLogger.logger.debug("ws_cache location set on AxisConfigContext, location="+cache_location);
> > > > + MethodMarshaller mm = MethodMarshallerFactory.getMarshaller(op, false);
> > > > + assertNotNull("getMarshaller returned null", mm );
> > > > + TestLogger.logger.debug("MethodMarshaller was created, type="+mm.getClass().getName());
> > > > + assertTrue("Generated artifacts are in cache, Method marshaller should not be DocLitWrappedMinimumMarshaller", !(mm instanceof DocLitWrappedMinimalMethodMarshaller));
> > > > + }catch(Exception e){
> > > > + TestLogger.logger.debug("Exception ="+e.getMessage());
> > > > + fail(e.getMessage());
> > > > + }
> > > > +
> > > > + }
> > > > +
> > > > + private EndpointDescription getEndpointDesc(Class implementationClass) {
> > > > + // Use the description factory directly; this will be done within the JAX-WS runtime
> > > > + ServiceDescription serviceDesc =
> > > > + DescriptionFactory.createServiceDescription(implementationClass);
> > > > + assertNotNull(serviceDesc);
> > > > +
> > > > + EndpointDescription[] endpointDesc = serviceDesc.getEndpointDescriptions();
> > > > + assertNotNull(endpointDesc);
> > > > + assertEquals(1, endpointDesc.length);
> > > > +
> > > > + // TODO: How will the JAX-WS dispatcher get the appropriate port (i.e. endpoint)? Currently assumes [0]
> > > > + EndpointDescription testEndpointDesc = endpointDesc[0];
> > > > + return testEndpointDesc;
> > > > + }
> > > > +}
> > > >
> > > > Added: axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml
> > > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml?rev=963508&view=auto
> > > > ==============================================================================
> > > > --- axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml (added)
> > > > +++ axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml Mon Jul 12 22:16:54 2010
> > > > @@ -0,0 +1,34 @@
> > > > +<?xml version="1.0" encoding="UTF-8"?>
> > > > +
> > > > +<project basedir="." default="run-wsgen-tests" name="wsgen-tests">
> > > > +
> > > > + <property name="wscache.output.base.dir" value="target/wscache" />
> > > > + <property name="wscache.generated.src.dir" value="${wscache.output.base.dir}/src" />
> > > > + <property name="wscache.generated.classes.dir" value="${wscache.output.base.dir}/classes" />
> > > > + <property name="compile.test.classes" value="target/test-classes" />
> > > > +
> > > > +
> > > > + <target name="run-wsgen-tests" depends="wrapper-beans"/>
> > > > +
> > > > +
> > > > + <target name="create-cache">
> > > > + <mkdir dir="${wscache.output.base.dir}" />
> > > > + <mkdir dir="${wscache.generated.src.dir}" />
> > > > + <mkdir dir="${wscache.generated.classes.dir}" />
> > > > + </target>
> > > > +
> > > > + <target name="wrapper-beans" depends="create-cache">
> > > > + <echo>Generating artifacts for org.apache.axis2.jaxws.wrapper.beans.AddNumbersService </echo>
> > > > + <wsgen
> > > > + sei="org.apache.axis2.jaxws.wrapper.beans.AddNumbersService"
> > > > + destdir="${wscache.generated.classes.dir}"
> > > > + resourcedestdir="${wscache.generated.src.dir}"
> > > > + keep="false"
> > > > + verbose="false"
> > > > + genwsdl="true">
> > > > + <classpath>
> > > > + <pathelement path="${compile.test.classes}" />
> > > > + </classpath>
> > > > + </wsgen>
> > > > + </target>
> > > > +</project>
> > > > \ No newline at end of file
> > > >
> > > >
> > > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
> > > For additional commands, e-mail: java-dev-help@axis.apache.org
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
> > For additional commands, e-mail: java-dev-help@axis.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-dev-help@axis.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org
Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws:
./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/
test/org/apache/axis2/jaxws/wrapper/ test/org/apache/axis2/jaxws/wrapper/beans/
Posted by Jarek Gawor <jg...@gmail.com>.
Nikhil,
I don't think there is an objection for adding jaxws-tools as a _test_
dependency. So as long you add the jaxws-tools dependency with
<scope>test</scope> there shouldn't be a problem.
Jarek
On Wed, Jul 14, 2010 at 10:40 PM, Nikhil V Thaker
<ni...@us.ibm.com> wrote:
>
> Thanks Jarek for the suggestion.
>
> The fact that there is an objection to putting jaxws-tools.jar as a dependency would mean we cannot run wsGen. Unless I misunderstood Andreas comments. To me we should always have jaxws-tools as dependency to jaxws module, after all jaxws tools are prerequisite to jaxws runtime, a user of jaxws runtime has to run wsGen or wsImport to build webservices application.
>
> Anyways, I will look and see if there is an alternate way to add these test cases.
>
> Regards,
>
> Nikhil Thaker
> office: 919 254 9964
> nvthaker@us.ibm.com
>
>
> Jarek Gawor <jg...@gmail.com>
>
> 07/14/2010 03:38 PM
>
> Please respond to
> java-dev@axis.apache.org
> To
> java-dev@axis.apache.org
> cc
> Subject
> Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws: ./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ test/org/apache/axis2/jaxws/wrapper/ test/org/apache/axis2/jaxws/wrapper/beans/
>
>
>
>
> Just a couple of thoughts:
>
> 1) Since you already have wsgen-tests.xml ant script to run the wsgen
> you could setup the appropriate classpath to the tools.jar or
> classes.jar or whatever in it. You just might need to fork the ant
> process.
>
> 2) I don't think it's that horrible to commit some generate code
> especially if there isn't too much of it and the test case is
> important. Besides, Axis2 already has some generated code checked it.
>
> Jarek
>
> On Wed, Jul 14, 2010 at 4:00 PM, Nikhil V Thaker
> <ni...@us.ibm.com> wrote:
> >
> > Yes Andreas,
> > I am running antrun plugin as the wsGen plugin has errors and is not fully matured, here's the URL that explains the issue I ran into http://jira.codehaus.org/browse/MNG-3586.
> >
> > So since I cannot run wsGen or cannot include generated artifacts I will just remove the test case. I will commit the changes soon.
> >
> > Regards,
> >
> > Nikhil Thaker
> > office: 919 254 9964
> > nvthaker@us.ibm.com
> >
> >
> > Andreas Veithen <an...@gmail.com>
> >
> > 07/14/2010 02:48 PM
> >
> > Please respond to
> > java-dev@axis.apache.org
> > To
> > java-dev@axis.apache.org
> > cc
> > Subject
> > Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws: ./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ test/org/apache/axis2/jaxws/wrapper/ test/org/apache/axis2/jaxws/wrapper/beans/
> >
> >
> >
> >
> > No, you are using the antrun plugin to execute the wsgen ant task.
> > What I meant was to use a real Maven plugin (either the one from
> > java.net or the one from CXF).
> >
> > -1 to commit any generated stuff into SVN.
> >
> > Andreas
> >
> > On Wed, Jul 14, 2010 at 21:42, Nikhil V Thaker
> > <ni...@us.ibm.com> wrote:
> > >
> > > Andreas - I had to add the tools.jar bit because maven plugin for wsGen gave NoClassDef Found errors for classes packaged in tools.jar.
> > >
> > > Since this is causing a problem I will just package the generated artifacts and remove the wsGen dependency.
> > >
> > > Thanks,
> > >
> > > Nikhil Thaker
> > > office: 919 254 9964
> > > nvthaker@us.ibm.com
> > >
> > >
> > > Andreas Veithen <an...@gmail.com>
> > >
> > > 07/14/2010 01:44 PM
> > >
> > > Please respond to
> > > java-dev@axis.apache.org
> > > To
> > > java-dev@axis.apache.org
> > > cc
> > > Subject
> > > Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws: ./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ test/org/apache/axis2/jaxws/wrapper/ test/org/apache/axis2/jaxws/wrapper/beans/
> > >
> > >
> > >
> > >
> > > Nikhil,
> > >
> > > I have some issues with the tools and jaxws-tools dependencies
> > > introduced by this change:
> > >
> > > * The change causes a build failure in Hudson. There will also be
> > > additional issues with tools.jar, because the way to declare this as a
> > > system dependency varies from one JDK to another. For example, I
> > > remember that on Mac OS X, it is completely different than on other
> > > JDKs.
> > >
> > > * I don't like the fact that jaxws-tools becomes a dependency of
> > > axis2-jaxws in scope compile, because it looks like this is only
> > > needed during the build and/or during the tests.
> > >
> > > I didn't review the change in detail, but wouldn't it be smarter to
> > > use one of the existing Maven plugins to do the wsgen stuff? They will
> > > take care of the tools.jar stuff as well.
> > >
> > > Andreas
> > >
> > > On Tue, Jul 13, 2010 at 00:16, <nt...@apache.org> wrote:
> > > > Author: nthaker
> > > > Date: Mon Jul 12 22:16:54 2010
> > > > New Revision: 963508
> > > >
> > > > URL: http://svn.apache.org/viewvc?rev=963508&view=rev
> > > > Log:
> > > > AXIS2-4775
> > > > This change ensures that we will use Request and Response wrapper Bean packaged by customer or we will Generate Wrappers if they are not packaged.
> > > >
> > > > Added:
> > > > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/
> > > > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/
> > > > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
> > > > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
> > > > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
> > > > axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml
> > > > Modified:
> > > > axis/axis2/java/core/trunk/modules/jaxws/pom.xml
> > > > axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
> > > >
> > > > Modified: axis/axis2/java/core/trunk/modules/jaxws/pom.xml
> > > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/pom.xml?rev=963508&r1=963507&r2=963508&view=diff
> > > > ==============================================================================
> > > > --- axis/axis2/java/core/trunk/modules/jaxws/pom.xml (original)
> > > > +++ axis/axis2/java/core/trunk/modules/jaxws/pom.xml Mon Jul 12 22:16:54 2010
> > > > @@ -1,5 +1,4 @@
> > > > <?xml version="1.0" encoding="UTF-8"?>
> > > > -
> > > > <!-- > ~ Licensed to the Apache Software Foundation (ASF) under one
> > > > ~ or more contributor license agreements. See the NOTICE file
> > > > @@ -20,7 +19,7 @@
> > > > -->
> > > >
> > > > <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> > > > - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
> > > > + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
> > > > <modelVersion>4.0.0</modelVersion>
> > > > <parent>
> > > > <groupId>org.apache.axis2</groupId>
> > > > @@ -98,7 +97,25 @@
> > > > <version>${version}</version>
> > > > <scope>test</scope>
> > > > </dependency>
> > > > + <dependency>
> > > > + <groupId>wsdl4j</groupId>
> > > > + <artifactId>wsdl4j</artifactId>
> > > > + </dependency>
> > > > + <dependency>
> > > > + <groupId>com.sun.xml.ws</groupId>
> > > > + <artifactId>jaxws-tools</artifactId>
> > > > + <version>2.1.3</version>
> > > > + </dependency>
> > > > + <!-- If we dont include tools.jar as dependency, maven throws NoClassDefFound on wsGen run -->
> > > > + <dependency>
> > > > + <groupId>java</groupId>
> > > > + <artifactId>tools</artifactId>
> > > > + <version>$version</version>
> > > > + <scope>system</scope>
> > > > + <systemPath>${JAVA_HOME}/lib/tools.jar</systemPath>
> > > > + </dependency>
> > > > </dependencies>
> > > > +
> > > > <build>
> > > > <sourceDirectory>src</sourceDirectory>
> > > > <testSourceDirectory>test</testSourceDirectory>
> > > > @@ -203,34 +220,39 @@
> > > > <compilerVersion>1.5</compilerVersion>
> > > > <source>1.5</source>
> > > > <target>1.5</target>
> > > > +
> > > > </configuration>
> > > > </plugin>
> > > > <plugin>
> > > > <groupId>org.apache.maven.plugins</groupId>
> > > > <artifactId>maven-antrun-plugin</artifactId>
> > > > +
> > > > <executions>
> > > > <execution>
> > > > <id>gen-ts</id>
> > > > <phase>generate-test-sources</phase>
> > > > <configuration>
> > > > - <tasks unless="maven.test.skip">
> > > > + <tasks unless="maven.test.skip">
> > > > <!-- Theres got to be a better way to do this -->
> > > > <property name="schema.source.dir" value="test-resources/xsd"/>
> > > > <property name="wsdl.source.dir" value="test-resources/wsdl"/>
> > > > - <property name="schema.output.base.dir" value="target/schema"/>
> > > > + <property name="schema.output.base.dir" value="target/schema"/>
> > > > <property name="schema.generated.src.dir" value="${schema.output.base.dir}/src"/>
> > > > <property name="schema.generated.classes.dir"
> > > > value="${schema.output.base.dir}/classes"/>
> > > > +
> > > > <!-- make the dirs -->
> > > > <mkdir dir="${schema.output.base.dir}"/>
> > > > <mkdir dir="${schema.generated.src.dir}"/>
> > > > <mkdir dir="${schema.generated.classes.dir}"/>
> > > > +
> > > > <!-- Run JAXB schema compiler with designated schemas -->
> > > > <echo>Generating JAX-B classes from XSDs</echo>
> > > >
> > > > <echo>Generating java from echo.xsd</echo>
> > > > <java classname="com.sun.tools.xjc.Driver" fork="true">
> > > > <classpath refid="maven.runtime.classpath"/>
> > > > +
> > > > <classpath location="${compiled.classes.dir}"/>
> > > > <arg line="-d ${schema.generated.src.dir} -quiet ${schema.source.dir}/echo.xsd"/>
> > > > </java>
> > > > @@ -266,7 +288,7 @@
> > > > <classpath refid="maven.runtime.classpath"/>
> > > > <classpath location="${compiled.classes.dir}"/>
> > > > <arg line="-d ${schema.generated.src.dir} -quiet -wsdl ${wsdl.source.dir}/AddNumbers.wsdl"/>
> > > > - </java>
> > > > + </java>
> > > > </tasks>
> > > > </configuration>
> > > > <goals>
> > > > @@ -287,6 +309,22 @@
> > > > <property name="addressing_version" value="${version}"/>
> > > > <ant antfile="build.xml" inheritall="true" inheritrefs="true"
> > > > dir="." target="build-repo"/>
> > > > +
> > > > + <property name="compile_classpath" refid="maven.compile.classpath" />
> > > > + <property name="runtime_classpath" refid="maven.runtime.classpath" />
> > > > + <property name="test_classpath" refid="maven.test.classpath" />
> > > > + <property name="plugin_classpath" refid="maven.plugin.classpath" />
> > > > +
> > > > + <!-- Defining wsGen task -->
> > > > + <taskdef name="wsgen" loaderRef="refwsgen" classname="com.sun.tools.ws.ant.WsGen">
> > > > + <classpath>
> > > > + <path refid="maven.runtime.classpath" />
> > > > + <path refid="maven.compile.classpath" />
> > > > + </classpath>
> > > > + </taskdef>
> > > > + <!-- Invoking test cases that need to generate artifacts using wsGen -->
> > > > + <ant antfile="wsgen-tests.xml" inheritall="true" inheritrefs="true"
> > > > + dir="." target="run-wsgen-tests"/>
> > > > </tasks>
> > > > </configuration>
> > > > <goals>
> > > > @@ -374,6 +412,13 @@
> > > > <plugin>
> > > > <groupId>org.apache.maven.plugins</groupId>
> > > > <artifactId>maven-surefire-report-plugin</artifactId>
> > > > + <reportSets>
> > > > + <reportSet>
> > > > + <reports>
> > > > + <report>report-only</report>
> > > > + </reports>
> > > > + </reportSet>
> > > > + </reportSets>
> > > > </plugin>
> > > > </plugins>
> > > > </reporting>
> > > >
> > > > Modified: axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
> > > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java?rev=963508&r1=963507&r2=963508&view=diff
> > > > ==============================================================================
> > > > --- axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java (original)
> > > > +++ axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java Mon Jul 12 22:16:54 2010
> > > > @@ -238,12 +238,27 @@ class ArtifactProcessor {
> > > > wrapperClass = newValue;
> > > > }
> > > > }
> > > > - if(cls==null && (type.equals("@WebFault")|| type.equals("faultInfo"))){
> > > > +
> > > > + if(cls==null &&
> > > > + (type.equals("@RequestWrapper")|| type.equals("@ResponseWrapper")||type.equals("@WebFault")|| type.equals("faultInfo"))){
> > > > +
> > > > + //Support for Fault Bean Generation
> > > > //As per JAX-WS 2.2 Specification section 3.7 an application programmer can choose not to
> > > > //package the faultBeans, if we have reached this point in the code then user has choosen
> > > > //not to package the fault bean. If there is a cache of generated artifacts available then
> > > > //lets look for the missing faultBean there.
> > > > -
> > > > +
> > > > + //Support for Wrapper Bean Generation
> > > > + //As per JAX-WS 2.2 Specificaiton section 3.6.2.1 pg 41 an application programmer does not use
> > > > + //the wrapper bean classes, so the application need not package these classes. If we have reached
> > > > + //this point in the code then user has choosen not to package these beans.
> > > > +
> > > > + //NOTE:If we find Generated artifacts from cache this guarantees that we will not use
> > > > + //DocLitWrappedMinimum marshaller code. The advantage of normal DocLitWrappedMarshaller is
> > > > + //that it is very robust and has support of lot more datatypes than in DocLitWrappedMinimum.
> > > > + if(log.isDebugEnabled()){
> > > > + log.debug("Adding cache to classpath");
> > > > + }
> > > > ClassFinderFactory cff =
> > > > (ClassFinderFactory)FactoryRegistry.getFactory(ClassFinderFactory.class);
> > > > ClassFinder cf = cff.getClassFinder();
> > > > @@ -317,11 +332,26 @@ class ArtifactProcessor {
> > > > if (cls2 == null) {
> > > > cls2 = loadClassOrNull(defaultValue, altClassLoader);
> > > > }
> > > > - if(cls2==null && (type.equals("faultInfo")|| type.equals("@WebFault"))){
> > > > - //As per JAX-WS 2.2 Specification section 3.7 an application programmer can choose not to
> > > > - //package the faultBeans, if we have reached this point in the code then user has choosen
> > > > - //not to package the fault bean. If there is a cache of generated artifacts available then
> > > > - //lets look for the missing faultBean there.
> > > > + if(cls2==null &&
> > > > + (type.equals("@RequestWrapper")|| type.equals("@ResponseWrapper")||type.equals("@WebFault")|| type.equals("faultInfo"))){
> > > > +
> > > > + //Support for Fault Bean Generation
> > > > + //As per JAX-WS 2.2 Specification section 3.7 an application programmer can choose not to
> > > > + //package the faultBeans, if we have reached this point in the code then user has choosen
> > > > + //not to package the fault bean. If there is a cache of generated artifacts available then
> > > > + //lets look for the missing faultBean there.
> > > > +
> > > > + //Support for Wrapper Bean Generation
> > > > + //As per JAX-WS 2.2 Specificaiton section 3.6.2.1 pg 41 an application programmer does not use
> > > > + //the wrapper bean classes, so the application need not package these classes. If we have reached
> > > > + //this point in the code then user has choosen not to package these beans.
> > > > +
> > > > + //NOTE:If we find Generated artifacts from cache this guarantees that we will not use
> > > > + //DocLitWrappedMinimum marshaller code. The advantage of normal DocLitWrappedMarshaller is
> > > > + //that it is very robust and has support of lot more datatypes than in DocLitWrappedMinimum.
> > > > + if(log.isDebugEnabled()){
> > > > + log.debug("Adding cache to classpath");
> > > > + }
> > > > if(log.isDebugEnabled()){
> > > > log.debug("Adding cache to classpath");
> > > > }
> > > >
> > > > Added: axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
> > > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java?rev=963508&view=auto
> > > > ==============================================================================
> > > > --- axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java (added)
> > > > +++ axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java Mon Jul 12 22:16:54 2010
> > > > @@ -0,0 +1,18 @@
> > > > +
> > > > +package org.apache.axis2.jaxws.wrapper.beans;
> > > > +
> > > > +import javax.xml.ws.WebFault;
> > > > +
> > > > +@WebFault(name = "AddNumbersFault", targetNamespace = "http://org/test/addnumbers")
> > > > +public class AddNumbersException extends Exception
> > > > +{
> > > > +
> > > > + private String message = null;
> > > > + public AddNumbersException(){}
> > > > + public AddNumbersException(String message){
> > > > + this.message = message;
> > > > + }
> > > > + public String getInfo(){
> > > > + return message;
> > > > + }
> > > > +}
> > > >
> > > > Added: axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
> > > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java?rev=963508&view=auto
> > > > ==============================================================================
> > > > --- axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java (added)
> > > > +++ axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java Mon Jul 12 22:16:54 2010
> > > > @@ -0,0 +1,15 @@
> > > > +package org.apache.axis2.jaxws.wrapper.beans;
> > > > +
> > > > +
> > > > +
> > > > +@javax.jws.WebService (targetNamespace="http://org/test/addnumbers", serviceName="AddNumbersService", portName="AddNumbersPort")
> > > > +public class AddNumbersService{
> > > > +
> > > > + public int addNumbers(int arg0, int arg1) throws AddNumbersException {
> > > > + if(arg0+arg1<0){
> > > > + throw new AddNumbersException("sum is less than 0");
> > > > + }
> > > > + return arg0+arg1;
> > > > + }
> > > > +
> > > > +}
> > > > \ No newline at end of file
> > > >
> > > > Added: axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
> > > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java?rev=963508&view=auto
> > > > ==============================================================================
> > > > --- axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java (added)
> > > > +++ axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java Mon Jul 12 22:16:54 2010
> > > > @@ -0,0 +1,114 @@
> > > > +/**
> > > > + *
> > > > + */
> > > > +package org.apache.axis2.jaxws.wrapper.beans;
> > > > +
> > > > +
> > > > +import org.apache.axis2.jaxws.Constants;
> > > > +import org.apache.axis2.jaxws.description.DescriptionFactory;
> > > > +import org.apache.axis2.jaxws.description.EndpointDescription;
> > > > +import org.apache.axis2.jaxws.description.EndpointDescriptionJava;
> > > > +import org.apache.axis2.jaxws.description.OperationDescription;
> > > > +import org.apache.axis2.jaxws.description.ServiceDescription;
> > > > +import org.apache.axis2.jaxws.marshaller.MethodMarshaller;
> > > > +import org.apache.axis2.jaxws.marshaller.factory.MethodMarshallerFactory;
> > > > +import org.apache.axis2.jaxws.marshaller.impl.alt.DocLitWrappedMinimalMethodMarshaller;
> > > > +import org.apache.axis2.jaxws.unitTest.TestLogger;
> > > > +
> > > > +import java.io.File;
> > > > +
> > > > +import junit.framework.TestCase;
> > > > +
> > > > +public class WrapperBeanMarshallTests extends TestCase {
> > > > + /**
> > > > + * This is the negative test case, when we do not use generated artifacts from cache
> > > > + * and user did not package wrapper beans, we should see use of DocLitWrappedMinumumMarshaller.
> > > > + */
> > > > + public void testGetMarshallerOperationDescriptionBooleanNegative() {
> > > > + TestLogger.logger.debug("---------------------------------------");
> > > > + TestLogger.logger.debug("test: " + getName());
> > > > +
> > > > + String cache_location = "/target/wscache/classes";
> > > > + try{
> > > > + String baseDir = new File(System.getProperty("basedir",".")).getCanonicalPath();
> > > > + cache_location = new File(baseDir+cache_location).getAbsolutePath();
> > > > + TestLogger.logger.debug("cache location ="+cache_location);
> > > > +
> > > > + //Get EndpointDescription.
> > > > + //Set location on AxisConfiguraiton.
> > > > + Class sei = AddNumbersService.class;
> > > > + EndpointDescription description = getEndpointDesc(sei);
> > > > + TestLogger.logger.debug("description objects where created successfully");
> > > > + OperationDescription[] ops =description.getEndpointInterfaceDescription().getOperations();
> > > > + assertNotNull( "OperationDescriptions where null", ops);
> > > > + assertTrue("No Operation Descriptions where found", ops.length>0);
> > > > + OperationDescription op = ops[0];
> > > > + TestLogger.logger.debug("operation found, java methodName="+op.getJavaMethodName());
> > > > + //Don not Set cache on AxisConfiguration.
> > > > + //get Marshaller, verify its not DoclitWrappedMinimum.
> > > > + TestLogger.logger.debug("ws_cache location NOT set on AxisConfigContext, location="+cache_location);
> > > > + MethodMarshaller mm = MethodMarshallerFactory.getMarshaller(op, false);
> > > > + assertNotNull("getMarshaller returned null", mm );
> > > > + TestLogger.logger.debug("MethodMarshaller was created, type="+mm.getClass().getName());
> > > > + assertTrue("Generated artifacts not found, Method marshaller should be DocLitWrappedMinimumMarshaller", (mm instanceof DocLitWrappedMinimalMethodMarshaller));
> > > > + }catch(Exception e){
> > > > + TestLogger.logger.debug("Exception ="+e.getMessage());
> > > > + fail(e.getMessage());
> > > > + }
> > > > +
> > > > + }
> > > > + /**
> > > > + * In this test case user did not package wrapper beans but we add generated artifacts from cache, we should see use of
> > > > + * DocLitWrappedMarshaller.
> > > > + * Test method for {@link org.apache.axis2.jaxws.marshaller.factory.MethodMarshallerFactory#getMarshaller(org.apache.axis2.jaxws.description.OperationDescription, boolean)}.
> > > > + */
> > > > + public void testGetMarshallerOperationDescriptionBoolean() {
> > > > + TestLogger.logger.debug("---------------------------------------");
> > > > + TestLogger.logger.debug("test: " + getName());
> > > > +
> > > > + String cache_location = "/target/wscache/classes";
> > > > + try{
> > > > + String baseDir = new File(System.getProperty("basedir",".")).getCanonicalPath();
> > > > + cache_location = new File(baseDir+cache_location).getAbsolutePath();
> > > > + TestLogger.logger.debug("cache location ="+cache_location);
> > > > +
> > > > + //Get EndpointDescription.
> > > > + //Set location on AxisConfiguraiton.
> > > > + Class sei = AddNumbersService.class;
> > > > + EndpointDescription description = getEndpointDesc(sei);
> > > > + TestLogger.logger.debug("description objects where created successfully");
> > > > + OperationDescription[] ops =description.getEndpointInterfaceDescription().getOperations();
> > > > + assertNotNull( "OperationDescriptions where null", ops);
> > > > + assertTrue("No Operation Descriptions where found", ops.length>0);
> > > > + OperationDescription op = ops[0];
> > > > + TestLogger.logger.debug("operation found, java methodName="+op.getJavaMethodName());
> > > > + //Set cache on AxisConfiguration.
> > > > + //get Marshaller, verify its not DoclitWrappedMinimum.
> > > > + description.getServiceDescription().getAxisConfigContext().setProperty(Constants.WS_CACHE, cache_location);
> > > > + TestLogger.logger.debug("ws_cache location set on AxisConfigContext, location="+cache_location);
> > > > + MethodMarshaller mm = MethodMarshallerFactory.getMarshaller(op, false);
> > > > + assertNotNull("getMarshaller returned null", mm );
> > > > + TestLogger.logger.debug("MethodMarshaller was created, type="+mm.getClass().getName());
> > > > + assertTrue("Generated artifacts are in cache, Method marshaller should not be DocLitWrappedMinimumMarshaller", !(mm instanceof DocLitWrappedMinimalMethodMarshaller));
> > > > + }catch(Exception e){
> > > > + TestLogger.logger.debug("Exception ="+e.getMessage());
> > > > + fail(e.getMessage());
> > > > + }
> > > > +
> > > > + }
> > > > +
> > > > + private EndpointDescription getEndpointDesc(Class implementationClass) {
> > > > + // Use the description factory directly; this will be done within the JAX-WS runtime
> > > > + ServiceDescription serviceDesc =
> > > > + DescriptionFactory.createServiceDescription(implementationClass);
> > > > + assertNotNull(serviceDesc);
> > > > +
> > > > + EndpointDescription[] endpointDesc = serviceDesc.getEndpointDescriptions();
> > > > + assertNotNull(endpointDesc);
> > > > + assertEquals(1, endpointDesc.length);
> > > > +
> > > > + // TODO: How will the JAX-WS dispatcher get the appropriate port (i.e. endpoint)? Currently assumes [0]
> > > > + EndpointDescription testEndpointDesc = endpointDesc[0];
> > > > + return testEndpointDesc;
> > > > + }
> > > > +}
> > > >
> > > > Added: axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml
> > > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml?rev=963508&view=auto
> > > > ==============================================================================
> > > > --- axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml (added)
> > > > +++ axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml Mon Jul 12 22:16:54 2010
> > > > @@ -0,0 +1,34 @@
> > > > +<?xml version="1.0" encoding="UTF-8"?>
> > > > +
> > > > +<project basedir="." default="run-wsgen-tests" name="wsgen-tests">
> > > > +
> > > > + <property name="wscache.output.base.dir" value="target/wscache" />
> > > > + <property name="wscache.generated.src.dir" value="${wscache.output.base.dir}/src" />
> > > > + <property name="wscache.generated.classes.dir" value="${wscache.output.base.dir}/classes" />
> > > > + <property name="compile.test.classes" value="target/test-classes" />
> > > > +
> > > > +
> > > > + <target name="run-wsgen-tests" depends="wrapper-beans"/>
> > > > +
> > > > +
> > > > + <target name="create-cache">
> > > > + <mkdir dir="${wscache.output.base.dir}" />
> > > > + <mkdir dir="${wscache.generated.src.dir}" />
> > > > + <mkdir dir="${wscache.generated.classes.dir}" />
> > > > + </target>
> > > > +
> > > > + <target name="wrapper-beans" depends="create-cache">
> > > > + <echo>Generating artifacts for org.apache.axis2.jaxws.wrapper.beans.AddNumbersService </echo>
> > > > + <wsgen
> > > > + sei="org.apache.axis2.jaxws.wrapper.beans.AddNumbersService"
> > > > + destdir="${wscache.generated.classes.dir}"
> > > > + resourcedestdir="${wscache.generated.src.dir}"
> > > > + keep="false"
> > > > + verbose="false"
> > > > + genwsdl="true">
> > > > + <classpath>
> > > > + <pathelement path="${compile.test.classes}" />
> > > > + </classpath>
> > > > + </wsgen>
> > > > + </target>
> > > > +</project>
> > > > \ No newline at end of file
> > > >
> > > >
> > > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
> > > For additional commands, e-mail: java-dev-help@axis.apache.org
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
> > For additional commands, e-mail: java-dev-help@axis.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-dev-help@axis.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org
Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws: ./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/
test/org/apache/axis2/jaxws/wrapper/ test/org/apache/axis2/jaxws/wrapper/beans/
Posted by Nikhil V Thaker <ni...@us.ibm.com>.
Thanks Jarek for the suggestion.
The fact that there is an objection to putting jaxws-tools.jar as a
dependency would mean we cannot run wsGen. Unless I misunderstood Andreas
comments. To me we should always have jaxws-tools as dependency to jaxws
module, after all jaxws tools are prerequisite to jaxws runtime, a user of
jaxws runtime has to run wsGen or wsImport to build webservices
application.
Anyways, I will look and see if there is an alternate way to add these
test cases.
Regards,
Nikhil Thaker
office: 919 254 9964
nvthaker@us.ibm.com
Jarek Gawor <jg...@gmail.com>
07/14/2010 03:38 PM
Please respond to
java-dev@axis.apache.org
To
java-dev@axis.apache.org
cc
Subject
Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws: ./
src/org/apache/axis2/jaxws/runtime/description/marshal/impl/
test/org/apache/axis2/jaxws/wrapper/
test/org/apache/axis2/jaxws/wrapper/beans/
Just a couple of thoughts:
1) Since you already have wsgen-tests.xml ant script to run the wsgen
you could setup the appropriate classpath to the tools.jar or
classes.jar or whatever in it. You just might need to fork the ant
process.
2) I don't think it's that horrible to commit some generate code
especially if there isn't too much of it and the test case is
important. Besides, Axis2 already has some generated code checked it.
Jarek
On Wed, Jul 14, 2010 at 4:00 PM, Nikhil V Thaker
<ni...@us.ibm.com> wrote:
>
> Yes Andreas,
> I am running antrun plugin as the wsGen plugin has errors and is not
fully matured, here's the URL that explains the issue I ran into
http://jira.codehaus.org/browse/MNG-3586.
>
> So since I cannot run wsGen or cannot include generated artifacts I will
just remove the test case. I will commit the changes soon.
>
> Regards,
>
> Nikhil Thaker
> office: 919 254 9964
> nvthaker@us.ibm.com
>
>
> Andreas Veithen <an...@gmail.com>
>
> 07/14/2010 02:48 PM
>
> Please respond to
> java-dev@axis.apache.org
> To
> java-dev@axis.apache.org
> cc
> Subject
> Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws:
./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/
test/org/apache/axis2/jaxws/wrapper/
test/org/apache/axis2/jaxws/wrapper/beans/
>
>
>
>
> No, you are using the antrun plugin to execute the wsgen ant task.
> What I meant was to use a real Maven plugin (either the one from
> java.net or the one from CXF).
>
> -1 to commit any generated stuff into SVN.
>
> Andreas
>
> On Wed, Jul 14, 2010 at 21:42, Nikhil V Thaker
> <ni...@us.ibm.com> wrote:
> >
> > Andreas - I had to add the tools.jar bit because maven plugin for
wsGen gave NoClassDef Found errors for classes packaged in tools.jar.
> >
> > Since this is causing a problem I will just package the generated
artifacts and remove the wsGen dependency.
> >
> > Thanks,
> >
> > Nikhil Thaker
> > office: 919 254 9964
> > nvthaker@us.ibm.com
> >
> >
> > Andreas Veithen <an...@gmail.com>
> >
> > 07/14/2010 01:44 PM
> >
> > Please respond to
> > java-dev@axis.apache.org
> > To
> > java-dev@axis.apache.org
> > cc
> > Subject
> > Re: svn commit: r963508 - in
/axis/axis2/java/core/trunk/modules/jaxws: ./
src/org/apache/axis2/jaxws/runtime/description/marshal/impl/
test/org/apache/axis2/jaxws/wrapper/
test/org/apache/axis2/jaxws/wrapper/beans/
> >
> >
> >
> >
> > Nikhil,
> >
> > I have some issues with the tools and jaxws-tools dependencies
> > introduced by this change:
> >
> > * The change causes a build failure in Hudson. There will also be
> > additional issues with tools.jar, because the way to declare this as a
> > system dependency varies from one JDK to another. For example, I
> > remember that on Mac OS X, it is completely different than on other
> > JDKs.
> >
> > * I don't like the fact that jaxws-tools becomes a dependency of
> > axis2-jaxws in scope compile, because it looks like this is only
> > needed during the build and/or during the tests.
> >
> > I didn't review the change in detail, but wouldn't it be smarter to
> > use one of the existing Maven plugins to do the wsgen stuff? They will
> > take care of the tools.jar stuff as well.
> >
> > Andreas
> >
> > On Tue, Jul 13, 2010 at 00:16, <nt...@apache.org> wrote:
> > > Author: nthaker
> > > Date: Mon Jul 12 22:16:54 2010
> > > New Revision: 963508
> > >
> > > URL: http://svn.apache.org/viewvc?rev=963508&view=rev
> > > Log:
> > > AXIS2-4775
> > > This change ensures that we will use Request and Response wrapper
Bean packaged by customer or we will Generate Wrappers if they are not
packaged.
> > >
> > > Added:
> > >
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/
> > >
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/
> > >
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
> > >
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
> > >
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
> > > axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml
> > > Modified:
> > > axis/axis2/java/core/trunk/modules/jaxws/pom.xml
> > >
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
> > >
> > > Modified: axis/axis2/java/core/trunk/modules/jaxws/pom.xml
> > > URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/pom.xml?rev=963508&r1=963507&r2=963508&view=diff
> > >
==============================================================================
> > > --- axis/axis2/java/core/trunk/modules/jaxws/pom.xml (original)
> > > +++ axis/axis2/java/core/trunk/modules/jaxws/pom.xml Mon Jul 12
22:16:54 2010
> > > @@ -1,5 +1,4 @@
> > > <?xml version="1.0" encoding="UTF-8"?>
> > > -
> > > <!-- > ~ Licensed to the Apache Software Foundation (ASF) under
one
> > > ~ or more contributor license agreements. See the NOTICE file
> > > @@ -20,7 +19,7 @@
> > > -->
> > >
> > > <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"
> > > - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
> > > + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
> > > <modelVersion>4.0.0</modelVersion>
> > > <parent>
> > > <groupId>org.apache.axis2</groupId>
> > > @@ -98,7 +97,25 @@
> > > <version>${version}</version>
> > > <scope>test</scope>
> > > </dependency>
> > > + <dependency>
> > > + <groupId>wsdl4j</groupId>
> > > + <artifactId>wsdl4j</artifactId>
> > > + </dependency>
> > > + <dependency>
> > > + <groupId>com.sun.xml.ws</groupId>
> > > + <artifactId>jaxws-tools</artifactId>
> > > + <version>2.1.3</version>
> > > + </dependency>
> > > + <!-- If we dont include tools.jar as dependency, maven
throws NoClassDefFound on wsGen run -->
> > > + <dependency>
> > > + <groupId>java</groupId>
> > > + <artifactId>tools</artifactId>
> > > + <version>$version</version>
> > > + <scope>system</scope>
> > > + <systemPath>${JAVA_HOME}/lib/tools.jar</systemPath>
> > > + </dependency>
> > > </dependencies>
> > > +
> > > <build>
> > > <sourceDirectory>src</sourceDirectory>
> > > <testSourceDirectory>test</testSourceDirectory>
> > > @@ -203,34 +220,39 @@
> > > <compilerVersion>1.5</compilerVersion>
> > > <source>1.5</source>
> > > <target>1.5</target>
> > > +
> > > </configuration>
> > > </plugin>
> > > <plugin>
> > > <groupId>org.apache.maven.plugins</groupId>
> > > <artifactId>maven-antrun-plugin</artifactId>
> > > +
> > > <executions>
> > > <execution>
> > > <id>gen-ts</id>
> > > <phase>generate-test-sources</phase>
> > > <configuration>
> > > - <tasks unless="maven.test.skip">
> > > + <tasks unless="maven.test.skip">
> > > <!-- Theres got to be a better way
to do this -->
> > > <property name="schema.source.dir"
value="test-resources/xsd"/>
> > > <property name="wsdl.source.dir"
value="test-resources/wsdl"/>
> > > - <property
name="schema.output.base.dir" value="target/schema"/>
> > > + <property
name="schema.output.base.dir" value="target/schema"/>
> > > <property
name="schema.generated.src.dir" value="${schema.output.base.dir}/src"/>
> > > <property
name="schema.generated.classes.dir"
> > >
value="${schema.output.base.dir}/classes"/>
> > > +
> > > <!-- make the dirs -->
> > > <mkdir
dir="${schema.output.base.dir}"/>
> > > <mkdir
dir="${schema.generated.src.dir}"/>
> > > <mkdir
dir="${schema.generated.classes.dir}"/>
> > > +
> > > <!-- Run JAXB schema compiler with
designated schemas -->
> > > <echo>Generating JAX-B classes from
XSDs</echo>
> > >
> > > <echo>Generating java from
echo.xsd</echo>
> > > <java
classname="com.sun.tools.xjc.Driver" fork="true">
> > > <classpath
refid="maven.runtime.classpath"/>
> > > +
> > > <classpath
location="${compiled.classes.dir}"/>
> > > <arg line="-d
${schema.generated.src.dir} -quiet ${schema.source.dir}/echo.xsd"/>
> > > </java>
> > > @@ -266,7 +288,7 @@
> > > <classpath
refid="maven.runtime.classpath"/>
> > > <classpath
location="${compiled.classes.dir}"/>
> > > <arg line="-d
${schema.generated.src.dir} -quiet -wsdl
${wsdl.source.dir}/AddNumbers.wsdl"/>
> > > - </java>
> > > + </java>
> > > </tasks>
> > > </configuration>
> > > <goals>
> > > @@ -287,6 +309,22 @@
> > > <property name="addressing_version"
value="${version}"/>
> > > <ant antfile="build.xml"
inheritall="true" inheritrefs="true"
> > > dir="." target="build-repo"/>
> > > +
> > > +
<property name="compile_classpath" refid="maven.compile.classpath" />
> > > +
<property name="runtime_classpath" refid="maven.runtime.classpath" />
> > > +
<property name="test_classpath" refid="maven.test.classpath" />
> > > +
<property name="plugin_classpath" refid="maven.plugin.classpath" />
> > > +
> > > + <!-- Defining wsGen task -->
> > > +
<taskdef name="wsgen" loaderRef="refwsgen"
classname="com.sun.tools.ws.ant.WsGen">
> > > +
<classpath>
> > > +
<path refid="maven.runtime.classpath" />
> > > +
<path refid="maven.compile.classpath" />
> > > +
</classpath>
> > > +
</taskdef>
> > > + <!--
Invoking test cases that need to generate artifacts using wsGen -->
> > > + <ant antfile="wsgen-tests.xml"
inheritall="true" inheritrefs="true"
> > > + dir="."
target="run-wsgen-tests"/>
> > > </tasks>
> > > </configuration>
> > > <goals>
> > > @@ -374,6 +412,13 @@
> > > <plugin>
> > > <groupId>org.apache.maven.plugins</groupId>
> > >
<artifactId>maven-surefire-report-plugin</artifactId>
> > > + <reportSets>
> > > + <reportSet>
> > > + <reports>
> > > + <report>report-only</report>
> > > + </reports>
> > > + </reportSet>
> > > + </reportSets>
> > > </plugin>
> > > </plugins>
> > > </reporting>
> > >
> > > Modified:
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
> > > URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java?rev=963508&r1=963507&r2=963508&view=diff
> > >
==============================================================================
> > > ---
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
(original)
> > > +++
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
Mon Jul 12 22:16:54 2010
> > > @@ -238,12 +238,27 @@ class ArtifactProcessor {
> > > wrapperClass = newValue;
> > > }
> > > }
> > > - if(cls==null && (type.equals("@WebFault")||
type.equals("faultInfo"))){
> > > +
> > > + if(cls==null &&
> > > + (type.equals("@RequestWrapper")||
type.equals("@ResponseWrapper")||type.equals("@WebFault")||
type.equals("faultInfo"))){
> > > +
> > > + //Support for Fault Bean Generation
> > > //As per JAX-WS 2.2 Specification
section 3.7 an application programmer can choose not to
> > > //package the faultBeans, if we have
reached this point in the code then user has choosen
> > > //not to package the fault bean. If
there is a cache of generated artifacts available then
> > > //lets look for the missing faultBean
there.
> > > -
> > > +
> > > + //Support for Wrapper Bean Generation
> > > + //As per JAX-WS 2.2 Specificaiton
section 3.6.2.1 pg 41 an application programmer does not use
> > > + //the wrapper bean classes, so the
application need not package these classes. If we have reached
> > > + //this point in the code then user has
choosen not to package these beans.
> > > +
> > > + //NOTE:If we find Generated artifacts
from cache this guarantees that we will not use
> > > + //DocLitWrappedMinimum marshaller code.
The advantage of normal DocLitWrappedMarshaller is
> > > + //that it is very robust and has
support of lot more datatypes than in DocLitWrappedMinimum.
> > > + if(log.isDebugEnabled()){
> > > + log.debug("Adding cache to
classpath");
> > > + }
> > > ClassFinderFactory cff =
> > >
(ClassFinderFactory)FactoryRegistry.getFactory(ClassFinderFactory.class);
> > > ClassFinder cf = cff.getClassFinder();
> > > @@ -317,11 +332,26 @@ class ArtifactProcessor {
> > > if (cls2 == null) {
> > > cls2 = loadClassOrNull(defaultValue,
altClassLoader);
> > > }
> > > - if(cls2==null &&
(type.equals("faultInfo")|| type.equals("@WebFault"))){
> > > - //As per JAX-WS 2.2 Specification
section 3.7 an application programmer can choose not to
> > > - //package the faultBeans, if we have
reached this point in the code then user has choosen
> > > - //not to package the fault bean. If
there is a cache of generated artifacts available then
> > > - //lets look for the missing faultBean
there.
> > > + if(cls2==null &&
> > > +
(type.equals("@RequestWrapper")||
type.equals("@ResponseWrapper")||type.equals("@WebFault")||
type.equals("faultInfo"))){
> > > +
> > > + //Support for Fault Bean Generation
> > > + //As per JAX-WS 2.2 Specification
section 3.7 an application programmer can choose not to
> > > + //package the faultBeans, if we have
reached this point in the code then user has choosen
> > > + //not to package the fault bean. If
there is a cache of generated artifacts available then
> > > + //lets look for the missing
faultBean there.
> > > +
> > > + //Support for Wrapper Bean
Generation
> > > + //As per JAX-WS 2.2 Specificaiton
section 3.6.2.1 pg 41 an application programmer does not use
> > > + //the wrapper bean classes, so the
application need not package these classes. If we have reached
> > > + //this point in the code then user
has choosen not to package these beans.
> > > +
> > > + //NOTE:If we find Generated
artifacts from cache this guarantees that we will not use
> > > + //DocLitWrappedMinimum marshaller
code. The advantage of normal DocLitWrappedMarshaller is
> > > + //that it is very robust and has
support of lot more datatypes than in DocLitWrappedMinimum.
> > > + if(log.isDebugEnabled()){
> > > + log.debug("Adding cache to
classpath");
> > > + }
> > > if(log.isDebugEnabled()){
> > > log.debug("Adding cache to
classpath");
> > > }
> > >
> > > Added:
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
> > > URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java?rev=963508&view=auto
> > >
==============================================================================
> > > ---
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
(added)
> > > +++
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
Mon Jul 12 22:16:54 2010
> > > @@ -0,0 +1,18 @@
> > > +
> > > +package org.apache.axis2.jaxws.wrapper.beans;
> > > +
> > > +import javax.xml.ws.WebFault;
> > > +
> > > +@WebFault(name = "AddNumbersFault", targetNamespace = "
http://org/test/addnumbers")
> > > +public class AddNumbersException extends Exception
> > > +{
> > > +
> > > + private String message = null;
> > > + public AddNumbersException(){}
> > > + public AddNumbersException(String message){
> > > + this.message = message;
> > > + }
> > > + public String getInfo(){
> > > + return message;
> > > + }
> > > +}
> > >
> > > Added:
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
> > > URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java?rev=963508&view=auto
> > >
==============================================================================
> > > ---
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
(added)
> > > +++
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
Mon Jul 12 22:16:54 2010
> > > @@ -0,0 +1,15 @@
> > > +package org.apache.axis2.jaxws.wrapper.beans;
> > > +
> > > +
> > > +
> > > +@javax.jws.WebService (targetNamespace="http://org/test/addnumbers
", serviceName="AddNumbersService", portName="AddNumbersPort")
> > > +public class AddNumbersService{
> > > +
> > > + public int addNumbers(int arg0, int arg1) throws
AddNumbersException {
> > > + if(arg0+arg1<0){
> > > + throw new AddNumbersException("sum is less
than 0");
> > > + }
> > > + return arg0+arg1;
> > > + }
> > > +
> > > +}
> > > \ No newline at end of file
> > >
> > > Added:
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
> > > URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java?rev=963508&view=auto
> > >
==============================================================================
> > > ---
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
(added)
> > > +++
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
Mon Jul 12 22:16:54 2010
> > > @@ -0,0 +1,114 @@
> > > +/**
> > > + *
> > > + */
> > > +package org.apache.axis2.jaxws.wrapper.beans;
> > > +
> > > +
> > > +import org.apache.axis2.jaxws.Constants;
> > > +import org.apache.axis2.jaxws.description.DescriptionFactory;
> > > +import org.apache.axis2.jaxws.description.EndpointDescription;
> > > +import org.apache.axis2.jaxws.description.EndpointDescriptionJava;
> > > +import org.apache.axis2.jaxws.description.OperationDescription;
> > > +import org.apache.axis2.jaxws.description.ServiceDescription;
> > > +import org.apache.axis2.jaxws.marshaller.MethodMarshaller;
> > > +import
org.apache.axis2.jaxws.marshaller.factory.MethodMarshallerFactory;
> > > +import
org.apache.axis2.jaxws.marshaller.impl.alt.DocLitWrappedMinimalMethodMarshaller;
> > > +import org.apache.axis2.jaxws.unitTest.TestLogger;
> > > +
> > > +import java.io.File;
> > > +
> > > +import junit.framework.TestCase;
> > > +
> > > +public class WrapperBeanMarshallTests extends TestCase {
> > > + /**
> > > + * This is the negative test case, when we do not use generated
artifacts from cache
> > > + * and user did not package wrapper beans, we should see use of
DocLitWrappedMinumumMarshaller.
> > > + */
> > > + public void
testGetMarshallerOperationDescriptionBooleanNegative() {
> > > +
TestLogger.logger.debug("---------------------------------------");
> > > + TestLogger.logger.debug("test: " + getName());
> > > +
> > > + String cache_location = "/target/wscache/classes";
> > > + try{
> > > + String baseDir = new
File(System.getProperty("basedir",".")).getCanonicalPath();
> > > + cache_location = new
File(baseDir+cache_location).getAbsolutePath();
> > > + TestLogger.logger.debug("cache location
="+cache_location);
> > > +
> > > + //Get EndpointDescription.
> > > + //Set location on AxisConfiguraiton.
> > > + Class sei = AddNumbersService.class;
> > > + EndpointDescription description = getEndpointDesc(sei);
> > > + TestLogger.logger.debug("description objects where
created successfully");
> > > + OperationDescription[] ops
=description.getEndpointInterfaceDescription().getOperations();
> > > + assertNotNull( "OperationDescriptions where null",
ops);
> > > + assertTrue("No Operation Descriptions where found",
ops.length>0);
> > > + OperationDescription op = ops[0];
> > > + TestLogger.logger.debug("operation found, java
methodName="+op.getJavaMethodName());
> > > + //Don not Set cache on AxisConfiguration.
> > > + //get Marshaller, verify its not DoclitWrappedMinimum.
> > > + TestLogger.logger.debug("ws_cache location NOT set on
AxisConfigContext, location="+cache_location);
> > > + MethodMarshaller mm =
MethodMarshallerFactory.getMarshaller(op, false);
> > > + assertNotNull("getMarshaller returned null", mm );
> > > + TestLogger.logger.debug("MethodMarshaller was created,
type="+mm.getClass().getName());
> > > + assertTrue("Generated artifacts not found, Method
marshaller should be DocLitWrappedMinimumMarshaller", (mm instanceof
DocLitWrappedMinimalMethodMarshaller));
> > > + }catch(Exception e){
> > > + TestLogger.logger.debug("Exception ="+e.getMessage());
> > > + fail(e.getMessage());
> > > + }
> > > +
> > > + }
> > > + /**
> > > + * In this test case user did not package wrapper beans but we
add generated artifacts from cache, we should see use of
> > > + * DocLitWrappedMarshaller.
> > > + * Test method for {@link
org.apache.axis2.jaxws.marshaller.factory.MethodMarshallerFactory#getMarshaller(org.apache.axis2.jaxws.description.OperationDescription,
boolean)}.
> > > + */
> > > + public void testGetMarshallerOperationDescriptionBoolean() {
> > > +
TestLogger.logger.debug("---------------------------------------");
> > > + TestLogger.logger.debug("test: " + getName());
> > > +
> > > + String cache_location = "/target/wscache/classes";
> > > + try{
> > > + String baseDir = new
File(System.getProperty("basedir",".")).getCanonicalPath();
> > > + cache_location = new
File(baseDir+cache_location).getAbsolutePath();
> > > + TestLogger.logger.debug("cache location
="+cache_location);
> > > +
> > > + //Get EndpointDescription.
> > > + //Set location on AxisConfiguraiton.
> > > + Class sei = AddNumbersService.class;
> > > + EndpointDescription description = getEndpointDesc(sei);
> > > + TestLogger.logger.debug("description objects where
created successfully");
> > > + OperationDescription[] ops
=description.getEndpointInterfaceDescription().getOperations();
> > > + assertNotNull( "OperationDescriptions where null",
ops);
> > > + assertTrue("No Operation Descriptions where found",
ops.length>0);
> > > + OperationDescription op = ops[0];
> > > + TestLogger.logger.debug("operation found, java
methodName="+op.getJavaMethodName());
> > > + //Set cache on AxisConfiguration.
> > > + //get Marshaller, verify its not DoclitWrappedMinimum.
> > > +
description.getServiceDescription().getAxisConfigContext().setProperty(Constants.WS_CACHE,
cache_location);
> > > + TestLogger.logger.debug("ws_cache location set on
AxisConfigContext, location="+cache_location);
> > > + MethodMarshaller mm =
MethodMarshallerFactory.getMarshaller(op, false);
> > > + assertNotNull("getMarshaller returned null", mm );
> > > + TestLogger.logger.debug("MethodMarshaller was created,
type="+mm.getClass().getName());
> > > + assertTrue("Generated artifacts are in cache, Method
marshaller should not be DocLitWrappedMinimumMarshaller", !(mm instanceof
DocLitWrappedMinimalMethodMarshaller));
> > > + }catch(Exception e){
> > > + TestLogger.logger.debug("Exception ="+e.getMessage());
> > > + fail(e.getMessage());
> > > + }
> > > +
> > > + }
> > > +
> > > + private EndpointDescription getEndpointDesc(Class
implementationClass) {
> > > + // Use the description factory directly; this will be done
within the JAX-WS runtime
> > > + ServiceDescription serviceDesc =
> > > +
DescriptionFactory.createServiceDescription(implementationClass);
> > > + assertNotNull(serviceDesc);
> > > +
> > > + EndpointDescription[] endpointDesc =
serviceDesc.getEndpointDescriptions();
> > > + assertNotNull(endpointDesc);
> > > + assertEquals(1, endpointDesc.length);
> > > +
> > > + // TODO: How will the JAX-WS dispatcher get the appropriate
port (i.e. endpoint)? Currently assumes [0]
> > > + EndpointDescription testEndpointDesc = endpointDesc[0];
> > > + return testEndpointDesc;
> > > + }
> > > +}
> > >
> > > Added: axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml
> > > URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml?rev=963508&view=auto
> > >
==============================================================================
> > > --- axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml (added)
> > > +++ axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml Mon Jul
12 22:16:54 2010
> > > @@ -0,0 +1,34 @@
> > > +<?xml version="1.0" encoding="UTF-8"?>
> > > +
> > > +<project basedir="." default="run-wsgen-tests" name="wsgen-tests">
> > > +
> > > + <property name="wscache.output.base.dir"
value="target/wscache" />
> > > + <property name="wscache.generated.src.dir"
value="${wscache.output.base.dir}/src" />
> > > + <property name="wscache.generated.classes.dir"
value="${wscache.output.base.dir}/classes" />
> > > + <property name="compile.test.classes"
value="target/test-classes" />
> > > +
> > > +
> > > + <target name="run-wsgen-tests" depends="wrapper-beans"/>
> > > +
> > > +
> > > + <target name="create-cache">
> > > + <mkdir dir="${wscache.output.base.dir}" />
> > > + <mkdir dir="${wscache.generated.src.dir}" />
> > > + <mkdir dir="${wscache.generated.classes.dir}" />
> > > + </target>
> > > +
> > > + <target name="wrapper-beans" depends="create-cache">
> > > + <echo>Generating artifacts for
org.apache.axis2.jaxws.wrapper.beans.AddNumbersService </echo>
> > > + <wsgen
> > > +
sei="org.apache.axis2.jaxws.wrapper.beans.AddNumbersService"
> > > + destdir="${wscache.generated.classes.dir}"
> > > + resourcedestdir="${wscache.generated.src.dir}"
> > > + keep="false"
> > > + verbose="false"
> > > + genwsdl="true">
> > > + <classpath>
> > > + <pathelement path="${compile.test.classes}" />
> > > + </classpath>
> > > + </wsgen>
> > > + </target>
> > > +</project>
> > > \ No newline at end of file
> > >
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
> > For additional commands, e-mail: java-dev-help@axis.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-dev-help@axis.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org
Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws:
./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/
test/org/apache/axis2/jaxws/wrapper/ test/org/apache/axis2/jaxws/wrapper/beans/
Posted by Andreas Veithen <an...@gmail.com>.
On Wed, Jul 14, 2010 at 22:38, Jarek Gawor <jg...@gmail.com> wrote:
> Just a couple of thoughts:
>
> 1) Since you already have wsgen-tests.xml ant script to run the wsgen
> you could setup the appropriate classpath to the tools.jar or
> classes.jar or whatever in it. You just might need to fork the ant
> process.
>
> 2) I don't think it's that horrible to commit some generate code
> especially if there isn't too much of it and the test case is
> important. Besides, Axis2 already has some generated code checked it.
It is extremely annoying to have generated code in Subversion when for
some reason you need to modify it. In general when that happens,
nobody is able to tell you how the code was generated initially.
Anyway, in this particular case, there are enough options that don't
make it necessary to include the generated stuff in Subversion.
> Jarek
>
> On Wed, Jul 14, 2010 at 4:00 PM, Nikhil V Thaker
> <ni...@us.ibm.com> wrote:
>>
>> Yes Andreas,
>> I am running antrun plugin as the wsGen plugin has errors and is not fully matured, here's the URL that explains the issue I ran into http://jira.codehaus.org/browse/MNG-3586.
>>
>> So since I cannot run wsGen or cannot include generated artifacts I will just remove the test case. I will commit the changes soon.
>>
>> Regards,
>>
>> Nikhil Thaker
>> office: 919 254 9964
>> nvthaker@us.ibm.com
>>
>>
>> Andreas Veithen <an...@gmail.com>
>>
>> 07/14/2010 02:48 PM
>>
>> Please respond to
>> java-dev@axis.apache.org
>> To
>> java-dev@axis.apache.org
>> cc
>> Subject
>> Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws: ./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ test/org/apache/axis2/jaxws/wrapper/ test/org/apache/axis2/jaxws/wrapper/beans/
>>
>>
>>
>>
>> No, you are using the antrun plugin to execute the wsgen ant task.
>> What I meant was to use a real Maven plugin (either the one from
>> java.net or the one from CXF).
>>
>> -1 to commit any generated stuff into SVN.
>>
>> Andreas
>>
>> On Wed, Jul 14, 2010 at 21:42, Nikhil V Thaker
>> <ni...@us.ibm.com> wrote:
>> >
>> > Andreas - I had to add the tools.jar bit because maven plugin for wsGen gave NoClassDef Found errors for classes packaged in tools.jar.
>> >
>> > Since this is causing a problem I will just package the generated artifacts and remove the wsGen dependency.
>> >
>> > Thanks,
>> >
>> > Nikhil Thaker
>> > office: 919 254 9964
>> > nvthaker@us.ibm.com
>> >
>> >
>> > Andreas Veithen <an...@gmail.com>
>> >
>> > 07/14/2010 01:44 PM
>> >
>> > Please respond to
>> > java-dev@axis.apache.org
>> > To
>> > java-dev@axis.apache.org
>> > cc
>> > Subject
>> > Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws: ./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ test/org/apache/axis2/jaxws/wrapper/ test/org/apache/axis2/jaxws/wrapper/beans/
>> >
>> >
>> >
>> >
>> > Nikhil,
>> >
>> > I have some issues with the tools and jaxws-tools dependencies
>> > introduced by this change:
>> >
>> > * The change causes a build failure in Hudson. There will also be
>> > additional issues with tools.jar, because the way to declare this as a
>> > system dependency varies from one JDK to another. For example, I
>> > remember that on Mac OS X, it is completely different than on other
>> > JDKs.
>> >
>> > * I don't like the fact that jaxws-tools becomes a dependency of
>> > axis2-jaxws in scope compile, because it looks like this is only
>> > needed during the build and/or during the tests.
>> >
>> > I didn't review the change in detail, but wouldn't it be smarter to
>> > use one of the existing Maven plugins to do the wsgen stuff? They will
>> > take care of the tools.jar stuff as well.
>> >
>> > Andreas
>> >
>> > On Tue, Jul 13, 2010 at 00:16, <nt...@apache.org> wrote:
>> > > Author: nthaker
>> > > Date: Mon Jul 12 22:16:54 2010
>> > > New Revision: 963508
>> > >
>> > > URL: http://svn.apache.org/viewvc?rev=963508&view=rev
>> > > Log:
>> > > AXIS2-4775
>> > > This change ensures that we will use Request and Response wrapper Bean packaged by customer or we will Generate Wrappers if they are not packaged.
>> > >
>> > > Added:
>> > > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/
>> > > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/
>> > > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
>> > > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
>> > > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
>> > > axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml
>> > > Modified:
>> > > axis/axis2/java/core/trunk/modules/jaxws/pom.xml
>> > > axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
>> > >
>> > > Modified: axis/axis2/java/core/trunk/modules/jaxws/pom.xml
>> > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/pom.xml?rev=963508&r1=963507&r2=963508&view=diff
>> > > ==============================================================================
>> > > --- axis/axis2/java/core/trunk/modules/jaxws/pom.xml (original)
>> > > +++ axis/axis2/java/core/trunk/modules/jaxws/pom.xml Mon Jul 12 22:16:54 2010
>> > > @@ -1,5 +1,4 @@
>> > > <?xml version="1.0" encoding="UTF-8"?>
>> > > -
>> > > <!-- > ~ Licensed to the Apache Software Foundation (ASF) under one
>> > > ~ or more contributor license agreements. See the NOTICE file
>> > > @@ -20,7 +19,7 @@
>> > > -->
>> > >
>> > > <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> > > - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
>> > > + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
>> > > <modelVersion>4.0.0</modelVersion>
>> > > <parent>
>> > > <groupId>org.apache.axis2</groupId>
>> > > @@ -98,7 +97,25 @@
>> > > <version>${version}</version>
>> > > <scope>test</scope>
>> > > </dependency>
>> > > + <dependency>
>> > > + <groupId>wsdl4j</groupId>
>> > > + <artifactId>wsdl4j</artifactId>
>> > > + </dependency>
>> > > + <dependency>
>> > > + <groupId>com.sun.xml.ws</groupId>
>> > > + <artifactId>jaxws-tools</artifactId>
>> > > + <version>2.1.3</version>
>> > > + </dependency>
>> > > + <!-- If we dont include tools.jar as dependency, maven throws NoClassDefFound on wsGen run -->
>> > > + <dependency>
>> > > + <groupId>java</groupId>
>> > > + <artifactId>tools</artifactId>
>> > > + <version>$version</version>
>> > > + <scope>system</scope>
>> > > + <systemPath>${JAVA_HOME}/lib/tools.jar</systemPath>
>> > > + </dependency>
>> > > </dependencies>
>> > > +
>> > > <build>
>> > > <sourceDirectory>src</sourceDirectory>
>> > > <testSourceDirectory>test</testSourceDirectory>
>> > > @@ -203,34 +220,39 @@
>> > > <compilerVersion>1.5</compilerVersion>
>> > > <source>1.5</source>
>> > > <target>1.5</target>
>> > > +
>> > > </configuration>
>> > > </plugin>
>> > > <plugin>
>> > > <groupId>org.apache.maven.plugins</groupId>
>> > > <artifactId>maven-antrun-plugin</artifactId>
>> > > +
>> > > <executions>
>> > > <execution>
>> > > <id>gen-ts</id>
>> > > <phase>generate-test-sources</phase>
>> > > <configuration>
>> > > - <tasks unless="maven.test.skip">
>> > > + <tasks unless="maven.test.skip">
>> > > <!-- Theres got to be a better way to do this -->
>> > > <property name="schema.source.dir" value="test-resources/xsd"/>
>> > > <property name="wsdl.source.dir" value="test-resources/wsdl"/>
>> > > - <property name="schema.output.base.dir" value="target/schema"/>
>> > > + <property name="schema.output.base.dir" value="target/schema"/>
>> > > <property name="schema.generated.src.dir" value="${schema.output.base.dir}/src"/>
>> > > <property name="schema.generated.classes.dir"
>> > > value="${schema.output.base.dir}/classes"/>
>> > > +
>> > > <!-- make the dirs -->
>> > > <mkdir dir="${schema.output.base.dir}"/>
>> > > <mkdir dir="${schema.generated.src.dir}"/>
>> > > <mkdir dir="${schema.generated.classes.dir}"/>
>> > > +
>> > > <!-- Run JAXB schema compiler with designated schemas -->
>> > > <echo>Generating JAX-B classes from XSDs</echo>
>> > >
>> > > <echo>Generating java from echo.xsd</echo>
>> > > <java classname="com.sun.tools.xjc.Driver" fork="true">
>> > > <classpath refid="maven.runtime.classpath"/>
>> > > +
>> > > <classpath location="${compiled.classes.dir}"/>
>> > > <arg line="-d ${schema.generated.src.dir} -quiet ${schema.source.dir}/echo.xsd"/>
>> > > </java>
>> > > @@ -266,7 +288,7 @@
>> > > <classpath refid="maven.runtime.classpath"/>
>> > > <classpath location="${compiled.classes.dir}"/>
>> > > <arg line="-d ${schema.generated.src.dir} -quiet -wsdl ${wsdl.source.dir}/AddNumbers.wsdl"/>
>> > > - </java>
>> > > + </java>
>> > > </tasks>
>> > > </configuration>
>> > > <goals>
>> > > @@ -287,6 +309,22 @@
>> > > <property name="addressing_version" value="${version}"/>
>> > > <ant antfile="build.xml" inheritall="true" inheritrefs="true"
>> > > dir="." target="build-repo"/>
>> > > +
>> > > + <property name="compile_classpath" refid="maven.compile.classpath" />
>> > > + <property name="runtime_classpath" refid="maven.runtime.classpath" />
>> > > + <property name="test_classpath" refid="maven.test.classpath" />
>> > > + <property name="plugin_classpath" refid="maven.plugin.classpath" />
>> > > +
>> > > + <!-- Defining wsGen task -->
>> > > + <taskdef name="wsgen" loaderRef="refwsgen" classname="com.sun.tools.ws.ant.WsGen">
>> > > + <classpath>
>> > > + <path refid="maven.runtime.classpath" />
>> > > + <path refid="maven.compile.classpath" />
>> > > + </classpath>
>> > > + </taskdef>
>> > > + <!-- Invoking test cases that need to generate artifacts using wsGen -->
>> > > + <ant antfile="wsgen-tests.xml" inheritall="true" inheritrefs="true"
>> > > + dir="." target="run-wsgen-tests"/>
>> > > </tasks>
>> > > </configuration>
>> > > <goals>
>> > > @@ -374,6 +412,13 @@
>> > > <plugin>
>> > > <groupId>org.apache.maven.plugins</groupId>
>> > > <artifactId>maven-surefire-report-plugin</artifactId>
>> > > + <reportSets>
>> > > + <reportSet>
>> > > + <reports>
>> > > + <report>report-only</report>
>> > > + </reports>
>> > > + </reportSet>
>> > > + </reportSets>
>> > > </plugin>
>> > > </plugins>
>> > > </reporting>
>> > >
>> > > Modified: axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
>> > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java?rev=963508&r1=963507&r2=963508&view=diff
>> > > ==============================================================================
>> > > --- axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java (original)
>> > > +++ axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java Mon Jul 12 22:16:54 2010
>> > > @@ -238,12 +238,27 @@ class ArtifactProcessor {
>> > > wrapperClass = newValue;
>> > > }
>> > > }
>> > > - if(cls==null && (type.equals("@WebFault")|| type.equals("faultInfo"))){
>> > > +
>> > > + if(cls==null &&
>> > > + (type.equals("@RequestWrapper")|| type.equals("@ResponseWrapper")||type.equals("@WebFault")|| type.equals("faultInfo"))){
>> > > +
>> > > + //Support for Fault Bean Generation
>> > > //As per JAX-WS 2.2 Specification section 3.7 an application programmer can choose not to
>> > > //package the faultBeans, if we have reached this point in the code then user has choosen
>> > > //not to package the fault bean. If there is a cache of generated artifacts available then
>> > > //lets look for the missing faultBean there.
>> > > -
>> > > +
>> > > + //Support for Wrapper Bean Generation
>> > > + //As per JAX-WS 2.2 Specificaiton section 3.6.2.1 pg 41 an application programmer does not use
>> > > + //the wrapper bean classes, so the application need not package these classes. If we have reached
>> > > + //this point in the code then user has choosen not to package these beans.
>> > > +
>> > > + //NOTE:If we find Generated artifacts from cache this guarantees that we will not use
>> > > + //DocLitWrappedMinimum marshaller code. The advantage of normal DocLitWrappedMarshaller is
>> > > + //that it is very robust and has support of lot more datatypes than in DocLitWrappedMinimum.
>> > > + if(log.isDebugEnabled()){
>> > > + log.debug("Adding cache to classpath");
>> > > + }
>> > > ClassFinderFactory cff =
>> > > (ClassFinderFactory)FactoryRegistry.getFactory(ClassFinderFactory.class);
>> > > ClassFinder cf = cff.getClassFinder();
>> > > @@ -317,11 +332,26 @@ class ArtifactProcessor {
>> > > if (cls2 == null) {
>> > > cls2 = loadClassOrNull(defaultValue, altClassLoader);
>> > > }
>> > > - if(cls2==null && (type.equals("faultInfo")|| type.equals("@WebFault"))){
>> > > - //As per JAX-WS 2.2 Specification section 3.7 an application programmer can choose not to
>> > > - //package the faultBeans, if we have reached this point in the code then user has choosen
>> > > - //not to package the fault bean. If there is a cache of generated artifacts available then
>> > > - //lets look for the missing faultBean there.
>> > > + if(cls2==null &&
>> > > + (type.equals("@RequestWrapper")|| type.equals("@ResponseWrapper")||type.equals("@WebFault")|| type.equals("faultInfo"))){
>> > > +
>> > > + //Support for Fault Bean Generation
>> > > + //As per JAX-WS 2.2 Specification section 3.7 an application programmer can choose not to
>> > > + //package the faultBeans, if we have reached this point in the code then user has choosen
>> > > + //not to package the fault bean. If there is a cache of generated artifacts available then
>> > > + //lets look for the missing faultBean there.
>> > > +
>> > > + //Support for Wrapper Bean Generation
>> > > + //As per JAX-WS 2.2 Specificaiton section 3.6.2.1 pg 41 an application programmer does not use
>> > > + //the wrapper bean classes, so the application need not package these classes. If we have reached
>> > > + //this point in the code then user has choosen not to package these beans.
>> > > +
>> > > + //NOTE:If we find Generated artifacts from cache this guarantees that we will not use
>> > > + //DocLitWrappedMinimum marshaller code. The advantage of normal DocLitWrappedMarshaller is
>> > > + //that it is very robust and has support of lot more datatypes than in DocLitWrappedMinimum.
>> > > + if(log.isDebugEnabled()){
>> > > + log.debug("Adding cache to classpath");
>> > > + }
>> > > if(log.isDebugEnabled()){
>> > > log.debug("Adding cache to classpath");
>> > > }
>> > >
>> > > Added: axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
>> > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java?rev=963508&view=auto
>> > > ==============================================================================
>> > > --- axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java (added)
>> > > +++ axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java Mon Jul 12 22:16:54 2010
>> > > @@ -0,0 +1,18 @@
>> > > +
>> > > +package org.apache.axis2.jaxws.wrapper.beans;
>> > > +
>> > > +import javax.xml.ws.WebFault;
>> > > +
>> > > +@WebFault(name = "AddNumbersFault", targetNamespace = "http://org/test/addnumbers")
>> > > +public class AddNumbersException extends Exception
>> > > +{
>> > > +
>> > > + private String message = null;
>> > > + public AddNumbersException(){}
>> > > + public AddNumbersException(String message){
>> > > + this.message = message;
>> > > + }
>> > > + public String getInfo(){
>> > > + return message;
>> > > + }
>> > > +}
>> > >
>> > > Added: axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
>> > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java?rev=963508&view=auto
>> > > ==============================================================================
>> > > --- axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java (added)
>> > > +++ axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java Mon Jul 12 22:16:54 2010
>> > > @@ -0,0 +1,15 @@
>> > > +package org.apache.axis2.jaxws.wrapper.beans;
>> > > +
>> > > +
>> > > +
>> > > +@javax.jws.WebService (targetNamespace="http://org/test/addnumbers", serviceName="AddNumbersService", portName="AddNumbersPort")
>> > > +public class AddNumbersService{
>> > > +
>> > > + public int addNumbers(int arg0, int arg1) throws AddNumbersException {
>> > > + if(arg0+arg1<0){
>> > > + throw new AddNumbersException("sum is less than 0");
>> > > + }
>> > > + return arg0+arg1;
>> > > + }
>> > > +
>> > > +}
>> > > \ No newline at end of file
>> > >
>> > > Added: axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
>> > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java?rev=963508&view=auto
>> > > ==============================================================================
>> > > --- axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java (added)
>> > > +++ axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java Mon Jul 12 22:16:54 2010
>> > > @@ -0,0 +1,114 @@
>> > > +/**
>> > > + *
>> > > + */
>> > > +package org.apache.axis2.jaxws.wrapper.beans;
>> > > +
>> > > +
>> > > +import org.apache.axis2.jaxws.Constants;
>> > > +import org.apache.axis2.jaxws.description.DescriptionFactory;
>> > > +import org.apache.axis2.jaxws.description.EndpointDescription;
>> > > +import org.apache.axis2.jaxws.description.EndpointDescriptionJava;
>> > > +import org.apache.axis2.jaxws.description.OperationDescription;
>> > > +import org.apache.axis2.jaxws.description.ServiceDescription;
>> > > +import org.apache.axis2.jaxws.marshaller.MethodMarshaller;
>> > > +import org.apache.axis2.jaxws.marshaller.factory.MethodMarshallerFactory;
>> > > +import org.apache.axis2.jaxws.marshaller.impl.alt.DocLitWrappedMinimalMethodMarshaller;
>> > > +import org.apache.axis2.jaxws.unitTest.TestLogger;
>> > > +
>> > > +import java.io.File;
>> > > +
>> > > +import junit.framework.TestCase;
>> > > +
>> > > +public class WrapperBeanMarshallTests extends TestCase {
>> > > + /**
>> > > + * This is the negative test case, when we do not use generated artifacts from cache
>> > > + * and user did not package wrapper beans, we should see use of DocLitWrappedMinumumMarshaller.
>> > > + */
>> > > + public void testGetMarshallerOperationDescriptionBooleanNegative() {
>> > > + TestLogger.logger.debug("---------------------------------------");
>> > > + TestLogger.logger.debug("test: " + getName());
>> > > +
>> > > + String cache_location = "/target/wscache/classes";
>> > > + try{
>> > > + String baseDir = new File(System.getProperty("basedir",".")).getCanonicalPath();
>> > > + cache_location = new File(baseDir+cache_location).getAbsolutePath();
>> > > + TestLogger.logger.debug("cache location ="+cache_location);
>> > > +
>> > > + //Get EndpointDescription.
>> > > + //Set location on AxisConfiguraiton.
>> > > + Class sei = AddNumbersService.class;
>> > > + EndpointDescription description = getEndpointDesc(sei);
>> > > + TestLogger.logger.debug("description objects where created successfully");
>> > > + OperationDescription[] ops =description.getEndpointInterfaceDescription().getOperations();
>> > > + assertNotNull( "OperationDescriptions where null", ops);
>> > > + assertTrue("No Operation Descriptions where found", ops.length>0);
>> > > + OperationDescription op = ops[0];
>> > > + TestLogger.logger.debug("operation found, java methodName="+op.getJavaMethodName());
>> > > + //Don not Set cache on AxisConfiguration.
>> > > + //get Marshaller, verify its not DoclitWrappedMinimum.
>> > > + TestLogger.logger.debug("ws_cache location NOT set on AxisConfigContext, location="+cache_location);
>> > > + MethodMarshaller mm = MethodMarshallerFactory.getMarshaller(op, false);
>> > > + assertNotNull("getMarshaller returned null", mm );
>> > > + TestLogger.logger.debug("MethodMarshaller was created, type="+mm.getClass().getName());
>> > > + assertTrue("Generated artifacts not found, Method marshaller should be DocLitWrappedMinimumMarshaller", (mm instanceof DocLitWrappedMinimalMethodMarshaller));
>> > > + }catch(Exception e){
>> > > + TestLogger.logger.debug("Exception ="+e.getMessage());
>> > > + fail(e.getMessage());
>> > > + }
>> > > +
>> > > + }
>> > > + /**
>> > > + * In this test case user did not package wrapper beans but we add generated artifacts from cache, we should see use of
>> > > + * DocLitWrappedMarshaller.
>> > > + * Test method for {@link org.apache.axis2.jaxws.marshaller.factory.MethodMarshallerFactory#getMarshaller(org.apache.axis2.jaxws.description.OperationDescription, boolean)}.
>> > > + */
>> > > + public void testGetMarshallerOperationDescriptionBoolean() {
>> > > + TestLogger.logger.debug("---------------------------------------");
>> > > + TestLogger.logger.debug("test: " + getName());
>> > > +
>> > > + String cache_location = "/target/wscache/classes";
>> > > + try{
>> > > + String baseDir = new File(System.getProperty("basedir",".")).getCanonicalPath();
>> > > + cache_location = new File(baseDir+cache_location).getAbsolutePath();
>> > > + TestLogger.logger.debug("cache location ="+cache_location);
>> > > +
>> > > + //Get EndpointDescription.
>> > > + //Set location on AxisConfiguraiton.
>> > > + Class sei = AddNumbersService.class;
>> > > + EndpointDescription description = getEndpointDesc(sei);
>> > > + TestLogger.logger.debug("description objects where created successfully");
>> > > + OperationDescription[] ops =description.getEndpointInterfaceDescription().getOperations();
>> > > + assertNotNull( "OperationDescriptions where null", ops);
>> > > + assertTrue("No Operation Descriptions where found", ops.length>0);
>> > > + OperationDescription op = ops[0];
>> > > + TestLogger.logger.debug("operation found, java methodName="+op.getJavaMethodName());
>> > > + //Set cache on AxisConfiguration.
>> > > + //get Marshaller, verify its not DoclitWrappedMinimum.
>> > > + description.getServiceDescription().getAxisConfigContext().setProperty(Constants.WS_CACHE, cache_location);
>> > > + TestLogger.logger.debug("ws_cache location set on AxisConfigContext, location="+cache_location);
>> > > + MethodMarshaller mm = MethodMarshallerFactory.getMarshaller(op, false);
>> > > + assertNotNull("getMarshaller returned null", mm );
>> > > + TestLogger.logger.debug("MethodMarshaller was created, type="+mm.getClass().getName());
>> > > + assertTrue("Generated artifacts are in cache, Method marshaller should not be DocLitWrappedMinimumMarshaller", !(mm instanceof DocLitWrappedMinimalMethodMarshaller));
>> > > + }catch(Exception e){
>> > > + TestLogger.logger.debug("Exception ="+e.getMessage());
>> > > + fail(e.getMessage());
>> > > + }
>> > > +
>> > > + }
>> > > +
>> > > + private EndpointDescription getEndpointDesc(Class implementationClass) {
>> > > + // Use the description factory directly; this will be done within the JAX-WS runtime
>> > > + ServiceDescription serviceDesc =
>> > > + DescriptionFactory.createServiceDescription(implementationClass);
>> > > + assertNotNull(serviceDesc);
>> > > +
>> > > + EndpointDescription[] endpointDesc = serviceDesc.getEndpointDescriptions();
>> > > + assertNotNull(endpointDesc);
>> > > + assertEquals(1, endpointDesc.length);
>> > > +
>> > > + // TODO: How will the JAX-WS dispatcher get the appropriate port (i.e. endpoint)? Currently assumes [0]
>> > > + EndpointDescription testEndpointDesc = endpointDesc[0];
>> > > + return testEndpointDesc;
>> > > + }
>> > > +}
>> > >
>> > > Added: axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml
>> > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml?rev=963508&view=auto
>> > > ==============================================================================
>> > > --- axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml (added)
>> > > +++ axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml Mon Jul 12 22:16:54 2010
>> > > @@ -0,0 +1,34 @@
>> > > +<?xml version="1.0" encoding="UTF-8"?>
>> > > +
>> > > +<project basedir="." default="run-wsgen-tests" name="wsgen-tests">
>> > > +
>> > > + <property name="wscache.output.base.dir" value="target/wscache" />
>> > > + <property name="wscache.generated.src.dir" value="${wscache.output.base.dir}/src" />
>> > > + <property name="wscache.generated.classes.dir" value="${wscache.output.base.dir}/classes" />
>> > > + <property name="compile.test.classes" value="target/test-classes" />
>> > > +
>> > > +
>> > > + <target name="run-wsgen-tests" depends="wrapper-beans"/>
>> > > +
>> > > +
>> > > + <target name="create-cache">
>> > > + <mkdir dir="${wscache.output.base.dir}" />
>> > > + <mkdir dir="${wscache.generated.src.dir}" />
>> > > + <mkdir dir="${wscache.generated.classes.dir}" />
>> > > + </target>
>> > > +
>> > > + <target name="wrapper-beans" depends="create-cache">
>> > > + <echo>Generating artifacts for org.apache.axis2.jaxws.wrapper.beans.AddNumbersService </echo>
>> > > + <wsgen
>> > > + sei="org.apache.axis2.jaxws.wrapper.beans.AddNumbersService"
>> > > + destdir="${wscache.generated.classes.dir}"
>> > > + resourcedestdir="${wscache.generated.src.dir}"
>> > > + keep="false"
>> > > + verbose="false"
>> > > + genwsdl="true">
>> > > + <classpath>
>> > > + <pathelement path="${compile.test.classes}" />
>> > > + </classpath>
>> > > + </wsgen>
>> > > + </target>
>> > > +</project>
>> > > \ No newline at end of file
>> > >
>> > >
>> > >
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
>> > For additional commands, e-mail: java-dev-help@axis.apache.org
>> >
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
>> For additional commands, e-mail: java-dev-help@axis.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-dev-help@axis.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org
Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws:
./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/
test/org/apache/axis2/jaxws/wrapper/ test/org/apache/axis2/jaxws/wrapper/beans/
Posted by Andreas Veithen <an...@gmail.com>.
On Wed, Jul 14, 2010 at 22:38, Jarek Gawor <jg...@gmail.com> wrote:
> Just a couple of thoughts:
>
> 1) Since you already have wsgen-tests.xml ant script to run the wsgen
> you could setup the appropriate classpath to the tools.jar or
> classes.jar or whatever in it. You just might need to fork the ant
> process.
>
> 2) I don't think it's that horrible to commit some generate code
> especially if there isn't too much of it and the test case is
> important. Besides, Axis2 already has some generated code checked it.
It is extremely annoying to have generated code in Subversion when for
some reason you need to modify it. In general when that happens,
nobody is able to tell you how the code was generated initially.
Anyway, in this particular case, there are enough options that don't
make it necessary to include the generated stuff in Subversion.
> Jarek
>
> On Wed, Jul 14, 2010 at 4:00 PM, Nikhil V Thaker
> <ni...@us.ibm.com> wrote:
>>
>> Yes Andreas,
>> I am running antrun plugin as the wsGen plugin has errors and is not fully matured, here's the URL that explains the issue I ran into http://jira.codehaus.org/browse/MNG-3586.
>>
>> So since I cannot run wsGen or cannot include generated artifacts I will just remove the test case. I will commit the changes soon.
>>
>> Regards,
>>
>> Nikhil Thaker
>> office: 919 254 9964
>> nvthaker@us.ibm.com
>>
>>
>> Andreas Veithen <an...@gmail.com>
>>
>> 07/14/2010 02:48 PM
>>
>> Please respond to
>> java-dev@axis.apache.org
>> To
>> java-dev@axis.apache.org
>> cc
>> Subject
>> Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws: ./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ test/org/apache/axis2/jaxws/wrapper/ test/org/apache/axis2/jaxws/wrapper/beans/
>>
>>
>>
>>
>> No, you are using the antrun plugin to execute the wsgen ant task.
>> What I meant was to use a real Maven plugin (either the one from
>> java.net or the one from CXF).
>>
>> -1 to commit any generated stuff into SVN.
>>
>> Andreas
>>
>> On Wed, Jul 14, 2010 at 21:42, Nikhil V Thaker
>> <ni...@us.ibm.com> wrote:
>> >
>> > Andreas - I had to add the tools.jar bit because maven plugin for wsGen gave NoClassDef Found errors for classes packaged in tools.jar.
>> >
>> > Since this is causing a problem I will just package the generated artifacts and remove the wsGen dependency.
>> >
>> > Thanks,
>> >
>> > Nikhil Thaker
>> > office: 919 254 9964
>> > nvthaker@us.ibm.com
>> >
>> >
>> > Andreas Veithen <an...@gmail.com>
>> >
>> > 07/14/2010 01:44 PM
>> >
>> > Please respond to
>> > java-dev@axis.apache.org
>> > To
>> > java-dev@axis.apache.org
>> > cc
>> > Subject
>> > Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws: ./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ test/org/apache/axis2/jaxws/wrapper/ test/org/apache/axis2/jaxws/wrapper/beans/
>> >
>> >
>> >
>> >
>> > Nikhil,
>> >
>> > I have some issues with the tools and jaxws-tools dependencies
>> > introduced by this change:
>> >
>> > * The change causes a build failure in Hudson. There will also be
>> > additional issues with tools.jar, because the way to declare this as a
>> > system dependency varies from one JDK to another. For example, I
>> > remember that on Mac OS X, it is completely different than on other
>> > JDKs.
>> >
>> > * I don't like the fact that jaxws-tools becomes a dependency of
>> > axis2-jaxws in scope compile, because it looks like this is only
>> > needed during the build and/or during the tests.
>> >
>> > I didn't review the change in detail, but wouldn't it be smarter to
>> > use one of the existing Maven plugins to do the wsgen stuff? They will
>> > take care of the tools.jar stuff as well.
>> >
>> > Andreas
>> >
>> > On Tue, Jul 13, 2010 at 00:16, <nt...@apache.org> wrote:
>> > > Author: nthaker
>> > > Date: Mon Jul 12 22:16:54 2010
>> > > New Revision: 963508
>> > >
>> > > URL: http://svn.apache.org/viewvc?rev=963508&view=rev
>> > > Log:
>> > > AXIS2-4775
>> > > This change ensures that we will use Request and Response wrapper Bean packaged by customer or we will Generate Wrappers if they are not packaged.
>> > >
>> > > Added:
>> > > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/
>> > > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/
>> > > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
>> > > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
>> > > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
>> > > axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml
>> > > Modified:
>> > > axis/axis2/java/core/trunk/modules/jaxws/pom.xml
>> > > axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
>> > >
>> > > Modified: axis/axis2/java/core/trunk/modules/jaxws/pom.xml
>> > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/pom.xml?rev=963508&r1=963507&r2=963508&view=diff
>> > > ==============================================================================
>> > > --- axis/axis2/java/core/trunk/modules/jaxws/pom.xml (original)
>> > > +++ axis/axis2/java/core/trunk/modules/jaxws/pom.xml Mon Jul 12 22:16:54 2010
>> > > @@ -1,5 +1,4 @@
>> > > <?xml version="1.0" encoding="UTF-8"?>
>> > > -
>> > > <!-- > ~ Licensed to the Apache Software Foundation (ASF) under one
>> > > ~ or more contributor license agreements. See the NOTICE file
>> > > @@ -20,7 +19,7 @@
>> > > -->
>> > >
>> > > <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> > > - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
>> > > + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
>> > > <modelVersion>4.0.0</modelVersion>
>> > > <parent>
>> > > <groupId>org.apache.axis2</groupId>
>> > > @@ -98,7 +97,25 @@
>> > > <version>${version}</version>
>> > > <scope>test</scope>
>> > > </dependency>
>> > > + <dependency>
>> > > + <groupId>wsdl4j</groupId>
>> > > + <artifactId>wsdl4j</artifactId>
>> > > + </dependency>
>> > > + <dependency>
>> > > + <groupId>com.sun.xml.ws</groupId>
>> > > + <artifactId>jaxws-tools</artifactId>
>> > > + <version>2.1.3</version>
>> > > + </dependency>
>> > > + <!-- If we dont include tools.jar as dependency, maven throws NoClassDefFound on wsGen run -->
>> > > + <dependency>
>> > > + <groupId>java</groupId>
>> > > + <artifactId>tools</artifactId>
>> > > + <version>$version</version>
>> > > + <scope>system</scope>
>> > > + <systemPath>${JAVA_HOME}/lib/tools.jar</systemPath>
>> > > + </dependency>
>> > > </dependencies>
>> > > +
>> > > <build>
>> > > <sourceDirectory>src</sourceDirectory>
>> > > <testSourceDirectory>test</testSourceDirectory>
>> > > @@ -203,34 +220,39 @@
>> > > <compilerVersion>1.5</compilerVersion>
>> > > <source>1.5</source>
>> > > <target>1.5</target>
>> > > +
>> > > </configuration>
>> > > </plugin>
>> > > <plugin>
>> > > <groupId>org.apache.maven.plugins</groupId>
>> > > <artifactId>maven-antrun-plugin</artifactId>
>> > > +
>> > > <executions>
>> > > <execution>
>> > > <id>gen-ts</id>
>> > > <phase>generate-test-sources</phase>
>> > > <configuration>
>> > > - <tasks unless="maven.test.skip">
>> > > + <tasks unless="maven.test.skip">
>> > > <!-- Theres got to be a better way to do this -->
>> > > <property name="schema.source.dir" value="test-resources/xsd"/>
>> > > <property name="wsdl.source.dir" value="test-resources/wsdl"/>
>> > > - <property name="schema.output.base.dir" value="target/schema"/>
>> > > + <property name="schema.output.base.dir" value="target/schema"/>
>> > > <property name="schema.generated.src.dir" value="${schema.output.base.dir}/src"/>
>> > > <property name="schema.generated.classes.dir"
>> > > value="${schema.output.base.dir}/classes"/>
>> > > +
>> > > <!-- make the dirs -->
>> > > <mkdir dir="${schema.output.base.dir}"/>
>> > > <mkdir dir="${schema.generated.src.dir}"/>
>> > > <mkdir dir="${schema.generated.classes.dir}"/>
>> > > +
>> > > <!-- Run JAXB schema compiler with designated schemas -->
>> > > <echo>Generating JAX-B classes from XSDs</echo>
>> > >
>> > > <echo>Generating java from echo.xsd</echo>
>> > > <java classname="com.sun.tools.xjc.Driver" fork="true">
>> > > <classpath refid="maven.runtime.classpath"/>
>> > > +
>> > > <classpath location="${compiled.classes.dir}"/>
>> > > <arg line="-d ${schema.generated.src.dir} -quiet ${schema.source.dir}/echo.xsd"/>
>> > > </java>
>> > > @@ -266,7 +288,7 @@
>> > > <classpath refid="maven.runtime.classpath"/>
>> > > <classpath location="${compiled.classes.dir}"/>
>> > > <arg line="-d ${schema.generated.src.dir} -quiet -wsdl ${wsdl.source.dir}/AddNumbers.wsdl"/>
>> > > - </java>
>> > > + </java>
>> > > </tasks>
>> > > </configuration>
>> > > <goals>
>> > > @@ -287,6 +309,22 @@
>> > > <property name="addressing_version" value="${version}"/>
>> > > <ant antfile="build.xml" inheritall="true" inheritrefs="true"
>> > > dir="." target="build-repo"/>
>> > > +
>> > > + <property name="compile_classpath" refid="maven.compile.classpath" />
>> > > + <property name="runtime_classpath" refid="maven.runtime.classpath" />
>> > > + <property name="test_classpath" refid="maven.test.classpath" />
>> > > + <property name="plugin_classpath" refid="maven.plugin.classpath" />
>> > > +
>> > > + <!-- Defining wsGen task -->
>> > > + <taskdef name="wsgen" loaderRef="refwsgen" classname="com.sun.tools.ws.ant.WsGen">
>> > > + <classpath>
>> > > + <path refid="maven.runtime.classpath" />
>> > > + <path refid="maven.compile.classpath" />
>> > > + </classpath>
>> > > + </taskdef>
>> > > + <!-- Invoking test cases that need to generate artifacts using wsGen -->
>> > > + <ant antfile="wsgen-tests.xml" inheritall="true" inheritrefs="true"
>> > > + dir="." target="run-wsgen-tests"/>
>> > > </tasks>
>> > > </configuration>
>> > > <goals>
>> > > @@ -374,6 +412,13 @@
>> > > <plugin>
>> > > <groupId>org.apache.maven.plugins</groupId>
>> > > <artifactId>maven-surefire-report-plugin</artifactId>
>> > > + <reportSets>
>> > > + <reportSet>
>> > > + <reports>
>> > > + <report>report-only</report>
>> > > + </reports>
>> > > + </reportSet>
>> > > + </reportSets>
>> > > </plugin>
>> > > </plugins>
>> > > </reporting>
>> > >
>> > > Modified: axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
>> > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java?rev=963508&r1=963507&r2=963508&view=diff
>> > > ==============================================================================
>> > > --- axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java (original)
>> > > +++ axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java Mon Jul 12 22:16:54 2010
>> > > @@ -238,12 +238,27 @@ class ArtifactProcessor {
>> > > wrapperClass = newValue;
>> > > }
>> > > }
>> > > - if(cls==null && (type.equals("@WebFault")|| type.equals("faultInfo"))){
>> > > +
>> > > + if(cls==null &&
>> > > + (type.equals("@RequestWrapper")|| type.equals("@ResponseWrapper")||type.equals("@WebFault")|| type.equals("faultInfo"))){
>> > > +
>> > > + //Support for Fault Bean Generation
>> > > //As per JAX-WS 2.2 Specification section 3.7 an application programmer can choose not to
>> > > //package the faultBeans, if we have reached this point in the code then user has choosen
>> > > //not to package the fault bean. If there is a cache of generated artifacts available then
>> > > //lets look for the missing faultBean there.
>> > > -
>> > > +
>> > > + //Support for Wrapper Bean Generation
>> > > + //As per JAX-WS 2.2 Specificaiton section 3.6.2.1 pg 41 an application programmer does not use
>> > > + //the wrapper bean classes, so the application need not package these classes. If we have reached
>> > > + //this point in the code then user has choosen not to package these beans.
>> > > +
>> > > + //NOTE:If we find Generated artifacts from cache this guarantees that we will not use
>> > > + //DocLitWrappedMinimum marshaller code. The advantage of normal DocLitWrappedMarshaller is
>> > > + //that it is very robust and has support of lot more datatypes than in DocLitWrappedMinimum.
>> > > + if(log.isDebugEnabled()){
>> > > + log.debug("Adding cache to classpath");
>> > > + }
>> > > ClassFinderFactory cff =
>> > > (ClassFinderFactory)FactoryRegistry.getFactory(ClassFinderFactory.class);
>> > > ClassFinder cf = cff.getClassFinder();
>> > > @@ -317,11 +332,26 @@ class ArtifactProcessor {
>> > > if (cls2 == null) {
>> > > cls2 = loadClassOrNull(defaultValue, altClassLoader);
>> > > }
>> > > - if(cls2==null && (type.equals("faultInfo")|| type.equals("@WebFault"))){
>> > > - //As per JAX-WS 2.2 Specification section 3.7 an application programmer can choose not to
>> > > - //package the faultBeans, if we have reached this point in the code then user has choosen
>> > > - //not to package the fault bean. If there is a cache of generated artifacts available then
>> > > - //lets look for the missing faultBean there.
>> > > + if(cls2==null &&
>> > > + (type.equals("@RequestWrapper")|| type.equals("@ResponseWrapper")||type.equals("@WebFault")|| type.equals("faultInfo"))){
>> > > +
>> > > + //Support for Fault Bean Generation
>> > > + //As per JAX-WS 2.2 Specification section 3.7 an application programmer can choose not to
>> > > + //package the faultBeans, if we have reached this point in the code then user has choosen
>> > > + //not to package the fault bean. If there is a cache of generated artifacts available then
>> > > + //lets look for the missing faultBean there.
>> > > +
>> > > + //Support for Wrapper Bean Generation
>> > > + //As per JAX-WS 2.2 Specificaiton section 3.6.2.1 pg 41 an application programmer does not use
>> > > + //the wrapper bean classes, so the application need not package these classes. If we have reached
>> > > + //this point in the code then user has choosen not to package these beans.
>> > > +
>> > > + //NOTE:If we find Generated artifacts from cache this guarantees that we will not use
>> > > + //DocLitWrappedMinimum marshaller code. The advantage of normal DocLitWrappedMarshaller is
>> > > + //that it is very robust and has support of lot more datatypes than in DocLitWrappedMinimum.
>> > > + if(log.isDebugEnabled()){
>> > > + log.debug("Adding cache to classpath");
>> > > + }
>> > > if(log.isDebugEnabled()){
>> > > log.debug("Adding cache to classpath");
>> > > }
>> > >
>> > > Added: axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
>> > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java?rev=963508&view=auto
>> > > ==============================================================================
>> > > --- axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java (added)
>> > > +++ axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java Mon Jul 12 22:16:54 2010
>> > > @@ -0,0 +1,18 @@
>> > > +
>> > > +package org.apache.axis2.jaxws.wrapper.beans;
>> > > +
>> > > +import javax.xml.ws.WebFault;
>> > > +
>> > > +@WebFault(name = "AddNumbersFault", targetNamespace = "http://org/test/addnumbers")
>> > > +public class AddNumbersException extends Exception
>> > > +{
>> > > +
>> > > + private String message = null;
>> > > + public AddNumbersException(){}
>> > > + public AddNumbersException(String message){
>> > > + this.message = message;
>> > > + }
>> > > + public String getInfo(){
>> > > + return message;
>> > > + }
>> > > +}
>> > >
>> > > Added: axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
>> > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java?rev=963508&view=auto
>> > > ==============================================================================
>> > > --- axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java (added)
>> > > +++ axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java Mon Jul 12 22:16:54 2010
>> > > @@ -0,0 +1,15 @@
>> > > +package org.apache.axis2.jaxws.wrapper.beans;
>> > > +
>> > > +
>> > > +
>> > > +@javax.jws.WebService (targetNamespace="http://org/test/addnumbers", serviceName="AddNumbersService", portName="AddNumbersPort")
>> > > +public class AddNumbersService{
>> > > +
>> > > + public int addNumbers(int arg0, int arg1) throws AddNumbersException {
>> > > + if(arg0+arg1<0){
>> > > + throw new AddNumbersException("sum is less than 0");
>> > > + }
>> > > + return arg0+arg1;
>> > > + }
>> > > +
>> > > +}
>> > > \ No newline at end of file
>> > >
>> > > Added: axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
>> > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java?rev=963508&view=auto
>> > > ==============================================================================
>> > > --- axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java (added)
>> > > +++ axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java Mon Jul 12 22:16:54 2010
>> > > @@ -0,0 +1,114 @@
>> > > +/**
>> > > + *
>> > > + */
>> > > +package org.apache.axis2.jaxws.wrapper.beans;
>> > > +
>> > > +
>> > > +import org.apache.axis2.jaxws.Constants;
>> > > +import org.apache.axis2.jaxws.description.DescriptionFactory;
>> > > +import org.apache.axis2.jaxws.description.EndpointDescription;
>> > > +import org.apache.axis2.jaxws.description.EndpointDescriptionJava;
>> > > +import org.apache.axis2.jaxws.description.OperationDescription;
>> > > +import org.apache.axis2.jaxws.description.ServiceDescription;
>> > > +import org.apache.axis2.jaxws.marshaller.MethodMarshaller;
>> > > +import org.apache.axis2.jaxws.marshaller.factory.MethodMarshallerFactory;
>> > > +import org.apache.axis2.jaxws.marshaller.impl.alt.DocLitWrappedMinimalMethodMarshaller;
>> > > +import org.apache.axis2.jaxws.unitTest.TestLogger;
>> > > +
>> > > +import java.io.File;
>> > > +
>> > > +import junit.framework.TestCase;
>> > > +
>> > > +public class WrapperBeanMarshallTests extends TestCase {
>> > > + /**
>> > > + * This is the negative test case, when we do not use generated artifacts from cache
>> > > + * and user did not package wrapper beans, we should see use of DocLitWrappedMinumumMarshaller.
>> > > + */
>> > > + public void testGetMarshallerOperationDescriptionBooleanNegative() {
>> > > + TestLogger.logger.debug("---------------------------------------");
>> > > + TestLogger.logger.debug("test: " + getName());
>> > > +
>> > > + String cache_location = "/target/wscache/classes";
>> > > + try{
>> > > + String baseDir = new File(System.getProperty("basedir",".")).getCanonicalPath();
>> > > + cache_location = new File(baseDir+cache_location).getAbsolutePath();
>> > > + TestLogger.logger.debug("cache location ="+cache_location);
>> > > +
>> > > + //Get EndpointDescription.
>> > > + //Set location on AxisConfiguraiton.
>> > > + Class sei = AddNumbersService.class;
>> > > + EndpointDescription description = getEndpointDesc(sei);
>> > > + TestLogger.logger.debug("description objects where created successfully");
>> > > + OperationDescription[] ops =description.getEndpointInterfaceDescription().getOperations();
>> > > + assertNotNull( "OperationDescriptions where null", ops);
>> > > + assertTrue("No Operation Descriptions where found", ops.length>0);
>> > > + OperationDescription op = ops[0];
>> > > + TestLogger.logger.debug("operation found, java methodName="+op.getJavaMethodName());
>> > > + //Don not Set cache on AxisConfiguration.
>> > > + //get Marshaller, verify its not DoclitWrappedMinimum.
>> > > + TestLogger.logger.debug("ws_cache location NOT set on AxisConfigContext, location="+cache_location);
>> > > + MethodMarshaller mm = MethodMarshallerFactory.getMarshaller(op, false);
>> > > + assertNotNull("getMarshaller returned null", mm );
>> > > + TestLogger.logger.debug("MethodMarshaller was created, type="+mm.getClass().getName());
>> > > + assertTrue("Generated artifacts not found, Method marshaller should be DocLitWrappedMinimumMarshaller", (mm instanceof DocLitWrappedMinimalMethodMarshaller));
>> > > + }catch(Exception e){
>> > > + TestLogger.logger.debug("Exception ="+e.getMessage());
>> > > + fail(e.getMessage());
>> > > + }
>> > > +
>> > > + }
>> > > + /**
>> > > + * In this test case user did not package wrapper beans but we add generated artifacts from cache, we should see use of
>> > > + * DocLitWrappedMarshaller.
>> > > + * Test method for {@link org.apache.axis2.jaxws.marshaller.factory.MethodMarshallerFactory#getMarshaller(org.apache.axis2.jaxws.description.OperationDescription, boolean)}.
>> > > + */
>> > > + public void testGetMarshallerOperationDescriptionBoolean() {
>> > > + TestLogger.logger.debug("---------------------------------------");
>> > > + TestLogger.logger.debug("test: " + getName());
>> > > +
>> > > + String cache_location = "/target/wscache/classes";
>> > > + try{
>> > > + String baseDir = new File(System.getProperty("basedir",".")).getCanonicalPath();
>> > > + cache_location = new File(baseDir+cache_location).getAbsolutePath();
>> > > + TestLogger.logger.debug("cache location ="+cache_location);
>> > > +
>> > > + //Get EndpointDescription.
>> > > + //Set location on AxisConfiguraiton.
>> > > + Class sei = AddNumbersService.class;
>> > > + EndpointDescription description = getEndpointDesc(sei);
>> > > + TestLogger.logger.debug("description objects where created successfully");
>> > > + OperationDescription[] ops =description.getEndpointInterfaceDescription().getOperations();
>> > > + assertNotNull( "OperationDescriptions where null", ops);
>> > > + assertTrue("No Operation Descriptions where found", ops.length>0);
>> > > + OperationDescription op = ops[0];
>> > > + TestLogger.logger.debug("operation found, java methodName="+op.getJavaMethodName());
>> > > + //Set cache on AxisConfiguration.
>> > > + //get Marshaller, verify its not DoclitWrappedMinimum.
>> > > + description.getServiceDescription().getAxisConfigContext().setProperty(Constants.WS_CACHE, cache_location);
>> > > + TestLogger.logger.debug("ws_cache location set on AxisConfigContext, location="+cache_location);
>> > > + MethodMarshaller mm = MethodMarshallerFactory.getMarshaller(op, false);
>> > > + assertNotNull("getMarshaller returned null", mm );
>> > > + TestLogger.logger.debug("MethodMarshaller was created, type="+mm.getClass().getName());
>> > > + assertTrue("Generated artifacts are in cache, Method marshaller should not be DocLitWrappedMinimumMarshaller", !(mm instanceof DocLitWrappedMinimalMethodMarshaller));
>> > > + }catch(Exception e){
>> > > + TestLogger.logger.debug("Exception ="+e.getMessage());
>> > > + fail(e.getMessage());
>> > > + }
>> > > +
>> > > + }
>> > > +
>> > > + private EndpointDescription getEndpointDesc(Class implementationClass) {
>> > > + // Use the description factory directly; this will be done within the JAX-WS runtime
>> > > + ServiceDescription serviceDesc =
>> > > + DescriptionFactory.createServiceDescription(implementationClass);
>> > > + assertNotNull(serviceDesc);
>> > > +
>> > > + EndpointDescription[] endpointDesc = serviceDesc.getEndpointDescriptions();
>> > > + assertNotNull(endpointDesc);
>> > > + assertEquals(1, endpointDesc.length);
>> > > +
>> > > + // TODO: How will the JAX-WS dispatcher get the appropriate port (i.e. endpoint)? Currently assumes [0]
>> > > + EndpointDescription testEndpointDesc = endpointDesc[0];
>> > > + return testEndpointDesc;
>> > > + }
>> > > +}
>> > >
>> > > Added: axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml
>> > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml?rev=963508&view=auto
>> > > ==============================================================================
>> > > --- axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml (added)
>> > > +++ axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml Mon Jul 12 22:16:54 2010
>> > > @@ -0,0 +1,34 @@
>> > > +<?xml version="1.0" encoding="UTF-8"?>
>> > > +
>> > > +<project basedir="." default="run-wsgen-tests" name="wsgen-tests">
>> > > +
>> > > + <property name="wscache.output.base.dir" value="target/wscache" />
>> > > + <property name="wscache.generated.src.dir" value="${wscache.output.base.dir}/src" />
>> > > + <property name="wscache.generated.classes.dir" value="${wscache.output.base.dir}/classes" />
>> > > + <property name="compile.test.classes" value="target/test-classes" />
>> > > +
>> > > +
>> > > + <target name="run-wsgen-tests" depends="wrapper-beans"/>
>> > > +
>> > > +
>> > > + <target name="create-cache">
>> > > + <mkdir dir="${wscache.output.base.dir}" />
>> > > + <mkdir dir="${wscache.generated.src.dir}" />
>> > > + <mkdir dir="${wscache.generated.classes.dir}" />
>> > > + </target>
>> > > +
>> > > + <target name="wrapper-beans" depends="create-cache">
>> > > + <echo>Generating artifacts for org.apache.axis2.jaxws.wrapper.beans.AddNumbersService </echo>
>> > > + <wsgen
>> > > + sei="org.apache.axis2.jaxws.wrapper.beans.AddNumbersService"
>> > > + destdir="${wscache.generated.classes.dir}"
>> > > + resourcedestdir="${wscache.generated.src.dir}"
>> > > + keep="false"
>> > > + verbose="false"
>> > > + genwsdl="true">
>> > > + <classpath>
>> > > + <pathelement path="${compile.test.classes}" />
>> > > + </classpath>
>> > > + </wsgen>
>> > > + </target>
>> > > +</project>
>> > > \ No newline at end of file
>> > >
>> > >
>> > >
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
>> > For additional commands, e-mail: java-dev-help@axis.apache.org
>> >
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
>> For additional commands, e-mail: java-dev-help@axis.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-dev-help@axis.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org
Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws: ./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/
test/org/apache/axis2/jaxws/wrapper/ test/org/apache/axis2/jaxws/wrapper/beans/
Posted by Nikhil V Thaker <ni...@us.ibm.com>.
Thanks Jarek for the suggestion.
The fact that there is an objection to putting jaxws-tools.jar as a
dependency would mean we cannot run wsGen. Unless I misunderstood Andreas
comments. To me we should always have jaxws-tools as dependency to jaxws
module, after all jaxws tools are prerequisite to jaxws runtime, a user of
jaxws runtime has to run wsGen or wsImport to build webservices
application.
Anyways, I will look and see if there is an alternate way to add these
test cases.
Regards,
Nikhil Thaker
office: 919 254 9964
nvthaker@us.ibm.com
Jarek Gawor <jg...@gmail.com>
07/14/2010 03:38 PM
Please respond to
java-dev@axis.apache.org
To
java-dev@axis.apache.org
cc
Subject
Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws: ./
src/org/apache/axis2/jaxws/runtime/description/marshal/impl/
test/org/apache/axis2/jaxws/wrapper/
test/org/apache/axis2/jaxws/wrapper/beans/
Just a couple of thoughts:
1) Since you already have wsgen-tests.xml ant script to run the wsgen
you could setup the appropriate classpath to the tools.jar or
classes.jar or whatever in it. You just might need to fork the ant
process.
2) I don't think it's that horrible to commit some generate code
especially if there isn't too much of it and the test case is
important. Besides, Axis2 already has some generated code checked it.
Jarek
On Wed, Jul 14, 2010 at 4:00 PM, Nikhil V Thaker
<ni...@us.ibm.com> wrote:
>
> Yes Andreas,
> I am running antrun plugin as the wsGen plugin has errors and is not
fully matured, here's the URL that explains the issue I ran into
http://jira.codehaus.org/browse/MNG-3586.
>
> So since I cannot run wsGen or cannot include generated artifacts I will
just remove the test case. I will commit the changes soon.
>
> Regards,
>
> Nikhil Thaker
> office: 919 254 9964
> nvthaker@us.ibm.com
>
>
> Andreas Veithen <an...@gmail.com>
>
> 07/14/2010 02:48 PM
>
> Please respond to
> java-dev@axis.apache.org
> To
> java-dev@axis.apache.org
> cc
> Subject
> Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws:
./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/
test/org/apache/axis2/jaxws/wrapper/
test/org/apache/axis2/jaxws/wrapper/beans/
>
>
>
>
> No, you are using the antrun plugin to execute the wsgen ant task.
> What I meant was to use a real Maven plugin (either the one from
> java.net or the one from CXF).
>
> -1 to commit any generated stuff into SVN.
>
> Andreas
>
> On Wed, Jul 14, 2010 at 21:42, Nikhil V Thaker
> <ni...@us.ibm.com> wrote:
> >
> > Andreas - I had to add the tools.jar bit because maven plugin for
wsGen gave NoClassDef Found errors for classes packaged in tools.jar.
> >
> > Since this is causing a problem I will just package the generated
artifacts and remove the wsGen dependency.
> >
> > Thanks,
> >
> > Nikhil Thaker
> > office: 919 254 9964
> > nvthaker@us.ibm.com
> >
> >
> > Andreas Veithen <an...@gmail.com>
> >
> > 07/14/2010 01:44 PM
> >
> > Please respond to
> > java-dev@axis.apache.org
> > To
> > java-dev@axis.apache.org
> > cc
> > Subject
> > Re: svn commit: r963508 - in
/axis/axis2/java/core/trunk/modules/jaxws: ./
src/org/apache/axis2/jaxws/runtime/description/marshal/impl/
test/org/apache/axis2/jaxws/wrapper/
test/org/apache/axis2/jaxws/wrapper/beans/
> >
> >
> >
> >
> > Nikhil,
> >
> > I have some issues with the tools and jaxws-tools dependencies
> > introduced by this change:
> >
> > * The change causes a build failure in Hudson. There will also be
> > additional issues with tools.jar, because the way to declare this as a
> > system dependency varies from one JDK to another. For example, I
> > remember that on Mac OS X, it is completely different than on other
> > JDKs.
> >
> > * I don't like the fact that jaxws-tools becomes a dependency of
> > axis2-jaxws in scope compile, because it looks like this is only
> > needed during the build and/or during the tests.
> >
> > I didn't review the change in detail, but wouldn't it be smarter to
> > use one of the existing Maven plugins to do the wsgen stuff? They will
> > take care of the tools.jar stuff as well.
> >
> > Andreas
> >
> > On Tue, Jul 13, 2010 at 00:16, <nt...@apache.org> wrote:
> > > Author: nthaker
> > > Date: Mon Jul 12 22:16:54 2010
> > > New Revision: 963508
> > >
> > > URL: http://svn.apache.org/viewvc?rev=963508&view=rev
> > > Log:
> > > AXIS2-4775
> > > This change ensures that we will use Request and Response wrapper
Bean packaged by customer or we will Generate Wrappers if they are not
packaged.
> > >
> > > Added:
> > >
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/
> > >
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/
> > >
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
> > >
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
> > >
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
> > > axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml
> > > Modified:
> > > axis/axis2/java/core/trunk/modules/jaxws/pom.xml
> > >
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
> > >
> > > Modified: axis/axis2/java/core/trunk/modules/jaxws/pom.xml
> > > URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/pom.xml?rev=963508&r1=963507&r2=963508&view=diff
> > >
==============================================================================
> > > --- axis/axis2/java/core/trunk/modules/jaxws/pom.xml (original)
> > > +++ axis/axis2/java/core/trunk/modules/jaxws/pom.xml Mon Jul 12
22:16:54 2010
> > > @@ -1,5 +1,4 @@
> > > <?xml version="1.0" encoding="UTF-8"?>
> > > -
> > > <!-- > ~ Licensed to the Apache Software Foundation (ASF) under
one
> > > ~ or more contributor license agreements. See the NOTICE file
> > > @@ -20,7 +19,7 @@
> > > -->
> > >
> > > <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"
> > > - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
> > > + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
> > > <modelVersion>4.0.0</modelVersion>
> > > <parent>
> > > <groupId>org.apache.axis2</groupId>
> > > @@ -98,7 +97,25 @@
> > > <version>${version}</version>
> > > <scope>test</scope>
> > > </dependency>
> > > + <dependency>
> > > + <groupId>wsdl4j</groupId>
> > > + <artifactId>wsdl4j</artifactId>
> > > + </dependency>
> > > + <dependency>
> > > + <groupId>com.sun.xml.ws</groupId>
> > > + <artifactId>jaxws-tools</artifactId>
> > > + <version>2.1.3</version>
> > > + </dependency>
> > > + <!-- If we dont include tools.jar as dependency, maven
throws NoClassDefFound on wsGen run -->
> > > + <dependency>
> > > + <groupId>java</groupId>
> > > + <artifactId>tools</artifactId>
> > > + <version>$version</version>
> > > + <scope>system</scope>
> > > + <systemPath>${JAVA_HOME}/lib/tools.jar</systemPath>
> > > + </dependency>
> > > </dependencies>
> > > +
> > > <build>
> > > <sourceDirectory>src</sourceDirectory>
> > > <testSourceDirectory>test</testSourceDirectory>
> > > @@ -203,34 +220,39 @@
> > > <compilerVersion>1.5</compilerVersion>
> > > <source>1.5</source>
> > > <target>1.5</target>
> > > +
> > > </configuration>
> > > </plugin>
> > > <plugin>
> > > <groupId>org.apache.maven.plugins</groupId>
> > > <artifactId>maven-antrun-plugin</artifactId>
> > > +
> > > <executions>
> > > <execution>
> > > <id>gen-ts</id>
> > > <phase>generate-test-sources</phase>
> > > <configuration>
> > > - <tasks unless="maven.test.skip">
> > > + <tasks unless="maven.test.skip">
> > > <!-- Theres got to be a better way
to do this -->
> > > <property name="schema.source.dir"
value="test-resources/xsd"/>
> > > <property name="wsdl.source.dir"
value="test-resources/wsdl"/>
> > > - <property
name="schema.output.base.dir" value="target/schema"/>
> > > + <property
name="schema.output.base.dir" value="target/schema"/>
> > > <property
name="schema.generated.src.dir" value="${schema.output.base.dir}/src"/>
> > > <property
name="schema.generated.classes.dir"
> > >
value="${schema.output.base.dir}/classes"/>
> > > +
> > > <!-- make the dirs -->
> > > <mkdir
dir="${schema.output.base.dir}"/>
> > > <mkdir
dir="${schema.generated.src.dir}"/>
> > > <mkdir
dir="${schema.generated.classes.dir}"/>
> > > +
> > > <!-- Run JAXB schema compiler with
designated schemas -->
> > > <echo>Generating JAX-B classes from
XSDs</echo>
> > >
> > > <echo>Generating java from
echo.xsd</echo>
> > > <java
classname="com.sun.tools.xjc.Driver" fork="true">
> > > <classpath
refid="maven.runtime.classpath"/>
> > > +
> > > <classpath
location="${compiled.classes.dir}"/>
> > > <arg line="-d
${schema.generated.src.dir} -quiet ${schema.source.dir}/echo.xsd"/>
> > > </java>
> > > @@ -266,7 +288,7 @@
> > > <classpath
refid="maven.runtime.classpath"/>
> > > <classpath
location="${compiled.classes.dir}"/>
> > > <arg line="-d
${schema.generated.src.dir} -quiet -wsdl
${wsdl.source.dir}/AddNumbers.wsdl"/>
> > > - </java>
> > > + </java>
> > > </tasks>
> > > </configuration>
> > > <goals>
> > > @@ -287,6 +309,22 @@
> > > <property name="addressing_version"
value="${version}"/>
> > > <ant antfile="build.xml"
inheritall="true" inheritrefs="true"
> > > dir="." target="build-repo"/>
> > > +
> > > +
<property name="compile_classpath" refid="maven.compile.classpath" />
> > > +
<property name="runtime_classpath" refid="maven.runtime.classpath" />
> > > +
<property name="test_classpath" refid="maven.test.classpath" />
> > > +
<property name="plugin_classpath" refid="maven.plugin.classpath" />
> > > +
> > > + <!-- Defining wsGen task -->
> > > +
<taskdef name="wsgen" loaderRef="refwsgen"
classname="com.sun.tools.ws.ant.WsGen">
> > > +
<classpath>
> > > +
<path refid="maven.runtime.classpath" />
> > > +
<path refid="maven.compile.classpath" />
> > > +
</classpath>
> > > +
</taskdef>
> > > + <!--
Invoking test cases that need to generate artifacts using wsGen -->
> > > + <ant antfile="wsgen-tests.xml"
inheritall="true" inheritrefs="true"
> > > + dir="."
target="run-wsgen-tests"/>
> > > </tasks>
> > > </configuration>
> > > <goals>
> > > @@ -374,6 +412,13 @@
> > > <plugin>
> > > <groupId>org.apache.maven.plugins</groupId>
> > >
<artifactId>maven-surefire-report-plugin</artifactId>
> > > + <reportSets>
> > > + <reportSet>
> > > + <reports>
> > > + <report>report-only</report>
> > > + </reports>
> > > + </reportSet>
> > > + </reportSets>
> > > </plugin>
> > > </plugins>
> > > </reporting>
> > >
> > > Modified:
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
> > > URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java?rev=963508&r1=963507&r2=963508&view=diff
> > >
==============================================================================
> > > ---
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
(original)
> > > +++
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
Mon Jul 12 22:16:54 2010
> > > @@ -238,12 +238,27 @@ class ArtifactProcessor {
> > > wrapperClass = newValue;
> > > }
> > > }
> > > - if(cls==null && (type.equals("@WebFault")||
type.equals("faultInfo"))){
> > > +
> > > + if(cls==null &&
> > > + (type.equals("@RequestWrapper")||
type.equals("@ResponseWrapper")||type.equals("@WebFault")||
type.equals("faultInfo"))){
> > > +
> > > + //Support for Fault Bean Generation
> > > //As per JAX-WS 2.2 Specification
section 3.7 an application programmer can choose not to
> > > //package the faultBeans, if we have
reached this point in the code then user has choosen
> > > //not to package the fault bean. If
there is a cache of generated artifacts available then
> > > //lets look for the missing faultBean
there.
> > > -
> > > +
> > > + //Support for Wrapper Bean Generation
> > > + //As per JAX-WS 2.2 Specificaiton
section 3.6.2.1 pg 41 an application programmer does not use
> > > + //the wrapper bean classes, so the
application need not package these classes. If we have reached
> > > + //this point in the code then user has
choosen not to package these beans.
> > > +
> > > + //NOTE:If we find Generated artifacts
from cache this guarantees that we will not use
> > > + //DocLitWrappedMinimum marshaller code.
The advantage of normal DocLitWrappedMarshaller is
> > > + //that it is very robust and has
support of lot more datatypes than in DocLitWrappedMinimum.
> > > + if(log.isDebugEnabled()){
> > > + log.debug("Adding cache to
classpath");
> > > + }
> > > ClassFinderFactory cff =
> > >
(ClassFinderFactory)FactoryRegistry.getFactory(ClassFinderFactory.class);
> > > ClassFinder cf = cff.getClassFinder();
> > > @@ -317,11 +332,26 @@ class ArtifactProcessor {
> > > if (cls2 == null) {
> > > cls2 = loadClassOrNull(defaultValue,
altClassLoader);
> > > }
> > > - if(cls2==null &&
(type.equals("faultInfo")|| type.equals("@WebFault"))){
> > > - //As per JAX-WS 2.2 Specification
section 3.7 an application programmer can choose not to
> > > - //package the faultBeans, if we have
reached this point in the code then user has choosen
> > > - //not to package the fault bean. If
there is a cache of generated artifacts available then
> > > - //lets look for the missing faultBean
there.
> > > + if(cls2==null &&
> > > +
(type.equals("@RequestWrapper")||
type.equals("@ResponseWrapper")||type.equals("@WebFault")||
type.equals("faultInfo"))){
> > > +
> > > + //Support for Fault Bean Generation
> > > + //As per JAX-WS 2.2 Specification
section 3.7 an application programmer can choose not to
> > > + //package the faultBeans, if we have
reached this point in the code then user has choosen
> > > + //not to package the fault bean. If
there is a cache of generated artifacts available then
> > > + //lets look for the missing
faultBean there.
> > > +
> > > + //Support for Wrapper Bean
Generation
> > > + //As per JAX-WS 2.2 Specificaiton
section 3.6.2.1 pg 41 an application programmer does not use
> > > + //the wrapper bean classes, so the
application need not package these classes. If we have reached
> > > + //this point in the code then user
has choosen not to package these beans.
> > > +
> > > + //NOTE:If we find Generated
artifacts from cache this guarantees that we will not use
> > > + //DocLitWrappedMinimum marshaller
code. The advantage of normal DocLitWrappedMarshaller is
> > > + //that it is very robust and has
support of lot more datatypes than in DocLitWrappedMinimum.
> > > + if(log.isDebugEnabled()){
> > > + log.debug("Adding cache to
classpath");
> > > + }
> > > if(log.isDebugEnabled()){
> > > log.debug("Adding cache to
classpath");
> > > }
> > >
> > > Added:
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
> > > URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java?rev=963508&view=auto
> > >
==============================================================================
> > > ---
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
(added)
> > > +++
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
Mon Jul 12 22:16:54 2010
> > > @@ -0,0 +1,18 @@
> > > +
> > > +package org.apache.axis2.jaxws.wrapper.beans;
> > > +
> > > +import javax.xml.ws.WebFault;
> > > +
> > > +@WebFault(name = "AddNumbersFault", targetNamespace = "
http://org/test/addnumbers")
> > > +public class AddNumbersException extends Exception
> > > +{
> > > +
> > > + private String message = null;
> > > + public AddNumbersException(){}
> > > + public AddNumbersException(String message){
> > > + this.message = message;
> > > + }
> > > + public String getInfo(){
> > > + return message;
> > > + }
> > > +}
> > >
> > > Added:
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
> > > URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java?rev=963508&view=auto
> > >
==============================================================================
> > > ---
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
(added)
> > > +++
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
Mon Jul 12 22:16:54 2010
> > > @@ -0,0 +1,15 @@
> > > +package org.apache.axis2.jaxws.wrapper.beans;
> > > +
> > > +
> > > +
> > > +@javax.jws.WebService (targetNamespace="http://org/test/addnumbers
", serviceName="AddNumbersService", portName="AddNumbersPort")
> > > +public class AddNumbersService{
> > > +
> > > + public int addNumbers(int arg0, int arg1) throws
AddNumbersException {
> > > + if(arg0+arg1<0){
> > > + throw new AddNumbersException("sum is less
than 0");
> > > + }
> > > + return arg0+arg1;
> > > + }
> > > +
> > > +}
> > > \ No newline at end of file
> > >
> > > Added:
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
> > > URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java?rev=963508&view=auto
> > >
==============================================================================
> > > ---
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
(added)
> > > +++
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
Mon Jul 12 22:16:54 2010
> > > @@ -0,0 +1,114 @@
> > > +/**
> > > + *
> > > + */
> > > +package org.apache.axis2.jaxws.wrapper.beans;
> > > +
> > > +
> > > +import org.apache.axis2.jaxws.Constants;
> > > +import org.apache.axis2.jaxws.description.DescriptionFactory;
> > > +import org.apache.axis2.jaxws.description.EndpointDescription;
> > > +import org.apache.axis2.jaxws.description.EndpointDescriptionJava;
> > > +import org.apache.axis2.jaxws.description.OperationDescription;
> > > +import org.apache.axis2.jaxws.description.ServiceDescription;
> > > +import org.apache.axis2.jaxws.marshaller.MethodMarshaller;
> > > +import
org.apache.axis2.jaxws.marshaller.factory.MethodMarshallerFactory;
> > > +import
org.apache.axis2.jaxws.marshaller.impl.alt.DocLitWrappedMinimalMethodMarshaller;
> > > +import org.apache.axis2.jaxws.unitTest.TestLogger;
> > > +
> > > +import java.io.File;
> > > +
> > > +import junit.framework.TestCase;
> > > +
> > > +public class WrapperBeanMarshallTests extends TestCase {
> > > + /**
> > > + * This is the negative test case, when we do not use generated
artifacts from cache
> > > + * and user did not package wrapper beans, we should see use of
DocLitWrappedMinumumMarshaller.
> > > + */
> > > + public void
testGetMarshallerOperationDescriptionBooleanNegative() {
> > > +
TestLogger.logger.debug("---------------------------------------");
> > > + TestLogger.logger.debug("test: " + getName());
> > > +
> > > + String cache_location = "/target/wscache/classes";
> > > + try{
> > > + String baseDir = new
File(System.getProperty("basedir",".")).getCanonicalPath();
> > > + cache_location = new
File(baseDir+cache_location).getAbsolutePath();
> > > + TestLogger.logger.debug("cache location
="+cache_location);
> > > +
> > > + //Get EndpointDescription.
> > > + //Set location on AxisConfiguraiton.
> > > + Class sei = AddNumbersService.class;
> > > + EndpointDescription description = getEndpointDesc(sei);
> > > + TestLogger.logger.debug("description objects where
created successfully");
> > > + OperationDescription[] ops
=description.getEndpointInterfaceDescription().getOperations();
> > > + assertNotNull( "OperationDescriptions where null",
ops);
> > > + assertTrue("No Operation Descriptions where found",
ops.length>0);
> > > + OperationDescription op = ops[0];
> > > + TestLogger.logger.debug("operation found, java
methodName="+op.getJavaMethodName());
> > > + //Don not Set cache on AxisConfiguration.
> > > + //get Marshaller, verify its not DoclitWrappedMinimum.
> > > + TestLogger.logger.debug("ws_cache location NOT set on
AxisConfigContext, location="+cache_location);
> > > + MethodMarshaller mm =
MethodMarshallerFactory.getMarshaller(op, false);
> > > + assertNotNull("getMarshaller returned null", mm );
> > > + TestLogger.logger.debug("MethodMarshaller was created,
type="+mm.getClass().getName());
> > > + assertTrue("Generated artifacts not found, Method
marshaller should be DocLitWrappedMinimumMarshaller", (mm instanceof
DocLitWrappedMinimalMethodMarshaller));
> > > + }catch(Exception e){
> > > + TestLogger.logger.debug("Exception ="+e.getMessage());
> > > + fail(e.getMessage());
> > > + }
> > > +
> > > + }
> > > + /**
> > > + * In this test case user did not package wrapper beans but we
add generated artifacts from cache, we should see use of
> > > + * DocLitWrappedMarshaller.
> > > + * Test method for {@link
org.apache.axis2.jaxws.marshaller.factory.MethodMarshallerFactory#getMarshaller(org.apache.axis2.jaxws.description.OperationDescription,
boolean)}.
> > > + */
> > > + public void testGetMarshallerOperationDescriptionBoolean() {
> > > +
TestLogger.logger.debug("---------------------------------------");
> > > + TestLogger.logger.debug("test: " + getName());
> > > +
> > > + String cache_location = "/target/wscache/classes";
> > > + try{
> > > + String baseDir = new
File(System.getProperty("basedir",".")).getCanonicalPath();
> > > + cache_location = new
File(baseDir+cache_location).getAbsolutePath();
> > > + TestLogger.logger.debug("cache location
="+cache_location);
> > > +
> > > + //Get EndpointDescription.
> > > + //Set location on AxisConfiguraiton.
> > > + Class sei = AddNumbersService.class;
> > > + EndpointDescription description = getEndpointDesc(sei);
> > > + TestLogger.logger.debug("description objects where
created successfully");
> > > + OperationDescription[] ops
=description.getEndpointInterfaceDescription().getOperations();
> > > + assertNotNull( "OperationDescriptions where null",
ops);
> > > + assertTrue("No Operation Descriptions where found",
ops.length>0);
> > > + OperationDescription op = ops[0];
> > > + TestLogger.logger.debug("operation found, java
methodName="+op.getJavaMethodName());
> > > + //Set cache on AxisConfiguration.
> > > + //get Marshaller, verify its not DoclitWrappedMinimum.
> > > +
description.getServiceDescription().getAxisConfigContext().setProperty(Constants.WS_CACHE,
cache_location);
> > > + TestLogger.logger.debug("ws_cache location set on
AxisConfigContext, location="+cache_location);
> > > + MethodMarshaller mm =
MethodMarshallerFactory.getMarshaller(op, false);
> > > + assertNotNull("getMarshaller returned null", mm );
> > > + TestLogger.logger.debug("MethodMarshaller was created,
type="+mm.getClass().getName());
> > > + assertTrue("Generated artifacts are in cache, Method
marshaller should not be DocLitWrappedMinimumMarshaller", !(mm instanceof
DocLitWrappedMinimalMethodMarshaller));
> > > + }catch(Exception e){
> > > + TestLogger.logger.debug("Exception ="+e.getMessage());
> > > + fail(e.getMessage());
> > > + }
> > > +
> > > + }
> > > +
> > > + private EndpointDescription getEndpointDesc(Class
implementationClass) {
> > > + // Use the description factory directly; this will be done
within the JAX-WS runtime
> > > + ServiceDescription serviceDesc =
> > > +
DescriptionFactory.createServiceDescription(implementationClass);
> > > + assertNotNull(serviceDesc);
> > > +
> > > + EndpointDescription[] endpointDesc =
serviceDesc.getEndpointDescriptions();
> > > + assertNotNull(endpointDesc);
> > > + assertEquals(1, endpointDesc.length);
> > > +
> > > + // TODO: How will the JAX-WS dispatcher get the appropriate
port (i.e. endpoint)? Currently assumes [0]
> > > + EndpointDescription testEndpointDesc = endpointDesc[0];
> > > + return testEndpointDesc;
> > > + }
> > > +}
> > >
> > > Added: axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml
> > > URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml?rev=963508&view=auto
> > >
==============================================================================
> > > --- axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml (added)
> > > +++ axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml Mon Jul
12 22:16:54 2010
> > > @@ -0,0 +1,34 @@
> > > +<?xml version="1.0" encoding="UTF-8"?>
> > > +
> > > +<project basedir="." default="run-wsgen-tests" name="wsgen-tests">
> > > +
> > > + <property name="wscache.output.base.dir"
value="target/wscache" />
> > > + <property name="wscache.generated.src.dir"
value="${wscache.output.base.dir}/src" />
> > > + <property name="wscache.generated.classes.dir"
value="${wscache.output.base.dir}/classes" />
> > > + <property name="compile.test.classes"
value="target/test-classes" />
> > > +
> > > +
> > > + <target name="run-wsgen-tests" depends="wrapper-beans"/>
> > > +
> > > +
> > > + <target name="create-cache">
> > > + <mkdir dir="${wscache.output.base.dir}" />
> > > + <mkdir dir="${wscache.generated.src.dir}" />
> > > + <mkdir dir="${wscache.generated.classes.dir}" />
> > > + </target>
> > > +
> > > + <target name="wrapper-beans" depends="create-cache">
> > > + <echo>Generating artifacts for
org.apache.axis2.jaxws.wrapper.beans.AddNumbersService </echo>
> > > + <wsgen
> > > +
sei="org.apache.axis2.jaxws.wrapper.beans.AddNumbersService"
> > > + destdir="${wscache.generated.classes.dir}"
> > > + resourcedestdir="${wscache.generated.src.dir}"
> > > + keep="false"
> > > + verbose="false"
> > > + genwsdl="true">
> > > + <classpath>
> > > + <pathelement path="${compile.test.classes}" />
> > > + </classpath>
> > > + </wsgen>
> > > + </target>
> > > +</project>
> > > \ No newline at end of file
> > >
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
> > For additional commands, e-mail: java-dev-help@axis.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-dev-help@axis.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org
Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws: ./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/
test/org/apache/axis2/jaxws/wrapper/ test/org/apache/axis2/jaxws/wrapper/beans/
Posted by Nikhil V Thaker <ni...@us.ibm.com>.
Thanks Jarek for the suggestion.
The fact that there is an objection to putting jaxws-tools.jar as a
dependency would mean we cannot run wsGen. Unless I misunderstood Andreas
comments. To me we should always have jaxws-tools as dependency to jaxws
module, after all jaxws tools are prerequisite to jaxws runtime, a user of
jaxws runtime has to run wsGen or wsImport to build webservices
application.
Anyways, I will look and see if there is an alternate way to add these
test cases.
Regards,
Nikhil Thaker
office: 919 254 9964
nvthaker@us.ibm.com
Jarek Gawor <jg...@gmail.com>
07/14/2010 03:38 PM
Please respond to
java-dev@axis.apache.org
To
java-dev@axis.apache.org
cc
Subject
Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws: ./
src/org/apache/axis2/jaxws/runtime/description/marshal/impl/
test/org/apache/axis2/jaxws/wrapper/
test/org/apache/axis2/jaxws/wrapper/beans/
Just a couple of thoughts:
1) Since you already have wsgen-tests.xml ant script to run the wsgen
you could setup the appropriate classpath to the tools.jar or
classes.jar or whatever in it. You just might need to fork the ant
process.
2) I don't think it's that horrible to commit some generate code
especially if there isn't too much of it and the test case is
important. Besides, Axis2 already has some generated code checked it.
Jarek
On Wed, Jul 14, 2010 at 4:00 PM, Nikhil V Thaker
<ni...@us.ibm.com> wrote:
>
> Yes Andreas,
> I am running antrun plugin as the wsGen plugin has errors and is not
fully matured, here's the URL that explains the issue I ran into
http://jira.codehaus.org/browse/MNG-3586.
>
> So since I cannot run wsGen or cannot include generated artifacts I will
just remove the test case. I will commit the changes soon.
>
> Regards,
>
> Nikhil Thaker
> office: 919 254 9964
> nvthaker@us.ibm.com
>
>
> Andreas Veithen <an...@gmail.com>
>
> 07/14/2010 02:48 PM
>
> Please respond to
> java-dev@axis.apache.org
> To
> java-dev@axis.apache.org
> cc
> Subject
> Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws:
./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/
test/org/apache/axis2/jaxws/wrapper/
test/org/apache/axis2/jaxws/wrapper/beans/
>
>
>
>
> No, you are using the antrun plugin to execute the wsgen ant task.
> What I meant was to use a real Maven plugin (either the one from
> java.net or the one from CXF).
>
> -1 to commit any generated stuff into SVN.
>
> Andreas
>
> On Wed, Jul 14, 2010 at 21:42, Nikhil V Thaker
> <ni...@us.ibm.com> wrote:
> >
> > Andreas - I had to add the tools.jar bit because maven plugin for
wsGen gave NoClassDef Found errors for classes packaged in tools.jar.
> >
> > Since this is causing a problem I will just package the generated
artifacts and remove the wsGen dependency.
> >
> > Thanks,
> >
> > Nikhil Thaker
> > office: 919 254 9964
> > nvthaker@us.ibm.com
> >
> >
> > Andreas Veithen <an...@gmail.com>
> >
> > 07/14/2010 01:44 PM
> >
> > Please respond to
> > java-dev@axis.apache.org
> > To
> > java-dev@axis.apache.org
> > cc
> > Subject
> > Re: svn commit: r963508 - in
/axis/axis2/java/core/trunk/modules/jaxws: ./
src/org/apache/axis2/jaxws/runtime/description/marshal/impl/
test/org/apache/axis2/jaxws/wrapper/
test/org/apache/axis2/jaxws/wrapper/beans/
> >
> >
> >
> >
> > Nikhil,
> >
> > I have some issues with the tools and jaxws-tools dependencies
> > introduced by this change:
> >
> > * The change causes a build failure in Hudson. There will also be
> > additional issues with tools.jar, because the way to declare this as a
> > system dependency varies from one JDK to another. For example, I
> > remember that on Mac OS X, it is completely different than on other
> > JDKs.
> >
> > * I don't like the fact that jaxws-tools becomes a dependency of
> > axis2-jaxws in scope compile, because it looks like this is only
> > needed during the build and/or during the tests.
> >
> > I didn't review the change in detail, but wouldn't it be smarter to
> > use one of the existing Maven plugins to do the wsgen stuff? They will
> > take care of the tools.jar stuff as well.
> >
> > Andreas
> >
> > On Tue, Jul 13, 2010 at 00:16, <nt...@apache.org> wrote:
> > > Author: nthaker
> > > Date: Mon Jul 12 22:16:54 2010
> > > New Revision: 963508
> > >
> > > URL: http://svn.apache.org/viewvc?rev=963508&view=rev
> > > Log:
> > > AXIS2-4775
> > > This change ensures that we will use Request and Response wrapper
Bean packaged by customer or we will Generate Wrappers if they are not
packaged.
> > >
> > > Added:
> > >
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/
> > >
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/
> > >
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
> > >
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
> > >
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
> > > axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml
> > > Modified:
> > > axis/axis2/java/core/trunk/modules/jaxws/pom.xml
> > >
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
> > >
> > > Modified: axis/axis2/java/core/trunk/modules/jaxws/pom.xml
> > > URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/pom.xml?rev=963508&r1=963507&r2=963508&view=diff
> > >
==============================================================================
> > > --- axis/axis2/java/core/trunk/modules/jaxws/pom.xml (original)
> > > +++ axis/axis2/java/core/trunk/modules/jaxws/pom.xml Mon Jul 12
22:16:54 2010
> > > @@ -1,5 +1,4 @@
> > > <?xml version="1.0" encoding="UTF-8"?>
> > > -
> > > <!-- > ~ Licensed to the Apache Software Foundation (ASF) under
one
> > > ~ or more contributor license agreements. See the NOTICE file
> > > @@ -20,7 +19,7 @@
> > > -->
> > >
> > > <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"
> > > - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
> > > + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
> > > <modelVersion>4.0.0</modelVersion>
> > > <parent>
> > > <groupId>org.apache.axis2</groupId>
> > > @@ -98,7 +97,25 @@
> > > <version>${version}</version>
> > > <scope>test</scope>
> > > </dependency>
> > > + <dependency>
> > > + <groupId>wsdl4j</groupId>
> > > + <artifactId>wsdl4j</artifactId>
> > > + </dependency>
> > > + <dependency>
> > > + <groupId>com.sun.xml.ws</groupId>
> > > + <artifactId>jaxws-tools</artifactId>
> > > + <version>2.1.3</version>
> > > + </dependency>
> > > + <!-- If we dont include tools.jar as dependency, maven
throws NoClassDefFound on wsGen run -->
> > > + <dependency>
> > > + <groupId>java</groupId>
> > > + <artifactId>tools</artifactId>
> > > + <version>$version</version>
> > > + <scope>system</scope>
> > > + <systemPath>${JAVA_HOME}/lib/tools.jar</systemPath>
> > > + </dependency>
> > > </dependencies>
> > > +
> > > <build>
> > > <sourceDirectory>src</sourceDirectory>
> > > <testSourceDirectory>test</testSourceDirectory>
> > > @@ -203,34 +220,39 @@
> > > <compilerVersion>1.5</compilerVersion>
> > > <source>1.5</source>
> > > <target>1.5</target>
> > > +
> > > </configuration>
> > > </plugin>
> > > <plugin>
> > > <groupId>org.apache.maven.plugins</groupId>
> > > <artifactId>maven-antrun-plugin</artifactId>
> > > +
> > > <executions>
> > > <execution>
> > > <id>gen-ts</id>
> > > <phase>generate-test-sources</phase>
> > > <configuration>
> > > - <tasks unless="maven.test.skip">
> > > + <tasks unless="maven.test.skip">
> > > <!-- Theres got to be a better way
to do this -->
> > > <property name="schema.source.dir"
value="test-resources/xsd"/>
> > > <property name="wsdl.source.dir"
value="test-resources/wsdl"/>
> > > - <property
name="schema.output.base.dir" value="target/schema"/>
> > > + <property
name="schema.output.base.dir" value="target/schema"/>
> > > <property
name="schema.generated.src.dir" value="${schema.output.base.dir}/src"/>
> > > <property
name="schema.generated.classes.dir"
> > >
value="${schema.output.base.dir}/classes"/>
> > > +
> > > <!-- make the dirs -->
> > > <mkdir
dir="${schema.output.base.dir}"/>
> > > <mkdir
dir="${schema.generated.src.dir}"/>
> > > <mkdir
dir="${schema.generated.classes.dir}"/>
> > > +
> > > <!-- Run JAXB schema compiler with
designated schemas -->
> > > <echo>Generating JAX-B classes from
XSDs</echo>
> > >
> > > <echo>Generating java from
echo.xsd</echo>
> > > <java
classname="com.sun.tools.xjc.Driver" fork="true">
> > > <classpath
refid="maven.runtime.classpath"/>
> > > +
> > > <classpath
location="${compiled.classes.dir}"/>
> > > <arg line="-d
${schema.generated.src.dir} -quiet ${schema.source.dir}/echo.xsd"/>
> > > </java>
> > > @@ -266,7 +288,7 @@
> > > <classpath
refid="maven.runtime.classpath"/>
> > > <classpath
location="${compiled.classes.dir}"/>
> > > <arg line="-d
${schema.generated.src.dir} -quiet -wsdl
${wsdl.source.dir}/AddNumbers.wsdl"/>
> > > - </java>
> > > + </java>
> > > </tasks>
> > > </configuration>
> > > <goals>
> > > @@ -287,6 +309,22 @@
> > > <property name="addressing_version"
value="${version}"/>
> > > <ant antfile="build.xml"
inheritall="true" inheritrefs="true"
> > > dir="." target="build-repo"/>
> > > +
> > > +
<property name="compile_classpath" refid="maven.compile.classpath" />
> > > +
<property name="runtime_classpath" refid="maven.runtime.classpath" />
> > > +
<property name="test_classpath" refid="maven.test.classpath" />
> > > +
<property name="plugin_classpath" refid="maven.plugin.classpath" />
> > > +
> > > + <!-- Defining wsGen task -->
> > > +
<taskdef name="wsgen" loaderRef="refwsgen"
classname="com.sun.tools.ws.ant.WsGen">
> > > +
<classpath>
> > > +
<path refid="maven.runtime.classpath" />
> > > +
<path refid="maven.compile.classpath" />
> > > +
</classpath>
> > > +
</taskdef>
> > > + <!--
Invoking test cases that need to generate artifacts using wsGen -->
> > > + <ant antfile="wsgen-tests.xml"
inheritall="true" inheritrefs="true"
> > > + dir="."
target="run-wsgen-tests"/>
> > > </tasks>
> > > </configuration>
> > > <goals>
> > > @@ -374,6 +412,13 @@
> > > <plugin>
> > > <groupId>org.apache.maven.plugins</groupId>
> > >
<artifactId>maven-surefire-report-plugin</artifactId>
> > > + <reportSets>
> > > + <reportSet>
> > > + <reports>
> > > + <report>report-only</report>
> > > + </reports>
> > > + </reportSet>
> > > + </reportSets>
> > > </plugin>
> > > </plugins>
> > > </reporting>
> > >
> > > Modified:
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
> > > URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java?rev=963508&r1=963507&r2=963508&view=diff
> > >
==============================================================================
> > > ---
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
(original)
> > > +++
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
Mon Jul 12 22:16:54 2010
> > > @@ -238,12 +238,27 @@ class ArtifactProcessor {
> > > wrapperClass = newValue;
> > > }
> > > }
> > > - if(cls==null && (type.equals("@WebFault")||
type.equals("faultInfo"))){
> > > +
> > > + if(cls==null &&
> > > + (type.equals("@RequestWrapper")||
type.equals("@ResponseWrapper")||type.equals("@WebFault")||
type.equals("faultInfo"))){
> > > +
> > > + //Support for Fault Bean Generation
> > > //As per JAX-WS 2.2 Specification
section 3.7 an application programmer can choose not to
> > > //package the faultBeans, if we have
reached this point in the code then user has choosen
> > > //not to package the fault bean. If
there is a cache of generated artifacts available then
> > > //lets look for the missing faultBean
there.
> > > -
> > > +
> > > + //Support for Wrapper Bean Generation
> > > + //As per JAX-WS 2.2 Specificaiton
section 3.6.2.1 pg 41 an application programmer does not use
> > > + //the wrapper bean classes, so the
application need not package these classes. If we have reached
> > > + //this point in the code then user has
choosen not to package these beans.
> > > +
> > > + //NOTE:If we find Generated artifacts
from cache this guarantees that we will not use
> > > + //DocLitWrappedMinimum marshaller code.
The advantage of normal DocLitWrappedMarshaller is
> > > + //that it is very robust and has
support of lot more datatypes than in DocLitWrappedMinimum.
> > > + if(log.isDebugEnabled()){
> > > + log.debug("Adding cache to
classpath");
> > > + }
> > > ClassFinderFactory cff =
> > >
(ClassFinderFactory)FactoryRegistry.getFactory(ClassFinderFactory.class);
> > > ClassFinder cf = cff.getClassFinder();
> > > @@ -317,11 +332,26 @@ class ArtifactProcessor {
> > > if (cls2 == null) {
> > > cls2 = loadClassOrNull(defaultValue,
altClassLoader);
> > > }
> > > - if(cls2==null &&
(type.equals("faultInfo")|| type.equals("@WebFault"))){
> > > - //As per JAX-WS 2.2 Specification
section 3.7 an application programmer can choose not to
> > > - //package the faultBeans, if we have
reached this point in the code then user has choosen
> > > - //not to package the fault bean. If
there is a cache of generated artifacts available then
> > > - //lets look for the missing faultBean
there.
> > > + if(cls2==null &&
> > > +
(type.equals("@RequestWrapper")||
type.equals("@ResponseWrapper")||type.equals("@WebFault")||
type.equals("faultInfo"))){
> > > +
> > > + //Support for Fault Bean Generation
> > > + //As per JAX-WS 2.2 Specification
section 3.7 an application programmer can choose not to
> > > + //package the faultBeans, if we have
reached this point in the code then user has choosen
> > > + //not to package the fault bean. If
there is a cache of generated artifacts available then
> > > + //lets look for the missing
faultBean there.
> > > +
> > > + //Support for Wrapper Bean
Generation
> > > + //As per JAX-WS 2.2 Specificaiton
section 3.6.2.1 pg 41 an application programmer does not use
> > > + //the wrapper bean classes, so the
application need not package these classes. If we have reached
> > > + //this point in the code then user
has choosen not to package these beans.
> > > +
> > > + //NOTE:If we find Generated
artifacts from cache this guarantees that we will not use
> > > + //DocLitWrappedMinimum marshaller
code. The advantage of normal DocLitWrappedMarshaller is
> > > + //that it is very robust and has
support of lot more datatypes than in DocLitWrappedMinimum.
> > > + if(log.isDebugEnabled()){
> > > + log.debug("Adding cache to
classpath");
> > > + }
> > > if(log.isDebugEnabled()){
> > > log.debug("Adding cache to
classpath");
> > > }
> > >
> > > Added:
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
> > > URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java?rev=963508&view=auto
> > >
==============================================================================
> > > ---
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
(added)
> > > +++
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
Mon Jul 12 22:16:54 2010
> > > @@ -0,0 +1,18 @@
> > > +
> > > +package org.apache.axis2.jaxws.wrapper.beans;
> > > +
> > > +import javax.xml.ws.WebFault;
> > > +
> > > +@WebFault(name = "AddNumbersFault", targetNamespace = "
http://org/test/addnumbers")
> > > +public class AddNumbersException extends Exception
> > > +{
> > > +
> > > + private String message = null;
> > > + public AddNumbersException(){}
> > > + public AddNumbersException(String message){
> > > + this.message = message;
> > > + }
> > > + public String getInfo(){
> > > + return message;
> > > + }
> > > +}
> > >
> > > Added:
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
> > > URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java?rev=963508&view=auto
> > >
==============================================================================
> > > ---
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
(added)
> > > +++
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
Mon Jul 12 22:16:54 2010
> > > @@ -0,0 +1,15 @@
> > > +package org.apache.axis2.jaxws.wrapper.beans;
> > > +
> > > +
> > > +
> > > +@javax.jws.WebService (targetNamespace="http://org/test/addnumbers
", serviceName="AddNumbersService", portName="AddNumbersPort")
> > > +public class AddNumbersService{
> > > +
> > > + public int addNumbers(int arg0, int arg1) throws
AddNumbersException {
> > > + if(arg0+arg1<0){
> > > + throw new AddNumbersException("sum is less
than 0");
> > > + }
> > > + return arg0+arg1;
> > > + }
> > > +
> > > +}
> > > \ No newline at end of file
> > >
> > > Added:
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
> > > URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java?rev=963508&view=auto
> > >
==============================================================================
> > > ---
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
(added)
> > > +++
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
Mon Jul 12 22:16:54 2010
> > > @@ -0,0 +1,114 @@
> > > +/**
> > > + *
> > > + */
> > > +package org.apache.axis2.jaxws.wrapper.beans;
> > > +
> > > +
> > > +import org.apache.axis2.jaxws.Constants;
> > > +import org.apache.axis2.jaxws.description.DescriptionFactory;
> > > +import org.apache.axis2.jaxws.description.EndpointDescription;
> > > +import org.apache.axis2.jaxws.description.EndpointDescriptionJava;
> > > +import org.apache.axis2.jaxws.description.OperationDescription;
> > > +import org.apache.axis2.jaxws.description.ServiceDescription;
> > > +import org.apache.axis2.jaxws.marshaller.MethodMarshaller;
> > > +import
org.apache.axis2.jaxws.marshaller.factory.MethodMarshallerFactory;
> > > +import
org.apache.axis2.jaxws.marshaller.impl.alt.DocLitWrappedMinimalMethodMarshaller;
> > > +import org.apache.axis2.jaxws.unitTest.TestLogger;
> > > +
> > > +import java.io.File;
> > > +
> > > +import junit.framework.TestCase;
> > > +
> > > +public class WrapperBeanMarshallTests extends TestCase {
> > > + /**
> > > + * This is the negative test case, when we do not use generated
artifacts from cache
> > > + * and user did not package wrapper beans, we should see use of
DocLitWrappedMinumumMarshaller.
> > > + */
> > > + public void
testGetMarshallerOperationDescriptionBooleanNegative() {
> > > +
TestLogger.logger.debug("---------------------------------------");
> > > + TestLogger.logger.debug("test: " + getName());
> > > +
> > > + String cache_location = "/target/wscache/classes";
> > > + try{
> > > + String baseDir = new
File(System.getProperty("basedir",".")).getCanonicalPath();
> > > + cache_location = new
File(baseDir+cache_location).getAbsolutePath();
> > > + TestLogger.logger.debug("cache location
="+cache_location);
> > > +
> > > + //Get EndpointDescription.
> > > + //Set location on AxisConfiguraiton.
> > > + Class sei = AddNumbersService.class;
> > > + EndpointDescription description = getEndpointDesc(sei);
> > > + TestLogger.logger.debug("description objects where
created successfully");
> > > + OperationDescription[] ops
=description.getEndpointInterfaceDescription().getOperations();
> > > + assertNotNull( "OperationDescriptions where null",
ops);
> > > + assertTrue("No Operation Descriptions where found",
ops.length>0);
> > > + OperationDescription op = ops[0];
> > > + TestLogger.logger.debug("operation found, java
methodName="+op.getJavaMethodName());
> > > + //Don not Set cache on AxisConfiguration.
> > > + //get Marshaller, verify its not DoclitWrappedMinimum.
> > > + TestLogger.logger.debug("ws_cache location NOT set on
AxisConfigContext, location="+cache_location);
> > > + MethodMarshaller mm =
MethodMarshallerFactory.getMarshaller(op, false);
> > > + assertNotNull("getMarshaller returned null", mm );
> > > + TestLogger.logger.debug("MethodMarshaller was created,
type="+mm.getClass().getName());
> > > + assertTrue("Generated artifacts not found, Method
marshaller should be DocLitWrappedMinimumMarshaller", (mm instanceof
DocLitWrappedMinimalMethodMarshaller));
> > > + }catch(Exception e){
> > > + TestLogger.logger.debug("Exception ="+e.getMessage());
> > > + fail(e.getMessage());
> > > + }
> > > +
> > > + }
> > > + /**
> > > + * In this test case user did not package wrapper beans but we
add generated artifacts from cache, we should see use of
> > > + * DocLitWrappedMarshaller.
> > > + * Test method for {@link
org.apache.axis2.jaxws.marshaller.factory.MethodMarshallerFactory#getMarshaller(org.apache.axis2.jaxws.description.OperationDescription,
boolean)}.
> > > + */
> > > + public void testGetMarshallerOperationDescriptionBoolean() {
> > > +
TestLogger.logger.debug("---------------------------------------");
> > > + TestLogger.logger.debug("test: " + getName());
> > > +
> > > + String cache_location = "/target/wscache/classes";
> > > + try{
> > > + String baseDir = new
File(System.getProperty("basedir",".")).getCanonicalPath();
> > > + cache_location = new
File(baseDir+cache_location).getAbsolutePath();
> > > + TestLogger.logger.debug("cache location
="+cache_location);
> > > +
> > > + //Get EndpointDescription.
> > > + //Set location on AxisConfiguraiton.
> > > + Class sei = AddNumbersService.class;
> > > + EndpointDescription description = getEndpointDesc(sei);
> > > + TestLogger.logger.debug("description objects where
created successfully");
> > > + OperationDescription[] ops
=description.getEndpointInterfaceDescription().getOperations();
> > > + assertNotNull( "OperationDescriptions where null",
ops);
> > > + assertTrue("No Operation Descriptions where found",
ops.length>0);
> > > + OperationDescription op = ops[0];
> > > + TestLogger.logger.debug("operation found, java
methodName="+op.getJavaMethodName());
> > > + //Set cache on AxisConfiguration.
> > > + //get Marshaller, verify its not DoclitWrappedMinimum.
> > > +
description.getServiceDescription().getAxisConfigContext().setProperty(Constants.WS_CACHE,
cache_location);
> > > + TestLogger.logger.debug("ws_cache location set on
AxisConfigContext, location="+cache_location);
> > > + MethodMarshaller mm =
MethodMarshallerFactory.getMarshaller(op, false);
> > > + assertNotNull("getMarshaller returned null", mm );
> > > + TestLogger.logger.debug("MethodMarshaller was created,
type="+mm.getClass().getName());
> > > + assertTrue("Generated artifacts are in cache, Method
marshaller should not be DocLitWrappedMinimumMarshaller", !(mm instanceof
DocLitWrappedMinimalMethodMarshaller));
> > > + }catch(Exception e){
> > > + TestLogger.logger.debug("Exception ="+e.getMessage());
> > > + fail(e.getMessage());
> > > + }
> > > +
> > > + }
> > > +
> > > + private EndpointDescription getEndpointDesc(Class
implementationClass) {
> > > + // Use the description factory directly; this will be done
within the JAX-WS runtime
> > > + ServiceDescription serviceDesc =
> > > +
DescriptionFactory.createServiceDescription(implementationClass);
> > > + assertNotNull(serviceDesc);
> > > +
> > > + EndpointDescription[] endpointDesc =
serviceDesc.getEndpointDescriptions();
> > > + assertNotNull(endpointDesc);
> > > + assertEquals(1, endpointDesc.length);
> > > +
> > > + // TODO: How will the JAX-WS dispatcher get the appropriate
port (i.e. endpoint)? Currently assumes [0]
> > > + EndpointDescription testEndpointDesc = endpointDesc[0];
> > > + return testEndpointDesc;
> > > + }
> > > +}
> > >
> > > Added: axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml
> > > URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml?rev=963508&view=auto
> > >
==============================================================================
> > > --- axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml (added)
> > > +++ axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml Mon Jul
12 22:16:54 2010
> > > @@ -0,0 +1,34 @@
> > > +<?xml version="1.0" encoding="UTF-8"?>
> > > +
> > > +<project basedir="." default="run-wsgen-tests" name="wsgen-tests">
> > > +
> > > + <property name="wscache.output.base.dir"
value="target/wscache" />
> > > + <property name="wscache.generated.src.dir"
value="${wscache.output.base.dir}/src" />
> > > + <property name="wscache.generated.classes.dir"
value="${wscache.output.base.dir}/classes" />
> > > + <property name="compile.test.classes"
value="target/test-classes" />
> > > +
> > > +
> > > + <target name="run-wsgen-tests" depends="wrapper-beans"/>
> > > +
> > > +
> > > + <target name="create-cache">
> > > + <mkdir dir="${wscache.output.base.dir}" />
> > > + <mkdir dir="${wscache.generated.src.dir}" />
> > > + <mkdir dir="${wscache.generated.classes.dir}" />
> > > + </target>
> > > +
> > > + <target name="wrapper-beans" depends="create-cache">
> > > + <echo>Generating artifacts for
org.apache.axis2.jaxws.wrapper.beans.AddNumbersService </echo>
> > > + <wsgen
> > > +
sei="org.apache.axis2.jaxws.wrapper.beans.AddNumbersService"
> > > + destdir="${wscache.generated.classes.dir}"
> > > + resourcedestdir="${wscache.generated.src.dir}"
> > > + keep="false"
> > > + verbose="false"
> > > + genwsdl="true">
> > > + <classpath>
> > > + <pathelement path="${compile.test.classes}" />
> > > + </classpath>
> > > + </wsgen>
> > > + </target>
> > > +</project>
> > > \ No newline at end of file
> > >
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
> > For additional commands, e-mail: java-dev-help@axis.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-dev-help@axis.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org
Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws:
./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/
test/org/apache/axis2/jaxws/wrapper/ test/org/apache/axis2/jaxws/wrapper/beans/
Posted by Andreas Veithen <an...@gmail.com>.
On Wed, Jul 14, 2010 at 22:38, Jarek Gawor <jg...@gmail.com> wrote:
> Just a couple of thoughts:
>
> 1) Since you already have wsgen-tests.xml ant script to run the wsgen
> you could setup the appropriate classpath to the tools.jar or
> classes.jar or whatever in it. You just might need to fork the ant
> process.
>
> 2) I don't think it's that horrible to commit some generate code
> especially if there isn't too much of it and the test case is
> important. Besides, Axis2 already has some generated code checked it.
It is extremely annoying to have generated code in Subversion when for
some reason you need to modify it. In general when that happens,
nobody is able to tell you how the code was generated initially.
Anyway, in this particular case, there are enough options that don't
make it necessary to include the generated stuff in Subversion.
> Jarek
>
> On Wed, Jul 14, 2010 at 4:00 PM, Nikhil V Thaker
> <ni...@us.ibm.com> wrote:
>>
>> Yes Andreas,
>> I am running antrun plugin as the wsGen plugin has errors and is not fully matured, here's the URL that explains the issue I ran into http://jira.codehaus.org/browse/MNG-3586.
>>
>> So since I cannot run wsGen or cannot include generated artifacts I will just remove the test case. I will commit the changes soon.
>>
>> Regards,
>>
>> Nikhil Thaker
>> office: 919 254 9964
>> nvthaker@us.ibm.com
>>
>>
>> Andreas Veithen <an...@gmail.com>
>>
>> 07/14/2010 02:48 PM
>>
>> Please respond to
>> java-dev@axis.apache.org
>> To
>> java-dev@axis.apache.org
>> cc
>> Subject
>> Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws: ./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ test/org/apache/axis2/jaxws/wrapper/ test/org/apache/axis2/jaxws/wrapper/beans/
>>
>>
>>
>>
>> No, you are using the antrun plugin to execute the wsgen ant task.
>> What I meant was to use a real Maven plugin (either the one from
>> java.net or the one from CXF).
>>
>> -1 to commit any generated stuff into SVN.
>>
>> Andreas
>>
>> On Wed, Jul 14, 2010 at 21:42, Nikhil V Thaker
>> <ni...@us.ibm.com> wrote:
>> >
>> > Andreas - I had to add the tools.jar bit because maven plugin for wsGen gave NoClassDef Found errors for classes packaged in tools.jar.
>> >
>> > Since this is causing a problem I will just package the generated artifacts and remove the wsGen dependency.
>> >
>> > Thanks,
>> >
>> > Nikhil Thaker
>> > office: 919 254 9964
>> > nvthaker@us.ibm.com
>> >
>> >
>> > Andreas Veithen <an...@gmail.com>
>> >
>> > 07/14/2010 01:44 PM
>> >
>> > Please respond to
>> > java-dev@axis.apache.org
>> > To
>> > java-dev@axis.apache.org
>> > cc
>> > Subject
>> > Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws: ./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ test/org/apache/axis2/jaxws/wrapper/ test/org/apache/axis2/jaxws/wrapper/beans/
>> >
>> >
>> >
>> >
>> > Nikhil,
>> >
>> > I have some issues with the tools and jaxws-tools dependencies
>> > introduced by this change:
>> >
>> > * The change causes a build failure in Hudson. There will also be
>> > additional issues with tools.jar, because the way to declare this as a
>> > system dependency varies from one JDK to another. For example, I
>> > remember that on Mac OS X, it is completely different than on other
>> > JDKs.
>> >
>> > * I don't like the fact that jaxws-tools becomes a dependency of
>> > axis2-jaxws in scope compile, because it looks like this is only
>> > needed during the build and/or during the tests.
>> >
>> > I didn't review the change in detail, but wouldn't it be smarter to
>> > use one of the existing Maven plugins to do the wsgen stuff? They will
>> > take care of the tools.jar stuff as well.
>> >
>> > Andreas
>> >
>> > On Tue, Jul 13, 2010 at 00:16, <nt...@apache.org> wrote:
>> > > Author: nthaker
>> > > Date: Mon Jul 12 22:16:54 2010
>> > > New Revision: 963508
>> > >
>> > > URL: http://svn.apache.org/viewvc?rev=963508&view=rev
>> > > Log:
>> > > AXIS2-4775
>> > > This change ensures that we will use Request and Response wrapper Bean packaged by customer or we will Generate Wrappers if they are not packaged.
>> > >
>> > > Added:
>> > > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/
>> > > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/
>> > > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
>> > > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
>> > > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
>> > > axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml
>> > > Modified:
>> > > axis/axis2/java/core/trunk/modules/jaxws/pom.xml
>> > > axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
>> > >
>> > > Modified: axis/axis2/java/core/trunk/modules/jaxws/pom.xml
>> > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/pom.xml?rev=963508&r1=963507&r2=963508&view=diff
>> > > ==============================================================================
>> > > --- axis/axis2/java/core/trunk/modules/jaxws/pom.xml (original)
>> > > +++ axis/axis2/java/core/trunk/modules/jaxws/pom.xml Mon Jul 12 22:16:54 2010
>> > > @@ -1,5 +1,4 @@
>> > > <?xml version="1.0" encoding="UTF-8"?>
>> > > -
>> > > <!-- > ~ Licensed to the Apache Software Foundation (ASF) under one
>> > > ~ or more contributor license agreements. See the NOTICE file
>> > > @@ -20,7 +19,7 @@
>> > > -->
>> > >
>> > > <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> > > - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
>> > > + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
>> > > <modelVersion>4.0.0</modelVersion>
>> > > <parent>
>> > > <groupId>org.apache.axis2</groupId>
>> > > @@ -98,7 +97,25 @@
>> > > <version>${version}</version>
>> > > <scope>test</scope>
>> > > </dependency>
>> > > + <dependency>
>> > > + <groupId>wsdl4j</groupId>
>> > > + <artifactId>wsdl4j</artifactId>
>> > > + </dependency>
>> > > + <dependency>
>> > > + <groupId>com.sun.xml.ws</groupId>
>> > > + <artifactId>jaxws-tools</artifactId>
>> > > + <version>2.1.3</version>
>> > > + </dependency>
>> > > + <!-- If we dont include tools.jar as dependency, maven throws NoClassDefFound on wsGen run -->
>> > > + <dependency>
>> > > + <groupId>java</groupId>
>> > > + <artifactId>tools</artifactId>
>> > > + <version>$version</version>
>> > > + <scope>system</scope>
>> > > + <systemPath>${JAVA_HOME}/lib/tools.jar</systemPath>
>> > > + </dependency>
>> > > </dependencies>
>> > > +
>> > > <build>
>> > > <sourceDirectory>src</sourceDirectory>
>> > > <testSourceDirectory>test</testSourceDirectory>
>> > > @@ -203,34 +220,39 @@
>> > > <compilerVersion>1.5</compilerVersion>
>> > > <source>1.5</source>
>> > > <target>1.5</target>
>> > > +
>> > > </configuration>
>> > > </plugin>
>> > > <plugin>
>> > > <groupId>org.apache.maven.plugins</groupId>
>> > > <artifactId>maven-antrun-plugin</artifactId>
>> > > +
>> > > <executions>
>> > > <execution>
>> > > <id>gen-ts</id>
>> > > <phase>generate-test-sources</phase>
>> > > <configuration>
>> > > - <tasks unless="maven.test.skip">
>> > > + <tasks unless="maven.test.skip">
>> > > <!-- Theres got to be a better way to do this -->
>> > > <property name="schema.source.dir" value="test-resources/xsd"/>
>> > > <property name="wsdl.source.dir" value="test-resources/wsdl"/>
>> > > - <property name="schema.output.base.dir" value="target/schema"/>
>> > > + <property name="schema.output.base.dir" value="target/schema"/>
>> > > <property name="schema.generated.src.dir" value="${schema.output.base.dir}/src"/>
>> > > <property name="schema.generated.classes.dir"
>> > > value="${schema.output.base.dir}/classes"/>
>> > > +
>> > > <!-- make the dirs -->
>> > > <mkdir dir="${schema.output.base.dir}"/>
>> > > <mkdir dir="${schema.generated.src.dir}"/>
>> > > <mkdir dir="${schema.generated.classes.dir}"/>
>> > > +
>> > > <!-- Run JAXB schema compiler with designated schemas -->
>> > > <echo>Generating JAX-B classes from XSDs</echo>
>> > >
>> > > <echo>Generating java from echo.xsd</echo>
>> > > <java classname="com.sun.tools.xjc.Driver" fork="true">
>> > > <classpath refid="maven.runtime.classpath"/>
>> > > +
>> > > <classpath location="${compiled.classes.dir}"/>
>> > > <arg line="-d ${schema.generated.src.dir} -quiet ${schema.source.dir}/echo.xsd"/>
>> > > </java>
>> > > @@ -266,7 +288,7 @@
>> > > <classpath refid="maven.runtime.classpath"/>
>> > > <classpath location="${compiled.classes.dir}"/>
>> > > <arg line="-d ${schema.generated.src.dir} -quiet -wsdl ${wsdl.source.dir}/AddNumbers.wsdl"/>
>> > > - </java>
>> > > + </java>
>> > > </tasks>
>> > > </configuration>
>> > > <goals>
>> > > @@ -287,6 +309,22 @@
>> > > <property name="addressing_version" value="${version}"/>
>> > > <ant antfile="build.xml" inheritall="true" inheritrefs="true"
>> > > dir="." target="build-repo"/>
>> > > +
>> > > + <property name="compile_classpath" refid="maven.compile.classpath" />
>> > > + <property name="runtime_classpath" refid="maven.runtime.classpath" />
>> > > + <property name="test_classpath" refid="maven.test.classpath" />
>> > > + <property name="plugin_classpath" refid="maven.plugin.classpath" />
>> > > +
>> > > + <!-- Defining wsGen task -->
>> > > + <taskdef name="wsgen" loaderRef="refwsgen" classname="com.sun.tools.ws.ant.WsGen">
>> > > + <classpath>
>> > > + <path refid="maven.runtime.classpath" />
>> > > + <path refid="maven.compile.classpath" />
>> > > + </classpath>
>> > > + </taskdef>
>> > > + <!-- Invoking test cases that need to generate artifacts using wsGen -->
>> > > + <ant antfile="wsgen-tests.xml" inheritall="true" inheritrefs="true"
>> > > + dir="." target="run-wsgen-tests"/>
>> > > </tasks>
>> > > </configuration>
>> > > <goals>
>> > > @@ -374,6 +412,13 @@
>> > > <plugin>
>> > > <groupId>org.apache.maven.plugins</groupId>
>> > > <artifactId>maven-surefire-report-plugin</artifactId>
>> > > + <reportSets>
>> > > + <reportSet>
>> > > + <reports>
>> > > + <report>report-only</report>
>> > > + </reports>
>> > > + </reportSet>
>> > > + </reportSets>
>> > > </plugin>
>> > > </plugins>
>> > > </reporting>
>> > >
>> > > Modified: axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
>> > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java?rev=963508&r1=963507&r2=963508&view=diff
>> > > ==============================================================================
>> > > --- axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java (original)
>> > > +++ axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java Mon Jul 12 22:16:54 2010
>> > > @@ -238,12 +238,27 @@ class ArtifactProcessor {
>> > > wrapperClass = newValue;
>> > > }
>> > > }
>> > > - if(cls==null && (type.equals("@WebFault")|| type.equals("faultInfo"))){
>> > > +
>> > > + if(cls==null &&
>> > > + (type.equals("@RequestWrapper")|| type.equals("@ResponseWrapper")||type.equals("@WebFault")|| type.equals("faultInfo"))){
>> > > +
>> > > + //Support for Fault Bean Generation
>> > > //As per JAX-WS 2.2 Specification section 3.7 an application programmer can choose not to
>> > > //package the faultBeans, if we have reached this point in the code then user has choosen
>> > > //not to package the fault bean. If there is a cache of generated artifacts available then
>> > > //lets look for the missing faultBean there.
>> > > -
>> > > +
>> > > + //Support for Wrapper Bean Generation
>> > > + //As per JAX-WS 2.2 Specificaiton section 3.6.2.1 pg 41 an application programmer does not use
>> > > + //the wrapper bean classes, so the application need not package these classes. If we have reached
>> > > + //this point in the code then user has choosen not to package these beans.
>> > > +
>> > > + //NOTE:If we find Generated artifacts from cache this guarantees that we will not use
>> > > + //DocLitWrappedMinimum marshaller code. The advantage of normal DocLitWrappedMarshaller is
>> > > + //that it is very robust and has support of lot more datatypes than in DocLitWrappedMinimum.
>> > > + if(log.isDebugEnabled()){
>> > > + log.debug("Adding cache to classpath");
>> > > + }
>> > > ClassFinderFactory cff =
>> > > (ClassFinderFactory)FactoryRegistry.getFactory(ClassFinderFactory.class);
>> > > ClassFinder cf = cff.getClassFinder();
>> > > @@ -317,11 +332,26 @@ class ArtifactProcessor {
>> > > if (cls2 == null) {
>> > > cls2 = loadClassOrNull(defaultValue, altClassLoader);
>> > > }
>> > > - if(cls2==null && (type.equals("faultInfo")|| type.equals("@WebFault"))){
>> > > - //As per JAX-WS 2.2 Specification section 3.7 an application programmer can choose not to
>> > > - //package the faultBeans, if we have reached this point in the code then user has choosen
>> > > - //not to package the fault bean. If there is a cache of generated artifacts available then
>> > > - //lets look for the missing faultBean there.
>> > > + if(cls2==null &&
>> > > + (type.equals("@RequestWrapper")|| type.equals("@ResponseWrapper")||type.equals("@WebFault")|| type.equals("faultInfo"))){
>> > > +
>> > > + //Support for Fault Bean Generation
>> > > + //As per JAX-WS 2.2 Specification section 3.7 an application programmer can choose not to
>> > > + //package the faultBeans, if we have reached this point in the code then user has choosen
>> > > + //not to package the fault bean. If there is a cache of generated artifacts available then
>> > > + //lets look for the missing faultBean there.
>> > > +
>> > > + //Support for Wrapper Bean Generation
>> > > + //As per JAX-WS 2.2 Specificaiton section 3.6.2.1 pg 41 an application programmer does not use
>> > > + //the wrapper bean classes, so the application need not package these classes. If we have reached
>> > > + //this point in the code then user has choosen not to package these beans.
>> > > +
>> > > + //NOTE:If we find Generated artifacts from cache this guarantees that we will not use
>> > > + //DocLitWrappedMinimum marshaller code. The advantage of normal DocLitWrappedMarshaller is
>> > > + //that it is very robust and has support of lot more datatypes than in DocLitWrappedMinimum.
>> > > + if(log.isDebugEnabled()){
>> > > + log.debug("Adding cache to classpath");
>> > > + }
>> > > if(log.isDebugEnabled()){
>> > > log.debug("Adding cache to classpath");
>> > > }
>> > >
>> > > Added: axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
>> > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java?rev=963508&view=auto
>> > > ==============================================================================
>> > > --- axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java (added)
>> > > +++ axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java Mon Jul 12 22:16:54 2010
>> > > @@ -0,0 +1,18 @@
>> > > +
>> > > +package org.apache.axis2.jaxws.wrapper.beans;
>> > > +
>> > > +import javax.xml.ws.WebFault;
>> > > +
>> > > +@WebFault(name = "AddNumbersFault", targetNamespace = "http://org/test/addnumbers")
>> > > +public class AddNumbersException extends Exception
>> > > +{
>> > > +
>> > > + private String message = null;
>> > > + public AddNumbersException(){}
>> > > + public AddNumbersException(String message){
>> > > + this.message = message;
>> > > + }
>> > > + public String getInfo(){
>> > > + return message;
>> > > + }
>> > > +}
>> > >
>> > > Added: axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
>> > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java?rev=963508&view=auto
>> > > ==============================================================================
>> > > --- axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java (added)
>> > > +++ axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java Mon Jul 12 22:16:54 2010
>> > > @@ -0,0 +1,15 @@
>> > > +package org.apache.axis2.jaxws.wrapper.beans;
>> > > +
>> > > +
>> > > +
>> > > +@javax.jws.WebService (targetNamespace="http://org/test/addnumbers", serviceName="AddNumbersService", portName="AddNumbersPort")
>> > > +public class AddNumbersService{
>> > > +
>> > > + public int addNumbers(int arg0, int arg1) throws AddNumbersException {
>> > > + if(arg0+arg1<0){
>> > > + throw new AddNumbersException("sum is less than 0");
>> > > + }
>> > > + return arg0+arg1;
>> > > + }
>> > > +
>> > > +}
>> > > \ No newline at end of file
>> > >
>> > > Added: axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
>> > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java?rev=963508&view=auto
>> > > ==============================================================================
>> > > --- axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java (added)
>> > > +++ axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java Mon Jul 12 22:16:54 2010
>> > > @@ -0,0 +1,114 @@
>> > > +/**
>> > > + *
>> > > + */
>> > > +package org.apache.axis2.jaxws.wrapper.beans;
>> > > +
>> > > +
>> > > +import org.apache.axis2.jaxws.Constants;
>> > > +import org.apache.axis2.jaxws.description.DescriptionFactory;
>> > > +import org.apache.axis2.jaxws.description.EndpointDescription;
>> > > +import org.apache.axis2.jaxws.description.EndpointDescriptionJava;
>> > > +import org.apache.axis2.jaxws.description.OperationDescription;
>> > > +import org.apache.axis2.jaxws.description.ServiceDescription;
>> > > +import org.apache.axis2.jaxws.marshaller.MethodMarshaller;
>> > > +import org.apache.axis2.jaxws.marshaller.factory.MethodMarshallerFactory;
>> > > +import org.apache.axis2.jaxws.marshaller.impl.alt.DocLitWrappedMinimalMethodMarshaller;
>> > > +import org.apache.axis2.jaxws.unitTest.TestLogger;
>> > > +
>> > > +import java.io.File;
>> > > +
>> > > +import junit.framework.TestCase;
>> > > +
>> > > +public class WrapperBeanMarshallTests extends TestCase {
>> > > + /**
>> > > + * This is the negative test case, when we do not use generated artifacts from cache
>> > > + * and user did not package wrapper beans, we should see use of DocLitWrappedMinumumMarshaller.
>> > > + */
>> > > + public void testGetMarshallerOperationDescriptionBooleanNegative() {
>> > > + TestLogger.logger.debug("---------------------------------------");
>> > > + TestLogger.logger.debug("test: " + getName());
>> > > +
>> > > + String cache_location = "/target/wscache/classes";
>> > > + try{
>> > > + String baseDir = new File(System.getProperty("basedir",".")).getCanonicalPath();
>> > > + cache_location = new File(baseDir+cache_location).getAbsolutePath();
>> > > + TestLogger.logger.debug("cache location ="+cache_location);
>> > > +
>> > > + //Get EndpointDescription.
>> > > + //Set location on AxisConfiguraiton.
>> > > + Class sei = AddNumbersService.class;
>> > > + EndpointDescription description = getEndpointDesc(sei);
>> > > + TestLogger.logger.debug("description objects where created successfully");
>> > > + OperationDescription[] ops =description.getEndpointInterfaceDescription().getOperations();
>> > > + assertNotNull( "OperationDescriptions where null", ops);
>> > > + assertTrue("No Operation Descriptions where found", ops.length>0);
>> > > + OperationDescription op = ops[0];
>> > > + TestLogger.logger.debug("operation found, java methodName="+op.getJavaMethodName());
>> > > + //Don not Set cache on AxisConfiguration.
>> > > + //get Marshaller, verify its not DoclitWrappedMinimum.
>> > > + TestLogger.logger.debug("ws_cache location NOT set on AxisConfigContext, location="+cache_location);
>> > > + MethodMarshaller mm = MethodMarshallerFactory.getMarshaller(op, false);
>> > > + assertNotNull("getMarshaller returned null", mm );
>> > > + TestLogger.logger.debug("MethodMarshaller was created, type="+mm.getClass().getName());
>> > > + assertTrue("Generated artifacts not found, Method marshaller should be DocLitWrappedMinimumMarshaller", (mm instanceof DocLitWrappedMinimalMethodMarshaller));
>> > > + }catch(Exception e){
>> > > + TestLogger.logger.debug("Exception ="+e.getMessage());
>> > > + fail(e.getMessage());
>> > > + }
>> > > +
>> > > + }
>> > > + /**
>> > > + * In this test case user did not package wrapper beans but we add generated artifacts from cache, we should see use of
>> > > + * DocLitWrappedMarshaller.
>> > > + * Test method for {@link org.apache.axis2.jaxws.marshaller.factory.MethodMarshallerFactory#getMarshaller(org.apache.axis2.jaxws.description.OperationDescription, boolean)}.
>> > > + */
>> > > + public void testGetMarshallerOperationDescriptionBoolean() {
>> > > + TestLogger.logger.debug("---------------------------------------");
>> > > + TestLogger.logger.debug("test: " + getName());
>> > > +
>> > > + String cache_location = "/target/wscache/classes";
>> > > + try{
>> > > + String baseDir = new File(System.getProperty("basedir",".")).getCanonicalPath();
>> > > + cache_location = new File(baseDir+cache_location).getAbsolutePath();
>> > > + TestLogger.logger.debug("cache location ="+cache_location);
>> > > +
>> > > + //Get EndpointDescription.
>> > > + //Set location on AxisConfiguraiton.
>> > > + Class sei = AddNumbersService.class;
>> > > + EndpointDescription description = getEndpointDesc(sei);
>> > > + TestLogger.logger.debug("description objects where created successfully");
>> > > + OperationDescription[] ops =description.getEndpointInterfaceDescription().getOperations();
>> > > + assertNotNull( "OperationDescriptions where null", ops);
>> > > + assertTrue("No Operation Descriptions where found", ops.length>0);
>> > > + OperationDescription op = ops[0];
>> > > + TestLogger.logger.debug("operation found, java methodName="+op.getJavaMethodName());
>> > > + //Set cache on AxisConfiguration.
>> > > + //get Marshaller, verify its not DoclitWrappedMinimum.
>> > > + description.getServiceDescription().getAxisConfigContext().setProperty(Constants.WS_CACHE, cache_location);
>> > > + TestLogger.logger.debug("ws_cache location set on AxisConfigContext, location="+cache_location);
>> > > + MethodMarshaller mm = MethodMarshallerFactory.getMarshaller(op, false);
>> > > + assertNotNull("getMarshaller returned null", mm );
>> > > + TestLogger.logger.debug("MethodMarshaller was created, type="+mm.getClass().getName());
>> > > + assertTrue("Generated artifacts are in cache, Method marshaller should not be DocLitWrappedMinimumMarshaller", !(mm instanceof DocLitWrappedMinimalMethodMarshaller));
>> > > + }catch(Exception e){
>> > > + TestLogger.logger.debug("Exception ="+e.getMessage());
>> > > + fail(e.getMessage());
>> > > + }
>> > > +
>> > > + }
>> > > +
>> > > + private EndpointDescription getEndpointDesc(Class implementationClass) {
>> > > + // Use the description factory directly; this will be done within the JAX-WS runtime
>> > > + ServiceDescription serviceDesc =
>> > > + DescriptionFactory.createServiceDescription(implementationClass);
>> > > + assertNotNull(serviceDesc);
>> > > +
>> > > + EndpointDescription[] endpointDesc = serviceDesc.getEndpointDescriptions();
>> > > + assertNotNull(endpointDesc);
>> > > + assertEquals(1, endpointDesc.length);
>> > > +
>> > > + // TODO: How will the JAX-WS dispatcher get the appropriate port (i.e. endpoint)? Currently assumes [0]
>> > > + EndpointDescription testEndpointDesc = endpointDesc[0];
>> > > + return testEndpointDesc;
>> > > + }
>> > > +}
>> > >
>> > > Added: axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml
>> > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml?rev=963508&view=auto
>> > > ==============================================================================
>> > > --- axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml (added)
>> > > +++ axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml Mon Jul 12 22:16:54 2010
>> > > @@ -0,0 +1,34 @@
>> > > +<?xml version="1.0" encoding="UTF-8"?>
>> > > +
>> > > +<project basedir="." default="run-wsgen-tests" name="wsgen-tests">
>> > > +
>> > > + <property name="wscache.output.base.dir" value="target/wscache" />
>> > > + <property name="wscache.generated.src.dir" value="${wscache.output.base.dir}/src" />
>> > > + <property name="wscache.generated.classes.dir" value="${wscache.output.base.dir}/classes" />
>> > > + <property name="compile.test.classes" value="target/test-classes" />
>> > > +
>> > > +
>> > > + <target name="run-wsgen-tests" depends="wrapper-beans"/>
>> > > +
>> > > +
>> > > + <target name="create-cache">
>> > > + <mkdir dir="${wscache.output.base.dir}" />
>> > > + <mkdir dir="${wscache.generated.src.dir}" />
>> > > + <mkdir dir="${wscache.generated.classes.dir}" />
>> > > + </target>
>> > > +
>> > > + <target name="wrapper-beans" depends="create-cache">
>> > > + <echo>Generating artifacts for org.apache.axis2.jaxws.wrapper.beans.AddNumbersService </echo>
>> > > + <wsgen
>> > > + sei="org.apache.axis2.jaxws.wrapper.beans.AddNumbersService"
>> > > + destdir="${wscache.generated.classes.dir}"
>> > > + resourcedestdir="${wscache.generated.src.dir}"
>> > > + keep="false"
>> > > + verbose="false"
>> > > + genwsdl="true">
>> > > + <classpath>
>> > > + <pathelement path="${compile.test.classes}" />
>> > > + </classpath>
>> > > + </wsgen>
>> > > + </target>
>> > > +</project>
>> > > \ No newline at end of file
>> > >
>> > >
>> > >
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
>> > For additional commands, e-mail: java-dev-help@axis.apache.org
>> >
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
>> For additional commands, e-mail: java-dev-help@axis.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-dev-help@axis.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org
Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws:
./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/
test/org/apache/axis2/jaxws/wrapper/ test/org/apache/axis2/jaxws/wrapper/beans/
Posted by Andreas Veithen <an...@gmail.com>.
On Wed, Jul 14, 2010 at 22:38, Jarek Gawor <jg...@gmail.com> wrote:
> Just a couple of thoughts:
>
> 1) Since you already have wsgen-tests.xml ant script to run the wsgen
> you could setup the appropriate classpath to the tools.jar or
> classes.jar or whatever in it. You just might need to fork the ant
> process.
>
> 2) I don't think it's that horrible to commit some generate code
> especially if there isn't too much of it and the test case is
> important. Besides, Axis2 already has some generated code checked it.
It is extremely annoying to have generated code in Subversion when for
some reason you need to modify it. In general when that happens,
nobody is able to tell you how the code was generated initially.
Anyway, in this particular case, there are enough options that don't
make it necessary to include the generated stuff in Subversion.
> Jarek
>
> On Wed, Jul 14, 2010 at 4:00 PM, Nikhil V Thaker
> <ni...@us.ibm.com> wrote:
>>
>> Yes Andreas,
>> I am running antrun plugin as the wsGen plugin has errors and is not fully matured, here's the URL that explains the issue I ran into http://jira.codehaus.org/browse/MNG-3586.
>>
>> So since I cannot run wsGen or cannot include generated artifacts I will just remove the test case. I will commit the changes soon.
>>
>> Regards,
>>
>> Nikhil Thaker
>> office: 919 254 9964
>> nvthaker@us.ibm.com
>>
>>
>> Andreas Veithen <an...@gmail.com>
>>
>> 07/14/2010 02:48 PM
>>
>> Please respond to
>> java-dev@axis.apache.org
>> To
>> java-dev@axis.apache.org
>> cc
>> Subject
>> Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws: ./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ test/org/apache/axis2/jaxws/wrapper/ test/org/apache/axis2/jaxws/wrapper/beans/
>>
>>
>>
>>
>> No, you are using the antrun plugin to execute the wsgen ant task.
>> What I meant was to use a real Maven plugin (either the one from
>> java.net or the one from CXF).
>>
>> -1 to commit any generated stuff into SVN.
>>
>> Andreas
>>
>> On Wed, Jul 14, 2010 at 21:42, Nikhil V Thaker
>> <ni...@us.ibm.com> wrote:
>> >
>> > Andreas - I had to add the tools.jar bit because maven plugin for wsGen gave NoClassDef Found errors for classes packaged in tools.jar.
>> >
>> > Since this is causing a problem I will just package the generated artifacts and remove the wsGen dependency.
>> >
>> > Thanks,
>> >
>> > Nikhil Thaker
>> > office: 919 254 9964
>> > nvthaker@us.ibm.com
>> >
>> >
>> > Andreas Veithen <an...@gmail.com>
>> >
>> > 07/14/2010 01:44 PM
>> >
>> > Please respond to
>> > java-dev@axis.apache.org
>> > To
>> > java-dev@axis.apache.org
>> > cc
>> > Subject
>> > Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws: ./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ test/org/apache/axis2/jaxws/wrapper/ test/org/apache/axis2/jaxws/wrapper/beans/
>> >
>> >
>> >
>> >
>> > Nikhil,
>> >
>> > I have some issues with the tools and jaxws-tools dependencies
>> > introduced by this change:
>> >
>> > * The change causes a build failure in Hudson. There will also be
>> > additional issues with tools.jar, because the way to declare this as a
>> > system dependency varies from one JDK to another. For example, I
>> > remember that on Mac OS X, it is completely different than on other
>> > JDKs.
>> >
>> > * I don't like the fact that jaxws-tools becomes a dependency of
>> > axis2-jaxws in scope compile, because it looks like this is only
>> > needed during the build and/or during the tests.
>> >
>> > I didn't review the change in detail, but wouldn't it be smarter to
>> > use one of the existing Maven plugins to do the wsgen stuff? They will
>> > take care of the tools.jar stuff as well.
>> >
>> > Andreas
>> >
>> > On Tue, Jul 13, 2010 at 00:16, <nt...@apache.org> wrote:
>> > > Author: nthaker
>> > > Date: Mon Jul 12 22:16:54 2010
>> > > New Revision: 963508
>> > >
>> > > URL: http://svn.apache.org/viewvc?rev=963508&view=rev
>> > > Log:
>> > > AXIS2-4775
>> > > This change ensures that we will use Request and Response wrapper Bean packaged by customer or we will Generate Wrappers if they are not packaged.
>> > >
>> > > Added:
>> > > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/
>> > > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/
>> > > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
>> > > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
>> > > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
>> > > axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml
>> > > Modified:
>> > > axis/axis2/java/core/trunk/modules/jaxws/pom.xml
>> > > axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
>> > >
>> > > Modified: axis/axis2/java/core/trunk/modules/jaxws/pom.xml
>> > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/pom.xml?rev=963508&r1=963507&r2=963508&view=diff
>> > > ==============================================================================
>> > > --- axis/axis2/java/core/trunk/modules/jaxws/pom.xml (original)
>> > > +++ axis/axis2/java/core/trunk/modules/jaxws/pom.xml Mon Jul 12 22:16:54 2010
>> > > @@ -1,5 +1,4 @@
>> > > <?xml version="1.0" encoding="UTF-8"?>
>> > > -
>> > > <!-- > ~ Licensed to the Apache Software Foundation (ASF) under one
>> > > ~ or more contributor license agreements. See the NOTICE file
>> > > @@ -20,7 +19,7 @@
>> > > -->
>> > >
>> > > <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> > > - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
>> > > + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
>> > > <modelVersion>4.0.0</modelVersion>
>> > > <parent>
>> > > <groupId>org.apache.axis2</groupId>
>> > > @@ -98,7 +97,25 @@
>> > > <version>${version}</version>
>> > > <scope>test</scope>
>> > > </dependency>
>> > > + <dependency>
>> > > + <groupId>wsdl4j</groupId>
>> > > + <artifactId>wsdl4j</artifactId>
>> > > + </dependency>
>> > > + <dependency>
>> > > + <groupId>com.sun.xml.ws</groupId>
>> > > + <artifactId>jaxws-tools</artifactId>
>> > > + <version>2.1.3</version>
>> > > + </dependency>
>> > > + <!-- If we dont include tools.jar as dependency, maven throws NoClassDefFound on wsGen run -->
>> > > + <dependency>
>> > > + <groupId>java</groupId>
>> > > + <artifactId>tools</artifactId>
>> > > + <version>$version</version>
>> > > + <scope>system</scope>
>> > > + <systemPath>${JAVA_HOME}/lib/tools.jar</systemPath>
>> > > + </dependency>
>> > > </dependencies>
>> > > +
>> > > <build>
>> > > <sourceDirectory>src</sourceDirectory>
>> > > <testSourceDirectory>test</testSourceDirectory>
>> > > @@ -203,34 +220,39 @@
>> > > <compilerVersion>1.5</compilerVersion>
>> > > <source>1.5</source>
>> > > <target>1.5</target>
>> > > +
>> > > </configuration>
>> > > </plugin>
>> > > <plugin>
>> > > <groupId>org.apache.maven.plugins</groupId>
>> > > <artifactId>maven-antrun-plugin</artifactId>
>> > > +
>> > > <executions>
>> > > <execution>
>> > > <id>gen-ts</id>
>> > > <phase>generate-test-sources</phase>
>> > > <configuration>
>> > > - <tasks unless="maven.test.skip">
>> > > + <tasks unless="maven.test.skip">
>> > > <!-- Theres got to be a better way to do this -->
>> > > <property name="schema.source.dir" value="test-resources/xsd"/>
>> > > <property name="wsdl.source.dir" value="test-resources/wsdl"/>
>> > > - <property name="schema.output.base.dir" value="target/schema"/>
>> > > + <property name="schema.output.base.dir" value="target/schema"/>
>> > > <property name="schema.generated.src.dir" value="${schema.output.base.dir}/src"/>
>> > > <property name="schema.generated.classes.dir"
>> > > value="${schema.output.base.dir}/classes"/>
>> > > +
>> > > <!-- make the dirs -->
>> > > <mkdir dir="${schema.output.base.dir}"/>
>> > > <mkdir dir="${schema.generated.src.dir}"/>
>> > > <mkdir dir="${schema.generated.classes.dir}"/>
>> > > +
>> > > <!-- Run JAXB schema compiler with designated schemas -->
>> > > <echo>Generating JAX-B classes from XSDs</echo>
>> > >
>> > > <echo>Generating java from echo.xsd</echo>
>> > > <java classname="com.sun.tools.xjc.Driver" fork="true">
>> > > <classpath refid="maven.runtime.classpath"/>
>> > > +
>> > > <classpath location="${compiled.classes.dir}"/>
>> > > <arg line="-d ${schema.generated.src.dir} -quiet ${schema.source.dir}/echo.xsd"/>
>> > > </java>
>> > > @@ -266,7 +288,7 @@
>> > > <classpath refid="maven.runtime.classpath"/>
>> > > <classpath location="${compiled.classes.dir}"/>
>> > > <arg line="-d ${schema.generated.src.dir} -quiet -wsdl ${wsdl.source.dir}/AddNumbers.wsdl"/>
>> > > - </java>
>> > > + </java>
>> > > </tasks>
>> > > </configuration>
>> > > <goals>
>> > > @@ -287,6 +309,22 @@
>> > > <property name="addressing_version" value="${version}"/>
>> > > <ant antfile="build.xml" inheritall="true" inheritrefs="true"
>> > > dir="." target="build-repo"/>
>> > > +
>> > > + <property name="compile_classpath" refid="maven.compile.classpath" />
>> > > + <property name="runtime_classpath" refid="maven.runtime.classpath" />
>> > > + <property name="test_classpath" refid="maven.test.classpath" />
>> > > + <property name="plugin_classpath" refid="maven.plugin.classpath" />
>> > > +
>> > > + <!-- Defining wsGen task -->
>> > > + <taskdef name="wsgen" loaderRef="refwsgen" classname="com.sun.tools.ws.ant.WsGen">
>> > > + <classpath>
>> > > + <path refid="maven.runtime.classpath" />
>> > > + <path refid="maven.compile.classpath" />
>> > > + </classpath>
>> > > + </taskdef>
>> > > + <!-- Invoking test cases that need to generate artifacts using wsGen -->
>> > > + <ant antfile="wsgen-tests.xml" inheritall="true" inheritrefs="true"
>> > > + dir="." target="run-wsgen-tests"/>
>> > > </tasks>
>> > > </configuration>
>> > > <goals>
>> > > @@ -374,6 +412,13 @@
>> > > <plugin>
>> > > <groupId>org.apache.maven.plugins</groupId>
>> > > <artifactId>maven-surefire-report-plugin</artifactId>
>> > > + <reportSets>
>> > > + <reportSet>
>> > > + <reports>
>> > > + <report>report-only</report>
>> > > + </reports>
>> > > + </reportSet>
>> > > + </reportSets>
>> > > </plugin>
>> > > </plugins>
>> > > </reporting>
>> > >
>> > > Modified: axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
>> > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java?rev=963508&r1=963507&r2=963508&view=diff
>> > > ==============================================================================
>> > > --- axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java (original)
>> > > +++ axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java Mon Jul 12 22:16:54 2010
>> > > @@ -238,12 +238,27 @@ class ArtifactProcessor {
>> > > wrapperClass = newValue;
>> > > }
>> > > }
>> > > - if(cls==null && (type.equals("@WebFault")|| type.equals("faultInfo"))){
>> > > +
>> > > + if(cls==null &&
>> > > + (type.equals("@RequestWrapper")|| type.equals("@ResponseWrapper")||type.equals("@WebFault")|| type.equals("faultInfo"))){
>> > > +
>> > > + //Support for Fault Bean Generation
>> > > //As per JAX-WS 2.2 Specification section 3.7 an application programmer can choose not to
>> > > //package the faultBeans, if we have reached this point in the code then user has choosen
>> > > //not to package the fault bean. If there is a cache of generated artifacts available then
>> > > //lets look for the missing faultBean there.
>> > > -
>> > > +
>> > > + //Support for Wrapper Bean Generation
>> > > + //As per JAX-WS 2.2 Specificaiton section 3.6.2.1 pg 41 an application programmer does not use
>> > > + //the wrapper bean classes, so the application need not package these classes. If we have reached
>> > > + //this point in the code then user has choosen not to package these beans.
>> > > +
>> > > + //NOTE:If we find Generated artifacts from cache this guarantees that we will not use
>> > > + //DocLitWrappedMinimum marshaller code. The advantage of normal DocLitWrappedMarshaller is
>> > > + //that it is very robust and has support of lot more datatypes than in DocLitWrappedMinimum.
>> > > + if(log.isDebugEnabled()){
>> > > + log.debug("Adding cache to classpath");
>> > > + }
>> > > ClassFinderFactory cff =
>> > > (ClassFinderFactory)FactoryRegistry.getFactory(ClassFinderFactory.class);
>> > > ClassFinder cf = cff.getClassFinder();
>> > > @@ -317,11 +332,26 @@ class ArtifactProcessor {
>> > > if (cls2 == null) {
>> > > cls2 = loadClassOrNull(defaultValue, altClassLoader);
>> > > }
>> > > - if(cls2==null && (type.equals("faultInfo")|| type.equals("@WebFault"))){
>> > > - //As per JAX-WS 2.2 Specification section 3.7 an application programmer can choose not to
>> > > - //package the faultBeans, if we have reached this point in the code then user has choosen
>> > > - //not to package the fault bean. If there is a cache of generated artifacts available then
>> > > - //lets look for the missing faultBean there.
>> > > + if(cls2==null &&
>> > > + (type.equals("@RequestWrapper")|| type.equals("@ResponseWrapper")||type.equals("@WebFault")|| type.equals("faultInfo"))){
>> > > +
>> > > + //Support for Fault Bean Generation
>> > > + //As per JAX-WS 2.2 Specification section 3.7 an application programmer can choose not to
>> > > + //package the faultBeans, if we have reached this point in the code then user has choosen
>> > > + //not to package the fault bean. If there is a cache of generated artifacts available then
>> > > + //lets look for the missing faultBean there.
>> > > +
>> > > + //Support for Wrapper Bean Generation
>> > > + //As per JAX-WS 2.2 Specificaiton section 3.6.2.1 pg 41 an application programmer does not use
>> > > + //the wrapper bean classes, so the application need not package these classes. If we have reached
>> > > + //this point in the code then user has choosen not to package these beans.
>> > > +
>> > > + //NOTE:If we find Generated artifacts from cache this guarantees that we will not use
>> > > + //DocLitWrappedMinimum marshaller code. The advantage of normal DocLitWrappedMarshaller is
>> > > + //that it is very robust and has support of lot more datatypes than in DocLitWrappedMinimum.
>> > > + if(log.isDebugEnabled()){
>> > > + log.debug("Adding cache to classpath");
>> > > + }
>> > > if(log.isDebugEnabled()){
>> > > log.debug("Adding cache to classpath");
>> > > }
>> > >
>> > > Added: axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
>> > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java?rev=963508&view=auto
>> > > ==============================================================================
>> > > --- axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java (added)
>> > > +++ axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java Mon Jul 12 22:16:54 2010
>> > > @@ -0,0 +1,18 @@
>> > > +
>> > > +package org.apache.axis2.jaxws.wrapper.beans;
>> > > +
>> > > +import javax.xml.ws.WebFault;
>> > > +
>> > > +@WebFault(name = "AddNumbersFault", targetNamespace = "http://org/test/addnumbers")
>> > > +public class AddNumbersException extends Exception
>> > > +{
>> > > +
>> > > + private String message = null;
>> > > + public AddNumbersException(){}
>> > > + public AddNumbersException(String message){
>> > > + this.message = message;
>> > > + }
>> > > + public String getInfo(){
>> > > + return message;
>> > > + }
>> > > +}
>> > >
>> > > Added: axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
>> > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java?rev=963508&view=auto
>> > > ==============================================================================
>> > > --- axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java (added)
>> > > +++ axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java Mon Jul 12 22:16:54 2010
>> > > @@ -0,0 +1,15 @@
>> > > +package org.apache.axis2.jaxws.wrapper.beans;
>> > > +
>> > > +
>> > > +
>> > > +@javax.jws.WebService (targetNamespace="http://org/test/addnumbers", serviceName="AddNumbersService", portName="AddNumbersPort")
>> > > +public class AddNumbersService{
>> > > +
>> > > + public int addNumbers(int arg0, int arg1) throws AddNumbersException {
>> > > + if(arg0+arg1<0){
>> > > + throw new AddNumbersException("sum is less than 0");
>> > > + }
>> > > + return arg0+arg1;
>> > > + }
>> > > +
>> > > +}
>> > > \ No newline at end of file
>> > >
>> > > Added: axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
>> > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java?rev=963508&view=auto
>> > > ==============================================================================
>> > > --- axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java (added)
>> > > +++ axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java Mon Jul 12 22:16:54 2010
>> > > @@ -0,0 +1,114 @@
>> > > +/**
>> > > + *
>> > > + */
>> > > +package org.apache.axis2.jaxws.wrapper.beans;
>> > > +
>> > > +
>> > > +import org.apache.axis2.jaxws.Constants;
>> > > +import org.apache.axis2.jaxws.description.DescriptionFactory;
>> > > +import org.apache.axis2.jaxws.description.EndpointDescription;
>> > > +import org.apache.axis2.jaxws.description.EndpointDescriptionJava;
>> > > +import org.apache.axis2.jaxws.description.OperationDescription;
>> > > +import org.apache.axis2.jaxws.description.ServiceDescription;
>> > > +import org.apache.axis2.jaxws.marshaller.MethodMarshaller;
>> > > +import org.apache.axis2.jaxws.marshaller.factory.MethodMarshallerFactory;
>> > > +import org.apache.axis2.jaxws.marshaller.impl.alt.DocLitWrappedMinimalMethodMarshaller;
>> > > +import org.apache.axis2.jaxws.unitTest.TestLogger;
>> > > +
>> > > +import java.io.File;
>> > > +
>> > > +import junit.framework.TestCase;
>> > > +
>> > > +public class WrapperBeanMarshallTests extends TestCase {
>> > > + /**
>> > > + * This is the negative test case, when we do not use generated artifacts from cache
>> > > + * and user did not package wrapper beans, we should see use of DocLitWrappedMinumumMarshaller.
>> > > + */
>> > > + public void testGetMarshallerOperationDescriptionBooleanNegative() {
>> > > + TestLogger.logger.debug("---------------------------------------");
>> > > + TestLogger.logger.debug("test: " + getName());
>> > > +
>> > > + String cache_location = "/target/wscache/classes";
>> > > + try{
>> > > + String baseDir = new File(System.getProperty("basedir",".")).getCanonicalPath();
>> > > + cache_location = new File(baseDir+cache_location).getAbsolutePath();
>> > > + TestLogger.logger.debug("cache location ="+cache_location);
>> > > +
>> > > + //Get EndpointDescription.
>> > > + //Set location on AxisConfiguraiton.
>> > > + Class sei = AddNumbersService.class;
>> > > + EndpointDescription description = getEndpointDesc(sei);
>> > > + TestLogger.logger.debug("description objects where created successfully");
>> > > + OperationDescription[] ops =description.getEndpointInterfaceDescription().getOperations();
>> > > + assertNotNull( "OperationDescriptions where null", ops);
>> > > + assertTrue("No Operation Descriptions where found", ops.length>0);
>> > > + OperationDescription op = ops[0];
>> > > + TestLogger.logger.debug("operation found, java methodName="+op.getJavaMethodName());
>> > > + //Don not Set cache on AxisConfiguration.
>> > > + //get Marshaller, verify its not DoclitWrappedMinimum.
>> > > + TestLogger.logger.debug("ws_cache location NOT set on AxisConfigContext, location="+cache_location);
>> > > + MethodMarshaller mm = MethodMarshallerFactory.getMarshaller(op, false);
>> > > + assertNotNull("getMarshaller returned null", mm );
>> > > + TestLogger.logger.debug("MethodMarshaller was created, type="+mm.getClass().getName());
>> > > + assertTrue("Generated artifacts not found, Method marshaller should be DocLitWrappedMinimumMarshaller", (mm instanceof DocLitWrappedMinimalMethodMarshaller));
>> > > + }catch(Exception e){
>> > > + TestLogger.logger.debug("Exception ="+e.getMessage());
>> > > + fail(e.getMessage());
>> > > + }
>> > > +
>> > > + }
>> > > + /**
>> > > + * In this test case user did not package wrapper beans but we add generated artifacts from cache, we should see use of
>> > > + * DocLitWrappedMarshaller.
>> > > + * Test method for {@link org.apache.axis2.jaxws.marshaller.factory.MethodMarshallerFactory#getMarshaller(org.apache.axis2.jaxws.description.OperationDescription, boolean)}.
>> > > + */
>> > > + public void testGetMarshallerOperationDescriptionBoolean() {
>> > > + TestLogger.logger.debug("---------------------------------------");
>> > > + TestLogger.logger.debug("test: " + getName());
>> > > +
>> > > + String cache_location = "/target/wscache/classes";
>> > > + try{
>> > > + String baseDir = new File(System.getProperty("basedir",".")).getCanonicalPath();
>> > > + cache_location = new File(baseDir+cache_location).getAbsolutePath();
>> > > + TestLogger.logger.debug("cache location ="+cache_location);
>> > > +
>> > > + //Get EndpointDescription.
>> > > + //Set location on AxisConfiguraiton.
>> > > + Class sei = AddNumbersService.class;
>> > > + EndpointDescription description = getEndpointDesc(sei);
>> > > + TestLogger.logger.debug("description objects where created successfully");
>> > > + OperationDescription[] ops =description.getEndpointInterfaceDescription().getOperations();
>> > > + assertNotNull( "OperationDescriptions where null", ops);
>> > > + assertTrue("No Operation Descriptions where found", ops.length>0);
>> > > + OperationDescription op = ops[0];
>> > > + TestLogger.logger.debug("operation found, java methodName="+op.getJavaMethodName());
>> > > + //Set cache on AxisConfiguration.
>> > > + //get Marshaller, verify its not DoclitWrappedMinimum.
>> > > + description.getServiceDescription().getAxisConfigContext().setProperty(Constants.WS_CACHE, cache_location);
>> > > + TestLogger.logger.debug("ws_cache location set on AxisConfigContext, location="+cache_location);
>> > > + MethodMarshaller mm = MethodMarshallerFactory.getMarshaller(op, false);
>> > > + assertNotNull("getMarshaller returned null", mm );
>> > > + TestLogger.logger.debug("MethodMarshaller was created, type="+mm.getClass().getName());
>> > > + assertTrue("Generated artifacts are in cache, Method marshaller should not be DocLitWrappedMinimumMarshaller", !(mm instanceof DocLitWrappedMinimalMethodMarshaller));
>> > > + }catch(Exception e){
>> > > + TestLogger.logger.debug("Exception ="+e.getMessage());
>> > > + fail(e.getMessage());
>> > > + }
>> > > +
>> > > + }
>> > > +
>> > > + private EndpointDescription getEndpointDesc(Class implementationClass) {
>> > > + // Use the description factory directly; this will be done within the JAX-WS runtime
>> > > + ServiceDescription serviceDesc =
>> > > + DescriptionFactory.createServiceDescription(implementationClass);
>> > > + assertNotNull(serviceDesc);
>> > > +
>> > > + EndpointDescription[] endpointDesc = serviceDesc.getEndpointDescriptions();
>> > > + assertNotNull(endpointDesc);
>> > > + assertEquals(1, endpointDesc.length);
>> > > +
>> > > + // TODO: How will the JAX-WS dispatcher get the appropriate port (i.e. endpoint)? Currently assumes [0]
>> > > + EndpointDescription testEndpointDesc = endpointDesc[0];
>> > > + return testEndpointDesc;
>> > > + }
>> > > +}
>> > >
>> > > Added: axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml
>> > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml?rev=963508&view=auto
>> > > ==============================================================================
>> > > --- axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml (added)
>> > > +++ axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml Mon Jul 12 22:16:54 2010
>> > > @@ -0,0 +1,34 @@
>> > > +<?xml version="1.0" encoding="UTF-8"?>
>> > > +
>> > > +<project basedir="." default="run-wsgen-tests" name="wsgen-tests">
>> > > +
>> > > + <property name="wscache.output.base.dir" value="target/wscache" />
>> > > + <property name="wscache.generated.src.dir" value="${wscache.output.base.dir}/src" />
>> > > + <property name="wscache.generated.classes.dir" value="${wscache.output.base.dir}/classes" />
>> > > + <property name="compile.test.classes" value="target/test-classes" />
>> > > +
>> > > +
>> > > + <target name="run-wsgen-tests" depends="wrapper-beans"/>
>> > > +
>> > > +
>> > > + <target name="create-cache">
>> > > + <mkdir dir="${wscache.output.base.dir}" />
>> > > + <mkdir dir="${wscache.generated.src.dir}" />
>> > > + <mkdir dir="${wscache.generated.classes.dir}" />
>> > > + </target>
>> > > +
>> > > + <target name="wrapper-beans" depends="create-cache">
>> > > + <echo>Generating artifacts for org.apache.axis2.jaxws.wrapper.beans.AddNumbersService </echo>
>> > > + <wsgen
>> > > + sei="org.apache.axis2.jaxws.wrapper.beans.AddNumbersService"
>> > > + destdir="${wscache.generated.classes.dir}"
>> > > + resourcedestdir="${wscache.generated.src.dir}"
>> > > + keep="false"
>> > > + verbose="false"
>> > > + genwsdl="true">
>> > > + <classpath>
>> > > + <pathelement path="${compile.test.classes}" />
>> > > + </classpath>
>> > > + </wsgen>
>> > > + </target>
>> > > +</project>
>> > > \ No newline at end of file
>> > >
>> > >
>> > >
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
>> > For additional commands, e-mail: java-dev-help@axis.apache.org
>> >
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
>> For additional commands, e-mail: java-dev-help@axis.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-dev-help@axis.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org
Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws: ./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/
test/org/apache/axis2/jaxws/wrapper/ test/org/apache/axis2/jaxws/wrapper/beans/
Posted by Nikhil V Thaker <ni...@us.ibm.com>.
Thanks Jarek for the suggestion.
The fact that there is an objection to putting jaxws-tools.jar as a
dependency would mean we cannot run wsGen. Unless I misunderstood Andreas
comments. To me we should always have jaxws-tools as dependency to jaxws
module, after all jaxws tools are prerequisite to jaxws runtime, a user of
jaxws runtime has to run wsGen or wsImport to build webservices
application.
Anyways, I will look and see if there is an alternate way to add these
test cases.
Regards,
Nikhil Thaker
office: 919 254 9964
nvthaker@us.ibm.com
Jarek Gawor <jg...@gmail.com>
07/14/2010 03:38 PM
Please respond to
java-dev@axis.apache.org
To
java-dev@axis.apache.org
cc
Subject
Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws: ./
src/org/apache/axis2/jaxws/runtime/description/marshal/impl/
test/org/apache/axis2/jaxws/wrapper/
test/org/apache/axis2/jaxws/wrapper/beans/
Just a couple of thoughts:
1) Since you already have wsgen-tests.xml ant script to run the wsgen
you could setup the appropriate classpath to the tools.jar or
classes.jar or whatever in it. You just might need to fork the ant
process.
2) I don't think it's that horrible to commit some generate code
especially if there isn't too much of it and the test case is
important. Besides, Axis2 already has some generated code checked it.
Jarek
On Wed, Jul 14, 2010 at 4:00 PM, Nikhil V Thaker
<ni...@us.ibm.com> wrote:
>
> Yes Andreas,
> I am running antrun plugin as the wsGen plugin has errors and is not
fully matured, here's the URL that explains the issue I ran into
http://jira.codehaus.org/browse/MNG-3586.
>
> So since I cannot run wsGen or cannot include generated artifacts I will
just remove the test case. I will commit the changes soon.
>
> Regards,
>
> Nikhil Thaker
> office: 919 254 9964
> nvthaker@us.ibm.com
>
>
> Andreas Veithen <an...@gmail.com>
>
> 07/14/2010 02:48 PM
>
> Please respond to
> java-dev@axis.apache.org
> To
> java-dev@axis.apache.org
> cc
> Subject
> Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws:
./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/
test/org/apache/axis2/jaxws/wrapper/
test/org/apache/axis2/jaxws/wrapper/beans/
>
>
>
>
> No, you are using the antrun plugin to execute the wsgen ant task.
> What I meant was to use a real Maven plugin (either the one from
> java.net or the one from CXF).
>
> -1 to commit any generated stuff into SVN.
>
> Andreas
>
> On Wed, Jul 14, 2010 at 21:42, Nikhil V Thaker
> <ni...@us.ibm.com> wrote:
> >
> > Andreas - I had to add the tools.jar bit because maven plugin for
wsGen gave NoClassDef Found errors for classes packaged in tools.jar.
> >
> > Since this is causing a problem I will just package the generated
artifacts and remove the wsGen dependency.
> >
> > Thanks,
> >
> > Nikhil Thaker
> > office: 919 254 9964
> > nvthaker@us.ibm.com
> >
> >
> > Andreas Veithen <an...@gmail.com>
> >
> > 07/14/2010 01:44 PM
> >
> > Please respond to
> > java-dev@axis.apache.org
> > To
> > java-dev@axis.apache.org
> > cc
> > Subject
> > Re: svn commit: r963508 - in
/axis/axis2/java/core/trunk/modules/jaxws: ./
src/org/apache/axis2/jaxws/runtime/description/marshal/impl/
test/org/apache/axis2/jaxws/wrapper/
test/org/apache/axis2/jaxws/wrapper/beans/
> >
> >
> >
> >
> > Nikhil,
> >
> > I have some issues with the tools and jaxws-tools dependencies
> > introduced by this change:
> >
> > * The change causes a build failure in Hudson. There will also be
> > additional issues with tools.jar, because the way to declare this as a
> > system dependency varies from one JDK to another. For example, I
> > remember that on Mac OS X, it is completely different than on other
> > JDKs.
> >
> > * I don't like the fact that jaxws-tools becomes a dependency of
> > axis2-jaxws in scope compile, because it looks like this is only
> > needed during the build and/or during the tests.
> >
> > I didn't review the change in detail, but wouldn't it be smarter to
> > use one of the existing Maven plugins to do the wsgen stuff? They will
> > take care of the tools.jar stuff as well.
> >
> > Andreas
> >
> > On Tue, Jul 13, 2010 at 00:16, <nt...@apache.org> wrote:
> > > Author: nthaker
> > > Date: Mon Jul 12 22:16:54 2010
> > > New Revision: 963508
> > >
> > > URL: http://svn.apache.org/viewvc?rev=963508&view=rev
> > > Log:
> > > AXIS2-4775
> > > This change ensures that we will use Request and Response wrapper
Bean packaged by customer or we will Generate Wrappers if they are not
packaged.
> > >
> > > Added:
> > >
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/
> > >
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/
> > >
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
> > >
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
> > >
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
> > > axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml
> > > Modified:
> > > axis/axis2/java/core/trunk/modules/jaxws/pom.xml
> > >
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
> > >
> > > Modified: axis/axis2/java/core/trunk/modules/jaxws/pom.xml
> > > URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/pom.xml?rev=963508&r1=963507&r2=963508&view=diff
> > >
==============================================================================
> > > --- axis/axis2/java/core/trunk/modules/jaxws/pom.xml (original)
> > > +++ axis/axis2/java/core/trunk/modules/jaxws/pom.xml Mon Jul 12
22:16:54 2010
> > > @@ -1,5 +1,4 @@
> > > <?xml version="1.0" encoding="UTF-8"?>
> > > -
> > > <!-- > ~ Licensed to the Apache Software Foundation (ASF) under
one
> > > ~ or more contributor license agreements. See the NOTICE file
> > > @@ -20,7 +19,7 @@
> > > -->
> > >
> > > <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"
> > > - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
> > > + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
> > > <modelVersion>4.0.0</modelVersion>
> > > <parent>
> > > <groupId>org.apache.axis2</groupId>
> > > @@ -98,7 +97,25 @@
> > > <version>${version}</version>
> > > <scope>test</scope>
> > > </dependency>
> > > + <dependency>
> > > + <groupId>wsdl4j</groupId>
> > > + <artifactId>wsdl4j</artifactId>
> > > + </dependency>
> > > + <dependency>
> > > + <groupId>com.sun.xml.ws</groupId>
> > > + <artifactId>jaxws-tools</artifactId>
> > > + <version>2.1.3</version>
> > > + </dependency>
> > > + <!-- If we dont include tools.jar as dependency, maven
throws NoClassDefFound on wsGen run -->
> > > + <dependency>
> > > + <groupId>java</groupId>
> > > + <artifactId>tools</artifactId>
> > > + <version>$version</version>
> > > + <scope>system</scope>
> > > + <systemPath>${JAVA_HOME}/lib/tools.jar</systemPath>
> > > + </dependency>
> > > </dependencies>
> > > +
> > > <build>
> > > <sourceDirectory>src</sourceDirectory>
> > > <testSourceDirectory>test</testSourceDirectory>
> > > @@ -203,34 +220,39 @@
> > > <compilerVersion>1.5</compilerVersion>
> > > <source>1.5</source>
> > > <target>1.5</target>
> > > +
> > > </configuration>
> > > </plugin>
> > > <plugin>
> > > <groupId>org.apache.maven.plugins</groupId>
> > > <artifactId>maven-antrun-plugin</artifactId>
> > > +
> > > <executions>
> > > <execution>
> > > <id>gen-ts</id>
> > > <phase>generate-test-sources</phase>
> > > <configuration>
> > > - <tasks unless="maven.test.skip">
> > > + <tasks unless="maven.test.skip">
> > > <!-- Theres got to be a better way
to do this -->
> > > <property name="schema.source.dir"
value="test-resources/xsd"/>
> > > <property name="wsdl.source.dir"
value="test-resources/wsdl"/>
> > > - <property
name="schema.output.base.dir" value="target/schema"/>
> > > + <property
name="schema.output.base.dir" value="target/schema"/>
> > > <property
name="schema.generated.src.dir" value="${schema.output.base.dir}/src"/>
> > > <property
name="schema.generated.classes.dir"
> > >
value="${schema.output.base.dir}/classes"/>
> > > +
> > > <!-- make the dirs -->
> > > <mkdir
dir="${schema.output.base.dir}"/>
> > > <mkdir
dir="${schema.generated.src.dir}"/>
> > > <mkdir
dir="${schema.generated.classes.dir}"/>
> > > +
> > > <!-- Run JAXB schema compiler with
designated schemas -->
> > > <echo>Generating JAX-B classes from
XSDs</echo>
> > >
> > > <echo>Generating java from
echo.xsd</echo>
> > > <java
classname="com.sun.tools.xjc.Driver" fork="true">
> > > <classpath
refid="maven.runtime.classpath"/>
> > > +
> > > <classpath
location="${compiled.classes.dir}"/>
> > > <arg line="-d
${schema.generated.src.dir} -quiet ${schema.source.dir}/echo.xsd"/>
> > > </java>
> > > @@ -266,7 +288,7 @@
> > > <classpath
refid="maven.runtime.classpath"/>
> > > <classpath
location="${compiled.classes.dir}"/>
> > > <arg line="-d
${schema.generated.src.dir} -quiet -wsdl
${wsdl.source.dir}/AddNumbers.wsdl"/>
> > > - </java>
> > > + </java>
> > > </tasks>
> > > </configuration>
> > > <goals>
> > > @@ -287,6 +309,22 @@
> > > <property name="addressing_version"
value="${version}"/>
> > > <ant antfile="build.xml"
inheritall="true" inheritrefs="true"
> > > dir="." target="build-repo"/>
> > > +
> > > +
<property name="compile_classpath" refid="maven.compile.classpath" />
> > > +
<property name="runtime_classpath" refid="maven.runtime.classpath" />
> > > +
<property name="test_classpath" refid="maven.test.classpath" />
> > > +
<property name="plugin_classpath" refid="maven.plugin.classpath" />
> > > +
> > > + <!-- Defining wsGen task -->
> > > +
<taskdef name="wsgen" loaderRef="refwsgen"
classname="com.sun.tools.ws.ant.WsGen">
> > > +
<classpath>
> > > +
<path refid="maven.runtime.classpath" />
> > > +
<path refid="maven.compile.classpath" />
> > > +
</classpath>
> > > +
</taskdef>
> > > + <!--
Invoking test cases that need to generate artifacts using wsGen -->
> > > + <ant antfile="wsgen-tests.xml"
inheritall="true" inheritrefs="true"
> > > + dir="."
target="run-wsgen-tests"/>
> > > </tasks>
> > > </configuration>
> > > <goals>
> > > @@ -374,6 +412,13 @@
> > > <plugin>
> > > <groupId>org.apache.maven.plugins</groupId>
> > >
<artifactId>maven-surefire-report-plugin</artifactId>
> > > + <reportSets>
> > > + <reportSet>
> > > + <reports>
> > > + <report>report-only</report>
> > > + </reports>
> > > + </reportSet>
> > > + </reportSets>
> > > </plugin>
> > > </plugins>
> > > </reporting>
> > >
> > > Modified:
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
> > > URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java?rev=963508&r1=963507&r2=963508&view=diff
> > >
==============================================================================
> > > ---
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
(original)
> > > +++
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
Mon Jul 12 22:16:54 2010
> > > @@ -238,12 +238,27 @@ class ArtifactProcessor {
> > > wrapperClass = newValue;
> > > }
> > > }
> > > - if(cls==null && (type.equals("@WebFault")||
type.equals("faultInfo"))){
> > > +
> > > + if(cls==null &&
> > > + (type.equals("@RequestWrapper")||
type.equals("@ResponseWrapper")||type.equals("@WebFault")||
type.equals("faultInfo"))){
> > > +
> > > + //Support for Fault Bean Generation
> > > //As per JAX-WS 2.2 Specification
section 3.7 an application programmer can choose not to
> > > //package the faultBeans, if we have
reached this point in the code then user has choosen
> > > //not to package the fault bean. If
there is a cache of generated artifacts available then
> > > //lets look for the missing faultBean
there.
> > > -
> > > +
> > > + //Support for Wrapper Bean Generation
> > > + //As per JAX-WS 2.2 Specificaiton
section 3.6.2.1 pg 41 an application programmer does not use
> > > + //the wrapper bean classes, so the
application need not package these classes. If we have reached
> > > + //this point in the code then user has
choosen not to package these beans.
> > > +
> > > + //NOTE:If we find Generated artifacts
from cache this guarantees that we will not use
> > > + //DocLitWrappedMinimum marshaller code.
The advantage of normal DocLitWrappedMarshaller is
> > > + //that it is very robust and has
support of lot more datatypes than in DocLitWrappedMinimum.
> > > + if(log.isDebugEnabled()){
> > > + log.debug("Adding cache to
classpath");
> > > + }
> > > ClassFinderFactory cff =
> > >
(ClassFinderFactory)FactoryRegistry.getFactory(ClassFinderFactory.class);
> > > ClassFinder cf = cff.getClassFinder();
> > > @@ -317,11 +332,26 @@ class ArtifactProcessor {
> > > if (cls2 == null) {
> > > cls2 = loadClassOrNull(defaultValue,
altClassLoader);
> > > }
> > > - if(cls2==null &&
(type.equals("faultInfo")|| type.equals("@WebFault"))){
> > > - //As per JAX-WS 2.2 Specification
section 3.7 an application programmer can choose not to
> > > - //package the faultBeans, if we have
reached this point in the code then user has choosen
> > > - //not to package the fault bean. If
there is a cache of generated artifacts available then
> > > - //lets look for the missing faultBean
there.
> > > + if(cls2==null &&
> > > +
(type.equals("@RequestWrapper")||
type.equals("@ResponseWrapper")||type.equals("@WebFault")||
type.equals("faultInfo"))){
> > > +
> > > + //Support for Fault Bean Generation
> > > + //As per JAX-WS 2.2 Specification
section 3.7 an application programmer can choose not to
> > > + //package the faultBeans, if we have
reached this point in the code then user has choosen
> > > + //not to package the fault bean. If
there is a cache of generated artifacts available then
> > > + //lets look for the missing
faultBean there.
> > > +
> > > + //Support for Wrapper Bean
Generation
> > > + //As per JAX-WS 2.2 Specificaiton
section 3.6.2.1 pg 41 an application programmer does not use
> > > + //the wrapper bean classes, so the
application need not package these classes. If we have reached
> > > + //this point in the code then user
has choosen not to package these beans.
> > > +
> > > + //NOTE:If we find Generated
artifacts from cache this guarantees that we will not use
> > > + //DocLitWrappedMinimum marshaller
code. The advantage of normal DocLitWrappedMarshaller is
> > > + //that it is very robust and has
support of lot more datatypes than in DocLitWrappedMinimum.
> > > + if(log.isDebugEnabled()){
> > > + log.debug("Adding cache to
classpath");
> > > + }
> > > if(log.isDebugEnabled()){
> > > log.debug("Adding cache to
classpath");
> > > }
> > >
> > > Added:
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
> > > URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java?rev=963508&view=auto
> > >
==============================================================================
> > > ---
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
(added)
> > > +++
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
Mon Jul 12 22:16:54 2010
> > > @@ -0,0 +1,18 @@
> > > +
> > > +package org.apache.axis2.jaxws.wrapper.beans;
> > > +
> > > +import javax.xml.ws.WebFault;
> > > +
> > > +@WebFault(name = "AddNumbersFault", targetNamespace = "
http://org/test/addnumbers")
> > > +public class AddNumbersException extends Exception
> > > +{
> > > +
> > > + private String message = null;
> > > + public AddNumbersException(){}
> > > + public AddNumbersException(String message){
> > > + this.message = message;
> > > + }
> > > + public String getInfo(){
> > > + return message;
> > > + }
> > > +}
> > >
> > > Added:
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
> > > URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java?rev=963508&view=auto
> > >
==============================================================================
> > > ---
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
(added)
> > > +++
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
Mon Jul 12 22:16:54 2010
> > > @@ -0,0 +1,15 @@
> > > +package org.apache.axis2.jaxws.wrapper.beans;
> > > +
> > > +
> > > +
> > > +@javax.jws.WebService (targetNamespace="http://org/test/addnumbers
", serviceName="AddNumbersService", portName="AddNumbersPort")
> > > +public class AddNumbersService{
> > > +
> > > + public int addNumbers(int arg0, int arg1) throws
AddNumbersException {
> > > + if(arg0+arg1<0){
> > > + throw new AddNumbersException("sum is less
than 0");
> > > + }
> > > + return arg0+arg1;
> > > + }
> > > +
> > > +}
> > > \ No newline at end of file
> > >
> > > Added:
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
> > > URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java?rev=963508&view=auto
> > >
==============================================================================
> > > ---
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
(added)
> > > +++
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
Mon Jul 12 22:16:54 2010
> > > @@ -0,0 +1,114 @@
> > > +/**
> > > + *
> > > + */
> > > +package org.apache.axis2.jaxws.wrapper.beans;
> > > +
> > > +
> > > +import org.apache.axis2.jaxws.Constants;
> > > +import org.apache.axis2.jaxws.description.DescriptionFactory;
> > > +import org.apache.axis2.jaxws.description.EndpointDescription;
> > > +import org.apache.axis2.jaxws.description.EndpointDescriptionJava;
> > > +import org.apache.axis2.jaxws.description.OperationDescription;
> > > +import org.apache.axis2.jaxws.description.ServiceDescription;
> > > +import org.apache.axis2.jaxws.marshaller.MethodMarshaller;
> > > +import
org.apache.axis2.jaxws.marshaller.factory.MethodMarshallerFactory;
> > > +import
org.apache.axis2.jaxws.marshaller.impl.alt.DocLitWrappedMinimalMethodMarshaller;
> > > +import org.apache.axis2.jaxws.unitTest.TestLogger;
> > > +
> > > +import java.io.File;
> > > +
> > > +import junit.framework.TestCase;
> > > +
> > > +public class WrapperBeanMarshallTests extends TestCase {
> > > + /**
> > > + * This is the negative test case, when we do not use generated
artifacts from cache
> > > + * and user did not package wrapper beans, we should see use of
DocLitWrappedMinumumMarshaller.
> > > + */
> > > + public void
testGetMarshallerOperationDescriptionBooleanNegative() {
> > > +
TestLogger.logger.debug("---------------------------------------");
> > > + TestLogger.logger.debug("test: " + getName());
> > > +
> > > + String cache_location = "/target/wscache/classes";
> > > + try{
> > > + String baseDir = new
File(System.getProperty("basedir",".")).getCanonicalPath();
> > > + cache_location = new
File(baseDir+cache_location).getAbsolutePath();
> > > + TestLogger.logger.debug("cache location
="+cache_location);
> > > +
> > > + //Get EndpointDescription.
> > > + //Set location on AxisConfiguraiton.
> > > + Class sei = AddNumbersService.class;
> > > + EndpointDescription description = getEndpointDesc(sei);
> > > + TestLogger.logger.debug("description objects where
created successfully");
> > > + OperationDescription[] ops
=description.getEndpointInterfaceDescription().getOperations();
> > > + assertNotNull( "OperationDescriptions where null",
ops);
> > > + assertTrue("No Operation Descriptions where found",
ops.length>0);
> > > + OperationDescription op = ops[0];
> > > + TestLogger.logger.debug("operation found, java
methodName="+op.getJavaMethodName());
> > > + //Don not Set cache on AxisConfiguration.
> > > + //get Marshaller, verify its not DoclitWrappedMinimum.
> > > + TestLogger.logger.debug("ws_cache location NOT set on
AxisConfigContext, location="+cache_location);
> > > + MethodMarshaller mm =
MethodMarshallerFactory.getMarshaller(op, false);
> > > + assertNotNull("getMarshaller returned null", mm );
> > > + TestLogger.logger.debug("MethodMarshaller was created,
type="+mm.getClass().getName());
> > > + assertTrue("Generated artifacts not found, Method
marshaller should be DocLitWrappedMinimumMarshaller", (mm instanceof
DocLitWrappedMinimalMethodMarshaller));
> > > + }catch(Exception e){
> > > + TestLogger.logger.debug("Exception ="+e.getMessage());
> > > + fail(e.getMessage());
> > > + }
> > > +
> > > + }
> > > + /**
> > > + * In this test case user did not package wrapper beans but we
add generated artifacts from cache, we should see use of
> > > + * DocLitWrappedMarshaller.
> > > + * Test method for {@link
org.apache.axis2.jaxws.marshaller.factory.MethodMarshallerFactory#getMarshaller(org.apache.axis2.jaxws.description.OperationDescription,
boolean)}.
> > > + */
> > > + public void testGetMarshallerOperationDescriptionBoolean() {
> > > +
TestLogger.logger.debug("---------------------------------------");
> > > + TestLogger.logger.debug("test: " + getName());
> > > +
> > > + String cache_location = "/target/wscache/classes";
> > > + try{
> > > + String baseDir = new
File(System.getProperty("basedir",".")).getCanonicalPath();
> > > + cache_location = new
File(baseDir+cache_location).getAbsolutePath();
> > > + TestLogger.logger.debug("cache location
="+cache_location);
> > > +
> > > + //Get EndpointDescription.
> > > + //Set location on AxisConfiguraiton.
> > > + Class sei = AddNumbersService.class;
> > > + EndpointDescription description = getEndpointDesc(sei);
> > > + TestLogger.logger.debug("description objects where
created successfully");
> > > + OperationDescription[] ops
=description.getEndpointInterfaceDescription().getOperations();
> > > + assertNotNull( "OperationDescriptions where null",
ops);
> > > + assertTrue("No Operation Descriptions where found",
ops.length>0);
> > > + OperationDescription op = ops[0];
> > > + TestLogger.logger.debug("operation found, java
methodName="+op.getJavaMethodName());
> > > + //Set cache on AxisConfiguration.
> > > + //get Marshaller, verify its not DoclitWrappedMinimum.
> > > +
description.getServiceDescription().getAxisConfigContext().setProperty(Constants.WS_CACHE,
cache_location);
> > > + TestLogger.logger.debug("ws_cache location set on
AxisConfigContext, location="+cache_location);
> > > + MethodMarshaller mm =
MethodMarshallerFactory.getMarshaller(op, false);
> > > + assertNotNull("getMarshaller returned null", mm );
> > > + TestLogger.logger.debug("MethodMarshaller was created,
type="+mm.getClass().getName());
> > > + assertTrue("Generated artifacts are in cache, Method
marshaller should not be DocLitWrappedMinimumMarshaller", !(mm instanceof
DocLitWrappedMinimalMethodMarshaller));
> > > + }catch(Exception e){
> > > + TestLogger.logger.debug("Exception ="+e.getMessage());
> > > + fail(e.getMessage());
> > > + }
> > > +
> > > + }
> > > +
> > > + private EndpointDescription getEndpointDesc(Class
implementationClass) {
> > > + // Use the description factory directly; this will be done
within the JAX-WS runtime
> > > + ServiceDescription serviceDesc =
> > > +
DescriptionFactory.createServiceDescription(implementationClass);
> > > + assertNotNull(serviceDesc);
> > > +
> > > + EndpointDescription[] endpointDesc =
serviceDesc.getEndpointDescriptions();
> > > + assertNotNull(endpointDesc);
> > > + assertEquals(1, endpointDesc.length);
> > > +
> > > + // TODO: How will the JAX-WS dispatcher get the appropriate
port (i.e. endpoint)? Currently assumes [0]
> > > + EndpointDescription testEndpointDesc = endpointDesc[0];
> > > + return testEndpointDesc;
> > > + }
> > > +}
> > >
> > > Added: axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml
> > > URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml?rev=963508&view=auto
> > >
==============================================================================
> > > --- axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml (added)
> > > +++ axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml Mon Jul
12 22:16:54 2010
> > > @@ -0,0 +1,34 @@
> > > +<?xml version="1.0" encoding="UTF-8"?>
> > > +
> > > +<project basedir="." default="run-wsgen-tests" name="wsgen-tests">
> > > +
> > > + <property name="wscache.output.base.dir"
value="target/wscache" />
> > > + <property name="wscache.generated.src.dir"
value="${wscache.output.base.dir}/src" />
> > > + <property name="wscache.generated.classes.dir"
value="${wscache.output.base.dir}/classes" />
> > > + <property name="compile.test.classes"
value="target/test-classes" />
> > > +
> > > +
> > > + <target name="run-wsgen-tests" depends="wrapper-beans"/>
> > > +
> > > +
> > > + <target name="create-cache">
> > > + <mkdir dir="${wscache.output.base.dir}" />
> > > + <mkdir dir="${wscache.generated.src.dir}" />
> > > + <mkdir dir="${wscache.generated.classes.dir}" />
> > > + </target>
> > > +
> > > + <target name="wrapper-beans" depends="create-cache">
> > > + <echo>Generating artifacts for
org.apache.axis2.jaxws.wrapper.beans.AddNumbersService </echo>
> > > + <wsgen
> > > +
sei="org.apache.axis2.jaxws.wrapper.beans.AddNumbersService"
> > > + destdir="${wscache.generated.classes.dir}"
> > > + resourcedestdir="${wscache.generated.src.dir}"
> > > + keep="false"
> > > + verbose="false"
> > > + genwsdl="true">
> > > + <classpath>
> > > + <pathelement path="${compile.test.classes}" />
> > > + </classpath>
> > > + </wsgen>
> > > + </target>
> > > +</project>
> > > \ No newline at end of file
> > >
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
> > For additional commands, e-mail: java-dev-help@axis.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-dev-help@axis.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org
Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws:
./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/
test/org/apache/axis2/jaxws/wrapper/ test/org/apache/axis2/jaxws/wrapper/beans/
Posted by Andreas Veithen <an...@gmail.com>.
On Wed, Jul 14, 2010 at 22:38, Jarek Gawor <jg...@gmail.com> wrote:
> Just a couple of thoughts:
>
> 1) Since you already have wsgen-tests.xml ant script to run the wsgen
> you could setup the appropriate classpath to the tools.jar or
> classes.jar or whatever in it. You just might need to fork the ant
> process.
>
> 2) I don't think it's that horrible to commit some generate code
> especially if there isn't too much of it and the test case is
> important. Besides, Axis2 already has some generated code checked it.
It is extremely annoying to have generated code in Subversion when for
some reason you need to modify it. In general when that happens,
nobody is able to tell you how the code was generated initially.
Anyway, in this particular case, there are enough options that don't
make it necessary to include the generated stuff in Subversion.
> Jarek
>
> On Wed, Jul 14, 2010 at 4:00 PM, Nikhil V Thaker
> <ni...@us.ibm.com> wrote:
>>
>> Yes Andreas,
>> I am running antrun plugin as the wsGen plugin has errors and is not fully matured, here's the URL that explains the issue I ran into http://jira.codehaus.org/browse/MNG-3586.
>>
>> So since I cannot run wsGen or cannot include generated artifacts I will just remove the test case. I will commit the changes soon.
>>
>> Regards,
>>
>> Nikhil Thaker
>> office: 919 254 9964
>> nvthaker@us.ibm.com
>>
>>
>> Andreas Veithen <an...@gmail.com>
>>
>> 07/14/2010 02:48 PM
>>
>> Please respond to
>> java-dev@axis.apache.org
>> To
>> java-dev@axis.apache.org
>> cc
>> Subject
>> Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws: ./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ test/org/apache/axis2/jaxws/wrapper/ test/org/apache/axis2/jaxws/wrapper/beans/
>>
>>
>>
>>
>> No, you are using the antrun plugin to execute the wsgen ant task.
>> What I meant was to use a real Maven plugin (either the one from
>> java.net or the one from CXF).
>>
>> -1 to commit any generated stuff into SVN.
>>
>> Andreas
>>
>> On Wed, Jul 14, 2010 at 21:42, Nikhil V Thaker
>> <ni...@us.ibm.com> wrote:
>> >
>> > Andreas - I had to add the tools.jar bit because maven plugin for wsGen gave NoClassDef Found errors for classes packaged in tools.jar.
>> >
>> > Since this is causing a problem I will just package the generated artifacts and remove the wsGen dependency.
>> >
>> > Thanks,
>> >
>> > Nikhil Thaker
>> > office: 919 254 9964
>> > nvthaker@us.ibm.com
>> >
>> >
>> > Andreas Veithen <an...@gmail.com>
>> >
>> > 07/14/2010 01:44 PM
>> >
>> > Please respond to
>> > java-dev@axis.apache.org
>> > To
>> > java-dev@axis.apache.org
>> > cc
>> > Subject
>> > Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws: ./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ test/org/apache/axis2/jaxws/wrapper/ test/org/apache/axis2/jaxws/wrapper/beans/
>> >
>> >
>> >
>> >
>> > Nikhil,
>> >
>> > I have some issues with the tools and jaxws-tools dependencies
>> > introduced by this change:
>> >
>> > * The change causes a build failure in Hudson. There will also be
>> > additional issues with tools.jar, because the way to declare this as a
>> > system dependency varies from one JDK to another. For example, I
>> > remember that on Mac OS X, it is completely different than on other
>> > JDKs.
>> >
>> > * I don't like the fact that jaxws-tools becomes a dependency of
>> > axis2-jaxws in scope compile, because it looks like this is only
>> > needed during the build and/or during the tests.
>> >
>> > I didn't review the change in detail, but wouldn't it be smarter to
>> > use one of the existing Maven plugins to do the wsgen stuff? They will
>> > take care of the tools.jar stuff as well.
>> >
>> > Andreas
>> >
>> > On Tue, Jul 13, 2010 at 00:16, <nt...@apache.org> wrote:
>> > > Author: nthaker
>> > > Date: Mon Jul 12 22:16:54 2010
>> > > New Revision: 963508
>> > >
>> > > URL: http://svn.apache.org/viewvc?rev=963508&view=rev
>> > > Log:
>> > > AXIS2-4775
>> > > This change ensures that we will use Request and Response wrapper Bean packaged by customer or we will Generate Wrappers if they are not packaged.
>> > >
>> > > Added:
>> > > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/
>> > > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/
>> > > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
>> > > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
>> > > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
>> > > axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml
>> > > Modified:
>> > > axis/axis2/java/core/trunk/modules/jaxws/pom.xml
>> > > axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
>> > >
>> > > Modified: axis/axis2/java/core/trunk/modules/jaxws/pom.xml
>> > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/pom.xml?rev=963508&r1=963507&r2=963508&view=diff
>> > > ==============================================================================
>> > > --- axis/axis2/java/core/trunk/modules/jaxws/pom.xml (original)
>> > > +++ axis/axis2/java/core/trunk/modules/jaxws/pom.xml Mon Jul 12 22:16:54 2010
>> > > @@ -1,5 +1,4 @@
>> > > <?xml version="1.0" encoding="UTF-8"?>
>> > > -
>> > > <!-- > ~ Licensed to the Apache Software Foundation (ASF) under one
>> > > ~ or more contributor license agreements. See the NOTICE file
>> > > @@ -20,7 +19,7 @@
>> > > -->
>> > >
>> > > <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> > > - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
>> > > + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
>> > > <modelVersion>4.0.0</modelVersion>
>> > > <parent>
>> > > <groupId>org.apache.axis2</groupId>
>> > > @@ -98,7 +97,25 @@
>> > > <version>${version}</version>
>> > > <scope>test</scope>
>> > > </dependency>
>> > > + <dependency>
>> > > + <groupId>wsdl4j</groupId>
>> > > + <artifactId>wsdl4j</artifactId>
>> > > + </dependency>
>> > > + <dependency>
>> > > + <groupId>com.sun.xml.ws</groupId>
>> > > + <artifactId>jaxws-tools</artifactId>
>> > > + <version>2.1.3</version>
>> > > + </dependency>
>> > > + <!-- If we dont include tools.jar as dependency, maven throws NoClassDefFound on wsGen run -->
>> > > + <dependency>
>> > > + <groupId>java</groupId>
>> > > + <artifactId>tools</artifactId>
>> > > + <version>$version</version>
>> > > + <scope>system</scope>
>> > > + <systemPath>${JAVA_HOME}/lib/tools.jar</systemPath>
>> > > + </dependency>
>> > > </dependencies>
>> > > +
>> > > <build>
>> > > <sourceDirectory>src</sourceDirectory>
>> > > <testSourceDirectory>test</testSourceDirectory>
>> > > @@ -203,34 +220,39 @@
>> > > <compilerVersion>1.5</compilerVersion>
>> > > <source>1.5</source>
>> > > <target>1.5</target>
>> > > +
>> > > </configuration>
>> > > </plugin>
>> > > <plugin>
>> > > <groupId>org.apache.maven.plugins</groupId>
>> > > <artifactId>maven-antrun-plugin</artifactId>
>> > > +
>> > > <executions>
>> > > <execution>
>> > > <id>gen-ts</id>
>> > > <phase>generate-test-sources</phase>
>> > > <configuration>
>> > > - <tasks unless="maven.test.skip">
>> > > + <tasks unless="maven.test.skip">
>> > > <!-- Theres got to be a better way to do this -->
>> > > <property name="schema.source.dir" value="test-resources/xsd"/>
>> > > <property name="wsdl.source.dir" value="test-resources/wsdl"/>
>> > > - <property name="schema.output.base.dir" value="target/schema"/>
>> > > + <property name="schema.output.base.dir" value="target/schema"/>
>> > > <property name="schema.generated.src.dir" value="${schema.output.base.dir}/src"/>
>> > > <property name="schema.generated.classes.dir"
>> > > value="${schema.output.base.dir}/classes"/>
>> > > +
>> > > <!-- make the dirs -->
>> > > <mkdir dir="${schema.output.base.dir}"/>
>> > > <mkdir dir="${schema.generated.src.dir}"/>
>> > > <mkdir dir="${schema.generated.classes.dir}"/>
>> > > +
>> > > <!-- Run JAXB schema compiler with designated schemas -->
>> > > <echo>Generating JAX-B classes from XSDs</echo>
>> > >
>> > > <echo>Generating java from echo.xsd</echo>
>> > > <java classname="com.sun.tools.xjc.Driver" fork="true">
>> > > <classpath refid="maven.runtime.classpath"/>
>> > > +
>> > > <classpath location="${compiled.classes.dir}"/>
>> > > <arg line="-d ${schema.generated.src.dir} -quiet ${schema.source.dir}/echo.xsd"/>
>> > > </java>
>> > > @@ -266,7 +288,7 @@
>> > > <classpath refid="maven.runtime.classpath"/>
>> > > <classpath location="${compiled.classes.dir}"/>
>> > > <arg line="-d ${schema.generated.src.dir} -quiet -wsdl ${wsdl.source.dir}/AddNumbers.wsdl"/>
>> > > - </java>
>> > > + </java>
>> > > </tasks>
>> > > </configuration>
>> > > <goals>
>> > > @@ -287,6 +309,22 @@
>> > > <property name="addressing_version" value="${version}"/>
>> > > <ant antfile="build.xml" inheritall="true" inheritrefs="true"
>> > > dir="." target="build-repo"/>
>> > > +
>> > > + <property name="compile_classpath" refid="maven.compile.classpath" />
>> > > + <property name="runtime_classpath" refid="maven.runtime.classpath" />
>> > > + <property name="test_classpath" refid="maven.test.classpath" />
>> > > + <property name="plugin_classpath" refid="maven.plugin.classpath" />
>> > > +
>> > > + <!-- Defining wsGen task -->
>> > > + <taskdef name="wsgen" loaderRef="refwsgen" classname="com.sun.tools.ws.ant.WsGen">
>> > > + <classpath>
>> > > + <path refid="maven.runtime.classpath" />
>> > > + <path refid="maven.compile.classpath" />
>> > > + </classpath>
>> > > + </taskdef>
>> > > + <!-- Invoking test cases that need to generate artifacts using wsGen -->
>> > > + <ant antfile="wsgen-tests.xml" inheritall="true" inheritrefs="true"
>> > > + dir="." target="run-wsgen-tests"/>
>> > > </tasks>
>> > > </configuration>
>> > > <goals>
>> > > @@ -374,6 +412,13 @@
>> > > <plugin>
>> > > <groupId>org.apache.maven.plugins</groupId>
>> > > <artifactId>maven-surefire-report-plugin</artifactId>
>> > > + <reportSets>
>> > > + <reportSet>
>> > > + <reports>
>> > > + <report>report-only</report>
>> > > + </reports>
>> > > + </reportSet>
>> > > + </reportSets>
>> > > </plugin>
>> > > </plugins>
>> > > </reporting>
>> > >
>> > > Modified: axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
>> > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java?rev=963508&r1=963507&r2=963508&view=diff
>> > > ==============================================================================
>> > > --- axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java (original)
>> > > +++ axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java Mon Jul 12 22:16:54 2010
>> > > @@ -238,12 +238,27 @@ class ArtifactProcessor {
>> > > wrapperClass = newValue;
>> > > }
>> > > }
>> > > - if(cls==null && (type.equals("@WebFault")|| type.equals("faultInfo"))){
>> > > +
>> > > + if(cls==null &&
>> > > + (type.equals("@RequestWrapper")|| type.equals("@ResponseWrapper")||type.equals("@WebFault")|| type.equals("faultInfo"))){
>> > > +
>> > > + //Support for Fault Bean Generation
>> > > //As per JAX-WS 2.2 Specification section 3.7 an application programmer can choose not to
>> > > //package the faultBeans, if we have reached this point in the code then user has choosen
>> > > //not to package the fault bean. If there is a cache of generated artifacts available then
>> > > //lets look for the missing faultBean there.
>> > > -
>> > > +
>> > > + //Support for Wrapper Bean Generation
>> > > + //As per JAX-WS 2.2 Specificaiton section 3.6.2.1 pg 41 an application programmer does not use
>> > > + //the wrapper bean classes, so the application need not package these classes. If we have reached
>> > > + //this point in the code then user has choosen not to package these beans.
>> > > +
>> > > + //NOTE:If we find Generated artifacts from cache this guarantees that we will not use
>> > > + //DocLitWrappedMinimum marshaller code. The advantage of normal DocLitWrappedMarshaller is
>> > > + //that it is very robust and has support of lot more datatypes than in DocLitWrappedMinimum.
>> > > + if(log.isDebugEnabled()){
>> > > + log.debug("Adding cache to classpath");
>> > > + }
>> > > ClassFinderFactory cff =
>> > > (ClassFinderFactory)FactoryRegistry.getFactory(ClassFinderFactory.class);
>> > > ClassFinder cf = cff.getClassFinder();
>> > > @@ -317,11 +332,26 @@ class ArtifactProcessor {
>> > > if (cls2 == null) {
>> > > cls2 = loadClassOrNull(defaultValue, altClassLoader);
>> > > }
>> > > - if(cls2==null && (type.equals("faultInfo")|| type.equals("@WebFault"))){
>> > > - //As per JAX-WS 2.2 Specification section 3.7 an application programmer can choose not to
>> > > - //package the faultBeans, if we have reached this point in the code then user has choosen
>> > > - //not to package the fault bean. If there is a cache of generated artifacts available then
>> > > - //lets look for the missing faultBean there.
>> > > + if(cls2==null &&
>> > > + (type.equals("@RequestWrapper")|| type.equals("@ResponseWrapper")||type.equals("@WebFault")|| type.equals("faultInfo"))){
>> > > +
>> > > + //Support for Fault Bean Generation
>> > > + //As per JAX-WS 2.2 Specification section 3.7 an application programmer can choose not to
>> > > + //package the faultBeans, if we have reached this point in the code then user has choosen
>> > > + //not to package the fault bean. If there is a cache of generated artifacts available then
>> > > + //lets look for the missing faultBean there.
>> > > +
>> > > + //Support for Wrapper Bean Generation
>> > > + //As per JAX-WS 2.2 Specificaiton section 3.6.2.1 pg 41 an application programmer does not use
>> > > + //the wrapper bean classes, so the application need not package these classes. If we have reached
>> > > + //this point in the code then user has choosen not to package these beans.
>> > > +
>> > > + //NOTE:If we find Generated artifacts from cache this guarantees that we will not use
>> > > + //DocLitWrappedMinimum marshaller code. The advantage of normal DocLitWrappedMarshaller is
>> > > + //that it is very robust and has support of lot more datatypes than in DocLitWrappedMinimum.
>> > > + if(log.isDebugEnabled()){
>> > > + log.debug("Adding cache to classpath");
>> > > + }
>> > > if(log.isDebugEnabled()){
>> > > log.debug("Adding cache to classpath");
>> > > }
>> > >
>> > > Added: axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
>> > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java?rev=963508&view=auto
>> > > ==============================================================================
>> > > --- axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java (added)
>> > > +++ axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java Mon Jul 12 22:16:54 2010
>> > > @@ -0,0 +1,18 @@
>> > > +
>> > > +package org.apache.axis2.jaxws.wrapper.beans;
>> > > +
>> > > +import javax.xml.ws.WebFault;
>> > > +
>> > > +@WebFault(name = "AddNumbersFault", targetNamespace = "http://org/test/addnumbers")
>> > > +public class AddNumbersException extends Exception
>> > > +{
>> > > +
>> > > + private String message = null;
>> > > + public AddNumbersException(){}
>> > > + public AddNumbersException(String message){
>> > > + this.message = message;
>> > > + }
>> > > + public String getInfo(){
>> > > + return message;
>> > > + }
>> > > +}
>> > >
>> > > Added: axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
>> > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java?rev=963508&view=auto
>> > > ==============================================================================
>> > > --- axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java (added)
>> > > +++ axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java Mon Jul 12 22:16:54 2010
>> > > @@ -0,0 +1,15 @@
>> > > +package org.apache.axis2.jaxws.wrapper.beans;
>> > > +
>> > > +
>> > > +
>> > > +@javax.jws.WebService (targetNamespace="http://org/test/addnumbers", serviceName="AddNumbersService", portName="AddNumbersPort")
>> > > +public class AddNumbersService{
>> > > +
>> > > + public int addNumbers(int arg0, int arg1) throws AddNumbersException {
>> > > + if(arg0+arg1<0){
>> > > + throw new AddNumbersException("sum is less than 0");
>> > > + }
>> > > + return arg0+arg1;
>> > > + }
>> > > +
>> > > +}
>> > > \ No newline at end of file
>> > >
>> > > Added: axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
>> > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java?rev=963508&view=auto
>> > > ==============================================================================
>> > > --- axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java (added)
>> > > +++ axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java Mon Jul 12 22:16:54 2010
>> > > @@ -0,0 +1,114 @@
>> > > +/**
>> > > + *
>> > > + */
>> > > +package org.apache.axis2.jaxws.wrapper.beans;
>> > > +
>> > > +
>> > > +import org.apache.axis2.jaxws.Constants;
>> > > +import org.apache.axis2.jaxws.description.DescriptionFactory;
>> > > +import org.apache.axis2.jaxws.description.EndpointDescription;
>> > > +import org.apache.axis2.jaxws.description.EndpointDescriptionJava;
>> > > +import org.apache.axis2.jaxws.description.OperationDescription;
>> > > +import org.apache.axis2.jaxws.description.ServiceDescription;
>> > > +import org.apache.axis2.jaxws.marshaller.MethodMarshaller;
>> > > +import org.apache.axis2.jaxws.marshaller.factory.MethodMarshallerFactory;
>> > > +import org.apache.axis2.jaxws.marshaller.impl.alt.DocLitWrappedMinimalMethodMarshaller;
>> > > +import org.apache.axis2.jaxws.unitTest.TestLogger;
>> > > +
>> > > +import java.io.File;
>> > > +
>> > > +import junit.framework.TestCase;
>> > > +
>> > > +public class WrapperBeanMarshallTests extends TestCase {
>> > > + /**
>> > > + * This is the negative test case, when we do not use generated artifacts from cache
>> > > + * and user did not package wrapper beans, we should see use of DocLitWrappedMinumumMarshaller.
>> > > + */
>> > > + public void testGetMarshallerOperationDescriptionBooleanNegative() {
>> > > + TestLogger.logger.debug("---------------------------------------");
>> > > + TestLogger.logger.debug("test: " + getName());
>> > > +
>> > > + String cache_location = "/target/wscache/classes";
>> > > + try{
>> > > + String baseDir = new File(System.getProperty("basedir",".")).getCanonicalPath();
>> > > + cache_location = new File(baseDir+cache_location).getAbsolutePath();
>> > > + TestLogger.logger.debug("cache location ="+cache_location);
>> > > +
>> > > + //Get EndpointDescription.
>> > > + //Set location on AxisConfiguraiton.
>> > > + Class sei = AddNumbersService.class;
>> > > + EndpointDescription description = getEndpointDesc(sei);
>> > > + TestLogger.logger.debug("description objects where created successfully");
>> > > + OperationDescription[] ops =description.getEndpointInterfaceDescription().getOperations();
>> > > + assertNotNull( "OperationDescriptions where null", ops);
>> > > + assertTrue("No Operation Descriptions where found", ops.length>0);
>> > > + OperationDescription op = ops[0];
>> > > + TestLogger.logger.debug("operation found, java methodName="+op.getJavaMethodName());
>> > > + //Don not Set cache on AxisConfiguration.
>> > > + //get Marshaller, verify its not DoclitWrappedMinimum.
>> > > + TestLogger.logger.debug("ws_cache location NOT set on AxisConfigContext, location="+cache_location);
>> > > + MethodMarshaller mm = MethodMarshallerFactory.getMarshaller(op, false);
>> > > + assertNotNull("getMarshaller returned null", mm );
>> > > + TestLogger.logger.debug("MethodMarshaller was created, type="+mm.getClass().getName());
>> > > + assertTrue("Generated artifacts not found, Method marshaller should be DocLitWrappedMinimumMarshaller", (mm instanceof DocLitWrappedMinimalMethodMarshaller));
>> > > + }catch(Exception e){
>> > > + TestLogger.logger.debug("Exception ="+e.getMessage());
>> > > + fail(e.getMessage());
>> > > + }
>> > > +
>> > > + }
>> > > + /**
>> > > + * In this test case user did not package wrapper beans but we add generated artifacts from cache, we should see use of
>> > > + * DocLitWrappedMarshaller.
>> > > + * Test method for {@link org.apache.axis2.jaxws.marshaller.factory.MethodMarshallerFactory#getMarshaller(org.apache.axis2.jaxws.description.OperationDescription, boolean)}.
>> > > + */
>> > > + public void testGetMarshallerOperationDescriptionBoolean() {
>> > > + TestLogger.logger.debug("---------------------------------------");
>> > > + TestLogger.logger.debug("test: " + getName());
>> > > +
>> > > + String cache_location = "/target/wscache/classes";
>> > > + try{
>> > > + String baseDir = new File(System.getProperty("basedir",".")).getCanonicalPath();
>> > > + cache_location = new File(baseDir+cache_location).getAbsolutePath();
>> > > + TestLogger.logger.debug("cache location ="+cache_location);
>> > > +
>> > > + //Get EndpointDescription.
>> > > + //Set location on AxisConfiguraiton.
>> > > + Class sei = AddNumbersService.class;
>> > > + EndpointDescription description = getEndpointDesc(sei);
>> > > + TestLogger.logger.debug("description objects where created successfully");
>> > > + OperationDescription[] ops =description.getEndpointInterfaceDescription().getOperations();
>> > > + assertNotNull( "OperationDescriptions where null", ops);
>> > > + assertTrue("No Operation Descriptions where found", ops.length>0);
>> > > + OperationDescription op = ops[0];
>> > > + TestLogger.logger.debug("operation found, java methodName="+op.getJavaMethodName());
>> > > + //Set cache on AxisConfiguration.
>> > > + //get Marshaller, verify its not DoclitWrappedMinimum.
>> > > + description.getServiceDescription().getAxisConfigContext().setProperty(Constants.WS_CACHE, cache_location);
>> > > + TestLogger.logger.debug("ws_cache location set on AxisConfigContext, location="+cache_location);
>> > > + MethodMarshaller mm = MethodMarshallerFactory.getMarshaller(op, false);
>> > > + assertNotNull("getMarshaller returned null", mm );
>> > > + TestLogger.logger.debug("MethodMarshaller was created, type="+mm.getClass().getName());
>> > > + assertTrue("Generated artifacts are in cache, Method marshaller should not be DocLitWrappedMinimumMarshaller", !(mm instanceof DocLitWrappedMinimalMethodMarshaller));
>> > > + }catch(Exception e){
>> > > + TestLogger.logger.debug("Exception ="+e.getMessage());
>> > > + fail(e.getMessage());
>> > > + }
>> > > +
>> > > + }
>> > > +
>> > > + private EndpointDescription getEndpointDesc(Class implementationClass) {
>> > > + // Use the description factory directly; this will be done within the JAX-WS runtime
>> > > + ServiceDescription serviceDesc =
>> > > + DescriptionFactory.createServiceDescription(implementationClass);
>> > > + assertNotNull(serviceDesc);
>> > > +
>> > > + EndpointDescription[] endpointDesc = serviceDesc.getEndpointDescriptions();
>> > > + assertNotNull(endpointDesc);
>> > > + assertEquals(1, endpointDesc.length);
>> > > +
>> > > + // TODO: How will the JAX-WS dispatcher get the appropriate port (i.e. endpoint)? Currently assumes [0]
>> > > + EndpointDescription testEndpointDesc = endpointDesc[0];
>> > > + return testEndpointDesc;
>> > > + }
>> > > +}
>> > >
>> > > Added: axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml
>> > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml?rev=963508&view=auto
>> > > ==============================================================================
>> > > --- axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml (added)
>> > > +++ axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml Mon Jul 12 22:16:54 2010
>> > > @@ -0,0 +1,34 @@
>> > > +<?xml version="1.0" encoding="UTF-8"?>
>> > > +
>> > > +<project basedir="." default="run-wsgen-tests" name="wsgen-tests">
>> > > +
>> > > + <property name="wscache.output.base.dir" value="target/wscache" />
>> > > + <property name="wscache.generated.src.dir" value="${wscache.output.base.dir}/src" />
>> > > + <property name="wscache.generated.classes.dir" value="${wscache.output.base.dir}/classes" />
>> > > + <property name="compile.test.classes" value="target/test-classes" />
>> > > +
>> > > +
>> > > + <target name="run-wsgen-tests" depends="wrapper-beans"/>
>> > > +
>> > > +
>> > > + <target name="create-cache">
>> > > + <mkdir dir="${wscache.output.base.dir}" />
>> > > + <mkdir dir="${wscache.generated.src.dir}" />
>> > > + <mkdir dir="${wscache.generated.classes.dir}" />
>> > > + </target>
>> > > +
>> > > + <target name="wrapper-beans" depends="create-cache">
>> > > + <echo>Generating artifacts for org.apache.axis2.jaxws.wrapper.beans.AddNumbersService </echo>
>> > > + <wsgen
>> > > + sei="org.apache.axis2.jaxws.wrapper.beans.AddNumbersService"
>> > > + destdir="${wscache.generated.classes.dir}"
>> > > + resourcedestdir="${wscache.generated.src.dir}"
>> > > + keep="false"
>> > > + verbose="false"
>> > > + genwsdl="true">
>> > > + <classpath>
>> > > + <pathelement path="${compile.test.classes}" />
>> > > + </classpath>
>> > > + </wsgen>
>> > > + </target>
>> > > +</project>
>> > > \ No newline at end of file
>> > >
>> > >
>> > >
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
>> > For additional commands, e-mail: java-dev-help@axis.apache.org
>> >
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
>> For additional commands, e-mail: java-dev-help@axis.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-dev-help@axis.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org
Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws: ./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/
test/org/apache/axis2/jaxws/wrapper/ test/org/apache/axis2/jaxws/wrapper/beans/
Posted by Nikhil V Thaker <ni...@us.ibm.com>.
Thanks Jarek for the suggestion.
The fact that there is an objection to putting jaxws-tools.jar as a
dependency would mean we cannot run wsGen. Unless I misunderstood Andreas
comments. To me we should always have jaxws-tools as dependency to jaxws
module, after all jaxws tools are prerequisite to jaxws runtime, a user of
jaxws runtime has to run wsGen or wsImport to build webservices
application.
Anyways, I will look and see if there is an alternate way to add these
test cases.
Regards,
Nikhil Thaker
office: 919 254 9964
nvthaker@us.ibm.com
Jarek Gawor <jg...@gmail.com>
07/14/2010 03:38 PM
Please respond to
java-dev@axis.apache.org
To
java-dev@axis.apache.org
cc
Subject
Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws: ./
src/org/apache/axis2/jaxws/runtime/description/marshal/impl/
test/org/apache/axis2/jaxws/wrapper/
test/org/apache/axis2/jaxws/wrapper/beans/
Just a couple of thoughts:
1) Since you already have wsgen-tests.xml ant script to run the wsgen
you could setup the appropriate classpath to the tools.jar or
classes.jar or whatever in it. You just might need to fork the ant
process.
2) I don't think it's that horrible to commit some generate code
especially if there isn't too much of it and the test case is
important. Besides, Axis2 already has some generated code checked it.
Jarek
On Wed, Jul 14, 2010 at 4:00 PM, Nikhil V Thaker
<ni...@us.ibm.com> wrote:
>
> Yes Andreas,
> I am running antrun plugin as the wsGen plugin has errors and is not
fully matured, here's the URL that explains the issue I ran into
http://jira.codehaus.org/browse/MNG-3586.
>
> So since I cannot run wsGen or cannot include generated artifacts I will
just remove the test case. I will commit the changes soon.
>
> Regards,
>
> Nikhil Thaker
> office: 919 254 9964
> nvthaker@us.ibm.com
>
>
> Andreas Veithen <an...@gmail.com>
>
> 07/14/2010 02:48 PM
>
> Please respond to
> java-dev@axis.apache.org
> To
> java-dev@axis.apache.org
> cc
> Subject
> Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws:
./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/
test/org/apache/axis2/jaxws/wrapper/
test/org/apache/axis2/jaxws/wrapper/beans/
>
>
>
>
> No, you are using the antrun plugin to execute the wsgen ant task.
> What I meant was to use a real Maven plugin (either the one from
> java.net or the one from CXF).
>
> -1 to commit any generated stuff into SVN.
>
> Andreas
>
> On Wed, Jul 14, 2010 at 21:42, Nikhil V Thaker
> <ni...@us.ibm.com> wrote:
> >
> > Andreas - I had to add the tools.jar bit because maven plugin for
wsGen gave NoClassDef Found errors for classes packaged in tools.jar.
> >
> > Since this is causing a problem I will just package the generated
artifacts and remove the wsGen dependency.
> >
> > Thanks,
> >
> > Nikhil Thaker
> > office: 919 254 9964
> > nvthaker@us.ibm.com
> >
> >
> > Andreas Veithen <an...@gmail.com>
> >
> > 07/14/2010 01:44 PM
> >
> > Please respond to
> > java-dev@axis.apache.org
> > To
> > java-dev@axis.apache.org
> > cc
> > Subject
> > Re: svn commit: r963508 - in
/axis/axis2/java/core/trunk/modules/jaxws: ./
src/org/apache/axis2/jaxws/runtime/description/marshal/impl/
test/org/apache/axis2/jaxws/wrapper/
test/org/apache/axis2/jaxws/wrapper/beans/
> >
> >
> >
> >
> > Nikhil,
> >
> > I have some issues with the tools and jaxws-tools dependencies
> > introduced by this change:
> >
> > * The change causes a build failure in Hudson. There will also be
> > additional issues with tools.jar, because the way to declare this as a
> > system dependency varies from one JDK to another. For example, I
> > remember that on Mac OS X, it is completely different than on other
> > JDKs.
> >
> > * I don't like the fact that jaxws-tools becomes a dependency of
> > axis2-jaxws in scope compile, because it looks like this is only
> > needed during the build and/or during the tests.
> >
> > I didn't review the change in detail, but wouldn't it be smarter to
> > use one of the existing Maven plugins to do the wsgen stuff? They will
> > take care of the tools.jar stuff as well.
> >
> > Andreas
> >
> > On Tue, Jul 13, 2010 at 00:16, <nt...@apache.org> wrote:
> > > Author: nthaker
> > > Date: Mon Jul 12 22:16:54 2010
> > > New Revision: 963508
> > >
> > > URL: http://svn.apache.org/viewvc?rev=963508&view=rev
> > > Log:
> > > AXIS2-4775
> > > This change ensures that we will use Request and Response wrapper
Bean packaged by customer or we will Generate Wrappers if they are not
packaged.
> > >
> > > Added:
> > >
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/
> > >
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/
> > >
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
> > >
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
> > >
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
> > > axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml
> > > Modified:
> > > axis/axis2/java/core/trunk/modules/jaxws/pom.xml
> > >
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
> > >
> > > Modified: axis/axis2/java/core/trunk/modules/jaxws/pom.xml
> > > URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/pom.xml?rev=963508&r1=963507&r2=963508&view=diff
> > >
==============================================================================
> > > --- axis/axis2/java/core/trunk/modules/jaxws/pom.xml (original)
> > > +++ axis/axis2/java/core/trunk/modules/jaxws/pom.xml Mon Jul 12
22:16:54 2010
> > > @@ -1,5 +1,4 @@
> > > <?xml version="1.0" encoding="UTF-8"?>
> > > -
> > > <!-- > ~ Licensed to the Apache Software Foundation (ASF) under
one
> > > ~ or more contributor license agreements. See the NOTICE file
> > > @@ -20,7 +19,7 @@
> > > -->
> > >
> > > <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"
> > > - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
> > > + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
> > > <modelVersion>4.0.0</modelVersion>
> > > <parent>
> > > <groupId>org.apache.axis2</groupId>
> > > @@ -98,7 +97,25 @@
> > > <version>${version}</version>
> > > <scope>test</scope>
> > > </dependency>
> > > + <dependency>
> > > + <groupId>wsdl4j</groupId>
> > > + <artifactId>wsdl4j</artifactId>
> > > + </dependency>
> > > + <dependency>
> > > + <groupId>com.sun.xml.ws</groupId>
> > > + <artifactId>jaxws-tools</artifactId>
> > > + <version>2.1.3</version>
> > > + </dependency>
> > > + <!-- If we dont include tools.jar as dependency, maven
throws NoClassDefFound on wsGen run -->
> > > + <dependency>
> > > + <groupId>java</groupId>
> > > + <artifactId>tools</artifactId>
> > > + <version>$version</version>
> > > + <scope>system</scope>
> > > + <systemPath>${JAVA_HOME}/lib/tools.jar</systemPath>
> > > + </dependency>
> > > </dependencies>
> > > +
> > > <build>
> > > <sourceDirectory>src</sourceDirectory>
> > > <testSourceDirectory>test</testSourceDirectory>
> > > @@ -203,34 +220,39 @@
> > > <compilerVersion>1.5</compilerVersion>
> > > <source>1.5</source>
> > > <target>1.5</target>
> > > +
> > > </configuration>
> > > </plugin>
> > > <plugin>
> > > <groupId>org.apache.maven.plugins</groupId>
> > > <artifactId>maven-antrun-plugin</artifactId>
> > > +
> > > <executions>
> > > <execution>
> > > <id>gen-ts</id>
> > > <phase>generate-test-sources</phase>
> > > <configuration>
> > > - <tasks unless="maven.test.skip">
> > > + <tasks unless="maven.test.skip">
> > > <!-- Theres got to be a better way
to do this -->
> > > <property name="schema.source.dir"
value="test-resources/xsd"/>
> > > <property name="wsdl.source.dir"
value="test-resources/wsdl"/>
> > > - <property
name="schema.output.base.dir" value="target/schema"/>
> > > + <property
name="schema.output.base.dir" value="target/schema"/>
> > > <property
name="schema.generated.src.dir" value="${schema.output.base.dir}/src"/>
> > > <property
name="schema.generated.classes.dir"
> > >
value="${schema.output.base.dir}/classes"/>
> > > +
> > > <!-- make the dirs -->
> > > <mkdir
dir="${schema.output.base.dir}"/>
> > > <mkdir
dir="${schema.generated.src.dir}"/>
> > > <mkdir
dir="${schema.generated.classes.dir}"/>
> > > +
> > > <!-- Run JAXB schema compiler with
designated schemas -->
> > > <echo>Generating JAX-B classes from
XSDs</echo>
> > >
> > > <echo>Generating java from
echo.xsd</echo>
> > > <java
classname="com.sun.tools.xjc.Driver" fork="true">
> > > <classpath
refid="maven.runtime.classpath"/>
> > > +
> > > <classpath
location="${compiled.classes.dir}"/>
> > > <arg line="-d
${schema.generated.src.dir} -quiet ${schema.source.dir}/echo.xsd"/>
> > > </java>
> > > @@ -266,7 +288,7 @@
> > > <classpath
refid="maven.runtime.classpath"/>
> > > <classpath
location="${compiled.classes.dir}"/>
> > > <arg line="-d
${schema.generated.src.dir} -quiet -wsdl
${wsdl.source.dir}/AddNumbers.wsdl"/>
> > > - </java>
> > > + </java>
> > > </tasks>
> > > </configuration>
> > > <goals>
> > > @@ -287,6 +309,22 @@
> > > <property name="addressing_version"
value="${version}"/>
> > > <ant antfile="build.xml"
inheritall="true" inheritrefs="true"
> > > dir="." target="build-repo"/>
> > > +
> > > +
<property name="compile_classpath" refid="maven.compile.classpath" />
> > > +
<property name="runtime_classpath" refid="maven.runtime.classpath" />
> > > +
<property name="test_classpath" refid="maven.test.classpath" />
> > > +
<property name="plugin_classpath" refid="maven.plugin.classpath" />
> > > +
> > > + <!-- Defining wsGen task -->
> > > +
<taskdef name="wsgen" loaderRef="refwsgen"
classname="com.sun.tools.ws.ant.WsGen">
> > > +
<classpath>
> > > +
<path refid="maven.runtime.classpath" />
> > > +
<path refid="maven.compile.classpath" />
> > > +
</classpath>
> > > +
</taskdef>
> > > + <!--
Invoking test cases that need to generate artifacts using wsGen -->
> > > + <ant antfile="wsgen-tests.xml"
inheritall="true" inheritrefs="true"
> > > + dir="."
target="run-wsgen-tests"/>
> > > </tasks>
> > > </configuration>
> > > <goals>
> > > @@ -374,6 +412,13 @@
> > > <plugin>
> > > <groupId>org.apache.maven.plugins</groupId>
> > >
<artifactId>maven-surefire-report-plugin</artifactId>
> > > + <reportSets>
> > > + <reportSet>
> > > + <reports>
> > > + <report>report-only</report>
> > > + </reports>
> > > + </reportSet>
> > > + </reportSets>
> > > </plugin>
> > > </plugins>
> > > </reporting>
> > >
> > > Modified:
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
> > > URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java?rev=963508&r1=963507&r2=963508&view=diff
> > >
==============================================================================
> > > ---
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
(original)
> > > +++
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
Mon Jul 12 22:16:54 2010
> > > @@ -238,12 +238,27 @@ class ArtifactProcessor {
> > > wrapperClass = newValue;
> > > }
> > > }
> > > - if(cls==null && (type.equals("@WebFault")||
type.equals("faultInfo"))){
> > > +
> > > + if(cls==null &&
> > > + (type.equals("@RequestWrapper")||
type.equals("@ResponseWrapper")||type.equals("@WebFault")||
type.equals("faultInfo"))){
> > > +
> > > + //Support for Fault Bean Generation
> > > //As per JAX-WS 2.2 Specification
section 3.7 an application programmer can choose not to
> > > //package the faultBeans, if we have
reached this point in the code then user has choosen
> > > //not to package the fault bean. If
there is a cache of generated artifacts available then
> > > //lets look for the missing faultBean
there.
> > > -
> > > +
> > > + //Support for Wrapper Bean Generation
> > > + //As per JAX-WS 2.2 Specificaiton
section 3.6.2.1 pg 41 an application programmer does not use
> > > + //the wrapper bean classes, so the
application need not package these classes. If we have reached
> > > + //this point in the code then user has
choosen not to package these beans.
> > > +
> > > + //NOTE:If we find Generated artifacts
from cache this guarantees that we will not use
> > > + //DocLitWrappedMinimum marshaller code.
The advantage of normal DocLitWrappedMarshaller is
> > > + //that it is very robust and has
support of lot more datatypes than in DocLitWrappedMinimum.
> > > + if(log.isDebugEnabled()){
> > > + log.debug("Adding cache to
classpath");
> > > + }
> > > ClassFinderFactory cff =
> > >
(ClassFinderFactory)FactoryRegistry.getFactory(ClassFinderFactory.class);
> > > ClassFinder cf = cff.getClassFinder();
> > > @@ -317,11 +332,26 @@ class ArtifactProcessor {
> > > if (cls2 == null) {
> > > cls2 = loadClassOrNull(defaultValue,
altClassLoader);
> > > }
> > > - if(cls2==null &&
(type.equals("faultInfo")|| type.equals("@WebFault"))){
> > > - //As per JAX-WS 2.2 Specification
section 3.7 an application programmer can choose not to
> > > - //package the faultBeans, if we have
reached this point in the code then user has choosen
> > > - //not to package the fault bean. If
there is a cache of generated artifacts available then
> > > - //lets look for the missing faultBean
there.
> > > + if(cls2==null &&
> > > +
(type.equals("@RequestWrapper")||
type.equals("@ResponseWrapper")||type.equals("@WebFault")||
type.equals("faultInfo"))){
> > > +
> > > + //Support for Fault Bean Generation
> > > + //As per JAX-WS 2.2 Specification
section 3.7 an application programmer can choose not to
> > > + //package the faultBeans, if we have
reached this point in the code then user has choosen
> > > + //not to package the fault bean. If
there is a cache of generated artifacts available then
> > > + //lets look for the missing
faultBean there.
> > > +
> > > + //Support for Wrapper Bean
Generation
> > > + //As per JAX-WS 2.2 Specificaiton
section 3.6.2.1 pg 41 an application programmer does not use
> > > + //the wrapper bean classes, so the
application need not package these classes. If we have reached
> > > + //this point in the code then user
has choosen not to package these beans.
> > > +
> > > + //NOTE:If we find Generated
artifacts from cache this guarantees that we will not use
> > > + //DocLitWrappedMinimum marshaller
code. The advantage of normal DocLitWrappedMarshaller is
> > > + //that it is very robust and has
support of lot more datatypes than in DocLitWrappedMinimum.
> > > + if(log.isDebugEnabled()){
> > > + log.debug("Adding cache to
classpath");
> > > + }
> > > if(log.isDebugEnabled()){
> > > log.debug("Adding cache to
classpath");
> > > }
> > >
> > > Added:
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
> > > URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java?rev=963508&view=auto
> > >
==============================================================================
> > > ---
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
(added)
> > > +++
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
Mon Jul 12 22:16:54 2010
> > > @@ -0,0 +1,18 @@
> > > +
> > > +package org.apache.axis2.jaxws.wrapper.beans;
> > > +
> > > +import javax.xml.ws.WebFault;
> > > +
> > > +@WebFault(name = "AddNumbersFault", targetNamespace = "
http://org/test/addnumbers")
> > > +public class AddNumbersException extends Exception
> > > +{
> > > +
> > > + private String message = null;
> > > + public AddNumbersException(){}
> > > + public AddNumbersException(String message){
> > > + this.message = message;
> > > + }
> > > + public String getInfo(){
> > > + return message;
> > > + }
> > > +}
> > >
> > > Added:
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
> > > URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java?rev=963508&view=auto
> > >
==============================================================================
> > > ---
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
(added)
> > > +++
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
Mon Jul 12 22:16:54 2010
> > > @@ -0,0 +1,15 @@
> > > +package org.apache.axis2.jaxws.wrapper.beans;
> > > +
> > > +
> > > +
> > > +@javax.jws.WebService (targetNamespace="http://org/test/addnumbers
", serviceName="AddNumbersService", portName="AddNumbersPort")
> > > +public class AddNumbersService{
> > > +
> > > + public int addNumbers(int arg0, int arg1) throws
AddNumbersException {
> > > + if(arg0+arg1<0){
> > > + throw new AddNumbersException("sum is less
than 0");
> > > + }
> > > + return arg0+arg1;
> > > + }
> > > +
> > > +}
> > > \ No newline at end of file
> > >
> > > Added:
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
> > > URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java?rev=963508&view=auto
> > >
==============================================================================
> > > ---
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
(added)
> > > +++
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
Mon Jul 12 22:16:54 2010
> > > @@ -0,0 +1,114 @@
> > > +/**
> > > + *
> > > + */
> > > +package org.apache.axis2.jaxws.wrapper.beans;
> > > +
> > > +
> > > +import org.apache.axis2.jaxws.Constants;
> > > +import org.apache.axis2.jaxws.description.DescriptionFactory;
> > > +import org.apache.axis2.jaxws.description.EndpointDescription;
> > > +import org.apache.axis2.jaxws.description.EndpointDescriptionJava;
> > > +import org.apache.axis2.jaxws.description.OperationDescription;
> > > +import org.apache.axis2.jaxws.description.ServiceDescription;
> > > +import org.apache.axis2.jaxws.marshaller.MethodMarshaller;
> > > +import
org.apache.axis2.jaxws.marshaller.factory.MethodMarshallerFactory;
> > > +import
org.apache.axis2.jaxws.marshaller.impl.alt.DocLitWrappedMinimalMethodMarshaller;
> > > +import org.apache.axis2.jaxws.unitTest.TestLogger;
> > > +
> > > +import java.io.File;
> > > +
> > > +import junit.framework.TestCase;
> > > +
> > > +public class WrapperBeanMarshallTests extends TestCase {
> > > + /**
> > > + * This is the negative test case, when we do not use generated
artifacts from cache
> > > + * and user did not package wrapper beans, we should see use of
DocLitWrappedMinumumMarshaller.
> > > + */
> > > + public void
testGetMarshallerOperationDescriptionBooleanNegative() {
> > > +
TestLogger.logger.debug("---------------------------------------");
> > > + TestLogger.logger.debug("test: " + getName());
> > > +
> > > + String cache_location = "/target/wscache/classes";
> > > + try{
> > > + String baseDir = new
File(System.getProperty("basedir",".")).getCanonicalPath();
> > > + cache_location = new
File(baseDir+cache_location).getAbsolutePath();
> > > + TestLogger.logger.debug("cache location
="+cache_location);
> > > +
> > > + //Get EndpointDescription.
> > > + //Set location on AxisConfiguraiton.
> > > + Class sei = AddNumbersService.class;
> > > + EndpointDescription description = getEndpointDesc(sei);
> > > + TestLogger.logger.debug("description objects where
created successfully");
> > > + OperationDescription[] ops
=description.getEndpointInterfaceDescription().getOperations();
> > > + assertNotNull( "OperationDescriptions where null",
ops);
> > > + assertTrue("No Operation Descriptions where found",
ops.length>0);
> > > + OperationDescription op = ops[0];
> > > + TestLogger.logger.debug("operation found, java
methodName="+op.getJavaMethodName());
> > > + //Don not Set cache on AxisConfiguration.
> > > + //get Marshaller, verify its not DoclitWrappedMinimum.
> > > + TestLogger.logger.debug("ws_cache location NOT set on
AxisConfigContext, location="+cache_location);
> > > + MethodMarshaller mm =
MethodMarshallerFactory.getMarshaller(op, false);
> > > + assertNotNull("getMarshaller returned null", mm );
> > > + TestLogger.logger.debug("MethodMarshaller was created,
type="+mm.getClass().getName());
> > > + assertTrue("Generated artifacts not found, Method
marshaller should be DocLitWrappedMinimumMarshaller", (mm instanceof
DocLitWrappedMinimalMethodMarshaller));
> > > + }catch(Exception e){
> > > + TestLogger.logger.debug("Exception ="+e.getMessage());
> > > + fail(e.getMessage());
> > > + }
> > > +
> > > + }
> > > + /**
> > > + * In this test case user did not package wrapper beans but we
add generated artifacts from cache, we should see use of
> > > + * DocLitWrappedMarshaller.
> > > + * Test method for {@link
org.apache.axis2.jaxws.marshaller.factory.MethodMarshallerFactory#getMarshaller(org.apache.axis2.jaxws.description.OperationDescription,
boolean)}.
> > > + */
> > > + public void testGetMarshallerOperationDescriptionBoolean() {
> > > +
TestLogger.logger.debug("---------------------------------------");
> > > + TestLogger.logger.debug("test: " + getName());
> > > +
> > > + String cache_location = "/target/wscache/classes";
> > > + try{
> > > + String baseDir = new
File(System.getProperty("basedir",".")).getCanonicalPath();
> > > + cache_location = new
File(baseDir+cache_location).getAbsolutePath();
> > > + TestLogger.logger.debug("cache location
="+cache_location);
> > > +
> > > + //Get EndpointDescription.
> > > + //Set location on AxisConfiguraiton.
> > > + Class sei = AddNumbersService.class;
> > > + EndpointDescription description = getEndpointDesc(sei);
> > > + TestLogger.logger.debug("description objects where
created successfully");
> > > + OperationDescription[] ops
=description.getEndpointInterfaceDescription().getOperations();
> > > + assertNotNull( "OperationDescriptions where null",
ops);
> > > + assertTrue("No Operation Descriptions where found",
ops.length>0);
> > > + OperationDescription op = ops[0];
> > > + TestLogger.logger.debug("operation found, java
methodName="+op.getJavaMethodName());
> > > + //Set cache on AxisConfiguration.
> > > + //get Marshaller, verify its not DoclitWrappedMinimum.
> > > +
description.getServiceDescription().getAxisConfigContext().setProperty(Constants.WS_CACHE,
cache_location);
> > > + TestLogger.logger.debug("ws_cache location set on
AxisConfigContext, location="+cache_location);
> > > + MethodMarshaller mm =
MethodMarshallerFactory.getMarshaller(op, false);
> > > + assertNotNull("getMarshaller returned null", mm );
> > > + TestLogger.logger.debug("MethodMarshaller was created,
type="+mm.getClass().getName());
> > > + assertTrue("Generated artifacts are in cache, Method
marshaller should not be DocLitWrappedMinimumMarshaller", !(mm instanceof
DocLitWrappedMinimalMethodMarshaller));
> > > + }catch(Exception e){
> > > + TestLogger.logger.debug("Exception ="+e.getMessage());
> > > + fail(e.getMessage());
> > > + }
> > > +
> > > + }
> > > +
> > > + private EndpointDescription getEndpointDesc(Class
implementationClass) {
> > > + // Use the description factory directly; this will be done
within the JAX-WS runtime
> > > + ServiceDescription serviceDesc =
> > > +
DescriptionFactory.createServiceDescription(implementationClass);
> > > + assertNotNull(serviceDesc);
> > > +
> > > + EndpointDescription[] endpointDesc =
serviceDesc.getEndpointDescriptions();
> > > + assertNotNull(endpointDesc);
> > > + assertEquals(1, endpointDesc.length);
> > > +
> > > + // TODO: How will the JAX-WS dispatcher get the appropriate
port (i.e. endpoint)? Currently assumes [0]
> > > + EndpointDescription testEndpointDesc = endpointDesc[0];
> > > + return testEndpointDesc;
> > > + }
> > > +}
> > >
> > > Added: axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml
> > > URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml?rev=963508&view=auto
> > >
==============================================================================
> > > --- axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml (added)
> > > +++ axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml Mon Jul
12 22:16:54 2010
> > > @@ -0,0 +1,34 @@
> > > +<?xml version="1.0" encoding="UTF-8"?>
> > > +
> > > +<project basedir="." default="run-wsgen-tests" name="wsgen-tests">
> > > +
> > > + <property name="wscache.output.base.dir"
value="target/wscache" />
> > > + <property name="wscache.generated.src.dir"
value="${wscache.output.base.dir}/src" />
> > > + <property name="wscache.generated.classes.dir"
value="${wscache.output.base.dir}/classes" />
> > > + <property name="compile.test.classes"
value="target/test-classes" />
> > > +
> > > +
> > > + <target name="run-wsgen-tests" depends="wrapper-beans"/>
> > > +
> > > +
> > > + <target name="create-cache">
> > > + <mkdir dir="${wscache.output.base.dir}" />
> > > + <mkdir dir="${wscache.generated.src.dir}" />
> > > + <mkdir dir="${wscache.generated.classes.dir}" />
> > > + </target>
> > > +
> > > + <target name="wrapper-beans" depends="create-cache">
> > > + <echo>Generating artifacts for
org.apache.axis2.jaxws.wrapper.beans.AddNumbersService </echo>
> > > + <wsgen
> > > +
sei="org.apache.axis2.jaxws.wrapper.beans.AddNumbersService"
> > > + destdir="${wscache.generated.classes.dir}"
> > > + resourcedestdir="${wscache.generated.src.dir}"
> > > + keep="false"
> > > + verbose="false"
> > > + genwsdl="true">
> > > + <classpath>
> > > + <pathelement path="${compile.test.classes}" />
> > > + </classpath>
> > > + </wsgen>
> > > + </target>
> > > +</project>
> > > \ No newline at end of file
> > >
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
> > For additional commands, e-mail: java-dev-help@axis.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-dev-help@axis.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org
Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws:
./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/
test/org/apache/axis2/jaxws/wrapper/ test/org/apache/axis2/jaxws/wrapper/beans/
Posted by Jarek Gawor <jg...@gmail.com>.
Just a couple of thoughts:
1) Since you already have wsgen-tests.xml ant script to run the wsgen
you could setup the appropriate classpath to the tools.jar or
classes.jar or whatever in it. You just might need to fork the ant
process.
2) I don't think it's that horrible to commit some generate code
especially if there isn't too much of it and the test case is
important. Besides, Axis2 already has some generated code checked it.
Jarek
On Wed, Jul 14, 2010 at 4:00 PM, Nikhil V Thaker
<ni...@us.ibm.com> wrote:
>
> Yes Andreas,
> I am running antrun plugin as the wsGen plugin has errors and is not fully matured, here's the URL that explains the issue I ran into http://jira.codehaus.org/browse/MNG-3586.
>
> So since I cannot run wsGen or cannot include generated artifacts I will just remove the test case. I will commit the changes soon.
>
> Regards,
>
> Nikhil Thaker
> office: 919 254 9964
> nvthaker@us.ibm.com
>
>
> Andreas Veithen <an...@gmail.com>
>
> 07/14/2010 02:48 PM
>
> Please respond to
> java-dev@axis.apache.org
> To
> java-dev@axis.apache.org
> cc
> Subject
> Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws: ./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ test/org/apache/axis2/jaxws/wrapper/ test/org/apache/axis2/jaxws/wrapper/beans/
>
>
>
>
> No, you are using the antrun plugin to execute the wsgen ant task.
> What I meant was to use a real Maven plugin (either the one from
> java.net or the one from CXF).
>
> -1 to commit any generated stuff into SVN.
>
> Andreas
>
> On Wed, Jul 14, 2010 at 21:42, Nikhil V Thaker
> <ni...@us.ibm.com> wrote:
> >
> > Andreas - I had to add the tools.jar bit because maven plugin for wsGen gave NoClassDef Found errors for classes packaged in tools.jar.
> >
> > Since this is causing a problem I will just package the generated artifacts and remove the wsGen dependency.
> >
> > Thanks,
> >
> > Nikhil Thaker
> > office: 919 254 9964
> > nvthaker@us.ibm.com
> >
> >
> > Andreas Veithen <an...@gmail.com>
> >
> > 07/14/2010 01:44 PM
> >
> > Please respond to
> > java-dev@axis.apache.org
> > To
> > java-dev@axis.apache.org
> > cc
> > Subject
> > Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws: ./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ test/org/apache/axis2/jaxws/wrapper/ test/org/apache/axis2/jaxws/wrapper/beans/
> >
> >
> >
> >
> > Nikhil,
> >
> > I have some issues with the tools and jaxws-tools dependencies
> > introduced by this change:
> >
> > * The change causes a build failure in Hudson. There will also be
> > additional issues with tools.jar, because the way to declare this as a
> > system dependency varies from one JDK to another. For example, I
> > remember that on Mac OS X, it is completely different than on other
> > JDKs.
> >
> > * I don't like the fact that jaxws-tools becomes a dependency of
> > axis2-jaxws in scope compile, because it looks like this is only
> > needed during the build and/or during the tests.
> >
> > I didn't review the change in detail, but wouldn't it be smarter to
> > use one of the existing Maven plugins to do the wsgen stuff? They will
> > take care of the tools.jar stuff as well.
> >
> > Andreas
> >
> > On Tue, Jul 13, 2010 at 00:16, <nt...@apache.org> wrote:
> > > Author: nthaker
> > > Date: Mon Jul 12 22:16:54 2010
> > > New Revision: 963508
> > >
> > > URL: http://svn.apache.org/viewvc?rev=963508&view=rev
> > > Log:
> > > AXIS2-4775
> > > This change ensures that we will use Request and Response wrapper Bean packaged by customer or we will Generate Wrappers if they are not packaged.
> > >
> > > Added:
> > > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/
> > > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/
> > > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
> > > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
> > > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
> > > axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml
> > > Modified:
> > > axis/axis2/java/core/trunk/modules/jaxws/pom.xml
> > > axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
> > >
> > > Modified: axis/axis2/java/core/trunk/modules/jaxws/pom.xml
> > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/pom.xml?rev=963508&r1=963507&r2=963508&view=diff
> > > ==============================================================================
> > > --- axis/axis2/java/core/trunk/modules/jaxws/pom.xml (original)
> > > +++ axis/axis2/java/core/trunk/modules/jaxws/pom.xml Mon Jul 12 22:16:54 2010
> > > @@ -1,5 +1,4 @@
> > > <?xml version="1.0" encoding="UTF-8"?>
> > > -
> > > <!-- > ~ Licensed to the Apache Software Foundation (ASF) under one
> > > ~ or more contributor license agreements. See the NOTICE file
> > > @@ -20,7 +19,7 @@
> > > -->
> > >
> > > <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> > > - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
> > > + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
> > > <modelVersion>4.0.0</modelVersion>
> > > <parent>
> > > <groupId>org.apache.axis2</groupId>
> > > @@ -98,7 +97,25 @@
> > > <version>${version}</version>
> > > <scope>test</scope>
> > > </dependency>
> > > + <dependency>
> > > + <groupId>wsdl4j</groupId>
> > > + <artifactId>wsdl4j</artifactId>
> > > + </dependency>
> > > + <dependency>
> > > + <groupId>com.sun.xml.ws</groupId>
> > > + <artifactId>jaxws-tools</artifactId>
> > > + <version>2.1.3</version>
> > > + </dependency>
> > > + <!-- If we dont include tools.jar as dependency, maven throws NoClassDefFound on wsGen run -->
> > > + <dependency>
> > > + <groupId>java</groupId>
> > > + <artifactId>tools</artifactId>
> > > + <version>$version</version>
> > > + <scope>system</scope>
> > > + <systemPath>${JAVA_HOME}/lib/tools.jar</systemPath>
> > > + </dependency>
> > > </dependencies>
> > > +
> > > <build>
> > > <sourceDirectory>src</sourceDirectory>
> > > <testSourceDirectory>test</testSourceDirectory>
> > > @@ -203,34 +220,39 @@
> > > <compilerVersion>1.5</compilerVersion>
> > > <source>1.5</source>
> > > <target>1.5</target>
> > > +
> > > </configuration>
> > > </plugin>
> > > <plugin>
> > > <groupId>org.apache.maven.plugins</groupId>
> > > <artifactId>maven-antrun-plugin</artifactId>
> > > +
> > > <executions>
> > > <execution>
> > > <id>gen-ts</id>
> > > <phase>generate-test-sources</phase>
> > > <configuration>
> > > - <tasks unless="maven.test.skip">
> > > + <tasks unless="maven.test.skip">
> > > <!-- Theres got to be a better way to do this -->
> > > <property name="schema.source.dir" value="test-resources/xsd"/>
> > > <property name="wsdl.source.dir" value="test-resources/wsdl"/>
> > > - <property name="schema.output.base.dir" value="target/schema"/>
> > > + <property name="schema.output.base.dir" value="target/schema"/>
> > > <property name="schema.generated.src.dir" value="${schema.output.base.dir}/src"/>
> > > <property name="schema.generated.classes.dir"
> > > value="${schema.output.base.dir}/classes"/>
> > > +
> > > <!-- make the dirs -->
> > > <mkdir dir="${schema.output.base.dir}"/>
> > > <mkdir dir="${schema.generated.src.dir}"/>
> > > <mkdir dir="${schema.generated.classes.dir}"/>
> > > +
> > > <!-- Run JAXB schema compiler with designated schemas -->
> > > <echo>Generating JAX-B classes from XSDs</echo>
> > >
> > > <echo>Generating java from echo.xsd</echo>
> > > <java classname="com.sun.tools.xjc.Driver" fork="true">
> > > <classpath refid="maven.runtime.classpath"/>
> > > +
> > > <classpath location="${compiled.classes.dir}"/>
> > > <arg line="-d ${schema.generated.src.dir} -quiet ${schema.source.dir}/echo.xsd"/>
> > > </java>
> > > @@ -266,7 +288,7 @@
> > > <classpath refid="maven.runtime.classpath"/>
> > > <classpath location="${compiled.classes.dir}"/>
> > > <arg line="-d ${schema.generated.src.dir} -quiet -wsdl ${wsdl.source.dir}/AddNumbers.wsdl"/>
> > > - </java>
> > > + </java>
> > > </tasks>
> > > </configuration>
> > > <goals>
> > > @@ -287,6 +309,22 @@
> > > <property name="addressing_version" value="${version}"/>
> > > <ant antfile="build.xml" inheritall="true" inheritrefs="true"
> > > dir="." target="build-repo"/>
> > > +
> > > + <property name="compile_classpath" refid="maven.compile.classpath" />
> > > + <property name="runtime_classpath" refid="maven.runtime.classpath" />
> > > + <property name="test_classpath" refid="maven.test.classpath" />
> > > + <property name="plugin_classpath" refid="maven.plugin.classpath" />
> > > +
> > > + <!-- Defining wsGen task -->
> > > + <taskdef name="wsgen" loaderRef="refwsgen" classname="com.sun.tools.ws.ant.WsGen">
> > > + <classpath>
> > > + <path refid="maven.runtime.classpath" />
> > > + <path refid="maven.compile.classpath" />
> > > + </classpath>
> > > + </taskdef>
> > > + <!-- Invoking test cases that need to generate artifacts using wsGen -->
> > > + <ant antfile="wsgen-tests.xml" inheritall="true" inheritrefs="true"
> > > + dir="." target="run-wsgen-tests"/>
> > > </tasks>
> > > </configuration>
> > > <goals>
> > > @@ -374,6 +412,13 @@
> > > <plugin>
> > > <groupId>org.apache.maven.plugins</groupId>
> > > <artifactId>maven-surefire-report-plugin</artifactId>
> > > + <reportSets>
> > > + <reportSet>
> > > + <reports>
> > > + <report>report-only</report>
> > > + </reports>
> > > + </reportSet>
> > > + </reportSets>
> > > </plugin>
> > > </plugins>
> > > </reporting>
> > >
> > > Modified: axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
> > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java?rev=963508&r1=963507&r2=963508&view=diff
> > > ==============================================================================
> > > --- axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java (original)
> > > +++ axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java Mon Jul 12 22:16:54 2010
> > > @@ -238,12 +238,27 @@ class ArtifactProcessor {
> > > wrapperClass = newValue;
> > > }
> > > }
> > > - if(cls==null && (type.equals("@WebFault")|| type.equals("faultInfo"))){
> > > +
> > > + if(cls==null &&
> > > + (type.equals("@RequestWrapper")|| type.equals("@ResponseWrapper")||type.equals("@WebFault")|| type.equals("faultInfo"))){
> > > +
> > > + //Support for Fault Bean Generation
> > > //As per JAX-WS 2.2 Specification section 3.7 an application programmer can choose not to
> > > //package the faultBeans, if we have reached this point in the code then user has choosen
> > > //not to package the fault bean. If there is a cache of generated artifacts available then
> > > //lets look for the missing faultBean there.
> > > -
> > > +
> > > + //Support for Wrapper Bean Generation
> > > + //As per JAX-WS 2.2 Specificaiton section 3.6.2.1 pg 41 an application programmer does not use
> > > + //the wrapper bean classes, so the application need not package these classes. If we have reached
> > > + //this point in the code then user has choosen not to package these beans.
> > > +
> > > + //NOTE:If we find Generated artifacts from cache this guarantees that we will not use
> > > + //DocLitWrappedMinimum marshaller code. The advantage of normal DocLitWrappedMarshaller is
> > > + //that it is very robust and has support of lot more datatypes than in DocLitWrappedMinimum.
> > > + if(log.isDebugEnabled()){
> > > + log.debug("Adding cache to classpath");
> > > + }
> > > ClassFinderFactory cff =
> > > (ClassFinderFactory)FactoryRegistry.getFactory(ClassFinderFactory.class);
> > > ClassFinder cf = cff.getClassFinder();
> > > @@ -317,11 +332,26 @@ class ArtifactProcessor {
> > > if (cls2 == null) {
> > > cls2 = loadClassOrNull(defaultValue, altClassLoader);
> > > }
> > > - if(cls2==null && (type.equals("faultInfo")|| type.equals("@WebFault"))){
> > > - //As per JAX-WS 2.2 Specification section 3.7 an application programmer can choose not to
> > > - //package the faultBeans, if we have reached this point in the code then user has choosen
> > > - //not to package the fault bean. If there is a cache of generated artifacts available then
> > > - //lets look for the missing faultBean there.
> > > + if(cls2==null &&
> > > + (type.equals("@RequestWrapper")|| type.equals("@ResponseWrapper")||type.equals("@WebFault")|| type.equals("faultInfo"))){
> > > +
> > > + //Support for Fault Bean Generation
> > > + //As per JAX-WS 2.2 Specification section 3.7 an application programmer can choose not to
> > > + //package the faultBeans, if we have reached this point in the code then user has choosen
> > > + //not to package the fault bean. If there is a cache of generated artifacts available then
> > > + //lets look for the missing faultBean there.
> > > +
> > > + //Support for Wrapper Bean Generation
> > > + //As per JAX-WS 2.2 Specificaiton section 3.6.2.1 pg 41 an application programmer does not use
> > > + //the wrapper bean classes, so the application need not package these classes. If we have reached
> > > + //this point in the code then user has choosen not to package these beans.
> > > +
> > > + //NOTE:If we find Generated artifacts from cache this guarantees that we will not use
> > > + //DocLitWrappedMinimum marshaller code. The advantage of normal DocLitWrappedMarshaller is
> > > + //that it is very robust and has support of lot more datatypes than in DocLitWrappedMinimum.
> > > + if(log.isDebugEnabled()){
> > > + log.debug("Adding cache to classpath");
> > > + }
> > > if(log.isDebugEnabled()){
> > > log.debug("Adding cache to classpath");
> > > }
> > >
> > > Added: axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
> > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java?rev=963508&view=auto
> > > ==============================================================================
> > > --- axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java (added)
> > > +++ axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java Mon Jul 12 22:16:54 2010
> > > @@ -0,0 +1,18 @@
> > > +
> > > +package org.apache.axis2.jaxws.wrapper.beans;
> > > +
> > > +import javax.xml.ws.WebFault;
> > > +
> > > +@WebFault(name = "AddNumbersFault", targetNamespace = "http://org/test/addnumbers")
> > > +public class AddNumbersException extends Exception
> > > +{
> > > +
> > > + private String message = null;
> > > + public AddNumbersException(){}
> > > + public AddNumbersException(String message){
> > > + this.message = message;
> > > + }
> > > + public String getInfo(){
> > > + return message;
> > > + }
> > > +}
> > >
> > > Added: axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
> > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java?rev=963508&view=auto
> > > ==============================================================================
> > > --- axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java (added)
> > > +++ axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java Mon Jul 12 22:16:54 2010
> > > @@ -0,0 +1,15 @@
> > > +package org.apache.axis2.jaxws.wrapper.beans;
> > > +
> > > +
> > > +
> > > +@javax.jws.WebService (targetNamespace="http://org/test/addnumbers", serviceName="AddNumbersService", portName="AddNumbersPort")
> > > +public class AddNumbersService{
> > > +
> > > + public int addNumbers(int arg0, int arg1) throws AddNumbersException {
> > > + if(arg0+arg1<0){
> > > + throw new AddNumbersException("sum is less than 0");
> > > + }
> > > + return arg0+arg1;
> > > + }
> > > +
> > > +}
> > > \ No newline at end of file
> > >
> > > Added: axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
> > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java?rev=963508&view=auto
> > > ==============================================================================
> > > --- axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java (added)
> > > +++ axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java Mon Jul 12 22:16:54 2010
> > > @@ -0,0 +1,114 @@
> > > +/**
> > > + *
> > > + */
> > > +package org.apache.axis2.jaxws.wrapper.beans;
> > > +
> > > +
> > > +import org.apache.axis2.jaxws.Constants;
> > > +import org.apache.axis2.jaxws.description.DescriptionFactory;
> > > +import org.apache.axis2.jaxws.description.EndpointDescription;
> > > +import org.apache.axis2.jaxws.description.EndpointDescriptionJava;
> > > +import org.apache.axis2.jaxws.description.OperationDescription;
> > > +import org.apache.axis2.jaxws.description.ServiceDescription;
> > > +import org.apache.axis2.jaxws.marshaller.MethodMarshaller;
> > > +import org.apache.axis2.jaxws.marshaller.factory.MethodMarshallerFactory;
> > > +import org.apache.axis2.jaxws.marshaller.impl.alt.DocLitWrappedMinimalMethodMarshaller;
> > > +import org.apache.axis2.jaxws.unitTest.TestLogger;
> > > +
> > > +import java.io.File;
> > > +
> > > +import junit.framework.TestCase;
> > > +
> > > +public class WrapperBeanMarshallTests extends TestCase {
> > > + /**
> > > + * This is the negative test case, when we do not use generated artifacts from cache
> > > + * and user did not package wrapper beans, we should see use of DocLitWrappedMinumumMarshaller.
> > > + */
> > > + public void testGetMarshallerOperationDescriptionBooleanNegative() {
> > > + TestLogger.logger.debug("---------------------------------------");
> > > + TestLogger.logger.debug("test: " + getName());
> > > +
> > > + String cache_location = "/target/wscache/classes";
> > > + try{
> > > + String baseDir = new File(System.getProperty("basedir",".")).getCanonicalPath();
> > > + cache_location = new File(baseDir+cache_location).getAbsolutePath();
> > > + TestLogger.logger.debug("cache location ="+cache_location);
> > > +
> > > + //Get EndpointDescription.
> > > + //Set location on AxisConfiguraiton.
> > > + Class sei = AddNumbersService.class;
> > > + EndpointDescription description = getEndpointDesc(sei);
> > > + TestLogger.logger.debug("description objects where created successfully");
> > > + OperationDescription[] ops =description.getEndpointInterfaceDescription().getOperations();
> > > + assertNotNull( "OperationDescriptions where null", ops);
> > > + assertTrue("No Operation Descriptions where found", ops.length>0);
> > > + OperationDescription op = ops[0];
> > > + TestLogger.logger.debug("operation found, java methodName="+op.getJavaMethodName());
> > > + //Don not Set cache on AxisConfiguration.
> > > + //get Marshaller, verify its not DoclitWrappedMinimum.
> > > + TestLogger.logger.debug("ws_cache location NOT set on AxisConfigContext, location="+cache_location);
> > > + MethodMarshaller mm = MethodMarshallerFactory.getMarshaller(op, false);
> > > + assertNotNull("getMarshaller returned null", mm );
> > > + TestLogger.logger.debug("MethodMarshaller was created, type="+mm.getClass().getName());
> > > + assertTrue("Generated artifacts not found, Method marshaller should be DocLitWrappedMinimumMarshaller", (mm instanceof DocLitWrappedMinimalMethodMarshaller));
> > > + }catch(Exception e){
> > > + TestLogger.logger.debug("Exception ="+e.getMessage());
> > > + fail(e.getMessage());
> > > + }
> > > +
> > > + }
> > > + /**
> > > + * In this test case user did not package wrapper beans but we add generated artifacts from cache, we should see use of
> > > + * DocLitWrappedMarshaller.
> > > + * Test method for {@link org.apache.axis2.jaxws.marshaller.factory.MethodMarshallerFactory#getMarshaller(org.apache.axis2.jaxws.description.OperationDescription, boolean)}.
> > > + */
> > > + public void testGetMarshallerOperationDescriptionBoolean() {
> > > + TestLogger.logger.debug("---------------------------------------");
> > > + TestLogger.logger.debug("test: " + getName());
> > > +
> > > + String cache_location = "/target/wscache/classes";
> > > + try{
> > > + String baseDir = new File(System.getProperty("basedir",".")).getCanonicalPath();
> > > + cache_location = new File(baseDir+cache_location).getAbsolutePath();
> > > + TestLogger.logger.debug("cache location ="+cache_location);
> > > +
> > > + //Get EndpointDescription.
> > > + //Set location on AxisConfiguraiton.
> > > + Class sei = AddNumbersService.class;
> > > + EndpointDescription description = getEndpointDesc(sei);
> > > + TestLogger.logger.debug("description objects where created successfully");
> > > + OperationDescription[] ops =description.getEndpointInterfaceDescription().getOperations();
> > > + assertNotNull( "OperationDescriptions where null", ops);
> > > + assertTrue("No Operation Descriptions where found", ops.length>0);
> > > + OperationDescription op = ops[0];
> > > + TestLogger.logger.debug("operation found, java methodName="+op.getJavaMethodName());
> > > + //Set cache on AxisConfiguration.
> > > + //get Marshaller, verify its not DoclitWrappedMinimum.
> > > + description.getServiceDescription().getAxisConfigContext().setProperty(Constants.WS_CACHE, cache_location);
> > > + TestLogger.logger.debug("ws_cache location set on AxisConfigContext, location="+cache_location);
> > > + MethodMarshaller mm = MethodMarshallerFactory.getMarshaller(op, false);
> > > + assertNotNull("getMarshaller returned null", mm );
> > > + TestLogger.logger.debug("MethodMarshaller was created, type="+mm.getClass().getName());
> > > + assertTrue("Generated artifacts are in cache, Method marshaller should not be DocLitWrappedMinimumMarshaller", !(mm instanceof DocLitWrappedMinimalMethodMarshaller));
> > > + }catch(Exception e){
> > > + TestLogger.logger.debug("Exception ="+e.getMessage());
> > > + fail(e.getMessage());
> > > + }
> > > +
> > > + }
> > > +
> > > + private EndpointDescription getEndpointDesc(Class implementationClass) {
> > > + // Use the description factory directly; this will be done within the JAX-WS runtime
> > > + ServiceDescription serviceDesc =
> > > + DescriptionFactory.createServiceDescription(implementationClass);
> > > + assertNotNull(serviceDesc);
> > > +
> > > + EndpointDescription[] endpointDesc = serviceDesc.getEndpointDescriptions();
> > > + assertNotNull(endpointDesc);
> > > + assertEquals(1, endpointDesc.length);
> > > +
> > > + // TODO: How will the JAX-WS dispatcher get the appropriate port (i.e. endpoint)? Currently assumes [0]
> > > + EndpointDescription testEndpointDesc = endpointDesc[0];
> > > + return testEndpointDesc;
> > > + }
> > > +}
> > >
> > > Added: axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml
> > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml?rev=963508&view=auto
> > > ==============================================================================
> > > --- axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml (added)
> > > +++ axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml Mon Jul 12 22:16:54 2010
> > > @@ -0,0 +1,34 @@
> > > +<?xml version="1.0" encoding="UTF-8"?>
> > > +
> > > +<project basedir="." default="run-wsgen-tests" name="wsgen-tests">
> > > +
> > > + <property name="wscache.output.base.dir" value="target/wscache" />
> > > + <property name="wscache.generated.src.dir" value="${wscache.output.base.dir}/src" />
> > > + <property name="wscache.generated.classes.dir" value="${wscache.output.base.dir}/classes" />
> > > + <property name="compile.test.classes" value="target/test-classes" />
> > > +
> > > +
> > > + <target name="run-wsgen-tests" depends="wrapper-beans"/>
> > > +
> > > +
> > > + <target name="create-cache">
> > > + <mkdir dir="${wscache.output.base.dir}" />
> > > + <mkdir dir="${wscache.generated.src.dir}" />
> > > + <mkdir dir="${wscache.generated.classes.dir}" />
> > > + </target>
> > > +
> > > + <target name="wrapper-beans" depends="create-cache">
> > > + <echo>Generating artifacts for org.apache.axis2.jaxws.wrapper.beans.AddNumbersService </echo>
> > > + <wsgen
> > > + sei="org.apache.axis2.jaxws.wrapper.beans.AddNumbersService"
> > > + destdir="${wscache.generated.classes.dir}"
> > > + resourcedestdir="${wscache.generated.src.dir}"
> > > + keep="false"
> > > + verbose="false"
> > > + genwsdl="true">
> > > + <classpath>
> > > + <pathelement path="${compile.test.classes}" />
> > > + </classpath>
> > > + </wsgen>
> > > + </target>
> > > +</project>
> > > \ No newline at end of file
> > >
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
> > For additional commands, e-mail: java-dev-help@axis.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-dev-help@axis.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org
Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws:
./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/
test/org/apache/axis2/jaxws/wrapper/ test/org/apache/axis2/jaxws/wrapper/beans/
Posted by Jarek Gawor <jg...@gmail.com>.
Just a couple of thoughts:
1) Since you already have wsgen-tests.xml ant script to run the wsgen
you could setup the appropriate classpath to the tools.jar or
classes.jar or whatever in it. You just might need to fork the ant
process.
2) I don't think it's that horrible to commit some generate code
especially if there isn't too much of it and the test case is
important. Besides, Axis2 already has some generated code checked it.
Jarek
On Wed, Jul 14, 2010 at 4:00 PM, Nikhil V Thaker
<ni...@us.ibm.com> wrote:
>
> Yes Andreas,
> I am running antrun plugin as the wsGen plugin has errors and is not fully matured, here's the URL that explains the issue I ran into http://jira.codehaus.org/browse/MNG-3586.
>
> So since I cannot run wsGen or cannot include generated artifacts I will just remove the test case. I will commit the changes soon.
>
> Regards,
>
> Nikhil Thaker
> office: 919 254 9964
> nvthaker@us.ibm.com
>
>
> Andreas Veithen <an...@gmail.com>
>
> 07/14/2010 02:48 PM
>
> Please respond to
> java-dev@axis.apache.org
> To
> java-dev@axis.apache.org
> cc
> Subject
> Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws: ./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ test/org/apache/axis2/jaxws/wrapper/ test/org/apache/axis2/jaxws/wrapper/beans/
>
>
>
>
> No, you are using the antrun plugin to execute the wsgen ant task.
> What I meant was to use a real Maven plugin (either the one from
> java.net or the one from CXF).
>
> -1 to commit any generated stuff into SVN.
>
> Andreas
>
> On Wed, Jul 14, 2010 at 21:42, Nikhil V Thaker
> <ni...@us.ibm.com> wrote:
> >
> > Andreas - I had to add the tools.jar bit because maven plugin for wsGen gave NoClassDef Found errors for classes packaged in tools.jar.
> >
> > Since this is causing a problem I will just package the generated artifacts and remove the wsGen dependency.
> >
> > Thanks,
> >
> > Nikhil Thaker
> > office: 919 254 9964
> > nvthaker@us.ibm.com
> >
> >
> > Andreas Veithen <an...@gmail.com>
> >
> > 07/14/2010 01:44 PM
> >
> > Please respond to
> > java-dev@axis.apache.org
> > To
> > java-dev@axis.apache.org
> > cc
> > Subject
> > Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws: ./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ test/org/apache/axis2/jaxws/wrapper/ test/org/apache/axis2/jaxws/wrapper/beans/
> >
> >
> >
> >
> > Nikhil,
> >
> > I have some issues with the tools and jaxws-tools dependencies
> > introduced by this change:
> >
> > * The change causes a build failure in Hudson. There will also be
> > additional issues with tools.jar, because the way to declare this as a
> > system dependency varies from one JDK to another. For example, I
> > remember that on Mac OS X, it is completely different than on other
> > JDKs.
> >
> > * I don't like the fact that jaxws-tools becomes a dependency of
> > axis2-jaxws in scope compile, because it looks like this is only
> > needed during the build and/or during the tests.
> >
> > I didn't review the change in detail, but wouldn't it be smarter to
> > use one of the existing Maven plugins to do the wsgen stuff? They will
> > take care of the tools.jar stuff as well.
> >
> > Andreas
> >
> > On Tue, Jul 13, 2010 at 00:16, <nt...@apache.org> wrote:
> > > Author: nthaker
> > > Date: Mon Jul 12 22:16:54 2010
> > > New Revision: 963508
> > >
> > > URL: http://svn.apache.org/viewvc?rev=963508&view=rev
> > > Log:
> > > AXIS2-4775
> > > This change ensures that we will use Request and Response wrapper Bean packaged by customer or we will Generate Wrappers if they are not packaged.
> > >
> > > Added:
> > > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/
> > > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/
> > > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
> > > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
> > > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
> > > axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml
> > > Modified:
> > > axis/axis2/java/core/trunk/modules/jaxws/pom.xml
> > > axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
> > >
> > > Modified: axis/axis2/java/core/trunk/modules/jaxws/pom.xml
> > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/pom.xml?rev=963508&r1=963507&r2=963508&view=diff
> > > ==============================================================================
> > > --- axis/axis2/java/core/trunk/modules/jaxws/pom.xml (original)
> > > +++ axis/axis2/java/core/trunk/modules/jaxws/pom.xml Mon Jul 12 22:16:54 2010
> > > @@ -1,5 +1,4 @@
> > > <?xml version="1.0" encoding="UTF-8"?>
> > > -
> > > <!-- > ~ Licensed to the Apache Software Foundation (ASF) under one
> > > ~ or more contributor license agreements. See the NOTICE file
> > > @@ -20,7 +19,7 @@
> > > -->
> > >
> > > <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> > > - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
> > > + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
> > > <modelVersion>4.0.0</modelVersion>
> > > <parent>
> > > <groupId>org.apache.axis2</groupId>
> > > @@ -98,7 +97,25 @@
> > > <version>${version}</version>
> > > <scope>test</scope>
> > > </dependency>
> > > + <dependency>
> > > + <groupId>wsdl4j</groupId>
> > > + <artifactId>wsdl4j</artifactId>
> > > + </dependency>
> > > + <dependency>
> > > + <groupId>com.sun.xml.ws</groupId>
> > > + <artifactId>jaxws-tools</artifactId>
> > > + <version>2.1.3</version>
> > > + </dependency>
> > > + <!-- If we dont include tools.jar as dependency, maven throws NoClassDefFound on wsGen run -->
> > > + <dependency>
> > > + <groupId>java</groupId>
> > > + <artifactId>tools</artifactId>
> > > + <version>$version</version>
> > > + <scope>system</scope>
> > > + <systemPath>${JAVA_HOME}/lib/tools.jar</systemPath>
> > > + </dependency>
> > > </dependencies>
> > > +
> > > <build>
> > > <sourceDirectory>src</sourceDirectory>
> > > <testSourceDirectory>test</testSourceDirectory>
> > > @@ -203,34 +220,39 @@
> > > <compilerVersion>1.5</compilerVersion>
> > > <source>1.5</source>
> > > <target>1.5</target>
> > > +
> > > </configuration>
> > > </plugin>
> > > <plugin>
> > > <groupId>org.apache.maven.plugins</groupId>
> > > <artifactId>maven-antrun-plugin</artifactId>
> > > +
> > > <executions>
> > > <execution>
> > > <id>gen-ts</id>
> > > <phase>generate-test-sources</phase>
> > > <configuration>
> > > - <tasks unless="maven.test.skip">
> > > + <tasks unless="maven.test.skip">
> > > <!-- Theres got to be a better way to do this -->
> > > <property name="schema.source.dir" value="test-resources/xsd"/>
> > > <property name="wsdl.source.dir" value="test-resources/wsdl"/>
> > > - <property name="schema.output.base.dir" value="target/schema"/>
> > > + <property name="schema.output.base.dir" value="target/schema"/>
> > > <property name="schema.generated.src.dir" value="${schema.output.base.dir}/src"/>
> > > <property name="schema.generated.classes.dir"
> > > value="${schema.output.base.dir}/classes"/>
> > > +
> > > <!-- make the dirs -->
> > > <mkdir dir="${schema.output.base.dir}"/>
> > > <mkdir dir="${schema.generated.src.dir}"/>
> > > <mkdir dir="${schema.generated.classes.dir}"/>
> > > +
> > > <!-- Run JAXB schema compiler with designated schemas -->
> > > <echo>Generating JAX-B classes from XSDs</echo>
> > >
> > > <echo>Generating java from echo.xsd</echo>
> > > <java classname="com.sun.tools.xjc.Driver" fork="true">
> > > <classpath refid="maven.runtime.classpath"/>
> > > +
> > > <classpath location="${compiled.classes.dir}"/>
> > > <arg line="-d ${schema.generated.src.dir} -quiet ${schema.source.dir}/echo.xsd"/>
> > > </java>
> > > @@ -266,7 +288,7 @@
> > > <classpath refid="maven.runtime.classpath"/>
> > > <classpath location="${compiled.classes.dir}"/>
> > > <arg line="-d ${schema.generated.src.dir} -quiet -wsdl ${wsdl.source.dir}/AddNumbers.wsdl"/>
> > > - </java>
> > > + </java>
> > > </tasks>
> > > </configuration>
> > > <goals>
> > > @@ -287,6 +309,22 @@
> > > <property name="addressing_version" value="${version}"/>
> > > <ant antfile="build.xml" inheritall="true" inheritrefs="true"
> > > dir="." target="build-repo"/>
> > > +
> > > + <property name="compile_classpath" refid="maven.compile.classpath" />
> > > + <property name="runtime_classpath" refid="maven.runtime.classpath" />
> > > + <property name="test_classpath" refid="maven.test.classpath" />
> > > + <property name="plugin_classpath" refid="maven.plugin.classpath" />
> > > +
> > > + <!-- Defining wsGen task -->
> > > + <taskdef name="wsgen" loaderRef="refwsgen" classname="com.sun.tools.ws.ant.WsGen">
> > > + <classpath>
> > > + <path refid="maven.runtime.classpath" />
> > > + <path refid="maven.compile.classpath" />
> > > + </classpath>
> > > + </taskdef>
> > > + <!-- Invoking test cases that need to generate artifacts using wsGen -->
> > > + <ant antfile="wsgen-tests.xml" inheritall="true" inheritrefs="true"
> > > + dir="." target="run-wsgen-tests"/>
> > > </tasks>
> > > </configuration>
> > > <goals>
> > > @@ -374,6 +412,13 @@
> > > <plugin>
> > > <groupId>org.apache.maven.plugins</groupId>
> > > <artifactId>maven-surefire-report-plugin</artifactId>
> > > + <reportSets>
> > > + <reportSet>
> > > + <reports>
> > > + <report>report-only</report>
> > > + </reports>
> > > + </reportSet>
> > > + </reportSets>
> > > </plugin>
> > > </plugins>
> > > </reporting>
> > >
> > > Modified: axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
> > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java?rev=963508&r1=963507&r2=963508&view=diff
> > > ==============================================================================
> > > --- axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java (original)
> > > +++ axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java Mon Jul 12 22:16:54 2010
> > > @@ -238,12 +238,27 @@ class ArtifactProcessor {
> > > wrapperClass = newValue;
> > > }
> > > }
> > > - if(cls==null && (type.equals("@WebFault")|| type.equals("faultInfo"))){
> > > +
> > > + if(cls==null &&
> > > + (type.equals("@RequestWrapper")|| type.equals("@ResponseWrapper")||type.equals("@WebFault")|| type.equals("faultInfo"))){
> > > +
> > > + //Support for Fault Bean Generation
> > > //As per JAX-WS 2.2 Specification section 3.7 an application programmer can choose not to
> > > //package the faultBeans, if we have reached this point in the code then user has choosen
> > > //not to package the fault bean. If there is a cache of generated artifacts available then
> > > //lets look for the missing faultBean there.
> > > -
> > > +
> > > + //Support for Wrapper Bean Generation
> > > + //As per JAX-WS 2.2 Specificaiton section 3.6.2.1 pg 41 an application programmer does not use
> > > + //the wrapper bean classes, so the application need not package these classes. If we have reached
> > > + //this point in the code then user has choosen not to package these beans.
> > > +
> > > + //NOTE:If we find Generated artifacts from cache this guarantees that we will not use
> > > + //DocLitWrappedMinimum marshaller code. The advantage of normal DocLitWrappedMarshaller is
> > > + //that it is very robust and has support of lot more datatypes than in DocLitWrappedMinimum.
> > > + if(log.isDebugEnabled()){
> > > + log.debug("Adding cache to classpath");
> > > + }
> > > ClassFinderFactory cff =
> > > (ClassFinderFactory)FactoryRegistry.getFactory(ClassFinderFactory.class);
> > > ClassFinder cf = cff.getClassFinder();
> > > @@ -317,11 +332,26 @@ class ArtifactProcessor {
> > > if (cls2 == null) {
> > > cls2 = loadClassOrNull(defaultValue, altClassLoader);
> > > }
> > > - if(cls2==null && (type.equals("faultInfo")|| type.equals("@WebFault"))){
> > > - //As per JAX-WS 2.2 Specification section 3.7 an application programmer can choose not to
> > > - //package the faultBeans, if we have reached this point in the code then user has choosen
> > > - //not to package the fault bean. If there is a cache of generated artifacts available then
> > > - //lets look for the missing faultBean there.
> > > + if(cls2==null &&
> > > + (type.equals("@RequestWrapper")|| type.equals("@ResponseWrapper")||type.equals("@WebFault")|| type.equals("faultInfo"))){
> > > +
> > > + //Support for Fault Bean Generation
> > > + //As per JAX-WS 2.2 Specification section 3.7 an application programmer can choose not to
> > > + //package the faultBeans, if we have reached this point in the code then user has choosen
> > > + //not to package the fault bean. If there is a cache of generated artifacts available then
> > > + //lets look for the missing faultBean there.
> > > +
> > > + //Support for Wrapper Bean Generation
> > > + //As per JAX-WS 2.2 Specificaiton section 3.6.2.1 pg 41 an application programmer does not use
> > > + //the wrapper bean classes, so the application need not package these classes. If we have reached
> > > + //this point in the code then user has choosen not to package these beans.
> > > +
> > > + //NOTE:If we find Generated artifacts from cache this guarantees that we will not use
> > > + //DocLitWrappedMinimum marshaller code. The advantage of normal DocLitWrappedMarshaller is
> > > + //that it is very robust and has support of lot more datatypes than in DocLitWrappedMinimum.
> > > + if(log.isDebugEnabled()){
> > > + log.debug("Adding cache to classpath");
> > > + }
> > > if(log.isDebugEnabled()){
> > > log.debug("Adding cache to classpath");
> > > }
> > >
> > > Added: axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
> > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java?rev=963508&view=auto
> > > ==============================================================================
> > > --- axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java (added)
> > > +++ axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java Mon Jul 12 22:16:54 2010
> > > @@ -0,0 +1,18 @@
> > > +
> > > +package org.apache.axis2.jaxws.wrapper.beans;
> > > +
> > > +import javax.xml.ws.WebFault;
> > > +
> > > +@WebFault(name = "AddNumbersFault", targetNamespace = "http://org/test/addnumbers")
> > > +public class AddNumbersException extends Exception
> > > +{
> > > +
> > > + private String message = null;
> > > + public AddNumbersException(){}
> > > + public AddNumbersException(String message){
> > > + this.message = message;
> > > + }
> > > + public String getInfo(){
> > > + return message;
> > > + }
> > > +}
> > >
> > > Added: axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
> > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java?rev=963508&view=auto
> > > ==============================================================================
> > > --- axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java (added)
> > > +++ axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java Mon Jul 12 22:16:54 2010
> > > @@ -0,0 +1,15 @@
> > > +package org.apache.axis2.jaxws.wrapper.beans;
> > > +
> > > +
> > > +
> > > +@javax.jws.WebService (targetNamespace="http://org/test/addnumbers", serviceName="AddNumbersService", portName="AddNumbersPort")
> > > +public class AddNumbersService{
> > > +
> > > + public int addNumbers(int arg0, int arg1) throws AddNumbersException {
> > > + if(arg0+arg1<0){
> > > + throw new AddNumbersException("sum is less than 0");
> > > + }
> > > + return arg0+arg1;
> > > + }
> > > +
> > > +}
> > > \ No newline at end of file
> > >
> > > Added: axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
> > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java?rev=963508&view=auto
> > > ==============================================================================
> > > --- axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java (added)
> > > +++ axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java Mon Jul 12 22:16:54 2010
> > > @@ -0,0 +1,114 @@
> > > +/**
> > > + *
> > > + */
> > > +package org.apache.axis2.jaxws.wrapper.beans;
> > > +
> > > +
> > > +import org.apache.axis2.jaxws.Constants;
> > > +import org.apache.axis2.jaxws.description.DescriptionFactory;
> > > +import org.apache.axis2.jaxws.description.EndpointDescription;
> > > +import org.apache.axis2.jaxws.description.EndpointDescriptionJava;
> > > +import org.apache.axis2.jaxws.description.OperationDescription;
> > > +import org.apache.axis2.jaxws.description.ServiceDescription;
> > > +import org.apache.axis2.jaxws.marshaller.MethodMarshaller;
> > > +import org.apache.axis2.jaxws.marshaller.factory.MethodMarshallerFactory;
> > > +import org.apache.axis2.jaxws.marshaller.impl.alt.DocLitWrappedMinimalMethodMarshaller;
> > > +import org.apache.axis2.jaxws.unitTest.TestLogger;
> > > +
> > > +import java.io.File;
> > > +
> > > +import junit.framework.TestCase;
> > > +
> > > +public class WrapperBeanMarshallTests extends TestCase {
> > > + /**
> > > + * This is the negative test case, when we do not use generated artifacts from cache
> > > + * and user did not package wrapper beans, we should see use of DocLitWrappedMinumumMarshaller.
> > > + */
> > > + public void testGetMarshallerOperationDescriptionBooleanNegative() {
> > > + TestLogger.logger.debug("---------------------------------------");
> > > + TestLogger.logger.debug("test: " + getName());
> > > +
> > > + String cache_location = "/target/wscache/classes";
> > > + try{
> > > + String baseDir = new File(System.getProperty("basedir",".")).getCanonicalPath();
> > > + cache_location = new File(baseDir+cache_location).getAbsolutePath();
> > > + TestLogger.logger.debug("cache location ="+cache_location);
> > > +
> > > + //Get EndpointDescription.
> > > + //Set location on AxisConfiguraiton.
> > > + Class sei = AddNumbersService.class;
> > > + EndpointDescription description = getEndpointDesc(sei);
> > > + TestLogger.logger.debug("description objects where created successfully");
> > > + OperationDescription[] ops =description.getEndpointInterfaceDescription().getOperations();
> > > + assertNotNull( "OperationDescriptions where null", ops);
> > > + assertTrue("No Operation Descriptions where found", ops.length>0);
> > > + OperationDescription op = ops[0];
> > > + TestLogger.logger.debug("operation found, java methodName="+op.getJavaMethodName());
> > > + //Don not Set cache on AxisConfiguration.
> > > + //get Marshaller, verify its not DoclitWrappedMinimum.
> > > + TestLogger.logger.debug("ws_cache location NOT set on AxisConfigContext, location="+cache_location);
> > > + MethodMarshaller mm = MethodMarshallerFactory.getMarshaller(op, false);
> > > + assertNotNull("getMarshaller returned null", mm );
> > > + TestLogger.logger.debug("MethodMarshaller was created, type="+mm.getClass().getName());
> > > + assertTrue("Generated artifacts not found, Method marshaller should be DocLitWrappedMinimumMarshaller", (mm instanceof DocLitWrappedMinimalMethodMarshaller));
> > > + }catch(Exception e){
> > > + TestLogger.logger.debug("Exception ="+e.getMessage());
> > > + fail(e.getMessage());
> > > + }
> > > +
> > > + }
> > > + /**
> > > + * In this test case user did not package wrapper beans but we add generated artifacts from cache, we should see use of
> > > + * DocLitWrappedMarshaller.
> > > + * Test method for {@link org.apache.axis2.jaxws.marshaller.factory.MethodMarshallerFactory#getMarshaller(org.apache.axis2.jaxws.description.OperationDescription, boolean)}.
> > > + */
> > > + public void testGetMarshallerOperationDescriptionBoolean() {
> > > + TestLogger.logger.debug("---------------------------------------");
> > > + TestLogger.logger.debug("test: " + getName());
> > > +
> > > + String cache_location = "/target/wscache/classes";
> > > + try{
> > > + String baseDir = new File(System.getProperty("basedir",".")).getCanonicalPath();
> > > + cache_location = new File(baseDir+cache_location).getAbsolutePath();
> > > + TestLogger.logger.debug("cache location ="+cache_location);
> > > +
> > > + //Get EndpointDescription.
> > > + //Set location on AxisConfiguraiton.
> > > + Class sei = AddNumbersService.class;
> > > + EndpointDescription description = getEndpointDesc(sei);
> > > + TestLogger.logger.debug("description objects where created successfully");
> > > + OperationDescription[] ops =description.getEndpointInterfaceDescription().getOperations();
> > > + assertNotNull( "OperationDescriptions where null", ops);
> > > + assertTrue("No Operation Descriptions where found", ops.length>0);
> > > + OperationDescription op = ops[0];
> > > + TestLogger.logger.debug("operation found, java methodName="+op.getJavaMethodName());
> > > + //Set cache on AxisConfiguration.
> > > + //get Marshaller, verify its not DoclitWrappedMinimum.
> > > + description.getServiceDescription().getAxisConfigContext().setProperty(Constants.WS_CACHE, cache_location);
> > > + TestLogger.logger.debug("ws_cache location set on AxisConfigContext, location="+cache_location);
> > > + MethodMarshaller mm = MethodMarshallerFactory.getMarshaller(op, false);
> > > + assertNotNull("getMarshaller returned null", mm );
> > > + TestLogger.logger.debug("MethodMarshaller was created, type="+mm.getClass().getName());
> > > + assertTrue("Generated artifacts are in cache, Method marshaller should not be DocLitWrappedMinimumMarshaller", !(mm instanceof DocLitWrappedMinimalMethodMarshaller));
> > > + }catch(Exception e){
> > > + TestLogger.logger.debug("Exception ="+e.getMessage());
> > > + fail(e.getMessage());
> > > + }
> > > +
> > > + }
> > > +
> > > + private EndpointDescription getEndpointDesc(Class implementationClass) {
> > > + // Use the description factory directly; this will be done within the JAX-WS runtime
> > > + ServiceDescription serviceDesc =
> > > + DescriptionFactory.createServiceDescription(implementationClass);
> > > + assertNotNull(serviceDesc);
> > > +
> > > + EndpointDescription[] endpointDesc = serviceDesc.getEndpointDescriptions();
> > > + assertNotNull(endpointDesc);
> > > + assertEquals(1, endpointDesc.length);
> > > +
> > > + // TODO: How will the JAX-WS dispatcher get the appropriate port (i.e. endpoint)? Currently assumes [0]
> > > + EndpointDescription testEndpointDesc = endpointDesc[0];
> > > + return testEndpointDesc;
> > > + }
> > > +}
> > >
> > > Added: axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml
> > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml?rev=963508&view=auto
> > > ==============================================================================
> > > --- axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml (added)
> > > +++ axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml Mon Jul 12 22:16:54 2010
> > > @@ -0,0 +1,34 @@
> > > +<?xml version="1.0" encoding="UTF-8"?>
> > > +
> > > +<project basedir="." default="run-wsgen-tests" name="wsgen-tests">
> > > +
> > > + <property name="wscache.output.base.dir" value="target/wscache" />
> > > + <property name="wscache.generated.src.dir" value="${wscache.output.base.dir}/src" />
> > > + <property name="wscache.generated.classes.dir" value="${wscache.output.base.dir}/classes" />
> > > + <property name="compile.test.classes" value="target/test-classes" />
> > > +
> > > +
> > > + <target name="run-wsgen-tests" depends="wrapper-beans"/>
> > > +
> > > +
> > > + <target name="create-cache">
> > > + <mkdir dir="${wscache.output.base.dir}" />
> > > + <mkdir dir="${wscache.generated.src.dir}" />
> > > + <mkdir dir="${wscache.generated.classes.dir}" />
> > > + </target>
> > > +
> > > + <target name="wrapper-beans" depends="create-cache">
> > > + <echo>Generating artifacts for org.apache.axis2.jaxws.wrapper.beans.AddNumbersService </echo>
> > > + <wsgen
> > > + sei="org.apache.axis2.jaxws.wrapper.beans.AddNumbersService"
> > > + destdir="${wscache.generated.classes.dir}"
> > > + resourcedestdir="${wscache.generated.src.dir}"
> > > + keep="false"
> > > + verbose="false"
> > > + genwsdl="true">
> > > + <classpath>
> > > + <pathelement path="${compile.test.classes}" />
> > > + </classpath>
> > > + </wsgen>
> > > + </target>
> > > +</project>
> > > \ No newline at end of file
> > >
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
> > For additional commands, e-mail: java-dev-help@axis.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-dev-help@axis.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org
Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws:
./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/
test/org/apache/axis2/jaxws/wrapper/ test/org/apache/axis2/jaxws/wrapper/beans/
Posted by Jarek Gawor <jg...@gmail.com>.
Just a couple of thoughts:
1) Since you already have wsgen-tests.xml ant script to run the wsgen
you could setup the appropriate classpath to the tools.jar or
classes.jar or whatever in it. You just might need to fork the ant
process.
2) I don't think it's that horrible to commit some generate code
especially if there isn't too much of it and the test case is
important. Besides, Axis2 already has some generated code checked it.
Jarek
On Wed, Jul 14, 2010 at 4:00 PM, Nikhil V Thaker
<ni...@us.ibm.com> wrote:
>
> Yes Andreas,
> I am running antrun plugin as the wsGen plugin has errors and is not fully matured, here's the URL that explains the issue I ran into http://jira.codehaus.org/browse/MNG-3586.
>
> So since I cannot run wsGen or cannot include generated artifacts I will just remove the test case. I will commit the changes soon.
>
> Regards,
>
> Nikhil Thaker
> office: 919 254 9964
> nvthaker@us.ibm.com
>
>
> Andreas Veithen <an...@gmail.com>
>
> 07/14/2010 02:48 PM
>
> Please respond to
> java-dev@axis.apache.org
> To
> java-dev@axis.apache.org
> cc
> Subject
> Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws: ./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ test/org/apache/axis2/jaxws/wrapper/ test/org/apache/axis2/jaxws/wrapper/beans/
>
>
>
>
> No, you are using the antrun plugin to execute the wsgen ant task.
> What I meant was to use a real Maven plugin (either the one from
> java.net or the one from CXF).
>
> -1 to commit any generated stuff into SVN.
>
> Andreas
>
> On Wed, Jul 14, 2010 at 21:42, Nikhil V Thaker
> <ni...@us.ibm.com> wrote:
> >
> > Andreas - I had to add the tools.jar bit because maven plugin for wsGen gave NoClassDef Found errors for classes packaged in tools.jar.
> >
> > Since this is causing a problem I will just package the generated artifacts and remove the wsGen dependency.
> >
> > Thanks,
> >
> > Nikhil Thaker
> > office: 919 254 9964
> > nvthaker@us.ibm.com
> >
> >
> > Andreas Veithen <an...@gmail.com>
> >
> > 07/14/2010 01:44 PM
> >
> > Please respond to
> > java-dev@axis.apache.org
> > To
> > java-dev@axis.apache.org
> > cc
> > Subject
> > Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws: ./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ test/org/apache/axis2/jaxws/wrapper/ test/org/apache/axis2/jaxws/wrapper/beans/
> >
> >
> >
> >
> > Nikhil,
> >
> > I have some issues with the tools and jaxws-tools dependencies
> > introduced by this change:
> >
> > * The change causes a build failure in Hudson. There will also be
> > additional issues with tools.jar, because the way to declare this as a
> > system dependency varies from one JDK to another. For example, I
> > remember that on Mac OS X, it is completely different than on other
> > JDKs.
> >
> > * I don't like the fact that jaxws-tools becomes a dependency of
> > axis2-jaxws in scope compile, because it looks like this is only
> > needed during the build and/or during the tests.
> >
> > I didn't review the change in detail, but wouldn't it be smarter to
> > use one of the existing Maven plugins to do the wsgen stuff? They will
> > take care of the tools.jar stuff as well.
> >
> > Andreas
> >
> > On Tue, Jul 13, 2010 at 00:16, <nt...@apache.org> wrote:
> > > Author: nthaker
> > > Date: Mon Jul 12 22:16:54 2010
> > > New Revision: 963508
> > >
> > > URL: http://svn.apache.org/viewvc?rev=963508&view=rev
> > > Log:
> > > AXIS2-4775
> > > This change ensures that we will use Request and Response wrapper Bean packaged by customer or we will Generate Wrappers if they are not packaged.
> > >
> > > Added:
> > > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/
> > > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/
> > > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
> > > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
> > > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
> > > axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml
> > > Modified:
> > > axis/axis2/java/core/trunk/modules/jaxws/pom.xml
> > > axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
> > >
> > > Modified: axis/axis2/java/core/trunk/modules/jaxws/pom.xml
> > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/pom.xml?rev=963508&r1=963507&r2=963508&view=diff
> > > ==============================================================================
> > > --- axis/axis2/java/core/trunk/modules/jaxws/pom.xml (original)
> > > +++ axis/axis2/java/core/trunk/modules/jaxws/pom.xml Mon Jul 12 22:16:54 2010
> > > @@ -1,5 +1,4 @@
> > > <?xml version="1.0" encoding="UTF-8"?>
> > > -
> > > <!-- > ~ Licensed to the Apache Software Foundation (ASF) under one
> > > ~ or more contributor license agreements. See the NOTICE file
> > > @@ -20,7 +19,7 @@
> > > -->
> > >
> > > <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> > > - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
> > > + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
> > > <modelVersion>4.0.0</modelVersion>
> > > <parent>
> > > <groupId>org.apache.axis2</groupId>
> > > @@ -98,7 +97,25 @@
> > > <version>${version}</version>
> > > <scope>test</scope>
> > > </dependency>
> > > + <dependency>
> > > + <groupId>wsdl4j</groupId>
> > > + <artifactId>wsdl4j</artifactId>
> > > + </dependency>
> > > + <dependency>
> > > + <groupId>com.sun.xml.ws</groupId>
> > > + <artifactId>jaxws-tools</artifactId>
> > > + <version>2.1.3</version>
> > > + </dependency>
> > > + <!-- If we dont include tools.jar as dependency, maven throws NoClassDefFound on wsGen run -->
> > > + <dependency>
> > > + <groupId>java</groupId>
> > > + <artifactId>tools</artifactId>
> > > + <version>$version</version>
> > > + <scope>system</scope>
> > > + <systemPath>${JAVA_HOME}/lib/tools.jar</systemPath>
> > > + </dependency>
> > > </dependencies>
> > > +
> > > <build>
> > > <sourceDirectory>src</sourceDirectory>
> > > <testSourceDirectory>test</testSourceDirectory>
> > > @@ -203,34 +220,39 @@
> > > <compilerVersion>1.5</compilerVersion>
> > > <source>1.5</source>
> > > <target>1.5</target>
> > > +
> > > </configuration>
> > > </plugin>
> > > <plugin>
> > > <groupId>org.apache.maven.plugins</groupId>
> > > <artifactId>maven-antrun-plugin</artifactId>
> > > +
> > > <executions>
> > > <execution>
> > > <id>gen-ts</id>
> > > <phase>generate-test-sources</phase>
> > > <configuration>
> > > - <tasks unless="maven.test.skip">
> > > + <tasks unless="maven.test.skip">
> > > <!-- Theres got to be a better way to do this -->
> > > <property name="schema.source.dir" value="test-resources/xsd"/>
> > > <property name="wsdl.source.dir" value="test-resources/wsdl"/>
> > > - <property name="schema.output.base.dir" value="target/schema"/>
> > > + <property name="schema.output.base.dir" value="target/schema"/>
> > > <property name="schema.generated.src.dir" value="${schema.output.base.dir}/src"/>
> > > <property name="schema.generated.classes.dir"
> > > value="${schema.output.base.dir}/classes"/>
> > > +
> > > <!-- make the dirs -->
> > > <mkdir dir="${schema.output.base.dir}"/>
> > > <mkdir dir="${schema.generated.src.dir}"/>
> > > <mkdir dir="${schema.generated.classes.dir}"/>
> > > +
> > > <!-- Run JAXB schema compiler with designated schemas -->
> > > <echo>Generating JAX-B classes from XSDs</echo>
> > >
> > > <echo>Generating java from echo.xsd</echo>
> > > <java classname="com.sun.tools.xjc.Driver" fork="true">
> > > <classpath refid="maven.runtime.classpath"/>
> > > +
> > > <classpath location="${compiled.classes.dir}"/>
> > > <arg line="-d ${schema.generated.src.dir} -quiet ${schema.source.dir}/echo.xsd"/>
> > > </java>
> > > @@ -266,7 +288,7 @@
> > > <classpath refid="maven.runtime.classpath"/>
> > > <classpath location="${compiled.classes.dir}"/>
> > > <arg line="-d ${schema.generated.src.dir} -quiet -wsdl ${wsdl.source.dir}/AddNumbers.wsdl"/>
> > > - </java>
> > > + </java>
> > > </tasks>
> > > </configuration>
> > > <goals>
> > > @@ -287,6 +309,22 @@
> > > <property name="addressing_version" value="${version}"/>
> > > <ant antfile="build.xml" inheritall="true" inheritrefs="true"
> > > dir="." target="build-repo"/>
> > > +
> > > + <property name="compile_classpath" refid="maven.compile.classpath" />
> > > + <property name="runtime_classpath" refid="maven.runtime.classpath" />
> > > + <property name="test_classpath" refid="maven.test.classpath" />
> > > + <property name="plugin_classpath" refid="maven.plugin.classpath" />
> > > +
> > > + <!-- Defining wsGen task -->
> > > + <taskdef name="wsgen" loaderRef="refwsgen" classname="com.sun.tools.ws.ant.WsGen">
> > > + <classpath>
> > > + <path refid="maven.runtime.classpath" />
> > > + <path refid="maven.compile.classpath" />
> > > + </classpath>
> > > + </taskdef>
> > > + <!-- Invoking test cases that need to generate artifacts using wsGen -->
> > > + <ant antfile="wsgen-tests.xml" inheritall="true" inheritrefs="true"
> > > + dir="." target="run-wsgen-tests"/>
> > > </tasks>
> > > </configuration>
> > > <goals>
> > > @@ -374,6 +412,13 @@
> > > <plugin>
> > > <groupId>org.apache.maven.plugins</groupId>
> > > <artifactId>maven-surefire-report-plugin</artifactId>
> > > + <reportSets>
> > > + <reportSet>
> > > + <reports>
> > > + <report>report-only</report>
> > > + </reports>
> > > + </reportSet>
> > > + </reportSets>
> > > </plugin>
> > > </plugins>
> > > </reporting>
> > >
> > > Modified: axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
> > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java?rev=963508&r1=963507&r2=963508&view=diff
> > > ==============================================================================
> > > --- axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java (original)
> > > +++ axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java Mon Jul 12 22:16:54 2010
> > > @@ -238,12 +238,27 @@ class ArtifactProcessor {
> > > wrapperClass = newValue;
> > > }
> > > }
> > > - if(cls==null && (type.equals("@WebFault")|| type.equals("faultInfo"))){
> > > +
> > > + if(cls==null &&
> > > + (type.equals("@RequestWrapper")|| type.equals("@ResponseWrapper")||type.equals("@WebFault")|| type.equals("faultInfo"))){
> > > +
> > > + //Support for Fault Bean Generation
> > > //As per JAX-WS 2.2 Specification section 3.7 an application programmer can choose not to
> > > //package the faultBeans, if we have reached this point in the code then user has choosen
> > > //not to package the fault bean. If there is a cache of generated artifacts available then
> > > //lets look for the missing faultBean there.
> > > -
> > > +
> > > + //Support for Wrapper Bean Generation
> > > + //As per JAX-WS 2.2 Specificaiton section 3.6.2.1 pg 41 an application programmer does not use
> > > + //the wrapper bean classes, so the application need not package these classes. If we have reached
> > > + //this point in the code then user has choosen not to package these beans.
> > > +
> > > + //NOTE:If we find Generated artifacts from cache this guarantees that we will not use
> > > + //DocLitWrappedMinimum marshaller code. The advantage of normal DocLitWrappedMarshaller is
> > > + //that it is very robust and has support of lot more datatypes than in DocLitWrappedMinimum.
> > > + if(log.isDebugEnabled()){
> > > + log.debug("Adding cache to classpath");
> > > + }
> > > ClassFinderFactory cff =
> > > (ClassFinderFactory)FactoryRegistry.getFactory(ClassFinderFactory.class);
> > > ClassFinder cf = cff.getClassFinder();
> > > @@ -317,11 +332,26 @@ class ArtifactProcessor {
> > > if (cls2 == null) {
> > > cls2 = loadClassOrNull(defaultValue, altClassLoader);
> > > }
> > > - if(cls2==null && (type.equals("faultInfo")|| type.equals("@WebFault"))){
> > > - //As per JAX-WS 2.2 Specification section 3.7 an application programmer can choose not to
> > > - //package the faultBeans, if we have reached this point in the code then user has choosen
> > > - //not to package the fault bean. If there is a cache of generated artifacts available then
> > > - //lets look for the missing faultBean there.
> > > + if(cls2==null &&
> > > + (type.equals("@RequestWrapper")|| type.equals("@ResponseWrapper")||type.equals("@WebFault")|| type.equals("faultInfo"))){
> > > +
> > > + //Support for Fault Bean Generation
> > > + //As per JAX-WS 2.2 Specification section 3.7 an application programmer can choose not to
> > > + //package the faultBeans, if we have reached this point in the code then user has choosen
> > > + //not to package the fault bean. If there is a cache of generated artifacts available then
> > > + //lets look for the missing faultBean there.
> > > +
> > > + //Support for Wrapper Bean Generation
> > > + //As per JAX-WS 2.2 Specificaiton section 3.6.2.1 pg 41 an application programmer does not use
> > > + //the wrapper bean classes, so the application need not package these classes. If we have reached
> > > + //this point in the code then user has choosen not to package these beans.
> > > +
> > > + //NOTE:If we find Generated artifacts from cache this guarantees that we will not use
> > > + //DocLitWrappedMinimum marshaller code. The advantage of normal DocLitWrappedMarshaller is
> > > + //that it is very robust and has support of lot more datatypes than in DocLitWrappedMinimum.
> > > + if(log.isDebugEnabled()){
> > > + log.debug("Adding cache to classpath");
> > > + }
> > > if(log.isDebugEnabled()){
> > > log.debug("Adding cache to classpath");
> > > }
> > >
> > > Added: axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
> > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java?rev=963508&view=auto
> > > ==============================================================================
> > > --- axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java (added)
> > > +++ axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java Mon Jul 12 22:16:54 2010
> > > @@ -0,0 +1,18 @@
> > > +
> > > +package org.apache.axis2.jaxws.wrapper.beans;
> > > +
> > > +import javax.xml.ws.WebFault;
> > > +
> > > +@WebFault(name = "AddNumbersFault", targetNamespace = "http://org/test/addnumbers")
> > > +public class AddNumbersException extends Exception
> > > +{
> > > +
> > > + private String message = null;
> > > + public AddNumbersException(){}
> > > + public AddNumbersException(String message){
> > > + this.message = message;
> > > + }
> > > + public String getInfo(){
> > > + return message;
> > > + }
> > > +}
> > >
> > > Added: axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
> > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java?rev=963508&view=auto
> > > ==============================================================================
> > > --- axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java (added)
> > > +++ axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java Mon Jul 12 22:16:54 2010
> > > @@ -0,0 +1,15 @@
> > > +package org.apache.axis2.jaxws.wrapper.beans;
> > > +
> > > +
> > > +
> > > +@javax.jws.WebService (targetNamespace="http://org/test/addnumbers", serviceName="AddNumbersService", portName="AddNumbersPort")
> > > +public class AddNumbersService{
> > > +
> > > + public int addNumbers(int arg0, int arg1) throws AddNumbersException {
> > > + if(arg0+arg1<0){
> > > + throw new AddNumbersException("sum is less than 0");
> > > + }
> > > + return arg0+arg1;
> > > + }
> > > +
> > > +}
> > > \ No newline at end of file
> > >
> > > Added: axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
> > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java?rev=963508&view=auto
> > > ==============================================================================
> > > --- axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java (added)
> > > +++ axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java Mon Jul 12 22:16:54 2010
> > > @@ -0,0 +1,114 @@
> > > +/**
> > > + *
> > > + */
> > > +package org.apache.axis2.jaxws.wrapper.beans;
> > > +
> > > +
> > > +import org.apache.axis2.jaxws.Constants;
> > > +import org.apache.axis2.jaxws.description.DescriptionFactory;
> > > +import org.apache.axis2.jaxws.description.EndpointDescription;
> > > +import org.apache.axis2.jaxws.description.EndpointDescriptionJava;
> > > +import org.apache.axis2.jaxws.description.OperationDescription;
> > > +import org.apache.axis2.jaxws.description.ServiceDescription;
> > > +import org.apache.axis2.jaxws.marshaller.MethodMarshaller;
> > > +import org.apache.axis2.jaxws.marshaller.factory.MethodMarshallerFactory;
> > > +import org.apache.axis2.jaxws.marshaller.impl.alt.DocLitWrappedMinimalMethodMarshaller;
> > > +import org.apache.axis2.jaxws.unitTest.TestLogger;
> > > +
> > > +import java.io.File;
> > > +
> > > +import junit.framework.TestCase;
> > > +
> > > +public class WrapperBeanMarshallTests extends TestCase {
> > > + /**
> > > + * This is the negative test case, when we do not use generated artifacts from cache
> > > + * and user did not package wrapper beans, we should see use of DocLitWrappedMinumumMarshaller.
> > > + */
> > > + public void testGetMarshallerOperationDescriptionBooleanNegative() {
> > > + TestLogger.logger.debug("---------------------------------------");
> > > + TestLogger.logger.debug("test: " + getName());
> > > +
> > > + String cache_location = "/target/wscache/classes";
> > > + try{
> > > + String baseDir = new File(System.getProperty("basedir",".")).getCanonicalPath();
> > > + cache_location = new File(baseDir+cache_location).getAbsolutePath();
> > > + TestLogger.logger.debug("cache location ="+cache_location);
> > > +
> > > + //Get EndpointDescription.
> > > + //Set location on AxisConfiguraiton.
> > > + Class sei = AddNumbersService.class;
> > > + EndpointDescription description = getEndpointDesc(sei);
> > > + TestLogger.logger.debug("description objects where created successfully");
> > > + OperationDescription[] ops =description.getEndpointInterfaceDescription().getOperations();
> > > + assertNotNull( "OperationDescriptions where null", ops);
> > > + assertTrue("No Operation Descriptions where found", ops.length>0);
> > > + OperationDescription op = ops[0];
> > > + TestLogger.logger.debug("operation found, java methodName="+op.getJavaMethodName());
> > > + //Don not Set cache on AxisConfiguration.
> > > + //get Marshaller, verify its not DoclitWrappedMinimum.
> > > + TestLogger.logger.debug("ws_cache location NOT set on AxisConfigContext, location="+cache_location);
> > > + MethodMarshaller mm = MethodMarshallerFactory.getMarshaller(op, false);
> > > + assertNotNull("getMarshaller returned null", mm );
> > > + TestLogger.logger.debug("MethodMarshaller was created, type="+mm.getClass().getName());
> > > + assertTrue("Generated artifacts not found, Method marshaller should be DocLitWrappedMinimumMarshaller", (mm instanceof DocLitWrappedMinimalMethodMarshaller));
> > > + }catch(Exception e){
> > > + TestLogger.logger.debug("Exception ="+e.getMessage());
> > > + fail(e.getMessage());
> > > + }
> > > +
> > > + }
> > > + /**
> > > + * In this test case user did not package wrapper beans but we add generated artifacts from cache, we should see use of
> > > + * DocLitWrappedMarshaller.
> > > + * Test method for {@link org.apache.axis2.jaxws.marshaller.factory.MethodMarshallerFactory#getMarshaller(org.apache.axis2.jaxws.description.OperationDescription, boolean)}.
> > > + */
> > > + public void testGetMarshallerOperationDescriptionBoolean() {
> > > + TestLogger.logger.debug("---------------------------------------");
> > > + TestLogger.logger.debug("test: " + getName());
> > > +
> > > + String cache_location = "/target/wscache/classes";
> > > + try{
> > > + String baseDir = new File(System.getProperty("basedir",".")).getCanonicalPath();
> > > + cache_location = new File(baseDir+cache_location).getAbsolutePath();
> > > + TestLogger.logger.debug("cache location ="+cache_location);
> > > +
> > > + //Get EndpointDescription.
> > > + //Set location on AxisConfiguraiton.
> > > + Class sei = AddNumbersService.class;
> > > + EndpointDescription description = getEndpointDesc(sei);
> > > + TestLogger.logger.debug("description objects where created successfully");
> > > + OperationDescription[] ops =description.getEndpointInterfaceDescription().getOperations();
> > > + assertNotNull( "OperationDescriptions where null", ops);
> > > + assertTrue("No Operation Descriptions where found", ops.length>0);
> > > + OperationDescription op = ops[0];
> > > + TestLogger.logger.debug("operation found, java methodName="+op.getJavaMethodName());
> > > + //Set cache on AxisConfiguration.
> > > + //get Marshaller, verify its not DoclitWrappedMinimum.
> > > + description.getServiceDescription().getAxisConfigContext().setProperty(Constants.WS_CACHE, cache_location);
> > > + TestLogger.logger.debug("ws_cache location set on AxisConfigContext, location="+cache_location);
> > > + MethodMarshaller mm = MethodMarshallerFactory.getMarshaller(op, false);
> > > + assertNotNull("getMarshaller returned null", mm );
> > > + TestLogger.logger.debug("MethodMarshaller was created, type="+mm.getClass().getName());
> > > + assertTrue("Generated artifacts are in cache, Method marshaller should not be DocLitWrappedMinimumMarshaller", !(mm instanceof DocLitWrappedMinimalMethodMarshaller));
> > > + }catch(Exception e){
> > > + TestLogger.logger.debug("Exception ="+e.getMessage());
> > > + fail(e.getMessage());
> > > + }
> > > +
> > > + }
> > > +
> > > + private EndpointDescription getEndpointDesc(Class implementationClass) {
> > > + // Use the description factory directly; this will be done within the JAX-WS runtime
> > > + ServiceDescription serviceDesc =
> > > + DescriptionFactory.createServiceDescription(implementationClass);
> > > + assertNotNull(serviceDesc);
> > > +
> > > + EndpointDescription[] endpointDesc = serviceDesc.getEndpointDescriptions();
> > > + assertNotNull(endpointDesc);
> > > + assertEquals(1, endpointDesc.length);
> > > +
> > > + // TODO: How will the JAX-WS dispatcher get the appropriate port (i.e. endpoint)? Currently assumes [0]
> > > + EndpointDescription testEndpointDesc = endpointDesc[0];
> > > + return testEndpointDesc;
> > > + }
> > > +}
> > >
> > > Added: axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml
> > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml?rev=963508&view=auto
> > > ==============================================================================
> > > --- axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml (added)
> > > +++ axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml Mon Jul 12 22:16:54 2010
> > > @@ -0,0 +1,34 @@
> > > +<?xml version="1.0" encoding="UTF-8"?>
> > > +
> > > +<project basedir="." default="run-wsgen-tests" name="wsgen-tests">
> > > +
> > > + <property name="wscache.output.base.dir" value="target/wscache" />
> > > + <property name="wscache.generated.src.dir" value="${wscache.output.base.dir}/src" />
> > > + <property name="wscache.generated.classes.dir" value="${wscache.output.base.dir}/classes" />
> > > + <property name="compile.test.classes" value="target/test-classes" />
> > > +
> > > +
> > > + <target name="run-wsgen-tests" depends="wrapper-beans"/>
> > > +
> > > +
> > > + <target name="create-cache">
> > > + <mkdir dir="${wscache.output.base.dir}" />
> > > + <mkdir dir="${wscache.generated.src.dir}" />
> > > + <mkdir dir="${wscache.generated.classes.dir}" />
> > > + </target>
> > > +
> > > + <target name="wrapper-beans" depends="create-cache">
> > > + <echo>Generating artifacts for org.apache.axis2.jaxws.wrapper.beans.AddNumbersService </echo>
> > > + <wsgen
> > > + sei="org.apache.axis2.jaxws.wrapper.beans.AddNumbersService"
> > > + destdir="${wscache.generated.classes.dir}"
> > > + resourcedestdir="${wscache.generated.src.dir}"
> > > + keep="false"
> > > + verbose="false"
> > > + genwsdl="true">
> > > + <classpath>
> > > + <pathelement path="${compile.test.classes}" />
> > > + </classpath>
> > > + </wsgen>
> > > + </target>
> > > +</project>
> > > \ No newline at end of file
> > >
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
> > For additional commands, e-mail: java-dev-help@axis.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-dev-help@axis.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org
Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws: ./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/
test/org/apache/axis2/jaxws/wrapper/ test/org/apache/axis2/jaxws/wrapper/beans/
Posted by Nikhil V Thaker <ni...@us.ibm.com>.
Andreas - Use of wsGen and Test case Changes have been backed out. There
should not be any dependency on jaxws-tools.jar and also reference to
tools.jar have been removed from pom. Changes in revision #964185.
Thanks,
Nikhil Thaker
office: 919 254 9964
nvthaker@us.ibm.com
Nikhil V Thaker/Columbus/IBM@IBMUS
07/14/2010 03:00 PM
Please respond to
java-dev@axis.apache.org
To
java-dev@axis.apache.org
cc
java-dev@axis.apache.org
Subject
Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws: ./
src/org/apache/axis2/jaxws/runtime/description/marshal/impl/
test/org/apache/axis2/jaxws/wrapper/
test/org/apache/axis2/jaxws/wrapper/beans/
Yes Andreas,
I am running antrun plugin as the wsGen plugin has errors and is not
fully matured, here's the URL that explains the issue I ran into
http://jira.codehaus.org/browse/MNG-3586.
So since I cannot run wsGen or cannot include generated artifacts I will
just remove the test case. I will commit the changes soon.
Regards,
Nikhil Thaker
office: 919 254 9964
nvthaker@us.ibm.com
Andreas Veithen <an...@gmail.com>
07/14/2010 02:48 PM
Please respond to
java-dev@axis.apache.org
To
java-dev@axis.apache.org
cc
Subject
Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws:
./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/
test/org/apache/axis2/jaxws/wrapper/
test/org/apache/axis2/jaxws/wrapper/beans/
No, you are using the antrun plugin to execute the wsgen ant task.
What I meant was to use a real Maven plugin (either the one from
java.net or the one from CXF).
-1 to commit any generated stuff into SVN.
Andreas
On Wed, Jul 14, 2010 at 21:42, Nikhil V Thaker
<ni...@us.ibm.com> wrote:
>
> Andreas - I had to add the tools.jar bit because maven plugin for wsGen
gave NoClassDef Found errors for classes packaged in tools.jar.
>
> Since this is causing a problem I will just package the generated
artifacts and remove the wsGen dependency.
>
> Thanks,
>
> Nikhil Thaker
> office: 919 254 9964
> nvthaker@us.ibm.com
>
>
> Andreas Veithen <an...@gmail.com>
>
> 07/14/2010 01:44 PM
>
> Please respond to
> java-dev@axis.apache.org
> To
> java-dev@axis.apache.org
> cc
> Subject
> Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws:
./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/
test/org/apache/axis2/jaxws/wrapper/
test/org/apache/axis2/jaxws/wrapper/beans/
>
>
>
>
> Nikhil,
>
> I have some issues with the tools and jaxws-tools dependencies
> introduced by this change:
>
> * The change causes a build failure in Hudson. There will also be
> additional issues with tools.jar, because the way to declare this as a
> system dependency varies from one JDK to another. For example, I
> remember that on Mac OS X, it is completely different than on other
> JDKs.
>
> * I don't like the fact that jaxws-tools becomes a dependency of
> axis2-jaxws in scope compile, because it looks like this is only
> needed during the build and/or during the tests.
>
> I didn't review the change in detail, but wouldn't it be smarter to
> use one of the existing Maven plugins to do the wsgen stuff? They will
> take care of the tools.jar stuff as well.
>
> Andreas
>
> On Tue, Jul 13, 2010 at 00:16, <nt...@apache.org> wrote:
> > Author: nthaker
> > Date: Mon Jul 12 22:16:54 2010
> > New Revision: 963508
> >
> > URL: http://svn.apache.org/viewvc?rev=963508&view=rev
> > Log:
> > AXIS2-4775
> > This change ensures that we will use Request and Response wrapper Bean
packaged by customer or we will Generate Wrappers if they are not
packaged.
> >
> > Added:
> >
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/
> >
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/
> >
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
> >
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
> >
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
> > axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml
> > Modified:
> > axis/axis2/java/core/trunk/modules/jaxws/pom.xml
> >
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
> >
> > Modified: axis/axis2/java/core/trunk/modules/jaxws/pom.xml
> > URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/pom.xml?rev=963508&r1=963507&r2=963508&view=diff
> >
==============================================================================
> > --- axis/axis2/java/core/trunk/modules/jaxws/pom.xml (original)
> > +++ axis/axis2/java/core/trunk/modules/jaxws/pom.xml Mon Jul 12
22:16:54 2010
> > @@ -1,5 +1,4 @@
> > <?xml version="1.0" encoding="UTF-8"?>
> > -
> > <!-- > ~ Licensed to the Apache Software Foundation (ASF) under one
> > ~ or more contributor license agreements. See the NOTICE file
> > @@ -20,7 +19,7 @@
> > -->
> >
> > <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"
> > - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
> > + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
> > <modelVersion>4.0.0</modelVersion>
> > <parent>
> > <groupId>org.apache.axis2</groupId>
> > @@ -98,7 +97,25 @@
> > <version>${version}</version>
> > <scope>test</scope>
> > </dependency>
> > + <dependency>
> > + <groupId>wsdl4j</groupId>
> > + <artifactId>wsdl4j</artifactId>
> > + </dependency>
> > + <dependency>
> > + <groupId>com.sun.xml.ws</groupId>
> > + <artifactId>jaxws-tools</artifactId>
> > + <version>2.1.3</version>
> > + </dependency>
> > + <!-- If we dont include tools.jar as dependency, maven throws
NoClassDefFound on wsGen run -->
> > + <dependency>
> > + <groupId>java</groupId>
> > + <artifactId>tools</artifactId>
> > + <version>$version</version>
> > + <scope>system</scope>
> > + <systemPath>${JAVA_HOME}/lib/tools.jar</systemPath>
> > + </dependency>
> > </dependencies>
> > +
> > <build>
> > <sourceDirectory>src</sourceDirectory>
> > <testSourceDirectory>test</testSourceDirectory>
> > @@ -203,34 +220,39 @@
> > <compilerVersion>1.5</compilerVersion>
> > <source>1.5</source>
> > <target>1.5</target>
> > +
> > </configuration>
> > </plugin>
> > <plugin>
> > <groupId>org.apache.maven.plugins</groupId>
> > <artifactId>maven-antrun-plugin</artifactId>
> > +
> > <executions>
> > <execution>
> > <id>gen-ts</id>
> > <phase>generate-test-sources</phase>
> > <configuration>
> > - <tasks unless="maven.test.skip">
> > + <tasks unless="maven.test.skip">
> > <!-- Theres got to be a better way to
do this -->
> > <property name="schema.source.dir"
value="test-resources/xsd"/>
> > <property name="wsdl.source.dir"
value="test-resources/wsdl"/>
> > - <property
name="schema.output.base.dir" value="target/schema"/>
> > + <property
name="schema.output.base.dir" value="target/schema"/>
> > <property
name="schema.generated.src.dir" value="${schema.output.base.dir}/src"/>
> > <property
name="schema.generated.classes.dir"
> > value="${schema.output.base.dir}/classes"/>
> > +
> > <!-- make the dirs -->
> > <mkdir
dir="${schema.output.base.dir}"/>
> > <mkdir
dir="${schema.generated.src.dir}"/>
> > <mkdir
dir="${schema.generated.classes.dir}"/>
> > +
> > <!-- Run JAXB schema compiler with
designated schemas -->
> > <echo>Generating JAX-B classes from
XSDs</echo>
> >
> > <echo>Generating java from
echo.xsd</echo>
> > <java
classname="com.sun.tools.xjc.Driver" fork="true">
> > <classpath
refid="maven.runtime.classpath"/>
> > +
> > <classpath
location="${compiled.classes.dir}"/>
> > <arg line="-d
${schema.generated.src.dir} -quiet ${schema.source.dir}/echo.xsd"/>
> > </java>
> > @@ -266,7 +288,7 @@
> > <classpath
refid="maven.runtime.classpath"/>
> > <classpath
location="${compiled.classes.dir}"/>
> > <arg line="-d
${schema.generated.src.dir} -quiet -wsdl
${wsdl.source.dir}/AddNumbers.wsdl"/>
> > - </java>
> > + </java>
> > </tasks>
> > </configuration>
> > <goals>
> > @@ -287,6 +309,22 @@
> > <property name="addressing_version"
value="${version}"/>
> > <ant antfile="build.xml"
inheritall="true" inheritrefs="true"
> > dir="." target="build-repo"/>
> > +
> > + <property name="compile_classpath" refid="maven.compile.classpath"
/>
> > + <property name="runtime_classpath" refid="maven.runtime.classpath"
/>
> > + <property name="test_classpath" refid="maven.test.classpath" />
> > + <property name="plugin_classpath" refid="maven.plugin.classpath" />
> > +
> > + <!-- Defining wsGen task -->
> > + <taskdef name="wsgen" loaderRef="refwsgen"
classname="com.sun.tools.ws.ant.WsGen">
> > + <classpath>
> > + <path refid="maven.runtime.classpath" />
> > + <path refid="maven.compile.classpath" />
> > + </classpath>
> > + </taskdef>
> > + <!--
Invoking test cases that need to generate artifacts using wsGen -->
> > + <ant antfile="wsgen-tests.xml"
inheritall="true" inheritrefs="true"
> > + dir="."
target="run-wsgen-tests"/>
> > </tasks>
> > </configuration>
> > <goals>
> > @@ -374,6 +412,13 @@
> > <plugin>
> > <groupId>org.apache.maven.plugins</groupId>
> > <artifactId>maven-surefire-report-plugin</artifactId>
> > + <reportSets>
> > + <reportSet>
> > + <reports>
> > + <report>report-only</report>
> > + </reports>
> > + </reportSet>
> > + </reportSets>
> > </plugin>
> > </plugins>
> > </reporting>
> >
> > Modified:
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
> > URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java?rev=963508&r1=963507&r2=963508&view=diff
> >
==============================================================================
> > ---
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
(original)
> > +++
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
Mon Jul 12 22:16:54 2010
> > @@ -238,12 +238,27 @@ class ArtifactProcessor {
> > wrapperClass = newValue;
> > }
> > }
> > - if(cls==null && (type.equals("@WebFault")||
type.equals("faultInfo"))){
> > +
> > + if(cls==null &&
> > + (type.equals("@RequestWrapper")||
type.equals("@ResponseWrapper")||type.equals("@WebFault")||
type.equals("faultInfo"))){
> > +
> > + //Support for Fault Bean Generation
> > //As per JAX-WS 2.2 Specification section
3.7 an application programmer can choose not to
> > //package the faultBeans, if we have
reached this point in the code then user has choosen
> > //not to package the fault bean. If there
is a cache of generated artifacts available then
> > //lets look for the missing faultBean
there.
> > -
> > +
> > + //Support for Wrapper Bean Generation
> > + //As per JAX-WS 2.2 Specificaiton section
3.6.2.1 pg 41 an application programmer does not use
> > + //the wrapper bean classes, so the
application need not package these classes. If we have reached
> > + //this point in the code then user has
choosen not to package these beans.
> > +
> > + //NOTE:If we find Generated artifacts
from cache this guarantees that we will not use
> > + //DocLitWrappedMinimum marshaller code.
The advantage of normal DocLitWrappedMarshaller is
> > + //that it is very robust and has support
of lot more datatypes than in DocLitWrappedMinimum.
> > + if(log.isDebugEnabled()){
> > + log.debug("Adding cache to
classpath");
> > + }
> > ClassFinderFactory cff =
> >
(ClassFinderFactory)FactoryRegistry.getFactory(ClassFinderFactory.class);
> > ClassFinder cf = cff.getClassFinder();
> > @@ -317,11 +332,26 @@ class ArtifactProcessor {
> > if (cls2 == null) {
> > cls2 = loadClassOrNull(defaultValue,
altClassLoader);
> > }
> > - if(cls2==null && (type.equals("faultInfo")||
type.equals("@WebFault"))){
> > - //As per JAX-WS 2.2 Specification section
3.7 an application programmer can choose not to
> > - //package the faultBeans, if we have
reached this point in the code then user has choosen
> > - //not to package the fault bean. If there
is a cache of generated artifacts available then
> > - //lets look for the missing faultBean
there.
> > + if(cls2==null &&
> > + (type.equals("@RequestWrapper")||
type.equals("@ResponseWrapper")||type.equals("@WebFault")||
type.equals("faultInfo"))){
> > +
> > + //Support for Fault Bean Generation
> > + //As per JAX-WS 2.2 Specification
section 3.7 an application programmer can choose not to
> > + //package the faultBeans, if we have
reached this point in the code then user has choosen
> > + //not to package the fault bean. If
there is a cache of generated artifacts available then
> > + //lets look for the missing faultBean
there.
> > +
> > + //Support for Wrapper Bean Generation
> > + //As per JAX-WS 2.2 Specificaiton
section 3.6.2.1 pg 41 an application programmer does not use
> > + //the wrapper bean classes, so the
application need not package these classes. If we have reached
> > + //this point in the code then user has
choosen not to package these beans.
> > +
> > + //NOTE:If we find Generated artifacts
from cache this guarantees that we will not use
> > + //DocLitWrappedMinimum marshaller
code. The advantage of normal DocLitWrappedMarshaller is
> > + //that it is very robust and has
support of lot more datatypes than in DocLitWrappedMinimum.
> > + if(log.isDebugEnabled()){
> > + log.debug("Adding cache to
classpath");
> > + }
> > if(log.isDebugEnabled()){
> > log.debug("Adding cache to
classpath");
> > }
> >
> > Added:
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
> > URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java?rev=963508&view=auto
> >
==============================================================================
> > ---
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
(added)
> > +++
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
Mon Jul 12 22:16:54 2010
> > @@ -0,0 +1,18 @@
> > +
> > +package org.apache.axis2.jaxws.wrapper.beans;
> > +
> > +import javax.xml.ws.WebFault;
> > +
> > +@WebFault(name = "AddNumbersFault", targetNamespace = "
http://org/test/addnumbers")
> > +public class AddNumbersException extends Exception
> > +{
> > +
> > + private String message = null;
> > + public AddNumbersException(){}
> > + public AddNumbersException(String message){
> > + this.message = message;
> > + }
> > + public String getInfo(){
> > + return message;
> > + }
> > +}
> >
> > Added:
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
> > URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java?rev=963508&view=auto
> >
==============================================================================
> > ---
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
(added)
> > +++
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
Mon Jul 12 22:16:54 2010
> > @@ -0,0 +1,15 @@
> > +package org.apache.axis2.jaxws.wrapper.beans;
> > +
> > +
> > +
> > +@javax.jws.WebService (targetNamespace="http://org/test/addnumbers",
serviceName="AddNumbersService", portName="AddNumbersPort")
> > +public class AddNumbersService{
> > +
> > + public int addNumbers(int arg0, int arg1) throws
AddNumbersException {
> > + if(arg0+arg1<0){
> > + throw new AddNumbersException("sum is less
than 0");
> > + }
> > + return arg0+arg1;
> > + }
> > +
> > +}
> > \ No newline at end of file
> >
> > Added:
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
> > URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java?rev=963508&view=auto
> >
==============================================================================
> > ---
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
(added)
> > +++
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
Mon Jul 12 22:16:54 2010
> > @@ -0,0 +1,114 @@
> > +/**
> > + *
> > + */
> > +package org.apache.axis2.jaxws.wrapper.beans;
> > +
> > +
> > +import org.apache.axis2.jaxws.Constants;
> > +import org.apache.axis2.jaxws.description.DescriptionFactory;
> > +import org.apache.axis2.jaxws.description.EndpointDescription;
> > +import org.apache.axis2.jaxws.description.EndpointDescriptionJava;
> > +import org.apache.axis2.jaxws.description.OperationDescription;
> > +import org.apache.axis2.jaxws.description.ServiceDescription;
> > +import org.apache.axis2.jaxws.marshaller.MethodMarshaller;
> > +import
org.apache.axis2.jaxws.marshaller.factory.MethodMarshallerFactory;
> > +import
org.apache.axis2.jaxws.marshaller.impl.alt.DocLitWrappedMinimalMethodMarshaller;
> > +import org.apache.axis2.jaxws.unitTest.TestLogger;
> > +
> > +import java.io.File;
> > +
> > +import junit.framework.TestCase;
> > +
> > +public class WrapperBeanMarshallTests extends TestCase {
> > + /**
> > + * This is the negative test case, when we do not use generated
artifacts from cache
> > + * and user did not package wrapper beans, we should see use of
DocLitWrappedMinumumMarshaller.
> > + */
> > + public void
testGetMarshallerOperationDescriptionBooleanNegative() {
> > + TestLogger.logger.debug("---------------------------------------");
> > + TestLogger.logger.debug("test: " + getName());
> > +
> > + String cache_location = "/target/wscache/classes";
> > + try{
> > + String baseDir = new
File(System.getProperty("basedir",".")).getCanonicalPath();
> > + cache_location = new
File(baseDir+cache_location).getAbsolutePath();
> > + TestLogger.logger.debug("cache location
="+cache_location);
> > +
> > + //Get EndpointDescription.
> > + //Set location on AxisConfiguraiton.
> > + Class sei = AddNumbersService.class;
> > + EndpointDescription description = getEndpointDesc(sei);
> > + TestLogger.logger.debug("description objects where
created successfully");
> > + OperationDescription[] ops
=description.getEndpointInterfaceDescription().getOperations();
> > + assertNotNull( "OperationDescriptions where null", ops);
> > + assertTrue("No Operation Descriptions where found",
ops.length>0);
> > + OperationDescription op = ops[0];
> > + TestLogger.logger.debug("operation found, java
methodName="+op.getJavaMethodName());
> > + //Don not Set cache on AxisConfiguration.
> > + //get Marshaller, verify its not DoclitWrappedMinimum.
> > + TestLogger.logger.debug("ws_cache location NOT set on
AxisConfigContext, location="+cache_location);
> > + MethodMarshaller mm =
MethodMarshallerFactory.getMarshaller(op, false);
> > + assertNotNull("getMarshaller returned null", mm );
> > + TestLogger.logger.debug("MethodMarshaller was created,
type="+mm.getClass().getName());
> > + assertTrue("Generated artifacts not found, Method
marshaller should be DocLitWrappedMinimumMarshaller", (mm instanceof
DocLitWrappedMinimalMethodMarshaller));
> > + }catch(Exception e){
> > + TestLogger.logger.debug("Exception ="+e.getMessage());
> > + fail(e.getMessage());
> > + }
> > +
> > + }
> > + /**
> > + * In this test case user did not package wrapper beans but we
add generated artifacts from cache, we should see use of
> > + * DocLitWrappedMarshaller.
> > + * Test method for {@link
org.apache.axis2.jaxws.marshaller.factory.MethodMarshallerFactory#getMarshaller(org.apache.axis2.jaxws.description.OperationDescription,
boolean)}.
> > + */
> > + public void testGetMarshallerOperationDescriptionBoolean() {
> > + TestLogger.logger.debug("---------------------------------------");
> > + TestLogger.logger.debug("test: " + getName());
> > +
> > + String cache_location = "/target/wscache/classes";
> > + try{
> > + String baseDir = new
File(System.getProperty("basedir",".")).getCanonicalPath();
> > + cache_location = new
File(baseDir+cache_location).getAbsolutePath();
> > + TestLogger.logger.debug("cache location
="+cache_location);
> > +
> > + //Get EndpointDescription.
> > + //Set location on AxisConfiguraiton.
> > + Class sei = AddNumbersService.class;
> > + EndpointDescription description = getEndpointDesc(sei);
> > + TestLogger.logger.debug("description objects where
created successfully");
> > + OperationDescription[] ops
=description.getEndpointInterfaceDescription().getOperations();
> > + assertNotNull( "OperationDescriptions where null", ops);
> > + assertTrue("No Operation Descriptions where found",
ops.length>0);
> > + OperationDescription op = ops[0];
> > + TestLogger.logger.debug("operation found, java
methodName="+op.getJavaMethodName());
> > + //Set cache on AxisConfiguration.
> > + //get Marshaller, verify its not DoclitWrappedMinimum.
> > +
description.getServiceDescription().getAxisConfigContext().setProperty(Constants.WS_CACHE,
cache_location);
> > + TestLogger.logger.debug("ws_cache location set on
AxisConfigContext, location="+cache_location);
> > + MethodMarshaller mm =
MethodMarshallerFactory.getMarshaller(op, false);
> > + assertNotNull("getMarshaller returned null", mm );
> > + TestLogger.logger.debug("MethodMarshaller was created,
type="+mm.getClass().getName());
> > + assertTrue("Generated artifacts are in cache, Method
marshaller should not be DocLitWrappedMinimumMarshaller", !(mm instanceof
DocLitWrappedMinimalMethodMarshaller));
> > + }catch(Exception e){
> > + TestLogger.logger.debug("Exception ="+e.getMessage());
> > + fail(e.getMessage());
> > + }
> > +
> > + }
> > +
> > + private EndpointDescription getEndpointDesc(Class
implementationClass) {
> > + // Use the description factory directly; this will be done
within the JAX-WS runtime
> > + ServiceDescription serviceDesc =
> > + DescriptionFactory.createServiceDescription(implementationClass);
> > + assertNotNull(serviceDesc);
> > +
> > + EndpointDescription[] endpointDesc =
serviceDesc.getEndpointDescriptions();
> > + assertNotNull(endpointDesc);
> > + assertEquals(1, endpointDesc.length);
> > +
> > + // TODO: How will the JAX-WS dispatcher get the appropriate
port (i.e. endpoint)? Currently assumes [0]
> > + EndpointDescription testEndpointDesc = endpointDesc[0];
> > + return testEndpointDesc;
> > + }
> > +}
> >
> > Added: axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml
> > URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml?rev=963508&view=auto
> >
==============================================================================
> > --- axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml (added)
> > +++ axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml Mon Jul
12 22:16:54 2010
> > @@ -0,0 +1,34 @@
> > +<?xml version="1.0" encoding="UTF-8"?>
> > +
> > +<project basedir="." default="run-wsgen-tests" name="wsgen-tests">
> > +
> > + <property name="wscache.output.base.dir"
value="target/wscache" />
> > + <property name="wscache.generated.src.dir"
value="${wscache.output.base.dir}/src" />
> > + <property name="wscache.generated.classes.dir"
value="${wscache.output.base.dir}/classes" />
> > + <property name="compile.test.classes"
value="target/test-classes" />
> > +
> > +
> > + <target name="run-wsgen-tests" depends="wrapper-beans"/>
> > +
> > +
> > + <target name="create-cache">
> > + <mkdir dir="${wscache.output.base.dir}" />
> > + <mkdir dir="${wscache.generated.src.dir}" />
> > + <mkdir dir="${wscache.generated.classes.dir}" />
> > + </target>
> > +
> > + <target name="wrapper-beans" depends="create-cache">
> > + <echo>Generating artifacts for
org.apache.axis2.jaxws.wrapper.beans.AddNumbersService </echo>
> > + <wsgen
> > + sei="org.apache.axis2.jaxws.wrapper.beans.AddNumbersService"
> > + destdir="${wscache.generated.classes.dir}"
> > + resourcedestdir="${wscache.generated.src.dir}"
> > + keep="false"
> > + verbose="false"
> > + genwsdl="true">
> > + <classpath>
> > + <pathelement path="${compile.test.classes}" />
> > + </classpath>
> > + </wsgen>
> > + </target>
> > +</project>
> > \ No newline at end of file
> >
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-dev-help@axis.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org
Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws: ./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/
test/org/apache/axis2/jaxws/wrapper/ test/org/apache/axis2/jaxws/wrapper/beans/
Posted by Nikhil V Thaker <ni...@us.ibm.com>.
Andreas - Use of wsGen and Test case Changes have been backed out. There
should not be any dependency on jaxws-tools.jar and also reference to
tools.jar have been removed from pom. Changes in revision #964185.
Thanks,
Nikhil Thaker
office: 919 254 9964
nvthaker@us.ibm.com
Nikhil V Thaker/Columbus/IBM@IBMUS
07/14/2010 03:00 PM
Please respond to
java-dev@axis.apache.org
To
java-dev@axis.apache.org
cc
java-dev@axis.apache.org
Subject
Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws: ./
src/org/apache/axis2/jaxws/runtime/description/marshal/impl/
test/org/apache/axis2/jaxws/wrapper/
test/org/apache/axis2/jaxws/wrapper/beans/
Yes Andreas,
I am running antrun plugin as the wsGen plugin has errors and is not
fully matured, here's the URL that explains the issue I ran into
http://jira.codehaus.org/browse/MNG-3586.
So since I cannot run wsGen or cannot include generated artifacts I will
just remove the test case. I will commit the changes soon.
Regards,
Nikhil Thaker
office: 919 254 9964
nvthaker@us.ibm.com
Andreas Veithen <an...@gmail.com>
07/14/2010 02:48 PM
Please respond to
java-dev@axis.apache.org
To
java-dev@axis.apache.org
cc
Subject
Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws:
./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/
test/org/apache/axis2/jaxws/wrapper/
test/org/apache/axis2/jaxws/wrapper/beans/
No, you are using the antrun plugin to execute the wsgen ant task.
What I meant was to use a real Maven plugin (either the one from
java.net or the one from CXF).
-1 to commit any generated stuff into SVN.
Andreas
On Wed, Jul 14, 2010 at 21:42, Nikhil V Thaker
<ni...@us.ibm.com> wrote:
>
> Andreas - I had to add the tools.jar bit because maven plugin for wsGen
gave NoClassDef Found errors for classes packaged in tools.jar.
>
> Since this is causing a problem I will just package the generated
artifacts and remove the wsGen dependency.
>
> Thanks,
>
> Nikhil Thaker
> office: 919 254 9964
> nvthaker@us.ibm.com
>
>
> Andreas Veithen <an...@gmail.com>
>
> 07/14/2010 01:44 PM
>
> Please respond to
> java-dev@axis.apache.org
> To
> java-dev@axis.apache.org
> cc
> Subject
> Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws:
./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/
test/org/apache/axis2/jaxws/wrapper/
test/org/apache/axis2/jaxws/wrapper/beans/
>
>
>
>
> Nikhil,
>
> I have some issues with the tools and jaxws-tools dependencies
> introduced by this change:
>
> * The change causes a build failure in Hudson. There will also be
> additional issues with tools.jar, because the way to declare this as a
> system dependency varies from one JDK to another. For example, I
> remember that on Mac OS X, it is completely different than on other
> JDKs.
>
> * I don't like the fact that jaxws-tools becomes a dependency of
> axis2-jaxws in scope compile, because it looks like this is only
> needed during the build and/or during the tests.
>
> I didn't review the change in detail, but wouldn't it be smarter to
> use one of the existing Maven plugins to do the wsgen stuff? They will
> take care of the tools.jar stuff as well.
>
> Andreas
>
> On Tue, Jul 13, 2010 at 00:16, <nt...@apache.org> wrote:
> > Author: nthaker
> > Date: Mon Jul 12 22:16:54 2010
> > New Revision: 963508
> >
> > URL: http://svn.apache.org/viewvc?rev=963508&view=rev
> > Log:
> > AXIS2-4775
> > This change ensures that we will use Request and Response wrapper Bean
packaged by customer or we will Generate Wrappers if they are not
packaged.
> >
> > Added:
> >
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/
> >
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/
> >
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
> >
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
> >
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
> > axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml
> > Modified:
> > axis/axis2/java/core/trunk/modules/jaxws/pom.xml
> >
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
> >
> > Modified: axis/axis2/java/core/trunk/modules/jaxws/pom.xml
> > URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/pom.xml?rev=963508&r1=963507&r2=963508&view=diff
> >
==============================================================================
> > --- axis/axis2/java/core/trunk/modules/jaxws/pom.xml (original)
> > +++ axis/axis2/java/core/trunk/modules/jaxws/pom.xml Mon Jul 12
22:16:54 2010
> > @@ -1,5 +1,4 @@
> > <?xml version="1.0" encoding="UTF-8"?>
> > -
> > <!-- > ~ Licensed to the Apache Software Foundation (ASF) under one
> > ~ or more contributor license agreements. See the NOTICE file
> > @@ -20,7 +19,7 @@
> > -->
> >
> > <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"
> > - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
> > + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
> > <modelVersion>4.0.0</modelVersion>
> > <parent>
> > <groupId>org.apache.axis2</groupId>
> > @@ -98,7 +97,25 @@
> > <version>${version}</version>
> > <scope>test</scope>
> > </dependency>
> > + <dependency>
> > + <groupId>wsdl4j</groupId>
> > + <artifactId>wsdl4j</artifactId>
> > + </dependency>
> > + <dependency>
> > + <groupId>com.sun.xml.ws</groupId>
> > + <artifactId>jaxws-tools</artifactId>
> > + <version>2.1.3</version>
> > + </dependency>
> > + <!-- If we dont include tools.jar as dependency, maven throws
NoClassDefFound on wsGen run -->
> > + <dependency>
> > + <groupId>java</groupId>
> > + <artifactId>tools</artifactId>
> > + <version>$version</version>
> > + <scope>system</scope>
> > + <systemPath>${JAVA_HOME}/lib/tools.jar</systemPath>
> > + </dependency>
> > </dependencies>
> > +
> > <build>
> > <sourceDirectory>src</sourceDirectory>
> > <testSourceDirectory>test</testSourceDirectory>
> > @@ -203,34 +220,39 @@
> > <compilerVersion>1.5</compilerVersion>
> > <source>1.5</source>
> > <target>1.5</target>
> > +
> > </configuration>
> > </plugin>
> > <plugin>
> > <groupId>org.apache.maven.plugins</groupId>
> > <artifactId>maven-antrun-plugin</artifactId>
> > +
> > <executions>
> > <execution>
> > <id>gen-ts</id>
> > <phase>generate-test-sources</phase>
> > <configuration>
> > - <tasks unless="maven.test.skip">
> > + <tasks unless="maven.test.skip">
> > <!-- Theres got to be a better way to
do this -->
> > <property name="schema.source.dir"
value="test-resources/xsd"/>
> > <property name="wsdl.source.dir"
value="test-resources/wsdl"/>
> > - <property
name="schema.output.base.dir" value="target/schema"/>
> > + <property
name="schema.output.base.dir" value="target/schema"/>
> > <property
name="schema.generated.src.dir" value="${schema.output.base.dir}/src"/>
> > <property
name="schema.generated.classes.dir"
> > value="${schema.output.base.dir}/classes"/>
> > +
> > <!-- make the dirs -->
> > <mkdir
dir="${schema.output.base.dir}"/>
> > <mkdir
dir="${schema.generated.src.dir}"/>
> > <mkdir
dir="${schema.generated.classes.dir}"/>
> > +
> > <!-- Run JAXB schema compiler with
designated schemas -->
> > <echo>Generating JAX-B classes from
XSDs</echo>
> >
> > <echo>Generating java from
echo.xsd</echo>
> > <java
classname="com.sun.tools.xjc.Driver" fork="true">
> > <classpath
refid="maven.runtime.classpath"/>
> > +
> > <classpath
location="${compiled.classes.dir}"/>
> > <arg line="-d
${schema.generated.src.dir} -quiet ${schema.source.dir}/echo.xsd"/>
> > </java>
> > @@ -266,7 +288,7 @@
> > <classpath
refid="maven.runtime.classpath"/>
> > <classpath
location="${compiled.classes.dir}"/>
> > <arg line="-d
${schema.generated.src.dir} -quiet -wsdl
${wsdl.source.dir}/AddNumbers.wsdl"/>
> > - </java>
> > + </java>
> > </tasks>
> > </configuration>
> > <goals>
> > @@ -287,6 +309,22 @@
> > <property name="addressing_version"
value="${version}"/>
> > <ant antfile="build.xml"
inheritall="true" inheritrefs="true"
> > dir="." target="build-repo"/>
> > +
> > + <property name="compile_classpath" refid="maven.compile.classpath"
/>
> > + <property name="runtime_classpath" refid="maven.runtime.classpath"
/>
> > + <property name="test_classpath" refid="maven.test.classpath" />
> > + <property name="plugin_classpath" refid="maven.plugin.classpath" />
> > +
> > + <!-- Defining wsGen task -->
> > + <taskdef name="wsgen" loaderRef="refwsgen"
classname="com.sun.tools.ws.ant.WsGen">
> > + <classpath>
> > + <path refid="maven.runtime.classpath" />
> > + <path refid="maven.compile.classpath" />
> > + </classpath>
> > + </taskdef>
> > + <!--
Invoking test cases that need to generate artifacts using wsGen -->
> > + <ant antfile="wsgen-tests.xml"
inheritall="true" inheritrefs="true"
> > + dir="."
target="run-wsgen-tests"/>
> > </tasks>
> > </configuration>
> > <goals>
> > @@ -374,6 +412,13 @@
> > <plugin>
> > <groupId>org.apache.maven.plugins</groupId>
> > <artifactId>maven-surefire-report-plugin</artifactId>
> > + <reportSets>
> > + <reportSet>
> > + <reports>
> > + <report>report-only</report>
> > + </reports>
> > + </reportSet>
> > + </reportSets>
> > </plugin>
> > </plugins>
> > </reporting>
> >
> > Modified:
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
> > URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java?rev=963508&r1=963507&r2=963508&view=diff
> >
==============================================================================
> > ---
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
(original)
> > +++
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
Mon Jul 12 22:16:54 2010
> > @@ -238,12 +238,27 @@ class ArtifactProcessor {
> > wrapperClass = newValue;
> > }
> > }
> > - if(cls==null && (type.equals("@WebFault")||
type.equals("faultInfo"))){
> > +
> > + if(cls==null &&
> > + (type.equals("@RequestWrapper")||
type.equals("@ResponseWrapper")||type.equals("@WebFault")||
type.equals("faultInfo"))){
> > +
> > + //Support for Fault Bean Generation
> > //As per JAX-WS 2.2 Specification section
3.7 an application programmer can choose not to
> > //package the faultBeans, if we have
reached this point in the code then user has choosen
> > //not to package the fault bean. If there
is a cache of generated artifacts available then
> > //lets look for the missing faultBean
there.
> > -
> > +
> > + //Support for Wrapper Bean Generation
> > + //As per JAX-WS 2.2 Specificaiton section
3.6.2.1 pg 41 an application programmer does not use
> > + //the wrapper bean classes, so the
application need not package these classes. If we have reached
> > + //this point in the code then user has
choosen not to package these beans.
> > +
> > + //NOTE:If we find Generated artifacts
from cache this guarantees that we will not use
> > + //DocLitWrappedMinimum marshaller code.
The advantage of normal DocLitWrappedMarshaller is
> > + //that it is very robust and has support
of lot more datatypes than in DocLitWrappedMinimum.
> > + if(log.isDebugEnabled()){
> > + log.debug("Adding cache to
classpath");
> > + }
> > ClassFinderFactory cff =
> >
(ClassFinderFactory)FactoryRegistry.getFactory(ClassFinderFactory.class);
> > ClassFinder cf = cff.getClassFinder();
> > @@ -317,11 +332,26 @@ class ArtifactProcessor {
> > if (cls2 == null) {
> > cls2 = loadClassOrNull(defaultValue,
altClassLoader);
> > }
> > - if(cls2==null && (type.equals("faultInfo")||
type.equals("@WebFault"))){
> > - //As per JAX-WS 2.2 Specification section
3.7 an application programmer can choose not to
> > - //package the faultBeans, if we have
reached this point in the code then user has choosen
> > - //not to package the fault bean. If there
is a cache of generated artifacts available then
> > - //lets look for the missing faultBean
there.
> > + if(cls2==null &&
> > + (type.equals("@RequestWrapper")||
type.equals("@ResponseWrapper")||type.equals("@WebFault")||
type.equals("faultInfo"))){
> > +
> > + //Support for Fault Bean Generation
> > + //As per JAX-WS 2.2 Specification
section 3.7 an application programmer can choose not to
> > + //package the faultBeans, if we have
reached this point in the code then user has choosen
> > + //not to package the fault bean. If
there is a cache of generated artifacts available then
> > + //lets look for the missing faultBean
there.
> > +
> > + //Support for Wrapper Bean Generation
> > + //As per JAX-WS 2.2 Specificaiton
section 3.6.2.1 pg 41 an application programmer does not use
> > + //the wrapper bean classes, so the
application need not package these classes. If we have reached
> > + //this point in the code then user has
choosen not to package these beans.
> > +
> > + //NOTE:If we find Generated artifacts
from cache this guarantees that we will not use
> > + //DocLitWrappedMinimum marshaller
code. The advantage of normal DocLitWrappedMarshaller is
> > + //that it is very robust and has
support of lot more datatypes than in DocLitWrappedMinimum.
> > + if(log.isDebugEnabled()){
> > + log.debug("Adding cache to
classpath");
> > + }
> > if(log.isDebugEnabled()){
> > log.debug("Adding cache to
classpath");
> > }
> >
> > Added:
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
> > URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java?rev=963508&view=auto
> >
==============================================================================
> > ---
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
(added)
> > +++
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
Mon Jul 12 22:16:54 2010
> > @@ -0,0 +1,18 @@
> > +
> > +package org.apache.axis2.jaxws.wrapper.beans;
> > +
> > +import javax.xml.ws.WebFault;
> > +
> > +@WebFault(name = "AddNumbersFault", targetNamespace = "
http://org/test/addnumbers")
> > +public class AddNumbersException extends Exception
> > +{
> > +
> > + private String message = null;
> > + public AddNumbersException(){}
> > + public AddNumbersException(String message){
> > + this.message = message;
> > + }
> > + public String getInfo(){
> > + return message;
> > + }
> > +}
> >
> > Added:
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
> > URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java?rev=963508&view=auto
> >
==============================================================================
> > ---
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
(added)
> > +++
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
Mon Jul 12 22:16:54 2010
> > @@ -0,0 +1,15 @@
> > +package org.apache.axis2.jaxws.wrapper.beans;
> > +
> > +
> > +
> > +@javax.jws.WebService (targetNamespace="http://org/test/addnumbers",
serviceName="AddNumbersService", portName="AddNumbersPort")
> > +public class AddNumbersService{
> > +
> > + public int addNumbers(int arg0, int arg1) throws
AddNumbersException {
> > + if(arg0+arg1<0){
> > + throw new AddNumbersException("sum is less
than 0");
> > + }
> > + return arg0+arg1;
> > + }
> > +
> > +}
> > \ No newline at end of file
> >
> > Added:
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
> > URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java?rev=963508&view=auto
> >
==============================================================================
> > ---
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
(added)
> > +++
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
Mon Jul 12 22:16:54 2010
> > @@ -0,0 +1,114 @@
> > +/**
> > + *
> > + */
> > +package org.apache.axis2.jaxws.wrapper.beans;
> > +
> > +
> > +import org.apache.axis2.jaxws.Constants;
> > +import org.apache.axis2.jaxws.description.DescriptionFactory;
> > +import org.apache.axis2.jaxws.description.EndpointDescription;
> > +import org.apache.axis2.jaxws.description.EndpointDescriptionJava;
> > +import org.apache.axis2.jaxws.description.OperationDescription;
> > +import org.apache.axis2.jaxws.description.ServiceDescription;
> > +import org.apache.axis2.jaxws.marshaller.MethodMarshaller;
> > +import
org.apache.axis2.jaxws.marshaller.factory.MethodMarshallerFactory;
> > +import
org.apache.axis2.jaxws.marshaller.impl.alt.DocLitWrappedMinimalMethodMarshaller;
> > +import org.apache.axis2.jaxws.unitTest.TestLogger;
> > +
> > +import java.io.File;
> > +
> > +import junit.framework.TestCase;
> > +
> > +public class WrapperBeanMarshallTests extends TestCase {
> > + /**
> > + * This is the negative test case, when we do not use generated
artifacts from cache
> > + * and user did not package wrapper beans, we should see use of
DocLitWrappedMinumumMarshaller.
> > + */
> > + public void
testGetMarshallerOperationDescriptionBooleanNegative() {
> > + TestLogger.logger.debug("---------------------------------------");
> > + TestLogger.logger.debug("test: " + getName());
> > +
> > + String cache_location = "/target/wscache/classes";
> > + try{
> > + String baseDir = new
File(System.getProperty("basedir",".")).getCanonicalPath();
> > + cache_location = new
File(baseDir+cache_location).getAbsolutePath();
> > + TestLogger.logger.debug("cache location
="+cache_location);
> > +
> > + //Get EndpointDescription.
> > + //Set location on AxisConfiguraiton.
> > + Class sei = AddNumbersService.class;
> > + EndpointDescription description = getEndpointDesc(sei);
> > + TestLogger.logger.debug("description objects where
created successfully");
> > + OperationDescription[] ops
=description.getEndpointInterfaceDescription().getOperations();
> > + assertNotNull( "OperationDescriptions where null", ops);
> > + assertTrue("No Operation Descriptions where found",
ops.length>0);
> > + OperationDescription op = ops[0];
> > + TestLogger.logger.debug("operation found, java
methodName="+op.getJavaMethodName());
> > + //Don not Set cache on AxisConfiguration.
> > + //get Marshaller, verify its not DoclitWrappedMinimum.
> > + TestLogger.logger.debug("ws_cache location NOT set on
AxisConfigContext, location="+cache_location);
> > + MethodMarshaller mm =
MethodMarshallerFactory.getMarshaller(op, false);
> > + assertNotNull("getMarshaller returned null", mm );
> > + TestLogger.logger.debug("MethodMarshaller was created,
type="+mm.getClass().getName());
> > + assertTrue("Generated artifacts not found, Method
marshaller should be DocLitWrappedMinimumMarshaller", (mm instanceof
DocLitWrappedMinimalMethodMarshaller));
> > + }catch(Exception e){
> > + TestLogger.logger.debug("Exception ="+e.getMessage());
> > + fail(e.getMessage());
> > + }
> > +
> > + }
> > + /**
> > + * In this test case user did not package wrapper beans but we
add generated artifacts from cache, we should see use of
> > + * DocLitWrappedMarshaller.
> > + * Test method for {@link
org.apache.axis2.jaxws.marshaller.factory.MethodMarshallerFactory#getMarshaller(org.apache.axis2.jaxws.description.OperationDescription,
boolean)}.
> > + */
> > + public void testGetMarshallerOperationDescriptionBoolean() {
> > + TestLogger.logger.debug("---------------------------------------");
> > + TestLogger.logger.debug("test: " + getName());
> > +
> > + String cache_location = "/target/wscache/classes";
> > + try{
> > + String baseDir = new
File(System.getProperty("basedir",".")).getCanonicalPath();
> > + cache_location = new
File(baseDir+cache_location).getAbsolutePath();
> > + TestLogger.logger.debug("cache location
="+cache_location);
> > +
> > + //Get EndpointDescription.
> > + //Set location on AxisConfiguraiton.
> > + Class sei = AddNumbersService.class;
> > + EndpointDescription description = getEndpointDesc(sei);
> > + TestLogger.logger.debug("description objects where
created successfully");
> > + OperationDescription[] ops
=description.getEndpointInterfaceDescription().getOperations();
> > + assertNotNull( "OperationDescriptions where null", ops);
> > + assertTrue("No Operation Descriptions where found",
ops.length>0);
> > + OperationDescription op = ops[0];
> > + TestLogger.logger.debug("operation found, java
methodName="+op.getJavaMethodName());
> > + //Set cache on AxisConfiguration.
> > + //get Marshaller, verify its not DoclitWrappedMinimum.
> > +
description.getServiceDescription().getAxisConfigContext().setProperty(Constants.WS_CACHE,
cache_location);
> > + TestLogger.logger.debug("ws_cache location set on
AxisConfigContext, location="+cache_location);
> > + MethodMarshaller mm =
MethodMarshallerFactory.getMarshaller(op, false);
> > + assertNotNull("getMarshaller returned null", mm );
> > + TestLogger.logger.debug("MethodMarshaller was created,
type="+mm.getClass().getName());
> > + assertTrue("Generated artifacts are in cache, Method
marshaller should not be DocLitWrappedMinimumMarshaller", !(mm instanceof
DocLitWrappedMinimalMethodMarshaller));
> > + }catch(Exception e){
> > + TestLogger.logger.debug("Exception ="+e.getMessage());
> > + fail(e.getMessage());
> > + }
> > +
> > + }
> > +
> > + private EndpointDescription getEndpointDesc(Class
implementationClass) {
> > + // Use the description factory directly; this will be done
within the JAX-WS runtime
> > + ServiceDescription serviceDesc =
> > + DescriptionFactory.createServiceDescription(implementationClass);
> > + assertNotNull(serviceDesc);
> > +
> > + EndpointDescription[] endpointDesc =
serviceDesc.getEndpointDescriptions();
> > + assertNotNull(endpointDesc);
> > + assertEquals(1, endpointDesc.length);
> > +
> > + // TODO: How will the JAX-WS dispatcher get the appropriate
port (i.e. endpoint)? Currently assumes [0]
> > + EndpointDescription testEndpointDesc = endpointDesc[0];
> > + return testEndpointDesc;
> > + }
> > +}
> >
> > Added: axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml
> > URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml?rev=963508&view=auto
> >
==============================================================================
> > --- axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml (added)
> > +++ axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml Mon Jul
12 22:16:54 2010
> > @@ -0,0 +1,34 @@
> > +<?xml version="1.0" encoding="UTF-8"?>
> > +
> > +<project basedir="." default="run-wsgen-tests" name="wsgen-tests">
> > +
> > + <property name="wscache.output.base.dir"
value="target/wscache" />
> > + <property name="wscache.generated.src.dir"
value="${wscache.output.base.dir}/src" />
> > + <property name="wscache.generated.classes.dir"
value="${wscache.output.base.dir}/classes" />
> > + <property name="compile.test.classes"
value="target/test-classes" />
> > +
> > +
> > + <target name="run-wsgen-tests" depends="wrapper-beans"/>
> > +
> > +
> > + <target name="create-cache">
> > + <mkdir dir="${wscache.output.base.dir}" />
> > + <mkdir dir="${wscache.generated.src.dir}" />
> > + <mkdir dir="${wscache.generated.classes.dir}" />
> > + </target>
> > +
> > + <target name="wrapper-beans" depends="create-cache">
> > + <echo>Generating artifacts for
org.apache.axis2.jaxws.wrapper.beans.AddNumbersService </echo>
> > + <wsgen
> > + sei="org.apache.axis2.jaxws.wrapper.beans.AddNumbersService"
> > + destdir="${wscache.generated.classes.dir}"
> > + resourcedestdir="${wscache.generated.src.dir}"
> > + keep="false"
> > + verbose="false"
> > + genwsdl="true">
> > + <classpath>
> > + <pathelement path="${compile.test.classes}" />
> > + </classpath>
> > + </wsgen>
> > + </target>
> > +</project>
> > \ No newline at end of file
> >
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-dev-help@axis.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org
Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws: ./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/
test/org/apache/axis2/jaxws/wrapper/ test/org/apache/axis2/jaxws/wrapper/beans/
Posted by Nikhil V Thaker <ni...@us.ibm.com>.
Andreas - Use of wsGen and Test case Changes have been backed out. There
should not be any dependency on jaxws-tools.jar and also reference to
tools.jar have been removed from pom. Changes in revision #964185.
Thanks,
Nikhil Thaker
office: 919 254 9964
nvthaker@us.ibm.com
Nikhil V Thaker/Columbus/IBM@IBMUS
07/14/2010 03:00 PM
Please respond to
java-dev@axis.apache.org
To
java-dev@axis.apache.org
cc
java-dev@axis.apache.org
Subject
Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws: ./
src/org/apache/axis2/jaxws/runtime/description/marshal/impl/
test/org/apache/axis2/jaxws/wrapper/
test/org/apache/axis2/jaxws/wrapper/beans/
Yes Andreas,
I am running antrun plugin as the wsGen plugin has errors and is not
fully matured, here's the URL that explains the issue I ran into
http://jira.codehaus.org/browse/MNG-3586.
So since I cannot run wsGen or cannot include generated artifacts I will
just remove the test case. I will commit the changes soon.
Regards,
Nikhil Thaker
office: 919 254 9964
nvthaker@us.ibm.com
Andreas Veithen <an...@gmail.com>
07/14/2010 02:48 PM
Please respond to
java-dev@axis.apache.org
To
java-dev@axis.apache.org
cc
Subject
Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws:
./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/
test/org/apache/axis2/jaxws/wrapper/
test/org/apache/axis2/jaxws/wrapper/beans/
No, you are using the antrun plugin to execute the wsgen ant task.
What I meant was to use a real Maven plugin (either the one from
java.net or the one from CXF).
-1 to commit any generated stuff into SVN.
Andreas
On Wed, Jul 14, 2010 at 21:42, Nikhil V Thaker
<ni...@us.ibm.com> wrote:
>
> Andreas - I had to add the tools.jar bit because maven plugin for wsGen
gave NoClassDef Found errors for classes packaged in tools.jar.
>
> Since this is causing a problem I will just package the generated
artifacts and remove the wsGen dependency.
>
> Thanks,
>
> Nikhil Thaker
> office: 919 254 9964
> nvthaker@us.ibm.com
>
>
> Andreas Veithen <an...@gmail.com>
>
> 07/14/2010 01:44 PM
>
> Please respond to
> java-dev@axis.apache.org
> To
> java-dev@axis.apache.org
> cc
> Subject
> Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws:
./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/
test/org/apache/axis2/jaxws/wrapper/
test/org/apache/axis2/jaxws/wrapper/beans/
>
>
>
>
> Nikhil,
>
> I have some issues with the tools and jaxws-tools dependencies
> introduced by this change:
>
> * The change causes a build failure in Hudson. There will also be
> additional issues with tools.jar, because the way to declare this as a
> system dependency varies from one JDK to another. For example, I
> remember that on Mac OS X, it is completely different than on other
> JDKs.
>
> * I don't like the fact that jaxws-tools becomes a dependency of
> axis2-jaxws in scope compile, because it looks like this is only
> needed during the build and/or during the tests.
>
> I didn't review the change in detail, but wouldn't it be smarter to
> use one of the existing Maven plugins to do the wsgen stuff? They will
> take care of the tools.jar stuff as well.
>
> Andreas
>
> On Tue, Jul 13, 2010 at 00:16, <nt...@apache.org> wrote:
> > Author: nthaker
> > Date: Mon Jul 12 22:16:54 2010
> > New Revision: 963508
> >
> > URL: http://svn.apache.org/viewvc?rev=963508&view=rev
> > Log:
> > AXIS2-4775
> > This change ensures that we will use Request and Response wrapper Bean
packaged by customer or we will Generate Wrappers if they are not
packaged.
> >
> > Added:
> >
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/
> >
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/
> >
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
> >
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
> >
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
> > axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml
> > Modified:
> > axis/axis2/java/core/trunk/modules/jaxws/pom.xml
> >
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
> >
> > Modified: axis/axis2/java/core/trunk/modules/jaxws/pom.xml
> > URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/pom.xml?rev=963508&r1=963507&r2=963508&view=diff
> >
==============================================================================
> > --- axis/axis2/java/core/trunk/modules/jaxws/pom.xml (original)
> > +++ axis/axis2/java/core/trunk/modules/jaxws/pom.xml Mon Jul 12
22:16:54 2010
> > @@ -1,5 +1,4 @@
> > <?xml version="1.0" encoding="UTF-8"?>
> > -
> > <!-- > ~ Licensed to the Apache Software Foundation (ASF) under one
> > ~ or more contributor license agreements. See the NOTICE file
> > @@ -20,7 +19,7 @@
> > -->
> >
> > <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"
> > - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
> > + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
> > <modelVersion>4.0.0</modelVersion>
> > <parent>
> > <groupId>org.apache.axis2</groupId>
> > @@ -98,7 +97,25 @@
> > <version>${version}</version>
> > <scope>test</scope>
> > </dependency>
> > + <dependency>
> > + <groupId>wsdl4j</groupId>
> > + <artifactId>wsdl4j</artifactId>
> > + </dependency>
> > + <dependency>
> > + <groupId>com.sun.xml.ws</groupId>
> > + <artifactId>jaxws-tools</artifactId>
> > + <version>2.1.3</version>
> > + </dependency>
> > + <!-- If we dont include tools.jar as dependency, maven throws
NoClassDefFound on wsGen run -->
> > + <dependency>
> > + <groupId>java</groupId>
> > + <artifactId>tools</artifactId>
> > + <version>$version</version>
> > + <scope>system</scope>
> > + <systemPath>${JAVA_HOME}/lib/tools.jar</systemPath>
> > + </dependency>
> > </dependencies>
> > +
> > <build>
> > <sourceDirectory>src</sourceDirectory>
> > <testSourceDirectory>test</testSourceDirectory>
> > @@ -203,34 +220,39 @@
> > <compilerVersion>1.5</compilerVersion>
> > <source>1.5</source>
> > <target>1.5</target>
> > +
> > </configuration>
> > </plugin>
> > <plugin>
> > <groupId>org.apache.maven.plugins</groupId>
> > <artifactId>maven-antrun-plugin</artifactId>
> > +
> > <executions>
> > <execution>
> > <id>gen-ts</id>
> > <phase>generate-test-sources</phase>
> > <configuration>
> > - <tasks unless="maven.test.skip">
> > + <tasks unless="maven.test.skip">
> > <!-- Theres got to be a better way to
do this -->
> > <property name="schema.source.dir"
value="test-resources/xsd"/>
> > <property name="wsdl.source.dir"
value="test-resources/wsdl"/>
> > - <property
name="schema.output.base.dir" value="target/schema"/>
> > + <property
name="schema.output.base.dir" value="target/schema"/>
> > <property
name="schema.generated.src.dir" value="${schema.output.base.dir}/src"/>
> > <property
name="schema.generated.classes.dir"
> > value="${schema.output.base.dir}/classes"/>
> > +
> > <!-- make the dirs -->
> > <mkdir
dir="${schema.output.base.dir}"/>
> > <mkdir
dir="${schema.generated.src.dir}"/>
> > <mkdir
dir="${schema.generated.classes.dir}"/>
> > +
> > <!-- Run JAXB schema compiler with
designated schemas -->
> > <echo>Generating JAX-B classes from
XSDs</echo>
> >
> > <echo>Generating java from
echo.xsd</echo>
> > <java
classname="com.sun.tools.xjc.Driver" fork="true">
> > <classpath
refid="maven.runtime.classpath"/>
> > +
> > <classpath
location="${compiled.classes.dir}"/>
> > <arg line="-d
${schema.generated.src.dir} -quiet ${schema.source.dir}/echo.xsd"/>
> > </java>
> > @@ -266,7 +288,7 @@
> > <classpath
refid="maven.runtime.classpath"/>
> > <classpath
location="${compiled.classes.dir}"/>
> > <arg line="-d
${schema.generated.src.dir} -quiet -wsdl
${wsdl.source.dir}/AddNumbers.wsdl"/>
> > - </java>
> > + </java>
> > </tasks>
> > </configuration>
> > <goals>
> > @@ -287,6 +309,22 @@
> > <property name="addressing_version"
value="${version}"/>
> > <ant antfile="build.xml"
inheritall="true" inheritrefs="true"
> > dir="." target="build-repo"/>
> > +
> > + <property name="compile_classpath" refid="maven.compile.classpath"
/>
> > + <property name="runtime_classpath" refid="maven.runtime.classpath"
/>
> > + <property name="test_classpath" refid="maven.test.classpath" />
> > + <property name="plugin_classpath" refid="maven.plugin.classpath" />
> > +
> > + <!-- Defining wsGen task -->
> > + <taskdef name="wsgen" loaderRef="refwsgen"
classname="com.sun.tools.ws.ant.WsGen">
> > + <classpath>
> > + <path refid="maven.runtime.classpath" />
> > + <path refid="maven.compile.classpath" />
> > + </classpath>
> > + </taskdef>
> > + <!--
Invoking test cases that need to generate artifacts using wsGen -->
> > + <ant antfile="wsgen-tests.xml"
inheritall="true" inheritrefs="true"
> > + dir="."
target="run-wsgen-tests"/>
> > </tasks>
> > </configuration>
> > <goals>
> > @@ -374,6 +412,13 @@
> > <plugin>
> > <groupId>org.apache.maven.plugins</groupId>
> > <artifactId>maven-surefire-report-plugin</artifactId>
> > + <reportSets>
> > + <reportSet>
> > + <reports>
> > + <report>report-only</report>
> > + </reports>
> > + </reportSet>
> > + </reportSets>
> > </plugin>
> > </plugins>
> > </reporting>
> >
> > Modified:
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
> > URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java?rev=963508&r1=963507&r2=963508&view=diff
> >
==============================================================================
> > ---
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
(original)
> > +++
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
Mon Jul 12 22:16:54 2010
> > @@ -238,12 +238,27 @@ class ArtifactProcessor {
> > wrapperClass = newValue;
> > }
> > }
> > - if(cls==null && (type.equals("@WebFault")||
type.equals("faultInfo"))){
> > +
> > + if(cls==null &&
> > + (type.equals("@RequestWrapper")||
type.equals("@ResponseWrapper")||type.equals("@WebFault")||
type.equals("faultInfo"))){
> > +
> > + //Support for Fault Bean Generation
> > //As per JAX-WS 2.2 Specification section
3.7 an application programmer can choose not to
> > //package the faultBeans, if we have
reached this point in the code then user has choosen
> > //not to package the fault bean. If there
is a cache of generated artifacts available then
> > //lets look for the missing faultBean
there.
> > -
> > +
> > + //Support for Wrapper Bean Generation
> > + //As per JAX-WS 2.2 Specificaiton section
3.6.2.1 pg 41 an application programmer does not use
> > + //the wrapper bean classes, so the
application need not package these classes. If we have reached
> > + //this point in the code then user has
choosen not to package these beans.
> > +
> > + //NOTE:If we find Generated artifacts
from cache this guarantees that we will not use
> > + //DocLitWrappedMinimum marshaller code.
The advantage of normal DocLitWrappedMarshaller is
> > + //that it is very robust and has support
of lot more datatypes than in DocLitWrappedMinimum.
> > + if(log.isDebugEnabled()){
> > + log.debug("Adding cache to
classpath");
> > + }
> > ClassFinderFactory cff =
> >
(ClassFinderFactory)FactoryRegistry.getFactory(ClassFinderFactory.class);
> > ClassFinder cf = cff.getClassFinder();
> > @@ -317,11 +332,26 @@ class ArtifactProcessor {
> > if (cls2 == null) {
> > cls2 = loadClassOrNull(defaultValue,
altClassLoader);
> > }
> > - if(cls2==null && (type.equals("faultInfo")||
type.equals("@WebFault"))){
> > - //As per JAX-WS 2.2 Specification section
3.7 an application programmer can choose not to
> > - //package the faultBeans, if we have
reached this point in the code then user has choosen
> > - //not to package the fault bean. If there
is a cache of generated artifacts available then
> > - //lets look for the missing faultBean
there.
> > + if(cls2==null &&
> > + (type.equals("@RequestWrapper")||
type.equals("@ResponseWrapper")||type.equals("@WebFault")||
type.equals("faultInfo"))){
> > +
> > + //Support for Fault Bean Generation
> > + //As per JAX-WS 2.2 Specification
section 3.7 an application programmer can choose not to
> > + //package the faultBeans, if we have
reached this point in the code then user has choosen
> > + //not to package the fault bean. If
there is a cache of generated artifacts available then
> > + //lets look for the missing faultBean
there.
> > +
> > + //Support for Wrapper Bean Generation
> > + //As per JAX-WS 2.2 Specificaiton
section 3.6.2.1 pg 41 an application programmer does not use
> > + //the wrapper bean classes, so the
application need not package these classes. If we have reached
> > + //this point in the code then user has
choosen not to package these beans.
> > +
> > + //NOTE:If we find Generated artifacts
from cache this guarantees that we will not use
> > + //DocLitWrappedMinimum marshaller
code. The advantage of normal DocLitWrappedMarshaller is
> > + //that it is very robust and has
support of lot more datatypes than in DocLitWrappedMinimum.
> > + if(log.isDebugEnabled()){
> > + log.debug("Adding cache to
classpath");
> > + }
> > if(log.isDebugEnabled()){
> > log.debug("Adding cache to
classpath");
> > }
> >
> > Added:
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
> > URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java?rev=963508&view=auto
> >
==============================================================================
> > ---
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
(added)
> > +++
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
Mon Jul 12 22:16:54 2010
> > @@ -0,0 +1,18 @@
> > +
> > +package org.apache.axis2.jaxws.wrapper.beans;
> > +
> > +import javax.xml.ws.WebFault;
> > +
> > +@WebFault(name = "AddNumbersFault", targetNamespace = "
http://org/test/addnumbers")
> > +public class AddNumbersException extends Exception
> > +{
> > +
> > + private String message = null;
> > + public AddNumbersException(){}
> > + public AddNumbersException(String message){
> > + this.message = message;
> > + }
> > + public String getInfo(){
> > + return message;
> > + }
> > +}
> >
> > Added:
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
> > URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java?rev=963508&view=auto
> >
==============================================================================
> > ---
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
(added)
> > +++
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
Mon Jul 12 22:16:54 2010
> > @@ -0,0 +1,15 @@
> > +package org.apache.axis2.jaxws.wrapper.beans;
> > +
> > +
> > +
> > +@javax.jws.WebService (targetNamespace="http://org/test/addnumbers",
serviceName="AddNumbersService", portName="AddNumbersPort")
> > +public class AddNumbersService{
> > +
> > + public int addNumbers(int arg0, int arg1) throws
AddNumbersException {
> > + if(arg0+arg1<0){
> > + throw new AddNumbersException("sum is less
than 0");
> > + }
> > + return arg0+arg1;
> > + }
> > +
> > +}
> > \ No newline at end of file
> >
> > Added:
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
> > URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java?rev=963508&view=auto
> >
==============================================================================
> > ---
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
(added)
> > +++
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
Mon Jul 12 22:16:54 2010
> > @@ -0,0 +1,114 @@
> > +/**
> > + *
> > + */
> > +package org.apache.axis2.jaxws.wrapper.beans;
> > +
> > +
> > +import org.apache.axis2.jaxws.Constants;
> > +import org.apache.axis2.jaxws.description.DescriptionFactory;
> > +import org.apache.axis2.jaxws.description.EndpointDescription;
> > +import org.apache.axis2.jaxws.description.EndpointDescriptionJava;
> > +import org.apache.axis2.jaxws.description.OperationDescription;
> > +import org.apache.axis2.jaxws.description.ServiceDescription;
> > +import org.apache.axis2.jaxws.marshaller.MethodMarshaller;
> > +import
org.apache.axis2.jaxws.marshaller.factory.MethodMarshallerFactory;
> > +import
org.apache.axis2.jaxws.marshaller.impl.alt.DocLitWrappedMinimalMethodMarshaller;
> > +import org.apache.axis2.jaxws.unitTest.TestLogger;
> > +
> > +import java.io.File;
> > +
> > +import junit.framework.TestCase;
> > +
> > +public class WrapperBeanMarshallTests extends TestCase {
> > + /**
> > + * This is the negative test case, when we do not use generated
artifacts from cache
> > + * and user did not package wrapper beans, we should see use of
DocLitWrappedMinumumMarshaller.
> > + */
> > + public void
testGetMarshallerOperationDescriptionBooleanNegative() {
> > + TestLogger.logger.debug("---------------------------------------");
> > + TestLogger.logger.debug("test: " + getName());
> > +
> > + String cache_location = "/target/wscache/classes";
> > + try{
> > + String baseDir = new
File(System.getProperty("basedir",".")).getCanonicalPath();
> > + cache_location = new
File(baseDir+cache_location).getAbsolutePath();
> > + TestLogger.logger.debug("cache location
="+cache_location);
> > +
> > + //Get EndpointDescription.
> > + //Set location on AxisConfiguraiton.
> > + Class sei = AddNumbersService.class;
> > + EndpointDescription description = getEndpointDesc(sei);
> > + TestLogger.logger.debug("description objects where
created successfully");
> > + OperationDescription[] ops
=description.getEndpointInterfaceDescription().getOperations();
> > + assertNotNull( "OperationDescriptions where null", ops);
> > + assertTrue("No Operation Descriptions where found",
ops.length>0);
> > + OperationDescription op = ops[0];
> > + TestLogger.logger.debug("operation found, java
methodName="+op.getJavaMethodName());
> > + //Don not Set cache on AxisConfiguration.
> > + //get Marshaller, verify its not DoclitWrappedMinimum.
> > + TestLogger.logger.debug("ws_cache location NOT set on
AxisConfigContext, location="+cache_location);
> > + MethodMarshaller mm =
MethodMarshallerFactory.getMarshaller(op, false);
> > + assertNotNull("getMarshaller returned null", mm );
> > + TestLogger.logger.debug("MethodMarshaller was created,
type="+mm.getClass().getName());
> > + assertTrue("Generated artifacts not found, Method
marshaller should be DocLitWrappedMinimumMarshaller", (mm instanceof
DocLitWrappedMinimalMethodMarshaller));
> > + }catch(Exception e){
> > + TestLogger.logger.debug("Exception ="+e.getMessage());
> > + fail(e.getMessage());
> > + }
> > +
> > + }
> > + /**
> > + * In this test case user did not package wrapper beans but we
add generated artifacts from cache, we should see use of
> > + * DocLitWrappedMarshaller.
> > + * Test method for {@link
org.apache.axis2.jaxws.marshaller.factory.MethodMarshallerFactory#getMarshaller(org.apache.axis2.jaxws.description.OperationDescription,
boolean)}.
> > + */
> > + public void testGetMarshallerOperationDescriptionBoolean() {
> > + TestLogger.logger.debug("---------------------------------------");
> > + TestLogger.logger.debug("test: " + getName());
> > +
> > + String cache_location = "/target/wscache/classes";
> > + try{
> > + String baseDir = new
File(System.getProperty("basedir",".")).getCanonicalPath();
> > + cache_location = new
File(baseDir+cache_location).getAbsolutePath();
> > + TestLogger.logger.debug("cache location
="+cache_location);
> > +
> > + //Get EndpointDescription.
> > + //Set location on AxisConfiguraiton.
> > + Class sei = AddNumbersService.class;
> > + EndpointDescription description = getEndpointDesc(sei);
> > + TestLogger.logger.debug("description objects where
created successfully");
> > + OperationDescription[] ops
=description.getEndpointInterfaceDescription().getOperations();
> > + assertNotNull( "OperationDescriptions where null", ops);
> > + assertTrue("No Operation Descriptions where found",
ops.length>0);
> > + OperationDescription op = ops[0];
> > + TestLogger.logger.debug("operation found, java
methodName="+op.getJavaMethodName());
> > + //Set cache on AxisConfiguration.
> > + //get Marshaller, verify its not DoclitWrappedMinimum.
> > +
description.getServiceDescription().getAxisConfigContext().setProperty(Constants.WS_CACHE,
cache_location);
> > + TestLogger.logger.debug("ws_cache location set on
AxisConfigContext, location="+cache_location);
> > + MethodMarshaller mm =
MethodMarshallerFactory.getMarshaller(op, false);
> > + assertNotNull("getMarshaller returned null", mm );
> > + TestLogger.logger.debug("MethodMarshaller was created,
type="+mm.getClass().getName());
> > + assertTrue("Generated artifacts are in cache, Method
marshaller should not be DocLitWrappedMinimumMarshaller", !(mm instanceof
DocLitWrappedMinimalMethodMarshaller));
> > + }catch(Exception e){
> > + TestLogger.logger.debug("Exception ="+e.getMessage());
> > + fail(e.getMessage());
> > + }
> > +
> > + }
> > +
> > + private EndpointDescription getEndpointDesc(Class
implementationClass) {
> > + // Use the description factory directly; this will be done
within the JAX-WS runtime
> > + ServiceDescription serviceDesc =
> > + DescriptionFactory.createServiceDescription(implementationClass);
> > + assertNotNull(serviceDesc);
> > +
> > + EndpointDescription[] endpointDesc =
serviceDesc.getEndpointDescriptions();
> > + assertNotNull(endpointDesc);
> > + assertEquals(1, endpointDesc.length);
> > +
> > + // TODO: How will the JAX-WS dispatcher get the appropriate
port (i.e. endpoint)? Currently assumes [0]
> > + EndpointDescription testEndpointDesc = endpointDesc[0];
> > + return testEndpointDesc;
> > + }
> > +}
> >
> > Added: axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml
> > URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml?rev=963508&view=auto
> >
==============================================================================
> > --- axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml (added)
> > +++ axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml Mon Jul
12 22:16:54 2010
> > @@ -0,0 +1,34 @@
> > +<?xml version="1.0" encoding="UTF-8"?>
> > +
> > +<project basedir="." default="run-wsgen-tests" name="wsgen-tests">
> > +
> > + <property name="wscache.output.base.dir"
value="target/wscache" />
> > + <property name="wscache.generated.src.dir"
value="${wscache.output.base.dir}/src" />
> > + <property name="wscache.generated.classes.dir"
value="${wscache.output.base.dir}/classes" />
> > + <property name="compile.test.classes"
value="target/test-classes" />
> > +
> > +
> > + <target name="run-wsgen-tests" depends="wrapper-beans"/>
> > +
> > +
> > + <target name="create-cache">
> > + <mkdir dir="${wscache.output.base.dir}" />
> > + <mkdir dir="${wscache.generated.src.dir}" />
> > + <mkdir dir="${wscache.generated.classes.dir}" />
> > + </target>
> > +
> > + <target name="wrapper-beans" depends="create-cache">
> > + <echo>Generating artifacts for
org.apache.axis2.jaxws.wrapper.beans.AddNumbersService </echo>
> > + <wsgen
> > + sei="org.apache.axis2.jaxws.wrapper.beans.AddNumbersService"
> > + destdir="${wscache.generated.classes.dir}"
> > + resourcedestdir="${wscache.generated.src.dir}"
> > + keep="false"
> > + verbose="false"
> > + genwsdl="true">
> > + <classpath>
> > + <pathelement path="${compile.test.classes}" />
> > + </classpath>
> > + </wsgen>
> > + </target>
> > +</project>
> > \ No newline at end of file
> >
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-dev-help@axis.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org
Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws:
./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/
test/org/apache/axis2/jaxws/wrapper/ test/org/apache/axis2/jaxws/wrapper/beans/
Posted by Jarek Gawor <jg...@gmail.com>.
Just a couple of thoughts:
1) Since you already have wsgen-tests.xml ant script to run the wsgen
you could setup the appropriate classpath to the tools.jar or
classes.jar or whatever in it. You just might need to fork the ant
process.
2) I don't think it's that horrible to commit some generate code
especially if there isn't too much of it and the test case is
important. Besides, Axis2 already has some generated code checked it.
Jarek
On Wed, Jul 14, 2010 at 4:00 PM, Nikhil V Thaker
<ni...@us.ibm.com> wrote:
>
> Yes Andreas,
> I am running antrun plugin as the wsGen plugin has errors and is not fully matured, here's the URL that explains the issue I ran into http://jira.codehaus.org/browse/MNG-3586.
>
> So since I cannot run wsGen or cannot include generated artifacts I will just remove the test case. I will commit the changes soon.
>
> Regards,
>
> Nikhil Thaker
> office: 919 254 9964
> nvthaker@us.ibm.com
>
>
> Andreas Veithen <an...@gmail.com>
>
> 07/14/2010 02:48 PM
>
> Please respond to
> java-dev@axis.apache.org
> To
> java-dev@axis.apache.org
> cc
> Subject
> Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws: ./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ test/org/apache/axis2/jaxws/wrapper/ test/org/apache/axis2/jaxws/wrapper/beans/
>
>
>
>
> No, you are using the antrun plugin to execute the wsgen ant task.
> What I meant was to use a real Maven plugin (either the one from
> java.net or the one from CXF).
>
> -1 to commit any generated stuff into SVN.
>
> Andreas
>
> On Wed, Jul 14, 2010 at 21:42, Nikhil V Thaker
> <ni...@us.ibm.com> wrote:
> >
> > Andreas - I had to add the tools.jar bit because maven plugin for wsGen gave NoClassDef Found errors for classes packaged in tools.jar.
> >
> > Since this is causing a problem I will just package the generated artifacts and remove the wsGen dependency.
> >
> > Thanks,
> >
> > Nikhil Thaker
> > office: 919 254 9964
> > nvthaker@us.ibm.com
> >
> >
> > Andreas Veithen <an...@gmail.com>
> >
> > 07/14/2010 01:44 PM
> >
> > Please respond to
> > java-dev@axis.apache.org
> > To
> > java-dev@axis.apache.org
> > cc
> > Subject
> > Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws: ./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ test/org/apache/axis2/jaxws/wrapper/ test/org/apache/axis2/jaxws/wrapper/beans/
> >
> >
> >
> >
> > Nikhil,
> >
> > I have some issues with the tools and jaxws-tools dependencies
> > introduced by this change:
> >
> > * The change causes a build failure in Hudson. There will also be
> > additional issues with tools.jar, because the way to declare this as a
> > system dependency varies from one JDK to another. For example, I
> > remember that on Mac OS X, it is completely different than on other
> > JDKs.
> >
> > * I don't like the fact that jaxws-tools becomes a dependency of
> > axis2-jaxws in scope compile, because it looks like this is only
> > needed during the build and/or during the tests.
> >
> > I didn't review the change in detail, but wouldn't it be smarter to
> > use one of the existing Maven plugins to do the wsgen stuff? They will
> > take care of the tools.jar stuff as well.
> >
> > Andreas
> >
> > On Tue, Jul 13, 2010 at 00:16, <nt...@apache.org> wrote:
> > > Author: nthaker
> > > Date: Mon Jul 12 22:16:54 2010
> > > New Revision: 963508
> > >
> > > URL: http://svn.apache.org/viewvc?rev=963508&view=rev
> > > Log:
> > > AXIS2-4775
> > > This change ensures that we will use Request and Response wrapper Bean packaged by customer or we will Generate Wrappers if they are not packaged.
> > >
> > > Added:
> > > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/
> > > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/
> > > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
> > > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
> > > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
> > > axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml
> > > Modified:
> > > axis/axis2/java/core/trunk/modules/jaxws/pom.xml
> > > axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
> > >
> > > Modified: axis/axis2/java/core/trunk/modules/jaxws/pom.xml
> > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/pom.xml?rev=963508&r1=963507&r2=963508&view=diff
> > > ==============================================================================
> > > --- axis/axis2/java/core/trunk/modules/jaxws/pom.xml (original)
> > > +++ axis/axis2/java/core/trunk/modules/jaxws/pom.xml Mon Jul 12 22:16:54 2010
> > > @@ -1,5 +1,4 @@
> > > <?xml version="1.0" encoding="UTF-8"?>
> > > -
> > > <!-- > ~ Licensed to the Apache Software Foundation (ASF) under one
> > > ~ or more contributor license agreements. See the NOTICE file
> > > @@ -20,7 +19,7 @@
> > > -->
> > >
> > > <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> > > - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
> > > + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
> > > <modelVersion>4.0.0</modelVersion>
> > > <parent>
> > > <groupId>org.apache.axis2</groupId>
> > > @@ -98,7 +97,25 @@
> > > <version>${version}</version>
> > > <scope>test</scope>
> > > </dependency>
> > > + <dependency>
> > > + <groupId>wsdl4j</groupId>
> > > + <artifactId>wsdl4j</artifactId>
> > > + </dependency>
> > > + <dependency>
> > > + <groupId>com.sun.xml.ws</groupId>
> > > + <artifactId>jaxws-tools</artifactId>
> > > + <version>2.1.3</version>
> > > + </dependency>
> > > + <!-- If we dont include tools.jar as dependency, maven throws NoClassDefFound on wsGen run -->
> > > + <dependency>
> > > + <groupId>java</groupId>
> > > + <artifactId>tools</artifactId>
> > > + <version>$version</version>
> > > + <scope>system</scope>
> > > + <systemPath>${JAVA_HOME}/lib/tools.jar</systemPath>
> > > + </dependency>
> > > </dependencies>
> > > +
> > > <build>
> > > <sourceDirectory>src</sourceDirectory>
> > > <testSourceDirectory>test</testSourceDirectory>
> > > @@ -203,34 +220,39 @@
> > > <compilerVersion>1.5</compilerVersion>
> > > <source>1.5</source>
> > > <target>1.5</target>
> > > +
> > > </configuration>
> > > </plugin>
> > > <plugin>
> > > <groupId>org.apache.maven.plugins</groupId>
> > > <artifactId>maven-antrun-plugin</artifactId>
> > > +
> > > <executions>
> > > <execution>
> > > <id>gen-ts</id>
> > > <phase>generate-test-sources</phase>
> > > <configuration>
> > > - <tasks unless="maven.test.skip">
> > > + <tasks unless="maven.test.skip">
> > > <!-- Theres got to be a better way to do this -->
> > > <property name="schema.source.dir" value="test-resources/xsd"/>
> > > <property name="wsdl.source.dir" value="test-resources/wsdl"/>
> > > - <property name="schema.output.base.dir" value="target/schema"/>
> > > + <property name="schema.output.base.dir" value="target/schema"/>
> > > <property name="schema.generated.src.dir" value="${schema.output.base.dir}/src"/>
> > > <property name="schema.generated.classes.dir"
> > > value="${schema.output.base.dir}/classes"/>
> > > +
> > > <!-- make the dirs -->
> > > <mkdir dir="${schema.output.base.dir}"/>
> > > <mkdir dir="${schema.generated.src.dir}"/>
> > > <mkdir dir="${schema.generated.classes.dir}"/>
> > > +
> > > <!-- Run JAXB schema compiler with designated schemas -->
> > > <echo>Generating JAX-B classes from XSDs</echo>
> > >
> > > <echo>Generating java from echo.xsd</echo>
> > > <java classname="com.sun.tools.xjc.Driver" fork="true">
> > > <classpath refid="maven.runtime.classpath"/>
> > > +
> > > <classpath location="${compiled.classes.dir}"/>
> > > <arg line="-d ${schema.generated.src.dir} -quiet ${schema.source.dir}/echo.xsd"/>
> > > </java>
> > > @@ -266,7 +288,7 @@
> > > <classpath refid="maven.runtime.classpath"/>
> > > <classpath location="${compiled.classes.dir}"/>
> > > <arg line="-d ${schema.generated.src.dir} -quiet -wsdl ${wsdl.source.dir}/AddNumbers.wsdl"/>
> > > - </java>
> > > + </java>
> > > </tasks>
> > > </configuration>
> > > <goals>
> > > @@ -287,6 +309,22 @@
> > > <property name="addressing_version" value="${version}"/>
> > > <ant antfile="build.xml" inheritall="true" inheritrefs="true"
> > > dir="." target="build-repo"/>
> > > +
> > > + <property name="compile_classpath" refid="maven.compile.classpath" />
> > > + <property name="runtime_classpath" refid="maven.runtime.classpath" />
> > > + <property name="test_classpath" refid="maven.test.classpath" />
> > > + <property name="plugin_classpath" refid="maven.plugin.classpath" />
> > > +
> > > + <!-- Defining wsGen task -->
> > > + <taskdef name="wsgen" loaderRef="refwsgen" classname="com.sun.tools.ws.ant.WsGen">
> > > + <classpath>
> > > + <path refid="maven.runtime.classpath" />
> > > + <path refid="maven.compile.classpath" />
> > > + </classpath>
> > > + </taskdef>
> > > + <!-- Invoking test cases that need to generate artifacts using wsGen -->
> > > + <ant antfile="wsgen-tests.xml" inheritall="true" inheritrefs="true"
> > > + dir="." target="run-wsgen-tests"/>
> > > </tasks>
> > > </configuration>
> > > <goals>
> > > @@ -374,6 +412,13 @@
> > > <plugin>
> > > <groupId>org.apache.maven.plugins</groupId>
> > > <artifactId>maven-surefire-report-plugin</artifactId>
> > > + <reportSets>
> > > + <reportSet>
> > > + <reports>
> > > + <report>report-only</report>
> > > + </reports>
> > > + </reportSet>
> > > + </reportSets>
> > > </plugin>
> > > </plugins>
> > > </reporting>
> > >
> > > Modified: axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
> > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java?rev=963508&r1=963507&r2=963508&view=diff
> > > ==============================================================================
> > > --- axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java (original)
> > > +++ axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java Mon Jul 12 22:16:54 2010
> > > @@ -238,12 +238,27 @@ class ArtifactProcessor {
> > > wrapperClass = newValue;
> > > }
> > > }
> > > - if(cls==null && (type.equals("@WebFault")|| type.equals("faultInfo"))){
> > > +
> > > + if(cls==null &&
> > > + (type.equals("@RequestWrapper")|| type.equals("@ResponseWrapper")||type.equals("@WebFault")|| type.equals("faultInfo"))){
> > > +
> > > + //Support for Fault Bean Generation
> > > //As per JAX-WS 2.2 Specification section 3.7 an application programmer can choose not to
> > > //package the faultBeans, if we have reached this point in the code then user has choosen
> > > //not to package the fault bean. If there is a cache of generated artifacts available then
> > > //lets look for the missing faultBean there.
> > > -
> > > +
> > > + //Support for Wrapper Bean Generation
> > > + //As per JAX-WS 2.2 Specificaiton section 3.6.2.1 pg 41 an application programmer does not use
> > > + //the wrapper bean classes, so the application need not package these classes. If we have reached
> > > + //this point in the code then user has choosen not to package these beans.
> > > +
> > > + //NOTE:If we find Generated artifacts from cache this guarantees that we will not use
> > > + //DocLitWrappedMinimum marshaller code. The advantage of normal DocLitWrappedMarshaller is
> > > + //that it is very robust and has support of lot more datatypes than in DocLitWrappedMinimum.
> > > + if(log.isDebugEnabled()){
> > > + log.debug("Adding cache to classpath");
> > > + }
> > > ClassFinderFactory cff =
> > > (ClassFinderFactory)FactoryRegistry.getFactory(ClassFinderFactory.class);
> > > ClassFinder cf = cff.getClassFinder();
> > > @@ -317,11 +332,26 @@ class ArtifactProcessor {
> > > if (cls2 == null) {
> > > cls2 = loadClassOrNull(defaultValue, altClassLoader);
> > > }
> > > - if(cls2==null && (type.equals("faultInfo")|| type.equals("@WebFault"))){
> > > - //As per JAX-WS 2.2 Specification section 3.7 an application programmer can choose not to
> > > - //package the faultBeans, if we have reached this point in the code then user has choosen
> > > - //not to package the fault bean. If there is a cache of generated artifacts available then
> > > - //lets look for the missing faultBean there.
> > > + if(cls2==null &&
> > > + (type.equals("@RequestWrapper")|| type.equals("@ResponseWrapper")||type.equals("@WebFault")|| type.equals("faultInfo"))){
> > > +
> > > + //Support for Fault Bean Generation
> > > + //As per JAX-WS 2.2 Specification section 3.7 an application programmer can choose not to
> > > + //package the faultBeans, if we have reached this point in the code then user has choosen
> > > + //not to package the fault bean. If there is a cache of generated artifacts available then
> > > + //lets look for the missing faultBean there.
> > > +
> > > + //Support for Wrapper Bean Generation
> > > + //As per JAX-WS 2.2 Specificaiton section 3.6.2.1 pg 41 an application programmer does not use
> > > + //the wrapper bean classes, so the application need not package these classes. If we have reached
> > > + //this point in the code then user has choosen not to package these beans.
> > > +
> > > + //NOTE:If we find Generated artifacts from cache this guarantees that we will not use
> > > + //DocLitWrappedMinimum marshaller code. The advantage of normal DocLitWrappedMarshaller is
> > > + //that it is very robust and has support of lot more datatypes than in DocLitWrappedMinimum.
> > > + if(log.isDebugEnabled()){
> > > + log.debug("Adding cache to classpath");
> > > + }
> > > if(log.isDebugEnabled()){
> > > log.debug("Adding cache to classpath");
> > > }
> > >
> > > Added: axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
> > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java?rev=963508&view=auto
> > > ==============================================================================
> > > --- axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java (added)
> > > +++ axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java Mon Jul 12 22:16:54 2010
> > > @@ -0,0 +1,18 @@
> > > +
> > > +package org.apache.axis2.jaxws.wrapper.beans;
> > > +
> > > +import javax.xml.ws.WebFault;
> > > +
> > > +@WebFault(name = "AddNumbersFault", targetNamespace = "http://org/test/addnumbers")
> > > +public class AddNumbersException extends Exception
> > > +{
> > > +
> > > + private String message = null;
> > > + public AddNumbersException(){}
> > > + public AddNumbersException(String message){
> > > + this.message = message;
> > > + }
> > > + public String getInfo(){
> > > + return message;
> > > + }
> > > +}
> > >
> > > Added: axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
> > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java?rev=963508&view=auto
> > > ==============================================================================
> > > --- axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java (added)
> > > +++ axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java Mon Jul 12 22:16:54 2010
> > > @@ -0,0 +1,15 @@
> > > +package org.apache.axis2.jaxws.wrapper.beans;
> > > +
> > > +
> > > +
> > > +@javax.jws.WebService (targetNamespace="http://org/test/addnumbers", serviceName="AddNumbersService", portName="AddNumbersPort")
> > > +public class AddNumbersService{
> > > +
> > > + public int addNumbers(int arg0, int arg1) throws AddNumbersException {
> > > + if(arg0+arg1<0){
> > > + throw new AddNumbersException("sum is less than 0");
> > > + }
> > > + return arg0+arg1;
> > > + }
> > > +
> > > +}
> > > \ No newline at end of file
> > >
> > > Added: axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
> > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java?rev=963508&view=auto
> > > ==============================================================================
> > > --- axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java (added)
> > > +++ axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java Mon Jul 12 22:16:54 2010
> > > @@ -0,0 +1,114 @@
> > > +/**
> > > + *
> > > + */
> > > +package org.apache.axis2.jaxws.wrapper.beans;
> > > +
> > > +
> > > +import org.apache.axis2.jaxws.Constants;
> > > +import org.apache.axis2.jaxws.description.DescriptionFactory;
> > > +import org.apache.axis2.jaxws.description.EndpointDescription;
> > > +import org.apache.axis2.jaxws.description.EndpointDescriptionJava;
> > > +import org.apache.axis2.jaxws.description.OperationDescription;
> > > +import org.apache.axis2.jaxws.description.ServiceDescription;
> > > +import org.apache.axis2.jaxws.marshaller.MethodMarshaller;
> > > +import org.apache.axis2.jaxws.marshaller.factory.MethodMarshallerFactory;
> > > +import org.apache.axis2.jaxws.marshaller.impl.alt.DocLitWrappedMinimalMethodMarshaller;
> > > +import org.apache.axis2.jaxws.unitTest.TestLogger;
> > > +
> > > +import java.io.File;
> > > +
> > > +import junit.framework.TestCase;
> > > +
> > > +public class WrapperBeanMarshallTests extends TestCase {
> > > + /**
> > > + * This is the negative test case, when we do not use generated artifacts from cache
> > > + * and user did not package wrapper beans, we should see use of DocLitWrappedMinumumMarshaller.
> > > + */
> > > + public void testGetMarshallerOperationDescriptionBooleanNegative() {
> > > + TestLogger.logger.debug("---------------------------------------");
> > > + TestLogger.logger.debug("test: " + getName());
> > > +
> > > + String cache_location = "/target/wscache/classes";
> > > + try{
> > > + String baseDir = new File(System.getProperty("basedir",".")).getCanonicalPath();
> > > + cache_location = new File(baseDir+cache_location).getAbsolutePath();
> > > + TestLogger.logger.debug("cache location ="+cache_location);
> > > +
> > > + //Get EndpointDescription.
> > > + //Set location on AxisConfiguraiton.
> > > + Class sei = AddNumbersService.class;
> > > + EndpointDescription description = getEndpointDesc(sei);
> > > + TestLogger.logger.debug("description objects where created successfully");
> > > + OperationDescription[] ops =description.getEndpointInterfaceDescription().getOperations();
> > > + assertNotNull( "OperationDescriptions where null", ops);
> > > + assertTrue("No Operation Descriptions where found", ops.length>0);
> > > + OperationDescription op = ops[0];
> > > + TestLogger.logger.debug("operation found, java methodName="+op.getJavaMethodName());
> > > + //Don not Set cache on AxisConfiguration.
> > > + //get Marshaller, verify its not DoclitWrappedMinimum.
> > > + TestLogger.logger.debug("ws_cache location NOT set on AxisConfigContext, location="+cache_location);
> > > + MethodMarshaller mm = MethodMarshallerFactory.getMarshaller(op, false);
> > > + assertNotNull("getMarshaller returned null", mm );
> > > + TestLogger.logger.debug("MethodMarshaller was created, type="+mm.getClass().getName());
> > > + assertTrue("Generated artifacts not found, Method marshaller should be DocLitWrappedMinimumMarshaller", (mm instanceof DocLitWrappedMinimalMethodMarshaller));
> > > + }catch(Exception e){
> > > + TestLogger.logger.debug("Exception ="+e.getMessage());
> > > + fail(e.getMessage());
> > > + }
> > > +
> > > + }
> > > + /**
> > > + * In this test case user did not package wrapper beans but we add generated artifacts from cache, we should see use of
> > > + * DocLitWrappedMarshaller.
> > > + * Test method for {@link org.apache.axis2.jaxws.marshaller.factory.MethodMarshallerFactory#getMarshaller(org.apache.axis2.jaxws.description.OperationDescription, boolean)}.
> > > + */
> > > + public void testGetMarshallerOperationDescriptionBoolean() {
> > > + TestLogger.logger.debug("---------------------------------------");
> > > + TestLogger.logger.debug("test: " + getName());
> > > +
> > > + String cache_location = "/target/wscache/classes";
> > > + try{
> > > + String baseDir = new File(System.getProperty("basedir",".")).getCanonicalPath();
> > > + cache_location = new File(baseDir+cache_location).getAbsolutePath();
> > > + TestLogger.logger.debug("cache location ="+cache_location);
> > > +
> > > + //Get EndpointDescription.
> > > + //Set location on AxisConfiguraiton.
> > > + Class sei = AddNumbersService.class;
> > > + EndpointDescription description = getEndpointDesc(sei);
> > > + TestLogger.logger.debug("description objects where created successfully");
> > > + OperationDescription[] ops =description.getEndpointInterfaceDescription().getOperations();
> > > + assertNotNull( "OperationDescriptions where null", ops);
> > > + assertTrue("No Operation Descriptions where found", ops.length>0);
> > > + OperationDescription op = ops[0];
> > > + TestLogger.logger.debug("operation found, java methodName="+op.getJavaMethodName());
> > > + //Set cache on AxisConfiguration.
> > > + //get Marshaller, verify its not DoclitWrappedMinimum.
> > > + description.getServiceDescription().getAxisConfigContext().setProperty(Constants.WS_CACHE, cache_location);
> > > + TestLogger.logger.debug("ws_cache location set on AxisConfigContext, location="+cache_location);
> > > + MethodMarshaller mm = MethodMarshallerFactory.getMarshaller(op, false);
> > > + assertNotNull("getMarshaller returned null", mm );
> > > + TestLogger.logger.debug("MethodMarshaller was created, type="+mm.getClass().getName());
> > > + assertTrue("Generated artifacts are in cache, Method marshaller should not be DocLitWrappedMinimumMarshaller", !(mm instanceof DocLitWrappedMinimalMethodMarshaller));
> > > + }catch(Exception e){
> > > + TestLogger.logger.debug("Exception ="+e.getMessage());
> > > + fail(e.getMessage());
> > > + }
> > > +
> > > + }
> > > +
> > > + private EndpointDescription getEndpointDesc(Class implementationClass) {
> > > + // Use the description factory directly; this will be done within the JAX-WS runtime
> > > + ServiceDescription serviceDesc =
> > > + DescriptionFactory.createServiceDescription(implementationClass);
> > > + assertNotNull(serviceDesc);
> > > +
> > > + EndpointDescription[] endpointDesc = serviceDesc.getEndpointDescriptions();
> > > + assertNotNull(endpointDesc);
> > > + assertEquals(1, endpointDesc.length);
> > > +
> > > + // TODO: How will the JAX-WS dispatcher get the appropriate port (i.e. endpoint)? Currently assumes [0]
> > > + EndpointDescription testEndpointDesc = endpointDesc[0];
> > > + return testEndpointDesc;
> > > + }
> > > +}
> > >
> > > Added: axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml
> > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml?rev=963508&view=auto
> > > ==============================================================================
> > > --- axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml (added)
> > > +++ axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml Mon Jul 12 22:16:54 2010
> > > @@ -0,0 +1,34 @@
> > > +<?xml version="1.0" encoding="UTF-8"?>
> > > +
> > > +<project basedir="." default="run-wsgen-tests" name="wsgen-tests">
> > > +
> > > + <property name="wscache.output.base.dir" value="target/wscache" />
> > > + <property name="wscache.generated.src.dir" value="${wscache.output.base.dir}/src" />
> > > + <property name="wscache.generated.classes.dir" value="${wscache.output.base.dir}/classes" />
> > > + <property name="compile.test.classes" value="target/test-classes" />
> > > +
> > > +
> > > + <target name="run-wsgen-tests" depends="wrapper-beans"/>
> > > +
> > > +
> > > + <target name="create-cache">
> > > + <mkdir dir="${wscache.output.base.dir}" />
> > > + <mkdir dir="${wscache.generated.src.dir}" />
> > > + <mkdir dir="${wscache.generated.classes.dir}" />
> > > + </target>
> > > +
> > > + <target name="wrapper-beans" depends="create-cache">
> > > + <echo>Generating artifacts for org.apache.axis2.jaxws.wrapper.beans.AddNumbersService </echo>
> > > + <wsgen
> > > + sei="org.apache.axis2.jaxws.wrapper.beans.AddNumbersService"
> > > + destdir="${wscache.generated.classes.dir}"
> > > + resourcedestdir="${wscache.generated.src.dir}"
> > > + keep="false"
> > > + verbose="false"
> > > + genwsdl="true">
> > > + <classpath>
> > > + <pathelement path="${compile.test.classes}" />
> > > + </classpath>
> > > + </wsgen>
> > > + </target>
> > > +</project>
> > > \ No newline at end of file
> > >
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
> > For additional commands, e-mail: java-dev-help@axis.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-dev-help@axis.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org
Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws:
./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/
test/org/apache/axis2/jaxws/wrapper/ test/org/apache/axis2/jaxws/wrapper/beans/
Posted by Jarek Gawor <jg...@gmail.com>.
Just a couple of thoughts:
1) Since you already have wsgen-tests.xml ant script to run the wsgen
you could setup the appropriate classpath to the tools.jar or
classes.jar or whatever in it. You just might need to fork the ant
process.
2) I don't think it's that horrible to commit some generate code
especially if there isn't too much of it and the test case is
important. Besides, Axis2 already has some generated code checked it.
Jarek
On Wed, Jul 14, 2010 at 4:00 PM, Nikhil V Thaker
<ni...@us.ibm.com> wrote:
>
> Yes Andreas,
> I am running antrun plugin as the wsGen plugin has errors and is not fully matured, here's the URL that explains the issue I ran into http://jira.codehaus.org/browse/MNG-3586.
>
> So since I cannot run wsGen or cannot include generated artifacts I will just remove the test case. I will commit the changes soon.
>
> Regards,
>
> Nikhil Thaker
> office: 919 254 9964
> nvthaker@us.ibm.com
>
>
> Andreas Veithen <an...@gmail.com>
>
> 07/14/2010 02:48 PM
>
> Please respond to
> java-dev@axis.apache.org
> To
> java-dev@axis.apache.org
> cc
> Subject
> Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws: ./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ test/org/apache/axis2/jaxws/wrapper/ test/org/apache/axis2/jaxws/wrapper/beans/
>
>
>
>
> No, you are using the antrun plugin to execute the wsgen ant task.
> What I meant was to use a real Maven plugin (either the one from
> java.net or the one from CXF).
>
> -1 to commit any generated stuff into SVN.
>
> Andreas
>
> On Wed, Jul 14, 2010 at 21:42, Nikhil V Thaker
> <ni...@us.ibm.com> wrote:
> >
> > Andreas - I had to add the tools.jar bit because maven plugin for wsGen gave NoClassDef Found errors for classes packaged in tools.jar.
> >
> > Since this is causing a problem I will just package the generated artifacts and remove the wsGen dependency.
> >
> > Thanks,
> >
> > Nikhil Thaker
> > office: 919 254 9964
> > nvthaker@us.ibm.com
> >
> >
> > Andreas Veithen <an...@gmail.com>
> >
> > 07/14/2010 01:44 PM
> >
> > Please respond to
> > java-dev@axis.apache.org
> > To
> > java-dev@axis.apache.org
> > cc
> > Subject
> > Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws: ./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ test/org/apache/axis2/jaxws/wrapper/ test/org/apache/axis2/jaxws/wrapper/beans/
> >
> >
> >
> >
> > Nikhil,
> >
> > I have some issues with the tools and jaxws-tools dependencies
> > introduced by this change:
> >
> > * The change causes a build failure in Hudson. There will also be
> > additional issues with tools.jar, because the way to declare this as a
> > system dependency varies from one JDK to another. For example, I
> > remember that on Mac OS X, it is completely different than on other
> > JDKs.
> >
> > * I don't like the fact that jaxws-tools becomes a dependency of
> > axis2-jaxws in scope compile, because it looks like this is only
> > needed during the build and/or during the tests.
> >
> > I didn't review the change in detail, but wouldn't it be smarter to
> > use one of the existing Maven plugins to do the wsgen stuff? They will
> > take care of the tools.jar stuff as well.
> >
> > Andreas
> >
> > On Tue, Jul 13, 2010 at 00:16, <nt...@apache.org> wrote:
> > > Author: nthaker
> > > Date: Mon Jul 12 22:16:54 2010
> > > New Revision: 963508
> > >
> > > URL: http://svn.apache.org/viewvc?rev=963508&view=rev
> > > Log:
> > > AXIS2-4775
> > > This change ensures that we will use Request and Response wrapper Bean packaged by customer or we will Generate Wrappers if they are not packaged.
> > >
> > > Added:
> > > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/
> > > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/
> > > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
> > > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
> > > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
> > > axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml
> > > Modified:
> > > axis/axis2/java/core/trunk/modules/jaxws/pom.xml
> > > axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
> > >
> > > Modified: axis/axis2/java/core/trunk/modules/jaxws/pom.xml
> > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/pom.xml?rev=963508&r1=963507&r2=963508&view=diff
> > > ==============================================================================
> > > --- axis/axis2/java/core/trunk/modules/jaxws/pom.xml (original)
> > > +++ axis/axis2/java/core/trunk/modules/jaxws/pom.xml Mon Jul 12 22:16:54 2010
> > > @@ -1,5 +1,4 @@
> > > <?xml version="1.0" encoding="UTF-8"?>
> > > -
> > > <!-- > ~ Licensed to the Apache Software Foundation (ASF) under one
> > > ~ or more contributor license agreements. See the NOTICE file
> > > @@ -20,7 +19,7 @@
> > > -->
> > >
> > > <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> > > - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
> > > + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
> > > <modelVersion>4.0.0</modelVersion>
> > > <parent>
> > > <groupId>org.apache.axis2</groupId>
> > > @@ -98,7 +97,25 @@
> > > <version>${version}</version>
> > > <scope>test</scope>
> > > </dependency>
> > > + <dependency>
> > > + <groupId>wsdl4j</groupId>
> > > + <artifactId>wsdl4j</artifactId>
> > > + </dependency>
> > > + <dependency>
> > > + <groupId>com.sun.xml.ws</groupId>
> > > + <artifactId>jaxws-tools</artifactId>
> > > + <version>2.1.3</version>
> > > + </dependency>
> > > + <!-- If we dont include tools.jar as dependency, maven throws NoClassDefFound on wsGen run -->
> > > + <dependency>
> > > + <groupId>java</groupId>
> > > + <artifactId>tools</artifactId>
> > > + <version>$version</version>
> > > + <scope>system</scope>
> > > + <systemPath>${JAVA_HOME}/lib/tools.jar</systemPath>
> > > + </dependency>
> > > </dependencies>
> > > +
> > > <build>
> > > <sourceDirectory>src</sourceDirectory>
> > > <testSourceDirectory>test</testSourceDirectory>
> > > @@ -203,34 +220,39 @@
> > > <compilerVersion>1.5</compilerVersion>
> > > <source>1.5</source>
> > > <target>1.5</target>
> > > +
> > > </configuration>
> > > </plugin>
> > > <plugin>
> > > <groupId>org.apache.maven.plugins</groupId>
> > > <artifactId>maven-antrun-plugin</artifactId>
> > > +
> > > <executions>
> > > <execution>
> > > <id>gen-ts</id>
> > > <phase>generate-test-sources</phase>
> > > <configuration>
> > > - <tasks unless="maven.test.skip">
> > > + <tasks unless="maven.test.skip">
> > > <!-- Theres got to be a better way to do this -->
> > > <property name="schema.source.dir" value="test-resources/xsd"/>
> > > <property name="wsdl.source.dir" value="test-resources/wsdl"/>
> > > - <property name="schema.output.base.dir" value="target/schema"/>
> > > + <property name="schema.output.base.dir" value="target/schema"/>
> > > <property name="schema.generated.src.dir" value="${schema.output.base.dir}/src"/>
> > > <property name="schema.generated.classes.dir"
> > > value="${schema.output.base.dir}/classes"/>
> > > +
> > > <!-- make the dirs -->
> > > <mkdir dir="${schema.output.base.dir}"/>
> > > <mkdir dir="${schema.generated.src.dir}"/>
> > > <mkdir dir="${schema.generated.classes.dir}"/>
> > > +
> > > <!-- Run JAXB schema compiler with designated schemas -->
> > > <echo>Generating JAX-B classes from XSDs</echo>
> > >
> > > <echo>Generating java from echo.xsd</echo>
> > > <java classname="com.sun.tools.xjc.Driver" fork="true">
> > > <classpath refid="maven.runtime.classpath"/>
> > > +
> > > <classpath location="${compiled.classes.dir}"/>
> > > <arg line="-d ${schema.generated.src.dir} -quiet ${schema.source.dir}/echo.xsd"/>
> > > </java>
> > > @@ -266,7 +288,7 @@
> > > <classpath refid="maven.runtime.classpath"/>
> > > <classpath location="${compiled.classes.dir}"/>
> > > <arg line="-d ${schema.generated.src.dir} -quiet -wsdl ${wsdl.source.dir}/AddNumbers.wsdl"/>
> > > - </java>
> > > + </java>
> > > </tasks>
> > > </configuration>
> > > <goals>
> > > @@ -287,6 +309,22 @@
> > > <property name="addressing_version" value="${version}"/>
> > > <ant antfile="build.xml" inheritall="true" inheritrefs="true"
> > > dir="." target="build-repo"/>
> > > +
> > > + <property name="compile_classpath" refid="maven.compile.classpath" />
> > > + <property name="runtime_classpath" refid="maven.runtime.classpath" />
> > > + <property name="test_classpath" refid="maven.test.classpath" />
> > > + <property name="plugin_classpath" refid="maven.plugin.classpath" />
> > > +
> > > + <!-- Defining wsGen task -->
> > > + <taskdef name="wsgen" loaderRef="refwsgen" classname="com.sun.tools.ws.ant.WsGen">
> > > + <classpath>
> > > + <path refid="maven.runtime.classpath" />
> > > + <path refid="maven.compile.classpath" />
> > > + </classpath>
> > > + </taskdef>
> > > + <!-- Invoking test cases that need to generate artifacts using wsGen -->
> > > + <ant antfile="wsgen-tests.xml" inheritall="true" inheritrefs="true"
> > > + dir="." target="run-wsgen-tests"/>
> > > </tasks>
> > > </configuration>
> > > <goals>
> > > @@ -374,6 +412,13 @@
> > > <plugin>
> > > <groupId>org.apache.maven.plugins</groupId>
> > > <artifactId>maven-surefire-report-plugin</artifactId>
> > > + <reportSets>
> > > + <reportSet>
> > > + <reports>
> > > + <report>report-only</report>
> > > + </reports>
> > > + </reportSet>
> > > + </reportSets>
> > > </plugin>
> > > </plugins>
> > > </reporting>
> > >
> > > Modified: axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
> > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java?rev=963508&r1=963507&r2=963508&view=diff
> > > ==============================================================================
> > > --- axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java (original)
> > > +++ axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java Mon Jul 12 22:16:54 2010
> > > @@ -238,12 +238,27 @@ class ArtifactProcessor {
> > > wrapperClass = newValue;
> > > }
> > > }
> > > - if(cls==null && (type.equals("@WebFault")|| type.equals("faultInfo"))){
> > > +
> > > + if(cls==null &&
> > > + (type.equals("@RequestWrapper")|| type.equals("@ResponseWrapper")||type.equals("@WebFault")|| type.equals("faultInfo"))){
> > > +
> > > + //Support for Fault Bean Generation
> > > //As per JAX-WS 2.2 Specification section 3.7 an application programmer can choose not to
> > > //package the faultBeans, if we have reached this point in the code then user has choosen
> > > //not to package the fault bean. If there is a cache of generated artifacts available then
> > > //lets look for the missing faultBean there.
> > > -
> > > +
> > > + //Support for Wrapper Bean Generation
> > > + //As per JAX-WS 2.2 Specificaiton section 3.6.2.1 pg 41 an application programmer does not use
> > > + //the wrapper bean classes, so the application need not package these classes. If we have reached
> > > + //this point in the code then user has choosen not to package these beans.
> > > +
> > > + //NOTE:If we find Generated artifacts from cache this guarantees that we will not use
> > > + //DocLitWrappedMinimum marshaller code. The advantage of normal DocLitWrappedMarshaller is
> > > + //that it is very robust and has support of lot more datatypes than in DocLitWrappedMinimum.
> > > + if(log.isDebugEnabled()){
> > > + log.debug("Adding cache to classpath");
> > > + }
> > > ClassFinderFactory cff =
> > > (ClassFinderFactory)FactoryRegistry.getFactory(ClassFinderFactory.class);
> > > ClassFinder cf = cff.getClassFinder();
> > > @@ -317,11 +332,26 @@ class ArtifactProcessor {
> > > if (cls2 == null) {
> > > cls2 = loadClassOrNull(defaultValue, altClassLoader);
> > > }
> > > - if(cls2==null && (type.equals("faultInfo")|| type.equals("@WebFault"))){
> > > - //As per JAX-WS 2.2 Specification section 3.7 an application programmer can choose not to
> > > - //package the faultBeans, if we have reached this point in the code then user has choosen
> > > - //not to package the fault bean. If there is a cache of generated artifacts available then
> > > - //lets look for the missing faultBean there.
> > > + if(cls2==null &&
> > > + (type.equals("@RequestWrapper")|| type.equals("@ResponseWrapper")||type.equals("@WebFault")|| type.equals("faultInfo"))){
> > > +
> > > + //Support for Fault Bean Generation
> > > + //As per JAX-WS 2.2 Specification section 3.7 an application programmer can choose not to
> > > + //package the faultBeans, if we have reached this point in the code then user has choosen
> > > + //not to package the fault bean. If there is a cache of generated artifacts available then
> > > + //lets look for the missing faultBean there.
> > > +
> > > + //Support for Wrapper Bean Generation
> > > + //As per JAX-WS 2.2 Specificaiton section 3.6.2.1 pg 41 an application programmer does not use
> > > + //the wrapper bean classes, so the application need not package these classes. If we have reached
> > > + //this point in the code then user has choosen not to package these beans.
> > > +
> > > + //NOTE:If we find Generated artifacts from cache this guarantees that we will not use
> > > + //DocLitWrappedMinimum marshaller code. The advantage of normal DocLitWrappedMarshaller is
> > > + //that it is very robust and has support of lot more datatypes than in DocLitWrappedMinimum.
> > > + if(log.isDebugEnabled()){
> > > + log.debug("Adding cache to classpath");
> > > + }
> > > if(log.isDebugEnabled()){
> > > log.debug("Adding cache to classpath");
> > > }
> > >
> > > Added: axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
> > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java?rev=963508&view=auto
> > > ==============================================================================
> > > --- axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java (added)
> > > +++ axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java Mon Jul 12 22:16:54 2010
> > > @@ -0,0 +1,18 @@
> > > +
> > > +package org.apache.axis2.jaxws.wrapper.beans;
> > > +
> > > +import javax.xml.ws.WebFault;
> > > +
> > > +@WebFault(name = "AddNumbersFault", targetNamespace = "http://org/test/addnumbers")
> > > +public class AddNumbersException extends Exception
> > > +{
> > > +
> > > + private String message = null;
> > > + public AddNumbersException(){}
> > > + public AddNumbersException(String message){
> > > + this.message = message;
> > > + }
> > > + public String getInfo(){
> > > + return message;
> > > + }
> > > +}
> > >
> > > Added: axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
> > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java?rev=963508&view=auto
> > > ==============================================================================
> > > --- axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java (added)
> > > +++ axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java Mon Jul 12 22:16:54 2010
> > > @@ -0,0 +1,15 @@
> > > +package org.apache.axis2.jaxws.wrapper.beans;
> > > +
> > > +
> > > +
> > > +@javax.jws.WebService (targetNamespace="http://org/test/addnumbers", serviceName="AddNumbersService", portName="AddNumbersPort")
> > > +public class AddNumbersService{
> > > +
> > > + public int addNumbers(int arg0, int arg1) throws AddNumbersException {
> > > + if(arg0+arg1<0){
> > > + throw new AddNumbersException("sum is less than 0");
> > > + }
> > > + return arg0+arg1;
> > > + }
> > > +
> > > +}
> > > \ No newline at end of file
> > >
> > > Added: axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
> > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java?rev=963508&view=auto
> > > ==============================================================================
> > > --- axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java (added)
> > > +++ axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java Mon Jul 12 22:16:54 2010
> > > @@ -0,0 +1,114 @@
> > > +/**
> > > + *
> > > + */
> > > +package org.apache.axis2.jaxws.wrapper.beans;
> > > +
> > > +
> > > +import org.apache.axis2.jaxws.Constants;
> > > +import org.apache.axis2.jaxws.description.DescriptionFactory;
> > > +import org.apache.axis2.jaxws.description.EndpointDescription;
> > > +import org.apache.axis2.jaxws.description.EndpointDescriptionJava;
> > > +import org.apache.axis2.jaxws.description.OperationDescription;
> > > +import org.apache.axis2.jaxws.description.ServiceDescription;
> > > +import org.apache.axis2.jaxws.marshaller.MethodMarshaller;
> > > +import org.apache.axis2.jaxws.marshaller.factory.MethodMarshallerFactory;
> > > +import org.apache.axis2.jaxws.marshaller.impl.alt.DocLitWrappedMinimalMethodMarshaller;
> > > +import org.apache.axis2.jaxws.unitTest.TestLogger;
> > > +
> > > +import java.io.File;
> > > +
> > > +import junit.framework.TestCase;
> > > +
> > > +public class WrapperBeanMarshallTests extends TestCase {
> > > + /**
> > > + * This is the negative test case, when we do not use generated artifacts from cache
> > > + * and user did not package wrapper beans, we should see use of DocLitWrappedMinumumMarshaller.
> > > + */
> > > + public void testGetMarshallerOperationDescriptionBooleanNegative() {
> > > + TestLogger.logger.debug("---------------------------------------");
> > > + TestLogger.logger.debug("test: " + getName());
> > > +
> > > + String cache_location = "/target/wscache/classes";
> > > + try{
> > > + String baseDir = new File(System.getProperty("basedir",".")).getCanonicalPath();
> > > + cache_location = new File(baseDir+cache_location).getAbsolutePath();
> > > + TestLogger.logger.debug("cache location ="+cache_location);
> > > +
> > > + //Get EndpointDescription.
> > > + //Set location on AxisConfiguraiton.
> > > + Class sei = AddNumbersService.class;
> > > + EndpointDescription description = getEndpointDesc(sei);
> > > + TestLogger.logger.debug("description objects where created successfully");
> > > + OperationDescription[] ops =description.getEndpointInterfaceDescription().getOperations();
> > > + assertNotNull( "OperationDescriptions where null", ops);
> > > + assertTrue("No Operation Descriptions where found", ops.length>0);
> > > + OperationDescription op = ops[0];
> > > + TestLogger.logger.debug("operation found, java methodName="+op.getJavaMethodName());
> > > + //Don not Set cache on AxisConfiguration.
> > > + //get Marshaller, verify its not DoclitWrappedMinimum.
> > > + TestLogger.logger.debug("ws_cache location NOT set on AxisConfigContext, location="+cache_location);
> > > + MethodMarshaller mm = MethodMarshallerFactory.getMarshaller(op, false);
> > > + assertNotNull("getMarshaller returned null", mm );
> > > + TestLogger.logger.debug("MethodMarshaller was created, type="+mm.getClass().getName());
> > > + assertTrue("Generated artifacts not found, Method marshaller should be DocLitWrappedMinimumMarshaller", (mm instanceof DocLitWrappedMinimalMethodMarshaller));
> > > + }catch(Exception e){
> > > + TestLogger.logger.debug("Exception ="+e.getMessage());
> > > + fail(e.getMessage());
> > > + }
> > > +
> > > + }
> > > + /**
> > > + * In this test case user did not package wrapper beans but we add generated artifacts from cache, we should see use of
> > > + * DocLitWrappedMarshaller.
> > > + * Test method for {@link org.apache.axis2.jaxws.marshaller.factory.MethodMarshallerFactory#getMarshaller(org.apache.axis2.jaxws.description.OperationDescription, boolean)}.
> > > + */
> > > + public void testGetMarshallerOperationDescriptionBoolean() {
> > > + TestLogger.logger.debug("---------------------------------------");
> > > + TestLogger.logger.debug("test: " + getName());
> > > +
> > > + String cache_location = "/target/wscache/classes";
> > > + try{
> > > + String baseDir = new File(System.getProperty("basedir",".")).getCanonicalPath();
> > > + cache_location = new File(baseDir+cache_location).getAbsolutePath();
> > > + TestLogger.logger.debug("cache location ="+cache_location);
> > > +
> > > + //Get EndpointDescription.
> > > + //Set location on AxisConfiguraiton.
> > > + Class sei = AddNumbersService.class;
> > > + EndpointDescription description = getEndpointDesc(sei);
> > > + TestLogger.logger.debug("description objects where created successfully");
> > > + OperationDescription[] ops =description.getEndpointInterfaceDescription().getOperations();
> > > + assertNotNull( "OperationDescriptions where null", ops);
> > > + assertTrue("No Operation Descriptions where found", ops.length>0);
> > > + OperationDescription op = ops[0];
> > > + TestLogger.logger.debug("operation found, java methodName="+op.getJavaMethodName());
> > > + //Set cache on AxisConfiguration.
> > > + //get Marshaller, verify its not DoclitWrappedMinimum.
> > > + description.getServiceDescription().getAxisConfigContext().setProperty(Constants.WS_CACHE, cache_location);
> > > + TestLogger.logger.debug("ws_cache location set on AxisConfigContext, location="+cache_location);
> > > + MethodMarshaller mm = MethodMarshallerFactory.getMarshaller(op, false);
> > > + assertNotNull("getMarshaller returned null", mm );
> > > + TestLogger.logger.debug("MethodMarshaller was created, type="+mm.getClass().getName());
> > > + assertTrue("Generated artifacts are in cache, Method marshaller should not be DocLitWrappedMinimumMarshaller", !(mm instanceof DocLitWrappedMinimalMethodMarshaller));
> > > + }catch(Exception e){
> > > + TestLogger.logger.debug("Exception ="+e.getMessage());
> > > + fail(e.getMessage());
> > > + }
> > > +
> > > + }
> > > +
> > > + private EndpointDescription getEndpointDesc(Class implementationClass) {
> > > + // Use the description factory directly; this will be done within the JAX-WS runtime
> > > + ServiceDescription serviceDesc =
> > > + DescriptionFactory.createServiceDescription(implementationClass);
> > > + assertNotNull(serviceDesc);
> > > +
> > > + EndpointDescription[] endpointDesc = serviceDesc.getEndpointDescriptions();
> > > + assertNotNull(endpointDesc);
> > > + assertEquals(1, endpointDesc.length);
> > > +
> > > + // TODO: How will the JAX-WS dispatcher get the appropriate port (i.e. endpoint)? Currently assumes [0]
> > > + EndpointDescription testEndpointDesc = endpointDesc[0];
> > > + return testEndpointDesc;
> > > + }
> > > +}
> > >
> > > Added: axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml
> > > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml?rev=963508&view=auto
> > > ==============================================================================
> > > --- axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml (added)
> > > +++ axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml Mon Jul 12 22:16:54 2010
> > > @@ -0,0 +1,34 @@
> > > +<?xml version="1.0" encoding="UTF-8"?>
> > > +
> > > +<project basedir="." default="run-wsgen-tests" name="wsgen-tests">
> > > +
> > > + <property name="wscache.output.base.dir" value="target/wscache" />
> > > + <property name="wscache.generated.src.dir" value="${wscache.output.base.dir}/src" />
> > > + <property name="wscache.generated.classes.dir" value="${wscache.output.base.dir}/classes" />
> > > + <property name="compile.test.classes" value="target/test-classes" />
> > > +
> > > +
> > > + <target name="run-wsgen-tests" depends="wrapper-beans"/>
> > > +
> > > +
> > > + <target name="create-cache">
> > > + <mkdir dir="${wscache.output.base.dir}" />
> > > + <mkdir dir="${wscache.generated.src.dir}" />
> > > + <mkdir dir="${wscache.generated.classes.dir}" />
> > > + </target>
> > > +
> > > + <target name="wrapper-beans" depends="create-cache">
> > > + <echo>Generating artifacts for org.apache.axis2.jaxws.wrapper.beans.AddNumbersService </echo>
> > > + <wsgen
> > > + sei="org.apache.axis2.jaxws.wrapper.beans.AddNumbersService"
> > > + destdir="${wscache.generated.classes.dir}"
> > > + resourcedestdir="${wscache.generated.src.dir}"
> > > + keep="false"
> > > + verbose="false"
> > > + genwsdl="true">
> > > + <classpath>
> > > + <pathelement path="${compile.test.classes}" />
> > > + </classpath>
> > > + </wsgen>
> > > + </target>
> > > +</project>
> > > \ No newline at end of file
> > >
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
> > For additional commands, e-mail: java-dev-help@axis.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-dev-help@axis.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org
Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws: ./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/
test/org/apache/axis2/jaxws/wrapper/ test/org/apache/axis2/jaxws/wrapper/beans/
Posted by Nikhil V Thaker <ni...@us.ibm.com>.
Yes Andreas,
I am running antrun plugin as the wsGen plugin has errors and is not
fully matured, here's the URL that explains the issue I ran into
http://jira.codehaus.org/browse/MNG-3586.
So since I cannot run wsGen or cannot include generated artifacts I will
just remove the test case. I will commit the changes soon.
Regards,
Nikhil Thaker
office: 919 254 9964
nvthaker@us.ibm.com
Andreas Veithen <an...@gmail.com>
07/14/2010 02:48 PM
Please respond to
java-dev@axis.apache.org
To
java-dev@axis.apache.org
cc
Subject
Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws: ./
src/org/apache/axis2/jaxws/runtime/description/marshal/impl/
test/org/apache/axis2/jaxws/wrapper/
test/org/apache/axis2/jaxws/wrapper/beans/
No, you are using the antrun plugin to execute the wsgen ant task.
What I meant was to use a real Maven plugin (either the one from
java.net or the one from CXF).
-1 to commit any generated stuff into SVN.
Andreas
On Wed, Jul 14, 2010 at 21:42, Nikhil V Thaker
<ni...@us.ibm.com> wrote:
>
> Andreas - I had to add the tools.jar bit because maven plugin for wsGen
gave NoClassDef Found errors for classes packaged in tools.jar.
>
> Since this is causing a problem I will just package the generated
artifacts and remove the wsGen dependency.
>
> Thanks,
>
> Nikhil Thaker
> office: 919 254 9964
> nvthaker@us.ibm.com
>
>
> Andreas Veithen <an...@gmail.com>
>
> 07/14/2010 01:44 PM
>
> Please respond to
> java-dev@axis.apache.org
> To
> java-dev@axis.apache.org
> cc
> Subject
> Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws:
./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/
test/org/apache/axis2/jaxws/wrapper/
test/org/apache/axis2/jaxws/wrapper/beans/
>
>
>
>
> Nikhil,
>
> I have some issues with the tools and jaxws-tools dependencies
> introduced by this change:
>
> * The change causes a build failure in Hudson. There will also be
> additional issues with tools.jar, because the way to declare this as a
> system dependency varies from one JDK to another. For example, I
> remember that on Mac OS X, it is completely different than on other
> JDKs.
>
> * I don't like the fact that jaxws-tools becomes a dependency of
> axis2-jaxws in scope compile, because it looks like this is only
> needed during the build and/or during the tests.
>
> I didn't review the change in detail, but wouldn't it be smarter to
> use one of the existing Maven plugins to do the wsgen stuff? They will
> take care of the tools.jar stuff as well.
>
> Andreas
>
> On Tue, Jul 13, 2010 at 00:16, <nt...@apache.org> wrote:
> > Author: nthaker
> > Date: Mon Jul 12 22:16:54 2010
> > New Revision: 963508
> >
> > URL: http://svn.apache.org/viewvc?rev=963508&view=rev
> > Log:
> > AXIS2-4775
> > This change ensures that we will use Request and Response wrapper Bean
packaged by customer or we will Generate Wrappers if they are not
packaged.
> >
> > Added:
> >
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/
> >
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/
> >
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
> >
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
> >
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
> > axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml
> > Modified:
> > axis/axis2/java/core/trunk/modules/jaxws/pom.xml
> >
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
> >
> > Modified: axis/axis2/java/core/trunk/modules/jaxws/pom.xml
> > URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/pom.xml?rev=963508&r1=963507&r2=963508&view=diff
> >
==============================================================================
> > --- axis/axis2/java/core/trunk/modules/jaxws/pom.xml (original)
> > +++ axis/axis2/java/core/trunk/modules/jaxws/pom.xml Mon Jul 12
22:16:54 2010
> > @@ -1,5 +1,4 @@
> > <?xml version="1.0" encoding="UTF-8"?>
> > -
> > <!-- > ~ Licensed to the Apache Software Foundation (ASF) under one
> > ~ or more contributor license agreements. See the NOTICE file
> > @@ -20,7 +19,7 @@
> > -->
> >
> > <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"
> > - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
> > + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
> > <modelVersion>4.0.0</modelVersion>
> > <parent>
> > <groupId>org.apache.axis2</groupId>
> > @@ -98,7 +97,25 @@
> > <version>${version}</version>
> > <scope>test</scope>
> > </dependency>
> > + <dependency>
> > + <groupId>wsdl4j</groupId>
> > + <artifactId>wsdl4j</artifactId>
> > + </dependency>
> > + <dependency>
> > + <groupId>com.sun.xml.ws</groupId>
> > + <artifactId>jaxws-tools</artifactId>
> > + <version>2.1.3</version>
> > + </dependency>
> > + <!-- If we dont include tools.jar as dependency, maven throws
NoClassDefFound on wsGen run -->
> > + <dependency>
> > + <groupId>java</groupId>
> > + <artifactId>tools</artifactId>
> > + <version>$version</version>
> > + <scope>system</scope>
> > + <systemPath>${JAVA_HOME}/lib/tools.jar</systemPath>
> > + </dependency>
> > </dependencies>
> > +
> > <build>
> > <sourceDirectory>src</sourceDirectory>
> > <testSourceDirectory>test</testSourceDirectory>
> > @@ -203,34 +220,39 @@
> > <compilerVersion>1.5</compilerVersion>
> > <source>1.5</source>
> > <target>1.5</target>
> > +
> > </configuration>
> > </plugin>
> > <plugin>
> > <groupId>org.apache.maven.plugins</groupId>
> > <artifactId>maven-antrun-plugin</artifactId>
> > +
> > <executions>
> > <execution>
> > <id>gen-ts</id>
> > <phase>generate-test-sources</phase>
> > <configuration>
> > - <tasks unless="maven.test.skip">
> > + <tasks unless="maven.test.skip">
> > <!-- Theres got to be a better way to
do this -->
> > <property name="schema.source.dir"
value="test-resources/xsd"/>
> > <property name="wsdl.source.dir"
value="test-resources/wsdl"/>
> > - <property
name="schema.output.base.dir" value="target/schema"/>
> > + <property
name="schema.output.base.dir" value="target/schema"/>
> > <property
name="schema.generated.src.dir" value="${schema.output.base.dir}/src"/>
> > <property
name="schema.generated.classes.dir"
> >
value="${schema.output.base.dir}/classes"/>
> > +
> > <!-- make the dirs -->
> > <mkdir
dir="${schema.output.base.dir}"/>
> > <mkdir
dir="${schema.generated.src.dir}"/>
> > <mkdir
dir="${schema.generated.classes.dir}"/>
> > +
> > <!-- Run JAXB schema compiler with
designated schemas -->
> > <echo>Generating JAX-B classes from
XSDs</echo>
> >
> > <echo>Generating java from
echo.xsd</echo>
> > <java
classname="com.sun.tools.xjc.Driver" fork="true">
> > <classpath
refid="maven.runtime.classpath"/>
> > +
> > <classpath
location="${compiled.classes.dir}"/>
> > <arg line="-d
${schema.generated.src.dir} -quiet ${schema.source.dir}/echo.xsd"/>
> > </java>
> > @@ -266,7 +288,7 @@
> > <classpath
refid="maven.runtime.classpath"/>
> > <classpath
location="${compiled.classes.dir}"/>
> > <arg line="-d
${schema.generated.src.dir} -quiet -wsdl
${wsdl.source.dir}/AddNumbers.wsdl"/>
> > - </java>
> > + </java>
> > </tasks>
> > </configuration>
> > <goals>
> > @@ -287,6 +309,22 @@
> > <property name="addressing_version"
value="${version}"/>
> > <ant antfile="build.xml"
inheritall="true" inheritrefs="true"
> > dir="." target="build-repo"/>
> > +
> > +
<property name="compile_classpath" refid="maven.compile.classpath" />
> > +
<property name="runtime_classpath" refid="maven.runtime.classpath" />
> > +
<property name="test_classpath" refid="maven.test.classpath" />
> > +
<property name="plugin_classpath" refid="maven.plugin.classpath" />
> > +
> > + <!-- Defining wsGen task -->
> > +
<taskdef name="wsgen" loaderRef="refwsgen"
classname="com.sun.tools.ws.ant.WsGen">
> > +
<classpath>
> > +
<path refid="maven.runtime.classpath" />
> > +
<path refid="maven.compile.classpath" />
> > +
</classpath>
> > +
</taskdef>
> > + <!--
Invoking test cases that need to generate artifacts using wsGen -->
> > + <ant antfile="wsgen-tests.xml"
inheritall="true" inheritrefs="true"
> > + dir="."
target="run-wsgen-tests"/>
> > </tasks>
> > </configuration>
> > <goals>
> > @@ -374,6 +412,13 @@
> > <plugin>
> > <groupId>org.apache.maven.plugins</groupId>
> > <artifactId>maven-surefire-report-plugin</artifactId>
> > + <reportSets>
> > + <reportSet>
> > + <reports>
> > + <report>report-only</report>
> > + </reports>
> > + </reportSet>
> > + </reportSets>
> > </plugin>
> > </plugins>
> > </reporting>
> >
> > Modified:
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
> > URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java?rev=963508&r1=963507&r2=963508&view=diff
> >
==============================================================================
> > ---
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
(original)
> > +++
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
Mon Jul 12 22:16:54 2010
> > @@ -238,12 +238,27 @@ class ArtifactProcessor {
> > wrapperClass = newValue;
> > }
> > }
> > - if(cls==null && (type.equals("@WebFault")||
type.equals("faultInfo"))){
> > +
> > + if(cls==null &&
> > + (type.equals("@RequestWrapper")||
type.equals("@ResponseWrapper")||type.equals("@WebFault")||
type.equals("faultInfo"))){
> > +
> > + //Support for Fault Bean Generation
> > //As per JAX-WS 2.2 Specification section
3.7 an application programmer can choose not to
> > //package the faultBeans, if we have
reached this point in the code then user has choosen
> > //not to package the fault bean. If there
is a cache of generated artifacts available then
> > //lets look for the missing faultBean
there.
> > -
> > +
> > + //Support for Wrapper Bean Generation
> > + //As per JAX-WS 2.2 Specificaiton section
3.6.2.1 pg 41 an application programmer does not use
> > + //the wrapper bean classes, so the
application need not package these classes. If we have reached
> > + //this point in the code then user has
choosen not to package these beans.
> > +
> > + //NOTE:If we find Generated artifacts
from cache this guarantees that we will not use
> > + //DocLitWrappedMinimum marshaller code.
The advantage of normal DocLitWrappedMarshaller is
> > + //that it is very robust and has support
of lot more datatypes than in DocLitWrappedMinimum.
> > + if(log.isDebugEnabled()){
> > + log.debug("Adding cache to
classpath");
> > + }
> > ClassFinderFactory cff =
> >
(ClassFinderFactory)FactoryRegistry.getFactory(ClassFinderFactory.class);
> > ClassFinder cf = cff.getClassFinder();
> > @@ -317,11 +332,26 @@ class ArtifactProcessor {
> > if (cls2 == null) {
> > cls2 = loadClassOrNull(defaultValue,
altClassLoader);
> > }
> > - if(cls2==null && (type.equals("faultInfo")||
type.equals("@WebFault"))){
> > - //As per JAX-WS 2.2 Specification section
3.7 an application programmer can choose not to
> > - //package the faultBeans, if we have
reached this point in the code then user has choosen
> > - //not to package the fault bean. If there
is a cache of generated artifacts available then
> > - //lets look for the missing faultBean
there.
> > + if(cls2==null &&
> > +
(type.equals("@RequestWrapper")||
type.equals("@ResponseWrapper")||type.equals("@WebFault")||
type.equals("faultInfo"))){
> > +
> > + //Support for Fault Bean Generation
> > + //As per JAX-WS 2.2 Specification
section 3.7 an application programmer can choose not to
> > + //package the faultBeans, if we have
reached this point in the code then user has choosen
> > + //not to package the fault bean. If
there is a cache of generated artifacts available then
> > + //lets look for the missing faultBean
there.
> > +
> > + //Support for Wrapper Bean Generation
> > + //As per JAX-WS 2.2 Specificaiton
section 3.6.2.1 pg 41 an application programmer does not use
> > + //the wrapper bean classes, so the
application need not package these classes. If we have reached
> > + //this point in the code then user has
choosen not to package these beans.
> > +
> > + //NOTE:If we find Generated artifacts
from cache this guarantees that we will not use
> > + //DocLitWrappedMinimum marshaller
code. The advantage of normal DocLitWrappedMarshaller is
> > + //that it is very robust and has
support of lot more datatypes than in DocLitWrappedMinimum.
> > + if(log.isDebugEnabled()){
> > + log.debug("Adding cache to
classpath");
> > + }
> > if(log.isDebugEnabled()){
> > log.debug("Adding cache to
classpath");
> > }
> >
> > Added:
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
> > URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java?rev=963508&view=auto
> >
==============================================================================
> > ---
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
(added)
> > +++
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
Mon Jul 12 22:16:54 2010
> > @@ -0,0 +1,18 @@
> > +
> > +package org.apache.axis2.jaxws.wrapper.beans;
> > +
> > +import javax.xml.ws.WebFault;
> > +
> > +@WebFault(name = "AddNumbersFault", targetNamespace = "
http://org/test/addnumbers")
> > +public class AddNumbersException extends Exception
> > +{
> > +
> > + private String message = null;
> > + public AddNumbersException(){}
> > + public AddNumbersException(String message){
> > + this.message = message;
> > + }
> > + public String getInfo(){
> > + return message;
> > + }
> > +}
> >
> > Added:
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
> > URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java?rev=963508&view=auto
> >
==============================================================================
> > ---
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
(added)
> > +++
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
Mon Jul 12 22:16:54 2010
> > @@ -0,0 +1,15 @@
> > +package org.apache.axis2.jaxws.wrapper.beans;
> > +
> > +
> > +
> > +@javax.jws.WebService (targetNamespace="http://org/test/addnumbers",
serviceName="AddNumbersService", portName="AddNumbersPort")
> > +public class AddNumbersService{
> > +
> > + public int addNumbers(int arg0, int arg1) throws
AddNumbersException {
> > + if(arg0+arg1<0){
> > + throw new AddNumbersException("sum is less
than 0");
> > + }
> > + return arg0+arg1;
> > + }
> > +
> > +}
> > \ No newline at end of file
> >
> > Added:
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
> > URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java?rev=963508&view=auto
> >
==============================================================================
> > ---
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
(added)
> > +++
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
Mon Jul 12 22:16:54 2010
> > @@ -0,0 +1,114 @@
> > +/**
> > + *
> > + */
> > +package org.apache.axis2.jaxws.wrapper.beans;
> > +
> > +
> > +import org.apache.axis2.jaxws.Constants;
> > +import org.apache.axis2.jaxws.description.DescriptionFactory;
> > +import org.apache.axis2.jaxws.description.EndpointDescription;
> > +import org.apache.axis2.jaxws.description.EndpointDescriptionJava;
> > +import org.apache.axis2.jaxws.description.OperationDescription;
> > +import org.apache.axis2.jaxws.description.ServiceDescription;
> > +import org.apache.axis2.jaxws.marshaller.MethodMarshaller;
> > +import
org.apache.axis2.jaxws.marshaller.factory.MethodMarshallerFactory;
> > +import
org.apache.axis2.jaxws.marshaller.impl.alt.DocLitWrappedMinimalMethodMarshaller;
> > +import org.apache.axis2.jaxws.unitTest.TestLogger;
> > +
> > +import java.io.File;
> > +
> > +import junit.framework.TestCase;
> > +
> > +public class WrapperBeanMarshallTests extends TestCase {
> > + /**
> > + * This is the negative test case, when we do not use generated
artifacts from cache
> > + * and user did not package wrapper beans, we should see use of
DocLitWrappedMinumumMarshaller.
> > + */
> > + public void
testGetMarshallerOperationDescriptionBooleanNegative() {
> > +
TestLogger.logger.debug("---------------------------------------");
> > + TestLogger.logger.debug("test: " + getName());
> > +
> > + String cache_location = "/target/wscache/classes";
> > + try{
> > + String baseDir = new
File(System.getProperty("basedir",".")).getCanonicalPath();
> > + cache_location = new
File(baseDir+cache_location).getAbsolutePath();
> > + TestLogger.logger.debug("cache location
="+cache_location);
> > +
> > + //Get EndpointDescription.
> > + //Set location on AxisConfiguraiton.
> > + Class sei = AddNumbersService.class;
> > + EndpointDescription description = getEndpointDesc(sei);
> > + TestLogger.logger.debug("description objects where
created successfully");
> > + OperationDescription[] ops
=description.getEndpointInterfaceDescription().getOperations();
> > + assertNotNull( "OperationDescriptions where null", ops);
> > + assertTrue("No Operation Descriptions where found",
ops.length>0);
> > + OperationDescription op = ops[0];
> > + TestLogger.logger.debug("operation found, java
methodName="+op.getJavaMethodName());
> > + //Don not Set cache on AxisConfiguration.
> > + //get Marshaller, verify its not DoclitWrappedMinimum.
> > + TestLogger.logger.debug("ws_cache location NOT set on
AxisConfigContext, location="+cache_location);
> > + MethodMarshaller mm =
MethodMarshallerFactory.getMarshaller(op, false);
> > + assertNotNull("getMarshaller returned null", mm );
> > + TestLogger.logger.debug("MethodMarshaller was created,
type="+mm.getClass().getName());
> > + assertTrue("Generated artifacts not found, Method
marshaller should be DocLitWrappedMinimumMarshaller", (mm instanceof
DocLitWrappedMinimalMethodMarshaller));
> > + }catch(Exception e){
> > + TestLogger.logger.debug("Exception ="+e.getMessage());
> > + fail(e.getMessage());
> > + }
> > +
> > + }
> > + /**
> > + * In this test case user did not package wrapper beans but we
add generated artifacts from cache, we should see use of
> > + * DocLitWrappedMarshaller.
> > + * Test method for {@link
org.apache.axis2.jaxws.marshaller.factory.MethodMarshallerFactory#getMarshaller(org.apache.axis2.jaxws.description.OperationDescription,
boolean)}.
> > + */
> > + public void testGetMarshallerOperationDescriptionBoolean() {
> > +
TestLogger.logger.debug("---------------------------------------");
> > + TestLogger.logger.debug("test: " + getName());
> > +
> > + String cache_location = "/target/wscache/classes";
> > + try{
> > + String baseDir = new
File(System.getProperty("basedir",".")).getCanonicalPath();
> > + cache_location = new
File(baseDir+cache_location).getAbsolutePath();
> > + TestLogger.logger.debug("cache location
="+cache_location);
> > +
> > + //Get EndpointDescription.
> > + //Set location on AxisConfiguraiton.
> > + Class sei = AddNumbersService.class;
> > + EndpointDescription description = getEndpointDesc(sei);
> > + TestLogger.logger.debug("description objects where
created successfully");
> > + OperationDescription[] ops
=description.getEndpointInterfaceDescription().getOperations();
> > + assertNotNull( "OperationDescriptions where null", ops);
> > + assertTrue("No Operation Descriptions where found",
ops.length>0);
> > + OperationDescription op = ops[0];
> > + TestLogger.logger.debug("operation found, java
methodName="+op.getJavaMethodName());
> > + //Set cache on AxisConfiguration.
> > + //get Marshaller, verify its not DoclitWrappedMinimum.
> > +
description.getServiceDescription().getAxisConfigContext().setProperty(Constants.WS_CACHE,
cache_location);
> > + TestLogger.logger.debug("ws_cache location set on
AxisConfigContext, location="+cache_location);
> > + MethodMarshaller mm =
MethodMarshallerFactory.getMarshaller(op, false);
> > + assertNotNull("getMarshaller returned null", mm );
> > + TestLogger.logger.debug("MethodMarshaller was created,
type="+mm.getClass().getName());
> > + assertTrue("Generated artifacts are in cache, Method
marshaller should not be DocLitWrappedMinimumMarshaller", !(mm instanceof
DocLitWrappedMinimalMethodMarshaller));
> > + }catch(Exception e){
> > + TestLogger.logger.debug("Exception ="+e.getMessage());
> > + fail(e.getMessage());
> > + }
> > +
> > + }
> > +
> > + private EndpointDescription getEndpointDesc(Class
implementationClass) {
> > + // Use the description factory directly; this will be done
within the JAX-WS runtime
> > + ServiceDescription serviceDesc =
> > +
DescriptionFactory.createServiceDescription(implementationClass);
> > + assertNotNull(serviceDesc);
> > +
> > + EndpointDescription[] endpointDesc =
serviceDesc.getEndpointDescriptions();
> > + assertNotNull(endpointDesc);
> > + assertEquals(1, endpointDesc.length);
> > +
> > + // TODO: How will the JAX-WS dispatcher get the appropriate
port (i.e. endpoint)? Currently assumes [0]
> > + EndpointDescription testEndpointDesc = endpointDesc[0];
> > + return testEndpointDesc;
> > + }
> > +}
> >
> > Added: axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml
> > URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml?rev=963508&view=auto
> >
==============================================================================
> > --- axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml (added)
> > +++ axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml Mon Jul
12 22:16:54 2010
> > @@ -0,0 +1,34 @@
> > +<?xml version="1.0" encoding="UTF-8"?>
> > +
> > +<project basedir="." default="run-wsgen-tests" name="wsgen-tests">
> > +
> > + <property name="wscache.output.base.dir"
value="target/wscache" />
> > + <property name="wscache.generated.src.dir"
value="${wscache.output.base.dir}/src" />
> > + <property name="wscache.generated.classes.dir"
value="${wscache.output.base.dir}/classes" />
> > + <property name="compile.test.classes"
value="target/test-classes" />
> > +
> > +
> > + <target name="run-wsgen-tests" depends="wrapper-beans"/>
> > +
> > +
> > + <target name="create-cache">
> > + <mkdir dir="${wscache.output.base.dir}" />
> > + <mkdir dir="${wscache.generated.src.dir}" />
> > + <mkdir dir="${wscache.generated.classes.dir}" />
> > + </target>
> > +
> > + <target name="wrapper-beans" depends="create-cache">
> > + <echo>Generating artifacts for
org.apache.axis2.jaxws.wrapper.beans.AddNumbersService </echo>
> > + <wsgen
> > +
sei="org.apache.axis2.jaxws.wrapper.beans.AddNumbersService"
> > + destdir="${wscache.generated.classes.dir}"
> > + resourcedestdir="${wscache.generated.src.dir}"
> > + keep="false"
> > + verbose="false"
> > + genwsdl="true">
> > + <classpath>
> > + <pathelement path="${compile.test.classes}" />
> > + </classpath>
> > + </wsgen>
> > + </target>
> > +</project>
> > \ No newline at end of file
> >
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-dev-help@axis.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org
Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws: ./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/
test/org/apache/axis2/jaxws/wrapper/ test/org/apache/axis2/jaxws/wrapper/beans/
Posted by Nikhil V Thaker <ni...@us.ibm.com>.
Yes Andreas,
I am running antrun plugin as the wsGen plugin has errors and is not
fully matured, here's the URL that explains the issue I ran into
http://jira.codehaus.org/browse/MNG-3586.
So since I cannot run wsGen or cannot include generated artifacts I will
just remove the test case. I will commit the changes soon.
Regards,
Nikhil Thaker
office: 919 254 9964
nvthaker@us.ibm.com
Andreas Veithen <an...@gmail.com>
07/14/2010 02:48 PM
Please respond to
java-dev@axis.apache.org
To
java-dev@axis.apache.org
cc
Subject
Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws: ./
src/org/apache/axis2/jaxws/runtime/description/marshal/impl/
test/org/apache/axis2/jaxws/wrapper/
test/org/apache/axis2/jaxws/wrapper/beans/
No, you are using the antrun plugin to execute the wsgen ant task.
What I meant was to use a real Maven plugin (either the one from
java.net or the one from CXF).
-1 to commit any generated stuff into SVN.
Andreas
On Wed, Jul 14, 2010 at 21:42, Nikhil V Thaker
<ni...@us.ibm.com> wrote:
>
> Andreas - I had to add the tools.jar bit because maven plugin for wsGen
gave NoClassDef Found errors for classes packaged in tools.jar.
>
> Since this is causing a problem I will just package the generated
artifacts and remove the wsGen dependency.
>
> Thanks,
>
> Nikhil Thaker
> office: 919 254 9964
> nvthaker@us.ibm.com
>
>
> Andreas Veithen <an...@gmail.com>
>
> 07/14/2010 01:44 PM
>
> Please respond to
> java-dev@axis.apache.org
> To
> java-dev@axis.apache.org
> cc
> Subject
> Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws:
./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/
test/org/apache/axis2/jaxws/wrapper/
test/org/apache/axis2/jaxws/wrapper/beans/
>
>
>
>
> Nikhil,
>
> I have some issues with the tools and jaxws-tools dependencies
> introduced by this change:
>
> * The change causes a build failure in Hudson. There will also be
> additional issues with tools.jar, because the way to declare this as a
> system dependency varies from one JDK to another. For example, I
> remember that on Mac OS X, it is completely different than on other
> JDKs.
>
> * I don't like the fact that jaxws-tools becomes a dependency of
> axis2-jaxws in scope compile, because it looks like this is only
> needed during the build and/or during the tests.
>
> I didn't review the change in detail, but wouldn't it be smarter to
> use one of the existing Maven plugins to do the wsgen stuff? They will
> take care of the tools.jar stuff as well.
>
> Andreas
>
> On Tue, Jul 13, 2010 at 00:16, <nt...@apache.org> wrote:
> > Author: nthaker
> > Date: Mon Jul 12 22:16:54 2010
> > New Revision: 963508
> >
> > URL: http://svn.apache.org/viewvc?rev=963508&view=rev
> > Log:
> > AXIS2-4775
> > This change ensures that we will use Request and Response wrapper Bean
packaged by customer or we will Generate Wrappers if they are not
packaged.
> >
> > Added:
> >
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/
> >
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/
> >
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
> >
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
> >
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
> > axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml
> > Modified:
> > axis/axis2/java/core/trunk/modules/jaxws/pom.xml
> >
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
> >
> > Modified: axis/axis2/java/core/trunk/modules/jaxws/pom.xml
> > URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/pom.xml?rev=963508&r1=963507&r2=963508&view=diff
> >
==============================================================================
> > --- axis/axis2/java/core/trunk/modules/jaxws/pom.xml (original)
> > +++ axis/axis2/java/core/trunk/modules/jaxws/pom.xml Mon Jul 12
22:16:54 2010
> > @@ -1,5 +1,4 @@
> > <?xml version="1.0" encoding="UTF-8"?>
> > -
> > <!-- > ~ Licensed to the Apache Software Foundation (ASF) under one
> > ~ or more contributor license agreements. See the NOTICE file
> > @@ -20,7 +19,7 @@
> > -->
> >
> > <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"
> > - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
> > + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
> > <modelVersion>4.0.0</modelVersion>
> > <parent>
> > <groupId>org.apache.axis2</groupId>
> > @@ -98,7 +97,25 @@
> > <version>${version}</version>
> > <scope>test</scope>
> > </dependency>
> > + <dependency>
> > + <groupId>wsdl4j</groupId>
> > + <artifactId>wsdl4j</artifactId>
> > + </dependency>
> > + <dependency>
> > + <groupId>com.sun.xml.ws</groupId>
> > + <artifactId>jaxws-tools</artifactId>
> > + <version>2.1.3</version>
> > + </dependency>
> > + <!-- If we dont include tools.jar as dependency, maven throws
NoClassDefFound on wsGen run -->
> > + <dependency>
> > + <groupId>java</groupId>
> > + <artifactId>tools</artifactId>
> > + <version>$version</version>
> > + <scope>system</scope>
> > + <systemPath>${JAVA_HOME}/lib/tools.jar</systemPath>
> > + </dependency>
> > </dependencies>
> > +
> > <build>
> > <sourceDirectory>src</sourceDirectory>
> > <testSourceDirectory>test</testSourceDirectory>
> > @@ -203,34 +220,39 @@
> > <compilerVersion>1.5</compilerVersion>
> > <source>1.5</source>
> > <target>1.5</target>
> > +
> > </configuration>
> > </plugin>
> > <plugin>
> > <groupId>org.apache.maven.plugins</groupId>
> > <artifactId>maven-antrun-plugin</artifactId>
> > +
> > <executions>
> > <execution>
> > <id>gen-ts</id>
> > <phase>generate-test-sources</phase>
> > <configuration>
> > - <tasks unless="maven.test.skip">
> > + <tasks unless="maven.test.skip">
> > <!-- Theres got to be a better way to
do this -->
> > <property name="schema.source.dir"
value="test-resources/xsd"/>
> > <property name="wsdl.source.dir"
value="test-resources/wsdl"/>
> > - <property
name="schema.output.base.dir" value="target/schema"/>
> > + <property
name="schema.output.base.dir" value="target/schema"/>
> > <property
name="schema.generated.src.dir" value="${schema.output.base.dir}/src"/>
> > <property
name="schema.generated.classes.dir"
> >
value="${schema.output.base.dir}/classes"/>
> > +
> > <!-- make the dirs -->
> > <mkdir
dir="${schema.output.base.dir}"/>
> > <mkdir
dir="${schema.generated.src.dir}"/>
> > <mkdir
dir="${schema.generated.classes.dir}"/>
> > +
> > <!-- Run JAXB schema compiler with
designated schemas -->
> > <echo>Generating JAX-B classes from
XSDs</echo>
> >
> > <echo>Generating java from
echo.xsd</echo>
> > <java
classname="com.sun.tools.xjc.Driver" fork="true">
> > <classpath
refid="maven.runtime.classpath"/>
> > +
> > <classpath
location="${compiled.classes.dir}"/>
> > <arg line="-d
${schema.generated.src.dir} -quiet ${schema.source.dir}/echo.xsd"/>
> > </java>
> > @@ -266,7 +288,7 @@
> > <classpath
refid="maven.runtime.classpath"/>
> > <classpath
location="${compiled.classes.dir}"/>
> > <arg line="-d
${schema.generated.src.dir} -quiet -wsdl
${wsdl.source.dir}/AddNumbers.wsdl"/>
> > - </java>
> > + </java>
> > </tasks>
> > </configuration>
> > <goals>
> > @@ -287,6 +309,22 @@
> > <property name="addressing_version"
value="${version}"/>
> > <ant antfile="build.xml"
inheritall="true" inheritrefs="true"
> > dir="." target="build-repo"/>
> > +
> > +
<property name="compile_classpath" refid="maven.compile.classpath" />
> > +
<property name="runtime_classpath" refid="maven.runtime.classpath" />
> > +
<property name="test_classpath" refid="maven.test.classpath" />
> > +
<property name="plugin_classpath" refid="maven.plugin.classpath" />
> > +
> > + <!-- Defining wsGen task -->
> > +
<taskdef name="wsgen" loaderRef="refwsgen"
classname="com.sun.tools.ws.ant.WsGen">
> > +
<classpath>
> > +
<path refid="maven.runtime.classpath" />
> > +
<path refid="maven.compile.classpath" />
> > +
</classpath>
> > +
</taskdef>
> > + <!--
Invoking test cases that need to generate artifacts using wsGen -->
> > + <ant antfile="wsgen-tests.xml"
inheritall="true" inheritrefs="true"
> > + dir="."
target="run-wsgen-tests"/>
> > </tasks>
> > </configuration>
> > <goals>
> > @@ -374,6 +412,13 @@
> > <plugin>
> > <groupId>org.apache.maven.plugins</groupId>
> > <artifactId>maven-surefire-report-plugin</artifactId>
> > + <reportSets>
> > + <reportSet>
> > + <reports>
> > + <report>report-only</report>
> > + </reports>
> > + </reportSet>
> > + </reportSets>
> > </plugin>
> > </plugins>
> > </reporting>
> >
> > Modified:
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
> > URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java?rev=963508&r1=963507&r2=963508&view=diff
> >
==============================================================================
> > ---
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
(original)
> > +++
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
Mon Jul 12 22:16:54 2010
> > @@ -238,12 +238,27 @@ class ArtifactProcessor {
> > wrapperClass = newValue;
> > }
> > }
> > - if(cls==null && (type.equals("@WebFault")||
type.equals("faultInfo"))){
> > +
> > + if(cls==null &&
> > + (type.equals("@RequestWrapper")||
type.equals("@ResponseWrapper")||type.equals("@WebFault")||
type.equals("faultInfo"))){
> > +
> > + //Support for Fault Bean Generation
> > //As per JAX-WS 2.2 Specification section
3.7 an application programmer can choose not to
> > //package the faultBeans, if we have
reached this point in the code then user has choosen
> > //not to package the fault bean. If there
is a cache of generated artifacts available then
> > //lets look for the missing faultBean
there.
> > -
> > +
> > + //Support for Wrapper Bean Generation
> > + //As per JAX-WS 2.2 Specificaiton section
3.6.2.1 pg 41 an application programmer does not use
> > + //the wrapper bean classes, so the
application need not package these classes. If we have reached
> > + //this point in the code then user has
choosen not to package these beans.
> > +
> > + //NOTE:If we find Generated artifacts
from cache this guarantees that we will not use
> > + //DocLitWrappedMinimum marshaller code.
The advantage of normal DocLitWrappedMarshaller is
> > + //that it is very robust and has support
of lot more datatypes than in DocLitWrappedMinimum.
> > + if(log.isDebugEnabled()){
> > + log.debug("Adding cache to
classpath");
> > + }
> > ClassFinderFactory cff =
> >
(ClassFinderFactory)FactoryRegistry.getFactory(ClassFinderFactory.class);
> > ClassFinder cf = cff.getClassFinder();
> > @@ -317,11 +332,26 @@ class ArtifactProcessor {
> > if (cls2 == null) {
> > cls2 = loadClassOrNull(defaultValue,
altClassLoader);
> > }
> > - if(cls2==null && (type.equals("faultInfo")||
type.equals("@WebFault"))){
> > - //As per JAX-WS 2.2 Specification section
3.7 an application programmer can choose not to
> > - //package the faultBeans, if we have
reached this point in the code then user has choosen
> > - //not to package the fault bean. If there
is a cache of generated artifacts available then
> > - //lets look for the missing faultBean
there.
> > + if(cls2==null &&
> > +
(type.equals("@RequestWrapper")||
type.equals("@ResponseWrapper")||type.equals("@WebFault")||
type.equals("faultInfo"))){
> > +
> > + //Support for Fault Bean Generation
> > + //As per JAX-WS 2.2 Specification
section 3.7 an application programmer can choose not to
> > + //package the faultBeans, if we have
reached this point in the code then user has choosen
> > + //not to package the fault bean. If
there is a cache of generated artifacts available then
> > + //lets look for the missing faultBean
there.
> > +
> > + //Support for Wrapper Bean Generation
> > + //As per JAX-WS 2.2 Specificaiton
section 3.6.2.1 pg 41 an application programmer does not use
> > + //the wrapper bean classes, so the
application need not package these classes. If we have reached
> > + //this point in the code then user has
choosen not to package these beans.
> > +
> > + //NOTE:If we find Generated artifacts
from cache this guarantees that we will not use
> > + //DocLitWrappedMinimum marshaller
code. The advantage of normal DocLitWrappedMarshaller is
> > + //that it is very robust and has
support of lot more datatypes than in DocLitWrappedMinimum.
> > + if(log.isDebugEnabled()){
> > + log.debug("Adding cache to
classpath");
> > + }
> > if(log.isDebugEnabled()){
> > log.debug("Adding cache to
classpath");
> > }
> >
> > Added:
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
> > URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java?rev=963508&view=auto
> >
==============================================================================
> > ---
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
(added)
> > +++
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
Mon Jul 12 22:16:54 2010
> > @@ -0,0 +1,18 @@
> > +
> > +package org.apache.axis2.jaxws.wrapper.beans;
> > +
> > +import javax.xml.ws.WebFault;
> > +
> > +@WebFault(name = "AddNumbersFault", targetNamespace = "
http://org/test/addnumbers")
> > +public class AddNumbersException extends Exception
> > +{
> > +
> > + private String message = null;
> > + public AddNumbersException(){}
> > + public AddNumbersException(String message){
> > + this.message = message;
> > + }
> > + public String getInfo(){
> > + return message;
> > + }
> > +}
> >
> > Added:
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
> > URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java?rev=963508&view=auto
> >
==============================================================================
> > ---
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
(added)
> > +++
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
Mon Jul 12 22:16:54 2010
> > @@ -0,0 +1,15 @@
> > +package org.apache.axis2.jaxws.wrapper.beans;
> > +
> > +
> > +
> > +@javax.jws.WebService (targetNamespace="http://org/test/addnumbers",
serviceName="AddNumbersService", portName="AddNumbersPort")
> > +public class AddNumbersService{
> > +
> > + public int addNumbers(int arg0, int arg1) throws
AddNumbersException {
> > + if(arg0+arg1<0){
> > + throw new AddNumbersException("sum is less
than 0");
> > + }
> > + return arg0+arg1;
> > + }
> > +
> > +}
> > \ No newline at end of file
> >
> > Added:
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
> > URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java?rev=963508&view=auto
> >
==============================================================================
> > ---
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
(added)
> > +++
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
Mon Jul 12 22:16:54 2010
> > @@ -0,0 +1,114 @@
> > +/**
> > + *
> > + */
> > +package org.apache.axis2.jaxws.wrapper.beans;
> > +
> > +
> > +import org.apache.axis2.jaxws.Constants;
> > +import org.apache.axis2.jaxws.description.DescriptionFactory;
> > +import org.apache.axis2.jaxws.description.EndpointDescription;
> > +import org.apache.axis2.jaxws.description.EndpointDescriptionJava;
> > +import org.apache.axis2.jaxws.description.OperationDescription;
> > +import org.apache.axis2.jaxws.description.ServiceDescription;
> > +import org.apache.axis2.jaxws.marshaller.MethodMarshaller;
> > +import
org.apache.axis2.jaxws.marshaller.factory.MethodMarshallerFactory;
> > +import
org.apache.axis2.jaxws.marshaller.impl.alt.DocLitWrappedMinimalMethodMarshaller;
> > +import org.apache.axis2.jaxws.unitTest.TestLogger;
> > +
> > +import java.io.File;
> > +
> > +import junit.framework.TestCase;
> > +
> > +public class WrapperBeanMarshallTests extends TestCase {
> > + /**
> > + * This is the negative test case, when we do not use generated
artifacts from cache
> > + * and user did not package wrapper beans, we should see use of
DocLitWrappedMinumumMarshaller.
> > + */
> > + public void
testGetMarshallerOperationDescriptionBooleanNegative() {
> > +
TestLogger.logger.debug("---------------------------------------");
> > + TestLogger.logger.debug("test: " + getName());
> > +
> > + String cache_location = "/target/wscache/classes";
> > + try{
> > + String baseDir = new
File(System.getProperty("basedir",".")).getCanonicalPath();
> > + cache_location = new
File(baseDir+cache_location).getAbsolutePath();
> > + TestLogger.logger.debug("cache location
="+cache_location);
> > +
> > + //Get EndpointDescription.
> > + //Set location on AxisConfiguraiton.
> > + Class sei = AddNumbersService.class;
> > + EndpointDescription description = getEndpointDesc(sei);
> > + TestLogger.logger.debug("description objects where
created successfully");
> > + OperationDescription[] ops
=description.getEndpointInterfaceDescription().getOperations();
> > + assertNotNull( "OperationDescriptions where null", ops);
> > + assertTrue("No Operation Descriptions where found",
ops.length>0);
> > + OperationDescription op = ops[0];
> > + TestLogger.logger.debug("operation found, java
methodName="+op.getJavaMethodName());
> > + //Don not Set cache on AxisConfiguration.
> > + //get Marshaller, verify its not DoclitWrappedMinimum.
> > + TestLogger.logger.debug("ws_cache location NOT set on
AxisConfigContext, location="+cache_location);
> > + MethodMarshaller mm =
MethodMarshallerFactory.getMarshaller(op, false);
> > + assertNotNull("getMarshaller returned null", mm );
> > + TestLogger.logger.debug("MethodMarshaller was created,
type="+mm.getClass().getName());
> > + assertTrue("Generated artifacts not found, Method
marshaller should be DocLitWrappedMinimumMarshaller", (mm instanceof
DocLitWrappedMinimalMethodMarshaller));
> > + }catch(Exception e){
> > + TestLogger.logger.debug("Exception ="+e.getMessage());
> > + fail(e.getMessage());
> > + }
> > +
> > + }
> > + /**
> > + * In this test case user did not package wrapper beans but we
add generated artifacts from cache, we should see use of
> > + * DocLitWrappedMarshaller.
> > + * Test method for {@link
org.apache.axis2.jaxws.marshaller.factory.MethodMarshallerFactory#getMarshaller(org.apache.axis2.jaxws.description.OperationDescription,
boolean)}.
> > + */
> > + public void testGetMarshallerOperationDescriptionBoolean() {
> > +
TestLogger.logger.debug("---------------------------------------");
> > + TestLogger.logger.debug("test: " + getName());
> > +
> > + String cache_location = "/target/wscache/classes";
> > + try{
> > + String baseDir = new
File(System.getProperty("basedir",".")).getCanonicalPath();
> > + cache_location = new
File(baseDir+cache_location).getAbsolutePath();
> > + TestLogger.logger.debug("cache location
="+cache_location);
> > +
> > + //Get EndpointDescription.
> > + //Set location on AxisConfiguraiton.
> > + Class sei = AddNumbersService.class;
> > + EndpointDescription description = getEndpointDesc(sei);
> > + TestLogger.logger.debug("description objects where
created successfully");
> > + OperationDescription[] ops
=description.getEndpointInterfaceDescription().getOperations();
> > + assertNotNull( "OperationDescriptions where null", ops);
> > + assertTrue("No Operation Descriptions where found",
ops.length>0);
> > + OperationDescription op = ops[0];
> > + TestLogger.logger.debug("operation found, java
methodName="+op.getJavaMethodName());
> > + //Set cache on AxisConfiguration.
> > + //get Marshaller, verify its not DoclitWrappedMinimum.
> > +
description.getServiceDescription().getAxisConfigContext().setProperty(Constants.WS_CACHE,
cache_location);
> > + TestLogger.logger.debug("ws_cache location set on
AxisConfigContext, location="+cache_location);
> > + MethodMarshaller mm =
MethodMarshallerFactory.getMarshaller(op, false);
> > + assertNotNull("getMarshaller returned null", mm );
> > + TestLogger.logger.debug("MethodMarshaller was created,
type="+mm.getClass().getName());
> > + assertTrue("Generated artifacts are in cache, Method
marshaller should not be DocLitWrappedMinimumMarshaller", !(mm instanceof
DocLitWrappedMinimalMethodMarshaller));
> > + }catch(Exception e){
> > + TestLogger.logger.debug("Exception ="+e.getMessage());
> > + fail(e.getMessage());
> > + }
> > +
> > + }
> > +
> > + private EndpointDescription getEndpointDesc(Class
implementationClass) {
> > + // Use the description factory directly; this will be done
within the JAX-WS runtime
> > + ServiceDescription serviceDesc =
> > +
DescriptionFactory.createServiceDescription(implementationClass);
> > + assertNotNull(serviceDesc);
> > +
> > + EndpointDescription[] endpointDesc =
serviceDesc.getEndpointDescriptions();
> > + assertNotNull(endpointDesc);
> > + assertEquals(1, endpointDesc.length);
> > +
> > + // TODO: How will the JAX-WS dispatcher get the appropriate
port (i.e. endpoint)? Currently assumes [0]
> > + EndpointDescription testEndpointDesc = endpointDesc[0];
> > + return testEndpointDesc;
> > + }
> > +}
> >
> > Added: axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml
> > URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml?rev=963508&view=auto
> >
==============================================================================
> > --- axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml (added)
> > +++ axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml Mon Jul
12 22:16:54 2010
> > @@ -0,0 +1,34 @@
> > +<?xml version="1.0" encoding="UTF-8"?>
> > +
> > +<project basedir="." default="run-wsgen-tests" name="wsgen-tests">
> > +
> > + <property name="wscache.output.base.dir"
value="target/wscache" />
> > + <property name="wscache.generated.src.dir"
value="${wscache.output.base.dir}/src" />
> > + <property name="wscache.generated.classes.dir"
value="${wscache.output.base.dir}/classes" />
> > + <property name="compile.test.classes"
value="target/test-classes" />
> > +
> > +
> > + <target name="run-wsgen-tests" depends="wrapper-beans"/>
> > +
> > +
> > + <target name="create-cache">
> > + <mkdir dir="${wscache.output.base.dir}" />
> > + <mkdir dir="${wscache.generated.src.dir}" />
> > + <mkdir dir="${wscache.generated.classes.dir}" />
> > + </target>
> > +
> > + <target name="wrapper-beans" depends="create-cache">
> > + <echo>Generating artifacts for
org.apache.axis2.jaxws.wrapper.beans.AddNumbersService </echo>
> > + <wsgen
> > +
sei="org.apache.axis2.jaxws.wrapper.beans.AddNumbersService"
> > + destdir="${wscache.generated.classes.dir}"
> > + resourcedestdir="${wscache.generated.src.dir}"
> > + keep="false"
> > + verbose="false"
> > + genwsdl="true">
> > + <classpath>
> > + <pathelement path="${compile.test.classes}" />
> > + </classpath>
> > + </wsgen>
> > + </target>
> > +</project>
> > \ No newline at end of file
> >
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-dev-help@axis.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org
Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws: ./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/
test/org/apache/axis2/jaxws/wrapper/ test/org/apache/axis2/jaxws/wrapper/beans/
Posted by Nikhil V Thaker <ni...@us.ibm.com>.
Yes Andreas,
I am running antrun plugin as the wsGen plugin has errors and is not
fully matured, here's the URL that explains the issue I ran into
http://jira.codehaus.org/browse/MNG-3586.
So since I cannot run wsGen or cannot include generated artifacts I will
just remove the test case. I will commit the changes soon.
Regards,
Nikhil Thaker
office: 919 254 9964
nvthaker@us.ibm.com
Andreas Veithen <an...@gmail.com>
07/14/2010 02:48 PM
Please respond to
java-dev@axis.apache.org
To
java-dev@axis.apache.org
cc
Subject
Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws: ./
src/org/apache/axis2/jaxws/runtime/description/marshal/impl/
test/org/apache/axis2/jaxws/wrapper/
test/org/apache/axis2/jaxws/wrapper/beans/
No, you are using the antrun plugin to execute the wsgen ant task.
What I meant was to use a real Maven plugin (either the one from
java.net or the one from CXF).
-1 to commit any generated stuff into SVN.
Andreas
On Wed, Jul 14, 2010 at 21:42, Nikhil V Thaker
<ni...@us.ibm.com> wrote:
>
> Andreas - I had to add the tools.jar bit because maven plugin for wsGen
gave NoClassDef Found errors for classes packaged in tools.jar.
>
> Since this is causing a problem I will just package the generated
artifacts and remove the wsGen dependency.
>
> Thanks,
>
> Nikhil Thaker
> office: 919 254 9964
> nvthaker@us.ibm.com
>
>
> Andreas Veithen <an...@gmail.com>
>
> 07/14/2010 01:44 PM
>
> Please respond to
> java-dev@axis.apache.org
> To
> java-dev@axis.apache.org
> cc
> Subject
> Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws:
./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/
test/org/apache/axis2/jaxws/wrapper/
test/org/apache/axis2/jaxws/wrapper/beans/
>
>
>
>
> Nikhil,
>
> I have some issues with the tools and jaxws-tools dependencies
> introduced by this change:
>
> * The change causes a build failure in Hudson. There will also be
> additional issues with tools.jar, because the way to declare this as a
> system dependency varies from one JDK to another. For example, I
> remember that on Mac OS X, it is completely different than on other
> JDKs.
>
> * I don't like the fact that jaxws-tools becomes a dependency of
> axis2-jaxws in scope compile, because it looks like this is only
> needed during the build and/or during the tests.
>
> I didn't review the change in detail, but wouldn't it be smarter to
> use one of the existing Maven plugins to do the wsgen stuff? They will
> take care of the tools.jar stuff as well.
>
> Andreas
>
> On Tue, Jul 13, 2010 at 00:16, <nt...@apache.org> wrote:
> > Author: nthaker
> > Date: Mon Jul 12 22:16:54 2010
> > New Revision: 963508
> >
> > URL: http://svn.apache.org/viewvc?rev=963508&view=rev
> > Log:
> > AXIS2-4775
> > This change ensures that we will use Request and Response wrapper Bean
packaged by customer or we will Generate Wrappers if they are not
packaged.
> >
> > Added:
> >
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/
> >
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/
> >
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
> >
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
> >
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
> > axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml
> > Modified:
> > axis/axis2/java/core/trunk/modules/jaxws/pom.xml
> >
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
> >
> > Modified: axis/axis2/java/core/trunk/modules/jaxws/pom.xml
> > URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/pom.xml?rev=963508&r1=963507&r2=963508&view=diff
> >
==============================================================================
> > --- axis/axis2/java/core/trunk/modules/jaxws/pom.xml (original)
> > +++ axis/axis2/java/core/trunk/modules/jaxws/pom.xml Mon Jul 12
22:16:54 2010
> > @@ -1,5 +1,4 @@
> > <?xml version="1.0" encoding="UTF-8"?>
> > -
> > <!-- > ~ Licensed to the Apache Software Foundation (ASF) under one
> > ~ or more contributor license agreements. See the NOTICE file
> > @@ -20,7 +19,7 @@
> > -->
> >
> > <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"
> > - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
> > + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
> > <modelVersion>4.0.0</modelVersion>
> > <parent>
> > <groupId>org.apache.axis2</groupId>
> > @@ -98,7 +97,25 @@
> > <version>${version}</version>
> > <scope>test</scope>
> > </dependency>
> > + <dependency>
> > + <groupId>wsdl4j</groupId>
> > + <artifactId>wsdl4j</artifactId>
> > + </dependency>
> > + <dependency>
> > + <groupId>com.sun.xml.ws</groupId>
> > + <artifactId>jaxws-tools</artifactId>
> > + <version>2.1.3</version>
> > + </dependency>
> > + <!-- If we dont include tools.jar as dependency, maven throws
NoClassDefFound on wsGen run -->
> > + <dependency>
> > + <groupId>java</groupId>
> > + <artifactId>tools</artifactId>
> > + <version>$version</version>
> > + <scope>system</scope>
> > + <systemPath>${JAVA_HOME}/lib/tools.jar</systemPath>
> > + </dependency>
> > </dependencies>
> > +
> > <build>
> > <sourceDirectory>src</sourceDirectory>
> > <testSourceDirectory>test</testSourceDirectory>
> > @@ -203,34 +220,39 @@
> > <compilerVersion>1.5</compilerVersion>
> > <source>1.5</source>
> > <target>1.5</target>
> > +
> > </configuration>
> > </plugin>
> > <plugin>
> > <groupId>org.apache.maven.plugins</groupId>
> > <artifactId>maven-antrun-plugin</artifactId>
> > +
> > <executions>
> > <execution>
> > <id>gen-ts</id>
> > <phase>generate-test-sources</phase>
> > <configuration>
> > - <tasks unless="maven.test.skip">
> > + <tasks unless="maven.test.skip">
> > <!-- Theres got to be a better way to
do this -->
> > <property name="schema.source.dir"
value="test-resources/xsd"/>
> > <property name="wsdl.source.dir"
value="test-resources/wsdl"/>
> > - <property
name="schema.output.base.dir" value="target/schema"/>
> > + <property
name="schema.output.base.dir" value="target/schema"/>
> > <property
name="schema.generated.src.dir" value="${schema.output.base.dir}/src"/>
> > <property
name="schema.generated.classes.dir"
> >
value="${schema.output.base.dir}/classes"/>
> > +
> > <!-- make the dirs -->
> > <mkdir
dir="${schema.output.base.dir}"/>
> > <mkdir
dir="${schema.generated.src.dir}"/>
> > <mkdir
dir="${schema.generated.classes.dir}"/>
> > +
> > <!-- Run JAXB schema compiler with
designated schemas -->
> > <echo>Generating JAX-B classes from
XSDs</echo>
> >
> > <echo>Generating java from
echo.xsd</echo>
> > <java
classname="com.sun.tools.xjc.Driver" fork="true">
> > <classpath
refid="maven.runtime.classpath"/>
> > +
> > <classpath
location="${compiled.classes.dir}"/>
> > <arg line="-d
${schema.generated.src.dir} -quiet ${schema.source.dir}/echo.xsd"/>
> > </java>
> > @@ -266,7 +288,7 @@
> > <classpath
refid="maven.runtime.classpath"/>
> > <classpath
location="${compiled.classes.dir}"/>
> > <arg line="-d
${schema.generated.src.dir} -quiet -wsdl
${wsdl.source.dir}/AddNumbers.wsdl"/>
> > - </java>
> > + </java>
> > </tasks>
> > </configuration>
> > <goals>
> > @@ -287,6 +309,22 @@
> > <property name="addressing_version"
value="${version}"/>
> > <ant antfile="build.xml"
inheritall="true" inheritrefs="true"
> > dir="." target="build-repo"/>
> > +
> > +
<property name="compile_classpath" refid="maven.compile.classpath" />
> > +
<property name="runtime_classpath" refid="maven.runtime.classpath" />
> > +
<property name="test_classpath" refid="maven.test.classpath" />
> > +
<property name="plugin_classpath" refid="maven.plugin.classpath" />
> > +
> > + <!-- Defining wsGen task -->
> > +
<taskdef name="wsgen" loaderRef="refwsgen"
classname="com.sun.tools.ws.ant.WsGen">
> > +
<classpath>
> > +
<path refid="maven.runtime.classpath" />
> > +
<path refid="maven.compile.classpath" />
> > +
</classpath>
> > +
</taskdef>
> > + <!--
Invoking test cases that need to generate artifacts using wsGen -->
> > + <ant antfile="wsgen-tests.xml"
inheritall="true" inheritrefs="true"
> > + dir="."
target="run-wsgen-tests"/>
> > </tasks>
> > </configuration>
> > <goals>
> > @@ -374,6 +412,13 @@
> > <plugin>
> > <groupId>org.apache.maven.plugins</groupId>
> > <artifactId>maven-surefire-report-plugin</artifactId>
> > + <reportSets>
> > + <reportSet>
> > + <reports>
> > + <report>report-only</report>
> > + </reports>
> > + </reportSet>
> > + </reportSets>
> > </plugin>
> > </plugins>
> > </reporting>
> >
> > Modified:
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
> > URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java?rev=963508&r1=963507&r2=963508&view=diff
> >
==============================================================================
> > ---
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
(original)
> > +++
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
Mon Jul 12 22:16:54 2010
> > @@ -238,12 +238,27 @@ class ArtifactProcessor {
> > wrapperClass = newValue;
> > }
> > }
> > - if(cls==null && (type.equals("@WebFault")||
type.equals("faultInfo"))){
> > +
> > + if(cls==null &&
> > + (type.equals("@RequestWrapper")||
type.equals("@ResponseWrapper")||type.equals("@WebFault")||
type.equals("faultInfo"))){
> > +
> > + //Support for Fault Bean Generation
> > //As per JAX-WS 2.2 Specification section
3.7 an application programmer can choose not to
> > //package the faultBeans, if we have
reached this point in the code then user has choosen
> > //not to package the fault bean. If there
is a cache of generated artifacts available then
> > //lets look for the missing faultBean
there.
> > -
> > +
> > + //Support for Wrapper Bean Generation
> > + //As per JAX-WS 2.2 Specificaiton section
3.6.2.1 pg 41 an application programmer does not use
> > + //the wrapper bean classes, so the
application need not package these classes. If we have reached
> > + //this point in the code then user has
choosen not to package these beans.
> > +
> > + //NOTE:If we find Generated artifacts
from cache this guarantees that we will not use
> > + //DocLitWrappedMinimum marshaller code.
The advantage of normal DocLitWrappedMarshaller is
> > + //that it is very robust and has support
of lot more datatypes than in DocLitWrappedMinimum.
> > + if(log.isDebugEnabled()){
> > + log.debug("Adding cache to
classpath");
> > + }
> > ClassFinderFactory cff =
> >
(ClassFinderFactory)FactoryRegistry.getFactory(ClassFinderFactory.class);
> > ClassFinder cf = cff.getClassFinder();
> > @@ -317,11 +332,26 @@ class ArtifactProcessor {
> > if (cls2 == null) {
> > cls2 = loadClassOrNull(defaultValue,
altClassLoader);
> > }
> > - if(cls2==null && (type.equals("faultInfo")||
type.equals("@WebFault"))){
> > - //As per JAX-WS 2.2 Specification section
3.7 an application programmer can choose not to
> > - //package the faultBeans, if we have
reached this point in the code then user has choosen
> > - //not to package the fault bean. If there
is a cache of generated artifacts available then
> > - //lets look for the missing faultBean
there.
> > + if(cls2==null &&
> > +
(type.equals("@RequestWrapper")||
type.equals("@ResponseWrapper")||type.equals("@WebFault")||
type.equals("faultInfo"))){
> > +
> > + //Support for Fault Bean Generation
> > + //As per JAX-WS 2.2 Specification
section 3.7 an application programmer can choose not to
> > + //package the faultBeans, if we have
reached this point in the code then user has choosen
> > + //not to package the fault bean. If
there is a cache of generated artifacts available then
> > + //lets look for the missing faultBean
there.
> > +
> > + //Support for Wrapper Bean Generation
> > + //As per JAX-WS 2.2 Specificaiton
section 3.6.2.1 pg 41 an application programmer does not use
> > + //the wrapper bean classes, so the
application need not package these classes. If we have reached
> > + //this point in the code then user has
choosen not to package these beans.
> > +
> > + //NOTE:If we find Generated artifacts
from cache this guarantees that we will not use
> > + //DocLitWrappedMinimum marshaller
code. The advantage of normal DocLitWrappedMarshaller is
> > + //that it is very robust and has
support of lot more datatypes than in DocLitWrappedMinimum.
> > + if(log.isDebugEnabled()){
> > + log.debug("Adding cache to
classpath");
> > + }
> > if(log.isDebugEnabled()){
> > log.debug("Adding cache to
classpath");
> > }
> >
> > Added:
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
> > URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java?rev=963508&view=auto
> >
==============================================================================
> > ---
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
(added)
> > +++
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
Mon Jul 12 22:16:54 2010
> > @@ -0,0 +1,18 @@
> > +
> > +package org.apache.axis2.jaxws.wrapper.beans;
> > +
> > +import javax.xml.ws.WebFault;
> > +
> > +@WebFault(name = "AddNumbersFault", targetNamespace = "
http://org/test/addnumbers")
> > +public class AddNumbersException extends Exception
> > +{
> > +
> > + private String message = null;
> > + public AddNumbersException(){}
> > + public AddNumbersException(String message){
> > + this.message = message;
> > + }
> > + public String getInfo(){
> > + return message;
> > + }
> > +}
> >
> > Added:
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
> > URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java?rev=963508&view=auto
> >
==============================================================================
> > ---
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
(added)
> > +++
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
Mon Jul 12 22:16:54 2010
> > @@ -0,0 +1,15 @@
> > +package org.apache.axis2.jaxws.wrapper.beans;
> > +
> > +
> > +
> > +@javax.jws.WebService (targetNamespace="http://org/test/addnumbers",
serviceName="AddNumbersService", portName="AddNumbersPort")
> > +public class AddNumbersService{
> > +
> > + public int addNumbers(int arg0, int arg1) throws
AddNumbersException {
> > + if(arg0+arg1<0){
> > + throw new AddNumbersException("sum is less
than 0");
> > + }
> > + return arg0+arg1;
> > + }
> > +
> > +}
> > \ No newline at end of file
> >
> > Added:
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
> > URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java?rev=963508&view=auto
> >
==============================================================================
> > ---
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
(added)
> > +++
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
Mon Jul 12 22:16:54 2010
> > @@ -0,0 +1,114 @@
> > +/**
> > + *
> > + */
> > +package org.apache.axis2.jaxws.wrapper.beans;
> > +
> > +
> > +import org.apache.axis2.jaxws.Constants;
> > +import org.apache.axis2.jaxws.description.DescriptionFactory;
> > +import org.apache.axis2.jaxws.description.EndpointDescription;
> > +import org.apache.axis2.jaxws.description.EndpointDescriptionJava;
> > +import org.apache.axis2.jaxws.description.OperationDescription;
> > +import org.apache.axis2.jaxws.description.ServiceDescription;
> > +import org.apache.axis2.jaxws.marshaller.MethodMarshaller;
> > +import
org.apache.axis2.jaxws.marshaller.factory.MethodMarshallerFactory;
> > +import
org.apache.axis2.jaxws.marshaller.impl.alt.DocLitWrappedMinimalMethodMarshaller;
> > +import org.apache.axis2.jaxws.unitTest.TestLogger;
> > +
> > +import java.io.File;
> > +
> > +import junit.framework.TestCase;
> > +
> > +public class WrapperBeanMarshallTests extends TestCase {
> > + /**
> > + * This is the negative test case, when we do not use generated
artifacts from cache
> > + * and user did not package wrapper beans, we should see use of
DocLitWrappedMinumumMarshaller.
> > + */
> > + public void
testGetMarshallerOperationDescriptionBooleanNegative() {
> > +
TestLogger.logger.debug("---------------------------------------");
> > + TestLogger.logger.debug("test: " + getName());
> > +
> > + String cache_location = "/target/wscache/classes";
> > + try{
> > + String baseDir = new
File(System.getProperty("basedir",".")).getCanonicalPath();
> > + cache_location = new
File(baseDir+cache_location).getAbsolutePath();
> > + TestLogger.logger.debug("cache location
="+cache_location);
> > +
> > + //Get EndpointDescription.
> > + //Set location on AxisConfiguraiton.
> > + Class sei = AddNumbersService.class;
> > + EndpointDescription description = getEndpointDesc(sei);
> > + TestLogger.logger.debug("description objects where
created successfully");
> > + OperationDescription[] ops
=description.getEndpointInterfaceDescription().getOperations();
> > + assertNotNull( "OperationDescriptions where null", ops);
> > + assertTrue("No Operation Descriptions where found",
ops.length>0);
> > + OperationDescription op = ops[0];
> > + TestLogger.logger.debug("operation found, java
methodName="+op.getJavaMethodName());
> > + //Don not Set cache on AxisConfiguration.
> > + //get Marshaller, verify its not DoclitWrappedMinimum.
> > + TestLogger.logger.debug("ws_cache location NOT set on
AxisConfigContext, location="+cache_location);
> > + MethodMarshaller mm =
MethodMarshallerFactory.getMarshaller(op, false);
> > + assertNotNull("getMarshaller returned null", mm );
> > + TestLogger.logger.debug("MethodMarshaller was created,
type="+mm.getClass().getName());
> > + assertTrue("Generated artifacts not found, Method
marshaller should be DocLitWrappedMinimumMarshaller", (mm instanceof
DocLitWrappedMinimalMethodMarshaller));
> > + }catch(Exception e){
> > + TestLogger.logger.debug("Exception ="+e.getMessage());
> > + fail(e.getMessage());
> > + }
> > +
> > + }
> > + /**
> > + * In this test case user did not package wrapper beans but we
add generated artifacts from cache, we should see use of
> > + * DocLitWrappedMarshaller.
> > + * Test method for {@link
org.apache.axis2.jaxws.marshaller.factory.MethodMarshallerFactory#getMarshaller(org.apache.axis2.jaxws.description.OperationDescription,
boolean)}.
> > + */
> > + public void testGetMarshallerOperationDescriptionBoolean() {
> > +
TestLogger.logger.debug("---------------------------------------");
> > + TestLogger.logger.debug("test: " + getName());
> > +
> > + String cache_location = "/target/wscache/classes";
> > + try{
> > + String baseDir = new
File(System.getProperty("basedir",".")).getCanonicalPath();
> > + cache_location = new
File(baseDir+cache_location).getAbsolutePath();
> > + TestLogger.logger.debug("cache location
="+cache_location);
> > +
> > + //Get EndpointDescription.
> > + //Set location on AxisConfiguraiton.
> > + Class sei = AddNumbersService.class;
> > + EndpointDescription description = getEndpointDesc(sei);
> > + TestLogger.logger.debug("description objects where
created successfully");
> > + OperationDescription[] ops
=description.getEndpointInterfaceDescription().getOperations();
> > + assertNotNull( "OperationDescriptions where null", ops);
> > + assertTrue("No Operation Descriptions where found",
ops.length>0);
> > + OperationDescription op = ops[0];
> > + TestLogger.logger.debug("operation found, java
methodName="+op.getJavaMethodName());
> > + //Set cache on AxisConfiguration.
> > + //get Marshaller, verify its not DoclitWrappedMinimum.
> > +
description.getServiceDescription().getAxisConfigContext().setProperty(Constants.WS_CACHE,
cache_location);
> > + TestLogger.logger.debug("ws_cache location set on
AxisConfigContext, location="+cache_location);
> > + MethodMarshaller mm =
MethodMarshallerFactory.getMarshaller(op, false);
> > + assertNotNull("getMarshaller returned null", mm );
> > + TestLogger.logger.debug("MethodMarshaller was created,
type="+mm.getClass().getName());
> > + assertTrue("Generated artifacts are in cache, Method
marshaller should not be DocLitWrappedMinimumMarshaller", !(mm instanceof
DocLitWrappedMinimalMethodMarshaller));
> > + }catch(Exception e){
> > + TestLogger.logger.debug("Exception ="+e.getMessage());
> > + fail(e.getMessage());
> > + }
> > +
> > + }
> > +
> > + private EndpointDescription getEndpointDesc(Class
implementationClass) {
> > + // Use the description factory directly; this will be done
within the JAX-WS runtime
> > + ServiceDescription serviceDesc =
> > +
DescriptionFactory.createServiceDescription(implementationClass);
> > + assertNotNull(serviceDesc);
> > +
> > + EndpointDescription[] endpointDesc =
serviceDesc.getEndpointDescriptions();
> > + assertNotNull(endpointDesc);
> > + assertEquals(1, endpointDesc.length);
> > +
> > + // TODO: How will the JAX-WS dispatcher get the appropriate
port (i.e. endpoint)? Currently assumes [0]
> > + EndpointDescription testEndpointDesc = endpointDesc[0];
> > + return testEndpointDesc;
> > + }
> > +}
> >
> > Added: axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml
> > URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml?rev=963508&view=auto
> >
==============================================================================
> > --- axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml (added)
> > +++ axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml Mon Jul
12 22:16:54 2010
> > @@ -0,0 +1,34 @@
> > +<?xml version="1.0" encoding="UTF-8"?>
> > +
> > +<project basedir="." default="run-wsgen-tests" name="wsgen-tests">
> > +
> > + <property name="wscache.output.base.dir"
value="target/wscache" />
> > + <property name="wscache.generated.src.dir"
value="${wscache.output.base.dir}/src" />
> > + <property name="wscache.generated.classes.dir"
value="${wscache.output.base.dir}/classes" />
> > + <property name="compile.test.classes"
value="target/test-classes" />
> > +
> > +
> > + <target name="run-wsgen-tests" depends="wrapper-beans"/>
> > +
> > +
> > + <target name="create-cache">
> > + <mkdir dir="${wscache.output.base.dir}" />
> > + <mkdir dir="${wscache.generated.src.dir}" />
> > + <mkdir dir="${wscache.generated.classes.dir}" />
> > + </target>
> > +
> > + <target name="wrapper-beans" depends="create-cache">
> > + <echo>Generating artifacts for
org.apache.axis2.jaxws.wrapper.beans.AddNumbersService </echo>
> > + <wsgen
> > +
sei="org.apache.axis2.jaxws.wrapper.beans.AddNumbersService"
> > + destdir="${wscache.generated.classes.dir}"
> > + resourcedestdir="${wscache.generated.src.dir}"
> > + keep="false"
> > + verbose="false"
> > + genwsdl="true">
> > + <classpath>
> > + <pathelement path="${compile.test.classes}" />
> > + </classpath>
> > + </wsgen>
> > + </target>
> > +</project>
> > \ No newline at end of file
> >
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-dev-help@axis.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org
Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws: ./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/
test/org/apache/axis2/jaxws/wrapper/ test/org/apache/axis2/jaxws/wrapper/beans/
Posted by Nikhil V Thaker <ni...@us.ibm.com>.
Yes Andreas,
I am running antrun plugin as the wsGen plugin has errors and is not
fully matured, here's the URL that explains the issue I ran into
http://jira.codehaus.org/browse/MNG-3586.
So since I cannot run wsGen or cannot include generated artifacts I will
just remove the test case. I will commit the changes soon.
Regards,
Nikhil Thaker
office: 919 254 9964
nvthaker@us.ibm.com
Andreas Veithen <an...@gmail.com>
07/14/2010 02:48 PM
Please respond to
java-dev@axis.apache.org
To
java-dev@axis.apache.org
cc
Subject
Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws: ./
src/org/apache/axis2/jaxws/runtime/description/marshal/impl/
test/org/apache/axis2/jaxws/wrapper/
test/org/apache/axis2/jaxws/wrapper/beans/
No, you are using the antrun plugin to execute the wsgen ant task.
What I meant was to use a real Maven plugin (either the one from
java.net or the one from CXF).
-1 to commit any generated stuff into SVN.
Andreas
On Wed, Jul 14, 2010 at 21:42, Nikhil V Thaker
<ni...@us.ibm.com> wrote:
>
> Andreas - I had to add the tools.jar bit because maven plugin for wsGen
gave NoClassDef Found errors for classes packaged in tools.jar.
>
> Since this is causing a problem I will just package the generated
artifacts and remove the wsGen dependency.
>
> Thanks,
>
> Nikhil Thaker
> office: 919 254 9964
> nvthaker@us.ibm.com
>
>
> Andreas Veithen <an...@gmail.com>
>
> 07/14/2010 01:44 PM
>
> Please respond to
> java-dev@axis.apache.org
> To
> java-dev@axis.apache.org
> cc
> Subject
> Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws:
./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/
test/org/apache/axis2/jaxws/wrapper/
test/org/apache/axis2/jaxws/wrapper/beans/
>
>
>
>
> Nikhil,
>
> I have some issues with the tools and jaxws-tools dependencies
> introduced by this change:
>
> * The change causes a build failure in Hudson. There will also be
> additional issues with tools.jar, because the way to declare this as a
> system dependency varies from one JDK to another. For example, I
> remember that on Mac OS X, it is completely different than on other
> JDKs.
>
> * I don't like the fact that jaxws-tools becomes a dependency of
> axis2-jaxws in scope compile, because it looks like this is only
> needed during the build and/or during the tests.
>
> I didn't review the change in detail, but wouldn't it be smarter to
> use one of the existing Maven plugins to do the wsgen stuff? They will
> take care of the tools.jar stuff as well.
>
> Andreas
>
> On Tue, Jul 13, 2010 at 00:16, <nt...@apache.org> wrote:
> > Author: nthaker
> > Date: Mon Jul 12 22:16:54 2010
> > New Revision: 963508
> >
> > URL: http://svn.apache.org/viewvc?rev=963508&view=rev
> > Log:
> > AXIS2-4775
> > This change ensures that we will use Request and Response wrapper Bean
packaged by customer or we will Generate Wrappers if they are not
packaged.
> >
> > Added:
> >
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/
> >
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/
> >
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
> >
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
> >
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
> > axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml
> > Modified:
> > axis/axis2/java/core/trunk/modules/jaxws/pom.xml
> >
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
> >
> > Modified: axis/axis2/java/core/trunk/modules/jaxws/pom.xml
> > URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/pom.xml?rev=963508&r1=963507&r2=963508&view=diff
> >
==============================================================================
> > --- axis/axis2/java/core/trunk/modules/jaxws/pom.xml (original)
> > +++ axis/axis2/java/core/trunk/modules/jaxws/pom.xml Mon Jul 12
22:16:54 2010
> > @@ -1,5 +1,4 @@
> > <?xml version="1.0" encoding="UTF-8"?>
> > -
> > <!-- > ~ Licensed to the Apache Software Foundation (ASF) under one
> > ~ or more contributor license agreements. See the NOTICE file
> > @@ -20,7 +19,7 @@
> > -->
> >
> > <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"
> > - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
> > + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
> > <modelVersion>4.0.0</modelVersion>
> > <parent>
> > <groupId>org.apache.axis2</groupId>
> > @@ -98,7 +97,25 @@
> > <version>${version}</version>
> > <scope>test</scope>
> > </dependency>
> > + <dependency>
> > + <groupId>wsdl4j</groupId>
> > + <artifactId>wsdl4j</artifactId>
> > + </dependency>
> > + <dependency>
> > + <groupId>com.sun.xml.ws</groupId>
> > + <artifactId>jaxws-tools</artifactId>
> > + <version>2.1.3</version>
> > + </dependency>
> > + <!-- If we dont include tools.jar as dependency, maven throws
NoClassDefFound on wsGen run -->
> > + <dependency>
> > + <groupId>java</groupId>
> > + <artifactId>tools</artifactId>
> > + <version>$version</version>
> > + <scope>system</scope>
> > + <systemPath>${JAVA_HOME}/lib/tools.jar</systemPath>
> > + </dependency>
> > </dependencies>
> > +
> > <build>
> > <sourceDirectory>src</sourceDirectory>
> > <testSourceDirectory>test</testSourceDirectory>
> > @@ -203,34 +220,39 @@
> > <compilerVersion>1.5</compilerVersion>
> > <source>1.5</source>
> > <target>1.5</target>
> > +
> > </configuration>
> > </plugin>
> > <plugin>
> > <groupId>org.apache.maven.plugins</groupId>
> > <artifactId>maven-antrun-plugin</artifactId>
> > +
> > <executions>
> > <execution>
> > <id>gen-ts</id>
> > <phase>generate-test-sources</phase>
> > <configuration>
> > - <tasks unless="maven.test.skip">
> > + <tasks unless="maven.test.skip">
> > <!-- Theres got to be a better way to
do this -->
> > <property name="schema.source.dir"
value="test-resources/xsd"/>
> > <property name="wsdl.source.dir"
value="test-resources/wsdl"/>
> > - <property
name="schema.output.base.dir" value="target/schema"/>
> > + <property
name="schema.output.base.dir" value="target/schema"/>
> > <property
name="schema.generated.src.dir" value="${schema.output.base.dir}/src"/>
> > <property
name="schema.generated.classes.dir"
> >
value="${schema.output.base.dir}/classes"/>
> > +
> > <!-- make the dirs -->
> > <mkdir
dir="${schema.output.base.dir}"/>
> > <mkdir
dir="${schema.generated.src.dir}"/>
> > <mkdir
dir="${schema.generated.classes.dir}"/>
> > +
> > <!-- Run JAXB schema compiler with
designated schemas -->
> > <echo>Generating JAX-B classes from
XSDs</echo>
> >
> > <echo>Generating java from
echo.xsd</echo>
> > <java
classname="com.sun.tools.xjc.Driver" fork="true">
> > <classpath
refid="maven.runtime.classpath"/>
> > +
> > <classpath
location="${compiled.classes.dir}"/>
> > <arg line="-d
${schema.generated.src.dir} -quiet ${schema.source.dir}/echo.xsd"/>
> > </java>
> > @@ -266,7 +288,7 @@
> > <classpath
refid="maven.runtime.classpath"/>
> > <classpath
location="${compiled.classes.dir}"/>
> > <arg line="-d
${schema.generated.src.dir} -quiet -wsdl
${wsdl.source.dir}/AddNumbers.wsdl"/>
> > - </java>
> > + </java>
> > </tasks>
> > </configuration>
> > <goals>
> > @@ -287,6 +309,22 @@
> > <property name="addressing_version"
value="${version}"/>
> > <ant antfile="build.xml"
inheritall="true" inheritrefs="true"
> > dir="." target="build-repo"/>
> > +
> > +
<property name="compile_classpath" refid="maven.compile.classpath" />
> > +
<property name="runtime_classpath" refid="maven.runtime.classpath" />
> > +
<property name="test_classpath" refid="maven.test.classpath" />
> > +
<property name="plugin_classpath" refid="maven.plugin.classpath" />
> > +
> > + <!-- Defining wsGen task -->
> > +
<taskdef name="wsgen" loaderRef="refwsgen"
classname="com.sun.tools.ws.ant.WsGen">
> > +
<classpath>
> > +
<path refid="maven.runtime.classpath" />
> > +
<path refid="maven.compile.classpath" />
> > +
</classpath>
> > +
</taskdef>
> > + <!--
Invoking test cases that need to generate artifacts using wsGen -->
> > + <ant antfile="wsgen-tests.xml"
inheritall="true" inheritrefs="true"
> > + dir="."
target="run-wsgen-tests"/>
> > </tasks>
> > </configuration>
> > <goals>
> > @@ -374,6 +412,13 @@
> > <plugin>
> > <groupId>org.apache.maven.plugins</groupId>
> > <artifactId>maven-surefire-report-plugin</artifactId>
> > + <reportSets>
> > + <reportSet>
> > + <reports>
> > + <report>report-only</report>
> > + </reports>
> > + </reportSet>
> > + </reportSets>
> > </plugin>
> > </plugins>
> > </reporting>
> >
> > Modified:
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
> > URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java?rev=963508&r1=963507&r2=963508&view=diff
> >
==============================================================================
> > ---
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
(original)
> > +++
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
Mon Jul 12 22:16:54 2010
> > @@ -238,12 +238,27 @@ class ArtifactProcessor {
> > wrapperClass = newValue;
> > }
> > }
> > - if(cls==null && (type.equals("@WebFault")||
type.equals("faultInfo"))){
> > +
> > + if(cls==null &&
> > + (type.equals("@RequestWrapper")||
type.equals("@ResponseWrapper")||type.equals("@WebFault")||
type.equals("faultInfo"))){
> > +
> > + //Support for Fault Bean Generation
> > //As per JAX-WS 2.2 Specification section
3.7 an application programmer can choose not to
> > //package the faultBeans, if we have
reached this point in the code then user has choosen
> > //not to package the fault bean. If there
is a cache of generated artifacts available then
> > //lets look for the missing faultBean
there.
> > -
> > +
> > + //Support for Wrapper Bean Generation
> > + //As per JAX-WS 2.2 Specificaiton section
3.6.2.1 pg 41 an application programmer does not use
> > + //the wrapper bean classes, so the
application need not package these classes. If we have reached
> > + //this point in the code then user has
choosen not to package these beans.
> > +
> > + //NOTE:If we find Generated artifacts
from cache this guarantees that we will not use
> > + //DocLitWrappedMinimum marshaller code.
The advantage of normal DocLitWrappedMarshaller is
> > + //that it is very robust and has support
of lot more datatypes than in DocLitWrappedMinimum.
> > + if(log.isDebugEnabled()){
> > + log.debug("Adding cache to
classpath");
> > + }
> > ClassFinderFactory cff =
> >
(ClassFinderFactory)FactoryRegistry.getFactory(ClassFinderFactory.class);
> > ClassFinder cf = cff.getClassFinder();
> > @@ -317,11 +332,26 @@ class ArtifactProcessor {
> > if (cls2 == null) {
> > cls2 = loadClassOrNull(defaultValue,
altClassLoader);
> > }
> > - if(cls2==null && (type.equals("faultInfo")||
type.equals("@WebFault"))){
> > - //As per JAX-WS 2.2 Specification section
3.7 an application programmer can choose not to
> > - //package the faultBeans, if we have
reached this point in the code then user has choosen
> > - //not to package the fault bean. If there
is a cache of generated artifacts available then
> > - //lets look for the missing faultBean
there.
> > + if(cls2==null &&
> > +
(type.equals("@RequestWrapper")||
type.equals("@ResponseWrapper")||type.equals("@WebFault")||
type.equals("faultInfo"))){
> > +
> > + //Support for Fault Bean Generation
> > + //As per JAX-WS 2.2 Specification
section 3.7 an application programmer can choose not to
> > + //package the faultBeans, if we have
reached this point in the code then user has choosen
> > + //not to package the fault bean. If
there is a cache of generated artifacts available then
> > + //lets look for the missing faultBean
there.
> > +
> > + //Support for Wrapper Bean Generation
> > + //As per JAX-WS 2.2 Specificaiton
section 3.6.2.1 pg 41 an application programmer does not use
> > + //the wrapper bean classes, so the
application need not package these classes. If we have reached
> > + //this point in the code then user has
choosen not to package these beans.
> > +
> > + //NOTE:If we find Generated artifacts
from cache this guarantees that we will not use
> > + //DocLitWrappedMinimum marshaller
code. The advantage of normal DocLitWrappedMarshaller is
> > + //that it is very robust and has
support of lot more datatypes than in DocLitWrappedMinimum.
> > + if(log.isDebugEnabled()){
> > + log.debug("Adding cache to
classpath");
> > + }
> > if(log.isDebugEnabled()){
> > log.debug("Adding cache to
classpath");
> > }
> >
> > Added:
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
> > URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java?rev=963508&view=auto
> >
==============================================================================
> > ---
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
(added)
> > +++
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
Mon Jul 12 22:16:54 2010
> > @@ -0,0 +1,18 @@
> > +
> > +package org.apache.axis2.jaxws.wrapper.beans;
> > +
> > +import javax.xml.ws.WebFault;
> > +
> > +@WebFault(name = "AddNumbersFault", targetNamespace = "
http://org/test/addnumbers")
> > +public class AddNumbersException extends Exception
> > +{
> > +
> > + private String message = null;
> > + public AddNumbersException(){}
> > + public AddNumbersException(String message){
> > + this.message = message;
> > + }
> > + public String getInfo(){
> > + return message;
> > + }
> > +}
> >
> > Added:
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
> > URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java?rev=963508&view=auto
> >
==============================================================================
> > ---
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
(added)
> > +++
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
Mon Jul 12 22:16:54 2010
> > @@ -0,0 +1,15 @@
> > +package org.apache.axis2.jaxws.wrapper.beans;
> > +
> > +
> > +
> > +@javax.jws.WebService (targetNamespace="http://org/test/addnumbers",
serviceName="AddNumbersService", portName="AddNumbersPort")
> > +public class AddNumbersService{
> > +
> > + public int addNumbers(int arg0, int arg1) throws
AddNumbersException {
> > + if(arg0+arg1<0){
> > + throw new AddNumbersException("sum is less
than 0");
> > + }
> > + return arg0+arg1;
> > + }
> > +
> > +}
> > \ No newline at end of file
> >
> > Added:
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
> > URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java?rev=963508&view=auto
> >
==============================================================================
> > ---
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
(added)
> > +++
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
Mon Jul 12 22:16:54 2010
> > @@ -0,0 +1,114 @@
> > +/**
> > + *
> > + */
> > +package org.apache.axis2.jaxws.wrapper.beans;
> > +
> > +
> > +import org.apache.axis2.jaxws.Constants;
> > +import org.apache.axis2.jaxws.description.DescriptionFactory;
> > +import org.apache.axis2.jaxws.description.EndpointDescription;
> > +import org.apache.axis2.jaxws.description.EndpointDescriptionJava;
> > +import org.apache.axis2.jaxws.description.OperationDescription;
> > +import org.apache.axis2.jaxws.description.ServiceDescription;
> > +import org.apache.axis2.jaxws.marshaller.MethodMarshaller;
> > +import
org.apache.axis2.jaxws.marshaller.factory.MethodMarshallerFactory;
> > +import
org.apache.axis2.jaxws.marshaller.impl.alt.DocLitWrappedMinimalMethodMarshaller;
> > +import org.apache.axis2.jaxws.unitTest.TestLogger;
> > +
> > +import java.io.File;
> > +
> > +import junit.framework.TestCase;
> > +
> > +public class WrapperBeanMarshallTests extends TestCase {
> > + /**
> > + * This is the negative test case, when we do not use generated
artifacts from cache
> > + * and user did not package wrapper beans, we should see use of
DocLitWrappedMinumumMarshaller.
> > + */
> > + public void
testGetMarshallerOperationDescriptionBooleanNegative() {
> > +
TestLogger.logger.debug("---------------------------------------");
> > + TestLogger.logger.debug("test: " + getName());
> > +
> > + String cache_location = "/target/wscache/classes";
> > + try{
> > + String baseDir = new
File(System.getProperty("basedir",".")).getCanonicalPath();
> > + cache_location = new
File(baseDir+cache_location).getAbsolutePath();
> > + TestLogger.logger.debug("cache location
="+cache_location);
> > +
> > + //Get EndpointDescription.
> > + //Set location on AxisConfiguraiton.
> > + Class sei = AddNumbersService.class;
> > + EndpointDescription description = getEndpointDesc(sei);
> > + TestLogger.logger.debug("description objects where
created successfully");
> > + OperationDescription[] ops
=description.getEndpointInterfaceDescription().getOperations();
> > + assertNotNull( "OperationDescriptions where null", ops);
> > + assertTrue("No Operation Descriptions where found",
ops.length>0);
> > + OperationDescription op = ops[0];
> > + TestLogger.logger.debug("operation found, java
methodName="+op.getJavaMethodName());
> > + //Don not Set cache on AxisConfiguration.
> > + //get Marshaller, verify its not DoclitWrappedMinimum.
> > + TestLogger.logger.debug("ws_cache location NOT set on
AxisConfigContext, location="+cache_location);
> > + MethodMarshaller mm =
MethodMarshallerFactory.getMarshaller(op, false);
> > + assertNotNull("getMarshaller returned null", mm );
> > + TestLogger.logger.debug("MethodMarshaller was created,
type="+mm.getClass().getName());
> > + assertTrue("Generated artifacts not found, Method
marshaller should be DocLitWrappedMinimumMarshaller", (mm instanceof
DocLitWrappedMinimalMethodMarshaller));
> > + }catch(Exception e){
> > + TestLogger.logger.debug("Exception ="+e.getMessage());
> > + fail(e.getMessage());
> > + }
> > +
> > + }
> > + /**
> > + * In this test case user did not package wrapper beans but we
add generated artifacts from cache, we should see use of
> > + * DocLitWrappedMarshaller.
> > + * Test method for {@link
org.apache.axis2.jaxws.marshaller.factory.MethodMarshallerFactory#getMarshaller(org.apache.axis2.jaxws.description.OperationDescription,
boolean)}.
> > + */
> > + public void testGetMarshallerOperationDescriptionBoolean() {
> > +
TestLogger.logger.debug("---------------------------------------");
> > + TestLogger.logger.debug("test: " + getName());
> > +
> > + String cache_location = "/target/wscache/classes";
> > + try{
> > + String baseDir = new
File(System.getProperty("basedir",".")).getCanonicalPath();
> > + cache_location = new
File(baseDir+cache_location).getAbsolutePath();
> > + TestLogger.logger.debug("cache location
="+cache_location);
> > +
> > + //Get EndpointDescription.
> > + //Set location on AxisConfiguraiton.
> > + Class sei = AddNumbersService.class;
> > + EndpointDescription description = getEndpointDesc(sei);
> > + TestLogger.logger.debug("description objects where
created successfully");
> > + OperationDescription[] ops
=description.getEndpointInterfaceDescription().getOperations();
> > + assertNotNull( "OperationDescriptions where null", ops);
> > + assertTrue("No Operation Descriptions where found",
ops.length>0);
> > + OperationDescription op = ops[0];
> > + TestLogger.logger.debug("operation found, java
methodName="+op.getJavaMethodName());
> > + //Set cache on AxisConfiguration.
> > + //get Marshaller, verify its not DoclitWrappedMinimum.
> > +
description.getServiceDescription().getAxisConfigContext().setProperty(Constants.WS_CACHE,
cache_location);
> > + TestLogger.logger.debug("ws_cache location set on
AxisConfigContext, location="+cache_location);
> > + MethodMarshaller mm =
MethodMarshallerFactory.getMarshaller(op, false);
> > + assertNotNull("getMarshaller returned null", mm );
> > + TestLogger.logger.debug("MethodMarshaller was created,
type="+mm.getClass().getName());
> > + assertTrue("Generated artifacts are in cache, Method
marshaller should not be DocLitWrappedMinimumMarshaller", !(mm instanceof
DocLitWrappedMinimalMethodMarshaller));
> > + }catch(Exception e){
> > + TestLogger.logger.debug("Exception ="+e.getMessage());
> > + fail(e.getMessage());
> > + }
> > +
> > + }
> > +
> > + private EndpointDescription getEndpointDesc(Class
implementationClass) {
> > + // Use the description factory directly; this will be done
within the JAX-WS runtime
> > + ServiceDescription serviceDesc =
> > +
DescriptionFactory.createServiceDescription(implementationClass);
> > + assertNotNull(serviceDesc);
> > +
> > + EndpointDescription[] endpointDesc =
serviceDesc.getEndpointDescriptions();
> > + assertNotNull(endpointDesc);
> > + assertEquals(1, endpointDesc.length);
> > +
> > + // TODO: How will the JAX-WS dispatcher get the appropriate
port (i.e. endpoint)? Currently assumes [0]
> > + EndpointDescription testEndpointDesc = endpointDesc[0];
> > + return testEndpointDesc;
> > + }
> > +}
> >
> > Added: axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml
> > URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml?rev=963508&view=auto
> >
==============================================================================
> > --- axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml (added)
> > +++ axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml Mon Jul
12 22:16:54 2010
> > @@ -0,0 +1,34 @@
> > +<?xml version="1.0" encoding="UTF-8"?>
> > +
> > +<project basedir="." default="run-wsgen-tests" name="wsgen-tests">
> > +
> > + <property name="wscache.output.base.dir"
value="target/wscache" />
> > + <property name="wscache.generated.src.dir"
value="${wscache.output.base.dir}/src" />
> > + <property name="wscache.generated.classes.dir"
value="${wscache.output.base.dir}/classes" />
> > + <property name="compile.test.classes"
value="target/test-classes" />
> > +
> > +
> > + <target name="run-wsgen-tests" depends="wrapper-beans"/>
> > +
> > +
> > + <target name="create-cache">
> > + <mkdir dir="${wscache.output.base.dir}" />
> > + <mkdir dir="${wscache.generated.src.dir}" />
> > + <mkdir dir="${wscache.generated.classes.dir}" />
> > + </target>
> > +
> > + <target name="wrapper-beans" depends="create-cache">
> > + <echo>Generating artifacts for
org.apache.axis2.jaxws.wrapper.beans.AddNumbersService </echo>
> > + <wsgen
> > +
sei="org.apache.axis2.jaxws.wrapper.beans.AddNumbersService"
> > + destdir="${wscache.generated.classes.dir}"
> > + resourcedestdir="${wscache.generated.src.dir}"
> > + keep="false"
> > + verbose="false"
> > + genwsdl="true">
> > + <classpath>
> > + <pathelement path="${compile.test.classes}" />
> > + </classpath>
> > + </wsgen>
> > + </target>
> > +</project>
> > \ No newline at end of file
> >
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-dev-help@axis.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org
Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws: ./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/
test/org/apache/axis2/jaxws/wrapper/ test/org/apache/axis2/jaxws/wrapper/beans/
Posted by Nikhil V Thaker <ni...@us.ibm.com>.
Yes Andreas,
I am running antrun plugin as the wsGen plugin has errors and is not
fully matured, here's the URL that explains the issue I ran into
http://jira.codehaus.org/browse/MNG-3586.
So since I cannot run wsGen or cannot include generated artifacts I will
just remove the test case. I will commit the changes soon.
Regards,
Nikhil Thaker
office: 919 254 9964
nvthaker@us.ibm.com
Andreas Veithen <an...@gmail.com>
07/14/2010 02:48 PM
Please respond to
java-dev@axis.apache.org
To
java-dev@axis.apache.org
cc
Subject
Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws: ./
src/org/apache/axis2/jaxws/runtime/description/marshal/impl/
test/org/apache/axis2/jaxws/wrapper/
test/org/apache/axis2/jaxws/wrapper/beans/
No, you are using the antrun plugin to execute the wsgen ant task.
What I meant was to use a real Maven plugin (either the one from
java.net or the one from CXF).
-1 to commit any generated stuff into SVN.
Andreas
On Wed, Jul 14, 2010 at 21:42, Nikhil V Thaker
<ni...@us.ibm.com> wrote:
>
> Andreas - I had to add the tools.jar bit because maven plugin for wsGen
gave NoClassDef Found errors for classes packaged in tools.jar.
>
> Since this is causing a problem I will just package the generated
artifacts and remove the wsGen dependency.
>
> Thanks,
>
> Nikhil Thaker
> office: 919 254 9964
> nvthaker@us.ibm.com
>
>
> Andreas Veithen <an...@gmail.com>
>
> 07/14/2010 01:44 PM
>
> Please respond to
> java-dev@axis.apache.org
> To
> java-dev@axis.apache.org
> cc
> Subject
> Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws:
./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/
test/org/apache/axis2/jaxws/wrapper/
test/org/apache/axis2/jaxws/wrapper/beans/
>
>
>
>
> Nikhil,
>
> I have some issues with the tools and jaxws-tools dependencies
> introduced by this change:
>
> * The change causes a build failure in Hudson. There will also be
> additional issues with tools.jar, because the way to declare this as a
> system dependency varies from one JDK to another. For example, I
> remember that on Mac OS X, it is completely different than on other
> JDKs.
>
> * I don't like the fact that jaxws-tools becomes a dependency of
> axis2-jaxws in scope compile, because it looks like this is only
> needed during the build and/or during the tests.
>
> I didn't review the change in detail, but wouldn't it be smarter to
> use one of the existing Maven plugins to do the wsgen stuff? They will
> take care of the tools.jar stuff as well.
>
> Andreas
>
> On Tue, Jul 13, 2010 at 00:16, <nt...@apache.org> wrote:
> > Author: nthaker
> > Date: Mon Jul 12 22:16:54 2010
> > New Revision: 963508
> >
> > URL: http://svn.apache.org/viewvc?rev=963508&view=rev
> > Log:
> > AXIS2-4775
> > This change ensures that we will use Request and Response wrapper Bean
packaged by customer or we will Generate Wrappers if they are not
packaged.
> >
> > Added:
> >
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/
> >
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/
> >
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
> >
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
> >
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
> > axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml
> > Modified:
> > axis/axis2/java/core/trunk/modules/jaxws/pom.xml
> >
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
> >
> > Modified: axis/axis2/java/core/trunk/modules/jaxws/pom.xml
> > URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/pom.xml?rev=963508&r1=963507&r2=963508&view=diff
> >
==============================================================================
> > --- axis/axis2/java/core/trunk/modules/jaxws/pom.xml (original)
> > +++ axis/axis2/java/core/trunk/modules/jaxws/pom.xml Mon Jul 12
22:16:54 2010
> > @@ -1,5 +1,4 @@
> > <?xml version="1.0" encoding="UTF-8"?>
> > -
> > <!-- > ~ Licensed to the Apache Software Foundation (ASF) under one
> > ~ or more contributor license agreements. See the NOTICE file
> > @@ -20,7 +19,7 @@
> > -->
> >
> > <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"
> > - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
> > + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
> > <modelVersion>4.0.0</modelVersion>
> > <parent>
> > <groupId>org.apache.axis2</groupId>
> > @@ -98,7 +97,25 @@
> > <version>${version}</version>
> > <scope>test</scope>
> > </dependency>
> > + <dependency>
> > + <groupId>wsdl4j</groupId>
> > + <artifactId>wsdl4j</artifactId>
> > + </dependency>
> > + <dependency>
> > + <groupId>com.sun.xml.ws</groupId>
> > + <artifactId>jaxws-tools</artifactId>
> > + <version>2.1.3</version>
> > + </dependency>
> > + <!-- If we dont include tools.jar as dependency, maven throws
NoClassDefFound on wsGen run -->
> > + <dependency>
> > + <groupId>java</groupId>
> > + <artifactId>tools</artifactId>
> > + <version>$version</version>
> > + <scope>system</scope>
> > + <systemPath>${JAVA_HOME}/lib/tools.jar</systemPath>
> > + </dependency>
> > </dependencies>
> > +
> > <build>
> > <sourceDirectory>src</sourceDirectory>
> > <testSourceDirectory>test</testSourceDirectory>
> > @@ -203,34 +220,39 @@
> > <compilerVersion>1.5</compilerVersion>
> > <source>1.5</source>
> > <target>1.5</target>
> > +
> > </configuration>
> > </plugin>
> > <plugin>
> > <groupId>org.apache.maven.plugins</groupId>
> > <artifactId>maven-antrun-plugin</artifactId>
> > +
> > <executions>
> > <execution>
> > <id>gen-ts</id>
> > <phase>generate-test-sources</phase>
> > <configuration>
> > - <tasks unless="maven.test.skip">
> > + <tasks unless="maven.test.skip">
> > <!-- Theres got to be a better way to
do this -->
> > <property name="schema.source.dir"
value="test-resources/xsd"/>
> > <property name="wsdl.source.dir"
value="test-resources/wsdl"/>
> > - <property
name="schema.output.base.dir" value="target/schema"/>
> > + <property
name="schema.output.base.dir" value="target/schema"/>
> > <property
name="schema.generated.src.dir" value="${schema.output.base.dir}/src"/>
> > <property
name="schema.generated.classes.dir"
> >
value="${schema.output.base.dir}/classes"/>
> > +
> > <!-- make the dirs -->
> > <mkdir
dir="${schema.output.base.dir}"/>
> > <mkdir
dir="${schema.generated.src.dir}"/>
> > <mkdir
dir="${schema.generated.classes.dir}"/>
> > +
> > <!-- Run JAXB schema compiler with
designated schemas -->
> > <echo>Generating JAX-B classes from
XSDs</echo>
> >
> > <echo>Generating java from
echo.xsd</echo>
> > <java
classname="com.sun.tools.xjc.Driver" fork="true">
> > <classpath
refid="maven.runtime.classpath"/>
> > +
> > <classpath
location="${compiled.classes.dir}"/>
> > <arg line="-d
${schema.generated.src.dir} -quiet ${schema.source.dir}/echo.xsd"/>
> > </java>
> > @@ -266,7 +288,7 @@
> > <classpath
refid="maven.runtime.classpath"/>
> > <classpath
location="${compiled.classes.dir}"/>
> > <arg line="-d
${schema.generated.src.dir} -quiet -wsdl
${wsdl.source.dir}/AddNumbers.wsdl"/>
> > - </java>
> > + </java>
> > </tasks>
> > </configuration>
> > <goals>
> > @@ -287,6 +309,22 @@
> > <property name="addressing_version"
value="${version}"/>
> > <ant antfile="build.xml"
inheritall="true" inheritrefs="true"
> > dir="." target="build-repo"/>
> > +
> > +
<property name="compile_classpath" refid="maven.compile.classpath" />
> > +
<property name="runtime_classpath" refid="maven.runtime.classpath" />
> > +
<property name="test_classpath" refid="maven.test.classpath" />
> > +
<property name="plugin_classpath" refid="maven.plugin.classpath" />
> > +
> > + <!-- Defining wsGen task -->
> > +
<taskdef name="wsgen" loaderRef="refwsgen"
classname="com.sun.tools.ws.ant.WsGen">
> > +
<classpath>
> > +
<path refid="maven.runtime.classpath" />
> > +
<path refid="maven.compile.classpath" />
> > +
</classpath>
> > +
</taskdef>
> > + <!--
Invoking test cases that need to generate artifacts using wsGen -->
> > + <ant antfile="wsgen-tests.xml"
inheritall="true" inheritrefs="true"
> > + dir="."
target="run-wsgen-tests"/>
> > </tasks>
> > </configuration>
> > <goals>
> > @@ -374,6 +412,13 @@
> > <plugin>
> > <groupId>org.apache.maven.plugins</groupId>
> > <artifactId>maven-surefire-report-plugin</artifactId>
> > + <reportSets>
> > + <reportSet>
> > + <reports>
> > + <report>report-only</report>
> > + </reports>
> > + </reportSet>
> > + </reportSets>
> > </plugin>
> > </plugins>
> > </reporting>
> >
> > Modified:
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
> > URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java?rev=963508&r1=963507&r2=963508&view=diff
> >
==============================================================================
> > ---
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
(original)
> > +++
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
Mon Jul 12 22:16:54 2010
> > @@ -238,12 +238,27 @@ class ArtifactProcessor {
> > wrapperClass = newValue;
> > }
> > }
> > - if(cls==null && (type.equals("@WebFault")||
type.equals("faultInfo"))){
> > +
> > + if(cls==null &&
> > + (type.equals("@RequestWrapper")||
type.equals("@ResponseWrapper")||type.equals("@WebFault")||
type.equals("faultInfo"))){
> > +
> > + //Support for Fault Bean Generation
> > //As per JAX-WS 2.2 Specification section
3.7 an application programmer can choose not to
> > //package the faultBeans, if we have
reached this point in the code then user has choosen
> > //not to package the fault bean. If there
is a cache of generated artifacts available then
> > //lets look for the missing faultBean
there.
> > -
> > +
> > + //Support for Wrapper Bean Generation
> > + //As per JAX-WS 2.2 Specificaiton section
3.6.2.1 pg 41 an application programmer does not use
> > + //the wrapper bean classes, so the
application need not package these classes. If we have reached
> > + //this point in the code then user has
choosen not to package these beans.
> > +
> > + //NOTE:If we find Generated artifacts
from cache this guarantees that we will not use
> > + //DocLitWrappedMinimum marshaller code.
The advantage of normal DocLitWrappedMarshaller is
> > + //that it is very robust and has support
of lot more datatypes than in DocLitWrappedMinimum.
> > + if(log.isDebugEnabled()){
> > + log.debug("Adding cache to
classpath");
> > + }
> > ClassFinderFactory cff =
> >
(ClassFinderFactory)FactoryRegistry.getFactory(ClassFinderFactory.class);
> > ClassFinder cf = cff.getClassFinder();
> > @@ -317,11 +332,26 @@ class ArtifactProcessor {
> > if (cls2 == null) {
> > cls2 = loadClassOrNull(defaultValue,
altClassLoader);
> > }
> > - if(cls2==null && (type.equals("faultInfo")||
type.equals("@WebFault"))){
> > - //As per JAX-WS 2.2 Specification section
3.7 an application programmer can choose not to
> > - //package the faultBeans, if we have
reached this point in the code then user has choosen
> > - //not to package the fault bean. If there
is a cache of generated artifacts available then
> > - //lets look for the missing faultBean
there.
> > + if(cls2==null &&
> > +
(type.equals("@RequestWrapper")||
type.equals("@ResponseWrapper")||type.equals("@WebFault")||
type.equals("faultInfo"))){
> > +
> > + //Support for Fault Bean Generation
> > + //As per JAX-WS 2.2 Specification
section 3.7 an application programmer can choose not to
> > + //package the faultBeans, if we have
reached this point in the code then user has choosen
> > + //not to package the fault bean. If
there is a cache of generated artifacts available then
> > + //lets look for the missing faultBean
there.
> > +
> > + //Support for Wrapper Bean Generation
> > + //As per JAX-WS 2.2 Specificaiton
section 3.6.2.1 pg 41 an application programmer does not use
> > + //the wrapper bean classes, so the
application need not package these classes. If we have reached
> > + //this point in the code then user has
choosen not to package these beans.
> > +
> > + //NOTE:If we find Generated artifacts
from cache this guarantees that we will not use
> > + //DocLitWrappedMinimum marshaller
code. The advantage of normal DocLitWrappedMarshaller is
> > + //that it is very robust and has
support of lot more datatypes than in DocLitWrappedMinimum.
> > + if(log.isDebugEnabled()){
> > + log.debug("Adding cache to
classpath");
> > + }
> > if(log.isDebugEnabled()){
> > log.debug("Adding cache to
classpath");
> > }
> >
> > Added:
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
> > URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java?rev=963508&view=auto
> >
==============================================================================
> > ---
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
(added)
> > +++
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
Mon Jul 12 22:16:54 2010
> > @@ -0,0 +1,18 @@
> > +
> > +package org.apache.axis2.jaxws.wrapper.beans;
> > +
> > +import javax.xml.ws.WebFault;
> > +
> > +@WebFault(name = "AddNumbersFault", targetNamespace = "
http://org/test/addnumbers")
> > +public class AddNumbersException extends Exception
> > +{
> > +
> > + private String message = null;
> > + public AddNumbersException(){}
> > + public AddNumbersException(String message){
> > + this.message = message;
> > + }
> > + public String getInfo(){
> > + return message;
> > + }
> > +}
> >
> > Added:
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
> > URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java?rev=963508&view=auto
> >
==============================================================================
> > ---
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
(added)
> > +++
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
Mon Jul 12 22:16:54 2010
> > @@ -0,0 +1,15 @@
> > +package org.apache.axis2.jaxws.wrapper.beans;
> > +
> > +
> > +
> > +@javax.jws.WebService (targetNamespace="http://org/test/addnumbers",
serviceName="AddNumbersService", portName="AddNumbersPort")
> > +public class AddNumbersService{
> > +
> > + public int addNumbers(int arg0, int arg1) throws
AddNumbersException {
> > + if(arg0+arg1<0){
> > + throw new AddNumbersException("sum is less
than 0");
> > + }
> > + return arg0+arg1;
> > + }
> > +
> > +}
> > \ No newline at end of file
> >
> > Added:
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
> > URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java?rev=963508&view=auto
> >
==============================================================================
> > ---
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
(added)
> > +++
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
Mon Jul 12 22:16:54 2010
> > @@ -0,0 +1,114 @@
> > +/**
> > + *
> > + */
> > +package org.apache.axis2.jaxws.wrapper.beans;
> > +
> > +
> > +import org.apache.axis2.jaxws.Constants;
> > +import org.apache.axis2.jaxws.description.DescriptionFactory;
> > +import org.apache.axis2.jaxws.description.EndpointDescription;
> > +import org.apache.axis2.jaxws.description.EndpointDescriptionJava;
> > +import org.apache.axis2.jaxws.description.OperationDescription;
> > +import org.apache.axis2.jaxws.description.ServiceDescription;
> > +import org.apache.axis2.jaxws.marshaller.MethodMarshaller;
> > +import
org.apache.axis2.jaxws.marshaller.factory.MethodMarshallerFactory;
> > +import
org.apache.axis2.jaxws.marshaller.impl.alt.DocLitWrappedMinimalMethodMarshaller;
> > +import org.apache.axis2.jaxws.unitTest.TestLogger;
> > +
> > +import java.io.File;
> > +
> > +import junit.framework.TestCase;
> > +
> > +public class WrapperBeanMarshallTests extends TestCase {
> > + /**
> > + * This is the negative test case, when we do not use generated
artifacts from cache
> > + * and user did not package wrapper beans, we should see use of
DocLitWrappedMinumumMarshaller.
> > + */
> > + public void
testGetMarshallerOperationDescriptionBooleanNegative() {
> > +
TestLogger.logger.debug("---------------------------------------");
> > + TestLogger.logger.debug("test: " + getName());
> > +
> > + String cache_location = "/target/wscache/classes";
> > + try{
> > + String baseDir = new
File(System.getProperty("basedir",".")).getCanonicalPath();
> > + cache_location = new
File(baseDir+cache_location).getAbsolutePath();
> > + TestLogger.logger.debug("cache location
="+cache_location);
> > +
> > + //Get EndpointDescription.
> > + //Set location on AxisConfiguraiton.
> > + Class sei = AddNumbersService.class;
> > + EndpointDescription description = getEndpointDesc(sei);
> > + TestLogger.logger.debug("description objects where
created successfully");
> > + OperationDescription[] ops
=description.getEndpointInterfaceDescription().getOperations();
> > + assertNotNull( "OperationDescriptions where null", ops);
> > + assertTrue("No Operation Descriptions where found",
ops.length>0);
> > + OperationDescription op = ops[0];
> > + TestLogger.logger.debug("operation found, java
methodName="+op.getJavaMethodName());
> > + //Don not Set cache on AxisConfiguration.
> > + //get Marshaller, verify its not DoclitWrappedMinimum.
> > + TestLogger.logger.debug("ws_cache location NOT set on
AxisConfigContext, location="+cache_location);
> > + MethodMarshaller mm =
MethodMarshallerFactory.getMarshaller(op, false);
> > + assertNotNull("getMarshaller returned null", mm );
> > + TestLogger.logger.debug("MethodMarshaller was created,
type="+mm.getClass().getName());
> > + assertTrue("Generated artifacts not found, Method
marshaller should be DocLitWrappedMinimumMarshaller", (mm instanceof
DocLitWrappedMinimalMethodMarshaller));
> > + }catch(Exception e){
> > + TestLogger.logger.debug("Exception ="+e.getMessage());
> > + fail(e.getMessage());
> > + }
> > +
> > + }
> > + /**
> > + * In this test case user did not package wrapper beans but we
add generated artifacts from cache, we should see use of
> > + * DocLitWrappedMarshaller.
> > + * Test method for {@link
org.apache.axis2.jaxws.marshaller.factory.MethodMarshallerFactory#getMarshaller(org.apache.axis2.jaxws.description.OperationDescription,
boolean)}.
> > + */
> > + public void testGetMarshallerOperationDescriptionBoolean() {
> > +
TestLogger.logger.debug("---------------------------------------");
> > + TestLogger.logger.debug("test: " + getName());
> > +
> > + String cache_location = "/target/wscache/classes";
> > + try{
> > + String baseDir = new
File(System.getProperty("basedir",".")).getCanonicalPath();
> > + cache_location = new
File(baseDir+cache_location).getAbsolutePath();
> > + TestLogger.logger.debug("cache location
="+cache_location);
> > +
> > + //Get EndpointDescription.
> > + //Set location on AxisConfiguraiton.
> > + Class sei = AddNumbersService.class;
> > + EndpointDescription description = getEndpointDesc(sei);
> > + TestLogger.logger.debug("description objects where
created successfully");
> > + OperationDescription[] ops
=description.getEndpointInterfaceDescription().getOperations();
> > + assertNotNull( "OperationDescriptions where null", ops);
> > + assertTrue("No Operation Descriptions where found",
ops.length>0);
> > + OperationDescription op = ops[0];
> > + TestLogger.logger.debug("operation found, java
methodName="+op.getJavaMethodName());
> > + //Set cache on AxisConfiguration.
> > + //get Marshaller, verify its not DoclitWrappedMinimum.
> > +
description.getServiceDescription().getAxisConfigContext().setProperty(Constants.WS_CACHE,
cache_location);
> > + TestLogger.logger.debug("ws_cache location set on
AxisConfigContext, location="+cache_location);
> > + MethodMarshaller mm =
MethodMarshallerFactory.getMarshaller(op, false);
> > + assertNotNull("getMarshaller returned null", mm );
> > + TestLogger.logger.debug("MethodMarshaller was created,
type="+mm.getClass().getName());
> > + assertTrue("Generated artifacts are in cache, Method
marshaller should not be DocLitWrappedMinimumMarshaller", !(mm instanceof
DocLitWrappedMinimalMethodMarshaller));
> > + }catch(Exception e){
> > + TestLogger.logger.debug("Exception ="+e.getMessage());
> > + fail(e.getMessage());
> > + }
> > +
> > + }
> > +
> > + private EndpointDescription getEndpointDesc(Class
implementationClass) {
> > + // Use the description factory directly; this will be done
within the JAX-WS runtime
> > + ServiceDescription serviceDesc =
> > +
DescriptionFactory.createServiceDescription(implementationClass);
> > + assertNotNull(serviceDesc);
> > +
> > + EndpointDescription[] endpointDesc =
serviceDesc.getEndpointDescriptions();
> > + assertNotNull(endpointDesc);
> > + assertEquals(1, endpointDesc.length);
> > +
> > + // TODO: How will the JAX-WS dispatcher get the appropriate
port (i.e. endpoint)? Currently assumes [0]
> > + EndpointDescription testEndpointDesc = endpointDesc[0];
> > + return testEndpointDesc;
> > + }
> > +}
> >
> > Added: axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml
> > URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml?rev=963508&view=auto
> >
==============================================================================
> > --- axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml (added)
> > +++ axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml Mon Jul
12 22:16:54 2010
> > @@ -0,0 +1,34 @@
> > +<?xml version="1.0" encoding="UTF-8"?>
> > +
> > +<project basedir="." default="run-wsgen-tests" name="wsgen-tests">
> > +
> > + <property name="wscache.output.base.dir"
value="target/wscache" />
> > + <property name="wscache.generated.src.dir"
value="${wscache.output.base.dir}/src" />
> > + <property name="wscache.generated.classes.dir"
value="${wscache.output.base.dir}/classes" />
> > + <property name="compile.test.classes"
value="target/test-classes" />
> > +
> > +
> > + <target name="run-wsgen-tests" depends="wrapper-beans"/>
> > +
> > +
> > + <target name="create-cache">
> > + <mkdir dir="${wscache.output.base.dir}" />
> > + <mkdir dir="${wscache.generated.src.dir}" />
> > + <mkdir dir="${wscache.generated.classes.dir}" />
> > + </target>
> > +
> > + <target name="wrapper-beans" depends="create-cache">
> > + <echo>Generating artifacts for
org.apache.axis2.jaxws.wrapper.beans.AddNumbersService </echo>
> > + <wsgen
> > +
sei="org.apache.axis2.jaxws.wrapper.beans.AddNumbersService"
> > + destdir="${wscache.generated.classes.dir}"
> > + resourcedestdir="${wscache.generated.src.dir}"
> > + keep="false"
> > + verbose="false"
> > + genwsdl="true">
> > + <classpath>
> > + <pathelement path="${compile.test.classes}" />
> > + </classpath>
> > + </wsgen>
> > + </target>
> > +</project>
> > \ No newline at end of file
> >
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-dev-help@axis.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org
Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws:
./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/
test/org/apache/axis2/jaxws/wrapper/ test/org/apache/axis2/jaxws/wrapper/beans/
Posted by Andreas Veithen <an...@gmail.com>.
No, you are using the antrun plugin to execute the wsgen ant task.
What I meant was to use a real Maven plugin (either the one from
java.net or the one from CXF).
-1 to commit any generated stuff into SVN.
Andreas
On Wed, Jul 14, 2010 at 21:42, Nikhil V Thaker
<ni...@us.ibm.com> wrote:
>
> Andreas - I had to add the tools.jar bit because maven plugin for wsGen gave NoClassDef Found errors for classes packaged in tools.jar.
>
> Since this is causing a problem I will just package the generated artifacts and remove the wsGen dependency.
>
> Thanks,
>
> Nikhil Thaker
> office: 919 254 9964
> nvthaker@us.ibm.com
>
>
> Andreas Veithen <an...@gmail.com>
>
> 07/14/2010 01:44 PM
>
> Please respond to
> java-dev@axis.apache.org
> To
> java-dev@axis.apache.org
> cc
> Subject
> Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws: ./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ test/org/apache/axis2/jaxws/wrapper/ test/org/apache/axis2/jaxws/wrapper/beans/
>
>
>
>
> Nikhil,
>
> I have some issues with the tools and jaxws-tools dependencies
> introduced by this change:
>
> * The change causes a build failure in Hudson. There will also be
> additional issues with tools.jar, because the way to declare this as a
> system dependency varies from one JDK to another. For example, I
> remember that on Mac OS X, it is completely different than on other
> JDKs.
>
> * I don't like the fact that jaxws-tools becomes a dependency of
> axis2-jaxws in scope compile, because it looks like this is only
> needed during the build and/or during the tests.
>
> I didn't review the change in detail, but wouldn't it be smarter to
> use one of the existing Maven plugins to do the wsgen stuff? They will
> take care of the tools.jar stuff as well.
>
> Andreas
>
> On Tue, Jul 13, 2010 at 00:16, <nt...@apache.org> wrote:
> > Author: nthaker
> > Date: Mon Jul 12 22:16:54 2010
> > New Revision: 963508
> >
> > URL: http://svn.apache.org/viewvc?rev=963508&view=rev
> > Log:
> > AXIS2-4775
> > This change ensures that we will use Request and Response wrapper Bean packaged by customer or we will Generate Wrappers if they are not packaged.
> >
> > Added:
> > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/
> > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/
> > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
> > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
> > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
> > axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml
> > Modified:
> > axis/axis2/java/core/trunk/modules/jaxws/pom.xml
> > axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
> >
> > Modified: axis/axis2/java/core/trunk/modules/jaxws/pom.xml
> > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/pom.xml?rev=963508&r1=963507&r2=963508&view=diff
> > ==============================================================================
> > --- axis/axis2/java/core/trunk/modules/jaxws/pom.xml (original)
> > +++ axis/axis2/java/core/trunk/modules/jaxws/pom.xml Mon Jul 12 22:16:54 2010
> > @@ -1,5 +1,4 @@
> > <?xml version="1.0" encoding="UTF-8"?>
> > -
> > <!-- > ~ Licensed to the Apache Software Foundation (ASF) under one
> > ~ or more contributor license agreements. See the NOTICE file
> > @@ -20,7 +19,7 @@
> > -->
> >
> > <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> > - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
> > + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
> > <modelVersion>4.0.0</modelVersion>
> > <parent>
> > <groupId>org.apache.axis2</groupId>
> > @@ -98,7 +97,25 @@
> > <version>${version}</version>
> > <scope>test</scope>
> > </dependency>
> > + <dependency>
> > + <groupId>wsdl4j</groupId>
> > + <artifactId>wsdl4j</artifactId>
> > + </dependency>
> > + <dependency>
> > + <groupId>com.sun.xml.ws</groupId>
> > + <artifactId>jaxws-tools</artifactId>
> > + <version>2.1.3</version>
> > + </dependency>
> > + <!-- If we dont include tools.jar as dependency, maven throws NoClassDefFound on wsGen run -->
> > + <dependency>
> > + <groupId>java</groupId>
> > + <artifactId>tools</artifactId>
> > + <version>$version</version>
> > + <scope>system</scope>
> > + <systemPath>${JAVA_HOME}/lib/tools.jar</systemPath>
> > + </dependency>
> > </dependencies>
> > +
> > <build>
> > <sourceDirectory>src</sourceDirectory>
> > <testSourceDirectory>test</testSourceDirectory>
> > @@ -203,34 +220,39 @@
> > <compilerVersion>1.5</compilerVersion>
> > <source>1.5</source>
> > <target>1.5</target>
> > +
> > </configuration>
> > </plugin>
> > <plugin>
> > <groupId>org.apache.maven.plugins</groupId>
> > <artifactId>maven-antrun-plugin</artifactId>
> > +
> > <executions>
> > <execution>
> > <id>gen-ts</id>
> > <phase>generate-test-sources</phase>
> > <configuration>
> > - <tasks unless="maven.test.skip">
> > + <tasks unless="maven.test.skip">
> > <!-- Theres got to be a better way to do this -->
> > <property name="schema.source.dir" value="test-resources/xsd"/>
> > <property name="wsdl.source.dir" value="test-resources/wsdl"/>
> > - <property name="schema.output.base.dir" value="target/schema"/>
> > + <property name="schema.output.base.dir" value="target/schema"/>
> > <property name="schema.generated.src.dir" value="${schema.output.base.dir}/src"/>
> > <property name="schema.generated.classes.dir"
> > value="${schema.output.base.dir}/classes"/>
> > +
> > <!-- make the dirs -->
> > <mkdir dir="${schema.output.base.dir}"/>
> > <mkdir dir="${schema.generated.src.dir}"/>
> > <mkdir dir="${schema.generated.classes.dir}"/>
> > +
> > <!-- Run JAXB schema compiler with designated schemas -->
> > <echo>Generating JAX-B classes from XSDs</echo>
> >
> > <echo>Generating java from echo.xsd</echo>
> > <java classname="com.sun.tools.xjc.Driver" fork="true">
> > <classpath refid="maven.runtime.classpath"/>
> > +
> > <classpath location="${compiled.classes.dir}"/>
> > <arg line="-d ${schema.generated.src.dir} -quiet ${schema.source.dir}/echo.xsd"/>
> > </java>
> > @@ -266,7 +288,7 @@
> > <classpath refid="maven.runtime.classpath"/>
> > <classpath location="${compiled.classes.dir}"/>
> > <arg line="-d ${schema.generated.src.dir} -quiet -wsdl ${wsdl.source.dir}/AddNumbers.wsdl"/>
> > - </java>
> > + </java>
> > </tasks>
> > </configuration>
> > <goals>
> > @@ -287,6 +309,22 @@
> > <property name="addressing_version" value="${version}"/>
> > <ant antfile="build.xml" inheritall="true" inheritrefs="true"
> > dir="." target="build-repo"/>
> > +
> > + <property name="compile_classpath" refid="maven.compile.classpath" />
> > + <property name="runtime_classpath" refid="maven.runtime.classpath" />
> > + <property name="test_classpath" refid="maven.test.classpath" />
> > + <property name="plugin_classpath" refid="maven.plugin.classpath" />
> > +
> > + <!-- Defining wsGen task -->
> > + <taskdef name="wsgen" loaderRef="refwsgen" classname="com.sun.tools.ws.ant.WsGen">
> > + <classpath>
> > + <path refid="maven.runtime.classpath" />
> > + <path refid="maven.compile.classpath" />
> > + </classpath>
> > + </taskdef>
> > + <!-- Invoking test cases that need to generate artifacts using wsGen -->
> > + <ant antfile="wsgen-tests.xml" inheritall="true" inheritrefs="true"
> > + dir="." target="run-wsgen-tests"/>
> > </tasks>
> > </configuration>
> > <goals>
> > @@ -374,6 +412,13 @@
> > <plugin>
> > <groupId>org.apache.maven.plugins</groupId>
> > <artifactId>maven-surefire-report-plugin</artifactId>
> > + <reportSets>
> > + <reportSet>
> > + <reports>
> > + <report>report-only</report>
> > + </reports>
> > + </reportSet>
> > + </reportSets>
> > </plugin>
> > </plugins>
> > </reporting>
> >
> > Modified: axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
> > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java?rev=963508&r1=963507&r2=963508&view=diff
> > ==============================================================================
> > --- axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java (original)
> > +++ axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java Mon Jul 12 22:16:54 2010
> > @@ -238,12 +238,27 @@ class ArtifactProcessor {
> > wrapperClass = newValue;
> > }
> > }
> > - if(cls==null && (type.equals("@WebFault")|| type.equals("faultInfo"))){
> > +
> > + if(cls==null &&
> > + (type.equals("@RequestWrapper")|| type.equals("@ResponseWrapper")||type.equals("@WebFault")|| type.equals("faultInfo"))){
> > +
> > + //Support for Fault Bean Generation
> > //As per JAX-WS 2.2 Specification section 3.7 an application programmer can choose not to
> > //package the faultBeans, if we have reached this point in the code then user has choosen
> > //not to package the fault bean. If there is a cache of generated artifacts available then
> > //lets look for the missing faultBean there.
> > -
> > +
> > + //Support for Wrapper Bean Generation
> > + //As per JAX-WS 2.2 Specificaiton section 3.6.2.1 pg 41 an application programmer does not use
> > + //the wrapper bean classes, so the application need not package these classes. If we have reached
> > + //this point in the code then user has choosen not to package these beans.
> > +
> > + //NOTE:If we find Generated artifacts from cache this guarantees that we will not use
> > + //DocLitWrappedMinimum marshaller code. The advantage of normal DocLitWrappedMarshaller is
> > + //that it is very robust and has support of lot more datatypes than in DocLitWrappedMinimum.
> > + if(log.isDebugEnabled()){
> > + log.debug("Adding cache to classpath");
> > + }
> > ClassFinderFactory cff =
> > (ClassFinderFactory)FactoryRegistry.getFactory(ClassFinderFactory.class);
> > ClassFinder cf = cff.getClassFinder();
> > @@ -317,11 +332,26 @@ class ArtifactProcessor {
> > if (cls2 == null) {
> > cls2 = loadClassOrNull(defaultValue, altClassLoader);
> > }
> > - if(cls2==null && (type.equals("faultInfo")|| type.equals("@WebFault"))){
> > - //As per JAX-WS 2.2 Specification section 3.7 an application programmer can choose not to
> > - //package the faultBeans, if we have reached this point in the code then user has choosen
> > - //not to package the fault bean. If there is a cache of generated artifacts available then
> > - //lets look for the missing faultBean there.
> > + if(cls2==null &&
> > + (type.equals("@RequestWrapper")|| type.equals("@ResponseWrapper")||type.equals("@WebFault")|| type.equals("faultInfo"))){
> > +
> > + //Support for Fault Bean Generation
> > + //As per JAX-WS 2.2 Specification section 3.7 an application programmer can choose not to
> > + //package the faultBeans, if we have reached this point in the code then user has choosen
> > + //not to package the fault bean. If there is a cache of generated artifacts available then
> > + //lets look for the missing faultBean there.
> > +
> > + //Support for Wrapper Bean Generation
> > + //As per JAX-WS 2.2 Specificaiton section 3.6.2.1 pg 41 an application programmer does not use
> > + //the wrapper bean classes, so the application need not package these classes. If we have reached
> > + //this point in the code then user has choosen not to package these beans.
> > +
> > + //NOTE:If we find Generated artifacts from cache this guarantees that we will not use
> > + //DocLitWrappedMinimum marshaller code. The advantage of normal DocLitWrappedMarshaller is
> > + //that it is very robust and has support of lot more datatypes than in DocLitWrappedMinimum.
> > + if(log.isDebugEnabled()){
> > + log.debug("Adding cache to classpath");
> > + }
> > if(log.isDebugEnabled()){
> > log.debug("Adding cache to classpath");
> > }
> >
> > Added: axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
> > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java?rev=963508&view=auto
> > ==============================================================================
> > --- axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java (added)
> > +++ axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java Mon Jul 12 22:16:54 2010
> > @@ -0,0 +1,18 @@
> > +
> > +package org.apache.axis2.jaxws.wrapper.beans;
> > +
> > +import javax.xml.ws.WebFault;
> > +
> > +@WebFault(name = "AddNumbersFault", targetNamespace = "http://org/test/addnumbers")
> > +public class AddNumbersException extends Exception
> > +{
> > +
> > + private String message = null;
> > + public AddNumbersException(){}
> > + public AddNumbersException(String message){
> > + this.message = message;
> > + }
> > + public String getInfo(){
> > + return message;
> > + }
> > +}
> >
> > Added: axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
> > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java?rev=963508&view=auto
> > ==============================================================================
> > --- axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java (added)
> > +++ axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java Mon Jul 12 22:16:54 2010
> > @@ -0,0 +1,15 @@
> > +package org.apache.axis2.jaxws.wrapper.beans;
> > +
> > +
> > +
> > +@javax.jws.WebService (targetNamespace="http://org/test/addnumbers", serviceName="AddNumbersService", portName="AddNumbersPort")
> > +public class AddNumbersService{
> > +
> > + public int addNumbers(int arg0, int arg1) throws AddNumbersException {
> > + if(arg0+arg1<0){
> > + throw new AddNumbersException("sum is less than 0");
> > + }
> > + return arg0+arg1;
> > + }
> > +
> > +}
> > \ No newline at end of file
> >
> > Added: axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
> > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java?rev=963508&view=auto
> > ==============================================================================
> > --- axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java (added)
> > +++ axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java Mon Jul 12 22:16:54 2010
> > @@ -0,0 +1,114 @@
> > +/**
> > + *
> > + */
> > +package org.apache.axis2.jaxws.wrapper.beans;
> > +
> > +
> > +import org.apache.axis2.jaxws.Constants;
> > +import org.apache.axis2.jaxws.description.DescriptionFactory;
> > +import org.apache.axis2.jaxws.description.EndpointDescription;
> > +import org.apache.axis2.jaxws.description.EndpointDescriptionJava;
> > +import org.apache.axis2.jaxws.description.OperationDescription;
> > +import org.apache.axis2.jaxws.description.ServiceDescription;
> > +import org.apache.axis2.jaxws.marshaller.MethodMarshaller;
> > +import org.apache.axis2.jaxws.marshaller.factory.MethodMarshallerFactory;
> > +import org.apache.axis2.jaxws.marshaller.impl.alt.DocLitWrappedMinimalMethodMarshaller;
> > +import org.apache.axis2.jaxws.unitTest.TestLogger;
> > +
> > +import java.io.File;
> > +
> > +import junit.framework.TestCase;
> > +
> > +public class WrapperBeanMarshallTests extends TestCase {
> > + /**
> > + * This is the negative test case, when we do not use generated artifacts from cache
> > + * and user did not package wrapper beans, we should see use of DocLitWrappedMinumumMarshaller.
> > + */
> > + public void testGetMarshallerOperationDescriptionBooleanNegative() {
> > + TestLogger.logger.debug("---------------------------------------");
> > + TestLogger.logger.debug("test: " + getName());
> > +
> > + String cache_location = "/target/wscache/classes";
> > + try{
> > + String baseDir = new File(System.getProperty("basedir",".")).getCanonicalPath();
> > + cache_location = new File(baseDir+cache_location).getAbsolutePath();
> > + TestLogger.logger.debug("cache location ="+cache_location);
> > +
> > + //Get EndpointDescription.
> > + //Set location on AxisConfiguraiton.
> > + Class sei = AddNumbersService.class;
> > + EndpointDescription description = getEndpointDesc(sei);
> > + TestLogger.logger.debug("description objects where created successfully");
> > + OperationDescription[] ops =description.getEndpointInterfaceDescription().getOperations();
> > + assertNotNull( "OperationDescriptions where null", ops);
> > + assertTrue("No Operation Descriptions where found", ops.length>0);
> > + OperationDescription op = ops[0];
> > + TestLogger.logger.debug("operation found, java methodName="+op.getJavaMethodName());
> > + //Don not Set cache on AxisConfiguration.
> > + //get Marshaller, verify its not DoclitWrappedMinimum.
> > + TestLogger.logger.debug("ws_cache location NOT set on AxisConfigContext, location="+cache_location);
> > + MethodMarshaller mm = MethodMarshallerFactory.getMarshaller(op, false);
> > + assertNotNull("getMarshaller returned null", mm );
> > + TestLogger.logger.debug("MethodMarshaller was created, type="+mm.getClass().getName());
> > + assertTrue("Generated artifacts not found, Method marshaller should be DocLitWrappedMinimumMarshaller", (mm instanceof DocLitWrappedMinimalMethodMarshaller));
> > + }catch(Exception e){
> > + TestLogger.logger.debug("Exception ="+e.getMessage());
> > + fail(e.getMessage());
> > + }
> > +
> > + }
> > + /**
> > + * In this test case user did not package wrapper beans but we add generated artifacts from cache, we should see use of
> > + * DocLitWrappedMarshaller.
> > + * Test method for {@link org.apache.axis2.jaxws.marshaller.factory.MethodMarshallerFactory#getMarshaller(org.apache.axis2.jaxws.description.OperationDescription, boolean)}.
> > + */
> > + public void testGetMarshallerOperationDescriptionBoolean() {
> > + TestLogger.logger.debug("---------------------------------------");
> > + TestLogger.logger.debug("test: " + getName());
> > +
> > + String cache_location = "/target/wscache/classes";
> > + try{
> > + String baseDir = new File(System.getProperty("basedir",".")).getCanonicalPath();
> > + cache_location = new File(baseDir+cache_location).getAbsolutePath();
> > + TestLogger.logger.debug("cache location ="+cache_location);
> > +
> > + //Get EndpointDescription.
> > + //Set location on AxisConfiguraiton.
> > + Class sei = AddNumbersService.class;
> > + EndpointDescription description = getEndpointDesc(sei);
> > + TestLogger.logger.debug("description objects where created successfully");
> > + OperationDescription[] ops =description.getEndpointInterfaceDescription().getOperations();
> > + assertNotNull( "OperationDescriptions where null", ops);
> > + assertTrue("No Operation Descriptions where found", ops.length>0);
> > + OperationDescription op = ops[0];
> > + TestLogger.logger.debug("operation found, java methodName="+op.getJavaMethodName());
> > + //Set cache on AxisConfiguration.
> > + //get Marshaller, verify its not DoclitWrappedMinimum.
> > + description.getServiceDescription().getAxisConfigContext().setProperty(Constants.WS_CACHE, cache_location);
> > + TestLogger.logger.debug("ws_cache location set on AxisConfigContext, location="+cache_location);
> > + MethodMarshaller mm = MethodMarshallerFactory.getMarshaller(op, false);
> > + assertNotNull("getMarshaller returned null", mm );
> > + TestLogger.logger.debug("MethodMarshaller was created, type="+mm.getClass().getName());
> > + assertTrue("Generated artifacts are in cache, Method marshaller should not be DocLitWrappedMinimumMarshaller", !(mm instanceof DocLitWrappedMinimalMethodMarshaller));
> > + }catch(Exception e){
> > + TestLogger.logger.debug("Exception ="+e.getMessage());
> > + fail(e.getMessage());
> > + }
> > +
> > + }
> > +
> > + private EndpointDescription getEndpointDesc(Class implementationClass) {
> > + // Use the description factory directly; this will be done within the JAX-WS runtime
> > + ServiceDescription serviceDesc =
> > + DescriptionFactory.createServiceDescription(implementationClass);
> > + assertNotNull(serviceDesc);
> > +
> > + EndpointDescription[] endpointDesc = serviceDesc.getEndpointDescriptions();
> > + assertNotNull(endpointDesc);
> > + assertEquals(1, endpointDesc.length);
> > +
> > + // TODO: How will the JAX-WS dispatcher get the appropriate port (i.e. endpoint)? Currently assumes [0]
> > + EndpointDescription testEndpointDesc = endpointDesc[0];
> > + return testEndpointDesc;
> > + }
> > +}
> >
> > Added: axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml
> > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml?rev=963508&view=auto
> > ==============================================================================
> > --- axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml (added)
> > +++ axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml Mon Jul 12 22:16:54 2010
> > @@ -0,0 +1,34 @@
> > +<?xml version="1.0" encoding="UTF-8"?>
> > +
> > +<project basedir="." default="run-wsgen-tests" name="wsgen-tests">
> > +
> > + <property name="wscache.output.base.dir" value="target/wscache" />
> > + <property name="wscache.generated.src.dir" value="${wscache.output.base.dir}/src" />
> > + <property name="wscache.generated.classes.dir" value="${wscache.output.base.dir}/classes" />
> > + <property name="compile.test.classes" value="target/test-classes" />
> > +
> > +
> > + <target name="run-wsgen-tests" depends="wrapper-beans"/>
> > +
> > +
> > + <target name="create-cache">
> > + <mkdir dir="${wscache.output.base.dir}" />
> > + <mkdir dir="${wscache.generated.src.dir}" />
> > + <mkdir dir="${wscache.generated.classes.dir}" />
> > + </target>
> > +
> > + <target name="wrapper-beans" depends="create-cache">
> > + <echo>Generating artifacts for org.apache.axis2.jaxws.wrapper.beans.AddNumbersService </echo>
> > + <wsgen
> > + sei="org.apache.axis2.jaxws.wrapper.beans.AddNumbersService"
> > + destdir="${wscache.generated.classes.dir}"
> > + resourcedestdir="${wscache.generated.src.dir}"
> > + keep="false"
> > + verbose="false"
> > + genwsdl="true">
> > + <classpath>
> > + <pathelement path="${compile.test.classes}" />
> > + </classpath>
> > + </wsgen>
> > + </target>
> > +</project>
> > \ No newline at end of file
> >
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-dev-help@axis.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org
Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws:
./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/
test/org/apache/axis2/jaxws/wrapper/ test/org/apache/axis2/jaxws/wrapper/beans/
Posted by Andreas Veithen <an...@gmail.com>.
No, you are using the antrun plugin to execute the wsgen ant task.
What I meant was to use a real Maven plugin (either the one from
java.net or the one from CXF).
-1 to commit any generated stuff into SVN.
Andreas
On Wed, Jul 14, 2010 at 21:42, Nikhil V Thaker
<ni...@us.ibm.com> wrote:
>
> Andreas - I had to add the tools.jar bit because maven plugin for wsGen gave NoClassDef Found errors for classes packaged in tools.jar.
>
> Since this is causing a problem I will just package the generated artifacts and remove the wsGen dependency.
>
> Thanks,
>
> Nikhil Thaker
> office: 919 254 9964
> nvthaker@us.ibm.com
>
>
> Andreas Veithen <an...@gmail.com>
>
> 07/14/2010 01:44 PM
>
> Please respond to
> java-dev@axis.apache.org
> To
> java-dev@axis.apache.org
> cc
> Subject
> Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws: ./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ test/org/apache/axis2/jaxws/wrapper/ test/org/apache/axis2/jaxws/wrapper/beans/
>
>
>
>
> Nikhil,
>
> I have some issues with the tools and jaxws-tools dependencies
> introduced by this change:
>
> * The change causes a build failure in Hudson. There will also be
> additional issues with tools.jar, because the way to declare this as a
> system dependency varies from one JDK to another. For example, I
> remember that on Mac OS X, it is completely different than on other
> JDKs.
>
> * I don't like the fact that jaxws-tools becomes a dependency of
> axis2-jaxws in scope compile, because it looks like this is only
> needed during the build and/or during the tests.
>
> I didn't review the change in detail, but wouldn't it be smarter to
> use one of the existing Maven plugins to do the wsgen stuff? They will
> take care of the tools.jar stuff as well.
>
> Andreas
>
> On Tue, Jul 13, 2010 at 00:16, <nt...@apache.org> wrote:
> > Author: nthaker
> > Date: Mon Jul 12 22:16:54 2010
> > New Revision: 963508
> >
> > URL: http://svn.apache.org/viewvc?rev=963508&view=rev
> > Log:
> > AXIS2-4775
> > This change ensures that we will use Request and Response wrapper Bean packaged by customer or we will Generate Wrappers if they are not packaged.
> >
> > Added:
> > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/
> > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/
> > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
> > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
> > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
> > axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml
> > Modified:
> > axis/axis2/java/core/trunk/modules/jaxws/pom.xml
> > axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
> >
> > Modified: axis/axis2/java/core/trunk/modules/jaxws/pom.xml
> > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/pom.xml?rev=963508&r1=963507&r2=963508&view=diff
> > ==============================================================================
> > --- axis/axis2/java/core/trunk/modules/jaxws/pom.xml (original)
> > +++ axis/axis2/java/core/trunk/modules/jaxws/pom.xml Mon Jul 12 22:16:54 2010
> > @@ -1,5 +1,4 @@
> > <?xml version="1.0" encoding="UTF-8"?>
> > -
> > <!-- > ~ Licensed to the Apache Software Foundation (ASF) under one
> > ~ or more contributor license agreements. See the NOTICE file
> > @@ -20,7 +19,7 @@
> > -->
> >
> > <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> > - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
> > + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
> > <modelVersion>4.0.0</modelVersion>
> > <parent>
> > <groupId>org.apache.axis2</groupId>
> > @@ -98,7 +97,25 @@
> > <version>${version}</version>
> > <scope>test</scope>
> > </dependency>
> > + <dependency>
> > + <groupId>wsdl4j</groupId>
> > + <artifactId>wsdl4j</artifactId>
> > + </dependency>
> > + <dependency>
> > + <groupId>com.sun.xml.ws</groupId>
> > + <artifactId>jaxws-tools</artifactId>
> > + <version>2.1.3</version>
> > + </dependency>
> > + <!-- If we dont include tools.jar as dependency, maven throws NoClassDefFound on wsGen run -->
> > + <dependency>
> > + <groupId>java</groupId>
> > + <artifactId>tools</artifactId>
> > + <version>$version</version>
> > + <scope>system</scope>
> > + <systemPath>${JAVA_HOME}/lib/tools.jar</systemPath>
> > + </dependency>
> > </dependencies>
> > +
> > <build>
> > <sourceDirectory>src</sourceDirectory>
> > <testSourceDirectory>test</testSourceDirectory>
> > @@ -203,34 +220,39 @@
> > <compilerVersion>1.5</compilerVersion>
> > <source>1.5</source>
> > <target>1.5</target>
> > +
> > </configuration>
> > </plugin>
> > <plugin>
> > <groupId>org.apache.maven.plugins</groupId>
> > <artifactId>maven-antrun-plugin</artifactId>
> > +
> > <executions>
> > <execution>
> > <id>gen-ts</id>
> > <phase>generate-test-sources</phase>
> > <configuration>
> > - <tasks unless="maven.test.skip">
> > + <tasks unless="maven.test.skip">
> > <!-- Theres got to be a better way to do this -->
> > <property name="schema.source.dir" value="test-resources/xsd"/>
> > <property name="wsdl.source.dir" value="test-resources/wsdl"/>
> > - <property name="schema.output.base.dir" value="target/schema"/>
> > + <property name="schema.output.base.dir" value="target/schema"/>
> > <property name="schema.generated.src.dir" value="${schema.output.base.dir}/src"/>
> > <property name="schema.generated.classes.dir"
> > value="${schema.output.base.dir}/classes"/>
> > +
> > <!-- make the dirs -->
> > <mkdir dir="${schema.output.base.dir}"/>
> > <mkdir dir="${schema.generated.src.dir}"/>
> > <mkdir dir="${schema.generated.classes.dir}"/>
> > +
> > <!-- Run JAXB schema compiler with designated schemas -->
> > <echo>Generating JAX-B classes from XSDs</echo>
> >
> > <echo>Generating java from echo.xsd</echo>
> > <java classname="com.sun.tools.xjc.Driver" fork="true">
> > <classpath refid="maven.runtime.classpath"/>
> > +
> > <classpath location="${compiled.classes.dir}"/>
> > <arg line="-d ${schema.generated.src.dir} -quiet ${schema.source.dir}/echo.xsd"/>
> > </java>
> > @@ -266,7 +288,7 @@
> > <classpath refid="maven.runtime.classpath"/>
> > <classpath location="${compiled.classes.dir}"/>
> > <arg line="-d ${schema.generated.src.dir} -quiet -wsdl ${wsdl.source.dir}/AddNumbers.wsdl"/>
> > - </java>
> > + </java>
> > </tasks>
> > </configuration>
> > <goals>
> > @@ -287,6 +309,22 @@
> > <property name="addressing_version" value="${version}"/>
> > <ant antfile="build.xml" inheritall="true" inheritrefs="true"
> > dir="." target="build-repo"/>
> > +
> > + <property name="compile_classpath" refid="maven.compile.classpath" />
> > + <property name="runtime_classpath" refid="maven.runtime.classpath" />
> > + <property name="test_classpath" refid="maven.test.classpath" />
> > + <property name="plugin_classpath" refid="maven.plugin.classpath" />
> > +
> > + <!-- Defining wsGen task -->
> > + <taskdef name="wsgen" loaderRef="refwsgen" classname="com.sun.tools.ws.ant.WsGen">
> > + <classpath>
> > + <path refid="maven.runtime.classpath" />
> > + <path refid="maven.compile.classpath" />
> > + </classpath>
> > + </taskdef>
> > + <!-- Invoking test cases that need to generate artifacts using wsGen -->
> > + <ant antfile="wsgen-tests.xml" inheritall="true" inheritrefs="true"
> > + dir="." target="run-wsgen-tests"/>
> > </tasks>
> > </configuration>
> > <goals>
> > @@ -374,6 +412,13 @@
> > <plugin>
> > <groupId>org.apache.maven.plugins</groupId>
> > <artifactId>maven-surefire-report-plugin</artifactId>
> > + <reportSets>
> > + <reportSet>
> > + <reports>
> > + <report>report-only</report>
> > + </reports>
> > + </reportSet>
> > + </reportSets>
> > </plugin>
> > </plugins>
> > </reporting>
> >
> > Modified: axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
> > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java?rev=963508&r1=963507&r2=963508&view=diff
> > ==============================================================================
> > --- axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java (original)
> > +++ axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java Mon Jul 12 22:16:54 2010
> > @@ -238,12 +238,27 @@ class ArtifactProcessor {
> > wrapperClass = newValue;
> > }
> > }
> > - if(cls==null && (type.equals("@WebFault")|| type.equals("faultInfo"))){
> > +
> > + if(cls==null &&
> > + (type.equals("@RequestWrapper")|| type.equals("@ResponseWrapper")||type.equals("@WebFault")|| type.equals("faultInfo"))){
> > +
> > + //Support for Fault Bean Generation
> > //As per JAX-WS 2.2 Specification section 3.7 an application programmer can choose not to
> > //package the faultBeans, if we have reached this point in the code then user has choosen
> > //not to package the fault bean. If there is a cache of generated artifacts available then
> > //lets look for the missing faultBean there.
> > -
> > +
> > + //Support for Wrapper Bean Generation
> > + //As per JAX-WS 2.2 Specificaiton section 3.6.2.1 pg 41 an application programmer does not use
> > + //the wrapper bean classes, so the application need not package these classes. If we have reached
> > + //this point in the code then user has choosen not to package these beans.
> > +
> > + //NOTE:If we find Generated artifacts from cache this guarantees that we will not use
> > + //DocLitWrappedMinimum marshaller code. The advantage of normal DocLitWrappedMarshaller is
> > + //that it is very robust and has support of lot more datatypes than in DocLitWrappedMinimum.
> > + if(log.isDebugEnabled()){
> > + log.debug("Adding cache to classpath");
> > + }
> > ClassFinderFactory cff =
> > (ClassFinderFactory)FactoryRegistry.getFactory(ClassFinderFactory.class);
> > ClassFinder cf = cff.getClassFinder();
> > @@ -317,11 +332,26 @@ class ArtifactProcessor {
> > if (cls2 == null) {
> > cls2 = loadClassOrNull(defaultValue, altClassLoader);
> > }
> > - if(cls2==null && (type.equals("faultInfo")|| type.equals("@WebFault"))){
> > - //As per JAX-WS 2.2 Specification section 3.7 an application programmer can choose not to
> > - //package the faultBeans, if we have reached this point in the code then user has choosen
> > - //not to package the fault bean. If there is a cache of generated artifacts available then
> > - //lets look for the missing faultBean there.
> > + if(cls2==null &&
> > + (type.equals("@RequestWrapper")|| type.equals("@ResponseWrapper")||type.equals("@WebFault")|| type.equals("faultInfo"))){
> > +
> > + //Support for Fault Bean Generation
> > + //As per JAX-WS 2.2 Specification section 3.7 an application programmer can choose not to
> > + //package the faultBeans, if we have reached this point in the code then user has choosen
> > + //not to package the fault bean. If there is a cache of generated artifacts available then
> > + //lets look for the missing faultBean there.
> > +
> > + //Support for Wrapper Bean Generation
> > + //As per JAX-WS 2.2 Specificaiton section 3.6.2.1 pg 41 an application programmer does not use
> > + //the wrapper bean classes, so the application need not package these classes. If we have reached
> > + //this point in the code then user has choosen not to package these beans.
> > +
> > + //NOTE:If we find Generated artifacts from cache this guarantees that we will not use
> > + //DocLitWrappedMinimum marshaller code. The advantage of normal DocLitWrappedMarshaller is
> > + //that it is very robust and has support of lot more datatypes than in DocLitWrappedMinimum.
> > + if(log.isDebugEnabled()){
> > + log.debug("Adding cache to classpath");
> > + }
> > if(log.isDebugEnabled()){
> > log.debug("Adding cache to classpath");
> > }
> >
> > Added: axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
> > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java?rev=963508&view=auto
> > ==============================================================================
> > --- axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java (added)
> > +++ axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java Mon Jul 12 22:16:54 2010
> > @@ -0,0 +1,18 @@
> > +
> > +package org.apache.axis2.jaxws.wrapper.beans;
> > +
> > +import javax.xml.ws.WebFault;
> > +
> > +@WebFault(name = "AddNumbersFault", targetNamespace = "http://org/test/addnumbers")
> > +public class AddNumbersException extends Exception
> > +{
> > +
> > + private String message = null;
> > + public AddNumbersException(){}
> > + public AddNumbersException(String message){
> > + this.message = message;
> > + }
> > + public String getInfo(){
> > + return message;
> > + }
> > +}
> >
> > Added: axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
> > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java?rev=963508&view=auto
> > ==============================================================================
> > --- axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java (added)
> > +++ axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java Mon Jul 12 22:16:54 2010
> > @@ -0,0 +1,15 @@
> > +package org.apache.axis2.jaxws.wrapper.beans;
> > +
> > +
> > +
> > +@javax.jws.WebService (targetNamespace="http://org/test/addnumbers", serviceName="AddNumbersService", portName="AddNumbersPort")
> > +public class AddNumbersService{
> > +
> > + public int addNumbers(int arg0, int arg1) throws AddNumbersException {
> > + if(arg0+arg1<0){
> > + throw new AddNumbersException("sum is less than 0");
> > + }
> > + return arg0+arg1;
> > + }
> > +
> > +}
> > \ No newline at end of file
> >
> > Added: axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
> > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java?rev=963508&view=auto
> > ==============================================================================
> > --- axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java (added)
> > +++ axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java Mon Jul 12 22:16:54 2010
> > @@ -0,0 +1,114 @@
> > +/**
> > + *
> > + */
> > +package org.apache.axis2.jaxws.wrapper.beans;
> > +
> > +
> > +import org.apache.axis2.jaxws.Constants;
> > +import org.apache.axis2.jaxws.description.DescriptionFactory;
> > +import org.apache.axis2.jaxws.description.EndpointDescription;
> > +import org.apache.axis2.jaxws.description.EndpointDescriptionJava;
> > +import org.apache.axis2.jaxws.description.OperationDescription;
> > +import org.apache.axis2.jaxws.description.ServiceDescription;
> > +import org.apache.axis2.jaxws.marshaller.MethodMarshaller;
> > +import org.apache.axis2.jaxws.marshaller.factory.MethodMarshallerFactory;
> > +import org.apache.axis2.jaxws.marshaller.impl.alt.DocLitWrappedMinimalMethodMarshaller;
> > +import org.apache.axis2.jaxws.unitTest.TestLogger;
> > +
> > +import java.io.File;
> > +
> > +import junit.framework.TestCase;
> > +
> > +public class WrapperBeanMarshallTests extends TestCase {
> > + /**
> > + * This is the negative test case, when we do not use generated artifacts from cache
> > + * and user did not package wrapper beans, we should see use of DocLitWrappedMinumumMarshaller.
> > + */
> > + public void testGetMarshallerOperationDescriptionBooleanNegative() {
> > + TestLogger.logger.debug("---------------------------------------");
> > + TestLogger.logger.debug("test: " + getName());
> > +
> > + String cache_location = "/target/wscache/classes";
> > + try{
> > + String baseDir = new File(System.getProperty("basedir",".")).getCanonicalPath();
> > + cache_location = new File(baseDir+cache_location).getAbsolutePath();
> > + TestLogger.logger.debug("cache location ="+cache_location);
> > +
> > + //Get EndpointDescription.
> > + //Set location on AxisConfiguraiton.
> > + Class sei = AddNumbersService.class;
> > + EndpointDescription description = getEndpointDesc(sei);
> > + TestLogger.logger.debug("description objects where created successfully");
> > + OperationDescription[] ops =description.getEndpointInterfaceDescription().getOperations();
> > + assertNotNull( "OperationDescriptions where null", ops);
> > + assertTrue("No Operation Descriptions where found", ops.length>0);
> > + OperationDescription op = ops[0];
> > + TestLogger.logger.debug("operation found, java methodName="+op.getJavaMethodName());
> > + //Don not Set cache on AxisConfiguration.
> > + //get Marshaller, verify its not DoclitWrappedMinimum.
> > + TestLogger.logger.debug("ws_cache location NOT set on AxisConfigContext, location="+cache_location);
> > + MethodMarshaller mm = MethodMarshallerFactory.getMarshaller(op, false);
> > + assertNotNull("getMarshaller returned null", mm );
> > + TestLogger.logger.debug("MethodMarshaller was created, type="+mm.getClass().getName());
> > + assertTrue("Generated artifacts not found, Method marshaller should be DocLitWrappedMinimumMarshaller", (mm instanceof DocLitWrappedMinimalMethodMarshaller));
> > + }catch(Exception e){
> > + TestLogger.logger.debug("Exception ="+e.getMessage());
> > + fail(e.getMessage());
> > + }
> > +
> > + }
> > + /**
> > + * In this test case user did not package wrapper beans but we add generated artifacts from cache, we should see use of
> > + * DocLitWrappedMarshaller.
> > + * Test method for {@link org.apache.axis2.jaxws.marshaller.factory.MethodMarshallerFactory#getMarshaller(org.apache.axis2.jaxws.description.OperationDescription, boolean)}.
> > + */
> > + public void testGetMarshallerOperationDescriptionBoolean() {
> > + TestLogger.logger.debug("---------------------------------------");
> > + TestLogger.logger.debug("test: " + getName());
> > +
> > + String cache_location = "/target/wscache/classes";
> > + try{
> > + String baseDir = new File(System.getProperty("basedir",".")).getCanonicalPath();
> > + cache_location = new File(baseDir+cache_location).getAbsolutePath();
> > + TestLogger.logger.debug("cache location ="+cache_location);
> > +
> > + //Get EndpointDescription.
> > + //Set location on AxisConfiguraiton.
> > + Class sei = AddNumbersService.class;
> > + EndpointDescription description = getEndpointDesc(sei);
> > + TestLogger.logger.debug("description objects where created successfully");
> > + OperationDescription[] ops =description.getEndpointInterfaceDescription().getOperations();
> > + assertNotNull( "OperationDescriptions where null", ops);
> > + assertTrue("No Operation Descriptions where found", ops.length>0);
> > + OperationDescription op = ops[0];
> > + TestLogger.logger.debug("operation found, java methodName="+op.getJavaMethodName());
> > + //Set cache on AxisConfiguration.
> > + //get Marshaller, verify its not DoclitWrappedMinimum.
> > + description.getServiceDescription().getAxisConfigContext().setProperty(Constants.WS_CACHE, cache_location);
> > + TestLogger.logger.debug("ws_cache location set on AxisConfigContext, location="+cache_location);
> > + MethodMarshaller mm = MethodMarshallerFactory.getMarshaller(op, false);
> > + assertNotNull("getMarshaller returned null", mm );
> > + TestLogger.logger.debug("MethodMarshaller was created, type="+mm.getClass().getName());
> > + assertTrue("Generated artifacts are in cache, Method marshaller should not be DocLitWrappedMinimumMarshaller", !(mm instanceof DocLitWrappedMinimalMethodMarshaller));
> > + }catch(Exception e){
> > + TestLogger.logger.debug("Exception ="+e.getMessage());
> > + fail(e.getMessage());
> > + }
> > +
> > + }
> > +
> > + private EndpointDescription getEndpointDesc(Class implementationClass) {
> > + // Use the description factory directly; this will be done within the JAX-WS runtime
> > + ServiceDescription serviceDesc =
> > + DescriptionFactory.createServiceDescription(implementationClass);
> > + assertNotNull(serviceDesc);
> > +
> > + EndpointDescription[] endpointDesc = serviceDesc.getEndpointDescriptions();
> > + assertNotNull(endpointDesc);
> > + assertEquals(1, endpointDesc.length);
> > +
> > + // TODO: How will the JAX-WS dispatcher get the appropriate port (i.e. endpoint)? Currently assumes [0]
> > + EndpointDescription testEndpointDesc = endpointDesc[0];
> > + return testEndpointDesc;
> > + }
> > +}
> >
> > Added: axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml
> > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml?rev=963508&view=auto
> > ==============================================================================
> > --- axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml (added)
> > +++ axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml Mon Jul 12 22:16:54 2010
> > @@ -0,0 +1,34 @@
> > +<?xml version="1.0" encoding="UTF-8"?>
> > +
> > +<project basedir="." default="run-wsgen-tests" name="wsgen-tests">
> > +
> > + <property name="wscache.output.base.dir" value="target/wscache" />
> > + <property name="wscache.generated.src.dir" value="${wscache.output.base.dir}/src" />
> > + <property name="wscache.generated.classes.dir" value="${wscache.output.base.dir}/classes" />
> > + <property name="compile.test.classes" value="target/test-classes" />
> > +
> > +
> > + <target name="run-wsgen-tests" depends="wrapper-beans"/>
> > +
> > +
> > + <target name="create-cache">
> > + <mkdir dir="${wscache.output.base.dir}" />
> > + <mkdir dir="${wscache.generated.src.dir}" />
> > + <mkdir dir="${wscache.generated.classes.dir}" />
> > + </target>
> > +
> > + <target name="wrapper-beans" depends="create-cache">
> > + <echo>Generating artifacts for org.apache.axis2.jaxws.wrapper.beans.AddNumbersService </echo>
> > + <wsgen
> > + sei="org.apache.axis2.jaxws.wrapper.beans.AddNumbersService"
> > + destdir="${wscache.generated.classes.dir}"
> > + resourcedestdir="${wscache.generated.src.dir}"
> > + keep="false"
> > + verbose="false"
> > + genwsdl="true">
> > + <classpath>
> > + <pathelement path="${compile.test.classes}" />
> > + </classpath>
> > + </wsgen>
> > + </target>
> > +</project>
> > \ No newline at end of file
> >
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-dev-help@axis.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org
Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws:
./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/
test/org/apache/axis2/jaxws/wrapper/ test/org/apache/axis2/jaxws/wrapper/beans/
Posted by Andreas Veithen <an...@gmail.com>.
No, you are using the antrun plugin to execute the wsgen ant task.
What I meant was to use a real Maven plugin (either the one from
java.net or the one from CXF).
-1 to commit any generated stuff into SVN.
Andreas
On Wed, Jul 14, 2010 at 21:42, Nikhil V Thaker
<ni...@us.ibm.com> wrote:
>
> Andreas - I had to add the tools.jar bit because maven plugin for wsGen gave NoClassDef Found errors for classes packaged in tools.jar.
>
> Since this is causing a problem I will just package the generated artifacts and remove the wsGen dependency.
>
> Thanks,
>
> Nikhil Thaker
> office: 919 254 9964
> nvthaker@us.ibm.com
>
>
> Andreas Veithen <an...@gmail.com>
>
> 07/14/2010 01:44 PM
>
> Please respond to
> java-dev@axis.apache.org
> To
> java-dev@axis.apache.org
> cc
> Subject
> Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws: ./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ test/org/apache/axis2/jaxws/wrapper/ test/org/apache/axis2/jaxws/wrapper/beans/
>
>
>
>
> Nikhil,
>
> I have some issues with the tools and jaxws-tools dependencies
> introduced by this change:
>
> * The change causes a build failure in Hudson. There will also be
> additional issues with tools.jar, because the way to declare this as a
> system dependency varies from one JDK to another. For example, I
> remember that on Mac OS X, it is completely different than on other
> JDKs.
>
> * I don't like the fact that jaxws-tools becomes a dependency of
> axis2-jaxws in scope compile, because it looks like this is only
> needed during the build and/or during the tests.
>
> I didn't review the change in detail, but wouldn't it be smarter to
> use one of the existing Maven plugins to do the wsgen stuff? They will
> take care of the tools.jar stuff as well.
>
> Andreas
>
> On Tue, Jul 13, 2010 at 00:16, <nt...@apache.org> wrote:
> > Author: nthaker
> > Date: Mon Jul 12 22:16:54 2010
> > New Revision: 963508
> >
> > URL: http://svn.apache.org/viewvc?rev=963508&view=rev
> > Log:
> > AXIS2-4775
> > This change ensures that we will use Request and Response wrapper Bean packaged by customer or we will Generate Wrappers if they are not packaged.
> >
> > Added:
> > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/
> > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/
> > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
> > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
> > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
> > axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml
> > Modified:
> > axis/axis2/java/core/trunk/modules/jaxws/pom.xml
> > axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
> >
> > Modified: axis/axis2/java/core/trunk/modules/jaxws/pom.xml
> > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/pom.xml?rev=963508&r1=963507&r2=963508&view=diff
> > ==============================================================================
> > --- axis/axis2/java/core/trunk/modules/jaxws/pom.xml (original)
> > +++ axis/axis2/java/core/trunk/modules/jaxws/pom.xml Mon Jul 12 22:16:54 2010
> > @@ -1,5 +1,4 @@
> > <?xml version="1.0" encoding="UTF-8"?>
> > -
> > <!-- > ~ Licensed to the Apache Software Foundation (ASF) under one
> > ~ or more contributor license agreements. See the NOTICE file
> > @@ -20,7 +19,7 @@
> > -->
> >
> > <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> > - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
> > + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
> > <modelVersion>4.0.0</modelVersion>
> > <parent>
> > <groupId>org.apache.axis2</groupId>
> > @@ -98,7 +97,25 @@
> > <version>${version}</version>
> > <scope>test</scope>
> > </dependency>
> > + <dependency>
> > + <groupId>wsdl4j</groupId>
> > + <artifactId>wsdl4j</artifactId>
> > + </dependency>
> > + <dependency>
> > + <groupId>com.sun.xml.ws</groupId>
> > + <artifactId>jaxws-tools</artifactId>
> > + <version>2.1.3</version>
> > + </dependency>
> > + <!-- If we dont include tools.jar as dependency, maven throws NoClassDefFound on wsGen run -->
> > + <dependency>
> > + <groupId>java</groupId>
> > + <artifactId>tools</artifactId>
> > + <version>$version</version>
> > + <scope>system</scope>
> > + <systemPath>${JAVA_HOME}/lib/tools.jar</systemPath>
> > + </dependency>
> > </dependencies>
> > +
> > <build>
> > <sourceDirectory>src</sourceDirectory>
> > <testSourceDirectory>test</testSourceDirectory>
> > @@ -203,34 +220,39 @@
> > <compilerVersion>1.5</compilerVersion>
> > <source>1.5</source>
> > <target>1.5</target>
> > +
> > </configuration>
> > </plugin>
> > <plugin>
> > <groupId>org.apache.maven.plugins</groupId>
> > <artifactId>maven-antrun-plugin</artifactId>
> > +
> > <executions>
> > <execution>
> > <id>gen-ts</id>
> > <phase>generate-test-sources</phase>
> > <configuration>
> > - <tasks unless="maven.test.skip">
> > + <tasks unless="maven.test.skip">
> > <!-- Theres got to be a better way to do this -->
> > <property name="schema.source.dir" value="test-resources/xsd"/>
> > <property name="wsdl.source.dir" value="test-resources/wsdl"/>
> > - <property name="schema.output.base.dir" value="target/schema"/>
> > + <property name="schema.output.base.dir" value="target/schema"/>
> > <property name="schema.generated.src.dir" value="${schema.output.base.dir}/src"/>
> > <property name="schema.generated.classes.dir"
> > value="${schema.output.base.dir}/classes"/>
> > +
> > <!-- make the dirs -->
> > <mkdir dir="${schema.output.base.dir}"/>
> > <mkdir dir="${schema.generated.src.dir}"/>
> > <mkdir dir="${schema.generated.classes.dir}"/>
> > +
> > <!-- Run JAXB schema compiler with designated schemas -->
> > <echo>Generating JAX-B classes from XSDs</echo>
> >
> > <echo>Generating java from echo.xsd</echo>
> > <java classname="com.sun.tools.xjc.Driver" fork="true">
> > <classpath refid="maven.runtime.classpath"/>
> > +
> > <classpath location="${compiled.classes.dir}"/>
> > <arg line="-d ${schema.generated.src.dir} -quiet ${schema.source.dir}/echo.xsd"/>
> > </java>
> > @@ -266,7 +288,7 @@
> > <classpath refid="maven.runtime.classpath"/>
> > <classpath location="${compiled.classes.dir}"/>
> > <arg line="-d ${schema.generated.src.dir} -quiet -wsdl ${wsdl.source.dir}/AddNumbers.wsdl"/>
> > - </java>
> > + </java>
> > </tasks>
> > </configuration>
> > <goals>
> > @@ -287,6 +309,22 @@
> > <property name="addressing_version" value="${version}"/>
> > <ant antfile="build.xml" inheritall="true" inheritrefs="true"
> > dir="." target="build-repo"/>
> > +
> > + <property name="compile_classpath" refid="maven.compile.classpath" />
> > + <property name="runtime_classpath" refid="maven.runtime.classpath" />
> > + <property name="test_classpath" refid="maven.test.classpath" />
> > + <property name="plugin_classpath" refid="maven.plugin.classpath" />
> > +
> > + <!-- Defining wsGen task -->
> > + <taskdef name="wsgen" loaderRef="refwsgen" classname="com.sun.tools.ws.ant.WsGen">
> > + <classpath>
> > + <path refid="maven.runtime.classpath" />
> > + <path refid="maven.compile.classpath" />
> > + </classpath>
> > + </taskdef>
> > + <!-- Invoking test cases that need to generate artifacts using wsGen -->
> > + <ant antfile="wsgen-tests.xml" inheritall="true" inheritrefs="true"
> > + dir="." target="run-wsgen-tests"/>
> > </tasks>
> > </configuration>
> > <goals>
> > @@ -374,6 +412,13 @@
> > <plugin>
> > <groupId>org.apache.maven.plugins</groupId>
> > <artifactId>maven-surefire-report-plugin</artifactId>
> > + <reportSets>
> > + <reportSet>
> > + <reports>
> > + <report>report-only</report>
> > + </reports>
> > + </reportSet>
> > + </reportSets>
> > </plugin>
> > </plugins>
> > </reporting>
> >
> > Modified: axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
> > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java?rev=963508&r1=963507&r2=963508&view=diff
> > ==============================================================================
> > --- axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java (original)
> > +++ axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java Mon Jul 12 22:16:54 2010
> > @@ -238,12 +238,27 @@ class ArtifactProcessor {
> > wrapperClass = newValue;
> > }
> > }
> > - if(cls==null && (type.equals("@WebFault")|| type.equals("faultInfo"))){
> > +
> > + if(cls==null &&
> > + (type.equals("@RequestWrapper")|| type.equals("@ResponseWrapper")||type.equals("@WebFault")|| type.equals("faultInfo"))){
> > +
> > + //Support for Fault Bean Generation
> > //As per JAX-WS 2.2 Specification section 3.7 an application programmer can choose not to
> > //package the faultBeans, if we have reached this point in the code then user has choosen
> > //not to package the fault bean. If there is a cache of generated artifacts available then
> > //lets look for the missing faultBean there.
> > -
> > +
> > + //Support for Wrapper Bean Generation
> > + //As per JAX-WS 2.2 Specificaiton section 3.6.2.1 pg 41 an application programmer does not use
> > + //the wrapper bean classes, so the application need not package these classes. If we have reached
> > + //this point in the code then user has choosen not to package these beans.
> > +
> > + //NOTE:If we find Generated artifacts from cache this guarantees that we will not use
> > + //DocLitWrappedMinimum marshaller code. The advantage of normal DocLitWrappedMarshaller is
> > + //that it is very robust and has support of lot more datatypes than in DocLitWrappedMinimum.
> > + if(log.isDebugEnabled()){
> > + log.debug("Adding cache to classpath");
> > + }
> > ClassFinderFactory cff =
> > (ClassFinderFactory)FactoryRegistry.getFactory(ClassFinderFactory.class);
> > ClassFinder cf = cff.getClassFinder();
> > @@ -317,11 +332,26 @@ class ArtifactProcessor {
> > if (cls2 == null) {
> > cls2 = loadClassOrNull(defaultValue, altClassLoader);
> > }
> > - if(cls2==null && (type.equals("faultInfo")|| type.equals("@WebFault"))){
> > - //As per JAX-WS 2.2 Specification section 3.7 an application programmer can choose not to
> > - //package the faultBeans, if we have reached this point in the code then user has choosen
> > - //not to package the fault bean. If there is a cache of generated artifacts available then
> > - //lets look for the missing faultBean there.
> > + if(cls2==null &&
> > + (type.equals("@RequestWrapper")|| type.equals("@ResponseWrapper")||type.equals("@WebFault")|| type.equals("faultInfo"))){
> > +
> > + //Support for Fault Bean Generation
> > + //As per JAX-WS 2.2 Specification section 3.7 an application programmer can choose not to
> > + //package the faultBeans, if we have reached this point in the code then user has choosen
> > + //not to package the fault bean. If there is a cache of generated artifacts available then
> > + //lets look for the missing faultBean there.
> > +
> > + //Support for Wrapper Bean Generation
> > + //As per JAX-WS 2.2 Specificaiton section 3.6.2.1 pg 41 an application programmer does not use
> > + //the wrapper bean classes, so the application need not package these classes. If we have reached
> > + //this point in the code then user has choosen not to package these beans.
> > +
> > + //NOTE:If we find Generated artifacts from cache this guarantees that we will not use
> > + //DocLitWrappedMinimum marshaller code. The advantage of normal DocLitWrappedMarshaller is
> > + //that it is very robust and has support of lot more datatypes than in DocLitWrappedMinimum.
> > + if(log.isDebugEnabled()){
> > + log.debug("Adding cache to classpath");
> > + }
> > if(log.isDebugEnabled()){
> > log.debug("Adding cache to classpath");
> > }
> >
> > Added: axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
> > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java?rev=963508&view=auto
> > ==============================================================================
> > --- axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java (added)
> > +++ axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java Mon Jul 12 22:16:54 2010
> > @@ -0,0 +1,18 @@
> > +
> > +package org.apache.axis2.jaxws.wrapper.beans;
> > +
> > +import javax.xml.ws.WebFault;
> > +
> > +@WebFault(name = "AddNumbersFault", targetNamespace = "http://org/test/addnumbers")
> > +public class AddNumbersException extends Exception
> > +{
> > +
> > + private String message = null;
> > + public AddNumbersException(){}
> > + public AddNumbersException(String message){
> > + this.message = message;
> > + }
> > + public String getInfo(){
> > + return message;
> > + }
> > +}
> >
> > Added: axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
> > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java?rev=963508&view=auto
> > ==============================================================================
> > --- axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java (added)
> > +++ axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java Mon Jul 12 22:16:54 2010
> > @@ -0,0 +1,15 @@
> > +package org.apache.axis2.jaxws.wrapper.beans;
> > +
> > +
> > +
> > +@javax.jws.WebService (targetNamespace="http://org/test/addnumbers", serviceName="AddNumbersService", portName="AddNumbersPort")
> > +public class AddNumbersService{
> > +
> > + public int addNumbers(int arg0, int arg1) throws AddNumbersException {
> > + if(arg0+arg1<0){
> > + throw new AddNumbersException("sum is less than 0");
> > + }
> > + return arg0+arg1;
> > + }
> > +
> > +}
> > \ No newline at end of file
> >
> > Added: axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
> > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java?rev=963508&view=auto
> > ==============================================================================
> > --- axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java (added)
> > +++ axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java Mon Jul 12 22:16:54 2010
> > @@ -0,0 +1,114 @@
> > +/**
> > + *
> > + */
> > +package org.apache.axis2.jaxws.wrapper.beans;
> > +
> > +
> > +import org.apache.axis2.jaxws.Constants;
> > +import org.apache.axis2.jaxws.description.DescriptionFactory;
> > +import org.apache.axis2.jaxws.description.EndpointDescription;
> > +import org.apache.axis2.jaxws.description.EndpointDescriptionJava;
> > +import org.apache.axis2.jaxws.description.OperationDescription;
> > +import org.apache.axis2.jaxws.description.ServiceDescription;
> > +import org.apache.axis2.jaxws.marshaller.MethodMarshaller;
> > +import org.apache.axis2.jaxws.marshaller.factory.MethodMarshallerFactory;
> > +import org.apache.axis2.jaxws.marshaller.impl.alt.DocLitWrappedMinimalMethodMarshaller;
> > +import org.apache.axis2.jaxws.unitTest.TestLogger;
> > +
> > +import java.io.File;
> > +
> > +import junit.framework.TestCase;
> > +
> > +public class WrapperBeanMarshallTests extends TestCase {
> > + /**
> > + * This is the negative test case, when we do not use generated artifacts from cache
> > + * and user did not package wrapper beans, we should see use of DocLitWrappedMinumumMarshaller.
> > + */
> > + public void testGetMarshallerOperationDescriptionBooleanNegative() {
> > + TestLogger.logger.debug("---------------------------------------");
> > + TestLogger.logger.debug("test: " + getName());
> > +
> > + String cache_location = "/target/wscache/classes";
> > + try{
> > + String baseDir = new File(System.getProperty("basedir",".")).getCanonicalPath();
> > + cache_location = new File(baseDir+cache_location).getAbsolutePath();
> > + TestLogger.logger.debug("cache location ="+cache_location);
> > +
> > + //Get EndpointDescription.
> > + //Set location on AxisConfiguraiton.
> > + Class sei = AddNumbersService.class;
> > + EndpointDescription description = getEndpointDesc(sei);
> > + TestLogger.logger.debug("description objects where created successfully");
> > + OperationDescription[] ops =description.getEndpointInterfaceDescription().getOperations();
> > + assertNotNull( "OperationDescriptions where null", ops);
> > + assertTrue("No Operation Descriptions where found", ops.length>0);
> > + OperationDescription op = ops[0];
> > + TestLogger.logger.debug("operation found, java methodName="+op.getJavaMethodName());
> > + //Don not Set cache on AxisConfiguration.
> > + //get Marshaller, verify its not DoclitWrappedMinimum.
> > + TestLogger.logger.debug("ws_cache location NOT set on AxisConfigContext, location="+cache_location);
> > + MethodMarshaller mm = MethodMarshallerFactory.getMarshaller(op, false);
> > + assertNotNull("getMarshaller returned null", mm );
> > + TestLogger.logger.debug("MethodMarshaller was created, type="+mm.getClass().getName());
> > + assertTrue("Generated artifacts not found, Method marshaller should be DocLitWrappedMinimumMarshaller", (mm instanceof DocLitWrappedMinimalMethodMarshaller));
> > + }catch(Exception e){
> > + TestLogger.logger.debug("Exception ="+e.getMessage());
> > + fail(e.getMessage());
> > + }
> > +
> > + }
> > + /**
> > + * In this test case user did not package wrapper beans but we add generated artifacts from cache, we should see use of
> > + * DocLitWrappedMarshaller.
> > + * Test method for {@link org.apache.axis2.jaxws.marshaller.factory.MethodMarshallerFactory#getMarshaller(org.apache.axis2.jaxws.description.OperationDescription, boolean)}.
> > + */
> > + public void testGetMarshallerOperationDescriptionBoolean() {
> > + TestLogger.logger.debug("---------------------------------------");
> > + TestLogger.logger.debug("test: " + getName());
> > +
> > + String cache_location = "/target/wscache/classes";
> > + try{
> > + String baseDir = new File(System.getProperty("basedir",".")).getCanonicalPath();
> > + cache_location = new File(baseDir+cache_location).getAbsolutePath();
> > + TestLogger.logger.debug("cache location ="+cache_location);
> > +
> > + //Get EndpointDescription.
> > + //Set location on AxisConfiguraiton.
> > + Class sei = AddNumbersService.class;
> > + EndpointDescription description = getEndpointDesc(sei);
> > + TestLogger.logger.debug("description objects where created successfully");
> > + OperationDescription[] ops =description.getEndpointInterfaceDescription().getOperations();
> > + assertNotNull( "OperationDescriptions where null", ops);
> > + assertTrue("No Operation Descriptions where found", ops.length>0);
> > + OperationDescription op = ops[0];
> > + TestLogger.logger.debug("operation found, java methodName="+op.getJavaMethodName());
> > + //Set cache on AxisConfiguration.
> > + //get Marshaller, verify its not DoclitWrappedMinimum.
> > + description.getServiceDescription().getAxisConfigContext().setProperty(Constants.WS_CACHE, cache_location);
> > + TestLogger.logger.debug("ws_cache location set on AxisConfigContext, location="+cache_location);
> > + MethodMarshaller mm = MethodMarshallerFactory.getMarshaller(op, false);
> > + assertNotNull("getMarshaller returned null", mm );
> > + TestLogger.logger.debug("MethodMarshaller was created, type="+mm.getClass().getName());
> > + assertTrue("Generated artifacts are in cache, Method marshaller should not be DocLitWrappedMinimumMarshaller", !(mm instanceof DocLitWrappedMinimalMethodMarshaller));
> > + }catch(Exception e){
> > + TestLogger.logger.debug("Exception ="+e.getMessage());
> > + fail(e.getMessage());
> > + }
> > +
> > + }
> > +
> > + private EndpointDescription getEndpointDesc(Class implementationClass) {
> > + // Use the description factory directly; this will be done within the JAX-WS runtime
> > + ServiceDescription serviceDesc =
> > + DescriptionFactory.createServiceDescription(implementationClass);
> > + assertNotNull(serviceDesc);
> > +
> > + EndpointDescription[] endpointDesc = serviceDesc.getEndpointDescriptions();
> > + assertNotNull(endpointDesc);
> > + assertEquals(1, endpointDesc.length);
> > +
> > + // TODO: How will the JAX-WS dispatcher get the appropriate port (i.e. endpoint)? Currently assumes [0]
> > + EndpointDescription testEndpointDesc = endpointDesc[0];
> > + return testEndpointDesc;
> > + }
> > +}
> >
> > Added: axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml
> > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml?rev=963508&view=auto
> > ==============================================================================
> > --- axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml (added)
> > +++ axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml Mon Jul 12 22:16:54 2010
> > @@ -0,0 +1,34 @@
> > +<?xml version="1.0" encoding="UTF-8"?>
> > +
> > +<project basedir="." default="run-wsgen-tests" name="wsgen-tests">
> > +
> > + <property name="wscache.output.base.dir" value="target/wscache" />
> > + <property name="wscache.generated.src.dir" value="${wscache.output.base.dir}/src" />
> > + <property name="wscache.generated.classes.dir" value="${wscache.output.base.dir}/classes" />
> > + <property name="compile.test.classes" value="target/test-classes" />
> > +
> > +
> > + <target name="run-wsgen-tests" depends="wrapper-beans"/>
> > +
> > +
> > + <target name="create-cache">
> > + <mkdir dir="${wscache.output.base.dir}" />
> > + <mkdir dir="${wscache.generated.src.dir}" />
> > + <mkdir dir="${wscache.generated.classes.dir}" />
> > + </target>
> > +
> > + <target name="wrapper-beans" depends="create-cache">
> > + <echo>Generating artifacts for org.apache.axis2.jaxws.wrapper.beans.AddNumbersService </echo>
> > + <wsgen
> > + sei="org.apache.axis2.jaxws.wrapper.beans.AddNumbersService"
> > + destdir="${wscache.generated.classes.dir}"
> > + resourcedestdir="${wscache.generated.src.dir}"
> > + keep="false"
> > + verbose="false"
> > + genwsdl="true">
> > + <classpath>
> > + <pathelement path="${compile.test.classes}" />
> > + </classpath>
> > + </wsgen>
> > + </target>
> > +</project>
> > \ No newline at end of file
> >
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-dev-help@axis.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org
Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws:
./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/
test/org/apache/axis2/jaxws/wrapper/ test/org/apache/axis2/jaxws/wrapper/beans/
Posted by Andreas Veithen <an...@gmail.com>.
No, you are using the antrun plugin to execute the wsgen ant task.
What I meant was to use a real Maven plugin (either the one from
java.net or the one from CXF).
-1 to commit any generated stuff into SVN.
Andreas
On Wed, Jul 14, 2010 at 21:42, Nikhil V Thaker
<ni...@us.ibm.com> wrote:
>
> Andreas - I had to add the tools.jar bit because maven plugin for wsGen gave NoClassDef Found errors for classes packaged in tools.jar.
>
> Since this is causing a problem I will just package the generated artifacts and remove the wsGen dependency.
>
> Thanks,
>
> Nikhil Thaker
> office: 919 254 9964
> nvthaker@us.ibm.com
>
>
> Andreas Veithen <an...@gmail.com>
>
> 07/14/2010 01:44 PM
>
> Please respond to
> java-dev@axis.apache.org
> To
> java-dev@axis.apache.org
> cc
> Subject
> Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws: ./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ test/org/apache/axis2/jaxws/wrapper/ test/org/apache/axis2/jaxws/wrapper/beans/
>
>
>
>
> Nikhil,
>
> I have some issues with the tools and jaxws-tools dependencies
> introduced by this change:
>
> * The change causes a build failure in Hudson. There will also be
> additional issues with tools.jar, because the way to declare this as a
> system dependency varies from one JDK to another. For example, I
> remember that on Mac OS X, it is completely different than on other
> JDKs.
>
> * I don't like the fact that jaxws-tools becomes a dependency of
> axis2-jaxws in scope compile, because it looks like this is only
> needed during the build and/or during the tests.
>
> I didn't review the change in detail, but wouldn't it be smarter to
> use one of the existing Maven plugins to do the wsgen stuff? They will
> take care of the tools.jar stuff as well.
>
> Andreas
>
> On Tue, Jul 13, 2010 at 00:16, <nt...@apache.org> wrote:
> > Author: nthaker
> > Date: Mon Jul 12 22:16:54 2010
> > New Revision: 963508
> >
> > URL: http://svn.apache.org/viewvc?rev=963508&view=rev
> > Log:
> > AXIS2-4775
> > This change ensures that we will use Request and Response wrapper Bean packaged by customer or we will Generate Wrappers if they are not packaged.
> >
> > Added:
> > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/
> > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/
> > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
> > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
> > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
> > axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml
> > Modified:
> > axis/axis2/java/core/trunk/modules/jaxws/pom.xml
> > axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
> >
> > Modified: axis/axis2/java/core/trunk/modules/jaxws/pom.xml
> > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/pom.xml?rev=963508&r1=963507&r2=963508&view=diff
> > ==============================================================================
> > --- axis/axis2/java/core/trunk/modules/jaxws/pom.xml (original)
> > +++ axis/axis2/java/core/trunk/modules/jaxws/pom.xml Mon Jul 12 22:16:54 2010
> > @@ -1,5 +1,4 @@
> > <?xml version="1.0" encoding="UTF-8"?>
> > -
> > <!-- > ~ Licensed to the Apache Software Foundation (ASF) under one
> > ~ or more contributor license agreements. See the NOTICE file
> > @@ -20,7 +19,7 @@
> > -->
> >
> > <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> > - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
> > + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
> > <modelVersion>4.0.0</modelVersion>
> > <parent>
> > <groupId>org.apache.axis2</groupId>
> > @@ -98,7 +97,25 @@
> > <version>${version}</version>
> > <scope>test</scope>
> > </dependency>
> > + <dependency>
> > + <groupId>wsdl4j</groupId>
> > + <artifactId>wsdl4j</artifactId>
> > + </dependency>
> > + <dependency>
> > + <groupId>com.sun.xml.ws</groupId>
> > + <artifactId>jaxws-tools</artifactId>
> > + <version>2.1.3</version>
> > + </dependency>
> > + <!-- If we dont include tools.jar as dependency, maven throws NoClassDefFound on wsGen run -->
> > + <dependency>
> > + <groupId>java</groupId>
> > + <artifactId>tools</artifactId>
> > + <version>$version</version>
> > + <scope>system</scope>
> > + <systemPath>${JAVA_HOME}/lib/tools.jar</systemPath>
> > + </dependency>
> > </dependencies>
> > +
> > <build>
> > <sourceDirectory>src</sourceDirectory>
> > <testSourceDirectory>test</testSourceDirectory>
> > @@ -203,34 +220,39 @@
> > <compilerVersion>1.5</compilerVersion>
> > <source>1.5</source>
> > <target>1.5</target>
> > +
> > </configuration>
> > </plugin>
> > <plugin>
> > <groupId>org.apache.maven.plugins</groupId>
> > <artifactId>maven-antrun-plugin</artifactId>
> > +
> > <executions>
> > <execution>
> > <id>gen-ts</id>
> > <phase>generate-test-sources</phase>
> > <configuration>
> > - <tasks unless="maven.test.skip">
> > + <tasks unless="maven.test.skip">
> > <!-- Theres got to be a better way to do this -->
> > <property name="schema.source.dir" value="test-resources/xsd"/>
> > <property name="wsdl.source.dir" value="test-resources/wsdl"/>
> > - <property name="schema.output.base.dir" value="target/schema"/>
> > + <property name="schema.output.base.dir" value="target/schema"/>
> > <property name="schema.generated.src.dir" value="${schema.output.base.dir}/src"/>
> > <property name="schema.generated.classes.dir"
> > value="${schema.output.base.dir}/classes"/>
> > +
> > <!-- make the dirs -->
> > <mkdir dir="${schema.output.base.dir}"/>
> > <mkdir dir="${schema.generated.src.dir}"/>
> > <mkdir dir="${schema.generated.classes.dir}"/>
> > +
> > <!-- Run JAXB schema compiler with designated schemas -->
> > <echo>Generating JAX-B classes from XSDs</echo>
> >
> > <echo>Generating java from echo.xsd</echo>
> > <java classname="com.sun.tools.xjc.Driver" fork="true">
> > <classpath refid="maven.runtime.classpath"/>
> > +
> > <classpath location="${compiled.classes.dir}"/>
> > <arg line="-d ${schema.generated.src.dir} -quiet ${schema.source.dir}/echo.xsd"/>
> > </java>
> > @@ -266,7 +288,7 @@
> > <classpath refid="maven.runtime.classpath"/>
> > <classpath location="${compiled.classes.dir}"/>
> > <arg line="-d ${schema.generated.src.dir} -quiet -wsdl ${wsdl.source.dir}/AddNumbers.wsdl"/>
> > - </java>
> > + </java>
> > </tasks>
> > </configuration>
> > <goals>
> > @@ -287,6 +309,22 @@
> > <property name="addressing_version" value="${version}"/>
> > <ant antfile="build.xml" inheritall="true" inheritrefs="true"
> > dir="." target="build-repo"/>
> > +
> > + <property name="compile_classpath" refid="maven.compile.classpath" />
> > + <property name="runtime_classpath" refid="maven.runtime.classpath" />
> > + <property name="test_classpath" refid="maven.test.classpath" />
> > + <property name="plugin_classpath" refid="maven.plugin.classpath" />
> > +
> > + <!-- Defining wsGen task -->
> > + <taskdef name="wsgen" loaderRef="refwsgen" classname="com.sun.tools.ws.ant.WsGen">
> > + <classpath>
> > + <path refid="maven.runtime.classpath" />
> > + <path refid="maven.compile.classpath" />
> > + </classpath>
> > + </taskdef>
> > + <!-- Invoking test cases that need to generate artifacts using wsGen -->
> > + <ant antfile="wsgen-tests.xml" inheritall="true" inheritrefs="true"
> > + dir="." target="run-wsgen-tests"/>
> > </tasks>
> > </configuration>
> > <goals>
> > @@ -374,6 +412,13 @@
> > <plugin>
> > <groupId>org.apache.maven.plugins</groupId>
> > <artifactId>maven-surefire-report-plugin</artifactId>
> > + <reportSets>
> > + <reportSet>
> > + <reports>
> > + <report>report-only</report>
> > + </reports>
> > + </reportSet>
> > + </reportSets>
> > </plugin>
> > </plugins>
> > </reporting>
> >
> > Modified: axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
> > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java?rev=963508&r1=963507&r2=963508&view=diff
> > ==============================================================================
> > --- axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java (original)
> > +++ axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java Mon Jul 12 22:16:54 2010
> > @@ -238,12 +238,27 @@ class ArtifactProcessor {
> > wrapperClass = newValue;
> > }
> > }
> > - if(cls==null && (type.equals("@WebFault")|| type.equals("faultInfo"))){
> > +
> > + if(cls==null &&
> > + (type.equals("@RequestWrapper")|| type.equals("@ResponseWrapper")||type.equals("@WebFault")|| type.equals("faultInfo"))){
> > +
> > + //Support for Fault Bean Generation
> > //As per JAX-WS 2.2 Specification section 3.7 an application programmer can choose not to
> > //package the faultBeans, if we have reached this point in the code then user has choosen
> > //not to package the fault bean. If there is a cache of generated artifacts available then
> > //lets look for the missing faultBean there.
> > -
> > +
> > + //Support for Wrapper Bean Generation
> > + //As per JAX-WS 2.2 Specificaiton section 3.6.2.1 pg 41 an application programmer does not use
> > + //the wrapper bean classes, so the application need not package these classes. If we have reached
> > + //this point in the code then user has choosen not to package these beans.
> > +
> > + //NOTE:If we find Generated artifacts from cache this guarantees that we will not use
> > + //DocLitWrappedMinimum marshaller code. The advantage of normal DocLitWrappedMarshaller is
> > + //that it is very robust and has support of lot more datatypes than in DocLitWrappedMinimum.
> > + if(log.isDebugEnabled()){
> > + log.debug("Adding cache to classpath");
> > + }
> > ClassFinderFactory cff =
> > (ClassFinderFactory)FactoryRegistry.getFactory(ClassFinderFactory.class);
> > ClassFinder cf = cff.getClassFinder();
> > @@ -317,11 +332,26 @@ class ArtifactProcessor {
> > if (cls2 == null) {
> > cls2 = loadClassOrNull(defaultValue, altClassLoader);
> > }
> > - if(cls2==null && (type.equals("faultInfo")|| type.equals("@WebFault"))){
> > - //As per JAX-WS 2.2 Specification section 3.7 an application programmer can choose not to
> > - //package the faultBeans, if we have reached this point in the code then user has choosen
> > - //not to package the fault bean. If there is a cache of generated artifacts available then
> > - //lets look for the missing faultBean there.
> > + if(cls2==null &&
> > + (type.equals("@RequestWrapper")|| type.equals("@ResponseWrapper")||type.equals("@WebFault")|| type.equals("faultInfo"))){
> > +
> > + //Support for Fault Bean Generation
> > + //As per JAX-WS 2.2 Specification section 3.7 an application programmer can choose not to
> > + //package the faultBeans, if we have reached this point in the code then user has choosen
> > + //not to package the fault bean. If there is a cache of generated artifacts available then
> > + //lets look for the missing faultBean there.
> > +
> > + //Support for Wrapper Bean Generation
> > + //As per JAX-WS 2.2 Specificaiton section 3.6.2.1 pg 41 an application programmer does not use
> > + //the wrapper bean classes, so the application need not package these classes. If we have reached
> > + //this point in the code then user has choosen not to package these beans.
> > +
> > + //NOTE:If we find Generated artifacts from cache this guarantees that we will not use
> > + //DocLitWrappedMinimum marshaller code. The advantage of normal DocLitWrappedMarshaller is
> > + //that it is very robust and has support of lot more datatypes than in DocLitWrappedMinimum.
> > + if(log.isDebugEnabled()){
> > + log.debug("Adding cache to classpath");
> > + }
> > if(log.isDebugEnabled()){
> > log.debug("Adding cache to classpath");
> > }
> >
> > Added: axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
> > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java?rev=963508&view=auto
> > ==============================================================================
> > --- axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java (added)
> > +++ axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java Mon Jul 12 22:16:54 2010
> > @@ -0,0 +1,18 @@
> > +
> > +package org.apache.axis2.jaxws.wrapper.beans;
> > +
> > +import javax.xml.ws.WebFault;
> > +
> > +@WebFault(name = "AddNumbersFault", targetNamespace = "http://org/test/addnumbers")
> > +public class AddNumbersException extends Exception
> > +{
> > +
> > + private String message = null;
> > + public AddNumbersException(){}
> > + public AddNumbersException(String message){
> > + this.message = message;
> > + }
> > + public String getInfo(){
> > + return message;
> > + }
> > +}
> >
> > Added: axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
> > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java?rev=963508&view=auto
> > ==============================================================================
> > --- axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java (added)
> > +++ axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java Mon Jul 12 22:16:54 2010
> > @@ -0,0 +1,15 @@
> > +package org.apache.axis2.jaxws.wrapper.beans;
> > +
> > +
> > +
> > +@javax.jws.WebService (targetNamespace="http://org/test/addnumbers", serviceName="AddNumbersService", portName="AddNumbersPort")
> > +public class AddNumbersService{
> > +
> > + public int addNumbers(int arg0, int arg1) throws AddNumbersException {
> > + if(arg0+arg1<0){
> > + throw new AddNumbersException("sum is less than 0");
> > + }
> > + return arg0+arg1;
> > + }
> > +
> > +}
> > \ No newline at end of file
> >
> > Added: axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
> > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java?rev=963508&view=auto
> > ==============================================================================
> > --- axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java (added)
> > +++ axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java Mon Jul 12 22:16:54 2010
> > @@ -0,0 +1,114 @@
> > +/**
> > + *
> > + */
> > +package org.apache.axis2.jaxws.wrapper.beans;
> > +
> > +
> > +import org.apache.axis2.jaxws.Constants;
> > +import org.apache.axis2.jaxws.description.DescriptionFactory;
> > +import org.apache.axis2.jaxws.description.EndpointDescription;
> > +import org.apache.axis2.jaxws.description.EndpointDescriptionJava;
> > +import org.apache.axis2.jaxws.description.OperationDescription;
> > +import org.apache.axis2.jaxws.description.ServiceDescription;
> > +import org.apache.axis2.jaxws.marshaller.MethodMarshaller;
> > +import org.apache.axis2.jaxws.marshaller.factory.MethodMarshallerFactory;
> > +import org.apache.axis2.jaxws.marshaller.impl.alt.DocLitWrappedMinimalMethodMarshaller;
> > +import org.apache.axis2.jaxws.unitTest.TestLogger;
> > +
> > +import java.io.File;
> > +
> > +import junit.framework.TestCase;
> > +
> > +public class WrapperBeanMarshallTests extends TestCase {
> > + /**
> > + * This is the negative test case, when we do not use generated artifacts from cache
> > + * and user did not package wrapper beans, we should see use of DocLitWrappedMinumumMarshaller.
> > + */
> > + public void testGetMarshallerOperationDescriptionBooleanNegative() {
> > + TestLogger.logger.debug("---------------------------------------");
> > + TestLogger.logger.debug("test: " + getName());
> > +
> > + String cache_location = "/target/wscache/classes";
> > + try{
> > + String baseDir = new File(System.getProperty("basedir",".")).getCanonicalPath();
> > + cache_location = new File(baseDir+cache_location).getAbsolutePath();
> > + TestLogger.logger.debug("cache location ="+cache_location);
> > +
> > + //Get EndpointDescription.
> > + //Set location on AxisConfiguraiton.
> > + Class sei = AddNumbersService.class;
> > + EndpointDescription description = getEndpointDesc(sei);
> > + TestLogger.logger.debug("description objects where created successfully");
> > + OperationDescription[] ops =description.getEndpointInterfaceDescription().getOperations();
> > + assertNotNull( "OperationDescriptions where null", ops);
> > + assertTrue("No Operation Descriptions where found", ops.length>0);
> > + OperationDescription op = ops[0];
> > + TestLogger.logger.debug("operation found, java methodName="+op.getJavaMethodName());
> > + //Don not Set cache on AxisConfiguration.
> > + //get Marshaller, verify its not DoclitWrappedMinimum.
> > + TestLogger.logger.debug("ws_cache location NOT set on AxisConfigContext, location="+cache_location);
> > + MethodMarshaller mm = MethodMarshallerFactory.getMarshaller(op, false);
> > + assertNotNull("getMarshaller returned null", mm );
> > + TestLogger.logger.debug("MethodMarshaller was created, type="+mm.getClass().getName());
> > + assertTrue("Generated artifacts not found, Method marshaller should be DocLitWrappedMinimumMarshaller", (mm instanceof DocLitWrappedMinimalMethodMarshaller));
> > + }catch(Exception e){
> > + TestLogger.logger.debug("Exception ="+e.getMessage());
> > + fail(e.getMessage());
> > + }
> > +
> > + }
> > + /**
> > + * In this test case user did not package wrapper beans but we add generated artifacts from cache, we should see use of
> > + * DocLitWrappedMarshaller.
> > + * Test method for {@link org.apache.axis2.jaxws.marshaller.factory.MethodMarshallerFactory#getMarshaller(org.apache.axis2.jaxws.description.OperationDescription, boolean)}.
> > + */
> > + public void testGetMarshallerOperationDescriptionBoolean() {
> > + TestLogger.logger.debug("---------------------------------------");
> > + TestLogger.logger.debug("test: " + getName());
> > +
> > + String cache_location = "/target/wscache/classes";
> > + try{
> > + String baseDir = new File(System.getProperty("basedir",".")).getCanonicalPath();
> > + cache_location = new File(baseDir+cache_location).getAbsolutePath();
> > + TestLogger.logger.debug("cache location ="+cache_location);
> > +
> > + //Get EndpointDescription.
> > + //Set location on AxisConfiguraiton.
> > + Class sei = AddNumbersService.class;
> > + EndpointDescription description = getEndpointDesc(sei);
> > + TestLogger.logger.debug("description objects where created successfully");
> > + OperationDescription[] ops =description.getEndpointInterfaceDescription().getOperations();
> > + assertNotNull( "OperationDescriptions where null", ops);
> > + assertTrue("No Operation Descriptions where found", ops.length>0);
> > + OperationDescription op = ops[0];
> > + TestLogger.logger.debug("operation found, java methodName="+op.getJavaMethodName());
> > + //Set cache on AxisConfiguration.
> > + //get Marshaller, verify its not DoclitWrappedMinimum.
> > + description.getServiceDescription().getAxisConfigContext().setProperty(Constants.WS_CACHE, cache_location);
> > + TestLogger.logger.debug("ws_cache location set on AxisConfigContext, location="+cache_location);
> > + MethodMarshaller mm = MethodMarshallerFactory.getMarshaller(op, false);
> > + assertNotNull("getMarshaller returned null", mm );
> > + TestLogger.logger.debug("MethodMarshaller was created, type="+mm.getClass().getName());
> > + assertTrue("Generated artifacts are in cache, Method marshaller should not be DocLitWrappedMinimumMarshaller", !(mm instanceof DocLitWrappedMinimalMethodMarshaller));
> > + }catch(Exception e){
> > + TestLogger.logger.debug("Exception ="+e.getMessage());
> > + fail(e.getMessage());
> > + }
> > +
> > + }
> > +
> > + private EndpointDescription getEndpointDesc(Class implementationClass) {
> > + // Use the description factory directly; this will be done within the JAX-WS runtime
> > + ServiceDescription serviceDesc =
> > + DescriptionFactory.createServiceDescription(implementationClass);
> > + assertNotNull(serviceDesc);
> > +
> > + EndpointDescription[] endpointDesc = serviceDesc.getEndpointDescriptions();
> > + assertNotNull(endpointDesc);
> > + assertEquals(1, endpointDesc.length);
> > +
> > + // TODO: How will the JAX-WS dispatcher get the appropriate port (i.e. endpoint)? Currently assumes [0]
> > + EndpointDescription testEndpointDesc = endpointDesc[0];
> > + return testEndpointDesc;
> > + }
> > +}
> >
> > Added: axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml
> > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml?rev=963508&view=auto
> > ==============================================================================
> > --- axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml (added)
> > +++ axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml Mon Jul 12 22:16:54 2010
> > @@ -0,0 +1,34 @@
> > +<?xml version="1.0" encoding="UTF-8"?>
> > +
> > +<project basedir="." default="run-wsgen-tests" name="wsgen-tests">
> > +
> > + <property name="wscache.output.base.dir" value="target/wscache" />
> > + <property name="wscache.generated.src.dir" value="${wscache.output.base.dir}/src" />
> > + <property name="wscache.generated.classes.dir" value="${wscache.output.base.dir}/classes" />
> > + <property name="compile.test.classes" value="target/test-classes" />
> > +
> > +
> > + <target name="run-wsgen-tests" depends="wrapper-beans"/>
> > +
> > +
> > + <target name="create-cache">
> > + <mkdir dir="${wscache.output.base.dir}" />
> > + <mkdir dir="${wscache.generated.src.dir}" />
> > + <mkdir dir="${wscache.generated.classes.dir}" />
> > + </target>
> > +
> > + <target name="wrapper-beans" depends="create-cache">
> > + <echo>Generating artifacts for org.apache.axis2.jaxws.wrapper.beans.AddNumbersService </echo>
> > + <wsgen
> > + sei="org.apache.axis2.jaxws.wrapper.beans.AddNumbersService"
> > + destdir="${wscache.generated.classes.dir}"
> > + resourcedestdir="${wscache.generated.src.dir}"
> > + keep="false"
> > + verbose="false"
> > + genwsdl="true">
> > + <classpath>
> > + <pathelement path="${compile.test.classes}" />
> > + </classpath>
> > + </wsgen>
> > + </target>
> > +</project>
> > \ No newline at end of file
> >
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-dev-help@axis.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org
Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws:
./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/
test/org/apache/axis2/jaxws/wrapper/ test/org/apache/axis2/jaxws/wrapper/beans/
Posted by Andreas Veithen <an...@gmail.com>.
No, you are using the antrun plugin to execute the wsgen ant task.
What I meant was to use a real Maven plugin (either the one from
java.net or the one from CXF).
-1 to commit any generated stuff into SVN.
Andreas
On Wed, Jul 14, 2010 at 21:42, Nikhil V Thaker
<ni...@us.ibm.com> wrote:
>
> Andreas - I had to add the tools.jar bit because maven plugin for wsGen gave NoClassDef Found errors for classes packaged in tools.jar.
>
> Since this is causing a problem I will just package the generated artifacts and remove the wsGen dependency.
>
> Thanks,
>
> Nikhil Thaker
> office: 919 254 9964
> nvthaker@us.ibm.com
>
>
> Andreas Veithen <an...@gmail.com>
>
> 07/14/2010 01:44 PM
>
> Please respond to
> java-dev@axis.apache.org
> To
> java-dev@axis.apache.org
> cc
> Subject
> Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws: ./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ test/org/apache/axis2/jaxws/wrapper/ test/org/apache/axis2/jaxws/wrapper/beans/
>
>
>
>
> Nikhil,
>
> I have some issues with the tools and jaxws-tools dependencies
> introduced by this change:
>
> * The change causes a build failure in Hudson. There will also be
> additional issues with tools.jar, because the way to declare this as a
> system dependency varies from one JDK to another. For example, I
> remember that on Mac OS X, it is completely different than on other
> JDKs.
>
> * I don't like the fact that jaxws-tools becomes a dependency of
> axis2-jaxws in scope compile, because it looks like this is only
> needed during the build and/or during the tests.
>
> I didn't review the change in detail, but wouldn't it be smarter to
> use one of the existing Maven plugins to do the wsgen stuff? They will
> take care of the tools.jar stuff as well.
>
> Andreas
>
> On Tue, Jul 13, 2010 at 00:16, <nt...@apache.org> wrote:
> > Author: nthaker
> > Date: Mon Jul 12 22:16:54 2010
> > New Revision: 963508
> >
> > URL: http://svn.apache.org/viewvc?rev=963508&view=rev
> > Log:
> > AXIS2-4775
> > This change ensures that we will use Request and Response wrapper Bean packaged by customer or we will Generate Wrappers if they are not packaged.
> >
> > Added:
> > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/
> > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/
> > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
> > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
> > axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
> > axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml
> > Modified:
> > axis/axis2/java/core/trunk/modules/jaxws/pom.xml
> > axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
> >
> > Modified: axis/axis2/java/core/trunk/modules/jaxws/pom.xml
> > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/pom.xml?rev=963508&r1=963507&r2=963508&view=diff
> > ==============================================================================
> > --- axis/axis2/java/core/trunk/modules/jaxws/pom.xml (original)
> > +++ axis/axis2/java/core/trunk/modules/jaxws/pom.xml Mon Jul 12 22:16:54 2010
> > @@ -1,5 +1,4 @@
> > <?xml version="1.0" encoding="UTF-8"?>
> > -
> > <!-- > ~ Licensed to the Apache Software Foundation (ASF) under one
> > ~ or more contributor license agreements. See the NOTICE file
> > @@ -20,7 +19,7 @@
> > -->
> >
> > <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> > - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
> > + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
> > <modelVersion>4.0.0</modelVersion>
> > <parent>
> > <groupId>org.apache.axis2</groupId>
> > @@ -98,7 +97,25 @@
> > <version>${version}</version>
> > <scope>test</scope>
> > </dependency>
> > + <dependency>
> > + <groupId>wsdl4j</groupId>
> > + <artifactId>wsdl4j</artifactId>
> > + </dependency>
> > + <dependency>
> > + <groupId>com.sun.xml.ws</groupId>
> > + <artifactId>jaxws-tools</artifactId>
> > + <version>2.1.3</version>
> > + </dependency>
> > + <!-- If we dont include tools.jar as dependency, maven throws NoClassDefFound on wsGen run -->
> > + <dependency>
> > + <groupId>java</groupId>
> > + <artifactId>tools</artifactId>
> > + <version>$version</version>
> > + <scope>system</scope>
> > + <systemPath>${JAVA_HOME}/lib/tools.jar</systemPath>
> > + </dependency>
> > </dependencies>
> > +
> > <build>
> > <sourceDirectory>src</sourceDirectory>
> > <testSourceDirectory>test</testSourceDirectory>
> > @@ -203,34 +220,39 @@
> > <compilerVersion>1.5</compilerVersion>
> > <source>1.5</source>
> > <target>1.5</target>
> > +
> > </configuration>
> > </plugin>
> > <plugin>
> > <groupId>org.apache.maven.plugins</groupId>
> > <artifactId>maven-antrun-plugin</artifactId>
> > +
> > <executions>
> > <execution>
> > <id>gen-ts</id>
> > <phase>generate-test-sources</phase>
> > <configuration>
> > - <tasks unless="maven.test.skip">
> > + <tasks unless="maven.test.skip">
> > <!-- Theres got to be a better way to do this -->
> > <property name="schema.source.dir" value="test-resources/xsd"/>
> > <property name="wsdl.source.dir" value="test-resources/wsdl"/>
> > - <property name="schema.output.base.dir" value="target/schema"/>
> > + <property name="schema.output.base.dir" value="target/schema"/>
> > <property name="schema.generated.src.dir" value="${schema.output.base.dir}/src"/>
> > <property name="schema.generated.classes.dir"
> > value="${schema.output.base.dir}/classes"/>
> > +
> > <!-- make the dirs -->
> > <mkdir dir="${schema.output.base.dir}"/>
> > <mkdir dir="${schema.generated.src.dir}"/>
> > <mkdir dir="${schema.generated.classes.dir}"/>
> > +
> > <!-- Run JAXB schema compiler with designated schemas -->
> > <echo>Generating JAX-B classes from XSDs</echo>
> >
> > <echo>Generating java from echo.xsd</echo>
> > <java classname="com.sun.tools.xjc.Driver" fork="true">
> > <classpath refid="maven.runtime.classpath"/>
> > +
> > <classpath location="${compiled.classes.dir}"/>
> > <arg line="-d ${schema.generated.src.dir} -quiet ${schema.source.dir}/echo.xsd"/>
> > </java>
> > @@ -266,7 +288,7 @@
> > <classpath refid="maven.runtime.classpath"/>
> > <classpath location="${compiled.classes.dir}"/>
> > <arg line="-d ${schema.generated.src.dir} -quiet -wsdl ${wsdl.source.dir}/AddNumbers.wsdl"/>
> > - </java>
> > + </java>
> > </tasks>
> > </configuration>
> > <goals>
> > @@ -287,6 +309,22 @@
> > <property name="addressing_version" value="${version}"/>
> > <ant antfile="build.xml" inheritall="true" inheritrefs="true"
> > dir="." target="build-repo"/>
> > +
> > + <property name="compile_classpath" refid="maven.compile.classpath" />
> > + <property name="runtime_classpath" refid="maven.runtime.classpath" />
> > + <property name="test_classpath" refid="maven.test.classpath" />
> > + <property name="plugin_classpath" refid="maven.plugin.classpath" />
> > +
> > + <!-- Defining wsGen task -->
> > + <taskdef name="wsgen" loaderRef="refwsgen" classname="com.sun.tools.ws.ant.WsGen">
> > + <classpath>
> > + <path refid="maven.runtime.classpath" />
> > + <path refid="maven.compile.classpath" />
> > + </classpath>
> > + </taskdef>
> > + <!-- Invoking test cases that need to generate artifacts using wsGen -->
> > + <ant antfile="wsgen-tests.xml" inheritall="true" inheritrefs="true"
> > + dir="." target="run-wsgen-tests"/>
> > </tasks>
> > </configuration>
> > <goals>
> > @@ -374,6 +412,13 @@
> > <plugin>
> > <groupId>org.apache.maven.plugins</groupId>
> > <artifactId>maven-surefire-report-plugin</artifactId>
> > + <reportSets>
> > + <reportSet>
> > + <reports>
> > + <report>report-only</report>
> > + </reports>
> > + </reportSet>
> > + </reportSets>
> > </plugin>
> > </plugins>
> > </reporting>
> >
> > Modified: axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
> > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java?rev=963508&r1=963507&r2=963508&view=diff
> > ==============================================================================
> > --- axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java (original)
> > +++ axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java Mon Jul 12 22:16:54 2010
> > @@ -238,12 +238,27 @@ class ArtifactProcessor {
> > wrapperClass = newValue;
> > }
> > }
> > - if(cls==null && (type.equals("@WebFault")|| type.equals("faultInfo"))){
> > +
> > + if(cls==null &&
> > + (type.equals("@RequestWrapper")|| type.equals("@ResponseWrapper")||type.equals("@WebFault")|| type.equals("faultInfo"))){
> > +
> > + //Support for Fault Bean Generation
> > //As per JAX-WS 2.2 Specification section 3.7 an application programmer can choose not to
> > //package the faultBeans, if we have reached this point in the code then user has choosen
> > //not to package the fault bean. If there is a cache of generated artifacts available then
> > //lets look for the missing faultBean there.
> > -
> > +
> > + //Support for Wrapper Bean Generation
> > + //As per JAX-WS 2.2 Specificaiton section 3.6.2.1 pg 41 an application programmer does not use
> > + //the wrapper bean classes, so the application need not package these classes. If we have reached
> > + //this point in the code then user has choosen not to package these beans.
> > +
> > + //NOTE:If we find Generated artifacts from cache this guarantees that we will not use
> > + //DocLitWrappedMinimum marshaller code. The advantage of normal DocLitWrappedMarshaller is
> > + //that it is very robust and has support of lot more datatypes than in DocLitWrappedMinimum.
> > + if(log.isDebugEnabled()){
> > + log.debug("Adding cache to classpath");
> > + }
> > ClassFinderFactory cff =
> > (ClassFinderFactory)FactoryRegistry.getFactory(ClassFinderFactory.class);
> > ClassFinder cf = cff.getClassFinder();
> > @@ -317,11 +332,26 @@ class ArtifactProcessor {
> > if (cls2 == null) {
> > cls2 = loadClassOrNull(defaultValue, altClassLoader);
> > }
> > - if(cls2==null && (type.equals("faultInfo")|| type.equals("@WebFault"))){
> > - //As per JAX-WS 2.2 Specification section 3.7 an application programmer can choose not to
> > - //package the faultBeans, if we have reached this point in the code then user has choosen
> > - //not to package the fault bean. If there is a cache of generated artifacts available then
> > - //lets look for the missing faultBean there.
> > + if(cls2==null &&
> > + (type.equals("@RequestWrapper")|| type.equals("@ResponseWrapper")||type.equals("@WebFault")|| type.equals("faultInfo"))){
> > +
> > + //Support for Fault Bean Generation
> > + //As per JAX-WS 2.2 Specification section 3.7 an application programmer can choose not to
> > + //package the faultBeans, if we have reached this point in the code then user has choosen
> > + //not to package the fault bean. If there is a cache of generated artifacts available then
> > + //lets look for the missing faultBean there.
> > +
> > + //Support for Wrapper Bean Generation
> > + //As per JAX-WS 2.2 Specificaiton section 3.6.2.1 pg 41 an application programmer does not use
> > + //the wrapper bean classes, so the application need not package these classes. If we have reached
> > + //this point in the code then user has choosen not to package these beans.
> > +
> > + //NOTE:If we find Generated artifacts from cache this guarantees that we will not use
> > + //DocLitWrappedMinimum marshaller code. The advantage of normal DocLitWrappedMarshaller is
> > + //that it is very robust and has support of lot more datatypes than in DocLitWrappedMinimum.
> > + if(log.isDebugEnabled()){
> > + log.debug("Adding cache to classpath");
> > + }
> > if(log.isDebugEnabled()){
> > log.debug("Adding cache to classpath");
> > }
> >
> > Added: axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
> > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java?rev=963508&view=auto
> > ==============================================================================
> > --- axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java (added)
> > +++ axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java Mon Jul 12 22:16:54 2010
> > @@ -0,0 +1,18 @@
> > +
> > +package org.apache.axis2.jaxws.wrapper.beans;
> > +
> > +import javax.xml.ws.WebFault;
> > +
> > +@WebFault(name = "AddNumbersFault", targetNamespace = "http://org/test/addnumbers")
> > +public class AddNumbersException extends Exception
> > +{
> > +
> > + private String message = null;
> > + public AddNumbersException(){}
> > + public AddNumbersException(String message){
> > + this.message = message;
> > + }
> > + public String getInfo(){
> > + return message;
> > + }
> > +}
> >
> > Added: axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
> > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java?rev=963508&view=auto
> > ==============================================================================
> > --- axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java (added)
> > +++ axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java Mon Jul 12 22:16:54 2010
> > @@ -0,0 +1,15 @@
> > +package org.apache.axis2.jaxws.wrapper.beans;
> > +
> > +
> > +
> > +@javax.jws.WebService (targetNamespace="http://org/test/addnumbers", serviceName="AddNumbersService", portName="AddNumbersPort")
> > +public class AddNumbersService{
> > +
> > + public int addNumbers(int arg0, int arg1) throws AddNumbersException {
> > + if(arg0+arg1<0){
> > + throw new AddNumbersException("sum is less than 0");
> > + }
> > + return arg0+arg1;
> > + }
> > +
> > +}
> > \ No newline at end of file
> >
> > Added: axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
> > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java?rev=963508&view=auto
> > ==============================================================================
> > --- axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java (added)
> > +++ axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java Mon Jul 12 22:16:54 2010
> > @@ -0,0 +1,114 @@
> > +/**
> > + *
> > + */
> > +package org.apache.axis2.jaxws.wrapper.beans;
> > +
> > +
> > +import org.apache.axis2.jaxws.Constants;
> > +import org.apache.axis2.jaxws.description.DescriptionFactory;
> > +import org.apache.axis2.jaxws.description.EndpointDescription;
> > +import org.apache.axis2.jaxws.description.EndpointDescriptionJava;
> > +import org.apache.axis2.jaxws.description.OperationDescription;
> > +import org.apache.axis2.jaxws.description.ServiceDescription;
> > +import org.apache.axis2.jaxws.marshaller.MethodMarshaller;
> > +import org.apache.axis2.jaxws.marshaller.factory.MethodMarshallerFactory;
> > +import org.apache.axis2.jaxws.marshaller.impl.alt.DocLitWrappedMinimalMethodMarshaller;
> > +import org.apache.axis2.jaxws.unitTest.TestLogger;
> > +
> > +import java.io.File;
> > +
> > +import junit.framework.TestCase;
> > +
> > +public class WrapperBeanMarshallTests extends TestCase {
> > + /**
> > + * This is the negative test case, when we do not use generated artifacts from cache
> > + * and user did not package wrapper beans, we should see use of DocLitWrappedMinumumMarshaller.
> > + */
> > + public void testGetMarshallerOperationDescriptionBooleanNegative() {
> > + TestLogger.logger.debug("---------------------------------------");
> > + TestLogger.logger.debug("test: " + getName());
> > +
> > + String cache_location = "/target/wscache/classes";
> > + try{
> > + String baseDir = new File(System.getProperty("basedir",".")).getCanonicalPath();
> > + cache_location = new File(baseDir+cache_location).getAbsolutePath();
> > + TestLogger.logger.debug("cache location ="+cache_location);
> > +
> > + //Get EndpointDescription.
> > + //Set location on AxisConfiguraiton.
> > + Class sei = AddNumbersService.class;
> > + EndpointDescription description = getEndpointDesc(sei);
> > + TestLogger.logger.debug("description objects where created successfully");
> > + OperationDescription[] ops =description.getEndpointInterfaceDescription().getOperations();
> > + assertNotNull( "OperationDescriptions where null", ops);
> > + assertTrue("No Operation Descriptions where found", ops.length>0);
> > + OperationDescription op = ops[0];
> > + TestLogger.logger.debug("operation found, java methodName="+op.getJavaMethodName());
> > + //Don not Set cache on AxisConfiguration.
> > + //get Marshaller, verify its not DoclitWrappedMinimum.
> > + TestLogger.logger.debug("ws_cache location NOT set on AxisConfigContext, location="+cache_location);
> > + MethodMarshaller mm = MethodMarshallerFactory.getMarshaller(op, false);
> > + assertNotNull("getMarshaller returned null", mm );
> > + TestLogger.logger.debug("MethodMarshaller was created, type="+mm.getClass().getName());
> > + assertTrue("Generated artifacts not found, Method marshaller should be DocLitWrappedMinimumMarshaller", (mm instanceof DocLitWrappedMinimalMethodMarshaller));
> > + }catch(Exception e){
> > + TestLogger.logger.debug("Exception ="+e.getMessage());
> > + fail(e.getMessage());
> > + }
> > +
> > + }
> > + /**
> > + * In this test case user did not package wrapper beans but we add generated artifacts from cache, we should see use of
> > + * DocLitWrappedMarshaller.
> > + * Test method for {@link org.apache.axis2.jaxws.marshaller.factory.MethodMarshallerFactory#getMarshaller(org.apache.axis2.jaxws.description.OperationDescription, boolean)}.
> > + */
> > + public void testGetMarshallerOperationDescriptionBoolean() {
> > + TestLogger.logger.debug("---------------------------------------");
> > + TestLogger.logger.debug("test: " + getName());
> > +
> > + String cache_location = "/target/wscache/classes";
> > + try{
> > + String baseDir = new File(System.getProperty("basedir",".")).getCanonicalPath();
> > + cache_location = new File(baseDir+cache_location).getAbsolutePath();
> > + TestLogger.logger.debug("cache location ="+cache_location);
> > +
> > + //Get EndpointDescription.
> > + //Set location on AxisConfiguraiton.
> > + Class sei = AddNumbersService.class;
> > + EndpointDescription description = getEndpointDesc(sei);
> > + TestLogger.logger.debug("description objects where created successfully");
> > + OperationDescription[] ops =description.getEndpointInterfaceDescription().getOperations();
> > + assertNotNull( "OperationDescriptions where null", ops);
> > + assertTrue("No Operation Descriptions where found", ops.length>0);
> > + OperationDescription op = ops[0];
> > + TestLogger.logger.debug("operation found, java methodName="+op.getJavaMethodName());
> > + //Set cache on AxisConfiguration.
> > + //get Marshaller, verify its not DoclitWrappedMinimum.
> > + description.getServiceDescription().getAxisConfigContext().setProperty(Constants.WS_CACHE, cache_location);
> > + TestLogger.logger.debug("ws_cache location set on AxisConfigContext, location="+cache_location);
> > + MethodMarshaller mm = MethodMarshallerFactory.getMarshaller(op, false);
> > + assertNotNull("getMarshaller returned null", mm );
> > + TestLogger.logger.debug("MethodMarshaller was created, type="+mm.getClass().getName());
> > + assertTrue("Generated artifacts are in cache, Method marshaller should not be DocLitWrappedMinimumMarshaller", !(mm instanceof DocLitWrappedMinimalMethodMarshaller));
> > + }catch(Exception e){
> > + TestLogger.logger.debug("Exception ="+e.getMessage());
> > + fail(e.getMessage());
> > + }
> > +
> > + }
> > +
> > + private EndpointDescription getEndpointDesc(Class implementationClass) {
> > + // Use the description factory directly; this will be done within the JAX-WS runtime
> > + ServiceDescription serviceDesc =
> > + DescriptionFactory.createServiceDescription(implementationClass);
> > + assertNotNull(serviceDesc);
> > +
> > + EndpointDescription[] endpointDesc = serviceDesc.getEndpointDescriptions();
> > + assertNotNull(endpointDesc);
> > + assertEquals(1, endpointDesc.length);
> > +
> > + // TODO: How will the JAX-WS dispatcher get the appropriate port (i.e. endpoint)? Currently assumes [0]
> > + EndpointDescription testEndpointDesc = endpointDesc[0];
> > + return testEndpointDesc;
> > + }
> > +}
> >
> > Added: axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml
> > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml?rev=963508&view=auto
> > ==============================================================================
> > --- axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml (added)
> > +++ axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml Mon Jul 12 22:16:54 2010
> > @@ -0,0 +1,34 @@
> > +<?xml version="1.0" encoding="UTF-8"?>
> > +
> > +<project basedir="." default="run-wsgen-tests" name="wsgen-tests">
> > +
> > + <property name="wscache.output.base.dir" value="target/wscache" />
> > + <property name="wscache.generated.src.dir" value="${wscache.output.base.dir}/src" />
> > + <property name="wscache.generated.classes.dir" value="${wscache.output.base.dir}/classes" />
> > + <property name="compile.test.classes" value="target/test-classes" />
> > +
> > +
> > + <target name="run-wsgen-tests" depends="wrapper-beans"/>
> > +
> > +
> > + <target name="create-cache">
> > + <mkdir dir="${wscache.output.base.dir}" />
> > + <mkdir dir="${wscache.generated.src.dir}" />
> > + <mkdir dir="${wscache.generated.classes.dir}" />
> > + </target>
> > +
> > + <target name="wrapper-beans" depends="create-cache">
> > + <echo>Generating artifacts for org.apache.axis2.jaxws.wrapper.beans.AddNumbersService </echo>
> > + <wsgen
> > + sei="org.apache.axis2.jaxws.wrapper.beans.AddNumbersService"
> > + destdir="${wscache.generated.classes.dir}"
> > + resourcedestdir="${wscache.generated.src.dir}"
> > + keep="false"
> > + verbose="false"
> > + genwsdl="true">
> > + <classpath>
> > + <pathelement path="${compile.test.classes}" />
> > + </classpath>
> > + </wsgen>
> > + </target>
> > +</project>
> > \ No newline at end of file
> >
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-dev-help@axis.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org
Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws: ./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/
test/org/apache/axis2/jaxws/wrapper/ test/org/apache/axis2/jaxws/wrapper/beans/
Posted by Nikhil V Thaker <ni...@us.ibm.com>.
Andreas - I had to add the tools.jar bit because maven plugin for wsGen
gave NoClassDef Found errors for classes packaged in tools.jar.
Since this is causing a problem I will just package the generated
artifacts and remove the wsGen dependency.
Thanks,
Nikhil Thaker
office: 919 254 9964
nvthaker@us.ibm.com
Andreas Veithen <an...@gmail.com>
07/14/2010 01:44 PM
Please respond to
java-dev@axis.apache.org
To
java-dev@axis.apache.org
cc
Subject
Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws: ./
src/org/apache/axis2/jaxws/runtime/description/marshal/impl/
test/org/apache/axis2/jaxws/wrapper/
test/org/apache/axis2/jaxws/wrapper/beans/
Nikhil,
I have some issues with the tools and jaxws-tools dependencies
introduced by this change:
* The change causes a build failure in Hudson. There will also be
additional issues with tools.jar, because the way to declare this as a
system dependency varies from one JDK to another. For example, I
remember that on Mac OS X, it is completely different than on other
JDKs.
* I don't like the fact that jaxws-tools becomes a dependency of
axis2-jaxws in scope compile, because it looks like this is only
needed during the build and/or during the tests.
I didn't review the change in detail, but wouldn't it be smarter to
use one of the existing Maven plugins to do the wsgen stuff? They will
take care of the tools.jar stuff as well.
Andreas
On Tue, Jul 13, 2010 at 00:16, <nt...@apache.org> wrote:
> Author: nthaker
> Date: Mon Jul 12 22:16:54 2010
> New Revision: 963508
>
> URL: http://svn.apache.org/viewvc?rev=963508&view=rev
> Log:
> AXIS2-4775
> This change ensures that we will use Request and Response wrapper Bean
packaged by customer or we will Generate Wrappers if they are not
packaged.
>
> Added:
>
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/
>
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/
>
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
>
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
>
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
> axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml
> Modified:
> axis/axis2/java/core/trunk/modules/jaxws/pom.xml
>
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
>
> Modified: axis/axis2/java/core/trunk/modules/jaxws/pom.xml
> URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/pom.xml?rev=963508&r1=963507&r2=963508&view=diff
>
==============================================================================
> --- axis/axis2/java/core/trunk/modules/jaxws/pom.xml (original)
> +++ axis/axis2/java/core/trunk/modules/jaxws/pom.xml Mon Jul 12 22:16:54
2010
> @@ -1,5 +1,4 @@
> <?xml version="1.0" encoding="UTF-8"?>
> -
> <!--
> ~ Licensed to the Apache Software Foundation (ASF) under one
> ~ or more contributor license agreements. See the NOTICE file
> @@ -20,7 +19,7 @@
> -->
>
> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"
> - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
> <modelVersion>4.0.0</modelVersion>
> <parent>
> <groupId>org.apache.axis2</groupId>
> @@ -98,7 +97,25 @@
> <version>${version}</version>
> <scope>test</scope>
> </dependency>
> + <dependency>
> + <groupId>wsdl4j</groupId>
> + <artifactId>wsdl4j</artifactId>
> + </dependency>
> + <dependency>
> + <groupId>com.sun.xml.ws</groupId>
> + <artifactId>jaxws-tools</artifactId>
> + <version>2.1.3</version>
> + </dependency>
> + <!-- If we dont include tools.jar as dependency, maven throws
NoClassDefFound on wsGen run -->
> + <dependency>
> + <groupId>java</groupId>
> + <artifactId>tools</artifactId>
> + <version>$version</version>
> + <scope>system</scope>
> + <systemPath>${JAVA_HOME}/lib/tools.jar</systemPath>
> + </dependency>
> </dependencies>
> +
> <build>
> <sourceDirectory>src</sourceDirectory>
> <testSourceDirectory>test</testSourceDirectory>
> @@ -203,34 +220,39 @@
> <compilerVersion>1.5</compilerVersion>
> <source>1.5</source>
> <target>1.5</target>
> +
> </configuration>
> </plugin>
> <plugin>
> <groupId>org.apache.maven.plugins</groupId>
> <artifactId>maven-antrun-plugin</artifactId>
> +
> <executions>
> <execution>
> <id>gen-ts</id>
> <phase>generate-test-sources</phase>
> <configuration>
> - <tasks unless="maven.test.skip">
> + <tasks unless="maven.test.skip">
> <!-- Theres got to be a better way to do
this -->
> <property name="schema.source.dir"
value="test-resources/xsd"/>
> <property name="wsdl.source.dir"
value="test-resources/wsdl"/>
> - <property name="schema.output.base.dir"
value="target/schema"/>
> + <property name="schema.output.base.dir"
value="target/schema"/>
> <property
name="schema.generated.src.dir" value="${schema.output.base.dir}/src"/>
> <property
name="schema.generated.classes.dir"
>
value="${schema.output.base.dir}/classes"/>
> +
> <!-- make the dirs -->
> <mkdir dir="${schema.output.base.dir}"/>
> <mkdir
dir="${schema.generated.src.dir}"/>
> <mkdir
dir="${schema.generated.classes.dir}"/>
> +
> <!-- Run JAXB schema compiler with
designated schemas -->
> <echo>Generating JAX-B classes from
XSDs</echo>
>
> <echo>Generating java from
echo.xsd</echo>
> <java
classname="com.sun.tools.xjc.Driver" fork="true">
> <classpath
refid="maven.runtime.classpath"/>
> +
> <classpath
location="${compiled.classes.dir}"/>
> <arg line="-d
${schema.generated.src.dir} -quiet ${schema.source.dir}/echo.xsd"/>
> </java>
> @@ -266,7 +288,7 @@
> <classpath
refid="maven.runtime.classpath"/>
> <classpath
location="${compiled.classes.dir}"/>
> <arg line="-d
${schema.generated.src.dir} -quiet -wsdl
${wsdl.source.dir}/AddNumbers.wsdl"/>
> - </java>
> + </java>
> </tasks>
> </configuration>
> <goals>
> @@ -287,6 +309,22 @@
> <property name="addressing_version"
value="${version}"/>
> <ant antfile="build.xml"
inheritall="true" inheritrefs="true"
> dir="." target="build-repo"/>
> +
> +
<property name="compile_classpath" refid="maven.compile.classpath" />
> +
<property name="runtime_classpath" refid="maven.runtime.classpath" />
> +
<property name="test_classpath" refid="maven.test.classpath" />
> +
<property name="plugin_classpath" refid="maven.plugin.classpath" />
> +
> + <!-- Defining wsGen task -->
> + <taskdef
name="wsgen" loaderRef="refwsgen" classname="com.sun.tools.ws.ant.WsGen">
> +
<classpath>
> +
<path refid="maven.runtime.classpath" />
> +
<path refid="maven.compile.classpath" />
> +
</classpath>
> +
</taskdef>
> + <!--
Invoking test cases that need to generate artifacts using wsGen -->
> + <ant antfile="wsgen-tests.xml"
inheritall="true" inheritrefs="true"
> + dir="." target="run-wsgen-tests"/>
> </tasks>
> </configuration>
> <goals>
> @@ -374,6 +412,13 @@
> <plugin>
> <groupId>org.apache.maven.plugins</groupId>
> <artifactId>maven-surefire-report-plugin</artifactId>
> + <reportSets>
> + <reportSet>
> + <reports>
> + <report>report-only</report>
> + </reports>
> + </reportSet>
> + </reportSets>
> </plugin>
> </plugins>
> </reporting>
>
> Modified:
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
> URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java?rev=963508&r1=963507&r2=963508&view=diff
>
==============================================================================
> ---
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
(original)
> +++
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
Mon Jul 12 22:16:54 2010
> @@ -238,12 +238,27 @@ class ArtifactProcessor {
> wrapperClass = newValue;
> }
> }
> - if(cls==null && (type.equals("@WebFault")||
type.equals("faultInfo"))){
> +
> + if(cls==null &&
> + (type.equals("@RequestWrapper")||
type.equals("@ResponseWrapper")||type.equals("@WebFault")||
type.equals("faultInfo"))){
> +
> + //Support for Fault Bean Generation
> //As per JAX-WS 2.2 Specification section
3.7 an application programmer can choose not to
> //package the faultBeans, if we have reached
this point in the code then user has choosen
> //not to package the fault bean. If there is
a cache of generated artifacts available then
> //lets look for the missing faultBean there.
> -
> +
> + //Support for Wrapper Bean Generation
> + //As per JAX-WS 2.2 Specificaiton section
3.6.2.1 pg 41 an application programmer does not use
> + //the wrapper bean classes, so the
application need not package these classes. If we have reached
> + //this point in the code then user has
choosen not to package these beans.
> +
> + //NOTE:If we find Generated artifacts from
cache this guarantees that we will not use
> + //DocLitWrappedMinimum marshaller code. The
advantage of normal DocLitWrappedMarshaller is
> + //that it is very robust and has support of
lot more datatypes than in DocLitWrappedMinimum.
> + if(log.isDebugEnabled()){
> + log.debug("Adding cache to classpath");
> + }
> ClassFinderFactory cff =
>
(ClassFinderFactory)FactoryRegistry.getFactory(ClassFinderFactory.class);
> ClassFinder cf = cff.getClassFinder();
> @@ -317,11 +332,26 @@ class ArtifactProcessor {
> if (cls2 == null) {
> cls2 = loadClassOrNull(defaultValue,
altClassLoader);
> }
> - if(cls2==null && (type.equals("faultInfo")||
type.equals("@WebFault"))){
> - //As per JAX-WS 2.2 Specification section
3.7 an application programmer can choose not to
> - //package the faultBeans, if we have
reached this point in the code then user has choosen
> - //not to package the fault bean. If there
is a cache of generated artifacts available then
> - //lets look for the missing faultBean
there.
> + if(cls2==null &&
> +
(type.equals("@RequestWrapper")||
type.equals("@ResponseWrapper")||type.equals("@WebFault")||
type.equals("faultInfo"))){
> +
> + //Support for Fault Bean Generation
> + //As per JAX-WS 2.2 Specification
section 3.7 an application programmer can choose not to
> + //package the faultBeans, if we have
reached this point in the code then user has choosen
> + //not to package the fault bean. If
there is a cache of generated artifacts available then
> + //lets look for the missing faultBean
there.
> +
> + //Support for Wrapper Bean Generation
> + //As per JAX-WS 2.2 Specificaiton
section 3.6.2.1 pg 41 an application programmer does not use
> + //the wrapper bean classes, so the
application need not package these classes. If we have reached
> + //this point in the code then user has
choosen not to package these beans.
> +
> + //NOTE:If we find Generated artifacts
from cache this guarantees that we will not use
> + //DocLitWrappedMinimum marshaller code.
The advantage of normal DocLitWrappedMarshaller is
> + //that it is very robust and has support
of lot more datatypes than in DocLitWrappedMinimum.
> + if(log.isDebugEnabled()){
> + log.debug("Adding cache to
classpath");
> + }
> if(log.isDebugEnabled()){
> log.debug("Adding cache to classpath");
> }
>
> Added:
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
> URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java?rev=963508&view=auto
>
==============================================================================
> ---
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
(added)
> +++
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
Mon Jul 12 22:16:54 2010
> @@ -0,0 +1,18 @@
> +
> +package org.apache.axis2.jaxws.wrapper.beans;
> +
> +import javax.xml.ws.WebFault;
> +
> +@WebFault(name = "AddNumbersFault", targetNamespace = "
http://org/test/addnumbers")
> +public class AddNumbersException extends Exception
> +{
> +
> + private String message = null;
> + public AddNumbersException(){}
> + public AddNumbersException(String message){
> + this.message = message;
> + }
> + public String getInfo(){
> + return message;
> + }
> +}
>
> Added:
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
> URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java?rev=963508&view=auto
>
==============================================================================
> ---
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
(added)
> +++
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
Mon Jul 12 22:16:54 2010
> @@ -0,0 +1,15 @@
> +package org.apache.axis2.jaxws.wrapper.beans;
> +
> +
> +
> +@javax.jws.WebService (targetNamespace="http://org/test/addnumbers",
serviceName="AddNumbersService", portName="AddNumbersPort")
> +public class AddNumbersService{
> +
> + public int addNumbers(int arg0, int arg1) throws
AddNumbersException {
> + if(arg0+arg1<0){
> + throw new AddNumbersException("sum is less than
0");
> + }
> + return arg0+arg1;
> + }
> +
> +}
> \ No newline at end of file
>
> Added:
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
> URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java?rev=963508&view=auto
>
==============================================================================
> ---
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
(added)
> +++
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
Mon Jul 12 22:16:54 2010
> @@ -0,0 +1,114 @@
> +/**
> + *
> + */
> +package org.apache.axis2.jaxws.wrapper.beans;
> +
> +
> +import org.apache.axis2.jaxws.Constants;
> +import org.apache.axis2.jaxws.description.DescriptionFactory;
> +import org.apache.axis2.jaxws.description.EndpointDescription;
> +import org.apache.axis2.jaxws.description.EndpointDescriptionJava;
> +import org.apache.axis2.jaxws.description.OperationDescription;
> +import org.apache.axis2.jaxws.description.ServiceDescription;
> +import org.apache.axis2.jaxws.marshaller.MethodMarshaller;
> +import
org.apache.axis2.jaxws.marshaller.factory.MethodMarshallerFactory;
> +import
org.apache.axis2.jaxws.marshaller.impl.alt.DocLitWrappedMinimalMethodMarshaller;
> +import org.apache.axis2.jaxws.unitTest.TestLogger;
> +
> +import java.io.File;
> +
> +import junit.framework.TestCase;
> +
> +public class WrapperBeanMarshallTests extends TestCase {
> + /**
> + * This is the negative test case, when we do not use generated
artifacts from cache
> + * and user did not package wrapper beans, we should see use of
DocLitWrappedMinumumMarshaller.
> + */
> + public void testGetMarshallerOperationDescriptionBooleanNegative()
{
> +
TestLogger.logger.debug("---------------------------------------");
> + TestLogger.logger.debug("test: " + getName());
> +
> + String cache_location = "/target/wscache/classes";
> + try{
> + String baseDir = new
File(System.getProperty("basedir",".")).getCanonicalPath();
> + cache_location = new
File(baseDir+cache_location).getAbsolutePath();
> + TestLogger.logger.debug("cache location ="+cache_location);
> +
> + //Get EndpointDescription.
> + //Set location on AxisConfiguraiton.
> + Class sei = AddNumbersService.class;
> + EndpointDescription description = getEndpointDesc(sei);
> + TestLogger.logger.debug("description objects where created
successfully");
> + OperationDescription[] ops
=description.getEndpointInterfaceDescription().getOperations();
> + assertNotNull( "OperationDescriptions where null", ops);
> + assertTrue("No Operation Descriptions where found",
ops.length>0);
> + OperationDescription op = ops[0];
> + TestLogger.logger.debug("operation found, java
methodName="+op.getJavaMethodName());
> + //Don not Set cache on AxisConfiguration.
> + //get Marshaller, verify its not DoclitWrappedMinimum.
> + TestLogger.logger.debug("ws_cache location NOT set on
AxisConfigContext, location="+cache_location);
> + MethodMarshaller mm =
MethodMarshallerFactory.getMarshaller(op, false);
> + assertNotNull("getMarshaller returned null", mm );
> + TestLogger.logger.debug("MethodMarshaller was created,
type="+mm.getClass().getName());
> + assertTrue("Generated artifacts not found, Method
marshaller should be DocLitWrappedMinimumMarshaller", (mm instanceof
DocLitWrappedMinimalMethodMarshaller));
> + }catch(Exception e){
> + TestLogger.logger.debug("Exception ="+e.getMessage());
> + fail(e.getMessage());
> + }
> +
> + }
> + /**
> + * In this test case user did not package wrapper beans but we add
generated artifacts from cache, we should see use of
> + * DocLitWrappedMarshaller.
> + * Test method for {@link
org.apache.axis2.jaxws.marshaller.factory.MethodMarshallerFactory#getMarshaller(org.apache.axis2.jaxws.description.OperationDescription,
boolean)}.
> + */
> + public void testGetMarshallerOperationDescriptionBoolean() {
> +
TestLogger.logger.debug("---------------------------------------");
> + TestLogger.logger.debug("test: " + getName());
> +
> + String cache_location = "/target/wscache/classes";
> + try{
> + String baseDir = new
File(System.getProperty("basedir",".")).getCanonicalPath();
> + cache_location = new
File(baseDir+cache_location).getAbsolutePath();
> + TestLogger.logger.debug("cache location ="+cache_location);
> +
> + //Get EndpointDescription.
> + //Set location on AxisConfiguraiton.
> + Class sei = AddNumbersService.class;
> + EndpointDescription description = getEndpointDesc(sei);
> + TestLogger.logger.debug("description objects where created
successfully");
> + OperationDescription[] ops
=description.getEndpointInterfaceDescription().getOperations();
> + assertNotNull( "OperationDescriptions where null", ops);
> + assertTrue("No Operation Descriptions where found",
ops.length>0);
> + OperationDescription op = ops[0];
> + TestLogger.logger.debug("operation found, java
methodName="+op.getJavaMethodName());
> + //Set cache on AxisConfiguration.
> + //get Marshaller, verify its not DoclitWrappedMinimum.
> +
description.getServiceDescription().getAxisConfigContext().setProperty(Constants.WS_CACHE,
cache_location);
> + TestLogger.logger.debug("ws_cache location set on
AxisConfigContext, location="+cache_location);
> + MethodMarshaller mm =
MethodMarshallerFactory.getMarshaller(op, false);
> + assertNotNull("getMarshaller returned null", mm );
> + TestLogger.logger.debug("MethodMarshaller was created,
type="+mm.getClass().getName());
> + assertTrue("Generated artifacts are in cache, Method
marshaller should not be DocLitWrappedMinimumMarshaller", !(mm instanceof
DocLitWrappedMinimalMethodMarshaller));
> + }catch(Exception e){
> + TestLogger.logger.debug("Exception ="+e.getMessage());
> + fail(e.getMessage());
> + }
> +
> + }
> +
> + private EndpointDescription getEndpointDesc(Class
implementationClass) {
> + // Use the description factory directly; this will be done
within the JAX-WS runtime
> + ServiceDescription serviceDesc =
> +
DescriptionFactory.createServiceDescription(implementationClass);
> + assertNotNull(serviceDesc);
> +
> + EndpointDescription[] endpointDesc =
serviceDesc.getEndpointDescriptions();
> + assertNotNull(endpointDesc);
> + assertEquals(1, endpointDesc.length);
> +
> + // TODO: How will the JAX-WS dispatcher get the appropriate
port (i.e. endpoint)? Currently assumes [0]
> + EndpointDescription testEndpointDesc = endpointDesc[0];
> + return testEndpointDesc;
> + }
> +}
>
> Added: axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml
> URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml?rev=963508&view=auto
>
==============================================================================
> --- axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml (added)
> +++ axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml Mon Jul 12
22:16:54 2010
> @@ -0,0 +1,34 @@
> +<?xml version="1.0" encoding="UTF-8"?>
> +
> +<project basedir="." default="run-wsgen-tests" name="wsgen-tests">
> +
> + <property name="wscache.output.base.dir" value="target/wscache"
/>
> + <property name="wscache.generated.src.dir"
value="${wscache.output.base.dir}/src" />
> + <property name="wscache.generated.classes.dir"
value="${wscache.output.base.dir}/classes" />
> + <property name="compile.test.classes"
value="target/test-classes" />
> +
> +
> + <target name="run-wsgen-tests" depends="wrapper-beans"/>
> +
> +
> + <target name="create-cache">
> + <mkdir dir="${wscache.output.base.dir}" />
> + <mkdir dir="${wscache.generated.src.dir}" />
> + <mkdir dir="${wscache.generated.classes.dir}" />
> + </target>
> +
> + <target name="wrapper-beans" depends="create-cache">
> + <echo>Generating artifacts for
org.apache.axis2.jaxws.wrapper.beans.AddNumbersService </echo>
> + <wsgen
> +
sei="org.apache.axis2.jaxws.wrapper.beans.AddNumbersService"
> + destdir="${wscache.generated.classes.dir}"
> + resourcedestdir="${wscache.generated.src.dir}"
> + keep="false"
> + verbose="false"
> + genwsdl="true">
> + <classpath>
> + <pathelement path="${compile.test.classes}" />
> + </classpath>
> + </wsgen>
> + </target>
> +</project>
> \ No newline at end of file
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org
Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws: ./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/
test/org/apache/axis2/jaxws/wrapper/ test/org/apache/axis2/jaxws/wrapper/beans/
Posted by Nikhil V Thaker <ni...@us.ibm.com>.
Andreas - I had to add the tools.jar bit because maven plugin for wsGen
gave NoClassDef Found errors for classes packaged in tools.jar.
Since this is causing a problem I will just package the generated
artifacts and remove the wsGen dependency.
Thanks,
Nikhil Thaker
office: 919 254 9964
nvthaker@us.ibm.com
Andreas Veithen <an...@gmail.com>
07/14/2010 01:44 PM
Please respond to
java-dev@axis.apache.org
To
java-dev@axis.apache.org
cc
Subject
Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws: ./
src/org/apache/axis2/jaxws/runtime/description/marshal/impl/
test/org/apache/axis2/jaxws/wrapper/
test/org/apache/axis2/jaxws/wrapper/beans/
Nikhil,
I have some issues with the tools and jaxws-tools dependencies
introduced by this change:
* The change causes a build failure in Hudson. There will also be
additional issues with tools.jar, because the way to declare this as a
system dependency varies from one JDK to another. For example, I
remember that on Mac OS X, it is completely different than on other
JDKs.
* I don't like the fact that jaxws-tools becomes a dependency of
axis2-jaxws in scope compile, because it looks like this is only
needed during the build and/or during the tests.
I didn't review the change in detail, but wouldn't it be smarter to
use one of the existing Maven plugins to do the wsgen stuff? They will
take care of the tools.jar stuff as well.
Andreas
On Tue, Jul 13, 2010 at 00:16, <nt...@apache.org> wrote:
> Author: nthaker
> Date: Mon Jul 12 22:16:54 2010
> New Revision: 963508
>
> URL: http://svn.apache.org/viewvc?rev=963508&view=rev
> Log:
> AXIS2-4775
> This change ensures that we will use Request and Response wrapper Bean
packaged by customer or we will Generate Wrappers if they are not
packaged.
>
> Added:
>
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/
>
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/
>
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
>
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
>
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
> axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml
> Modified:
> axis/axis2/java/core/trunk/modules/jaxws/pom.xml
>
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
>
> Modified: axis/axis2/java/core/trunk/modules/jaxws/pom.xml
> URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/pom.xml?rev=963508&r1=963507&r2=963508&view=diff
>
==============================================================================
> --- axis/axis2/java/core/trunk/modules/jaxws/pom.xml (original)
> +++ axis/axis2/java/core/trunk/modules/jaxws/pom.xml Mon Jul 12 22:16:54
2010
> @@ -1,5 +1,4 @@
> <?xml version="1.0" encoding="UTF-8"?>
> -
> <!--
> ~ Licensed to the Apache Software Foundation (ASF) under one
> ~ or more contributor license agreements. See the NOTICE file
> @@ -20,7 +19,7 @@
> -->
>
> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"
> - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
> <modelVersion>4.0.0</modelVersion>
> <parent>
> <groupId>org.apache.axis2</groupId>
> @@ -98,7 +97,25 @@
> <version>${version}</version>
> <scope>test</scope>
> </dependency>
> + <dependency>
> + <groupId>wsdl4j</groupId>
> + <artifactId>wsdl4j</artifactId>
> + </dependency>
> + <dependency>
> + <groupId>com.sun.xml.ws</groupId>
> + <artifactId>jaxws-tools</artifactId>
> + <version>2.1.3</version>
> + </dependency>
> + <!-- If we dont include tools.jar as dependency, maven throws
NoClassDefFound on wsGen run -->
> + <dependency>
> + <groupId>java</groupId>
> + <artifactId>tools</artifactId>
> + <version>$version</version>
> + <scope>system</scope>
> + <systemPath>${JAVA_HOME}/lib/tools.jar</systemPath>
> + </dependency>
> </dependencies>
> +
> <build>
> <sourceDirectory>src</sourceDirectory>
> <testSourceDirectory>test</testSourceDirectory>
> @@ -203,34 +220,39 @@
> <compilerVersion>1.5</compilerVersion>
> <source>1.5</source>
> <target>1.5</target>
> +
> </configuration>
> </plugin>
> <plugin>
> <groupId>org.apache.maven.plugins</groupId>
> <artifactId>maven-antrun-plugin</artifactId>
> +
> <executions>
> <execution>
> <id>gen-ts</id>
> <phase>generate-test-sources</phase>
> <configuration>
> - <tasks unless="maven.test.skip">
> + <tasks unless="maven.test.skip">
> <!-- Theres got to be a better way to do
this -->
> <property name="schema.source.dir"
value="test-resources/xsd"/>
> <property name="wsdl.source.dir"
value="test-resources/wsdl"/>
> - <property name="schema.output.base.dir"
value="target/schema"/>
> + <property name="schema.output.base.dir"
value="target/schema"/>
> <property
name="schema.generated.src.dir" value="${schema.output.base.dir}/src"/>
> <property
name="schema.generated.classes.dir"
>
value="${schema.output.base.dir}/classes"/>
> +
> <!-- make the dirs -->
> <mkdir dir="${schema.output.base.dir}"/>
> <mkdir
dir="${schema.generated.src.dir}"/>
> <mkdir
dir="${schema.generated.classes.dir}"/>
> +
> <!-- Run JAXB schema compiler with
designated schemas -->
> <echo>Generating JAX-B classes from
XSDs</echo>
>
> <echo>Generating java from
echo.xsd</echo>
> <java
classname="com.sun.tools.xjc.Driver" fork="true">
> <classpath
refid="maven.runtime.classpath"/>
> +
> <classpath
location="${compiled.classes.dir}"/>
> <arg line="-d
${schema.generated.src.dir} -quiet ${schema.source.dir}/echo.xsd"/>
> </java>
> @@ -266,7 +288,7 @@
> <classpath
refid="maven.runtime.classpath"/>
> <classpath
location="${compiled.classes.dir}"/>
> <arg line="-d
${schema.generated.src.dir} -quiet -wsdl
${wsdl.source.dir}/AddNumbers.wsdl"/>
> - </java>
> + </java>
> </tasks>
> </configuration>
> <goals>
> @@ -287,6 +309,22 @@
> <property name="addressing_version"
value="${version}"/>
> <ant antfile="build.xml"
inheritall="true" inheritrefs="true"
> dir="." target="build-repo"/>
> +
> +
<property name="compile_classpath" refid="maven.compile.classpath" />
> +
<property name="runtime_classpath" refid="maven.runtime.classpath" />
> +
<property name="test_classpath" refid="maven.test.classpath" />
> +
<property name="plugin_classpath" refid="maven.plugin.classpath" />
> +
> + <!-- Defining wsGen task -->
> + <taskdef
name="wsgen" loaderRef="refwsgen" classname="com.sun.tools.ws.ant.WsGen">
> +
<classpath>
> +
<path refid="maven.runtime.classpath" />
> +
<path refid="maven.compile.classpath" />
> +
</classpath>
> +
</taskdef>
> + <!--
Invoking test cases that need to generate artifacts using wsGen -->
> + <ant antfile="wsgen-tests.xml"
inheritall="true" inheritrefs="true"
> + dir="." target="run-wsgen-tests"/>
> </tasks>
> </configuration>
> <goals>
> @@ -374,6 +412,13 @@
> <plugin>
> <groupId>org.apache.maven.plugins</groupId>
> <artifactId>maven-surefire-report-plugin</artifactId>
> + <reportSets>
> + <reportSet>
> + <reports>
> + <report>report-only</report>
> + </reports>
> + </reportSet>
> + </reportSets>
> </plugin>
> </plugins>
> </reporting>
>
> Modified:
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
> URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java?rev=963508&r1=963507&r2=963508&view=diff
>
==============================================================================
> ---
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
(original)
> +++
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
Mon Jul 12 22:16:54 2010
> @@ -238,12 +238,27 @@ class ArtifactProcessor {
> wrapperClass = newValue;
> }
> }
> - if(cls==null && (type.equals("@WebFault")||
type.equals("faultInfo"))){
> +
> + if(cls==null &&
> + (type.equals("@RequestWrapper")||
type.equals("@ResponseWrapper")||type.equals("@WebFault")||
type.equals("faultInfo"))){
> +
> + //Support for Fault Bean Generation
> //As per JAX-WS 2.2 Specification section
3.7 an application programmer can choose not to
> //package the faultBeans, if we have reached
this point in the code then user has choosen
> //not to package the fault bean. If there is
a cache of generated artifacts available then
> //lets look for the missing faultBean there.
> -
> +
> + //Support for Wrapper Bean Generation
> + //As per JAX-WS 2.2 Specificaiton section
3.6.2.1 pg 41 an application programmer does not use
> + //the wrapper bean classes, so the
application need not package these classes. If we have reached
> + //this point in the code then user has
choosen not to package these beans.
> +
> + //NOTE:If we find Generated artifacts from
cache this guarantees that we will not use
> + //DocLitWrappedMinimum marshaller code. The
advantage of normal DocLitWrappedMarshaller is
> + //that it is very robust and has support of
lot more datatypes than in DocLitWrappedMinimum.
> + if(log.isDebugEnabled()){
> + log.debug("Adding cache to classpath");
> + }
> ClassFinderFactory cff =
>
(ClassFinderFactory)FactoryRegistry.getFactory(ClassFinderFactory.class);
> ClassFinder cf = cff.getClassFinder();
> @@ -317,11 +332,26 @@ class ArtifactProcessor {
> if (cls2 == null) {
> cls2 = loadClassOrNull(defaultValue,
altClassLoader);
> }
> - if(cls2==null && (type.equals("faultInfo")||
type.equals("@WebFault"))){
> - //As per JAX-WS 2.2 Specification section
3.7 an application programmer can choose not to
> - //package the faultBeans, if we have
reached this point in the code then user has choosen
> - //not to package the fault bean. If there
is a cache of generated artifacts available then
> - //lets look for the missing faultBean
there.
> + if(cls2==null &&
> +
(type.equals("@RequestWrapper")||
type.equals("@ResponseWrapper")||type.equals("@WebFault")||
type.equals("faultInfo"))){
> +
> + //Support for Fault Bean Generation
> + //As per JAX-WS 2.2 Specification
section 3.7 an application programmer can choose not to
> + //package the faultBeans, if we have
reached this point in the code then user has choosen
> + //not to package the fault bean. If
there is a cache of generated artifacts available then
> + //lets look for the missing faultBean
there.
> +
> + //Support for Wrapper Bean Generation
> + //As per JAX-WS 2.2 Specificaiton
section 3.6.2.1 pg 41 an application programmer does not use
> + //the wrapper bean classes, so the
application need not package these classes. If we have reached
> + //this point in the code then user has
choosen not to package these beans.
> +
> + //NOTE:If we find Generated artifacts
from cache this guarantees that we will not use
> + //DocLitWrappedMinimum marshaller code.
The advantage of normal DocLitWrappedMarshaller is
> + //that it is very robust and has support
of lot more datatypes than in DocLitWrappedMinimum.
> + if(log.isDebugEnabled()){
> + log.debug("Adding cache to
classpath");
> + }
> if(log.isDebugEnabled()){
> log.debug("Adding cache to classpath");
> }
>
> Added:
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
> URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java?rev=963508&view=auto
>
==============================================================================
> ---
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
(added)
> +++
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
Mon Jul 12 22:16:54 2010
> @@ -0,0 +1,18 @@
> +
> +package org.apache.axis2.jaxws.wrapper.beans;
> +
> +import javax.xml.ws.WebFault;
> +
> +@WebFault(name = "AddNumbersFault", targetNamespace = "
http://org/test/addnumbers")
> +public class AddNumbersException extends Exception
> +{
> +
> + private String message = null;
> + public AddNumbersException(){}
> + public AddNumbersException(String message){
> + this.message = message;
> + }
> + public String getInfo(){
> + return message;
> + }
> +}
>
> Added:
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
> URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java?rev=963508&view=auto
>
==============================================================================
> ---
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
(added)
> +++
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
Mon Jul 12 22:16:54 2010
> @@ -0,0 +1,15 @@
> +package org.apache.axis2.jaxws.wrapper.beans;
> +
> +
> +
> +@javax.jws.WebService (targetNamespace="http://org/test/addnumbers",
serviceName="AddNumbersService", portName="AddNumbersPort")
> +public class AddNumbersService{
> +
> + public int addNumbers(int arg0, int arg1) throws
AddNumbersException {
> + if(arg0+arg1<0){
> + throw new AddNumbersException("sum is less than
0");
> + }
> + return arg0+arg1;
> + }
> +
> +}
> \ No newline at end of file
>
> Added:
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
> URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java?rev=963508&view=auto
>
==============================================================================
> ---
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
(added)
> +++
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
Mon Jul 12 22:16:54 2010
> @@ -0,0 +1,114 @@
> +/**
> + *
> + */
> +package org.apache.axis2.jaxws.wrapper.beans;
> +
> +
> +import org.apache.axis2.jaxws.Constants;
> +import org.apache.axis2.jaxws.description.DescriptionFactory;
> +import org.apache.axis2.jaxws.description.EndpointDescription;
> +import org.apache.axis2.jaxws.description.EndpointDescriptionJava;
> +import org.apache.axis2.jaxws.description.OperationDescription;
> +import org.apache.axis2.jaxws.description.ServiceDescription;
> +import org.apache.axis2.jaxws.marshaller.MethodMarshaller;
> +import
org.apache.axis2.jaxws.marshaller.factory.MethodMarshallerFactory;
> +import
org.apache.axis2.jaxws.marshaller.impl.alt.DocLitWrappedMinimalMethodMarshaller;
> +import org.apache.axis2.jaxws.unitTest.TestLogger;
> +
> +import java.io.File;
> +
> +import junit.framework.TestCase;
> +
> +public class WrapperBeanMarshallTests extends TestCase {
> + /**
> + * This is the negative test case, when we do not use generated
artifacts from cache
> + * and user did not package wrapper beans, we should see use of
DocLitWrappedMinumumMarshaller.
> + */
> + public void testGetMarshallerOperationDescriptionBooleanNegative()
{
> +
TestLogger.logger.debug("---------------------------------------");
> + TestLogger.logger.debug("test: " + getName());
> +
> + String cache_location = "/target/wscache/classes";
> + try{
> + String baseDir = new
File(System.getProperty("basedir",".")).getCanonicalPath();
> + cache_location = new
File(baseDir+cache_location).getAbsolutePath();
> + TestLogger.logger.debug("cache location ="+cache_location);
> +
> + //Get EndpointDescription.
> + //Set location on AxisConfiguraiton.
> + Class sei = AddNumbersService.class;
> + EndpointDescription description = getEndpointDesc(sei);
> + TestLogger.logger.debug("description objects where created
successfully");
> + OperationDescription[] ops
=description.getEndpointInterfaceDescription().getOperations();
> + assertNotNull( "OperationDescriptions where null", ops);
> + assertTrue("No Operation Descriptions where found",
ops.length>0);
> + OperationDescription op = ops[0];
> + TestLogger.logger.debug("operation found, java
methodName="+op.getJavaMethodName());
> + //Don not Set cache on AxisConfiguration.
> + //get Marshaller, verify its not DoclitWrappedMinimum.
> + TestLogger.logger.debug("ws_cache location NOT set on
AxisConfigContext, location="+cache_location);
> + MethodMarshaller mm =
MethodMarshallerFactory.getMarshaller(op, false);
> + assertNotNull("getMarshaller returned null", mm );
> + TestLogger.logger.debug("MethodMarshaller was created,
type="+mm.getClass().getName());
> + assertTrue("Generated artifacts not found, Method
marshaller should be DocLitWrappedMinimumMarshaller", (mm instanceof
DocLitWrappedMinimalMethodMarshaller));
> + }catch(Exception e){
> + TestLogger.logger.debug("Exception ="+e.getMessage());
> + fail(e.getMessage());
> + }
> +
> + }
> + /**
> + * In this test case user did not package wrapper beans but we add
generated artifacts from cache, we should see use of
> + * DocLitWrappedMarshaller.
> + * Test method for {@link
org.apache.axis2.jaxws.marshaller.factory.MethodMarshallerFactory#getMarshaller(org.apache.axis2.jaxws.description.OperationDescription,
boolean)}.
> + */
> + public void testGetMarshallerOperationDescriptionBoolean() {
> +
TestLogger.logger.debug("---------------------------------------");
> + TestLogger.logger.debug("test: " + getName());
> +
> + String cache_location = "/target/wscache/classes";
> + try{
> + String baseDir = new
File(System.getProperty("basedir",".")).getCanonicalPath();
> + cache_location = new
File(baseDir+cache_location).getAbsolutePath();
> + TestLogger.logger.debug("cache location ="+cache_location);
> +
> + //Get EndpointDescription.
> + //Set location on AxisConfiguraiton.
> + Class sei = AddNumbersService.class;
> + EndpointDescription description = getEndpointDesc(sei);
> + TestLogger.logger.debug("description objects where created
successfully");
> + OperationDescription[] ops
=description.getEndpointInterfaceDescription().getOperations();
> + assertNotNull( "OperationDescriptions where null", ops);
> + assertTrue("No Operation Descriptions where found",
ops.length>0);
> + OperationDescription op = ops[0];
> + TestLogger.logger.debug("operation found, java
methodName="+op.getJavaMethodName());
> + //Set cache on AxisConfiguration.
> + //get Marshaller, verify its not DoclitWrappedMinimum.
> +
description.getServiceDescription().getAxisConfigContext().setProperty(Constants.WS_CACHE,
cache_location);
> + TestLogger.logger.debug("ws_cache location set on
AxisConfigContext, location="+cache_location);
> + MethodMarshaller mm =
MethodMarshallerFactory.getMarshaller(op, false);
> + assertNotNull("getMarshaller returned null", mm );
> + TestLogger.logger.debug("MethodMarshaller was created,
type="+mm.getClass().getName());
> + assertTrue("Generated artifacts are in cache, Method
marshaller should not be DocLitWrappedMinimumMarshaller", !(mm instanceof
DocLitWrappedMinimalMethodMarshaller));
> + }catch(Exception e){
> + TestLogger.logger.debug("Exception ="+e.getMessage());
> + fail(e.getMessage());
> + }
> +
> + }
> +
> + private EndpointDescription getEndpointDesc(Class
implementationClass) {
> + // Use the description factory directly; this will be done
within the JAX-WS runtime
> + ServiceDescription serviceDesc =
> +
DescriptionFactory.createServiceDescription(implementationClass);
> + assertNotNull(serviceDesc);
> +
> + EndpointDescription[] endpointDesc =
serviceDesc.getEndpointDescriptions();
> + assertNotNull(endpointDesc);
> + assertEquals(1, endpointDesc.length);
> +
> + // TODO: How will the JAX-WS dispatcher get the appropriate
port (i.e. endpoint)? Currently assumes [0]
> + EndpointDescription testEndpointDesc = endpointDesc[0];
> + return testEndpointDesc;
> + }
> +}
>
> Added: axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml
> URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml?rev=963508&view=auto
>
==============================================================================
> --- axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml (added)
> +++ axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml Mon Jul 12
22:16:54 2010
> @@ -0,0 +1,34 @@
> +<?xml version="1.0" encoding="UTF-8"?>
> +
> +<project basedir="." default="run-wsgen-tests" name="wsgen-tests">
> +
> + <property name="wscache.output.base.dir" value="target/wscache"
/>
> + <property name="wscache.generated.src.dir"
value="${wscache.output.base.dir}/src" />
> + <property name="wscache.generated.classes.dir"
value="${wscache.output.base.dir}/classes" />
> + <property name="compile.test.classes"
value="target/test-classes" />
> +
> +
> + <target name="run-wsgen-tests" depends="wrapper-beans"/>
> +
> +
> + <target name="create-cache">
> + <mkdir dir="${wscache.output.base.dir}" />
> + <mkdir dir="${wscache.generated.src.dir}" />
> + <mkdir dir="${wscache.generated.classes.dir}" />
> + </target>
> +
> + <target name="wrapper-beans" depends="create-cache">
> + <echo>Generating artifacts for
org.apache.axis2.jaxws.wrapper.beans.AddNumbersService </echo>
> + <wsgen
> +
sei="org.apache.axis2.jaxws.wrapper.beans.AddNumbersService"
> + destdir="${wscache.generated.classes.dir}"
> + resourcedestdir="${wscache.generated.src.dir}"
> + keep="false"
> + verbose="false"
> + genwsdl="true">
> + <classpath>
> + <pathelement path="${compile.test.classes}" />
> + </classpath>
> + </wsgen>
> + </target>
> +</project>
> \ No newline at end of file
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org
Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws: ./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/
test/org/apache/axis2/jaxws/wrapper/ test/org/apache/axis2/jaxws/wrapper/beans/
Posted by Nikhil V Thaker <ni...@us.ibm.com>.
Andreas - I had to add the tools.jar bit because maven plugin for wsGen
gave NoClassDef Found errors for classes packaged in tools.jar.
Since this is causing a problem I will just package the generated
artifacts and remove the wsGen dependency.
Thanks,
Nikhil Thaker
office: 919 254 9964
nvthaker@us.ibm.com
Andreas Veithen <an...@gmail.com>
07/14/2010 01:44 PM
Please respond to
java-dev@axis.apache.org
To
java-dev@axis.apache.org
cc
Subject
Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws: ./
src/org/apache/axis2/jaxws/runtime/description/marshal/impl/
test/org/apache/axis2/jaxws/wrapper/
test/org/apache/axis2/jaxws/wrapper/beans/
Nikhil,
I have some issues with the tools and jaxws-tools dependencies
introduced by this change:
* The change causes a build failure in Hudson. There will also be
additional issues with tools.jar, because the way to declare this as a
system dependency varies from one JDK to another. For example, I
remember that on Mac OS X, it is completely different than on other
JDKs.
* I don't like the fact that jaxws-tools becomes a dependency of
axis2-jaxws in scope compile, because it looks like this is only
needed during the build and/or during the tests.
I didn't review the change in detail, but wouldn't it be smarter to
use one of the existing Maven plugins to do the wsgen stuff? They will
take care of the tools.jar stuff as well.
Andreas
On Tue, Jul 13, 2010 at 00:16, <nt...@apache.org> wrote:
> Author: nthaker
> Date: Mon Jul 12 22:16:54 2010
> New Revision: 963508
>
> URL: http://svn.apache.org/viewvc?rev=963508&view=rev
> Log:
> AXIS2-4775
> This change ensures that we will use Request and Response wrapper Bean
packaged by customer or we will Generate Wrappers if they are not
packaged.
>
> Added:
>
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/
>
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/
>
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
>
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
>
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
> axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml
> Modified:
> axis/axis2/java/core/trunk/modules/jaxws/pom.xml
>
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
>
> Modified: axis/axis2/java/core/trunk/modules/jaxws/pom.xml
> URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/pom.xml?rev=963508&r1=963507&r2=963508&view=diff
>
==============================================================================
> --- axis/axis2/java/core/trunk/modules/jaxws/pom.xml (original)
> +++ axis/axis2/java/core/trunk/modules/jaxws/pom.xml Mon Jul 12 22:16:54
2010
> @@ -1,5 +1,4 @@
> <?xml version="1.0" encoding="UTF-8"?>
> -
> <!--
> ~ Licensed to the Apache Software Foundation (ASF) under one
> ~ or more contributor license agreements. See the NOTICE file
> @@ -20,7 +19,7 @@
> -->
>
> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"
> - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
> <modelVersion>4.0.0</modelVersion>
> <parent>
> <groupId>org.apache.axis2</groupId>
> @@ -98,7 +97,25 @@
> <version>${version}</version>
> <scope>test</scope>
> </dependency>
> + <dependency>
> + <groupId>wsdl4j</groupId>
> + <artifactId>wsdl4j</artifactId>
> + </dependency>
> + <dependency>
> + <groupId>com.sun.xml.ws</groupId>
> + <artifactId>jaxws-tools</artifactId>
> + <version>2.1.3</version>
> + </dependency>
> + <!-- If we dont include tools.jar as dependency, maven throws
NoClassDefFound on wsGen run -->
> + <dependency>
> + <groupId>java</groupId>
> + <artifactId>tools</artifactId>
> + <version>$version</version>
> + <scope>system</scope>
> + <systemPath>${JAVA_HOME}/lib/tools.jar</systemPath>
> + </dependency>
> </dependencies>
> +
> <build>
> <sourceDirectory>src</sourceDirectory>
> <testSourceDirectory>test</testSourceDirectory>
> @@ -203,34 +220,39 @@
> <compilerVersion>1.5</compilerVersion>
> <source>1.5</source>
> <target>1.5</target>
> +
> </configuration>
> </plugin>
> <plugin>
> <groupId>org.apache.maven.plugins</groupId>
> <artifactId>maven-antrun-plugin</artifactId>
> +
> <executions>
> <execution>
> <id>gen-ts</id>
> <phase>generate-test-sources</phase>
> <configuration>
> - <tasks unless="maven.test.skip">
> + <tasks unless="maven.test.skip">
> <!-- Theres got to be a better way to do
this -->
> <property name="schema.source.dir"
value="test-resources/xsd"/>
> <property name="wsdl.source.dir"
value="test-resources/wsdl"/>
> - <property name="schema.output.base.dir"
value="target/schema"/>
> + <property name="schema.output.base.dir"
value="target/schema"/>
> <property
name="schema.generated.src.dir" value="${schema.output.base.dir}/src"/>
> <property
name="schema.generated.classes.dir"
>
value="${schema.output.base.dir}/classes"/>
> +
> <!-- make the dirs -->
> <mkdir dir="${schema.output.base.dir}"/>
> <mkdir
dir="${schema.generated.src.dir}"/>
> <mkdir
dir="${schema.generated.classes.dir}"/>
> +
> <!-- Run JAXB schema compiler with
designated schemas -->
> <echo>Generating JAX-B classes from
XSDs</echo>
>
> <echo>Generating java from
echo.xsd</echo>
> <java
classname="com.sun.tools.xjc.Driver" fork="true">
> <classpath
refid="maven.runtime.classpath"/>
> +
> <classpath
location="${compiled.classes.dir}"/>
> <arg line="-d
${schema.generated.src.dir} -quiet ${schema.source.dir}/echo.xsd"/>
> </java>
> @@ -266,7 +288,7 @@
> <classpath
refid="maven.runtime.classpath"/>
> <classpath
location="${compiled.classes.dir}"/>
> <arg line="-d
${schema.generated.src.dir} -quiet -wsdl
${wsdl.source.dir}/AddNumbers.wsdl"/>
> - </java>
> + </java>
> </tasks>
> </configuration>
> <goals>
> @@ -287,6 +309,22 @@
> <property name="addressing_version"
value="${version}"/>
> <ant antfile="build.xml"
inheritall="true" inheritrefs="true"
> dir="." target="build-repo"/>
> +
> +
<property name="compile_classpath" refid="maven.compile.classpath" />
> +
<property name="runtime_classpath" refid="maven.runtime.classpath" />
> +
<property name="test_classpath" refid="maven.test.classpath" />
> +
<property name="plugin_classpath" refid="maven.plugin.classpath" />
> +
> + <!-- Defining wsGen task -->
> + <taskdef
name="wsgen" loaderRef="refwsgen" classname="com.sun.tools.ws.ant.WsGen">
> +
<classpath>
> +
<path refid="maven.runtime.classpath" />
> +
<path refid="maven.compile.classpath" />
> +
</classpath>
> +
</taskdef>
> + <!--
Invoking test cases that need to generate artifacts using wsGen -->
> + <ant antfile="wsgen-tests.xml"
inheritall="true" inheritrefs="true"
> + dir="." target="run-wsgen-tests"/>
> </tasks>
> </configuration>
> <goals>
> @@ -374,6 +412,13 @@
> <plugin>
> <groupId>org.apache.maven.plugins</groupId>
> <artifactId>maven-surefire-report-plugin</artifactId>
> + <reportSets>
> + <reportSet>
> + <reports>
> + <report>report-only</report>
> + </reports>
> + </reportSet>
> + </reportSets>
> </plugin>
> </plugins>
> </reporting>
>
> Modified:
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
> URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java?rev=963508&r1=963507&r2=963508&view=diff
>
==============================================================================
> ---
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
(original)
> +++
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
Mon Jul 12 22:16:54 2010
> @@ -238,12 +238,27 @@ class ArtifactProcessor {
> wrapperClass = newValue;
> }
> }
> - if(cls==null && (type.equals("@WebFault")||
type.equals("faultInfo"))){
> +
> + if(cls==null &&
> + (type.equals("@RequestWrapper")||
type.equals("@ResponseWrapper")||type.equals("@WebFault")||
type.equals("faultInfo"))){
> +
> + //Support for Fault Bean Generation
> //As per JAX-WS 2.2 Specification section
3.7 an application programmer can choose not to
> //package the faultBeans, if we have reached
this point in the code then user has choosen
> //not to package the fault bean. If there is
a cache of generated artifacts available then
> //lets look for the missing faultBean there.
> -
> +
> + //Support for Wrapper Bean Generation
> + //As per JAX-WS 2.2 Specificaiton section
3.6.2.1 pg 41 an application programmer does not use
> + //the wrapper bean classes, so the
application need not package these classes. If we have reached
> + //this point in the code then user has
choosen not to package these beans.
> +
> + //NOTE:If we find Generated artifacts from
cache this guarantees that we will not use
> + //DocLitWrappedMinimum marshaller code. The
advantage of normal DocLitWrappedMarshaller is
> + //that it is very robust and has support of
lot more datatypes than in DocLitWrappedMinimum.
> + if(log.isDebugEnabled()){
> + log.debug("Adding cache to classpath");
> + }
> ClassFinderFactory cff =
>
(ClassFinderFactory)FactoryRegistry.getFactory(ClassFinderFactory.class);
> ClassFinder cf = cff.getClassFinder();
> @@ -317,11 +332,26 @@ class ArtifactProcessor {
> if (cls2 == null) {
> cls2 = loadClassOrNull(defaultValue,
altClassLoader);
> }
> - if(cls2==null && (type.equals("faultInfo")||
type.equals("@WebFault"))){
> - //As per JAX-WS 2.2 Specification section
3.7 an application programmer can choose not to
> - //package the faultBeans, if we have
reached this point in the code then user has choosen
> - //not to package the fault bean. If there
is a cache of generated artifacts available then
> - //lets look for the missing faultBean
there.
> + if(cls2==null &&
> +
(type.equals("@RequestWrapper")||
type.equals("@ResponseWrapper")||type.equals("@WebFault")||
type.equals("faultInfo"))){
> +
> + //Support for Fault Bean Generation
> + //As per JAX-WS 2.2 Specification
section 3.7 an application programmer can choose not to
> + //package the faultBeans, if we have
reached this point in the code then user has choosen
> + //not to package the fault bean. If
there is a cache of generated artifacts available then
> + //lets look for the missing faultBean
there.
> +
> + //Support for Wrapper Bean Generation
> + //As per JAX-WS 2.2 Specificaiton
section 3.6.2.1 pg 41 an application programmer does not use
> + //the wrapper bean classes, so the
application need not package these classes. If we have reached
> + //this point in the code then user has
choosen not to package these beans.
> +
> + //NOTE:If we find Generated artifacts
from cache this guarantees that we will not use
> + //DocLitWrappedMinimum marshaller code.
The advantage of normal DocLitWrappedMarshaller is
> + //that it is very robust and has support
of lot more datatypes than in DocLitWrappedMinimum.
> + if(log.isDebugEnabled()){
> + log.debug("Adding cache to
classpath");
> + }
> if(log.isDebugEnabled()){
> log.debug("Adding cache to classpath");
> }
>
> Added:
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
> URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java?rev=963508&view=auto
>
==============================================================================
> ---
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
(added)
> +++
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
Mon Jul 12 22:16:54 2010
> @@ -0,0 +1,18 @@
> +
> +package org.apache.axis2.jaxws.wrapper.beans;
> +
> +import javax.xml.ws.WebFault;
> +
> +@WebFault(name = "AddNumbersFault", targetNamespace = "
http://org/test/addnumbers")
> +public class AddNumbersException extends Exception
> +{
> +
> + private String message = null;
> + public AddNumbersException(){}
> + public AddNumbersException(String message){
> + this.message = message;
> + }
> + public String getInfo(){
> + return message;
> + }
> +}
>
> Added:
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
> URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java?rev=963508&view=auto
>
==============================================================================
> ---
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
(added)
> +++
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
Mon Jul 12 22:16:54 2010
> @@ -0,0 +1,15 @@
> +package org.apache.axis2.jaxws.wrapper.beans;
> +
> +
> +
> +@javax.jws.WebService (targetNamespace="http://org/test/addnumbers",
serviceName="AddNumbersService", portName="AddNumbersPort")
> +public class AddNumbersService{
> +
> + public int addNumbers(int arg0, int arg1) throws
AddNumbersException {
> + if(arg0+arg1<0){
> + throw new AddNumbersException("sum is less than
0");
> + }
> + return arg0+arg1;
> + }
> +
> +}
> \ No newline at end of file
>
> Added:
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
> URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java?rev=963508&view=auto
>
==============================================================================
> ---
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
(added)
> +++
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
Mon Jul 12 22:16:54 2010
> @@ -0,0 +1,114 @@
> +/**
> + *
> + */
> +package org.apache.axis2.jaxws.wrapper.beans;
> +
> +
> +import org.apache.axis2.jaxws.Constants;
> +import org.apache.axis2.jaxws.description.DescriptionFactory;
> +import org.apache.axis2.jaxws.description.EndpointDescription;
> +import org.apache.axis2.jaxws.description.EndpointDescriptionJava;
> +import org.apache.axis2.jaxws.description.OperationDescription;
> +import org.apache.axis2.jaxws.description.ServiceDescription;
> +import org.apache.axis2.jaxws.marshaller.MethodMarshaller;
> +import
org.apache.axis2.jaxws.marshaller.factory.MethodMarshallerFactory;
> +import
org.apache.axis2.jaxws.marshaller.impl.alt.DocLitWrappedMinimalMethodMarshaller;
> +import org.apache.axis2.jaxws.unitTest.TestLogger;
> +
> +import java.io.File;
> +
> +import junit.framework.TestCase;
> +
> +public class WrapperBeanMarshallTests extends TestCase {
> + /**
> + * This is the negative test case, when we do not use generated
artifacts from cache
> + * and user did not package wrapper beans, we should see use of
DocLitWrappedMinumumMarshaller.
> + */
> + public void testGetMarshallerOperationDescriptionBooleanNegative()
{
> +
TestLogger.logger.debug("---------------------------------------");
> + TestLogger.logger.debug("test: " + getName());
> +
> + String cache_location = "/target/wscache/classes";
> + try{
> + String baseDir = new
File(System.getProperty("basedir",".")).getCanonicalPath();
> + cache_location = new
File(baseDir+cache_location).getAbsolutePath();
> + TestLogger.logger.debug("cache location ="+cache_location);
> +
> + //Get EndpointDescription.
> + //Set location on AxisConfiguraiton.
> + Class sei = AddNumbersService.class;
> + EndpointDescription description = getEndpointDesc(sei);
> + TestLogger.logger.debug("description objects where created
successfully");
> + OperationDescription[] ops
=description.getEndpointInterfaceDescription().getOperations();
> + assertNotNull( "OperationDescriptions where null", ops);
> + assertTrue("No Operation Descriptions where found",
ops.length>0);
> + OperationDescription op = ops[0];
> + TestLogger.logger.debug("operation found, java
methodName="+op.getJavaMethodName());
> + //Don not Set cache on AxisConfiguration.
> + //get Marshaller, verify its not DoclitWrappedMinimum.
> + TestLogger.logger.debug("ws_cache location NOT set on
AxisConfigContext, location="+cache_location);
> + MethodMarshaller mm =
MethodMarshallerFactory.getMarshaller(op, false);
> + assertNotNull("getMarshaller returned null", mm );
> + TestLogger.logger.debug("MethodMarshaller was created,
type="+mm.getClass().getName());
> + assertTrue("Generated artifacts not found, Method
marshaller should be DocLitWrappedMinimumMarshaller", (mm instanceof
DocLitWrappedMinimalMethodMarshaller));
> + }catch(Exception e){
> + TestLogger.logger.debug("Exception ="+e.getMessage());
> + fail(e.getMessage());
> + }
> +
> + }
> + /**
> + * In this test case user did not package wrapper beans but we add
generated artifacts from cache, we should see use of
> + * DocLitWrappedMarshaller.
> + * Test method for {@link
org.apache.axis2.jaxws.marshaller.factory.MethodMarshallerFactory#getMarshaller(org.apache.axis2.jaxws.description.OperationDescription,
boolean)}.
> + */
> + public void testGetMarshallerOperationDescriptionBoolean() {
> +
TestLogger.logger.debug("---------------------------------------");
> + TestLogger.logger.debug("test: " + getName());
> +
> + String cache_location = "/target/wscache/classes";
> + try{
> + String baseDir = new
File(System.getProperty("basedir",".")).getCanonicalPath();
> + cache_location = new
File(baseDir+cache_location).getAbsolutePath();
> + TestLogger.logger.debug("cache location ="+cache_location);
> +
> + //Get EndpointDescription.
> + //Set location on AxisConfiguraiton.
> + Class sei = AddNumbersService.class;
> + EndpointDescription description = getEndpointDesc(sei);
> + TestLogger.logger.debug("description objects where created
successfully");
> + OperationDescription[] ops
=description.getEndpointInterfaceDescription().getOperations();
> + assertNotNull( "OperationDescriptions where null", ops);
> + assertTrue("No Operation Descriptions where found",
ops.length>0);
> + OperationDescription op = ops[0];
> + TestLogger.logger.debug("operation found, java
methodName="+op.getJavaMethodName());
> + //Set cache on AxisConfiguration.
> + //get Marshaller, verify its not DoclitWrappedMinimum.
> +
description.getServiceDescription().getAxisConfigContext().setProperty(Constants.WS_CACHE,
cache_location);
> + TestLogger.logger.debug("ws_cache location set on
AxisConfigContext, location="+cache_location);
> + MethodMarshaller mm =
MethodMarshallerFactory.getMarshaller(op, false);
> + assertNotNull("getMarshaller returned null", mm );
> + TestLogger.logger.debug("MethodMarshaller was created,
type="+mm.getClass().getName());
> + assertTrue("Generated artifacts are in cache, Method
marshaller should not be DocLitWrappedMinimumMarshaller", !(mm instanceof
DocLitWrappedMinimalMethodMarshaller));
> + }catch(Exception e){
> + TestLogger.logger.debug("Exception ="+e.getMessage());
> + fail(e.getMessage());
> + }
> +
> + }
> +
> + private EndpointDescription getEndpointDesc(Class
implementationClass) {
> + // Use the description factory directly; this will be done
within the JAX-WS runtime
> + ServiceDescription serviceDesc =
> +
DescriptionFactory.createServiceDescription(implementationClass);
> + assertNotNull(serviceDesc);
> +
> + EndpointDescription[] endpointDesc =
serviceDesc.getEndpointDescriptions();
> + assertNotNull(endpointDesc);
> + assertEquals(1, endpointDesc.length);
> +
> + // TODO: How will the JAX-WS dispatcher get the appropriate
port (i.e. endpoint)? Currently assumes [0]
> + EndpointDescription testEndpointDesc = endpointDesc[0];
> + return testEndpointDesc;
> + }
> +}
>
> Added: axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml
> URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml?rev=963508&view=auto
>
==============================================================================
> --- axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml (added)
> +++ axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml Mon Jul 12
22:16:54 2010
> @@ -0,0 +1,34 @@
> +<?xml version="1.0" encoding="UTF-8"?>
> +
> +<project basedir="." default="run-wsgen-tests" name="wsgen-tests">
> +
> + <property name="wscache.output.base.dir" value="target/wscache"
/>
> + <property name="wscache.generated.src.dir"
value="${wscache.output.base.dir}/src" />
> + <property name="wscache.generated.classes.dir"
value="${wscache.output.base.dir}/classes" />
> + <property name="compile.test.classes"
value="target/test-classes" />
> +
> +
> + <target name="run-wsgen-tests" depends="wrapper-beans"/>
> +
> +
> + <target name="create-cache">
> + <mkdir dir="${wscache.output.base.dir}" />
> + <mkdir dir="${wscache.generated.src.dir}" />
> + <mkdir dir="${wscache.generated.classes.dir}" />
> + </target>
> +
> + <target name="wrapper-beans" depends="create-cache">
> + <echo>Generating artifacts for
org.apache.axis2.jaxws.wrapper.beans.AddNumbersService </echo>
> + <wsgen
> +
sei="org.apache.axis2.jaxws.wrapper.beans.AddNumbersService"
> + destdir="${wscache.generated.classes.dir}"
> + resourcedestdir="${wscache.generated.src.dir}"
> + keep="false"
> + verbose="false"
> + genwsdl="true">
> + <classpath>
> + <pathelement path="${compile.test.classes}" />
> + </classpath>
> + </wsgen>
> + </target>
> +</project>
> \ No newline at end of file
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org
Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws: ./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/
test/org/apache/axis2/jaxws/wrapper/ test/org/apache/axis2/jaxws/wrapper/beans/
Posted by Nikhil V Thaker <ni...@us.ibm.com>.
Andreas - I had to add the tools.jar bit because maven plugin for wsGen
gave NoClassDef Found errors for classes packaged in tools.jar.
Since this is causing a problem I will just package the generated
artifacts and remove the wsGen dependency.
Thanks,
Nikhil Thaker
office: 919 254 9964
nvthaker@us.ibm.com
Andreas Veithen <an...@gmail.com>
07/14/2010 01:44 PM
Please respond to
java-dev@axis.apache.org
To
java-dev@axis.apache.org
cc
Subject
Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws: ./
src/org/apache/axis2/jaxws/runtime/description/marshal/impl/
test/org/apache/axis2/jaxws/wrapper/
test/org/apache/axis2/jaxws/wrapper/beans/
Nikhil,
I have some issues with the tools and jaxws-tools dependencies
introduced by this change:
* The change causes a build failure in Hudson. There will also be
additional issues with tools.jar, because the way to declare this as a
system dependency varies from one JDK to another. For example, I
remember that on Mac OS X, it is completely different than on other
JDKs.
* I don't like the fact that jaxws-tools becomes a dependency of
axis2-jaxws in scope compile, because it looks like this is only
needed during the build and/or during the tests.
I didn't review the change in detail, but wouldn't it be smarter to
use one of the existing Maven plugins to do the wsgen stuff? They will
take care of the tools.jar stuff as well.
Andreas
On Tue, Jul 13, 2010 at 00:16, <nt...@apache.org> wrote:
> Author: nthaker
> Date: Mon Jul 12 22:16:54 2010
> New Revision: 963508
>
> URL: http://svn.apache.org/viewvc?rev=963508&view=rev
> Log:
> AXIS2-4775
> This change ensures that we will use Request and Response wrapper Bean
packaged by customer or we will Generate Wrappers if they are not
packaged.
>
> Added:
>
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/
>
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/
>
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
>
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
>
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
> axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml
> Modified:
> axis/axis2/java/core/trunk/modules/jaxws/pom.xml
>
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
>
> Modified: axis/axis2/java/core/trunk/modules/jaxws/pom.xml
> URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/pom.xml?rev=963508&r1=963507&r2=963508&view=diff
>
==============================================================================
> --- axis/axis2/java/core/trunk/modules/jaxws/pom.xml (original)
> +++ axis/axis2/java/core/trunk/modules/jaxws/pom.xml Mon Jul 12 22:16:54
2010
> @@ -1,5 +1,4 @@
> <?xml version="1.0" encoding="UTF-8"?>
> -
> <!--
> ~ Licensed to the Apache Software Foundation (ASF) under one
> ~ or more contributor license agreements. See the NOTICE file
> @@ -20,7 +19,7 @@
> -->
>
> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"
> - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
> <modelVersion>4.0.0</modelVersion>
> <parent>
> <groupId>org.apache.axis2</groupId>
> @@ -98,7 +97,25 @@
> <version>${version}</version>
> <scope>test</scope>
> </dependency>
> + <dependency>
> + <groupId>wsdl4j</groupId>
> + <artifactId>wsdl4j</artifactId>
> + </dependency>
> + <dependency>
> + <groupId>com.sun.xml.ws</groupId>
> + <artifactId>jaxws-tools</artifactId>
> + <version>2.1.3</version>
> + </dependency>
> + <!-- If we dont include tools.jar as dependency, maven throws
NoClassDefFound on wsGen run -->
> + <dependency>
> + <groupId>java</groupId>
> + <artifactId>tools</artifactId>
> + <version>$version</version>
> + <scope>system</scope>
> + <systemPath>${JAVA_HOME}/lib/tools.jar</systemPath>
> + </dependency>
> </dependencies>
> +
> <build>
> <sourceDirectory>src</sourceDirectory>
> <testSourceDirectory>test</testSourceDirectory>
> @@ -203,34 +220,39 @@
> <compilerVersion>1.5</compilerVersion>
> <source>1.5</source>
> <target>1.5</target>
> +
> </configuration>
> </plugin>
> <plugin>
> <groupId>org.apache.maven.plugins</groupId>
> <artifactId>maven-antrun-plugin</artifactId>
> +
> <executions>
> <execution>
> <id>gen-ts</id>
> <phase>generate-test-sources</phase>
> <configuration>
> - <tasks unless="maven.test.skip">
> + <tasks unless="maven.test.skip">
> <!-- Theres got to be a better way to do
this -->
> <property name="schema.source.dir"
value="test-resources/xsd"/>
> <property name="wsdl.source.dir"
value="test-resources/wsdl"/>
> - <property name="schema.output.base.dir"
value="target/schema"/>
> + <property name="schema.output.base.dir"
value="target/schema"/>
> <property
name="schema.generated.src.dir" value="${schema.output.base.dir}/src"/>
> <property
name="schema.generated.classes.dir"
>
value="${schema.output.base.dir}/classes"/>
> +
> <!-- make the dirs -->
> <mkdir dir="${schema.output.base.dir}"/>
> <mkdir
dir="${schema.generated.src.dir}"/>
> <mkdir
dir="${schema.generated.classes.dir}"/>
> +
> <!-- Run JAXB schema compiler with
designated schemas -->
> <echo>Generating JAX-B classes from
XSDs</echo>
>
> <echo>Generating java from
echo.xsd</echo>
> <java
classname="com.sun.tools.xjc.Driver" fork="true">
> <classpath
refid="maven.runtime.classpath"/>
> +
> <classpath
location="${compiled.classes.dir}"/>
> <arg line="-d
${schema.generated.src.dir} -quiet ${schema.source.dir}/echo.xsd"/>
> </java>
> @@ -266,7 +288,7 @@
> <classpath
refid="maven.runtime.classpath"/>
> <classpath
location="${compiled.classes.dir}"/>
> <arg line="-d
${schema.generated.src.dir} -quiet -wsdl
${wsdl.source.dir}/AddNumbers.wsdl"/>
> - </java>
> + </java>
> </tasks>
> </configuration>
> <goals>
> @@ -287,6 +309,22 @@
> <property name="addressing_version"
value="${version}"/>
> <ant antfile="build.xml"
inheritall="true" inheritrefs="true"
> dir="." target="build-repo"/>
> +
> +
<property name="compile_classpath" refid="maven.compile.classpath" />
> +
<property name="runtime_classpath" refid="maven.runtime.classpath" />
> +
<property name="test_classpath" refid="maven.test.classpath" />
> +
<property name="plugin_classpath" refid="maven.plugin.classpath" />
> +
> + <!-- Defining wsGen task -->
> + <taskdef
name="wsgen" loaderRef="refwsgen" classname="com.sun.tools.ws.ant.WsGen">
> +
<classpath>
> +
<path refid="maven.runtime.classpath" />
> +
<path refid="maven.compile.classpath" />
> +
</classpath>
> +
</taskdef>
> + <!--
Invoking test cases that need to generate artifacts using wsGen -->
> + <ant antfile="wsgen-tests.xml"
inheritall="true" inheritrefs="true"
> + dir="." target="run-wsgen-tests"/>
> </tasks>
> </configuration>
> <goals>
> @@ -374,6 +412,13 @@
> <plugin>
> <groupId>org.apache.maven.plugins</groupId>
> <artifactId>maven-surefire-report-plugin</artifactId>
> + <reportSets>
> + <reportSet>
> + <reports>
> + <report>report-only</report>
> + </reports>
> + </reportSet>
> + </reportSets>
> </plugin>
> </plugins>
> </reporting>
>
> Modified:
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
> URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java?rev=963508&r1=963507&r2=963508&view=diff
>
==============================================================================
> ---
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
(original)
> +++
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
Mon Jul 12 22:16:54 2010
> @@ -238,12 +238,27 @@ class ArtifactProcessor {
> wrapperClass = newValue;
> }
> }
> - if(cls==null && (type.equals("@WebFault")||
type.equals("faultInfo"))){
> +
> + if(cls==null &&
> + (type.equals("@RequestWrapper")||
type.equals("@ResponseWrapper")||type.equals("@WebFault")||
type.equals("faultInfo"))){
> +
> + //Support for Fault Bean Generation
> //As per JAX-WS 2.2 Specification section
3.7 an application programmer can choose not to
> //package the faultBeans, if we have reached
this point in the code then user has choosen
> //not to package the fault bean. If there is
a cache of generated artifacts available then
> //lets look for the missing faultBean there.
> -
> +
> + //Support for Wrapper Bean Generation
> + //As per JAX-WS 2.2 Specificaiton section
3.6.2.1 pg 41 an application programmer does not use
> + //the wrapper bean classes, so the
application need not package these classes. If we have reached
> + //this point in the code then user has
choosen not to package these beans.
> +
> + //NOTE:If we find Generated artifacts from
cache this guarantees that we will not use
> + //DocLitWrappedMinimum marshaller code. The
advantage of normal DocLitWrappedMarshaller is
> + //that it is very robust and has support of
lot more datatypes than in DocLitWrappedMinimum.
> + if(log.isDebugEnabled()){
> + log.debug("Adding cache to classpath");
> + }
> ClassFinderFactory cff =
>
(ClassFinderFactory)FactoryRegistry.getFactory(ClassFinderFactory.class);
> ClassFinder cf = cff.getClassFinder();
> @@ -317,11 +332,26 @@ class ArtifactProcessor {
> if (cls2 == null) {
> cls2 = loadClassOrNull(defaultValue,
altClassLoader);
> }
> - if(cls2==null && (type.equals("faultInfo")||
type.equals("@WebFault"))){
> - //As per JAX-WS 2.2 Specification section
3.7 an application programmer can choose not to
> - //package the faultBeans, if we have
reached this point in the code then user has choosen
> - //not to package the fault bean. If there
is a cache of generated artifacts available then
> - //lets look for the missing faultBean
there.
> + if(cls2==null &&
> +
(type.equals("@RequestWrapper")||
type.equals("@ResponseWrapper")||type.equals("@WebFault")||
type.equals("faultInfo"))){
> +
> + //Support for Fault Bean Generation
> + //As per JAX-WS 2.2 Specification
section 3.7 an application programmer can choose not to
> + //package the faultBeans, if we have
reached this point in the code then user has choosen
> + //not to package the fault bean. If
there is a cache of generated artifacts available then
> + //lets look for the missing faultBean
there.
> +
> + //Support for Wrapper Bean Generation
> + //As per JAX-WS 2.2 Specificaiton
section 3.6.2.1 pg 41 an application programmer does not use
> + //the wrapper bean classes, so the
application need not package these classes. If we have reached
> + //this point in the code then user has
choosen not to package these beans.
> +
> + //NOTE:If we find Generated artifacts
from cache this guarantees that we will not use
> + //DocLitWrappedMinimum marshaller code.
The advantage of normal DocLitWrappedMarshaller is
> + //that it is very robust and has support
of lot more datatypes than in DocLitWrappedMinimum.
> + if(log.isDebugEnabled()){
> + log.debug("Adding cache to
classpath");
> + }
> if(log.isDebugEnabled()){
> log.debug("Adding cache to classpath");
> }
>
> Added:
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
> URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java?rev=963508&view=auto
>
==============================================================================
> ---
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
(added)
> +++
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
Mon Jul 12 22:16:54 2010
> @@ -0,0 +1,18 @@
> +
> +package org.apache.axis2.jaxws.wrapper.beans;
> +
> +import javax.xml.ws.WebFault;
> +
> +@WebFault(name = "AddNumbersFault", targetNamespace = "
http://org/test/addnumbers")
> +public class AddNumbersException extends Exception
> +{
> +
> + private String message = null;
> + public AddNumbersException(){}
> + public AddNumbersException(String message){
> + this.message = message;
> + }
> + public String getInfo(){
> + return message;
> + }
> +}
>
> Added:
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
> URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java?rev=963508&view=auto
>
==============================================================================
> ---
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
(added)
> +++
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
Mon Jul 12 22:16:54 2010
> @@ -0,0 +1,15 @@
> +package org.apache.axis2.jaxws.wrapper.beans;
> +
> +
> +
> +@javax.jws.WebService (targetNamespace="http://org/test/addnumbers",
serviceName="AddNumbersService", portName="AddNumbersPort")
> +public class AddNumbersService{
> +
> + public int addNumbers(int arg0, int arg1) throws
AddNumbersException {
> + if(arg0+arg1<0){
> + throw new AddNumbersException("sum is less than
0");
> + }
> + return arg0+arg1;
> + }
> +
> +}
> \ No newline at end of file
>
> Added:
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
> URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java?rev=963508&view=auto
>
==============================================================================
> ---
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
(added)
> +++
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
Mon Jul 12 22:16:54 2010
> @@ -0,0 +1,114 @@
> +/**
> + *
> + */
> +package org.apache.axis2.jaxws.wrapper.beans;
> +
> +
> +import org.apache.axis2.jaxws.Constants;
> +import org.apache.axis2.jaxws.description.DescriptionFactory;
> +import org.apache.axis2.jaxws.description.EndpointDescription;
> +import org.apache.axis2.jaxws.description.EndpointDescriptionJava;
> +import org.apache.axis2.jaxws.description.OperationDescription;
> +import org.apache.axis2.jaxws.description.ServiceDescription;
> +import org.apache.axis2.jaxws.marshaller.MethodMarshaller;
> +import
org.apache.axis2.jaxws.marshaller.factory.MethodMarshallerFactory;
> +import
org.apache.axis2.jaxws.marshaller.impl.alt.DocLitWrappedMinimalMethodMarshaller;
> +import org.apache.axis2.jaxws.unitTest.TestLogger;
> +
> +import java.io.File;
> +
> +import junit.framework.TestCase;
> +
> +public class WrapperBeanMarshallTests extends TestCase {
> + /**
> + * This is the negative test case, when we do not use generated
artifacts from cache
> + * and user did not package wrapper beans, we should see use of
DocLitWrappedMinumumMarshaller.
> + */
> + public void testGetMarshallerOperationDescriptionBooleanNegative()
{
> +
TestLogger.logger.debug("---------------------------------------");
> + TestLogger.logger.debug("test: " + getName());
> +
> + String cache_location = "/target/wscache/classes";
> + try{
> + String baseDir = new
File(System.getProperty("basedir",".")).getCanonicalPath();
> + cache_location = new
File(baseDir+cache_location).getAbsolutePath();
> + TestLogger.logger.debug("cache location ="+cache_location);
> +
> + //Get EndpointDescription.
> + //Set location on AxisConfiguraiton.
> + Class sei = AddNumbersService.class;
> + EndpointDescription description = getEndpointDesc(sei);
> + TestLogger.logger.debug("description objects where created
successfully");
> + OperationDescription[] ops
=description.getEndpointInterfaceDescription().getOperations();
> + assertNotNull( "OperationDescriptions where null", ops);
> + assertTrue("No Operation Descriptions where found",
ops.length>0);
> + OperationDescription op = ops[0];
> + TestLogger.logger.debug("operation found, java
methodName="+op.getJavaMethodName());
> + //Don not Set cache on AxisConfiguration.
> + //get Marshaller, verify its not DoclitWrappedMinimum.
> + TestLogger.logger.debug("ws_cache location NOT set on
AxisConfigContext, location="+cache_location);
> + MethodMarshaller mm =
MethodMarshallerFactory.getMarshaller(op, false);
> + assertNotNull("getMarshaller returned null", mm );
> + TestLogger.logger.debug("MethodMarshaller was created,
type="+mm.getClass().getName());
> + assertTrue("Generated artifacts not found, Method
marshaller should be DocLitWrappedMinimumMarshaller", (mm instanceof
DocLitWrappedMinimalMethodMarshaller));
> + }catch(Exception e){
> + TestLogger.logger.debug("Exception ="+e.getMessage());
> + fail(e.getMessage());
> + }
> +
> + }
> + /**
> + * In this test case user did not package wrapper beans but we add
generated artifacts from cache, we should see use of
> + * DocLitWrappedMarshaller.
> + * Test method for {@link
org.apache.axis2.jaxws.marshaller.factory.MethodMarshallerFactory#getMarshaller(org.apache.axis2.jaxws.description.OperationDescription,
boolean)}.
> + */
> + public void testGetMarshallerOperationDescriptionBoolean() {
> +
TestLogger.logger.debug("---------------------------------------");
> + TestLogger.logger.debug("test: " + getName());
> +
> + String cache_location = "/target/wscache/classes";
> + try{
> + String baseDir = new
File(System.getProperty("basedir",".")).getCanonicalPath();
> + cache_location = new
File(baseDir+cache_location).getAbsolutePath();
> + TestLogger.logger.debug("cache location ="+cache_location);
> +
> + //Get EndpointDescription.
> + //Set location on AxisConfiguraiton.
> + Class sei = AddNumbersService.class;
> + EndpointDescription description = getEndpointDesc(sei);
> + TestLogger.logger.debug("description objects where created
successfully");
> + OperationDescription[] ops
=description.getEndpointInterfaceDescription().getOperations();
> + assertNotNull( "OperationDescriptions where null", ops);
> + assertTrue("No Operation Descriptions where found",
ops.length>0);
> + OperationDescription op = ops[0];
> + TestLogger.logger.debug("operation found, java
methodName="+op.getJavaMethodName());
> + //Set cache on AxisConfiguration.
> + //get Marshaller, verify its not DoclitWrappedMinimum.
> +
description.getServiceDescription().getAxisConfigContext().setProperty(Constants.WS_CACHE,
cache_location);
> + TestLogger.logger.debug("ws_cache location set on
AxisConfigContext, location="+cache_location);
> + MethodMarshaller mm =
MethodMarshallerFactory.getMarshaller(op, false);
> + assertNotNull("getMarshaller returned null", mm );
> + TestLogger.logger.debug("MethodMarshaller was created,
type="+mm.getClass().getName());
> + assertTrue("Generated artifacts are in cache, Method
marshaller should not be DocLitWrappedMinimumMarshaller", !(mm instanceof
DocLitWrappedMinimalMethodMarshaller));
> + }catch(Exception e){
> + TestLogger.logger.debug("Exception ="+e.getMessage());
> + fail(e.getMessage());
> + }
> +
> + }
> +
> + private EndpointDescription getEndpointDesc(Class
implementationClass) {
> + // Use the description factory directly; this will be done
within the JAX-WS runtime
> + ServiceDescription serviceDesc =
> +
DescriptionFactory.createServiceDescription(implementationClass);
> + assertNotNull(serviceDesc);
> +
> + EndpointDescription[] endpointDesc =
serviceDesc.getEndpointDescriptions();
> + assertNotNull(endpointDesc);
> + assertEquals(1, endpointDesc.length);
> +
> + // TODO: How will the JAX-WS dispatcher get the appropriate
port (i.e. endpoint)? Currently assumes [0]
> + EndpointDescription testEndpointDesc = endpointDesc[0];
> + return testEndpointDesc;
> + }
> +}
>
> Added: axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml
> URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml?rev=963508&view=auto
>
==============================================================================
> --- axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml (added)
> +++ axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml Mon Jul 12
22:16:54 2010
> @@ -0,0 +1,34 @@
> +<?xml version="1.0" encoding="UTF-8"?>
> +
> +<project basedir="." default="run-wsgen-tests" name="wsgen-tests">
> +
> + <property name="wscache.output.base.dir" value="target/wscache"
/>
> + <property name="wscache.generated.src.dir"
value="${wscache.output.base.dir}/src" />
> + <property name="wscache.generated.classes.dir"
value="${wscache.output.base.dir}/classes" />
> + <property name="compile.test.classes"
value="target/test-classes" />
> +
> +
> + <target name="run-wsgen-tests" depends="wrapper-beans"/>
> +
> +
> + <target name="create-cache">
> + <mkdir dir="${wscache.output.base.dir}" />
> + <mkdir dir="${wscache.generated.src.dir}" />
> + <mkdir dir="${wscache.generated.classes.dir}" />
> + </target>
> +
> + <target name="wrapper-beans" depends="create-cache">
> + <echo>Generating artifacts for
org.apache.axis2.jaxws.wrapper.beans.AddNumbersService </echo>
> + <wsgen
> +
sei="org.apache.axis2.jaxws.wrapper.beans.AddNumbersService"
> + destdir="${wscache.generated.classes.dir}"
> + resourcedestdir="${wscache.generated.src.dir}"
> + keep="false"
> + verbose="false"
> + genwsdl="true">
> + <classpath>
> + <pathelement path="${compile.test.classes}" />
> + </classpath>
> + </wsgen>
> + </target>
> +</project>
> \ No newline at end of file
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org
Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws: ./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/
test/org/apache/axis2/jaxws/wrapper/ test/org/apache/axis2/jaxws/wrapper/beans/
Posted by Nikhil V Thaker <ni...@us.ibm.com>.
Andreas - I had to add the tools.jar bit because maven plugin for wsGen
gave NoClassDef Found errors for classes packaged in tools.jar.
Since this is causing a problem I will just package the generated
artifacts and remove the wsGen dependency.
Thanks,
Nikhil Thaker
office: 919 254 9964
nvthaker@us.ibm.com
Andreas Veithen <an...@gmail.com>
07/14/2010 01:44 PM
Please respond to
java-dev@axis.apache.org
To
java-dev@axis.apache.org
cc
Subject
Re: svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws: ./
src/org/apache/axis2/jaxws/runtime/description/marshal/impl/
test/org/apache/axis2/jaxws/wrapper/
test/org/apache/axis2/jaxws/wrapper/beans/
Nikhil,
I have some issues with the tools and jaxws-tools dependencies
introduced by this change:
* The change causes a build failure in Hudson. There will also be
additional issues with tools.jar, because the way to declare this as a
system dependency varies from one JDK to another. For example, I
remember that on Mac OS X, it is completely different than on other
JDKs.
* I don't like the fact that jaxws-tools becomes a dependency of
axis2-jaxws in scope compile, because it looks like this is only
needed during the build and/or during the tests.
I didn't review the change in detail, but wouldn't it be smarter to
use one of the existing Maven plugins to do the wsgen stuff? They will
take care of the tools.jar stuff as well.
Andreas
On Tue, Jul 13, 2010 at 00:16, <nt...@apache.org> wrote:
> Author: nthaker
> Date: Mon Jul 12 22:16:54 2010
> New Revision: 963508
>
> URL: http://svn.apache.org/viewvc?rev=963508&view=rev
> Log:
> AXIS2-4775
> This change ensures that we will use Request and Response wrapper Bean
packaged by customer or we will Generate Wrappers if they are not
packaged.
>
> Added:
>
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/
>
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/
>
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
>
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
>
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
> axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml
> Modified:
> axis/axis2/java/core/trunk/modules/jaxws/pom.xml
>
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
>
> Modified: axis/axis2/java/core/trunk/modules/jaxws/pom.xml
> URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/pom.xml?rev=963508&r1=963507&r2=963508&view=diff
>
==============================================================================
> --- axis/axis2/java/core/trunk/modules/jaxws/pom.xml (original)
> +++ axis/axis2/java/core/trunk/modules/jaxws/pom.xml Mon Jul 12 22:16:54
2010
> @@ -1,5 +1,4 @@
> <?xml version="1.0" encoding="UTF-8"?>
> -
> <!--
> ~ Licensed to the Apache Software Foundation (ASF) under one
> ~ or more contributor license agreements. See the NOTICE file
> @@ -20,7 +19,7 @@
> -->
>
> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"
> - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
> <modelVersion>4.0.0</modelVersion>
> <parent>
> <groupId>org.apache.axis2</groupId>
> @@ -98,7 +97,25 @@
> <version>${version}</version>
> <scope>test</scope>
> </dependency>
> + <dependency>
> + <groupId>wsdl4j</groupId>
> + <artifactId>wsdl4j</artifactId>
> + </dependency>
> + <dependency>
> + <groupId>com.sun.xml.ws</groupId>
> + <artifactId>jaxws-tools</artifactId>
> + <version>2.1.3</version>
> + </dependency>
> + <!-- If we dont include tools.jar as dependency, maven throws
NoClassDefFound on wsGen run -->
> + <dependency>
> + <groupId>java</groupId>
> + <artifactId>tools</artifactId>
> + <version>$version</version>
> + <scope>system</scope>
> + <systemPath>${JAVA_HOME}/lib/tools.jar</systemPath>
> + </dependency>
> </dependencies>
> +
> <build>
> <sourceDirectory>src</sourceDirectory>
> <testSourceDirectory>test</testSourceDirectory>
> @@ -203,34 +220,39 @@
> <compilerVersion>1.5</compilerVersion>
> <source>1.5</source>
> <target>1.5</target>
> +
> </configuration>
> </plugin>
> <plugin>
> <groupId>org.apache.maven.plugins</groupId>
> <artifactId>maven-antrun-plugin</artifactId>
> +
> <executions>
> <execution>
> <id>gen-ts</id>
> <phase>generate-test-sources</phase>
> <configuration>
> - <tasks unless="maven.test.skip">
> + <tasks unless="maven.test.skip">
> <!-- Theres got to be a better way to do
this -->
> <property name="schema.source.dir"
value="test-resources/xsd"/>
> <property name="wsdl.source.dir"
value="test-resources/wsdl"/>
> - <property name="schema.output.base.dir"
value="target/schema"/>
> + <property name="schema.output.base.dir"
value="target/schema"/>
> <property
name="schema.generated.src.dir" value="${schema.output.base.dir}/src"/>
> <property
name="schema.generated.classes.dir"
>
value="${schema.output.base.dir}/classes"/>
> +
> <!-- make the dirs -->
> <mkdir dir="${schema.output.base.dir}"/>
> <mkdir
dir="${schema.generated.src.dir}"/>
> <mkdir
dir="${schema.generated.classes.dir}"/>
> +
> <!-- Run JAXB schema compiler with
designated schemas -->
> <echo>Generating JAX-B classes from
XSDs</echo>
>
> <echo>Generating java from
echo.xsd</echo>
> <java
classname="com.sun.tools.xjc.Driver" fork="true">
> <classpath
refid="maven.runtime.classpath"/>
> +
> <classpath
location="${compiled.classes.dir}"/>
> <arg line="-d
${schema.generated.src.dir} -quiet ${schema.source.dir}/echo.xsd"/>
> </java>
> @@ -266,7 +288,7 @@
> <classpath
refid="maven.runtime.classpath"/>
> <classpath
location="${compiled.classes.dir}"/>
> <arg line="-d
${schema.generated.src.dir} -quiet -wsdl
${wsdl.source.dir}/AddNumbers.wsdl"/>
> - </java>
> + </java>
> </tasks>
> </configuration>
> <goals>
> @@ -287,6 +309,22 @@
> <property name="addressing_version"
value="${version}"/>
> <ant antfile="build.xml"
inheritall="true" inheritrefs="true"
> dir="." target="build-repo"/>
> +
> +
<property name="compile_classpath" refid="maven.compile.classpath" />
> +
<property name="runtime_classpath" refid="maven.runtime.classpath" />
> +
<property name="test_classpath" refid="maven.test.classpath" />
> +
<property name="plugin_classpath" refid="maven.plugin.classpath" />
> +
> + <!-- Defining wsGen task -->
> + <taskdef
name="wsgen" loaderRef="refwsgen" classname="com.sun.tools.ws.ant.WsGen">
> +
<classpath>
> +
<path refid="maven.runtime.classpath" />
> +
<path refid="maven.compile.classpath" />
> +
</classpath>
> +
</taskdef>
> + <!--
Invoking test cases that need to generate artifacts using wsGen -->
> + <ant antfile="wsgen-tests.xml"
inheritall="true" inheritrefs="true"
> + dir="." target="run-wsgen-tests"/>
> </tasks>
> </configuration>
> <goals>
> @@ -374,6 +412,13 @@
> <plugin>
> <groupId>org.apache.maven.plugins</groupId>
> <artifactId>maven-surefire-report-plugin</artifactId>
> + <reportSets>
> + <reportSet>
> + <reports>
> + <report>report-only</report>
> + </reports>
> + </reportSet>
> + </reportSets>
> </plugin>
> </plugins>
> </reporting>
>
> Modified:
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
> URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java?rev=963508&r1=963507&r2=963508&view=diff
>
==============================================================================
> ---
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
(original)
> +++
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
Mon Jul 12 22:16:54 2010
> @@ -238,12 +238,27 @@ class ArtifactProcessor {
> wrapperClass = newValue;
> }
> }
> - if(cls==null && (type.equals("@WebFault")||
type.equals("faultInfo"))){
> +
> + if(cls==null &&
> + (type.equals("@RequestWrapper")||
type.equals("@ResponseWrapper")||type.equals("@WebFault")||
type.equals("faultInfo"))){
> +
> + //Support for Fault Bean Generation
> //As per JAX-WS 2.2 Specification section
3.7 an application programmer can choose not to
> //package the faultBeans, if we have reached
this point in the code then user has choosen
> //not to package the fault bean. If there is
a cache of generated artifacts available then
> //lets look for the missing faultBean there.
> -
> +
> + //Support for Wrapper Bean Generation
> + //As per JAX-WS 2.2 Specificaiton section
3.6.2.1 pg 41 an application programmer does not use
> + //the wrapper bean classes, so the
application need not package these classes. If we have reached
> + //this point in the code then user has
choosen not to package these beans.
> +
> + //NOTE:If we find Generated artifacts from
cache this guarantees that we will not use
> + //DocLitWrappedMinimum marshaller code. The
advantage of normal DocLitWrappedMarshaller is
> + //that it is very robust and has support of
lot more datatypes than in DocLitWrappedMinimum.
> + if(log.isDebugEnabled()){
> + log.debug("Adding cache to classpath");
> + }
> ClassFinderFactory cff =
>
(ClassFinderFactory)FactoryRegistry.getFactory(ClassFinderFactory.class);
> ClassFinder cf = cff.getClassFinder();
> @@ -317,11 +332,26 @@ class ArtifactProcessor {
> if (cls2 == null) {
> cls2 = loadClassOrNull(defaultValue,
altClassLoader);
> }
> - if(cls2==null && (type.equals("faultInfo")||
type.equals("@WebFault"))){
> - //As per JAX-WS 2.2 Specification section
3.7 an application programmer can choose not to
> - //package the faultBeans, if we have
reached this point in the code then user has choosen
> - //not to package the fault bean. If there
is a cache of generated artifacts available then
> - //lets look for the missing faultBean
there.
> + if(cls2==null &&
> +
(type.equals("@RequestWrapper")||
type.equals("@ResponseWrapper")||type.equals("@WebFault")||
type.equals("faultInfo"))){
> +
> + //Support for Fault Bean Generation
> + //As per JAX-WS 2.2 Specification
section 3.7 an application programmer can choose not to
> + //package the faultBeans, if we have
reached this point in the code then user has choosen
> + //not to package the fault bean. If
there is a cache of generated artifacts available then
> + //lets look for the missing faultBean
there.
> +
> + //Support for Wrapper Bean Generation
> + //As per JAX-WS 2.2 Specificaiton
section 3.6.2.1 pg 41 an application programmer does not use
> + //the wrapper bean classes, so the
application need not package these classes. If we have reached
> + //this point in the code then user has
choosen not to package these beans.
> +
> + //NOTE:If we find Generated artifacts
from cache this guarantees that we will not use
> + //DocLitWrappedMinimum marshaller code.
The advantage of normal DocLitWrappedMarshaller is
> + //that it is very robust and has support
of lot more datatypes than in DocLitWrappedMinimum.
> + if(log.isDebugEnabled()){
> + log.debug("Adding cache to
classpath");
> + }
> if(log.isDebugEnabled()){
> log.debug("Adding cache to classpath");
> }
>
> Added:
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
> URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java?rev=963508&view=auto
>
==============================================================================
> ---
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
(added)
> +++
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
Mon Jul 12 22:16:54 2010
> @@ -0,0 +1,18 @@
> +
> +package org.apache.axis2.jaxws.wrapper.beans;
> +
> +import javax.xml.ws.WebFault;
> +
> +@WebFault(name = "AddNumbersFault", targetNamespace = "
http://org/test/addnumbers")
> +public class AddNumbersException extends Exception
> +{
> +
> + private String message = null;
> + public AddNumbersException(){}
> + public AddNumbersException(String message){
> + this.message = message;
> + }
> + public String getInfo(){
> + return message;
> + }
> +}
>
> Added:
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
> URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java?rev=963508&view=auto
>
==============================================================================
> ---
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
(added)
> +++
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
Mon Jul 12 22:16:54 2010
> @@ -0,0 +1,15 @@
> +package org.apache.axis2.jaxws.wrapper.beans;
> +
> +
> +
> +@javax.jws.WebService (targetNamespace="http://org/test/addnumbers",
serviceName="AddNumbersService", portName="AddNumbersPort")
> +public class AddNumbersService{
> +
> + public int addNumbers(int arg0, int arg1) throws
AddNumbersException {
> + if(arg0+arg1<0){
> + throw new AddNumbersException("sum is less than
0");
> + }
> + return arg0+arg1;
> + }
> +
> +}
> \ No newline at end of file
>
> Added:
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
> URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java?rev=963508&view=auto
>
==============================================================================
> ---
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
(added)
> +++
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
Mon Jul 12 22:16:54 2010
> @@ -0,0 +1,114 @@
> +/**
> + *
> + */
> +package org.apache.axis2.jaxws.wrapper.beans;
> +
> +
> +import org.apache.axis2.jaxws.Constants;
> +import org.apache.axis2.jaxws.description.DescriptionFactory;
> +import org.apache.axis2.jaxws.description.EndpointDescription;
> +import org.apache.axis2.jaxws.description.EndpointDescriptionJava;
> +import org.apache.axis2.jaxws.description.OperationDescription;
> +import org.apache.axis2.jaxws.description.ServiceDescription;
> +import org.apache.axis2.jaxws.marshaller.MethodMarshaller;
> +import
org.apache.axis2.jaxws.marshaller.factory.MethodMarshallerFactory;
> +import
org.apache.axis2.jaxws.marshaller.impl.alt.DocLitWrappedMinimalMethodMarshaller;
> +import org.apache.axis2.jaxws.unitTest.TestLogger;
> +
> +import java.io.File;
> +
> +import junit.framework.TestCase;
> +
> +public class WrapperBeanMarshallTests extends TestCase {
> + /**
> + * This is the negative test case, when we do not use generated
artifacts from cache
> + * and user did not package wrapper beans, we should see use of
DocLitWrappedMinumumMarshaller.
> + */
> + public void testGetMarshallerOperationDescriptionBooleanNegative()
{
> +
TestLogger.logger.debug("---------------------------------------");
> + TestLogger.logger.debug("test: " + getName());
> +
> + String cache_location = "/target/wscache/classes";
> + try{
> + String baseDir = new
File(System.getProperty("basedir",".")).getCanonicalPath();
> + cache_location = new
File(baseDir+cache_location).getAbsolutePath();
> + TestLogger.logger.debug("cache location ="+cache_location);
> +
> + //Get EndpointDescription.
> + //Set location on AxisConfiguraiton.
> + Class sei = AddNumbersService.class;
> + EndpointDescription description = getEndpointDesc(sei);
> + TestLogger.logger.debug("description objects where created
successfully");
> + OperationDescription[] ops
=description.getEndpointInterfaceDescription().getOperations();
> + assertNotNull( "OperationDescriptions where null", ops);
> + assertTrue("No Operation Descriptions where found",
ops.length>0);
> + OperationDescription op = ops[0];
> + TestLogger.logger.debug("operation found, java
methodName="+op.getJavaMethodName());
> + //Don not Set cache on AxisConfiguration.
> + //get Marshaller, verify its not DoclitWrappedMinimum.
> + TestLogger.logger.debug("ws_cache location NOT set on
AxisConfigContext, location="+cache_location);
> + MethodMarshaller mm =
MethodMarshallerFactory.getMarshaller(op, false);
> + assertNotNull("getMarshaller returned null", mm );
> + TestLogger.logger.debug("MethodMarshaller was created,
type="+mm.getClass().getName());
> + assertTrue("Generated artifacts not found, Method
marshaller should be DocLitWrappedMinimumMarshaller", (mm instanceof
DocLitWrappedMinimalMethodMarshaller));
> + }catch(Exception e){
> + TestLogger.logger.debug("Exception ="+e.getMessage());
> + fail(e.getMessage());
> + }
> +
> + }
> + /**
> + * In this test case user did not package wrapper beans but we add
generated artifacts from cache, we should see use of
> + * DocLitWrappedMarshaller.
> + * Test method for {@link
org.apache.axis2.jaxws.marshaller.factory.MethodMarshallerFactory#getMarshaller(org.apache.axis2.jaxws.description.OperationDescription,
boolean)}.
> + */
> + public void testGetMarshallerOperationDescriptionBoolean() {
> +
TestLogger.logger.debug("---------------------------------------");
> + TestLogger.logger.debug("test: " + getName());
> +
> + String cache_location = "/target/wscache/classes";
> + try{
> + String baseDir = new
File(System.getProperty("basedir",".")).getCanonicalPath();
> + cache_location = new
File(baseDir+cache_location).getAbsolutePath();
> + TestLogger.logger.debug("cache location ="+cache_location);
> +
> + //Get EndpointDescription.
> + //Set location on AxisConfiguraiton.
> + Class sei = AddNumbersService.class;
> + EndpointDescription description = getEndpointDesc(sei);
> + TestLogger.logger.debug("description objects where created
successfully");
> + OperationDescription[] ops
=description.getEndpointInterfaceDescription().getOperations();
> + assertNotNull( "OperationDescriptions where null", ops);
> + assertTrue("No Operation Descriptions where found",
ops.length>0);
> + OperationDescription op = ops[0];
> + TestLogger.logger.debug("operation found, java
methodName="+op.getJavaMethodName());
> + //Set cache on AxisConfiguration.
> + //get Marshaller, verify its not DoclitWrappedMinimum.
> +
description.getServiceDescription().getAxisConfigContext().setProperty(Constants.WS_CACHE,
cache_location);
> + TestLogger.logger.debug("ws_cache location set on
AxisConfigContext, location="+cache_location);
> + MethodMarshaller mm =
MethodMarshallerFactory.getMarshaller(op, false);
> + assertNotNull("getMarshaller returned null", mm );
> + TestLogger.logger.debug("MethodMarshaller was created,
type="+mm.getClass().getName());
> + assertTrue("Generated artifacts are in cache, Method
marshaller should not be DocLitWrappedMinimumMarshaller", !(mm instanceof
DocLitWrappedMinimalMethodMarshaller));
> + }catch(Exception e){
> + TestLogger.logger.debug("Exception ="+e.getMessage());
> + fail(e.getMessage());
> + }
> +
> + }
> +
> + private EndpointDescription getEndpointDesc(Class
implementationClass) {
> + // Use the description factory directly; this will be done
within the JAX-WS runtime
> + ServiceDescription serviceDesc =
> +
DescriptionFactory.createServiceDescription(implementationClass);
> + assertNotNull(serviceDesc);
> +
> + EndpointDescription[] endpointDesc =
serviceDesc.getEndpointDescriptions();
> + assertNotNull(endpointDesc);
> + assertEquals(1, endpointDesc.length);
> +
> + // TODO: How will the JAX-WS dispatcher get the appropriate
port (i.e. endpoint)? Currently assumes [0]
> + EndpointDescription testEndpointDesc = endpointDesc[0];
> + return testEndpointDesc;
> + }
> +}
>
> Added: axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml
> URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml?rev=963508&view=auto
>
==============================================================================
> --- axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml (added)
> +++ axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml Mon Jul 12
22:16:54 2010
> @@ -0,0 +1,34 @@
> +<?xml version="1.0" encoding="UTF-8"?>
> +
> +<project basedir="." default="run-wsgen-tests" name="wsgen-tests">
> +
> + <property name="wscache.output.base.dir" value="target/wscache"
/>
> + <property name="wscache.generated.src.dir"
value="${wscache.output.base.dir}/src" />
> + <property name="wscache.generated.classes.dir"
value="${wscache.output.base.dir}/classes" />
> + <property name="compile.test.classes"
value="target/test-classes" />
> +
> +
> + <target name="run-wsgen-tests" depends="wrapper-beans"/>
> +
> +
> + <target name="create-cache">
> + <mkdir dir="${wscache.output.base.dir}" />
> + <mkdir dir="${wscache.generated.src.dir}" />
> + <mkdir dir="${wscache.generated.classes.dir}" />
> + </target>
> +
> + <target name="wrapper-beans" depends="create-cache">
> + <echo>Generating artifacts for
org.apache.axis2.jaxws.wrapper.beans.AddNumbersService </echo>
> + <wsgen
> +
sei="org.apache.axis2.jaxws.wrapper.beans.AddNumbersService"
> + destdir="${wscache.generated.classes.dir}"
> + resourcedestdir="${wscache.generated.src.dir}"
> + keep="false"
> + verbose="false"
> + genwsdl="true">
> + <classpath>
> + <pathelement path="${compile.test.classes}" />
> + </classpath>
> + </wsgen>
> + </target>
> +</project>
> \ No newline at end of file
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org