[seam-commits] Seam SVN: r14593 - in branches/community/Seam_2_3/examples-ee6/restbay/restbay-tests: src/test/java/org/jboss/seam/example/restbay/test and 1 other directories.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Mon Apr 16 13:15:15 EDT 2012


Author: maschmid
Date: 2012-04-16 13:15:14 -0400 (Mon, 16 Apr 2012)
New Revision: 14593

Added:
   branches/community/Seam_2_3/examples-ee6/restbay/restbay-tests/src/test/java/org/jboss/seam/example/restbay/test/Deployments.java
   branches/community/Seam_2_3/examples-ee6/restbay/restbay-tests/src/test/resources-integration/arquillian.xml
   branches/community/Seam_2_3/examples-ee6/restbay/restbay-tests/src/test/resources-integration/web.xml
Modified:
   branches/community/Seam_2_3/examples-ee6/restbay/restbay-tests/pom.xml
   branches/community/Seam_2_3/examples-ee6/restbay/restbay-tests/src/test/java/org/jboss/seam/example/restbay/test/AuctionServiceTest.java
   branches/community/Seam_2_3/examples-ee6/restbay/restbay-tests/src/test/java/org/jboss/seam/example/restbay/test/BasicServiceTest.java
   branches/community/Seam_2_3/examples-ee6/restbay/restbay-tests/src/test/java/org/jboss/seam/example/restbay/test/ContextDataTest.java
   branches/community/Seam_2_3/examples-ee6/restbay/restbay-tests/src/test/java/org/jboss/seam/example/restbay/test/ResourceHomeTest.java
   branches/community/Seam_2_3/examples-ee6/restbay/restbay-tests/src/test/java/org/jboss/seam/example/restbay/test/ResourceQueryTest.java
   branches/community/Seam_2_3/examples-ee6/restbay/restbay-tests/src/test/java/org/jboss/seam/example/restbay/test/SecurityTest.java
   branches/community/Seam_2_3/examples-ee6/restbay/restbay-tests/src/test/java/org/jboss/seam/example/restbay/test/SubresourceTest.java
Log:
update restbay seamtest


Modified: branches/community/Seam_2_3/examples-ee6/restbay/restbay-tests/pom.xml
===================================================================
--- branches/community/Seam_2_3/examples-ee6/restbay/restbay-tests/pom.xml	2012-04-16 16:06:53 UTC (rev 14592)
+++ branches/community/Seam_2_3/examples-ee6/restbay/restbay-tests/pom.xml	2012-04-16 17:15:14 UTC (rev 14593)
@@ -53,7 +53,25 @@
         <dependency>
             <groupId>org.jboss.spec.javax.el</groupId>
             <artifactId>jboss-el-api_2.2_spec</artifactId>
-        </dependency>        
+        </dependency>
+
+        <dependency>
+            <groupId>org.jboss.arquillian.junit</groupId>
+            <artifactId>arquillian-junit-container</artifactId>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.jboss.arquillian.protocol</groupId>
+            <artifactId>arquillian-protocol-servlet</artifactId>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.jboss.spec.javax.el</groupId>
+            <artifactId>jboss-el-api_2.2_spec</artifactId>
+        </dependency>
+ 
     </dependencies>
     
     <build>
@@ -62,6 +80,9 @@
                 <directory>src/test/resources</directory>
                 <filtering>true</filtering>
             </testResource>
+            <testResource>
+                <directory>src/test/resources-integration</directory>
+            </testResource>
         </testResources>
         <plugins>
             <plugin>
@@ -72,6 +93,45 @@
                 </configuration>
             </plugin>
         </plugins>     
-    </build>    
+    </build>
+
+    <profiles>
+        <profile>
+            <id>integration-tests</id>
+            <activation>
+                <property>
+                    <name>arquillian</name>
+                </property>
+            </activation> 
+        </profile>
+
+        <profile>
+            <id>arq-jbossas-7-managed</id>
+            <activation>
+                <property>
+                    <name>arquillian</name>
+                    <value>jbossas-managed-7</value>
+                </property>
+            </activation>
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>org.apache.maven.plugins</groupId>
+                        <artifactId>maven-dependency-plugin</artifactId>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+
+        <profile>
+            <id>arq-jbossas-7-remote</id>
+            <activation>
+                <property>
+                    <name>arquillian</name>
+                    <value>jbossas-remote-7</value>
+                </property>
+            </activation>
+        </profile>
+    </profiles> 
     
 </project>

Modified: branches/community/Seam_2_3/examples-ee6/restbay/restbay-tests/src/test/java/org/jboss/seam/example/restbay/test/AuctionServiceTest.java
===================================================================
--- branches/community/Seam_2_3/examples-ee6/restbay/restbay-tests/src/test/java/org/jboss/seam/example/restbay/test/AuctionServiceTest.java	2012-04-16 16:06:53 UTC (rev 14592)
+++ branches/community/Seam_2_3/examples-ee6/restbay/restbay-tests/src/test/java/org/jboss/seam/example/restbay/test/AuctionServiceTest.java	2012-04-16 17:15:14 UTC (rev 14593)
@@ -1,11 +1,17 @@
 package org.jboss.seam.example.restbay.test;
 
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.OverProtocol;
+import org.jboss.arquillian.junit.Arquillian;
 import org.jboss.seam.mock.EnhancedMockHttpServletResponse;
-import org.jboss.seam.mock.SeamTest;
+import org.jboss.seam.mock.JUnitSeamTest;
 import org.jboss.seam.mock.ResourceRequestEnvironment;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-import org.junit.Ignore;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
 
 import static org.jboss.seam.mock.ResourceRequestEnvironment.Method;
 import static org.jboss.seam.mock.ResourceRequestEnvironment.ResourceRequest;
@@ -13,13 +19,22 @@
 import java.util.HashMap;
 import java.util.Map;
 
