Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Note

In CDI mode, the default reactor strategy is PerSuite. Test classes can override this by specifying PerClass. The PerMethod strategy is not supported for CDI containers.

...

OpenWebBeans Container

Pax Exam starts an org.apache.webbeans.cditest.CdiTestContainer and uses the CDI BeanManager to fill all injection points of test classes instantiated by the driver.

Code Block
languagexml
titleProject dependencies for OpenWebBeans container
collapsetrue
<!-- Pax Exam -->
<dependency>
    <groupId>org.ops4j.pax.exam</groupId>
    <artifactId>pax-exam-container-openwebbeans</artifactId>
    <version>${exam.version}</version>
    <scope>test</scope>
</dependency>

<dependency>
    <groupId>org.ops4j.pax.exam</groupId>
    <artifactId>pax-exam-junit4</artifactId>
    <version>${exam.version}</version>
    <scope>test</scope>
</dependency>

<!-- Java EE APIs -->
<dependency>
    <groupId>org.apache.geronimo.specs</groupId>
    <artifactId>geronimo-atinject_1.0_spec</artifactId>
    <scope>provided</scope>
</dependency>

<!-- Logging -->
<dependency>
    <groupId>ch.qos.logback</groupId>
    <artifactId>logback-core</artifactId>
    <version>0.9.29</version>
    <scope>test</scope>
</dependency>

<dependency>
    <groupId>ch.qos.logback</groupId>
    <artifactId>logback-classic</artifactId>
    <version>0.9.29</version>
    <scope>test</scope>
</dependency>

<dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>slf4j-api</artifactId>
</dependency>

<dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>jul-to-slf4j</artifactId>
    <scope>test</scope>
</dependency>

To work with the OpenWebBeans Container, you need the pax-exam-container-openwebbeans artifact and a test driver. At the moment, only pax-exam-junit4 is supported. In addition, you need (a subset of) the Java EE APIs and some logging artifacts.

Pax Exam uses SLF4J whereas OpenWebBeans uses java.util.logging internally. Using the jul-to-slf4j bridge, you can redirect java.util.logging messages to SLF4J. 

Anchor
weld
weld

Weld Container

...

Code Block
xml
xml
<!-- Pax Exam -->
<dependency>
    <groupId>org.ops4j.pax.exam</groupId>
    <artifactId>pax-exam-container-weld</artifactId>
    <version>${exam.version}</version>
    <scope>test</scope>
</dependency>

<dependency>
    <groupId>org.ops4j.pax.exam</groupId>
    <artifactId>pax-exam-junit4</artifactId>
    <version>${exam.version}</version>
    <scope>test</scope>
</dependency>

<!-- Java EE APIs -->
<dependency>
    <groupId>org.apache.geronimo.specs</groupId>
    <artifactId>geronimo-atinject_1.0_spec</artifactId>
    <scope>provided</scope>
</dependency>

<!-- Logging -->
<dependency>
    <groupId>ch.qos.logback</groupId>
    <artifactId>logback-core</artifactId>
    <version>0.9.29</version>
    <scope>test</scope>
</dependency>

<dependency>
    <groupId>ch.qos.logback</groupId>
    <artifactId>logback-classic</artifactId>
    <version>0.9.29</version>
    <scope>test</scope>
</dependency>

<dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>slf4j-api</artifactId>
</dependency>

  Anchorcandicandi

CanDI Container

Pax Exam starts a com.caucho.resin.ResinBeanContainer and uses the CDI BeanManager to fill all injection points of test classes instantiated by the driver.

CanDI, the Resin CDI implementation, does not have a stand-alone distribution artifact, so this container requires the full com.caucho:resin artifact as a dependency.

...