openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From build...@apache.org
Subject svn commit: r883265 - in /websites/staging/openwebbeans/trunk/content: ./ testing_cdictrl.html
Date Sat, 19 Oct 2013 09:12:30 GMT
Author: buildbot
Date: Sat Oct 19 09:12:30 2013
New Revision: 883265

Log:
Staging update by buildbot for openwebbeans

Modified:
    websites/staging/openwebbeans/trunk/content/   (props changed)
    websites/staging/openwebbeans/trunk/content/testing_cdictrl.html

Propchange: websites/staging/openwebbeans/trunk/content/
------------------------------------------------------------------------------
--- cms:source-revision (original)
+++ cms:source-revision Sat Oct 19 09:12:30 2013
@@ -1 +1 @@
-1533716
+1533717

Modified: websites/staging/openwebbeans/trunk/content/testing_cdictrl.html
==============================================================================
--- websites/staging/openwebbeans/trunk/content/testing_cdictrl.html (original)
+++ websites/staging/openwebbeans/trunk/content/testing_cdictrl.html Sat Oct 19 09:12:30 2013
@@ -83,6 +83,24 @@ and controls the lifecycle of it's Conte
 <p>The actual CDI Container is determined by using the <code>java.util.ServiceLoader</code>.
 There are a few different implementations available. Besides Apache OpenWebBeans
 there are also plugins for JBoss Weld and <a href="http://tomee.apache.org">Apache
TomEE</a>. </p>
+<h2 id="adding-openwebbeans-cdictrl-to-your-project">Adding OpenWebBeans CdiCtrl to
your project</h2>
+<p>The following are the dependencies you need in your Apache Maven pom.xml file in
addition to
+OWB itself:</p>
+<div class="codehilite"><pre><span class="nt">&lt;dependency&gt;</span>
+    <span class="nt">&lt;groupId&gt;</span>org.apache.deltaspike.cdictrl<span
class="nt">&lt;/groupId&gt;</span>
+    <span class="nt">&lt;artifactId&gt;</span>deltaspike-cdictrl-api<span
class="nt">&lt;/artifactId&gt;</span>
+    <span class="nt">&lt;version&gt;</span><span class="cp">${</span><span
class="n">deltaspike</span><span class="o">.</span><span class="n">version</span><span
class="cp">}</span><span class="nt">&lt;/version&gt;</span>
+    <span class="nt">&lt;scope&gt;</span>test<span class="nt">&lt;/scope&gt;</span>
+<span class="nt">&lt;/dependency&gt;</span>
+<span class="nt">&lt;dependency&gt;</span>
+    <span class="nt">&lt;groupId&gt;</span>org.apache.deltaspike.cdictrl<span
class="nt">&lt;/groupId&gt;</span>
+    <span class="nt">&lt;artifactId&gt;</span>deltaspike-cdictrl-owb<span
class="nt">&lt;/artifactId&gt;</span>
+    <span class="nt">&lt;version&gt;</span><span class="cp">${</span><span
class="n">deltaspike</span><span class="o">.</span><span class="n">version</span><span
class="cp">}</span><span class="nt">&lt;/version&gt;</span>
+    <span class="nt">&lt;scope&gt;</span>test<span class="nt">&lt;/scope&gt;</span>
+<span class="nt">&lt;/dependency&gt;</span>
+</pre></div>
+
+
 <h2 id="why-use-cdictrl-for-your-unit-tests">Why use CdiCtrl for your unit tests?</h2>
 <p>Whenever you need to write unit tests for a full application, then you will need
to 
 have a CDI container scann all your classes, create <code>Bean&lt;T&gt;</code>
from it and provide 
@@ -94,14 +112,18 @@ as this would cause a big performance lo
 use the CdiCtrls <code>ContextControl</code> mechanism to just stop and restart
the 
 respective CDI Contexts.</p>
 <p>Such a base class could look roughly like the following:</p>
-<div class="codehilite"><pre><span class="kd">public</span> <span
class="kd">abstract</span> <span class="kd">class</span> <span class="nc">ContainerTest</span>
<span class="o">{</span>
+<div class="codehilite"><pre><span class="kn">import</span> <span
class="nn">org.apache.deltaspike.cdise.api.CdiContainer</span><span class="o">;</span>
+<span class="kn">import</span> <span class="nn">org.apache.deltaspike.cdise.api.CdiContainerLoader</span><span
class="o">;</span>
+<span class="kn">import</span> <span class="nn">org.apache.deltaspike.core.api.projectstage.ProjectStage</span><span
class="o">;</span>
+<span class="kn">import</span> <span class="nn">org.apache.deltaspike.core.util.ProjectStageProducer</span><span
class="o">;</span>
+<span class="kn">import</span> <span class="nn">org.apache.deltaspike.core.api.provider.BeanProvider</span><span
class="o">;</span>
+
+<span class="kd">public</span> <span class="kd">abstract</span> <span
class="kd">class</span> <span class="nc">ContainerTest</span> <span
class="o">{</span>
 
     <span class="kd">protected</span> <span class="kd">static</span>
<span class="kd">volatile</span> <span class="n">CdiContainer</span>
<span class="n">cdiContainer</span><span class="o">;</span>
     <span class="c1">// nice to know, since testng executes tests in parallel.</span>
     <span class="kd">protected</span> <span class="kd">static</span>
<span class="kt">int</span> <span class="n">containerRefCount</span>
<span class="o">=</span> <span class="mi">0</span><span class="o">;</span>
 
-    <span class="kd">private</span> <span class="kd">static</span>
<span class="kd">final</span> <span class="n">Logger</span> <span
class="n">logger</span> <span class="o">=</span> <span class="n">LoggerFactory</span><span
class="o">.</span><span class="na">getLogger</span><span class="o">(</span><span
class="n">ContainerTest</span><span class="o">.</span><span class="na">class</span><span
class="o">);</span>
-
     <span class="kd">protected</span> <span class="n">ProjectStage</span>
<span class="nf">runInProjectStage</span><span class="o">()</span>
<span class="o">{</span>
         <span class="k">return</span> <span class="n">ProjectStage</span><span
class="o">.</span><span class="na">UnitTest</span><span class="o">;</span>
     <span class="o">}</span>



Mime
View raw message