Author: rafabene
Date: Wed Feb  4 19:19:21 2015
New Revision: 1657382

URL: http://svn.apache.org/r1657382
Log:
Site checkin for project Apache DeltaSpike Documentation

Modified:
    deltaspike/site/trunk/content/staging/documentation/cdiimp.html
    deltaspike/site/trunk/content/staging/documentation/container-control.html
    deltaspike/site/trunk/content/staging/documentation/core.html
    deltaspike/site/trunk/content/staging/documentation/projectstage.html
    deltaspike/site/trunk/content/staging/documentation/test-control.html

Modified: deltaspike/site/trunk/content/staging/documentation/cdiimp.html
URL: 
http://svn.apache.org/viewvc/deltaspike/site/trunk/content/staging/documentation/cdiimp.html?rev=1657382&r1=1657381&r2=1657382&view=diff
==============================================================================
--- deltaspike/site/trunk/content/staging/documentation/cdiimp.html (original)
+++ deltaspike/site/trunk/content/staging/documentation/cdiimp.html Wed Feb  4 
19:19:21 2015
@@ -196,12 +196,13 @@ body {
 <li><a href="#_java_ee5_and_servlet_containers">Java EE5 and Servlet 
Containers</a></li>
 <li><a href="#javase6">Java SE6+</a>
 <ul class="sectlevel2">
-<li><a href="#_declare_cdi_dependencies">Declare CDI Dependencies</a>
+<li><a href="#_1_declare_cdi_dependencies">1. Declare CDI Dependencies</a>
 <ul class="sectlevel3">
 <li><a href="#_option_a_declare_dependencies_for_maven_based_projects">Option 
A: Declare Dependencies for Maven-based Projects</a></li>
 <li><a 
href="#_option_b_declare_dependencies_for_maven_independent_projects">Option B: 
Declare Dependencies for Maven-independent Projects</a></li>
 </ul>
 </li>
+<li><a href="#_2_start_the_cdi_container_from_your_project">2. Start the CDI 
Container from Your Project</a></li>
 </ul>
 </li>
 <li><a href="#_next">Next</a></li>
@@ -249,7 +250,7 @@ body {
 <p>Instructions are provided here for adding the required resources to both 
Maven-based and Maven-independent projects and subsequently booting the CDI 
container from your project source code.</p>
 </div>
 <div class="sect2">
-<h3 id="_declare_cdi_dependencies">Declare CDI Dependencies</h3>
+<h3 id="_1_declare_cdi_dependencies">1. Declare CDI Dependencies</h3>
 <div class="sect3">
 <h4 id="_option_a_declare_dependencies_for_maven_based_projects">Option A: 
Declare Dependencies for Maven-based Projects</h4>
 <div class="paragraph">
@@ -386,6 +387,66 @@ body {
 </div>
 </div>
 </div>
+<div class="sect2">
+<h3 id="_2_start_the_cdi_container_from_your_project">2. Start the CDI 
Container from Your Project</h3>
+<div class="paragraph">
+<p>To start a CDI container in your application, you must instantiate a 
<code>CdiContainer</code> object and call the <code>#boot</code> method. When 
<code>#boot</code> is called, the <code>CdiContainer</code> scans CDI-enabled
+archives for beans and CDI extensions. Before the application exits, 
<code>#shutdown</code> must be called to correctly destroy all beans. An 
example is given in the code snippet here.</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="CodeRay highlight"><code data-lang="java"><span 
class="keyword">import</span> <span 
class="include">org.apache.deltaspike.cdise.api.CdiContainer</span>;
+<span class="keyword">import</span> <span 
class="include">org.apache.deltaspike.cdise.api.CdiContainerLoader</span>;
+
+<span class="directive">public</span> <span class="type">class</span> <span 
class="class">MainApp</span> {
+    <span class="directive">public</span> <span 
class="directive">static</span> <span class="type">void</span> main(<span 
class="predefined-type">String</span><span class="type">[]</span> args) {
+
+        CdiContainer cdiContainer = CdiContainerLoader.getCdiContainer();
+        cdiContainer.boot();
+
+        <span class="comment">// You can use CDI here</span>
+
+        cdiContainer.shutdown();
+    }
+}</code></pre>
+</div>
+</div>
+<div class="paragraph">
+<p>Starting the container does not automatically start all CDI Contexts. 
Contexts must be started independently using the provided 
<code>ContextControl</code> class. An example of starting the Context for 
<code>@ApplicationScoped</code> beans is added to the code snippet here.</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="CodeRay highlight"><code data-lang="java"><span 
class="keyword">import</span> <span 
class="include">org.apache.deltaspike.cdise.api.CdiContainer</span>;
+<span class="keyword">import</span> <span 
class="include">org.apache.deltaspike.cdise.api.CdiContainerLoader</span>;
+<span class="keyword">import</span> <span 
class="include">org.apache.deltaspike.cdise.api.ContextControl</span>;
+<span class="keyword">import</span> <span 
class="include">javax.enterprise.context.ApplicationScoped</span>;
+
+<span class="directive">public</span> <span class="type">class</span> <span 
class="class">MainApp</span> {
+    <span class="directive">public</span> <span 
class="directive">static</span> <span class="type">void</span> main(<span 
class="predefined-type">String</span><span class="type">[]</span> args) {
+
+        CdiContainer cdiContainer = CdiContainerLoader.getCdiContainer();
+        cdiContainer.boot();
+
+        <span class="comment">// Starting the application-context enables use 
of @ApplicationScoped beans</span>
+        ContextControl contextControl = cdiContainer.getContextControl();
+        contextControl.startContext(ApplicationScoped.class);
+
+        <span class="comment">// You can use CDI here</span>
+
+        cdiContainer.shutdown();
+    }
+}</code></pre>
+</div>
+</div>
+<div class="paragraph">
+<p>To resolve project beans, you can use the DeltaSpike 
<code>BeanProvider</code> class. Whether <code>EchoService</code> is a concrete 
implementation or just an interface depends on the application. In the case 
that it is an interface, the corresponding implementation is resolved. The 
resolved bean is a standard CDI bean and it can be used for all CDI concepts, 
such as <code>@Inject</code>, in the class without further uses of 
<code>BeanProvider</code>. An example of resolving the bean without qualifiers 
is given in the code snippet here.</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="CodeRay highlight"><code data-lang="java">EchoService echoService 
= BeanProvider.getContextualReference(EchoService.class, <span 
class="predefined-constant">false</span>);</code></pre>
+</div>
+</div>
+</div>
 </div>
 </div>
 <div class="sect1">

Modified: 
deltaspike/site/trunk/content/staging/documentation/container-control.html
URL: 
http://svn.apache.org/viewvc/deltaspike/site/trunk/content/staging/documentation/container-control.html?rev=1657382&r1=1657381&r2=1657382&view=diff
==============================================================================
--- deltaspike/site/trunk/content/staging/documentation/container-control.html 
(original)
+++ deltaspike/site/trunk/content/staging/documentation/container-control.html 
Wed Feb  4 19:19:21 2015
@@ -195,13 +195,11 @@ body {
 <li><a href="#_overview">Overview</a></li>
 <li><a href="#_configure_your_projects">Configure Your Projects</a>
 <ul class="sectlevel2">
-<li><a href="#_enable_cdi_for_your_java_environment">Enable CDI For Your Java 
Environment</a></li>
 <li><a href="#_declare_container_control_module_dependencies">Declare 
Container Control Module Dependencies</a></li>
 </ul>
 </li>
 <li><a href="#_use_the_module_features">Use the Module Features</a>
 <ul class="sectlevel2">
-<li><a href="#_start_the_cdi_container_from_your_project">Start the CDI 
Container from Your Project</a></li>
 <li><a href="#_cdicontainer">CdiContainer</a></li>
 <li><a href="#_contextcontrol_usage">ContextControl Usage</a></li>
 <li><a href="#_procedure_for_builing_uber_jar">Procedure for builing Uber 
jar</a>
@@ -236,12 +234,6 @@ body {
 <p>The configuration information provided here is for Maven-based projects and 
it assumes that you have already declared the DeltaSpike version and DeltaSpike 
Core module for your projects, as detailed in <a 
href="configure.html">Configure DeltaSpike in Your Projects</a>. For 
Maven-independent projects, see <a 
href="configure.html#config-maven-indep">Configure DeltaSpike in 
Maven-independent Projects</a>.</p>
 </div>
 <div class="sect2">
-<h3 id="_enable_cdi_for_your_java_environment">Enable CDI For Your Java 
Environment</h3>
-<div class="paragraph">
-<p>This module requires a CDI implementation to be available in the Java 
environment where your projects are deployed. Dependent on the Java environment 
you choose, some setup may be necessary as detailed at the <a 
href="cdiimp.html">Enable CDI For Your Java Environment</a> page.</p>
-</div>
-</div>
-<div class="sect2">
 <h3 id="_declare_container_control_module_dependencies">Declare Container 
Control Module Dependencies</h3>
 <div class="paragraph">
 <p>Add the Container Control module to the list of dependencies in the project 
<code>pom.xml</code> file using this code snippet:</p>
@@ -263,66 +255,6 @@ body {
 <h2 id="_use_the_module_features">Use the Module Features</h2>
 <div class="sectionbody">
 <div class="sect2">
-<h3 id="_start_the_cdi_container_from_your_project">Start the CDI Container 
from Your Project</h3>
-<div class="paragraph">
-<p>To start a CDI container in your application, you must instantiate a 
<code>CdiContainer</code> object and call the <code>#boot</code> method. When 
<code>#boot</code> is called, the <code>CdiContainer</code> scans CDI-enabled
-archives for beans and CDI extensions. Before the application exits, 
<code>#shutdown</code> must be called to correctly destroy all beans. An 
example is given in the code snippet here.</p>
-</div>
-<div class="listingblock">
-<div class="content">
-<pre class="CodeRay highlight"><code data-lang="java"><span 
class="keyword">import</span> <span 
class="include">org.apache.deltaspike.cdise.api.CdiContainer</span>;
-<span class="keyword">import</span> <span 
class="include">org.apache.deltaspike.cdise.api.CdiContainerLoader</span>;
-
-<span class="directive">public</span> <span class="type">class</span> <span 
class="class">MainApp</span> {
-    <span class="directive">public</span> <span 
class="directive">static</span> <span class="type">void</span> main(<span 
class="predefined-type">String</span><span class="type">[]</span> args) {
-
-        CdiContainer cdiContainer = CdiContainerLoader.getCdiContainer();
-        cdiContainer.boot();
-
-        <span class="comment">// You can use CDI here</span>
-
-        cdiContainer.shutdown();
-    }
-}</code></pre>
-</div>
-</div>
-<div class="paragraph">
-<p>Starting the container does not automatically start all CDI Contexts. 
Contexts must be started independently using the provided 
<code>ContextControl</code> class. An example of starting the Context for 
<code>@ApplicationScoped</code> beans is added to the code snippet here.</p>
-</div>
-<div class="listingblock">
-<div class="content">
-<pre class="CodeRay highlight"><code data-lang="java"><span 
class="keyword">import</span> <span 
class="include">org.apache.deltaspike.cdise.api.CdiContainer</span>;
-<span class="keyword">import</span> <span 
class="include">org.apache.deltaspike.cdise.api.CdiContainerLoader</span>;
-<span class="keyword">import</span> <span 
class="include">org.apache.deltaspike.cdise.api.ContextControl</span>;
-<span class="keyword">import</span> <span 
class="include">javax.enterprise.context.ApplicationScoped</span>;
-
-<span class="directive">public</span> <span class="type">class</span> <span 
class="class">MainApp</span> {
-    <span class="directive">public</span> <span 
class="directive">static</span> <span class="type">void</span> main(<span 
class="predefined-type">String</span><span class="type">[]</span> args) {
-
-        CdiContainer cdiContainer = CdiContainerLoader.getCdiContainer();
-        cdiContainer.boot();
-
-        <span class="comment">// Starting the application-context enables use 
of @ApplicationScoped beans</span>
-        ContextControl contextControl = cdiContainer.getContextControl();
-        contextControl.startContext(ApplicationScoped.class);
-
-        <span class="comment">// You can use CDI here</span>
-
-        cdiContainer.shutdown();
-    }
-}</code></pre>
-</div>
-</div>
-<div class="paragraph">
-<p>To resolve project beans, you can use the DeltaSpike 
<code>BeanProvider</code> class. Whether <code>EchoService</code> is a concrete 
implementation or just an interface depends on the application. In the case 
that it is an interface, the corresponding implementation is resolved. The 
resolved bean is a standard CDI bean and it can be used for all CDI concepts, 
such as <code>@Inject</code>, in the class without further uses of 
<code>BeanProvider</code>. An example of resolving the bean without qualifiers 
is given in the code snippet here.</p>
-</div>
-<div class="listingblock">
-<div class="content">
-<pre class="CodeRay highlight"><code data-lang="java">EchoService echoService 
= BeanProvider.getContextualReference(EchoService.class, <span 
class="predefined-constant">false</span>);</code></pre>
-</div>
-</div>
-</div>
-<div class="sect2">
 <h3 id="_cdicontainer">CdiContainer</h3>
 <div class="paragraph">
 <p>The <code>CdiContainer</code> interface provides booting and shutdown of 
the CDI containers from deployed applications, with 
<code>CdiContainerLoader</code> a simple factory providing access to the 
underlying <code>CdiContainer</code> implementation.</p>

Modified: deltaspike/site/trunk/content/staging/documentation/core.html
URL: 
http://svn.apache.org/viewvc/deltaspike/site/trunk/content/staging/documentation/core.html?rev=1657382&r1=1657381&r2=1657382&view=diff
==============================================================================
--- deltaspike/site/trunk/content/staging/documentation/core.html (original)
+++ deltaspike/site/trunk/content/staging/documentation/core.html Wed Feb  4 
19:19:21 2015
@@ -431,9 +431,10 @@ the lookup strategy you used before, you
 <div class="sect3">
 <h4 id="_type_safe_projectstage">Type-safe ProjectStage</h4>
 <div class="paragraph">
-<p>The DeltaSpike <a href="projectstage.html">ProjectStage</a> mechanism 
allows to
-use configuration and implementations depending on the server
-environment you currently run on.</p>
+<p>The DeltaSpike <a href="projectstage.html">ProjectStage</a> mechanism 
allows to use configuration and implementations depending on the server 
environment you currently run on.</p>
+</div>
+<div class="paragraph">
+<p>DeltaSpike provides some pre-defined <a 
href="projectstage.html#_introduction">ProjectStages</a> but it&#8217;s also 
possible to create your own <a 
href="projectstage.html#_custom_project_stages">Custom Project Stage</a>, 
Please, check the <a href="projectstage.html">DeltaSpike ProjectStage</a> page 
for more details.</p>
 </div>
 </div>
 <div class="sect3">

Modified: deltaspike/site/trunk/content/staging/documentation/projectstage.html
URL: 
http://svn.apache.org/viewvc/deltaspike/site/trunk/content/staging/documentation/projectstage.html?rev=1657382&r1=1657381&r2=1657382&view=diff
==============================================================================
--- deltaspike/site/trunk/content/staging/documentation/projectstage.html 
(original)
+++ deltaspike/site/trunk/content/staging/documentation/projectstage.html Wed 
Feb  4 19:19:21 2015
@@ -192,16 +192,10 @@ body {
 
         <div id="toc" class="toc">
             <ul class="sectlevel1">
-<li><a href="#_introduction">Introduction</a>
-<ul class="sectlevel2">
+<li><a href="#_introduction">Introduction</a></li>
 <li><a href="#_custom_project_stages">Custom Project Stages</a></li>
-<li><a 
href="#_projectstageproducer_for_third_party_portable_extensions">ProjectStageProducer
 (for Third-party Portable Extensions)</a>
-<ul class="sectlevel3">
-<li><a href="#_setting_the_active_projectstage">Setting the Active 
ProjectStage</a></li>
-</ul>
-</li>
-</ul>
-</li>
+<li><a href="#_setting_the_active_projectstage">Setting the active 
ProjectStage</a></li>
+<li><a 
href="#_projectstageproducer_for_third_party_portable_extensions">ProjectStageProducer
 (for Third-party Portable Extensions)</a></li>
 </ul>
             <hr>
             <div class="sect1">
@@ -261,8 +255,11 @@ DeltaSpike.</p>
 <span class="type">boolean</span> isDevProjectStage = 
ProjectStage.Development.equals(<span 
class="local-variable">this</span>.projectStage);</code></pre>
 </div>
 </div>
-<div class="sect2">
-<h3 id="_custom_project_stages">Custom Project Stages</h3>
+</div>
+</div>
+<div class="sect1">
+<h2 id="_custom_project_stages">Custom Project Stages</h2>
+<div class="sectionbody">
 <div class="paragraph">
 <p>It is possible to provide custom project stage implementations.
 Therefore, you have to provide an implementation of the
@@ -290,9 +287,20 @@ you will not use it directly.</p>
 </div>
 <div class="paragraph">
 <p>Configure your custom <code>ProjectStageHolder</code> in
-<code>META-INF/services/org.apache.deltaspike.core.api.projectstage.ProjectStageHolder</code>.
+<code>META-INF/services/org.apache.deltaspike.core.api.projectstage.ProjectStageHolder</code>.</p>
+</div>
+<div class="admonitionblock note">
+<table>
+<tr>
+<td class="icon">
+<i class="fa icon-note" title="Note"></i>
+</td>
+<td class="content">
 The file has to provide the <em>fully qualified</em> class name of the custom
-implementation of the <code>ProjectStageHolder</code> interface.</p>
+implementation of the <code>ProjectStageHolder</code> interface.
+</td>
+</tr>
+</table>
 </div>
 <div class="paragraph">
 <p>Usage of a custom project stage:</p>
@@ -308,21 +316,10 @@ customProjectStage = CustomProjectStageH
 </div>
 </div>
 </div>
-<div class="sect2">
-<h3 
id="_projectstageproducer_for_third_party_portable_extensions">ProjectStageProducer
 (for Third-party Portable Extensions)</h3>
-<div class="paragraph">
-<p><code>ProjectStageProducer</code> provides the producer method which allows 
to
-inject the current ProjectStage. However, in some cases it is needed to
-use ProjectStages also during the bootstrapping process of the CDI
-container and you cais not use injection. In such cases you can use
-<code>ProjectStageProducer.getInstance().getProjectStage()</code> to resolve 
the
-current ProjectStage. This helper also contains helpers for unit-tests
-- e.g. <code>#setProjectStage</code>. However, those methods shouldis not be 
needed
-for users (we just need them for testing different ProjectStage
-scenarios).</p>
 </div>
-<div class="sect3">
-<h4 id="_setting_the_active_projectstage">Setting the Active ProjectStage</h4>
+<div class="sect1">
+<h2 id="_setting_the_active_projectstage">Setting the active ProjectStage</h2>
+<div class="sectionbody">
 <div class="paragraph">
 <p>For setting the ProjectStage which shall get used in your application
 you can specify it in a few ways. The underlying mechanism used to
@@ -336,6 +333,20 @@ determine the string is the ConfigResolv
 </div>
 </div>
 </div>
+<div class="sect1">
+<h2 
id="_projectstageproducer_for_third_party_portable_extensions">ProjectStageProducer
 (for Third-party Portable Extensions)</h2>
+<div class="sectionbody">
+<div class="paragraph">
+<p><code>ProjectStageProducer</code> provides the producer method which allows 
to
+inject the current ProjectStage. However, in some cases it is needed to
+use ProjectStages also during the bootstrapping process of the CDI
+container and you cais not use injection. In such cases you can use
+<code>ProjectStageProducer.getInstance().getProjectStage()</code> to resolve 
the
+current ProjectStage. This helper also contains helpers for unit-tests
+- e.g. <code>#setProjectStage</code>. However, those methods shouldis not be 
needed
+for users (we just need them for testing different ProjectStage
+scenarios).</p>
+</div>
 </div>
 </div>
         </div>

Modified: deltaspike/site/trunk/content/staging/documentation/test-control.html
URL: 
http://svn.apache.org/viewvc/deltaspike/site/trunk/content/staging/documentation/test-control.html?rev=1657382&r1=1657381&r2=1657382&view=diff
==============================================================================
--- deltaspike/site/trunk/content/staging/documentation/test-control.html 
(original)
+++ deltaspike/site/trunk/content/staging/documentation/test-control.html Wed 
Feb  4 19:19:21 2015
@@ -232,10 +232,12 @@ body {
 <li><a href="#_jsf_via_myfaces_test">JSF (via MyFaces-Test)</a></li>
 </ul>
 </li>
+<li><a href="#_using_jersey_test_with_test_control">Using jersey-test with 
test-control</a></li>
 <li><a href="#_mixed_tests">Mixed Tests</a></li>
 <li><a href="#_known_restrictions">Known Restrictions</a>
 <ul class="sectlevel3">
 <li><a href="#_liquibase">Liquibase</a></li>
+<li><a href="#_gradle">Gradle</a></li>
 </ul>
 </li>
 <li><a href="#_spi">SPI</a>
@@ -732,6 +734,80 @@ constructor) and specify the target-type
 </div>
 </div>
 <div class="sect2">
+<h3 id="_using_jersey_test_with_test_control">Using jersey-test with 
test-control</h3>
+<div class="paragraph">
+<p>jersey-test starts jetty which answers requests in a separated thread. 
since ds test-control just handles the thread of the test itself, it&#8217;s 
needed to integrate jetty and jersey with the cdi-container. usually 
that&#8217;s done via a ServletRequestListener - the following part describes 
an alternative approach for jersey-test:</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="CodeRay highlight"><code data-lang="java"><span 
class="comment">//use: 
-Djersey.config.test.container.factory=custom.CdiAwareJettyTestContainerFactory</span>
+
+<span class="annotation">@RunWith</span>(CdiTestRunner.class)
+<span class="directive">public</span> <span class="type">class</span> <span 
class="class">SimpleCdiAndJaxRsTest</span> <span 
class="directive">extends</span> JerseyTest {
+  <span class="comment">//...</span>
+}</code></pre>
+</div>
+</div>
+<div class="paragraph">
+<p>or</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="CodeRay highlight"><code data-lang="java"><span 
class="directive">public</span> <span class="type">class</span> <span 
class="class">CdiAwareJerseyTest</span> <span class="directive">extends</span> 
JerseyTest {
+    <span class="directive">static</span> {
+        <span class="predefined-type">System</span>.setProperty(<span 
class="string"><span class="delimiter">&quot;</span><span 
class="content">jersey.config.test.container.factory</span><span 
class="delimiter">&quot;</span></span>,CdiAwareJettyTestContainerFactory.class.getName());
+    }
+}
+
+<span class="annotation">@RunWith</span>(CdiTestRunner.class)
+<span class="directive">public</span> <span class="type">class</span> <span 
class="class">SimpleCdiAndJaxRsTest</span> <span 
class="directive">extends</span> CdiAwareJerseyTest {
+    <span class="comment">//...</span>
+}</code></pre>
+</div>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="CodeRay highlight"><code data-lang="java"><span 
class="directive">public</span> <span class="type">class</span> <span 
class="class">CdiAwareJettyTestContainerFactory</span> <span 
class="directive">implements</span> TestContainerFactory {
+    <span class="annotation">@Override</span>
+    <span class="directive">public</span> TestContainer create(<span 
class="directive">final</span> <span class="predefined-type">URI</span> 
baseUri, <span class="directive">final</span> DeploymentContext context) <span 
class="directive">throws</span> <span 
class="exception">IllegalArgumentException</span> {
+        <span class="keyword">return</span> <span class="keyword">new</span> 
CdiAwareJettyTestContainer(baseUri, context);
+    }
+}</code></pre>
+</div>
+</div>
+<div class="paragraph">
+<p>CdiAwareJettyTestContainer is a copy of 
JettyTestContainerFactory.JettyTestContainer but with</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="CodeRay highlight"><code data-lang="java">HandlerWrapper 
cdiHandlerWrapper = <span class="keyword">new</span> CdiAwareHandlerWrapper();
+cdiHandlerWrapper.setHandler(<span 
class="local-variable">this</span>.server.getHandler());
+<span 
class="local-variable">this</span>.server.setHandler(cdiHandlerWrapper);</code></pre>
+</div>
+</div>
+<div class="paragraph">
+<p>after the line with JettyHttpContainerFactory#createServer</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="CodeRay highlight"><code data-lang="java"><span 
class="comment">//activate the request-context e.g. via:</span>
+<span class="directive">public</span> <span class="type">class</span> <span 
class="class">CdiAwareHandlerWrapper</span> <span 
class="directive">extends</span> HandlerWrapper {
+    <span class="annotation">@Override</span>
+    <span class="directive">public</span> <span class="type">void</span> 
handle(<span class="predefined-type">String</span> target, Request baseRequest, 
HttpServletRequest request, HttpServletResponse response) <span 
class="directive">throws</span> <span class="exception">IOException</span>, 
ServletException {
+        CdiContainer cdiContainer = CdiContainerLoader.getCdiContainer();
+
+        <span class="keyword">try</span> {
+            cdiContainer.getContextControl().startContext(RequestScoped.class);
+            <span class="local-variable">super</span>.handle(target, 
baseRequest, request, response);
+        } <span class="keyword">finally</span> {
+            cdiContainer.getContextControl().stopContext(RequestScoped.class);
+        }
+    }
+}</code></pre>
+</div>
+</div>
+</div>
+<div class="sect2">
 <h3 id="_mixed_tests">Mixed Tests</h3>
 <div class="paragraph">
 <p>Usually you should have one kind of tests per test-module. However, if
@@ -781,6 +857,29 @@ mocking-support via:</p>
 <p>Further details are available at deactivatable.</p>
 </div>
 </div>
+<div class="sect3">
+<h4 id="_gradle">Gradle</h4>
+<div class="paragraph">
+<p>Gradle by default does not put resources and compiled sources in to the 
same directory.
+When running a test using Gradle, this means your classes will not be in bean 
archives as
+defined by the CDI spec.  To work around this, you need to set your main and 
test directories
+for resources to point to where the compiled code lives.  This is an example 
of how to do that:</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="CodeRay highlight"><code data-lang="groovy">sourceSets {
+    main {
+        output.resourcesDir = <span class="string"><span 
class="delimiter">'</span><span class="content">build/classes/main</span><span 
class="delimiter">'</span></span>
+        output.classesDir   = <span class="string"><span 
class="delimiter">'</span><span class="content">build/classes/main</span><span 
class="delimiter">'</span></span>
+    }
+    test {
+        output.resourcesDir = <span class="string"><span 
class="delimiter">'</span><span class="content">build/classes/test</span><span 
class="delimiter">'</span></span>
+        output.classesDir   = <span class="string"><span 
class="delimiter">'</span><span class="content">build/classes/test</span><span 
class="delimiter">'</span></span>
+    }
+}</code></pre>
+</div>
+</div>
+</div>
 </div>
 <div class="sect2">
 <h3 id="_spi">SPI</h3>


Reply via email to