dims        2002/10/19 08:24:38

  Modified:    java/test/dynamic TestDynamicInvoker.java
  Log:
  Don't fail of we get a ConnectException.
  
  Revision  Changes    Path
  1.2       +33 -6     xml-axis/java/test/dynamic/TestDynamicInvoker.java
  
  Index: TestDynamicInvoker.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/test/dynamic/TestDynamicInvoker.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TestDynamicInvoker.java   13 Oct 2002 15:35:57 -0000      1.1
  +++ TestDynamicInvoker.java   19 Oct 2002 15:24:38 -0000      1.2
  @@ -57,6 +57,9 @@
   
   import samples.client.DynamicInvoker;
   import junit.framework.TestCase;
  +import org.apache.axis.AxisFault;
  +
  +import java.net.ConnectException;
   
   public class TestDynamicInvoker extends TestCase {
       public TestDynamicInvoker(String name) {
  @@ -64,14 +67,38 @@
       } // ctor
   
       public void test1() throws Exception {
  -        String[] args = new 
String[]{"http://www.xmethods.net/sd/2001/TemperatureService.wsdl";, "getTemp", 
"02067"};
  -        DynamicInvoker invoker = new DynamicInvoker();
  -        invoker.main(args);
  +        try {
  +            String[] args = new 
String[]{"http://www.xmethods.net/sd/2001/TemperatureService.wsdl";, "getTemp", 
"02067"};
  +            DynamicInvoker invoker = new DynamicInvoker();
  +            invoker.main(args);
  +        }  catch (java.rmi.RemoteException re) {
  +            if (re instanceof AxisFault) {
  +                AxisFault fault = (AxisFault) re;
  +                if (fault.detail instanceof ConnectException ||
  +                    fault.getFaultCode().getLocalPart().equals("HTTP")) {
  +                    System.err.println("TerraService HTTP error: " + fault);
  +                    return;
  +                }
  +            }
  +            throw new junit.framework.AssertionFailedError("Remote Exception 
caught: " + re);
  +        }
       }
   
       public void test2() throws Exception {
  -        String[] args = new 
String[]{"http://services.xmethods.net/soap/urn:xmethods-delayed-quotes.wsdl";, 
"getQuote", "IBM"};
  -        DynamicInvoker invoker = new DynamicInvoker();
  -        invoker.main(args);
  +        try {
  +            String[] args = new 
String[]{"http://services.xmethods.net/soap/urn:xmethods-delayed-quotes.wsdl";, 
"getQuote", "IBM"};
  +            DynamicInvoker invoker = new DynamicInvoker();
  +            invoker.main(args);
  +        }  catch (java.rmi.RemoteException re) {
  +            if (re instanceof AxisFault) {
  +                AxisFault fault = (AxisFault) re;
  +                if (fault.detail instanceof ConnectException ||
  +                    fault.getFaultCode().getLocalPart().equals("HTTP")) {
  +                    System.err.println("TerraService HTTP error: " + fault);
  +                    return;
  +                }
  +            }
  +            throw new junit.framework.AssertionFailedError("Remote Exception 
caught: " + re);
  +        }
       }
   }
  
  
  


Reply via email to