1 45 package org.openejb.test.entity.bmp; 46 47 48 54 public class BmpRemoteIntfcTests extends BasicBmpTestClient{ 55 56 public BmpRemoteIntfcTests(){ 57 super("RemoteIntfc."); 58 } 59 60 protected void setUp() throws Exception { 61 super.setUp(); 62 Object obj = initialContext.lookup("client/tests/entity/bmp/BasicBmpHome"); 63 ejbHome = (BasicBmpHome)javax.rmi.PortableRemoteObject.narrow( obj, BasicBmpHome.class); 64 ejbObject = ejbHome.create("Forth Bean"); 65 } 66 67 public void test01_businessMethod(){ 71 try{ 72 String expected = "Success"; 73 String actual = ejbObject.businessMethod("sseccuS"); 74 assertEquals(expected, actual); 75 } catch (Exception e){ 76 fail("Received Exception "+e.getClass()+ " : "+e.getMessage()); 77 } 78 } 79 83 public void test02_throwApplicationException(){ 84 try{ 85 ejbObject.throwApplicationException(); 86 } catch (org.openejb.test.ApplicationException e){ 87 return; 89 } catch (Throwable e){ 90 fail("Received Exception "+e.getClass()+ " : "+e.getMessage()); 91 } 92 fail("An ApplicationException should have been thrown."); 93 } 94 95 99 public void test03_invokeAfterApplicationException(){ 100 try{ 101 String expected = "Success"; 102 String actual = ejbObject.businessMethod("sseccuS"); 103 assertEquals(expected, actual); 104 } catch (Throwable e){ 105 fail("Received Exception "+e.getClass()+ " : "+e.getMessage()); 106 } 107 } 108 109 public void test04_throwSystemException(){ 110 try{ 111 ejbObject.throwSystemException_NullPointer(); 112 } catch (java.rmi.RemoteException e){ 113 Throwable n = e.detail; 115 assertNotNull("Nested exception should not be is null", n ); 116 assertTrue("Nested exception should be an instance of NullPointerException, but exception is "+n.getClass().getName(), (n instanceof NullPointerException )); 117 return; 118 } catch (Throwable e){ 119 fail("Received Exception "+e.getClass()+ " : "+e.getMessage()); 120 } 121 fail("A NullPointerException should have been thrown."); 122 } 123 124 130 public void BUG_test05_invokeAfterSystemException(){ 131 try{ 132 ejbObject.businessMethod("This refernce is invalid"); 133 fail("A java.rmi.NoSuchObjectException should have been thrown."); 134 } catch (java.rmi.NoSuchObjectException e){ 135 } catch (Throwable e){ 137 fail("Received Exception "+e.getClass()+ " : "+e.getMessage()); 138 } 139 } 140 144 protected void tearDown() throws Exception { 145 super.tearDown(); 146 } 147 } 148 | Popular Tags |