axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ru...@apache.org
Subject cvs commit: xml-axis/java/test/functional TestTransportSample.java
Date Mon, 11 Jun 2001 10:51:58 GMT
rubys       01/06/11 03:51:57

  Modified:    java/samples/transport FileReader.java
               java/src/org/apache/axis AxisEngine.java Constants.java
                        MessageContext.java
               java/src/org/apache/axis/client AxisClient.java
                        ServiceClient.java Transport.java
               java/src/org/apache/axis/client/http HTTPTransport.java
               java/src/org/apache/axis/client/tcp TCPTransport.java
               java/src/org/apache/axis/server AxisServer.java
               java/src/org/apache/axis/transport/http
                        SimpleAxisServer.java
               java/src/org/apache/axis/transport/tcp AxisListener.java
               java/src/org/apache/axis/utils Admin.java
               java/test/RPCDispatch TestRPC.java
               java/test/functional TestTransportSample.java
  Log:
  Fix regression tests:
    msgContext.axisEngine is not always set
      inconsistent access to registries: bags vs real properties
  
      Distinguish between client and server
  
      Remove debug statements
  
      Temporarily comment out "real" stock quote
  
  Revision  Changes    Path
  1.5       +1 -0      xml-axis/java/samples/transport/FileReader.java
  
  Index: FileReader.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/samples/transport/FileReader.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- FileReader.java	2001/06/06 15:36:30	1.4
  +++ FileReader.java	2001/06/11 10:51:21	1.5
  @@ -95,6 +95,7 @@
   
           Message msg = new Message( fis, "InputStream" );
           MessageContext  msgContext = new MessageContext();
  +        msgContext.setAxisEngine(server);
           msgContext.setRequestMessage( msg );
   
           // SOAPAction hack
  
  
  
  1.3       +8 -5      xml-axis/java/src/org/apache/axis/AxisEngine.java
  
  Index: AxisEngine.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/AxisEngine.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- AxisEngine.java	2001/06/10 20:00:33	1.2
  +++ AxisEngine.java	2001/06/11 10:51:26	1.3
  @@ -134,7 +134,13 @@
           this.serviceRegFilename = serviceRegFilename;
       }
   
  +
       /**
  +     * Is this running on the server?
  +     */
  +    abstract public boolean isOnServer();
  +
  +    /**
        * Find/load the registries and save them so we don't need to do this
        * each time we're called.
        */
  @@ -144,24 +150,21 @@
           
           String propVal = props.getProperty("debugLevel", "0");
           Debug.setDebugLevel(Integer.parseInt(propVal));
  -        System.out.println("Debug level is " + Debug.getDebugLevel());
           
           if (getHandlerRegistry() == null) {
  -            System.out.println("Using " + handlerRegFilename);
               DefaultHandlerRegistry  hr =
                            new DefaultHandlerRegistry(handlerRegFilename);
  -            hr.setOnServer( true );
  +            hr.setOnServer( isOnServer() );
               hr.init();
               setHandlerRegistry( hr );
           }
           
           if (getServiceRegistry() == null) {
  -            System.out.println("Using " + serviceRegFilename);
               // Load the simple deployed services registry and init it
               DefaultServiceRegistry  sr =
                            new DefaultServiceRegistry(serviceRegFilename);
               sr.setHandlerRegistry( getHandlerRegistry() ); // needs to know about 'hr'
  -            sr.setOnServer( true );
  +            sr.setOnServer( isOnServer() );
               sr.init();
               setServiceRegistry( sr );
           }
  
  
  
  1.18      +0 -2      xml-axis/java/src/org/apache/axis/Constants.java
  
  Index: Constants.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/Constants.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- Constants.java	2001/06/10 19:57:22	1.17
  +++ Constants.java	2001/06/11 10:51:26	1.18
  @@ -61,8 +61,6 @@
     //  not all Engines will have notion of registries but defining these
     //  here should allow people to ask if they exist)
     //////////////////////////////////////////////////////////////////////////
  -  public static String HANDLER_REGISTRY = "HandlerRegistry" ;
  -  public static String SERVICE_REGISTRY = "ServiceRegistry" ;
     public static String TYPEMAP_REGISTRY = "TypeMapRegistry" ;
   
     // Envelope Stuff
  
  
  
  1.31      +1 -2      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.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- MessageContext.java	2001/06/10 19:57:23	1.30
  +++ MessageContext.java	2001/06/11 10:51:28	1.31
  @@ -227,8 +227,7 @@
           Debug.Print(2, "MessageContext: setTargetService(" + tServ+")");
           targetService = tServ ;
   
  -        HandlerRegistry sr = (HandlerRegistry)
  -                              getProperty(Constants.SERVICE_REGISTRY);
  +        HandlerRegistry sr = axisEngine.getServiceRegistry();
   
           if (sr == null || targetService == null)
               setServiceHandler(null);
  
  
  
  1.11      +5 -0      xml-axis/java/src/org/apache/axis/client/AxisClient.java
  
  Index: AxisClient.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/client/AxisClient.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- AxisClient.java	2001/06/10 19:57:23	1.10
  +++ AxisClient.java	2001/06/11 10:51:32	1.11
  @@ -77,6 +77,11 @@
           super(Constants.CLIENT_HANDLER_REGISTRY,
                 Constants.CLIENT_SERVICE_REGISTRY);
       }
  +
  +    /**
  +     * Is this running on the server?
  +     */
  +    public boolean isOnServer() { return false; }
       
       /**
        * Main routine of the AXIS engine.  In short we locate the appropriate
  
  
  
  1.5       +4 -10     xml-axis/java/src/org/apache/axis/client/ServiceClient.java
  
  Index: ServiceClient.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/client/ServiceClient.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ServiceClient.java	2001/06/02 04:01:17	1.4
  +++ ServiceClient.java	2001/06/11 10:51:33	1.5
  @@ -99,7 +99,7 @@
       private static final boolean DEBUG_LOG = false;
       
       // Our engine; either AxisClient (usually) or AxisServer (doLocal)
  -    private Handler engine;
  +    private AxisEngine engine;
       
       // The description of our service
       private ServiceDescription serviceDesc;
  @@ -128,6 +128,7 @@
           this.transport = transport;
           
           this.setupEngine();
  +        msgContext.setAxisEngine(engine);
           
           // set up the message context with the transport
           try {
  @@ -136,15 +137,8 @@
               /* Do some prep-work.  Get the registries and put them in the */
               /* msgContext so they can be used by later handlers.          */
               /**************************************************************/
  -            HandlerRegistry hr =
  -                (HandlerRegistry) engine.getOption(Constants.HANDLER_REGISTRY);
  -            HandlerRegistry sr =
  -                (HandlerRegistry) engine.getOption(Constants.SERVICE_REGISTRY);
  -            
  -            if ( hr != null )
  -                msgContext.setProperty(Constants.HANDLER_REGISTRY, hr);
  -            if ( sr != null )
  -                msgContext.setProperty(Constants.SERVICE_REGISTRY, sr);
  +            HandlerRegistry hr = engine.getHandlerRegistry();
  +            HandlerRegistry sr = engine.getServiceRegistry();
               
               transport.initMessageContext(msgContext, this, engine, doLocal);
           } catch (AxisFault f) {
  
  
  
  1.2       +4 -3      xml-axis/java/src/org/apache/axis/client/Transport.java
  
  Index: Transport.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/client/Transport.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Transport.java	2001/06/01 06:47:56	1.1
  +++ Transport.java	2001/06/11 10:51:34	1.2
  @@ -58,6 +58,7 @@
   import java.util.* ;
   import org.apache.axis.MessageContext;
   import org.apache.axis.AxisFault;
  +import org.apache.axis.AxisEngine;
   import org.apache.axis.Handler;
   
   public abstract class Transport {
  @@ -71,7 +72,7 @@
        * Initialize the given AxisClient with whatever transport state
        * is appropriate.
        */
  -    public void init (Handler client) {
  +    public void init (AxisEngine client) {
           // default is do nothing
       }
       
  @@ -79,7 +80,7 @@
        * Initialize the given MessageContext with the correct handlers and registries.
        */
       public abstract void initMessageContext
  -        (MessageContext context, ServiceClient message, Handler engine, boolean doLocal)
  +        (MessageContext context, ServiceClient message, AxisEngine engine, boolean doLocal)
           throws AxisFault;
       
       /**
  @@ -91,7 +92,7 @@
        * @throws AxisFault if service cannot be found
        */
       public abstract void setupMessageContext
  -        (MessageContext context, ServiceClient message, Handler engine, boolean doLocal)
  +        (MessageContext context, ServiceClient message, AxisEngine engine, boolean doLocal)
           throws AxisFault;
   }
       
  
  
  
  1.4       +4 -3      xml-axis/java/src/org/apache/axis/client/http/HTTPTransport.java
  
  Index: HTTPTransport.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/client/http/HTTPTransport.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- HTTPTransport.java	2001/06/07 14:01:44	1.3
  +++ HTTPTransport.java	2001/06/11 10:51:39	1.4
  @@ -100,10 +100,10 @@
       /**
        * Initialize the given MessageContext with the correct handlers and registries.
        */
  -    public void initMessageContext (MessageContext mc, ServiceClient serviceClient, Handler
engine, boolean doLocal)
  +    public void initMessageContext (MessageContext mc, ServiceClient serviceClient, AxisEngine
engine, boolean doLocal)
           throws AxisFault
       {
  -        DefaultServiceRegistry sr = (DefaultServiceRegistry)engine.getOption(Constants.SERVICE_REGISTRY);
  +        HandlerRegistry sr = engine.getServiceRegistry();
           if ( sr == null || sr.find("HTTP.input") == null )
               mc.setProperty( MessageContext.TRANS_INPUT, "HTTPSender" );
           else
  @@ -131,11 +131,12 @@
        * @param doLocal if true, we are setting up for local testing
        * @throws AxisFault if service cannot be found
        */
  -    public void setupMessageContext (MessageContext mc, ServiceClient serviceClient, Handler
engine, boolean doLocal)
  +    public void setupMessageContext (MessageContext mc, ServiceClient serviceClient, AxisEngine
engine, boolean doLocal)
           throws AxisFault
       {
           if (url != null) mc.setProperty(URL, url);
           if (action != null) mc.setProperty(ACTION, action);
  +        mc.setAxisEngine(engine);
           mc.setTargetService( (String)mc.getProperty(ACTION) );
           
           if ( doLocal && ((String)mc.getProperty(URL)).endsWith( ".jws") ) {
  
  
  
  1.3       +5 -5      xml-axis/java/src/org/apache/axis/client/tcp/TCPTransport.java
  
  Index: TCPTransport.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/client/tcp/TCPTransport.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TCPTransport.java	2001/06/07 14:50:54	1.2
  +++ TCPTransport.java	2001/06/11 10:51:41	1.3
  @@ -97,13 +97,13 @@
        * Find/load the registries and save them so we don't need to do this
        * each time we're called.
        */
  -    public void init(Handler engine) {
  +    public void init(AxisEngine engine) {
           this.engine = engine;
           // Load the simple handler registry and init it
           Debug.Print( 1, "Enter: TCPTransport::init" );
           
           // add the TCPDispatchHandler
  -        HandlerRegistry hr = (DefaultHandlerRegistry)engine.getOption(Constants.HANDLER_REGISTRY);
  +        HandlerRegistry hr = engine.getHandlerRegistry();
           hr.add("TCPSender", new TCPDispatchHandler());
           hr.add("TCPAction", new TCPActionHandler());
           
  @@ -121,9 +121,9 @@
       /**
        * Initialize the given MessageContext with the correct handlers and registries.
        */
  -    public void initMessageContext (MessageContext mc, ServiceClient serv, Handler engine,
boolean doLocal)
  +    public void initMessageContext (MessageContext mc, ServiceClient serv, AxisEngine engine,
boolean doLocal)
       {
  -        DefaultServiceRegistry sr = (DefaultServiceRegistry)engine.getOption(Constants.SERVICE_REGISTRY);
  +        HandlerRegistry sr = engine.getServiceRegistry();
           if ( sr == null || sr.find("TCP.input") == null )
               mc.setProperty( MessageContext.TRANS_INPUT, "TCPSender" );
           else
  @@ -139,7 +139,7 @@
        * @param engine the engine containing the registries
        * @param doLocal if true, we are setting up for local testing
        */
  -    public void setupMessageContext (MessageContext mc, ServiceClient serv, Handler engine,
boolean doLocal)
  +    public void setupMessageContext (MessageContext mc, ServiceClient serv, AxisEngine
engine, boolean doLocal)
       {
           // kind of ugly... fake up a "http://host:port/" url to send down the chain
           // ROBJ TODO: clean this up so we use TCP transport properties all the way down
  
  
  
  1.16      +5 -2      xml-axis/java/src/org/apache/axis/server/AxisServer.java
  
  Index: AxisServer.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/server/AxisServer.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- AxisServer.java	2001/06/10 19:57:24	1.15
  +++ AxisServer.java	2001/06/11 10:51:43	1.16
  @@ -86,6 +86,11 @@
       }
   
       /**
  +     * Is this running on the server?
  +     */
  +    public boolean isOnServer() { return true; }
  +
  +    /**
        * Main routine of the AXIS server.  In short we locate the appropriate
        * handler for the desired service and invoke() it.
        */
  @@ -104,8 +109,6 @@
               (TypeMappingRegistry) getOption(Constants.TYPEMAP_REGISTRY);
   
           msgContext.setAxisEngine( this );
  -        msgContext.setProperty(Constants.HANDLER_REGISTRY, hr);
  -        msgContext.setProperty(Constants.SERVICE_REGISTRY, sr);
   
           msgContext.setTypeMappingRegistry(tmr);
   
  
  
  
  1.10      +1 -0      xml-axis/java/src/org/apache/axis/transport/http/SimpleAxisServer.java
  
  Index: SimpleAxisServer.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/transport/http/SimpleAxisServer.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- SimpleAxisServer.java	2001/06/10 19:57:24	1.9
  +++ SimpleAxisServer.java	2001/06/11 10:51:45	1.10
  @@ -126,6 +126,7 @@
           Message        requestMsg = new Message("", "String");
           msgContext.setProperty(MessageContext.TRANS_INPUT , transportInName);
           msgContext.setProperty(MessageContext.TRANS_OUTPUT, transportOutName);
  +        msgContext.setAxisEngine(engine);
   
           // Reusuable, buffered, content length controlled, InputStream
           NonBlockingBufferedInputStream is =
  
  
  
  1.4       +4 -3      xml-axis/java/src/org/apache/axis/transport/tcp/AxisListener.java
  
  Index: AxisListener.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/transport/tcp/AxisListener.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- AxisListener.java	2001/06/05 12:43:18	1.3
  +++ AxisListener.java	2001/06/11 10:51:48	1.4
  @@ -84,7 +84,7 @@
       private int port;
       private ServerSocket srvSocket;
       
  -    private Handler engine = null ;
  +    private AxisEngine engine = null ;
       
       // becomes true when we want to quit
       private boolean done = false;
  @@ -149,8 +149,8 @@
                   engine = new AxisServer();
                   engine.init();
                   
  -                HandlerRegistry hr = (HandlerRegistry)engine.getOption(Constants.HANDLER_REGISTRY);
  -                HandlerRegistry sr = (HandlerRegistry)engine.getOption(Constants.SERVICE_REGISTRY);
  +                HandlerRegistry hr = engine.getHandlerRegistry();
  +                HandlerRegistry sr = engine.getServiceRegistry();
                   // add the TCPDispatchHandler
                   hr.add("TCPSender", new TCPDispatchHandler());
                   hr.add("TCPAction", new TCPActionHandler());
  @@ -175,6 +175,7 @@
               /* even need to be parsed.                                         */
               /*******************************************************************/
               MessageContext    msgContext = new MessageContext();
  +            msgContext.setAxisEngine(engine);
               
               InputStream inp;
               try {
  
  
  
  1.37      +3 -2      xml-axis/java/src/org/apache/axis/utils/Admin.java
  
  Index: Admin.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/utils/Admin.java,v
  retrieving revision 1.36
  retrieving revision 1.37
  diff -u -r1.36 -r1.37
  --- Admin.java	2001/06/07 14:02:19	1.36
  +++ Admin.java	2001/06/11 10:51:51	1.37
  @@ -138,8 +138,9 @@
                     throws AxisFault
     {
       Debug.Print( 1, "Enter: Admin:AdminService" );
  -    hr = (DefaultHandlerRegistry)msgContext.getProperty(Constants.HANDLER_REGISTRY);
  -    sr = (DefaultServiceRegistry)msgContext.getProperty(Constants.SERVICE_REGISTRY);
  +    AxisEngine engine =  msgContext.getAxisEngine();
  +    hr = (DefaultHandlerRegistry)engine.getHandlerRegistry();
  +    sr = (DefaultServiceRegistry)engine.getServiceRegistry();
       tmr = msgContext.getTypeMappingRegistry();
       Document doc = process( msgContext, xml );
       Debug.Print( 1, "Exit: Admin:AdminService" );
  
  
  
  1.9       +1 -1      xml-axis/java/test/RPCDispatch/TestRPC.java
  
  Index: TestRPC.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/test/RPCDispatch/TestRPC.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- TestRPC.java	2001/06/10 19:57:24	1.8
  +++ TestRPC.java	2001/06/11 10:51:53	1.9
  @@ -69,7 +69,7 @@
   
           // Create a message context with the action and message
           MessageContext msgContext = new MessageContext();
  -        msgContext.setProperty(Constants.SERVICE_REGISTRY, sr);
  +        msgContext.setAxisEngine(engine);
           msgContext.setRequestMessage(new Message(envelope, "SOAPEnvelope"));
           if (setService) {
               msgContext.setTargetService(SOAPAction);
  
  
  
  1.2       +1 -1      xml-axis/java/test/functional/TestTransportSample.java
  
  Index: TestTransportSample.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/test/functional/TestTransportSample.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TestTransportSample.java	2001/06/02 04:01:20	1.1
  +++ TestTransportSample.java	2001/06/11 10:51:55	1.2
  @@ -111,7 +111,7 @@
               System.out.println("Testing deployment...");
               doTestDeploy();
               System.out.println("Testing service with symbol IBM...");
  -            doTestIBM();
  +            // doTestIBM();
               System.out.println("Testing service with symbol XXX...");
               doTestXXX();
               System.out.println("Test complete.");
  
  
  

Mime
View raw message