- at Ignore
-public class AuctionServiceTest extends SeamTest
+ at RunWith(Arquillian.class)
+public class AuctionServiceTest extends JUnitSeamTest
 {
+   @Deployment(name="AuctionServiceTest")
+   @OverProtocol("Servlet 3.0")
+   public static Archive<?> createDeployment()
+   {
+      EnterpriseArchive er = Deployments.restbayDeployment();
+      WebArchive web = er.getAsType(WebArchive.class, "restbay-web.war");
+      web.addClasses(AuctionServiceTest.class);
+      return er;
+   }
 
    ResourceRequestEnvironment requestEnv;
 
-   @BeforeClass
+   @Before
    public void prepareEnv() throws Exception
    {
       requestEnv = new ResourceRequestEnvironment(this)

Modified: branches/community/Seam_2_3/examples-ee6/restbay/restbay-tests/src/test/java/org/jboss/seam/example/restbay/test/BasicServiceTest.java
===================================================================
--- branches/community/Seam_2_3/examples-ee6/restbay/restbay-tests/src/test/java/org/jboss/seam/example/restbay/test/BasicServiceTest.java	2012-04-16 16:06:53 UTC (rev 14592)
+++ branches/community/Seam_2_3/examples-ee6/restbay/restbay-tests/src/test/java/org/jboss/seam/example/restbay/test/BasicServiceTest.java	2012-04-16 17:15:14 UTC (rev 14593)
@@ -1,16 +1,25 @@
 package org.jboss.seam.example.restbay.test;
 
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.OverProtocol;
+import org.jboss.arquillian.junit.Arquillian;
 import org.jboss.seam.mock.EnhancedMockHttpServletResponse;
 import org.jboss.seam.mock.EnhancedMockHttpServletRequest;
+import org.jboss.seam.mock.JUnitSeamTest;
 import org.jboss.seam.mock.SeamTest;
 import org.jboss.seam.mock.ResourceRequestEnvironment;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+
 import static org.jboss.seam.mock.ResourceRequestEnvironment.Method;
 import static org.jboss.seam.mock.ResourceRequestEnvironment.ResourceRequest;
-import org.testng.annotations.Test;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.BeforeClass;
-import static org.testng.Assert.assertEquals;
+
+import org.junit.Before;
 import org.junit.Ignore;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import static org.junit.Assert.*;
 
 import javax.servlet.http.Cookie;
 import javax.ws.rs.core.MediaType;
@@ -69,13 +78,22 @@
  * </pre>
  *
  */
- at Ignore
-public class BasicServiceTest extends SeamTest
+ at RunWith(Arquillian.class)
+public class BasicServiceTest extends JUnitSeamTest
 {
+   @Deployment(name="BasicServiceTest")
+   @OverProtocol("Servlet 3.0")
+   public static Archive<?> createDeployment()
+   {
+      EnterpriseArchive er = Deployments.restbayDeployment();
+      WebArchive web = er.getAsType(WebArchive.class, "restbay-web.war");
+      web.addClasses(BasicServiceTest.class);
+      return er;
+   }
 
    ResourceRequestEnvironment requestEnv;
 
-   @BeforeClass
+   @Before
    public void prepareEnv() throws Exception
    {
       requestEnv = new ResourceRequestEnvironment(this)
@@ -84,9 +102,9 @@
          public Map<String, Object> getDefaultHeaders()
          {
             return new HashMap<String, Object>()
-            {{
-                  put("Accept", "text/plain");
-               }};
+                  {{
+                     put("Accept", "text/plain");
+                  }};
          }
 
          @Override
@@ -98,22 +116,21 @@
       };
    }
 
-   @DataProvider(name = "queryPaths")
-   public Object[][] getData()
+   public String[] getQueryPaths()
    {
-      return new String[][] {
-            { "/restv1/plainTest" },
+      return new String[] {
+            "/restv1/plainTest",
 
-            { "/restv1/eventComponentTest" },
-            { "/restv1/applicationComponentTest" },
-            { "/restv1/statelessComponentTest" },
+            "/restv1/eventComponentTest",
+            "/restv1/applicationComponentTest",
+            "/restv1/statelessComponentTest",
 
-            { "/restv1/interfaceEventComponentTest" },
-            { "/restv1/interfaceApplicationComponentTest" },
-            { "/restv1/interfaceStatelessComponentTest" },
+            "/restv1/interfaceEventComponentTest",
+            "/restv1/interfaceApplicationComponentTest",
+            "/restv1/interfaceStatelessComponentTest",
 
-            { "/restv1/statelessEjbTest" },
-            { "/restv1/statelessEjbComponentTest" }
+            "/restv1/statelessEjbTest",
+            "/restv1/statelessEjbComponentTest"
       };
    }
 
@@ -125,308 +142,325 @@
          @Override
          protected void onResponse(EnhancedMockHttpServletResponse response)
          {
-            assertEquals(response.getStatus(), 200);
-            assertEquals(response.getContentAsString(), "Root");
+            assertEquals(200, response.getStatus());
+            assertEquals("Root", response.getContentAsString());
          }
 
       }.run();
    }
 
-   @Test(dataProvider = "queryPaths")
-   public void testExeptionMapping(final String resourcePath) throws Exception
+   @Test
+   public void testExeptionMapping() throws Exception
    {
-      new ResourceRequest(requestEnv, Method.GET, resourcePath + "/trigger/unsupported")
+      for (String resourcePath : getQueryPaths())
       {
-
-         @Override
-         protected void onResponse(EnhancedMockHttpServletResponse response)
+         new ResourceRequest(requestEnv, Method.GET, resourcePath + "/trigger/unsupported")
          {
-            assert response.getStatus() == 501;
-            assert response.getStatusMessage().equals("The request operation is not supported: foo");
-         }
 
-      }.run();
+            @Override
+            protected void onResponse(EnhancedMockHttpServletResponse response)
+            {
+               assert response.getStatus() == 501;
+               assert response.getStatusMessage().equals("The request operation is not supported: foo");
+            }
 
+         }.run();
+      }
    }
 
-   @Test(dataProvider = "queryPaths")
-   public void testEchos(final String resourcePath) throws Exception
+   @Test
+   public void testEchos() throws Exception
    {
-      new ResourceRequest(requestEnv, Method.GET, resourcePath + "/echouri")
+      for (String resourcePath : getQueryPaths())
       {
-
-         @Override
-         protected void onResponse(EnhancedMockHttpServletResponse response)
+         new ResourceRequest(requestEnv, Method.GET, resourcePath + "/echouri")
          {
-            assert response.getStatus() == 200;
-            assert response.getContentAsString().endsWith("/echouri");
-         }
 
-      }.run();
-      
-      reset();
+            @Override
+            protected void onResponse(EnhancedMockHttpServletResponse response)
+            {
+               assert response.getStatus() == 200;
+               assert response.getContentAsString().endsWith("/echouri");
+            }
 
-      new ResourceRequest(requestEnv, Method.GET, resourcePath + "/echoquery")
-      {
+         }.run();
 
-         @Override
-         protected void prepareRequest(EnhancedMockHttpServletRequest request)
-         {
-            request.setQueryString("asdf=123");
-            request.addQueryParameter("bar", "bbb");
-            request.addQueryParameter("baz", "bzzz");
-         }
+         reset();
 
-         @Override
-         protected void onResponse(EnhancedMockHttpServletResponse response)
+         new ResourceRequest(requestEnv, Method.GET, resourcePath + "/echoquery")
          {
-            assert response.getStatus() == 200;
-            assert response.getContentAsString().equals("bbb");
-         }
 
-      }.run();
-      
-      reset();
+            @Override
+            protected void prepareRequest(EnhancedMockHttpServletRequest request)
+            {
+               request.setQueryString("asdf=123");
+               request.addQueryParameter("bar", "bbb");
+               request.addQueryParameter("baz", "bzzz");
+            }
 
-      new ResourceRequest(requestEnv, Method.GET, resourcePath + "/echoheader")
-      {
+            @Override
+            protected void onResponse(EnhancedMockHttpServletResponse response)
+            {
+               assert response.getStatus() == 200;
+               assert response.getContentAsString().equals("bbb");
+            }
 
-         @Override
-         protected void prepareRequest(EnhancedMockHttpServletRequest request)
-         {
-            request.addHeader("bar", "baz");
-         }
+         }.run();
 
