| org.mockejb.test.entity.BMPEntityBeanTest
BMPEntityBeanTest | public class BMPEntityBeanTest extends TestCase (Code) | | Demonstrates BMP Entity bean support.
MockEJB calls BMP entity beans same way with session beans,
however finders have to be handled using aspects/interceptors framework.
BMP finders always return primary key(s), so clients have to write
interceptors to translate primary key to the entity.
|
Inner Class :class PersonFinderAspect implements Aspect | |
Method Summary | |
public void | setUp() Sets up our mock container, JNDI context and deploy the beans that we need. | public void | tearDown() | public void | testFinderAndEjbLoad() This test demonstrates how we can test BMP entities that
indeed read something from the database. | public void | testFinderUsingAspect() Demonstrates how to setup BMP finder support with the help of
interceptors. | public void | testFinderUsingEntityDatabase() Demonstrates how to tell MockEJB to resolve the PKs returned by the
finder without the use of interceptors. |
BMPEntityBeanTest | public BMPEntityBeanTest(String testName)(Code) | | |
setUp | public void setUp() throws Exception(Code) | | Sets up our mock container, JNDI context and deploy the beans that we need.
|
tearDown | public void tearDown()(Code) | | |
testFinderAndEjbLoad | public void testFinderAndEjbLoad() throws Exception(Code) | | This test demonstrates how we can test BMP entities that
indeed read something from the database.
MockEJB does the following:
it calls the finder, checks if the returned PK is in the EntityDatabase.
If not, it creates a new entity instance and calls ejbLoad on it
|
testFinderUsingAspect | public void testFinderUsingAspect() throws Exception(Code) | | Demonstrates how to setup BMP finder support with the help of
interceptors. PersonFinderAspect (see the code at bottom of this file)
ignores the PK values returned by the real finder and substitutes them
with the Person entities that it creates.
This can be used to provide mock data for testing as opposed to
relying on the database.
|
testFinderUsingEntityDatabase | public void testFinderUsingEntityDatabase() throws Exception(Code) | | Demonstrates how to tell MockEJB to resolve the PKs returned by the
finder without the use of interceptors.
|
|
|