Java Reference
In-Depth Information
named chapter15-ejb , and they're relatively simple so the EJBContainer config-
uration won't be too difficult. But the example code is also not trivial, so it's worthwhile to
demonstrate the use of EJBContainer . The first configuration we'll look at is the Maven
pom.xml.
Maven
The /chapter15-ejb-embedded-test/pom.xml will need a number of changes to run the in-
tegration tests using the embedded EJBContainer . The first change you need to be
aware of is a property defining what version of the chapter15-ejb project you want to
test. Your EJB project will most likely have multiple versions because code is developed
and pushed to production over the years. As this happens, testing must also change to keep
pace with the code it's testing. This property defines what version of the EJB code is to be
tested:
<properties>
<chapter15-ejb.version>1.0</chapter15-ejb.version>
</properties>
The reason you define this as a property is because you're going to need the value in a
couple of different places inside pom.xml. It's always bad to duplicate version numbers
like this, so a property to hold the value will do nicely. The first use of this property will be
to add a dependency on the chapter15-ejb project. Adding the dependency is just like
adding any other Maven dependency, but you use the property to define the version:
<dependency>
<groupId>com.actionbazaar<groupId>
<artifactId>chapter15-ejb</artifactId>
<version>${chapter15-ejb.version}</version>
<scope>test</scope>
</dependency>
You need to use this property in one more configuration change in pom.xml. You need to
configure maven-surefire-plugin and pass a module name to the integration test.
You'll see why you need to do this in a moment, but for right now, this is the maven-
surefire-plugin configuration:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
Search WWH ::




Custom Search