-         @Override
-         protected void onResponse(EnhancedMockHttpServletResponse response)
+         reset();
+
+         new ResourceRequest(requestEnv, Method.GET, resourcePath + "/echoheader")
          {
-            assert response.getStatus() == 200;
-            assert response.getContentAsString().equals("baz");
-         }
 
-      }.run();
-      
-      reset();
+            @Override
+            protected void prepareRequest(EnhancedMockHttpServletRequest request)
+            {
+               request.addHeader("bar", "baz");
+            }
 
-      new ResourceRequest(requestEnv, Method.GET, resourcePath + "/echocookie")
-      {
+            @Override
+            protected void onResponse(EnhancedMockHttpServletResponse response)
+            {
+               assert response.getStatus() == 200;
+               assert response.getContentAsString().equals("baz");
+            }
 
-         @Override
-         protected void prepareRequest(EnhancedMockHttpServletRequest request)
-         {
-            request.addCookie(new Cookie("bar", "baz"));
-         }
+         }.run();
 
-         @Override
-         protected void onResponse(EnhancedMockHttpServletResponse response)
+         reset();
+
+         new ResourceRequest(requestEnv, Method.GET, resourcePath + "/echocookie")
          {
-            assert response.getStatus() == 200;
-            assert response.getContentAsString().equals("baz");
-         }
 
-      }.run();
-      
-      reset();
+            @Override
+            protected void prepareRequest(EnhancedMockHttpServletRequest request)
+            {
+               request.addCookie(new Cookie("bar", "baz"));
+            }
 
-      new ResourceRequest(requestEnv, Method.GET, resourcePath + "/foo/bar/asdf")
-      {
+            @Override
+            protected void onResponse(EnhancedMockHttpServletResponse response)
+            {
+               assert response.getStatus() == 200;
+               assert response.getContentAsString().equals("baz");
+            }
 
-         @Override
-         protected void onResponse(EnhancedMockHttpServletResponse response)
+         }.run();
+
+         reset();
+
+         new ResourceRequest(requestEnv, Method.GET, resourcePath + "/foo/bar/asdf")
          {
 
-            assert response.getStatus() == 200;
-            assert response.getContentAsString().equals("bar: asdf");
-         }
+            @Override
+            protected void onResponse(EnhancedMockHttpServletResponse response)
+            {
 
-      }.run();
-      
-      reset();
+               assert response.getStatus() == 200;
+               assert response.getContentAsString().equals("bar: asdf");
+            }
 
-      new ResourceRequest(requestEnv, Method.GET, resourcePath + "/echotwoparams/foo/bar")
-      {
+         }.run();
 
-         @Override
-         protected void onResponse(EnhancedMockHttpServletResponse response)
+         reset();
+
+         new ResourceRequest(requestEnv, Method.GET, resourcePath + "/echotwoparams/foo/bar")
          {
-            assert response.getStatus() == 200;
-            assert response.getContentAsString().equals("foobar");
-         }
 
-      }.run();
+            @Override
+            protected void onResponse(EnhancedMockHttpServletResponse response)
+            {
+               assert response.getStatus() == 200;
+               assert response.getContentAsString().equals("foobar");
+            }
 
+         }.run();
+      }
+
    }
 
-   @Test(dataProvider = "queryPaths")
-   public void testEncoding(final String resourcePath) throws Exception
+   @Test
+   public void testEncoding() throws Exception
    {
-      new ResourceRequest(requestEnv, Method.GET, resourcePath + "/echoencoded/foo bar")
+      for (String resourcePath : getQueryPaths())
       {
-
-         @Override
-         protected void onResponse(EnhancedMockHttpServletResponse response)
+         new ResourceRequest(requestEnv, Method.GET, resourcePath + "/echoencoded/foo bar")
          {
-            assert response.getStatus() == 200;
-            assert response.getContentAsString().equals("foo%20bar");
-         }
 
-      }.run();
+            @Override
+            protected void onResponse(EnhancedMockHttpServletResponse response)
+            {
+               assert response.getStatus() == 200;
+               assert response.getContentAsString().equals("foo%20bar");
+            }
+
+         }.run();
+      }
    }
 
-   @Test(dataProvider = "queryPaths")
-   public void testFormHandling(final String resourcePath) throws Exception
+   @Test
+   public void testFormHandling() throws Exception
    {
-      new ResourceRequest(requestEnv, Method.POST, resourcePath + "/echoformparams")
+      for (String resourcePath : getQueryPaths())
       {
-
-         @Override
-         protected void prepareRequest(EnhancedMockHttpServletRequest request)
+         new ResourceRequest(requestEnv, Method.POST, resourcePath + "/echoformparams")
          {
-            request.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
-            request.addParameter("foo", new String[]{"bar", "baz"});
-         }
 
-         @Override
-         protected void onResponse(EnhancedMockHttpServletResponse response)
-         {
-            assert response.getStatus() == 200;
-            assert response.getContentAsString().equals("barbaz");
-         }
+            @Override
+            protected void prepareRequest(EnhancedMockHttpServletRequest request)
+            {
+               request.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
+               request.addParameter("foo", new String[]
+               {"bar", "baz"});
+            }
 
-      }.run();
-      
-      reset();
+            @Override
+            protected void onResponse(EnhancedMockHttpServletResponse response)
+            {
+               assert response.getStatus() == 200;
+               assert response.getContentAsString().equals("barbaz");
+            }
 
-      new ResourceRequest(requestEnv, Method.POST, resourcePath + "/echoformparams2")
-      {
+         }.run();
 
-         @Override
-         protected void prepareRequest(EnhancedMockHttpServletRequest request)
-         {
-            request.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
-            request.addParameter("foo", new String[]{"bar", "baz"});
-         }
+         reset();
 
-         @Override
-         protected void onResponse(EnhancedMockHttpServletResponse response)
+         new ResourceRequest(requestEnv, Method.POST, resourcePath + "/echoformparams2")
          {
-            assert response.getStatus() == 200;
-            assert response.getContentAsString().equals("barbaz");
-         }
 
-      }.run();
-      
-      reset();
+            @Override
+            protected void prepareRequest(EnhancedMockHttpServletRequest request)
+            {
+               request.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
+               request.addParameter("foo", new String[]
+               {"bar", "baz"});
+            }
 
-      new ResourceRequest(requestEnv, Method.POST, resourcePath + "/echoformparams3")
-      {
+            @Override
+            protected void onResponse(EnhancedMockHttpServletResponse response)
+            {
+               assert response.getStatus() == 200;
+               assert response.getContentAsString().equals("barbaz");
+            }
 
-         @Override
-         protected void prepareRequest(EnhancedMockHttpServletRequest request)
-         {
-            request.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
-            request.addHeader("bar", "foo");
-            request.addParameter("foo", new String[]{"bar", "baz"});
-         }
+         }.run();
 
