1 16 package test.wsdl.oneway; 17 18 import junit.framework.AssertionFailedError; 19 import junit.framework.TestCase; 20 21 import javax.xml.rpc.ServiceException ; 22 import javax.xml.rpc.Stub ; 23 import java.rmi.RemoteException ; 24 25 28 29 public class OnewayTestCase extends TestCase { 30 public OnewayTestCase(String name) { 31 super(name); 32 } 33 34 38 public void test1NoSessionOnOneway() { 39 Oneway binding; 40 try { 41 binding = new OnewayServiceLocator().getOneway(); 42 } 43 catch (ServiceException jre) { 44 throw new AssertionFailedError("JAX-RPC ServiceException caught: " + jre); 45 } 46 assertTrue("binding is null", binding != null); 47 48 try { 49 ((Stub ) binding)._setProperty(Stub.SESSION_MAINTAIN_PROPERTY, new Boolean (true)); 50 binding.addEntry("hi", new Address()); 51 Address address = binding.getAddressFromName("hi"); 52 assertTrue("session doesn't work on oneway operations, address should have been null", address == null); 53 } 54 catch (RemoteException re) { 55 throw new AssertionFailedError("Remote Exception caught: " + re); 56 } 57 } 58 59 64 public void test2NoExceptionOnOneway() { 65 Oneway binding; 66 try { 67 binding = new OnewayServiceLocator().getOneway(); 68 } 69 catch (ServiceException jre) { 70 throw new AssertionFailedError("JAX-RPC ServiceException caught: " + jre); 71 } 72 assertTrue("binding is null", binding != null); 73 74 try { 75 binding.throwException(); 76 } 77 catch (Throwable t) { 78 throw new AssertionFailedError("Throwable: " + t); 79 } 80 } 81 82 } 83 | Popular Tags |