Example usage for javax.ejb NoSuchEJBException getMessage

List of usage examples for javax.ejb NoSuchEJBException getMessage

Introduction

In this page you can find the example usage for javax.ejb NoSuchEJBException getMessage.

Prototype

public String getMessage() 

Source Link

Document

Returns the detail message string of this throwable.

Usage

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());
    }

}