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 du...@apache.org on 2002/08/28 21:22:57 UTC

cvs commit: xml-axis/java/test/functional TestStockSample.java

dug         2002/08/28 12:22:56

  Modified:    java/samples/stock GetQuote.wsdl
               java/src/org/apache/axis MessageContext.java
               java/src/org/apache/axis/client Call.java client-config.wsdd
               java/src/org/apache/axis/configuration
                        BasicClientConfig.java BasicServerConfig.java
               java/test build_functional_tests.xml
               java/test/functional TestStockSample.java
  Log:
  Add a Java Transport/Binding.
  This will allow people to switch between native Java calls and SOAP
  calls by just switching the WSDL, Port or URL.  The URL is assumed
  to be of the form:   java:<classname>    ie. java:org.apache.Foo
  This does call all of the client-side chains but since it does not
  create a server object it does not call the server side chains.
  If you want that then you can use the Local Transport.
  This isn't 100% there yet - for example this only handles RPC for now.
  Stubbed in code for Msg but i'm running into problems with the Op.Desc.
  stuff.
  Added a test for it too.
  
  Revision  Changes    Path
  1.5       +3 -0      xml-axis/java/samples/stock/GetQuote.wsdl
  
  Index: GetQuote.wsdl
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/samples/stock/GetQuote.wsdl,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- GetQuote.wsdl	9 Nov 2001 00:02:56 -0000	1.4
  +++ GetQuote.wsdl	28 Aug 2002 19:22:55 -0000	1.5
  @@ -68,6 +68,9 @@
       <port name="GetQuote" binding="tns:GetQuoteBinding">
         <soap:address location="http://localhost:8080/axis/servlet/AxisServlet"/>
       </port>
  +    <port name="GetQuoteJava" binding="tns:GetQuoteBinding">
  +      <soap:address location="java:samples.stock.StockQuoteService"/>
  +    </port>
     </service>
   
   </definitions>
  
  
  
  1.119     +3 -0      xml-axis/java/src/org/apache/axis/MessageContext.java
  
  Index: MessageContext.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/MessageContext.java,v
  retrieving revision 1.118
  retrieving revision 1.119
  diff -u -r1.118 -r1.119
  --- MessageContext.java	24 Aug 2002 23:11:00 -0000	1.118
  +++ MessageContext.java	28 Aug 2002 19:22:55 -0000	1.119
  @@ -673,6 +673,9 @@
       /** If on the client - this is the Call object */
       public static String CALL                = "call_object" ;
   
  +    /** Are we doing Msg vs RPC? - For Java Binding */
  +    public static String IS_MSG              = "isMsg" ;
  +
       /** The directory where in coming attachments are created. */
       public static String ATTACHMENTS_DIR   = "attachments.directory" ;
   
  
  
  
  1.173     +6 -0      xml-axis/java/src/org/apache/axis/client/Call.java
  
  Index: Call.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/client/Call.java,v
  retrieving revision 1.172
  retrieving revision 1.173
  diff -u -r1.172 -r1.173
  --- Call.java	24 Aug 2002 23:11:00 -0000	1.172
  +++ Call.java	28 Aug 2002 19:22:56 -0000	1.173
  @@ -177,6 +177,7 @@
   
       // Is this a one-way call?
       private boolean invokeOneWay               = false;
  +    private boolean isMsg                      = false;
   
       // Our Transport, if any
       private Transport          transport       = null ;
  @@ -1273,6 +1274,7 @@
           if ( params != null && params.length > 0 && i == params.length ) {
               /* ok, we're doing Messaging, so build up the message */
               /******************************************************/
  +            isMsg = true ;
               env = new SOAPEnvelope(msgContext.getSOAPConstants());
   
               if ( !(params[0] instanceof SOAPEnvelope) )
  @@ -1408,6 +1410,8 @@
       public static synchronized void initialize() {
           addTransportPackage("org.apache.axis.transport");
   
  +        setTransportForProtocol("java",
  +                org.apache.axis.transport.java.JavaTransport.class);
           setTransportForProtocol("local",
                   org.apache.axis.transport.local.LocalTransport.class);
           setTransportForProtocol("http", HTTPTransport.class);
  @@ -1973,6 +1977,8 @@
           msgContext.setProperty( MessageContext.CALL, this );
           msgContext.setProperty( WSDL_SERVICE, service );
           msgContext.setProperty( WSDL_PORT_NAME, getPortName() );
  +        if ( isMsg ) 
  +          msgContext.setProperty( MessageContext.IS_MSG, "true" );
   
           if (username != null) {
               msgContext.setUsername(username);
  
  
  
  1.2       +1 -0      xml-axis/java/src/org/apache/axis/client/client-config.wsdd
  
  Index: client-config.wsdd
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/client/client-config.wsdd,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- client-config.wsdd	31 Oct 2001 23:50:19 -0000	1.1
  +++ client-config.wsdd	28 Aug 2002 19:22:56 -0000	1.2
  @@ -4,5 +4,6 @@
               xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
    <transport name="http" pivot="java:org.apache.axis.transport.http.HTTPSender"/>
    <transport name="local" pivot="java:org.apache.axis.transport.local.LocalSender"/>
  + <transport name="java" pivot="java:org.apache.axis.transport.java.JavaSender"/>
   </deployment>
   
  
  
  
  1.3       +2 -0      xml-axis/java/src/org/apache/axis/configuration/BasicClientConfig.java
  
  Index: BasicClientConfig.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/configuration/BasicClientConfig.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- BasicClientConfig.java	30 May 2002 03:06:06 -0000	1.2
  +++ BasicClientConfig.java	28 Aug 2002 19:22:56 -0000	1.3
  @@ -56,6 +56,7 @@
   
   import org.apache.axis.transport.local.LocalSender;
   import org.apache.axis.transport.http.HTTPSender;
  +import org.apache.axis.transport.java.JavaSender;
   import org.apache.axis.Handler;
   import org.apache.axis.SimpleTargetedChain;
   
  @@ -70,6 +71,7 @@
        * Constructor - deploy client-side basic transports.
        */
       public BasicClientConfig() {
  +        deployTransport("java", new SimpleTargetedChain(new JavaSender()));
           deployTransport("local", new SimpleTargetedChain(new LocalSender()));
           deployTransport("http", new SimpleTargetedChain(new HTTPSender()));
       }
  
  
  
  1.2       +2 -0      xml-axis/java/src/org/apache/axis/configuration/BasicServerConfig.java
  
  Index: BasicServerConfig.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/configuration/BasicServerConfig.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- BasicServerConfig.java	18 Mar 2002 04:03:36 -0000	1.1
  +++ BasicServerConfig.java	28 Aug 2002 19:22:56 -0000	1.2
  @@ -57,6 +57,7 @@
   import org.apache.axis.transport.local.LocalSender;
   import org.apache.axis.transport.local.LocalResponder;
   import org.apache.axis.transport.http.HTTPSender;
  +import org.apache.axis.transport.java.JavaSender;
   import org.apache.axis.Handler;
   import org.apache.axis.SimpleTargetedChain;
   
  @@ -74,5 +75,6 @@
           Handler h = new LocalResponder();
           SimpleTargetedChain transport = new SimpleTargetedChain(null, null, h);
           deployTransport("local", transport);
  +        deployTransport("java", new SimpleTargetedChain(new LocalSender()));
       }
   }
  
  
  
  1.56      +2 -0      xml-axis/java/test/build_functional_tests.xml
  
  Index: build_functional_tests.xml
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/test/build_functional_tests.xml,v
  retrieving revision 1.55
  retrieving revision 1.56
  diff -u -r1.55 -r1.56
  --- build_functional_tests.xml	12 Aug 2002 17:44:24 -0000	1.55
  +++ build_functional_tests.xml	28 Aug 2002 19:22:56 -0000	1.56
  @@ -213,6 +213,7 @@
     <!-- Generate code using Wsdl2java utility                               -->
     <!-- =================================================================== -->
     <target name="wsdl-setup" if="junit.present" >
  +    <copy file="${axis.home}/samples/stock/GetQuote.wsdl" todir="."/>
       <copy todir="${build.dir}/classes" overwrite="yes">
         <fileset dir="${test.dir}/wsdl/_import">
           <include name="NStoPkg.properties"/>
  @@ -309,6 +310,7 @@
         testTarget="junit-functional-secure"
         stopTarget="stop-functional-test-http-server-secure" />
   
  +    <delete file="GetQuote.wsdl"/>
     </target>
   
     <!-- =================================================================== -->
  
  
  
  1.22      +9 -0      xml-axis/java/test/functional/TestStockSample.java
  
  Index: TestStockSample.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/test/functional/TestStockSample.java,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- TestStockSample.java	3 Jul 2002 18:47:07 -0000	1.21
  +++ TestStockSample.java	28 Aug 2002 19:22:56 -0000	1.22
  @@ -63,6 +63,7 @@
   import org.apache.commons.logging.Log;
   
   import samples.stock.GetQuote;
  +import samples.stock.GetQuote2;
   
   
   /** Test the stock sample code.
  @@ -97,6 +98,12 @@
           AdminClient.main(args);
       }
       
  +    public void doTestStockJava() throws Exception {
  +        String[] args = { "XXX" };
  +        float val = new GetQuote2().getQuote(args);
  +        assertEquals("Stock price is not the expected 55.25 +/- 0.01", val, 55.25, 0.01);
  +    }
  +    
       public void doTestStock () throws Exception {
           String[] args = { "-uuser1", "-wpass1", "XXX" };
           float val = new GetQuote().getQuote(args);
  @@ -124,6 +131,8 @@
               log.info("Testing stock sample.");
               log.info("Testing JWS...");
               doTestStockJWS();
  +            log.info("Testing Java Binding...");
  +            doTestStockJava();
               log.info("Testing deployment...");
               doTestDeploy();
               log.info("Testing service...");