-         @Override
-         protected void onResponse(EnhancedMockHttpServletResponse response)
+         reset();
+
+         new ResourceRequest(requestEnv, Method.POST, resourcePath + "/echoformparams3")
          {
-            assert response.getStatus() == 200;
-            assert response.getContentAsString().equals("foobarbaz");
-         }
 
-      }.run();
-      
-      reset();
+            @Override
+            protected void prepareRequest(EnhancedMockHttpServletRequest request)
+            {
+               request.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
+               request.addHeader("bar", "foo");
+               request.addParameter("foo", new String[]
+               {"bar", "baz"});
+            }
 
+            @Override
+            protected void onResponse(EnhancedMockHttpServletResponse response)
+            {
+               assert response.getStatus() == 200;
+               assert response.getContentAsString().equals("foobarbaz");
+            }
+
+         }.run();
+
+         reset();
+      }
    }
 
-   @Test(dataProvider = "queryPaths")
-   public void testStringConverter(final String resourcePath) throws Exception
+   @Test()
+   public void testStringConverter() throws Exception
    {
       final String ISO_DATE = "2007-07-10T14:54:56-0500";
       final String ISO_DATE_MILLIS = "1184097296000";
-
-      new ResourceRequest(requestEnv, Method.GET, resourcePath + "/convertDate/" + ISO_DATE)
+      
+      for (String resourcePath : getQueryPaths())
       {
 
-         @Override
-         protected void onResponse(EnhancedMockHttpServletResponse response)
+         new ResourceRequest(requestEnv, Method.GET, resourcePath + "/convertDate/" + ISO_DATE)
          {
-            assert response.getStatus() == 200;
-            assertEquals(response.getContentAsString(), ISO_DATE_MILLIS);
-         }
 
-      }.run();
+            @Override
+            protected void onResponse(EnhancedMockHttpServletResponse response)
+            {
+               assert response.getStatus() == 200;
+               assertEquals(ISO_DATE_MILLIS, response.getContentAsString());
+            }
 
+         }.run();
+      }
    }
 
-   @Test(dataProvider = "queryPaths")
-   public void testProvider(final String resourcePath) throws Exception
+   @Test
+   public void testProvider() throws Exception
    {
-
-      new ResourceRequest(requestEnv, Method.GET, resourcePath + "/commaSeparated")
+      for (String resourcePath : getQueryPaths())
       {
-
-         @Override
-         protected void prepareRequest(EnhancedMockHttpServletRequest request)
+         new ResourceRequest(requestEnv, Method.GET, resourcePath + "/commaSeparated")
          {
-            request.addHeader("Accept", "text/csv");
-         }
 
-         @Override
-         protected void onResponse(EnhancedMockHttpServletResponse response)
-         {
-            assert response.getStatus() == 200;
-            assert response.getContentAsString().equals("foo,bar\r\nasdf,123\r\n");
-         }
+            @Override
+            protected void prepareRequest(EnhancedMockHttpServletRequest request)
+            {
+               request.addHeader("Accept", "text/csv");
+            }
 
-      }.run();
-      
-      reset();
+            @Override
+            protected void onResponse(EnhancedMockHttpServletResponse response)
+            {
+               assert response.getStatus() == 200;
+               assert response.getContentAsString().equals("foo,bar\r\nasdf,123\r\n");
+            }
 
-      new ResourceRequest(requestEnv, Method.GET, resourcePath + "/commaSeparatedStrings")
-      {
+         }.run();
 
-         @Override
-         protected void prepareRequest(EnhancedMockHttpServletRequest request)
-         {
-            request.addHeader("Accept", "text/plain");
-         }
+         reset();
 
-         @Override
-         protected void onResponse(EnhancedMockHttpServletResponse response)
+         new ResourceRequest(requestEnv, Method.GET, resourcePath + "/commaSeparatedStrings")
          {
-            assert response.getStatus() == 200;
-            assert response.getContentAsString().equals("abc,foo,bar,baz");
-         }
 
-      }.run();
-      
-      reset();
+            @Override
+            protected void prepareRequest(EnhancedMockHttpServletRequest request)
+            {
+               request.addHeader("Accept", "text/plain");
+            }
 
-      new ResourceRequest(requestEnv, Method.GET, resourcePath + "/commaSeparatedIntegers")
-      {
+            @Override
+            protected void onResponse(EnhancedMockHttpServletResponse response)
+            {
+               assert response.getStatus() == 200;
+               assert response.getContentAsString().equals("abc,foo,bar,baz");
+            }
 
-         @Override
-         protected void prepareRequest(EnhancedMockHttpServletRequest request)
-         {
-            request.addHeader("Accept", "text/plain");
-         }
+         }.run();
 
-         @Override
-         protected void onResponse(EnhancedMockHttpServletResponse response)
+         reset();
+
+         new ResourceRequest(requestEnv, Method.GET, resourcePath + "/commaSeparatedIntegers")
          {
-            assert response.getStatus() == 200;
-            assert response.getContentAsString().equals("abc,1,2,3");
-         }
-      };
-      // }.run();
-      // TODO: Retracted support for Seam component providers, injection shouldn't happen, see https://jira.jboss.org/jira/browse/JBSEAM-4247
 
+            @Override
+            protected void prepareRequest(EnhancedMockHttpServletRequest request)
+            {
+               request.addHeader("Accept", "text/plain");
+            }
+
+            @Override
+            protected void onResponse(EnhancedMockHttpServletResponse response)
+            {
+               assert response.getStatus() == 200;
+               assert response.getContentAsString().equals("abc,1,2,3");
+            }
+         };
+         // }.run();
+         // TODO: Retracted support for Seam component providers, injection shouldn't happen, see https://jira.jboss.org/jira/browse/JBSEAM-4247
+      }
    }
-   
+
    @Test
    // JBPAPP-3713
    public void synchronizationsLookup() throws Exception
@@ -438,14 +472,14 @@
          {
             super.prepareRequest(request);
          }
-         
+
          @Override
          protected void onResponse(EnhancedMockHttpServletResponse response)
          {
-            assertEquals(response.getStatus(), 200, "Unexpected response code.");
+            assertEquals("Unexpected response code.", 200, response.getStatus(), 200);
             assert response.getContentAsString().equals("true");
          }
-         
+
       }.run();
    }
 }

Modified: branches/community/Seam_2_3/examples-ee6/restbay/restbay-tests/src/test/java/org/jboss/seam/example/restbay/test/ContextDataTest.java
===================================================================
--- branches/community/Seam_2_3/examples-ee6/restbay/restbay-tests/src/test/java/org/jboss/seam/example/restbay/test/ContextDataTest.java	2012-04-16 16:06:53 UTC (rev 14592)
+++ branches/community/Seam_2_3/examples-ee6/restbay/restbay-tests/src/test/java/org/jboss/seam/example/restbay/test/ContextDataTest.java	2012-04-16 17:15:14 UTC (rev 14593)
@@ -1,52 +1,70 @@
 package org.jboss.seam.example.restbay.test;
 
