You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by di...@apache.org on 2004/08/18 13:39:17 UTC
cvs commit: ws-axis/java/test/wsdl/wrapperHolder ExampleSoapImpl.java ExampleSoapTestCase.java bug1191.wsdl build.xml
dims 2004/08/18 04:39:17
Added: java/test/wsdl/wrapperHolder ExampleSoapImpl.java
ExampleSoapTestCase.java bug1191.wsdl build.xml
Log:
OOPS!!! - forgot the test case from Andrei.
Revision Changes Path
1.1 ws-axis/java/test/wsdl/wrapperHolder/ExampleSoapImpl.java
Index: ExampleSoapImpl.java
===================================================================
/**
* ExampleSoapImpl.java
*
* Verifies that wrapped operations featuring Java wrapper types are working.
*/
package test.wsdl.wrapperHolder;
public class ExampleSoapImpl implements test.wsdl.wrapperHolder.ExampleSoap {
public void doExample(byte[][] doExampleValue1, java.lang.Long out, javax.xml.rpc.holders.ByteArrayHolder doExampleResponseRet, javax.xml.rpc.holders.LongWrapperHolder out2) throws java.rmi.RemoteException {
doExampleResponseRet.value = doExampleValue1[0];
out2.value = out;
}
}
1.1 ws-axis/java/test/wsdl/wrapperHolder/ExampleSoapTestCase.java
Index: ExampleSoapTestCase.java
===================================================================
/**
* DoExampleTestCase.java
*
* This file was auto-generated from WSDL
* by the Apache Axis 1.2beta3 Aug 03, 2004 (01:17:01 CEST) WSDL2Java emitter.
*/
package test.wsdl.wrapperHolder;
import javax.xml.rpc.holders.ByteArrayHolder;
import javax.xml.rpc.holders.LongWrapperHolder;
public class ExampleSoapTestCase extends junit.framework.TestCase {
public ExampleSoapTestCase(java.lang.String name) {
super(name);
}
public void testWrapperHolderWSDL() throws Exception {
javax.xml.rpc.ServiceFactory serviceFactory = javax.xml.rpc.ServiceFactory.newInstance();
java.net.URL url = new java.net.URL(new test.wsdl.wrapperHolder.DoExampleLocator().getWrapperHolderAddress() + "?WSDL");
javax.xml.rpc.Service service = serviceFactory.createService(url, new test.wsdl.wrapperHolder.DoExampleLocator().getServiceName());
assertTrue(service != null);
}
public void test1WrapperHolderDoExample() throws Exception {
test.wsdl.wrapperHolder.ExampleSoapStub binding;
try {
binding = (test.wsdl.wrapperHolder.ExampleSoapStub)
new test.wsdl.wrapperHolder.DoExampleLocator().getWrapperHolder();
}
catch (javax.xml.rpc.ServiceException jre) {
if(jre.getLinkedCause()!=null)
jre.getLinkedCause().printStackTrace();
throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre);
}
assertNotNull("binding is null", binding);
// Time out after a minute
binding.setTimeout(60000);
byte[][] in1 = new byte[][] {
{ (byte) 0xbe, (byte) 0xef, (byte) 0xcc },
{ (byte) 0xee, (byte) 0xff, (byte) 0xaa },
};
Long in2 = new Long(3);
ByteArrayHolder out1 = new ByteArrayHolder();
LongWrapperHolder out2 = new LongWrapperHolder();
// Test operation
binding.doExample(in1, in2, out1, out2);
assertEquals("Unexpected value for ByteArrayHolder",
byteArrayAsList(in1[0]), byteArrayAsList(out1.value));
assertEquals("Unexpected value for LongWrapperHolder ",
in2, out2.value);
}
private static java.util.List byteArrayAsList(final byte[] a) {
return new java.util.AbstractList() {
public Object get(int i) {
return new Byte(a[i]);
}
public int size() {
return a.length;
}
public Object set(int i, Object o) {
byte oldVal = a[i];
a[i] = ((Byte) o).byteValue();
return new Byte(oldVal);
}
};
}
}
1.1 ws-axis/java/test/wsdl/wrapperHolder/bug1191.wsdl
Index: bug1191.wsdl
===================================================================
<?xml version="1.0" ?>
<definitions name="urn:AddressFetcher"
targetNamespace="urn:wrapperHolder"
xmlns:tns="urn:wrapperHolder"
xmlns:typens="urn:wrapperHolder"
xmlns:xsd="http://www.w3.org/1999/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns="http://schemas.xmlsoap.org/wsdl/">
<types>
<schema attributeFormDefault="qualified" elementFormDefault="qualified"
targetNamespace="urn:wrapperHolder"
xmlns="http://www.w3.org/1999/XMLSchema">
<element name="out" type="xsd:long"/>
<element name="DoExample">
<complexType>
<sequence>
<element name="value1" nillable="true" maxOccurs="unbounded" type="xsd:base64Binary"/>
<element name="value2" minOccurs="0" maxOccurs="1" ref="typens:out"/>
</sequence>
</complexType>
</element>
<element name="DoExampleResponse">
<complexType>
<sequence>
<element name="ret" nillable="true" type="xsd:base64Binary"/>
<element name="out" minOccurs="0" maxOccurs="1" ref="typens:out"/>
</sequence>
</complexType>
</element>
</schema>
</types>
<message name="DoExample">
<part name="body" element="typens:DoExample"/>
</message>
<message name="DoExampleResponse">
<part name="result" element="typens:DoExampleResponse"/>
</message>
<portType name="ExampleSoap">
<operation name="DoExample" parameterOrder="body result">
<input message="tns:DoExample"/>
<output message="tns:DoExampleResponse"/>
</operation>
</portType>
<binding name="ExampleSoap" type="tns:ExampleSoap">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="DoExample">
<soap:operation soapAction="" style="document"/>
<input>
<soap:body use="literal" parts="body" />
</input>
<output >
<soap:body use="literal" parts="result" />
</output>
</operation>
</binding>
<service name="DoExample">
<port name="WrapperHolder" binding="tns:ExampleSoap">
<soap:address location="http://localhost:8080/axis/services/WrapperHolder"/>
</port>
</service>
</definitions>
1.1 ws-axis/java/test/wsdl/wrapperHolder/build.xml
Index: build.xml
===================================================================
<?xml version="1.0" ?>
<!DOCTYPE project [
<!ENTITY properties SYSTEM "file:../../../xmls/properties.xml">
<!ENTITY paths SYSTEM "file:../../../xmls/path_refs.xml">
<!ENTITY taskdefs SYSTEM "file:../../../xmls/taskdefs.xml">
<!ENTITY taskdefs_post_compile SYSTEM "file:../../../xmls/taskdefs_post_compile.xml">
<!ENTITY targets SYSTEM "file:../../../xmls/targets.xml">
]>
<!-- ===================================================================
<description>
This is a test case to accompany the fix for Bug 1191.
Notes:
This is a build file for use with the Jakarta Ant build tool.
Prerequisites:
jakarta-ant from http://jakarta.apache.org
Build Instructions:
To compile
ant compile
To execute
ant run
Author:
Andrei Iltchenko Andrei.Iltchenko@nl.compuware.com
Copyright:
Copyright (c) 2002-2004 Apache Software Foundation.
</description>
==================================================================== -->
<project default="compile">
<property name="axis.home" location="../../.."/>
<property name="componentName" value="test/wsdl/wrapperHolder"/>
<property name="packageName" value="test.wsdl.wrapperHolder"/>
&properties;
&paths;
&taskdefs;
&taskdefs_post_compile;
&targets;
<target name="clean">
<echo message="Removing ${build.dir}/classes/${componentName} and ${build.dir}/work/${componentName}" />
<delete dir="${build.dir}/classes/${componentName}"/>
<delete dir="${build.dir}/work/${componentName}"/>
</target>
<target name="copy" depends="setenv"/>
<target name="compile" depends="copy">
<echo message="Compiling ${packageName}"/>
<!-- Wrapped Sample Test -->
<wsdl2java url="${axis.home}/${componentName}/bug1191.wsdl"
output="${axis.home}/build/work"
serverSide="yes"
skeletonDeploy="no"
testcase="no">
<mapping namespace="urn:wrapperHolder" package="${packageName}"/>
</wsdl2java>
<copy todir="${build.dir}/work/${componentName}" overwrite="yes">
<fileset dir="${axis.home}/${componentName}">
<include name="*TestCase.java"/>
<include name="*Impl.java"/>
</fileset>
</copy>
<javac srcdir="${build.dir}/work" destdir="${build.dest}" nowarn="${nowarn}" source="${source}" fork="${javac.fork}"
debug="${debug}">
<classpath refid="classpath" />
<include name="${componentName}/*.java" />
</javac>
</target>
<target name="run" >
<antcall target="execute-Component" />
</target>
</project>