axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gdani...@apache.org
Subject cvs commit: xml-axis/java/test/functional TestTCPTransportSample.java
Date Wed, 17 Oct 2001 20:21:07 GMT
gdaniels    01/10/17 13:21:07

  Modified:    java/samples/transport/tcp AdminClient.java GetQuote.java
                        TCPTransport.java
               java/test/functional TestTCPTransportSample.java
  Log:
  Fix TCP transport samples + test.
  
  Revision  Changes    Path
  1.6       +3 -3      xml-axis/java/samples/transport/tcp/AdminClient.java
  
  Index: AdminClient.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/samples/transport/tcp/AdminClient.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- AdminClient.java	2001/09/02 04:04:22	1.5
  +++ AdminClient.java	2001/10/17 20:21:06	1.6
  @@ -56,7 +56,7 @@
   package samples.transport.tcp ;
   
   import org.apache.axis.utils.Options ;
  -import org.apache.axis.client.ServiceClient;
  +import org.apache.axis.client.Call;
   import org.apache.axis.transport.http.HTTPConstants;
   import java.net.URL;
   
  @@ -72,8 +72,8 @@
   
       public static void main(String args[]) {
         
  -        ServiceClient.addTransportPackage("samples.transport");
  -        ServiceClient.setTransportForProtocol("tcp", TCPTransport.class);
  +        Call.addTransportPackage("samples.transport");
  +        Call.setTransportForProtocol("tcp", TCPTransport.class);
           
           try {
               org.apache.axis.client.AdminClient.main(args);
  
  
  
  1.8       +18 -13    xml-axis/java/samples/transport/tcp/GetQuote.java
  
  Index: GetQuote.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/samples/transport/tcp/GetQuote.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- GetQuote.java	2001/10/15 21:05:32	1.7
  +++ GetQuote.java	2001/10/17 20:21:06	1.8
  @@ -60,8 +60,9 @@
   import java.util.*;
   
   import org.apache.axis.AxisFault ;
  -import org.apache.axis.client.ServiceClient ;
   import org.apache.axis.client.Transport ;
  +import org.apache.axis.client.Call;
  +import org.apache.axis.client.Service;
   import org.apache.axis.transport.http.HTTPConstants;
   import org.apache.axis.message.RPCParam ;
   
  @@ -69,6 +70,7 @@
   import org.apache.axis.utils.QName ;
   import org.apache.axis.encoding.ServiceDescription;
   import org.apache.axis.encoding.SOAPTypeMappingRegistry;
  +import org.apache.axis.encoding.XMLType;
   
   /**
    *
  @@ -79,7 +81,8 @@
       
     // helper function; does all the real work
       public float getQuote (String args[]) throws Exception {
  -      ServiceClient.addTransportPackage("samples.transport");
  +      Call.addTransportPackage("samples.transport");
  +        Call.setTransportForProtocol("tcp", TCPTransport.class);
   
         Options opts = new Options( args );
   
  @@ -93,21 +96,24 @@
         String namespace = "urn:xmltoday-delayed-quotes";
         symbol = args[0] ;
   
  -      ServiceClient call = new ServiceClient(opts.getURL());
  +      Service service = new Service();
  +      Call call = (Call)service.createCall();
         call.setTransport(new TCPTransport());
  -      ServiceDescription sd = new ServiceDescription("stockQuotes", true);
  -      sd.addInputParam("symbol", SOAPTypeMappingRegistry.XSD_STRING);
  -      sd.setReturnType(SOAPTypeMappingRegistry.XSD_FLOAT);
  -      call.setServiceDescription(sd);
  -      
  +
  +        call.setTargetEndpointAddress( new URL(opts.getURL()) );
  +        call.setOperationName( "getQuote" );
  +        call.setProperty( Call.NAMESPACE, "urn:xmltoday-delayed-quotes" );
  +        call.addParameter( "symbol", XMLType.XSD_STRING, Call.PARAM_MODE_IN );
  +        call.setReturnType( XMLType.XSD_FLOAT );
  +
         // TESTING HACK BY ROBJ
         if (symbol.equals("XXX_noaction")) {
             symbol = "XXX";
  -          call.set(HTTPConstants.MC_HTTP_SOAPACTION, "");
  +          call.setProperty( HTTPConstants.MC_HTTP_SOAPACTION, "" );
         }
   
  -      call.set( Transport.USER, opts.getUser() );
  -      call.set( Transport.PASSWORD, opts.getPassword() );
  +        call.setProperty( Transport.USER, opts.getUser() );
  +        call.setProperty( Transport.PASSWORD, opts.getPassword() );
   
         // useful option for profiling - perhaps we should remove before
         // shipping?
  @@ -120,8 +126,7 @@
   
         Float res = new Float(0.0F);
         for (int i=0; i<count; i++) {
  -          Object ret = call.invoke(
  -          namespace, "getQuote", new Object[] {symbol} );
  +          Object ret = call.invoke(new Object[] {symbol} );
             if (ret instanceof String) {
                 System.out.println("Received problem response from server: "+ret);
                 throw new AxisFault("", (String)ret, null, null);
  
  
  
  1.10      +6 -9      xml-axis/java/samples/transport/tcp/TCPTransport.java
  
  Index: TCPTransport.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/samples/transport/tcp/TCPTransport.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- TCPTransport.java	2001/09/16 19:58:45	1.9
  +++ TCPTransport.java	2001/10/17 20:21:06	1.10
  @@ -55,17 +55,14 @@
   
   package samples.transport.tcp;
   
  -import java.net.URL;
  -import java.util.* ;
  -import org.apache.axis.* ;
  -
  -import org.apache.axis.handlers.* ;
  -import org.apache.axis.registries.* ;
  +import org.apache.axis.AxisEngine;
  +import org.apache.axis.MessageContext;
  +import org.apache.axis.client.Call;
   import org.apache.axis.client.Transport;
  -import org.apache.axis.client.AxisClient;
  -import org.apache.axis.client.ServiceClient;
   import org.apache.log4j.Category;
   
  +import java.net.URL;
  +
   /**
    *
    * @author Rob Jellinghaus (robj@unrealities.com)
  @@ -103,7 +100,7 @@
        * @param engine the engine containing the registries
        */
       public void setupMessageContextImpl(MessageContext mc,
  -                                        ServiceClient serv,
  +                                        Call call,
                                           AxisEngine engine)
       {
           try {
  
  
  
  1.8       +18 -14    xml-axis/java/test/functional/TestTCPTransportSample.java
  
  Index: TestTCPTransportSample.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/test/functional/TestTCPTransportSample.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- TestTCPTransportSample.java	2001/10/17 18:24:10	1.7
  +++ TestTCPTransportSample.java	2001/10/17 20:21:07	1.8
  @@ -62,10 +62,14 @@
   import org.apache.axis.AxisFault ;
   import samples.transport.tcp.TCPTransport;
   import samples.transport.tcp.AdminClient;
  +import samples.transport.tcp.GetQuote;
   import org.apache.axis.utils.Admin;
   import org.apache.axis.client.ServiceClient;
  +import org.apache.axis.client.Service;
  +import org.apache.axis.client.Call;
   import org.apache.axis.encoding.ServiceDescription;
   import org.apache.axis.encoding.SOAPTypeMappingRegistry;
  +import org.apache.axis.encoding.XMLType;
   import org.apache.log4j.Category;
   
   import junit.framework.TestCase;
  @@ -99,24 +103,24 @@
       public void doTestStock() throws Exception {
           try {
               category.info("Testing TCP stock service...");
  +            GetQuote tester = new GetQuote();
  +            tester.getQuote(new String [] { "-ltcp://localhost:8088", "XXX" });
               String   symbol = "XXX"; // args[0] ;
   
  -            ServiceClient call   = new ServiceClient
  -                ( new TCPTransport("localhost", "8088") );
  +            Service  service = new Service();
  +            Call     call    = (Call) service.createCall();
   
  -            // reconstruct URL
  -            ServiceDescription sd = new ServiceDescription("stockQuotes", true);
  -            sd.addOutputParam("return", SOAPTypeMappingRegistry.XSD_FLOAT);
  -            call.setServiceDescription(sd);
  +            call.setTargetEndpointAddress( new URL("tcp://localhost:8088") );
  +            call.setOperationName( "getQuote" );
  +            call.setProperty( Call.NAMESPACE, "urn:xmltoday-delayed-quotes" );
  +            call.addParameter( "symbol", XMLType.XSD_STRING, Call.PARAM_MODE_IN );
  +            call.setReturnType( XMLType.XSD_FLOAT );
   
  -            Float res = new Float(0.0F);
  -            //      for (int i=0; i<count; i++) {
               Object ret = call.invoke(
                   "urn:xmltoday-delayed-quotes", "getQuote",
                   new Object[] {symbol} );
               if (ret instanceof Float) {
  -                res = (Float) ret;
  -                // System.out.println( symbol + ": " + res );
  +                Float res = (Float) ret;
                   assertEquals("TestTCPTransportSample: stock price should be 55.25 +/- 0.000001",
res.floatValue(), 55.25, 0.000001);
               } else {
                   throw new AssertionFailedError("Bad return value from TCP stock test: "+ret);
  @@ -135,19 +139,19 @@
           try {
               category.info("Testing TCP transport.");
   
  -            System.out.print("Deploying TCP client transport...");
  +            category.info("Deploying TCP client transport...");
               doTransportDeploy();
               category.info("OK!");
   
  -            System.out.print("Testing deployment...");
  +            category.info("Testing deployment...");
               doTestDeploy();
               category.info("OK!");
   
  -            System.out.print("Testing service...");
  +            category.info("Testing service...");
               doTestStock();
               category.info("OK!");
   
  -            System.out.print("Testing undeployment...");
  +            category.info("Testing undeployment...");
               doTestUndeploy();
               category.info("OK!");
   
  
  
  

Mime
View raw message