List of usage examples for javax.ejb NoSuchEJBException getMessage
public String getMessage()
From source file:org.jboss.ejb3.test.ejbthree1222.unit.RegularRemoveMethodUnitTestCase.java
/** * Tests that a call to an unannotated "void remove()" * method is a traditional call on a remote view *///from w w w. jav a 2s.c om public void testRemoteNormalMethodNamedRemove() throws Exception { // Lookup Bean TestStatefulWithRemoveMethodRemoteBusiness bean = (TestStatefulWithRemoveMethodRemoteBusiness) this .getInitialContext().lookup(TestStatefulWithRemoveMethodRemoteBusiness.JNDI_NAME); // Reset the number of calls, if any bean.reset(); // Make a call try { bean.remove(); } catch (Exception e) { logger.error(e.getMessage(), e); TestCase.fail(e.getMessage()); } try { // Ensure the call was received and the bean instance is still available TestCase.assertEquals(1, bean.getCalls()); } catch (NoSuchEJBException nsee) { // "void remove()" should not have been handled as EJB2.1 call TestCase.fail("Bean should not have been removed: " + nsee.getMessage()); } }
From source file:org.jboss.ejb3.test.ejbthree1222.unit.RegularRemoveMethodUnitTestCase.java
/** * Tests that a call to an unannotated "void remove()" * method is a traditional call on a local view *///from w w w. ja va 2 s . c o m public void testLocalNormalMethodNamedRemove() throws Exception { // Lookup Access Bean AccessLocalSfsbRemoteBusiness bean = (AccessLocalSfsbRemoteBusiness) this.getInitialContext() .lookup(AccessLocalSfsbRemoteBusiness.JNDI_NAME); // Reset the number of calls, if any bean.resetOnLocalBusiness(); // Make a call try { bean.removeOnLocalBusiness(); } catch (Exception e) { logger.error(e.getMessage(), e); TestCase.fail(e.getMessage()); } try { // Ensure the call was received and the bean instance is still available TestCase.assertEquals(1, bean.getCallsOnLocalBusiness()); } catch (NoSuchEJBException nsee) { // "void remove()" should not have been handled as EJB2.1 call TestCase.fail("Bean should not have been removed: " + nsee.getMessage()); } }