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 Glen Daniels <gd...@macromedia.com> on 2001/06/22 16:07:10 UTC

RE: cvs commit: xml-axis/java/test/functional TestTransportSample .java

Sam:

This is fine with me for now, although I would still like to see the "map
transports by protocol" functionality there, even for user-defined
protocols.  As I mentioned earlier, the two ways to do this which don't
involve registering a new URLStreamHandlerFactory are setting the system
property which tells the URL class to look in a custom transport directory
for StreamHandlers, or parsing the URL string ourselves before we try
turning it into a URL.  The former is more in-line with "Javaness", the
latter is probably somewhat easier.

--G

> -----Original Message-----
> From: rubys@apache.org [mailto:rubys@apache.org]
> Sent: Thursday, June 21, 2001 9:34 AM
> To: xml-axis-cvs@apache.org
> Subject: cvs commit: xml-axis/java/test/functional
> TestTransportSample.java
> 
> 
> rubys       01/06/21 06:33:53
> 
>   Modified:    java/src/org/apache/axis/client AdminClient.java
>                         Transport.java
>                java/test/functional TestTransportSample.java
>   Log:
>   Fix bug whereby the AdminClient would cause NullPointerExceptions in
>   any call which attempted to read from a URL.  Note: no unit or
>   function tests were affected by the removal of the 
> offending function,
>   so ***GLEN*** please review this change.
>   
>   Re-introduced the function test, but treat the fault 
> generated by being
>   off the net as a success (Note: this surfaced another bug, so adding
>   intentional fault tests is on my todo list).
>   
>   Revision  Changes    Path
>   1.21      +0 -6      
> xml-axis/java/src/org/apache/axis/client/AdminClient.java
>   
>   Index: AdminClient.java
>   ===================================================================
>   RCS file: 
> /home/cvs/xml-axis/java/src/org/apache/axis/client/AdminClient.java,v
>   retrieving revision 1.20
>   retrieving revision 1.21
>   diff -u -r1.20 -r1.21
>   --- AdminClient.java	2001/06/21 02:45:37	1.20
>   +++ AdminClient.java	2001/06/21 13:33:52	1.21
>   @@ -80,12 +80,6 @@
>    
>    public abstract class AdminClient {
>    
>   -    // Temporary home until we find something better.
>   -    static {
>   -        // System.out.println("Registering URL stream 
> handler factory.");
>   -        
> URL.setURLStreamHandlerFactory(Transport.getURLStreamHandlerFa
> ctory());
>   -    }
>   -    
>        // do the real work, and throw exception if fubar
>        // this is reused by the TestHTTPDeploy functional tests
>        public void doAdmin (String[] args)
>   
>   
>   
>   1.5       +0 -24     
> 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.4
>   retrieving revision 1.5
>   diff -u -r1.4 -r1.5
>   --- Transport.java	2001/06/14 21:30:22	1.4
>   +++ Transport.java	2001/06/21 13:33:52	1.5
>   @@ -64,30 +64,6 @@
>    import org.apache.axis.Handler;
>    
>    public abstract class Transport {
>   -    static class AxisURLHandler extends URLStreamHandler {
>   -        /** This is just for parsing purposes, so don't 
> really open any
>   -         * connections.  At some point we may actually 
> want to do something
>   -         * here...
>   -         */
>   -        public URLConnection openConnection(URL url) 
> throws IOException
>   -        {
>   -            return null;
>   -        }
>   -    }
>   -    
>   -    static class AxisURLStreamHandlerFactory implements 
> URLStreamHandlerFactory {
>   -        public URLStreamHandler 
> createURLStreamHandler(String protocol)
>   -        {
>   -            // For now, just accept anything.  Later we 
> might want to
>   -            // generate MalformedURLExceptions for 
> non-supported protocols.
>   -            return new AxisURLHandler();
>   -        }
>   -    }
>   -    
>   -    public static URLStreamHandlerFactory 
> getURLStreamHandlerFactory()
>   -    {
>   -        return new AxisURLStreamHandlerFactory();
>   -    }
>        
>        /**
>         * Synonyms for MessageContext userid / password.
>   
>   
>   
>   1.6       +12 -8     
> 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.5
>   retrieving revision 1.6
>   diff -u -r1.5 -r1.6
>   --- TestTransportSample.java	2001/06/21 02:46:00	1.5
>   +++ TestTransportSample.java	2001/06/21 13:33:53	1.6
>   @@ -60,7 +60,6 @@
>    import java.util.*;
>    
>    import org.apache.axis.AxisFault ;
>   -import org.apache.axis.client.http.AdminClient;
>    import org.apache.axis.utils.Debug ;
>    import org.apache.axis.utils.Options ;
>    import org.apache.axis.utils.QName ;
>   @@ -92,16 +91,23 @@
>        }
>        
>        /* NOT RECOMMENDED -- this calls out to xmltoday.com 
> which is flaky.
>   -       Do not do this in regular regression tests since it 
> can result in
>   -       spurious failures due to no fault of Axis code. -- RobJ
>   +       Verify that it either succeeds, or that it produces 
> a specific
>   +       failure. */
>        
>        public void doTestIBM () throws Exception {
>            String[] args = { "IBM" };
>   -        FileTest.main(args);
>   +        try {
>   +            FileTest.main(args);
>   +        } catch (AxisFault e) {
>   +            String fault = e.getFaultString();
>   +            if (fault == null || 
> fault.indexOf("java.net.UnknownHost")<0)
>   +                throw e;
>   +            int start = fault.indexOf(": ");
>   +            int eol   = fault.indexOf('\n', start+1);
>   +            System.out.println(fault.substring(start+2, eol));
>   +        }
>        }
>        
>   -     */
>   -    
>        public void doTestXXX () throws Exception {
>            String[] args = { "XXX" };
>            FileTest.main(args);
>   @@ -114,10 +120,8 @@
>                doTestClientDeploy();
>                System.out.println("Testing deployment...");
>                doTestDeploy();
>   -            /*
>                System.out.println("Testing service with 
> symbol IBM...");
>                doTestIBM();
>   -             */
>                System.out.println("Testing service with 
> symbol XXX...");
>                doTestXXX();
>                System.out.println("Test complete.");
>   
>   
>   
>