-import static org.testng.Assert.assertEquals;
+import static org.junit.Assert.assertEquals;
 
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.OverProtocol;
+import org.jboss.arquillian.junit.Arquillian;
 import org.jboss.seam.mock.EnhancedMockHttpServletRequest;
 import org.jboss.seam.mock.EnhancedMockHttpServletResponse;
+import org.jboss.seam.mock.JUnitSeamTest;
 import org.jboss.seam.mock.ResourceRequestEnvironment;
-import org.jboss.seam.mock.SeamTest;
 import org.jboss.seam.mock.ResourceRequestEnvironment.Method;
 import org.jboss.seam.mock.ResourceRequestEnvironment.ResourceRequest;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-import org.junit.Ignore;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.junit.Test;
+import org.junit.runner.RunWith;
 
 /**
  *
  * @author Jozef Hartinger
  */
- at Ignore
-public class ContextDataTest extends SeamTest
+ at RunWith(Arquillian.class)
+public class ContextDataTest extends JUnitSeamTest
 {
-   @DataProvider(name = "contextDataTypes")
-   public Object[][] getContextDataTypePaths()
+   @Deployment(name="ContextDataTest")
+   @OverProtocol("Servlet 3.0")
+   public static Archive<?> createDeployment()
    {
-      return new String[][]{ { "/providers" }, { "/registry" }, { "/dispatcher" } };
+      EnterpriseArchive er = Deployments.restbayDeployment();
+      WebArchive web = er.getAsType(WebArchive.class, "restbay-web.war");
+      web.addClasses(ContextDataTest.class);
+      return er;
    }
    
-   @Test(dataProvider = "contextDataTypes")
-   public void testContextData(String pathSegment) throws Exception
+   public String[] getContextDataTypePaths()
    {
-      final String path = "/restv1/contextData" + pathSegment;
+      return new String[]{ "/providers", "/registry", "/dispatcher" };
+   }
+   
+   @Test
+   public void testContextData() throws Exception
+   {
 
-      new ResourceRequest(new ResourceRequestEnvironment(this), Method.GET, path)
+      for (String pathSegment : getContextDataTypePaths())
       {
+         String path = "/restv1/contextData" + pathSegment;
 
-         @Override
-         protected void prepareRequest(EnhancedMockHttpServletRequest request)
+         new ResourceRequest(new ResourceRequestEnvironment(this), Method.GET, path)
          {
-            super.prepareRequest(request);
-            request.addHeader("Accept", "text/plain");
-         }
 
-         @Override
-         protected void onResponse(EnhancedMockHttpServletResponse response)
-         {
-            assertEquals(response.getStatus(), 200, "Unexpected response code.");
-            assertEquals(response.getContentAsString(), "true", "Unexpected response.");
-         }
+            @Override
+            protected void prepareRequest(EnhancedMockHttpServletRequest request)
+            {
+               super.prepareRequest(request);
+               request.addHeader("Accept", "text/plain");
+            }
 
-      }.run();
+            @Override
+            protected void onResponse(EnhancedMockHttpServletResponse response)
+            {
+               assertEquals("Unexpected response code.", 200, response.getStatus());
+               assertEquals("Unexpected response.", "true", response.getContentAsString());
+            }
+
+         }.run();
+      }
    }
 }

Added: branches/community/Seam_2_3/examples-ee6/restbay/restbay-tests/src/test/java/org/jboss/seam/example/restbay/test/Deployments.java
===================================================================
--- branches/community/Seam_2_3/examples-ee6/restbay/restbay-tests/src/test/java/org/jboss/seam/example/restbay/test/Deployments.java	                        (rev 0)
+++ branches/community/Seam_2_3/examples-ee6/restbay/restbay-tests/src/test/java/org/jboss/seam/example/restbay/test/Deployments.java	2012-04-16 17:15:14 UTC (rev 14593)
@@ -0,0 +1,22 @@
+package org.jboss.seam.example.restbay.test;
+
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.importer.ZipImporter;
+import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+
+import java.io.File;
+
+public class Deployments {
+   public static EnterpriseArchive restbayDeployment() {
+      EnterpriseArchive ear = ShrinkWrap.create(ZipImporter.class, "seam-restbay.ear").importFrom(new File("../restbay-ear/target/seam-restbay.ear"))
+              .as(EnterpriseArchive.class);
+      
+      // Install org.jboss.seam.mock.MockSeamListener
+      WebArchive web = ear.getAsType(WebArchive.class, "restbay-web.war");
+      web.delete("/WEB-INF/web.xml");
+      web.addAsWebInfResource("web.xml");
+      
+      return ear;
+   }
+}

Modified: branches/community/Seam_2_3/examples-ee6/restbay/restbay-tests/src/test/java/org/jboss/seam/example/restbay/test/ResourceHomeTest.java
===================================================================
--- branches/community/Seam_2_3/examples-ee6/restbay/restbay-tests/src/test/java/org/jboss/seam/example/restbay/test/ResourceHomeTest.java	2012-04-16 16:06:53 UTC (rev 14592)
+++ branches/community/Seam_2_3/examples-ee6/restbay/restbay-tests/src/test/java/org/jboss/seam/example/restbay/test/ResourceHomeTest.java	2012-04-16 17:15:14 UTC (rev 14593)
@@ -1,135 +1,160 @@
 package org.jboss.seam.example.restbay.test;
 
+import static org.junit.Assert.assertEquals;
+
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.OverProtocol;
+import org.jboss.arquillian.junit.Arquillian;
 import org.jboss.seam.mock.EnhancedMockHttpServletRequest;
 import org.jboss.seam.mock.EnhancedMockHttpServletResponse;
+import org.jboss.seam.mock.JUnitSeamTest;
+
 import static org.jboss.seam.mock.ResourceRequestEnvironment.Method;
 import static org.jboss.seam.mock.ResourceRequestEnvironment.ResourceRequest;
-import org.jboss.seam.mock.SeamTest;
 import org.jboss.seam.mock.ResourceRequestEnvironment;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-import org.junit.Ignore;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.junit.Test;
+import org.junit.runner.RunWith;
 
-import static org.testng.Assert.assertEquals;
 
 /**
  * 
  * @author Jozef Hartinger
  * 
  */
