1 package org.jboss.test.marshaliiop.test; 2 3 import junit.framework.Test; 4 import org.jboss.test.JBossIIOPTestCase; 5 import org.jboss.test.marshaliiop.TestPayload; 6 import org.jboss.test.marshaliiop.interfaces.MarshalSession; 7 import org.jboss.test.marshaliiop.interfaces.MarshalSessionHome; 8 9 import javax.rmi.PortableRemoteObject ; 10 import java.rmi.MarshalException ; 11 12 18 public class EjbUnMarshalUnitTestCase extends JBossIIOPTestCase 19 { 20 public EjbUnMarshalUnitTestCase(String name) 21 { 22 super(name); 23 } 24 25 public static Test suite() 26 throws Exception 27 { 28 return getDeploySetup(EjbUnMarshalUnitTestCase.class, "test-ejb-iiop-unmarshal.jar"); 29 } 30 31 38 public void testUnMarshalException() throws Exception 39 { 40 Object objHome = getInitialContext().lookup("marshalliiop/MarshallSession"); 41 objHome = PortableRemoteObject.narrow(objHome, MarshalSessionHome.class); 42 MarshalSessionHome marshalHome = (MarshalSessionHome) objHome; 43 MarshalSession marshalSession = marshalHome.create(); 44 45 TestPayload payload = new TestPayload(); 46 try 47 { 48 marshalSession.testMethod(payload); 49 assertTrue("Call on MarshalSession.testMethod() should have thrown UnmarshalException, but did not", false); 50 } 51 catch (MarshalException e) 52 { 53 assertTrue(true); 54 } 55 catch (Throwable thr) 56 { 57 thr.printStackTrace(); 58 throw new Exception (thr); 59 } 60 } 61 62 } 63 | Popular Tags |