Author: struberg
Date: Sat Oct 19 09:12:22 2013
New Revision: 1533717
URL: http://svn.apache.org/r1533717
Log:
improve owb cdictrl section with imports and pom fragments
Modified:
openwebbeans/cms-site/trunk/content/testing_cdictrl.mdtext
Modified: openwebbeans/cms-site/trunk/content/testing_cdictrl.mdtext
URL:
http://svn.apache.org/viewvc/openwebbeans/cms-site/trunk/content/testing_cdictrl.mdtext?rev=1533717&r1=1533716&r2=1533717&view=diff
==============================================================================
--- openwebbeans/cms-site/trunk/content/testing_cdictrl.mdtext (original)
+++ openwebbeans/cms-site/trunk/content/testing_cdictrl.mdtext Sat Oct 19
09:12:22 2013
@@ -30,6 +30,24 @@ The actual CDI Container is determined b
There are a few different implementations available. Besides Apache
OpenWebBeans
there are also plugins for JBoss Weld and [Apache TomEE][2].
+## Adding OpenWebBeans CdiCtrl to your project
+
+The following are the dependencies you need in your Apache Maven pom.xml file
in addition to
+OWB itself:
+
+ <dependency>
+ <groupId>org.apache.deltaspike.cdictrl</groupId>
+ <artifactId>deltaspike-cdictrl-api</artifactId>
+ <version>${deltaspike.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.deltaspike.cdictrl</groupId>
+ <artifactId>deltaspike-cdictrl-owb</artifactId>
+ <version>${deltaspike.version}</version>
+ <scope>test</scope>
+ </dependency>
+
## Why use CdiCtrl for your unit tests?
Whenever you need to write unit tests for a full application, then you will
need to
@@ -46,14 +64,18 @@ respective CDI Contexts.
Such a base class could look roughly like the following:
:::java
+ import org.apache.deltaspike.cdise.api.CdiContainer;
+ import org.apache.deltaspike.cdise.api.CdiContainerLoader;
+ import org.apache.deltaspike.core.api.projectstage.ProjectStage;
+ import org.apache.deltaspike.core.util.ProjectStageProducer;
+ import org.apache.deltaspike.core.api.provider.BeanProvider;
+
public abstract class ContainerTest {
protected static volatile CdiContainer cdiContainer;
// nice to know, since testng executes tests in parallel.
protected static int containerRefCount = 0;
- private static final Logger logger =
LoggerFactory.getLogger(ContainerTest.class);
-
protected ProjectStage runInProjectStage() {
return ProjectStage.UnitTest;
}