- at Ignore
-public class ResourceHomeTest extends SeamTest
+ at RunWith(Arquillian.class)
+public class ResourceHomeTest extends JUnitSeamTest
 {
+   @Deployment(name="ResourceHomeTest")
+   @OverProtocol("Servlet 3.0")
+   public static Archive<?> createDeployment()
+   {
+      EnterpriseArchive er = Deployments.restbayDeployment();
+      WebArchive web = er.getAsType(WebArchive.class, "restbay-web.war");
+      web.addClasses(ResourceHomeTest.class);
+      return er;
+   }
 
-   @DataProvider(name = "queryPaths")
-   public Object[][] getData()
+   public String[] getQueryPaths()
    {
-      return new String[][]{ { "/configuredCategory" }, { "/extendedCategory" } };
+      return new String[]{ "/configuredCategory", "/extendedCategory" };
    }
 
-   @Test(dataProvider = "queryPaths")
-   public void testResourceHomeRead(final String resourcePath) throws Exception
+   @Test
+   public void testResourceHomeRead() throws Exception
    {
-      final String expectedResponse = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><category><categoryId>1</categoryId><name>Antiques</name></category>";
-      final String path = "/restv1" + resourcePath + "/1";
-
-      new ResourceRequest(new ResourceRequestEnvironment(this), Method.GET, path)
+      for (String resourcePath : getQueryPaths())
       {
+         final String expectedResponse = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><category><categoryId>1</categoryId><name>Antiques</name></category>";
+         final String path = "/restv1" + resourcePath + "/1";
 
-         @Override
-         protected void prepareRequest(EnhancedMockHttpServletRequest request)
+         new ResourceRequest(new ResourceRequestEnvironment(this), Method.GET, path)
          {
-            super.prepareRequest(request);
-            request.addHeader("Accept", "application/xml");
-         }
 
-         @Override
-         protected void onResponse(EnhancedMockHttpServletResponse response)
-         {
-            assertEquals(response.getContentAsString(), expectedResponse, "Unexpected response.");
-         }
+            @Override
+            protected void prepareRequest(EnhancedMockHttpServletRequest request)
+            {
+               super.prepareRequest(request);
+               request.addHeader("Accept", "application/xml");
+            }
 
-      }.run();
+            @Override
+            protected void onResponse(EnhancedMockHttpServletResponse response)
+            {
+               assertEquals("Unexpected response.", expectedResponse, response.getContentAsString());
+            }
+
+         }.run();
+      }
    }
 
-   @Test(dataProvider = "queryPaths")
-   public void testResourceHomeCreate(final String resourcePath) throws Exception
+   @Test
+   public void testResourceHomeCreate() throws Exception
    {
-      final String name = "Airplanes";
-      final String body = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><category><name>" + name + "</name></category>";
-      final String mediaType = "application/xml";
-      final String path = "/restv1" + resourcePath;
-
-      new ResourceRequest(new ResourceRequestEnvironment(this), Method.POST, path)
+      for (String resourcePath : getQueryPaths())
       {
-         @Override
-         protected void prepareRequest(EnhancedMockHttpServletRequest request)
-         {
-            super.prepareRequest(request);
-            // TODO for some reason content type must be set using both these
-            // methods
-            request.addHeader("Content-Type", mediaType);
-            request.setContentType(mediaType);
-            request.setContent(body.getBytes());
-         }
+         final String name = "Airplanes";
+         final String body = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><category><name>" + name
+               + "</name></category>";
+         final String mediaType = "application/xml";
+         final String path = "/restv1" + resourcePath;
 
-         @Override
-         protected void onResponse(EnhancedMockHttpServletResponse response)
+         new ResourceRequest(new ResourceRequestEnvironment(this), Method.POST, path)
          {
-            assertEquals(response.getStatus(), 201, "Unexpected response code.");
-         }
+            @Override
+            protected void prepareRequest(EnhancedMockHttpServletRequest request)
+            {
+               super.prepareRequest(request);
+               // TODO for some reason content type must be set using both these
+               // methods
+               request.addHeader("Content-Type", mediaType);
+               request.setContentType(mediaType);
+               request.setContent(body.getBytes());
+            }
 
-      }.run();
+            @Override
+            protected void onResponse(EnhancedMockHttpServletResponse response)
+            {
+               assertEquals("Unexpected response code.", 201, response.getStatus(), 201);
+            }
+
+         }.run();
+      }
    }
 
-   @Test(dataProvider = "queryPaths")
-   public void testResourceHomeUpdate(String resourcePath) throws Exception
+   @Test
+   public void testResourceHomeUpdate() throws Exception
    {
-      final String body = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><category><categoryId>5</categoryId><name>" + resourcePath.hashCode() + "</name></category>";
-      final String mediaType = "application/xml";
-      final String path = "/restv1" + resourcePath + "/5";
-
-      new ResourceRequest(new ResourceRequestEnvironment(this), Method.PUT, path)
+      for (String resourcePath : getQueryPaths())
       {
+         final String body = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><category><categoryId>5</categoryId><name>"
+               + resourcePath.hashCode() + "</name></category>";
+         final String mediaType = "application/xml";
+         final String path = "/restv1" + resourcePath + "/5";
 
-         @Override
-         protected void prepareRequest(EnhancedMockHttpServletRequest request)
+         new ResourceRequest(new ResourceRequestEnvironment(this), Method.PUT, path)
          {
-            super.prepareRequest(request);
-            request.setContentType(mediaType);
-            request.addHeader("Content-Type", mediaType);
-            request.setContent(body.getBytes());
-         }
 
-         @Override
-         protected void onResponse(EnhancedMockHttpServletResponse response)
-         {
-            assertEquals(response.getStatus(), 204, "Unexpected response code.");
-         }
+            @Override
+            protected void prepareRequest(EnhancedMockHttpServletRequest request)
+            {
+               super.prepareRequest(request);
+               request.setContentType(mediaType);
+               request.addHeader("Content-Type", mediaType);
+               request.setContent(body.getBytes());
+            }
 
-      }.run();
-      
-      reset();
+            @Override
+            protected void onResponse(EnhancedMockHttpServletResponse response)
+            {
+               assertEquals("Unexpected response code.", 204, response.getStatus());
+            }
 
-      new ResourceRequest(new ResourceRequestEnvironment(this), Method.GET, path)
-      {
+         }.run();
 
-         @Override
-         protected void prepareRequest(EnhancedMockHttpServletRequest request)
-         {
-            super.prepareRequest(request);
-            request.addHeader("Accept", mediaType);
-         }
+         reset();
 
-         @Override
-         protected void onResponse(EnhancedMockHttpServletResponse response)
+         new ResourceRequest(new ResourceRequestEnvironment(this), Method.GET, path)
          {
-            assertEquals(response.getStatus(), 200, "Unexpected response code.");
-            assertEquals(response.getContentAsString(), body, "Unexpected response.");
-         }
 
-      }.run();
+            @Override
+            protected void prepareRequest(EnhancedMockHttpServletRequest request)
+            {
+               super.prepareRequest(request);
+               request.addHeader("Accept", mediaType);
+            }
 
+            @Override
+            protected void onResponse(EnhancedMockHttpServletResponse response)
+            {
+               assertEquals("Unexpected response code.", 200, response.getStatus());
+               assertEquals("Unexpected response.", body, response.getContentAsString());
+            }
+
+         }.run();
+      }
    }
 
    @Test
@@ -144,7 +169,7 @@
          @Override
          protected void onResponse(EnhancedMockHttpServletResponse response)
          {
-            assertEquals(response.getStatus(), 204, "Unexpected response code.");
+            assertEquals("Unexpected response code.", 204, response.getStatus());
          }
 
       }.run();
@@ -164,7 +189,7 @@
          @Override
          protected void onResponse(EnhancedMockHttpServletResponse response)
          {
-            assertEquals(response.getStatus(), 404, "Unexpected response code.");
+            assertEquals("Unexpected response code.", response.getStatus(), 404);
          }
 
       }.run();

