This example demonstrates the use of Seam in a Java EE 6 environment. Transaction and persistence context management is handled by the EJB container. This example runs on JBoss AS as an EAR.
To deploy the example to a running JBoss AS instance, follow these steps:
-
In the example root directory run:
mvn clean install
-
Set JBOSS_HOME environment property.
-
In the booking-ear directory run:
mvn jboss-as:deploy
-
Open this URL in a web browser: http://localhost:8080/seam-booking
-
In the example root directory run:
ant clean package
-
Copy
seam-booking.ear
from directorybooking-ear/target
to the deployment directory of JBoss AS($JBOSS_HOME/standalone/deployments
by default) -
Open this URL in a web browser:
http://localhost:8080/seam-booking
To deploy Booking example on openshift you can use prepared openshift profile like
mvn clean install -Popenshift
for creating deployments/seam-booking.ear and changing the web context root of application to be "/" to not append seam-booking string into web context root. You only need to use it like this is in your Openshift git repository.
This example is covered by integration and functional tests. All tests use the following technologies:
- Arquillian - as the framework for EE testing, for managing of container lifecycle and deployment of test archive,
- ShrinkWrap - to create the test archive (WAR).
Integration tests cover core application logic and reside in the EJB module. In addition to Arquillian and ShrinkWrap, the integration tests also use:
- JUnitSeamTest - to hook into the JSF lifecycle and assert server-side state,
- ShrinkWrap Resolver - to resolve dependencies of the project for packaging in the test archive.
The tests are executed in Maven's test phase. By default they are skipped and can be executed on JBoss AS with:
mvn clean test -Darquillian=jbossas-managed-7
The JBOSS_HOME
environment variable must be set and point to a JBoss AS instance directory.
To test on a running server, use
mvn clean test -Darquillian=jbossas-remote-7
In the example root directory run:
ant clean test
Functional tests are located in a separate project and are not executed during the build of the example. They test the built archive in an application server through browser-testing. They use:
- Arquillian Graphene Extension - an advanced Ajax-capable type-safe Selenium-based browser testing tool,
- Arquillian Drone Extension - to automatically run and stop browser instances.
Note: It is necessary to first build and package the example, because the functional test references the built archive for automatic deployment to the server.
Run the functional test on JBoss AS instance with
mvn -f booking-ftest/pom.xml clean test
The JBOSS_HOME
environment variable must be set and point to a JBoss AS instance directory.
Several variables can be configured:
-
path to an alternative archive for testing
-DtestDeployment=/path/to/archive.ear
-
the browser to use for testing
-Dbrowser=htmlUnit
-
test on a running server
-Dremote
-
Open JBDS and start a configured instance of JBoss AS
-
Import the example project and its submodules
-
In the Project Explorer, select the EJB module project, then
- Type
Ctrl+Alt+P
(Select Maven Profiles) and checkintegration-tests
andarq-jbossas-7-remote
- Right-click the module and select Run As - JUnit Test
- Type
It is not possible to run the functional tests of this example in JBDS, because they use the maven-dependency-plugin to copy test classes from a different maven artifact, which is not a configuration supported by JBDS.