MockEJB Examples

  • HelloWorldTest. The name says it all. This test shows how to call a simple session bean's method without using any of the advanced MockEJB features.
  • FundamentalsTest. Demonstrates the basics of MockEJB, such as JNDI setup, deployment of stateless session beans and the use of interceptors.
  • JdbcAndTransactionTest. Demonstrates the use of JDBC and container-managed transactions with MockEJB.
  • MDBTest. Demonstrates how to use mock JMS and how to run and test message-driven beans. This example also shows how to test a session bean that sends a JMS message.
  • StatefulTest. Demonstrates how to run and test stateful session beans with MockEJB.
  • EntityBeanTest. Demonstrates how to run and test CMP entity beans with MockEJB. It covers "create",finders, ejbHome and ejbSelect methods.
  • BMPEntityBeanTest. Demonstrates how to run and test BMP entity beans with MockEJB. It covers "create" and finders.

If you want to build and run MockEJB examples, please review build_test.xml build script included with MockEJB distribution. Before you can run it, you need to create your own build.properties file with the location of the external libraries that MockEJB test classes depend upon. You can use build.properties.sample file as the starting point. Do not use the "build.xlm" file to run the examples, this build script is intended for rebuilding mockejb.jar.

If you want to run MockEJB examples in the container, you might need to add your own deployment target. build_test.xml only supports Weblogic at this point. You also need to add cactus.properties file to the "testfiles" directory.

MockEJB distribution does not contain any of the external libraries required to build and run test class, you will have to download them yourself. Please see build.properties for the full list of dependencies.