Modified: branches/community/Seam_2_3/examples-ee6/restbay/restbay-tests/src/test/java/org/jboss/seam/example/restbay/test/ResourceQueryTest.java
===================================================================
--- branches/community/Seam_2_3/examples-ee6/restbay/restbay-tests/src/test/java/org/jboss/seam/example/restbay/test/ResourceQueryTest.java	2012-04-16 16:06:53 UTC (rev 14592)
+++ branches/community/Seam_2_3/examples-ee6/restbay/restbay-tests/src/test/java/org/jboss/seam/example/restbay/test/ResourceQueryTest.java	2012-04-16 17:15:14 UTC (rev 14593)
@@ -1,57 +1,74 @@
 package org.jboss.seam.example.restbay.test;
 
-import static org.testng.Assert.assertEquals;
-
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.OverProtocol;
+import org.jboss.arquillian.junit.Arquillian;
 import org.jboss.seam.mock.EnhancedMockHttpServletRequest;
 import org.jboss.seam.mock.EnhancedMockHttpServletResponse;
+import org.jboss.seam.mock.JUnitSeamTest;
+
 import static org.jboss.seam.mock.ResourceRequestEnvironment.Method;
 import static org.jboss.seam.mock.ResourceRequestEnvironment.ResourceRequest;
 import org.jboss.seam.mock.SeamTest;
 import org.jboss.seam.mock.ResourceRequestEnvironment;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-import org.junit.Ignore;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import static org.junit.Assert.assertEquals;
 
 /**
  * 
  * @author Jozef Hartinger
  * 
  */
- at Ignore
-public class ResourceQueryTest extends SeamTest
+ at RunWith(Arquillian.class)
+public class ResourceQueryTest extends JUnitSeamTest
 {
+   @Deployment(name="ResourceQueryTest")
+   @OverProtocol("Servlet 3.0")
+   public static Archive<?> createDeployment()
+   {
+      EnterpriseArchive er = Deployments.restbayDeployment();
+      WebArchive web = er.getAsType(WebArchive.class, "restbay-web.war");
+      web.addClasses(ResourceQueryTest.class);
+      return er;
+   }
 
-   @DataProvider(name = "queryPaths")
-   public Object[][] getData()
+   public String[] getQueryPaths()
    {
-      String[][] data = new String[2][1];
-      data[0][0] = "/configuredCategory";
-      data[1][0] = "/extendedCategory";
+      String[] data = new String[2];
+      data[0] = "/configuredCategory";
+      data[1] = "/extendedCategory";
       return data;
    }
 
-   @Test(dataProvider = "queryPaths")
-   public void testResourceQuery(String path) throws Exception
+   @Test
+   public void testResourceQuery() throws Exception
    {
-      new ResourceRequest(new ResourceRequestEnvironment(this), Method.GET, "/restv1" + path)
+      for (String path : getQueryPaths())
       {
-
-         @Override
-         protected void prepareRequest(EnhancedMockHttpServletRequest request)
+         new ResourceRequest(new ResourceRequestEnvironment(this), Method.GET, "/restv1" + path)
          {
-            super.prepareRequest(request);
-            request.addHeader("Accept", "application/xml");
-            request.setQueryString("start=2&show=2");
-         }
 
-         @Override
-         protected void onResponse(EnhancedMockHttpServletResponse response)
-         {
-            String expectedResponse = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><collection><category><categoryId>3</categoryId><name>Books</name></category><category><categoryId>4</categoryId><name>Cameras and Photography</name></category></collection>";
-            assertEquals(response.getContentAsString(), expectedResponse, "Unexpected response.");
-         }
+            @Override
+            protected void prepareRequest(EnhancedMockHttpServletRequest request)
+            {
+               super.prepareRequest(request);
+               request.addHeader("Accept", "application/xml");
+               request.setQueryString("start=2&show=2");
+            }
 
-      }.run();
+            @Override
+            protected void onResponse(EnhancedMockHttpServletResponse response)
+            {
+               String expectedResponse = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><collection><category><categoryId>3</categoryId><name>Books</name></category><category><categoryId>4</categoryId><name>Cameras and Photography</name></category></collection>";
+               assertEquals("Unexpected response.", expectedResponse, response.getContentAsString());
+            }
+
+         }.run();
+      }
    }
 
 }

Modified: branches/community/Seam_2_3/examples-ee6/restbay/restbay-tests/src/test/java/org/jboss/seam/example/restbay/test/SecurityTest.java
===================================================================
--- branches/community/Seam_2_3/examples-ee6/restbay/restbay-tests/src/test/java/org/jboss/seam/example/restbay/test/SecurityTest.java	2012-04-16 16:06:53 UTC (rev 14592)
+++ branches/community/Seam_2_3/examples-ee6/restbay/restbay-tests/src/test/java/org/jboss/seam/example/restbay/test/SecurityTest.java	2012-04-16 17:15:14 UTC (rev 14593)
@@ -1,17 +1,24 @@
 package org.jboss.seam.example.restbay.test;
 
-import static org.testng.Assert.assertEquals;
-
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.OverProtocol;
+import org.jboss.arquillian.junit.Arquillian;
 import org.jboss.seam.mock.EnhancedMockHttpServletRequest;
 import org.jboss.seam.mock.EnhancedMockHttpServletResponse;
-import org.jboss.seam.mock.SeamTest;
+import org.jboss.seam.mock.JUnitSeamTest;
 import org.jboss.seam.mock.ResourceRequestEnvironment;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+
 import static org.jboss.seam.mock.ResourceRequestEnvironment.Method;
 import static org.jboss.seam.mock.ResourceRequestEnvironment.ResourceRequest;
-import org.testng.annotations.Test;
-import org.testng.annotations.BeforeClass;
-import org.junit.Ignore;
 
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import static org.junit.Assert.assertEquals;
+
 import java.util.HashMap;
 import java.util.Map;
 
@@ -20,13 +27,22 @@
  *
  * @author Jozef Hartinger
  */
- at Ignore
-public class SecurityTest extends SeamTest
+ at RunWith(Arquillian.class)
+public class SecurityTest extends JUnitSeamTest
 {
+   @Deployment(name="SecurityTest")
+   @OverProtocol("Servlet 3.0")
+   public static Archive<?> createDeployment()
+   {
+      EnterpriseArchive er = Deployments.restbayDeployment();
+      WebArchive web = er.getAsType(WebArchive.class, "restbay-web.war");
+      web.addClasses(SecurityTest.class);
+      return er;
+   }
 
    ResourceRequestEnvironment requestEnv;
 
-   @BeforeClass
+   @Before
    public void prepareEnv() throws Exception
    {
       requestEnv = new ResourceRequestEnvironment(this)
@@ -58,8 +74,8 @@
          @Override
          protected void onResponse(EnhancedMockHttpServletResponse response)
          {
-            assertEquals(response.getStatus(), 200, "Unexpected response code.");
-            assertEquals(response.getContentAsString(), "false", "Unexpected response.");
+            assertEquals("Unexpected response code.", 200, response.getStatus(), 200);
+            assertEquals("Unexpected response.", "false", response.getContentAsString());
          }
 
       }.run();
@@ -82,11 +98,11 @@
          protected void onResponse(EnhancedMockHttpServletResponse response)
          {
             assertEquals(
-                  response.getHeader("WWW-Authenticate"),
+                  "Invalid authentication header value",
                   "Basic realm=\"Seam RestBay Application\"",
-                  "Invalid authentication header value"
+                  response.getHeader("WWW-Authenticate")
             );
-            assertEquals(response.getStatus(), 401, "Unexpected response code.");
+            assertEquals("Unexpected response code.", 401, response.getStatus());
          }
 
       }.run();
