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 he...@apache.org on 2004/07/12 06:16:54 UTC
cvs commit: ws-axis/contrib/ews/samples/clients ClientTest.java build.xml
hemapani 2004/07/11 21:16:54
Added: contrib/ews/samples/clients ClientTest.java build.xml
Log:
this is set of test clients to test the webservice when it is deployed.
not yet completly functional
Revision Changes Path
1.1 ws-axis/contrib/ews/samples/clients/ClientTest.java
Index: ClientTest.java
===================================================================
import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import java.rmi.RemoteException;
import javax.xml.rpc.ServiceException;
import junit.framework.TestCase;
import org.apache.ws.echosample.Echo;
import org.apache.ws.echosample.EchoServiceLocator;
import org.apache.ws.echosample.EchoStruct;
import com.jwsbook.jaxrpc.BookQuote;
import com.jwsbook.jaxrpc.BookQuoteServiceLocator;
public class ClientTest extends TestCase{
public void testClients() throws Exception{
try{
// File file = new File("./conf/wsdd/client/secuirty-client-config.wsdd");
// if(!file.exists())
// throw new RuntimeException();
System.setProperty("axis.ClientConfigFile",file.getAbsolutePath());
BookQuoteServiceLocator locater = new BookQuoteServiceLocator();
BookQuote port = locater.getBookQuotePort(new URL("http://127.0.0.1:5555/axis/services/BookQuotePort"));
System.out.println("return value is "+port.getBookPrice("hello"));
EchoServiceLocator elocator = new EchoServiceLocator();
Echo eport = elocator.getechoPort(new URL("http://127.0.0.1:5555/axis/services/echoPort"));
boolean booleanValue = true;
double doubleValue = 124565;
byte[] bytes = "hello".getBytes();
float floatValue = 245235f;
int intValue = 234;
long longValue = 23453536;
short shortvalue = new Short("23").shortValue();
EchoStruct struct = new EchoStruct();
struct.setStrVal("Hi");
assertEquals(eport.echoBoolean(true),true);
assertEquals(eport.echoDouble(doubleValue),doubleValue,2);
System.out.println(eport.echoBytes(bytes));
assertTrue(eport.echoFloat(floatValue) == floatValue);
assertEquals(eport.echoInt(intValue),intValue);
assertEquals(eport.echoLong(longValue),longValue);
assertEquals(eport.echoStruct(struct),struct);
assertEquals(eport.echoShort(shortvalue),shortvalue);
}catch(Exception e){
e.printStackTrace();
throw e;
}
}
}
1.1 ws-axis/contrib/ews/samples/clients/build.xml
Index: build.xml
===================================================================
<?xml version="1.0"?>
<project basedir="." default="test">
<property name="build" location="build"/>
<property name="src" location="${build}/src"/>
<property file="../../conf/ws4j2ee.properties"></property>
<property name="build.classes" location="${build}/classes"/>
<property name="build.lib" location="../../target/generated/samples/lib"/>
<path id="cp">
<pathelement location="../../target/classes/"/>
<pathelement location="${build.classes}"/>
<fileset dir="${maven.repo.local}">
<include name="axis/**/*.jar"/>
<include name="geronimo-spec/**/*.jar"/>
<include name="geronimo/**/*.jar"/>
<include name="sec/**/*.jar"/>
<include name="dom4j/**/*.jar"/>
<include name="jaxb-ri/**/*.jar"/>
<include name="xerces/**/*.jar"/>
<include name="junit/**/*.jar"/>
</fileset>
</path>
<property name="jar.dir" location="../../target/generated/samples/"/>
<target name="compile-wsdls" >
<mkdir dir="${src}"/>
<mkdir dir="${build.classes}"/>
<java classname="org.apache.geronimo.ews.ws4j2ee.toWs.ws.WSDLOnlyClientSideWsGenerator" >
<classpath refid="cp"/>
<arg value="../../target/generated/samples/withoutWSDL/echo-jar/echo.wsdl"/>
<arg value="${src}"/>
</java>
<java classname="org.apache.geronimo.ews.ws4j2ee.toWs.ws.WSDLOnlyClientSideWsGenerator" >
<classpath refid="cp"/>
<arg value="../../target/generated/samples/withoutWSDL/bookquote-jar/BookQuote.wsdl"/>
<arg value="${src}"/>
</java>
</target>
<target name="compile" depends="compile-wsdls">
<copy todir="${src}">
<fileset dir=".">
<include name="*/*.java"/>
</fileset>
</copy>
<javac destdir="${build.classes}" debug="on">
<classpath refid="cp"/>
<src path="${src}"/>
</javac>
<jar jarfile="${jar.dir}/clients.jar" basedir="${build.classes}" >
<include name="**" />
</jar>
</target>
<target name="test" depends="compile">
<junit haltonerror="true" showoutput="true" printsummary="true">
<classpath refid="cp"/>
<formatter type="plain" />
<batchtest fork="yes" todir="${build}">
<fileset dir="${src}">
<include name="*/*Test*.java" />
<exclude name="**/AllTests.java" />
</fileset>
</batchtest>
</junit>
<delete dir="${build}"/>
</target>
</project>