deltaspike-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From build...@apache.org
Subject svn commit: r939004 - in /websites/staging/deltaspike/trunk/content: ./ documentation/test-control.html
Date Wed, 04 Feb 2015 19:23:44 GMT
Author: buildbot
Date: Wed Feb  4 19:23:44 2015
New Revision: 939004

Log:
Staging update by buildbot for deltaspike

Modified:
    websites/staging/deltaspike/trunk/content/   (props changed)
    websites/staging/deltaspike/trunk/content/documentation/test-control.html

Propchange: websites/staging/deltaspike/trunk/content/
------------------------------------------------------------------------------
--- cms:source-revision (original)
+++ cms:source-revision Wed Feb  4 19:23:44 2015
@@ -1 +1 @@
-1657382
+1657385

Modified: websites/staging/deltaspike/trunk/content/documentation/test-control.html
==============================================================================
--- websites/staging/deltaspike/trunk/content/documentation/test-control.html (original)
+++ websites/staging/deltaspike/trunk/content/documentation/test-control.html Wed Feb  4 19:23:44
2015
@@ -736,14 +736,15 @@ constructor) and specify the target-type
 <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>
+<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="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>
@@ -753,23 +754,28 @@ constructor) and specify the target-type
 </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());
+<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="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 {
+<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="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>
@@ -791,15 +797,20 @@ cdiHandlerWrapper.setHandler(<span class
 <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="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 {
+    <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> {
+        <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> {
+        }
+        <span class="keyword">finally</span>
+        {
             cdiContainer.getContextControl().stopContext(RequestScoped.class);
         }
     }



Mime
View raw message