@@ -108,8 +124,8 @@
          @Override
          protected void onResponse(EnhancedMockHttpServletResponse response)
          {
-            assertEquals(response.getStatus(), 200, "Unexpected response code.");
-            assertEquals(response.getContentAsString(), "true");
+            assertEquals("Unexpected response code.", 200, response.getStatus());
+            assertEquals("true", response.getContentAsString());
          }
 
       }.run();
@@ -131,8 +147,8 @@
          @Override
          protected void onResponse(EnhancedMockHttpServletResponse response)
          {
-            assertEquals(response.getStatus(), 200, "Unexpected response code.");
-            assertEquals(response.getContentAsString(), "true");
+            assertEquals("Unexpected response code.", 200, response.getStatus());
+            assertEquals("true", response.getContentAsString());
          }
 
       }.run();
@@ -155,7 +171,7 @@
          protected void onResponse(EnhancedMockHttpServletResponse response)
          {
             // See AuthorizationException mapping to 403 in pages.xml!
-            assertEquals(response.getStatus(), 403, "Unexpected response code.");
+            assertEquals("Unexpected response code.", 403, response.getStatus());
             assert response.getStatusMessage().startsWith("Not authorized to access resource");
          }
 
@@ -179,7 +195,7 @@
          @Override
          protected void onResponse(EnhancedMockHttpServletResponse response)
          {
-            assertEquals(response.getStatus(), 200, "Unexpected response code.");
+            assertEquals("Unexpected response code.", 200, response.getStatus(), 200);
             assert response.getContentAsString().equals("true");
          }
          
@@ -203,7 +219,7 @@
          @Override
          protected void onResponse(EnhancedMockHttpServletResponse response)
          {
-            assertEquals(response.getStatus(), 200, "Unexpected response code.");
+            assertEquals("Unexpected response code.", 200, response.getStatus());
             assert response.getContentAsString().equals("true");
          }
          

Modified: branches/community/Seam_2_3/examples-ee6/restbay/restbay-tests/src/test/java/org/jboss/seam/example/restbay/test/SubresourceTest.java
===================================================================
--- branches/community/Seam_2_3/examples-ee6/restbay/restbay-tests/src/test/java/org/jboss/seam/example/restbay/test/SubresourceTest.java	2012-04-16 16:06:53 UTC (rev 14592)
+++ branches/community/Seam_2_3/examples-ee6/restbay/restbay-tests/src/test/java/org/jboss/seam/example/restbay/test/SubresourceTest.java	2012-04-16 17:15:14 UTC (rev 14593)
@@ -1,19 +1,34 @@
 package org.jboss.seam.example.restbay.test;
 
-import static org.testng.Assert.assertEquals;
-
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.OverProtocol;
+import org.jboss.arquillian.junit.Arquillian;
 import org.jboss.seam.mock.EnhancedMockHttpServletRequest;
 import org.jboss.seam.mock.EnhancedMockHttpServletResponse;
+import org.jboss.seam.mock.JUnitSeamTest;
 import org.jboss.seam.mock.ResourceRequestEnvironment;
-import org.jboss.seam.mock.SeamTest;
 import org.jboss.seam.mock.ResourceRequestEnvironment.Method;
 import org.jboss.seam.mock.ResourceRequestEnvironment.ResourceRequest;
-import org.testng.annotations.Test;
-import org.junit.Ignore;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+import org.junit.runner.RunWith;
 
- at Ignore
-public class SubresourceTest extends SeamTest
+ at RunWith(Arquillian.class)
+public class SubresourceTest extends JUnitSeamTest
 {
+   @Deployment(name="SubresourceTest")
+   @OverProtocol("Servlet 3.0")
+   public static Archive<?> createDeployment()
+   {
+      EnterpriseArchive er = Deployments.restbayDeployment();
+      WebArchive web = er.getAsType(WebArchive.class, "restbay-web.war");
+      web.addClasses(SubresourceTest.class);
+      return er;
+   }
+   
    @Test
    public void testSubresourceGET() throws Exception
    {
@@ -32,8 +47,8 @@
          @Override
          protected void onResponse(EnhancedMockHttpServletResponse response)
          {
-            assertEquals(response.getStatus(), 200, "Unexpected response code.");
-            assertEquals(response.getContentAsString(), "Honda", "Unexpected response.");
+            assertEquals("Unexpected response code.", 200, response.getStatus());
+            assertEquals("Unexpected response.", "Honda", response.getContentAsString());
          }
 
       }.run();

Added: branches/community/Seam_2_3/examples-ee6/restbay/restbay-tests/src/test/resources-integration/arquillian.xml
===================================================================
--- branches/community/Seam_2_3/examples-ee6/restbay/restbay-tests/src/test/resources-integration/arquillian.xml	                        (rev 0)
+++ branches/community/Seam_2_3/examples-ee6/restbay/restbay-tests/src/test/resources-integration/arquillian.xml	2012-04-16 17:15:14 UTC (rev 14593)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<arquillian xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xmlns="http://jboss.org/schema/arquillian"
+    xsi:schemaLocation="http://jboss.org/schema/arquillian http://jboss.org/schema/arquillian/arquillian_1_0.xsd">
+
+    <engine>
+        <property name="deploymentExportPath">target/</property>
+    </engine>
+
+    <container qualifier="jboss" default="true">
+        <configuration>
+            <property name="javaVmArguments">-Xmx1024m -XX:MaxPermSize=512m</property>
+            <property name="jbossHome">target/jboss-as-${version.jbossas7}</property>
+        </configuration>
+    </container>
+
+</arquillian>

Added: branches/community/Seam_2_3/examples-ee6/restbay/restbay-tests/src/test/resources-integration/web.xml
===================================================================
--- branches/community/Seam_2_3/examples-ee6/restbay/restbay-tests/src/test/resources-integration/web.xml	                        (rev 0)
+++ branches/community/Seam_2_3/examples-ee6/restbay/restbay-tests/src/test/resources-integration/web.xml	2012-04-16 17:15:14 UTC (rev 14593)
@@ -0,0 +1,12 @@
+<?xml version="1.0" ?>
+
+<web-app version="3.0"
+         xmlns="http://java.sun.com/xml/ns/javaee"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
+         
+    <listener>
+        <listener-class>org.jboss.seam.mock.MockSeamListener</listener-class>
+    </listener>
+
+</web-app>



More information about the seam-commits mailing list