Menu

ejb-framework-sample

Harry Gardner

Introduction
The EJB Framework project, located in samples/ejb-framework directory, shows usage of DAL4j EJB Framework which makes it easy to integrate generated Entity Beans into EJB 3 Session Beans.
Note that the examples were built to run under jboss 5.1, its possible that tweaks may be required to get the tests to work under a different application server.
For examples of the SessionBean interface and implementation classes which use the DAL4j EJB framework, see class files in: src/com/dal4j/sample/ejbframework/
Once built, this project will deploy the following:
1. The dal4j runtime jar.
2. Cactus and libraries required to run cactus in a jboss 5.1 environment.
NOTE: This is one area where tweaks might be required.
3. The Test EJB jar: dal4j-sample-ejb.jar
4. The cactus unit test war dal4j-unit-test.war

Setup
1. Edit build.properties to point to the application server the tests will be executed under. The properties that will need to be modified are:
# Location of the build time EJB definitions.
j2ee.jar=c:/jboss-5.1.0.GA/common/lib/jboss-javaee.jar
# Application server directory where the test ejb.jar should be deployed.
app.server.deploy.dir=c:/jboss-5.1.0.GA/server/default/deploy
# Application server directory where other jars can be deployed
app.server.lib.dir=c:/jboss-5.1.0.GA/server/default/lib
2. If necessary, modify META-INF/persistence.xml as required for your app server environment. This default persistence.xml file uses the hibernate JPA provider which ships with jboss. Also, the default datasource JNDI name is: java:/DAL4j-DS, change this as needed.

Build, Deployment, and Test Execution
1. To build and deploy the ejb-jar and cactus unit test run 'ant' from the samples/ejb directory.
2. Then start the application server.
NOTE: Make sure the application server has a data source with JNDI name: 'java:/DAL4j DS' deployed. If a different datasource should be used, modify META-INF/persistence.xml.
NOTE 2: Make sure the app server is bound to localhost, cactus seems to not function if the appserver is not bound to localhost...
3. Assuming the application server started clean, the cactus unit tests can be executed by opening a browser and navigating to the following URL:
http://localhost/dal4j-ejb-unit-test/ServletTestRunner?suite=com.dal4j.sample.test.EJBFrameworkTest&xsl=cactus-report.xsl
For Example, jboss on port 8080 would look like the following:
http://localhost:8080/dal4j-ejb-unit-test/ServletTestRunner?suite=com.dal4j.sample.test.EJBFrameworkTest&xsl=cactus-report.xsl
4. The results of the test will be displayed in the browser screen.


Related

Wiki: Home

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.