[seam-commits] Seam SVN: r11284 - in tags/JBoss_Seam_2_2_0_GA: examples/tasks/src/main/org/jboss/seam/example/tasks/test and 3 other directories.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Mon Jul 13 16:49:45 EDT 2009


Author: norman.richards at jboss.com
Date: 2009-07-13 16:49:44 -0400 (Mon, 13 Jul 2009)
New Revision: 11284

Added:
   tags/JBoss_Seam_2_2_0_GA/src/main/org/jboss/seam/deployment/PagesDotXmlDeploymentHandler.java
Removed:
   tags/JBoss_Seam_2_2_0_GA/src/main/org/jboss/seam/contexts/PagesDotXmlDeploymentHandler.java
Modified:
   tags/JBoss_Seam_2_2_0_GA/build.xml
   tags/JBoss_Seam_2_2_0_GA/examples/tasks/src/main/org/jboss/seam/example/tasks/test/CategoryResourceTest.java
   tags/JBoss_Seam_2_2_0_GA/examples/tasks/src/main/org/jboss/seam/example/tasks/test/ResolvedTaskResourceQueryTest.java
   tags/JBoss_Seam_2_2_0_GA/examples/tasks/src/main/org/jboss/seam/example/tasks/test/TaskResourceTest.java
   tags/JBoss_Seam_2_2_0_GA/src/resteasy/org/jboss/seam/resteasy/ResteasyBootstrap.java
Log:
merge to 11276 from branch

Modified: tags/JBoss_Seam_2_2_0_GA/build.xml
===================================================================
--- tags/JBoss_Seam_2_2_0_GA/build.xml	2009-07-13 18:16:28 UTC (rev 11283)
+++ tags/JBoss_Seam_2_2_0_GA/build.xml	2009-07-13 20:49:44 UTC (rev 11284)
@@ -528,6 +528,7 @@
 		<testexample name="jpa" />
 		<testexample name="quartz" />
 		<testexample name="guice" />
+		<testexample name="tasks" />
 		<ant dir="examples/wiki" target="test" inheritall="false">
 			<property name="test.output.dir" value="${test.dir}/wiki" />
 		</ant>

Modified: tags/JBoss_Seam_2_2_0_GA/examples/tasks/src/main/org/jboss/seam/example/tasks/test/CategoryResourceTest.java
===================================================================
--- tags/JBoss_Seam_2_2_0_GA/examples/tasks/src/main/org/jboss/seam/example/tasks/test/CategoryResourceTest.java	2009-07-13 18:16:28 UTC (rev 11283)
+++ tags/JBoss_Seam_2_2_0_GA/examples/tasks/src/main/org/jboss/seam/example/tasks/test/CategoryResourceTest.java	2009-07-13 20:49:44 UTC (rev 11284)
@@ -24,9 +24,12 @@
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertTrue;
 
-import org.jboss.seam.resteasy.testfwk.ResourceSeamTest;
-import org.jboss.seam.resteasy.testfwk.MockHttpServletResponse;
-import org.jboss.seam.resteasy.testfwk.MockHttpServletRequest;
+import org.jboss.seam.mock.SeamTest;
+import static org.jboss.seam.mock.ResourceRequestEnvironment.Method;
+import static org.jboss.seam.mock.ResourceRequestEnvironment.ResourceRequest;
+import org.jboss.seam.mock.EnhancedMockHttpServletRequest;
+import org.jboss.seam.mock.EnhancedMockHttpServletResponse;
+import org.jboss.seam.mock.ResourceRequestEnvironment;
 import org.testng.annotations.DataProvider;
 import org.testng.annotations.Test;
 
@@ -35,7 +38,7 @@
  * @author Jozef Hartinger
  *
  */
-public class CategoryResourceTest extends ResourceSeamTest
+public class CategoryResourceTest extends SeamTest
 {
    @DataProvider(name = "query")
    public String[][] getQueryData()
@@ -46,11 +49,11 @@
    @Test(dataProvider = "query")
    public void getCategoryListTest(final String contentType, final String expectedResponse) throws Exception
    {
-      new ResourceRequest(Method.GET, "/v1/auth/category")
+      new ResourceRequest(new ResourceRequestEnvironment(this), Method.GET, "/v1/auth/category")
       {
 
          @Override
-         protected void prepareRequest(MockHttpServletRequest request)
+         protected void prepareRequest(EnhancedMockHttpServletRequest request)
          {
             super.prepareRequest(request);
             request.addHeader("Accept", contentType);
@@ -58,7 +61,7 @@
          }
 
          @Override
-         protected void onResponse(MockHttpServletResponse response)
+         protected void onResponse(EnhancedMockHttpServletResponse response)
          {
             super.onResponse(response);
             assertEquals(response.getStatus(), 200, "Unexpected response code.");
@@ -71,11 +74,11 @@
    @Test
    public void deleteCategoryTest() throws Exception
    {
-      new ResourceRequest(Method.DELETE, "/v1/auth/category/Work")
+      new ResourceRequest(new ResourceRequestEnvironment(this), Method.DELETE, "/v1/auth/category/Work")
       {
 
          @Override
-         protected void prepareRequest(MockHttpServletRequest request)
+         protected void prepareRequest(EnhancedMockHttpServletRequest request)
          {
             super.prepareRequest(request);
             request.addHeader("Accept", "application/xml");
@@ -83,7 +86,7 @@
          }
 
          @Override
-         protected void onResponse(MockHttpServletResponse response)
+         protected void onResponse(EnhancedMockHttpServletResponse response)
          {
             super.onResponse(response);
             assertEquals(response.getStatus(), 204, "Unexpected response code.");
@@ -100,18 +103,18 @@
       final String mimeType = "application/json";
       final String expectedResponse = "{\"category\":{\"name\":\"Test Category\"}}";
       
-      new ResourceRequest(Method.PUT, uri)
+      new ResourceRequest(new ResourceRequestEnvironment(this), Method.PUT, uri)
       {
 
          @Override
-         protected void prepareRequest(MockHttpServletRequest request)
+         protected void prepareRequest(EnhancedMockHttpServletRequest request)
          {
             super.prepareRequest(request);
             request.addHeader("Authorization", "Basic ZGVtbzpkZW1v"); // demo:demo
          }
 
          @Override
-         protected void onResponse(MockHttpServletResponse response)
+         protected void onResponse(EnhancedMockHttpServletResponse response)
          {
             super.onResponse(response);
             assertEquals(response.getStatus(), 201, "Unexpected response code.");
@@ -119,11 +122,11 @@
 
       }.run();
 
-      new ResourceRequest(Method.GET, uri)
+      new ResourceRequest(new ResourceRequestEnvironment(this), Method.GET, uri)
       {
 
          @Override
-         protected void prepareRequest(MockHttpServletRequest request)
+         protected void prepareRequest(EnhancedMockHttpServletRequest request)
          {
             super.prepareRequest(request);
             request.addHeader("Accept", mimeType);
@@ -131,7 +134,7 @@
          }
 
          @Override
-         protected void onResponse(MockHttpServletResponse response)
+         protected void onResponse(EnhancedMockHttpServletResponse response)
          {
             super.onResponse(response);
             assertEquals(response.getStatus(), 200, "Unexpected response code.");
@@ -144,18 +147,18 @@
    @Test
    public void noAuthorizationHeaderTest() throws Exception
    {
-      new ResourceRequest(Method.GET, "/v1/auth/category")
+      new ResourceRequest(new ResourceRequestEnvironment(this), Method.GET, "/v1/auth/category")
       {
 
          @Override
-         protected void prepareRequest(MockHttpServletRequest request)
+         protected void prepareRequest(EnhancedMockHttpServletRequest request)
          {
             super.prepareRequest(request);
             request.addHeader("Accept", "application/xml");
          }
 
          @Override
-         protected void onResponse(MockHttpServletResponse response)
+         protected void onResponse(EnhancedMockHttpServletResponse response)
          {
             super.onResponse(response);
             assertEquals(response.getStatus(), 401, "Unexpected response code.");

Modified: tags/JBoss_Seam_2_2_0_GA/examples/tasks/src/main/org/jboss/seam/example/tasks/test/ResolvedTaskResourceQueryTest.java
===================================================================
--- tags/JBoss_Seam_2_2_0_GA/examples/tasks/src/main/org/jboss/seam/example/tasks/test/ResolvedTaskResourceQueryTest.java	2009-07-13 18:16:28 UTC (rev 11283)
+++ tags/JBoss_Seam_2_2_0_GA/examples/tasks/src/main/org/jboss/seam/example/tasks/test/ResolvedTaskResourceQueryTest.java	2009-07-13 20:49:44 UTC (rev 11284)
@@ -24,9 +24,12 @@
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertTrue;
 
-import org.jboss.seam.resteasy.testfwk.ResourceSeamTest;
-import org.jboss.seam.resteasy.testfwk.MockHttpServletResponse;
-import org.jboss.seam.resteasy.testfwk.MockHttpServletRequest;
+import org.jboss.seam.mock.SeamTest;
+import static org.jboss.seam.mock.ResourceRequestEnvironment.Method;
+import static org.jboss.seam.mock.ResourceRequestEnvironment.ResourceRequest;
+import org.jboss.seam.mock.EnhancedMockHttpServletRequest;
+import org.jboss.seam.mock.EnhancedMockHttpServletResponse;
+import org.jboss.seam.mock.ResourceRequestEnvironment;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.DataProvider;
 import org.testng.annotations.Test;
@@ -36,7 +39,7 @@
  * @author Jozef Hartinger
  *
  */
-public class ResolvedTaskResourceQueryTest extends ResourceSeamTest
+public class ResolvedTaskResourceQueryTest extends SeamTest
 {
 
    // We could do this BeforeClass only once but we can't do ResourceRequests there
@@ -46,11 +49,11 @@
       final String mimeType = "application/xml";
       final String representation = "<task><id>14</id></task>";
       
-      new ResourceRequest(Method.PUT, "/v1/auth/category/School/resolved/14")
+      new ResourceRequest(new ResourceRequestEnvironment(this), Method.PUT, "/v1/auth/category/School/resolved/14")
       {
 
          @Override
-         protected void prepareRequest(MockHttpServletRequest request)
+         protected void prepareRequest(EnhancedMockHttpServletRequest request)
          {
             super.prepareRequest(request);
             request.addHeader("Authorization", "Basic ZGVtbzpkZW1v"); // demo:demo
@@ -60,7 +63,7 @@
          }
 
          @Override
-         protected void onResponse(MockHttpServletResponse response)
+         protected void onResponse(EnhancedMockHttpServletResponse response)
          {
             super.onResponse(response);
             assertEquals(response.getStatus(), 204, "Unexpected response code.");
@@ -81,18 +84,18 @@
    @Test(dataProvider="data")
    public void editTaskTest(final String mimeType, final String expectedResponsePart) throws Exception
    {
-      new ResourceRequest(Method.GET, "/v1/user/demo/tasks/resolved")
+      new ResourceRequest(new ResourceRequestEnvironment(this), Method.GET, "/v1/user/demo/tasks/resolved")
       {
 
          @Override
-         protected void prepareRequest(MockHttpServletRequest request)
+         protected void prepareRequest(EnhancedMockHttpServletRequest request)
          {
             super.prepareRequest(request);
             request.addHeader("Accept", mimeType);
          }
 
          @Override
-         protected void onResponse(MockHttpServletResponse response)
+         protected void onResponse(EnhancedMockHttpServletResponse response)
          {
             super.onResponse(response);
             assertEquals(response.getStatus(), 200, "Unexpected response code.");

Modified: tags/JBoss_Seam_2_2_0_GA/examples/tasks/src/main/org/jboss/seam/example/tasks/test/TaskResourceTest.java
===================================================================
--- tags/JBoss_Seam_2_2_0_GA/examples/tasks/src/main/org/jboss/seam/example/tasks/test/TaskResourceTest.java	2009-07-13 18:16:28 UTC (rev 11283)
+++ tags/JBoss_Seam_2_2_0_GA/examples/tasks/src/main/org/jboss/seam/example/tasks/test/TaskResourceTest.java	2009-07-13 20:49:44 UTC (rev 11284)
@@ -24,9 +24,12 @@
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertTrue;
 
-import org.jboss.seam.resteasy.testfwk.ResourceSeamTest;
-import org.jboss.seam.resteasy.testfwk.MockHttpServletResponse;
-import org.jboss.seam.resteasy.testfwk.MockHttpServletRequest;
+import org.jboss.seam.mock.SeamTest;
+import static org.jboss.seam.mock.ResourceRequestEnvironment.Method;
+import static org.jboss.seam.mock.ResourceRequestEnvironment.ResourceRequest;
+import org.jboss.seam.mock.EnhancedMockHttpServletRequest;
+import org.jboss.seam.mock.EnhancedMockHttpServletResponse;
+import org.jboss.seam.mock.ResourceRequestEnvironment;
 import org.testng.annotations.Test;
 
 /**
@@ -34,7 +37,7 @@
  * @author Jozef Hartinger
  *
  */
-public class TaskResourceTest extends ResourceSeamTest
+public class TaskResourceTest extends SeamTest
 {
    @Test
    public void createTaskTest() throws Exception
@@ -42,11 +45,11 @@
       final String mimeType = "application/json";
       final String representation = "{\"task\":{\"name\":\"Test task\"}}";
       
-      new ResourceRequest(Method.POST, "/v1/auth/category/School/unresolved")
+      new ResourceRequest(new ResourceRequestEnvironment(this), Method.POST, "/v1/auth/category/School/unresolved")
       {
          
          @Override
-         protected void prepareRequest(MockHttpServletRequest request)
+         protected void prepareRequest(EnhancedMockHttpServletRequest request)
          {
             super.prepareRequest(request);
             request.addHeader("Authorization", "Basic ZGVtbzpkZW1v"); // demo:demo
@@ -56,7 +59,7 @@
          }
          
          @Override
-         protected void onResponse(MockHttpServletResponse response)
+         protected void onResponse(EnhancedMockHttpServletResponse response)
          {
             super.onResponse(response);
             assertEquals(response.getStatus(), 201, "Unexpected response code.");
@@ -71,11 +74,11 @@
       final String mimeType = "application/xml";
       final String representation = "<task><id>4</id><name>Learn new English vocabulary</name></task>";
 
-      new ResourceRequest(Method.PUT, "/v1/auth/category/School/unresolved/4")
+      new ResourceRequest(new ResourceRequestEnvironment(this), Method.PUT, "/v1/auth/category/School/unresolved/4")
       {
 
          @Override
-         protected void prepareRequest(MockHttpServletRequest request)
+         protected void prepareRequest(EnhancedMockHttpServletRequest request)
          {
             super.prepareRequest(request);
             request.addHeader("Authorization", "Basic ZGVtbzpkZW1v"); // demo:demo
@@ -85,7 +88,7 @@
          }
 
          @Override
-         protected void onResponse(MockHttpServletResponse response)
+         protected void onResponse(EnhancedMockHttpServletResponse response)
          {
             super.onResponse(response);
             assertEquals(response.getStatus(), 204, "Unexpected response code.");
@@ -93,11 +96,11 @@
 
       }.run();
 
-      new ResourceRequest(Method.GET, "/v1/auth/category/School/unresolved/4")
+      new ResourceRequest(new ResourceRequestEnvironment(this), Method.GET, "/v1/auth/category/School/unresolved/4")
       {
 
          @Override
-         protected void prepareRequest(MockHttpServletRequest request)
+         protected void prepareRequest(EnhancedMockHttpServletRequest request)
          {
             super.prepareRequest(request);
             request.addHeader("Accept", "application/xml");
@@ -105,7 +108,7 @@
          }
 
          @Override
-         protected void onResponse(MockHttpServletResponse response)
+         protected void onResponse(EnhancedMockHttpServletResponse response)
          {
             super.onResponse(response);
             assertEquals(response.getStatus(), 200, "Unexpected response code.");
@@ -118,18 +121,18 @@
    @Test
    public void deleteTaskTest() throws Exception
    {
-      new ResourceRequest(Method.DELETE, "/v1/auth/category/School/unresolved/2")
+      new ResourceRequest(new ResourceRequestEnvironment(this), Method.DELETE, "/v1/auth/category/School/unresolved/2")
       {
          
          @Override
-         protected void prepareRequest(MockHttpServletRequest request)
+         protected void prepareRequest(EnhancedMockHttpServletRequest request)
          {
             super.prepareRequest(request);
             request.addHeader("Authorization", "Basic ZGVtbzpkZW1v"); // demo:demo
          }
          
          @Override
-         protected void onResponse(MockHttpServletResponse response)
+         protected void onResponse(EnhancedMockHttpServletResponse response)
          {
             super.onResponse(response);
             assertEquals(response.getStatus(), 204, "Unexpected response code.");

Deleted: tags/JBoss_Seam_2_2_0_GA/src/main/org/jboss/seam/contexts/PagesDotXmlDeploymentHandler.java
===================================================================
--- tags/JBoss_Seam_2_2_0_GA/src/main/org/jboss/seam/contexts/PagesDotXmlDeploymentHandler.java	2009-07-13 18:16:28 UTC (rev 11283)
+++ tags/JBoss_Seam_2_2_0_GA/src/main/org/jboss/seam/contexts/PagesDotXmlDeploymentHandler.java	2009-07-13 20:49:44 UTC (rev 11284)
@@ -1,61 +0,0 @@
-package org.jboss.seam.deployment;
-
-import org.jboss.seam.contexts.Contexts;
-
-/**
- * The {@link PagesDotXmlDeploymentHandler} process pages.xml files
- * Its only purpose is to make sure pages.xml gets updated by hot deploy
- * 
- * @author Stuart Douglas
- * 
- */
-public class PagesDotXmlDeploymentHandler extends AbstractDeploymentHandler
-{
-   
-   private static DeploymentMetadata PAGESDOTXML_SUFFIX_FILE_METADATA = new DeploymentMetadata()
-   {
-      
-      public String getFileNameSuffix()
-      {
-         return "WEB-INF/pages.xml";
-      }
-      
-   };
-   
-   /**
-    * Name under which this {@link DeploymentHandler} is registered
-    */
-   public static final String NAME = "org.jboss.seam.deployment.PagesDotXmlDeploymentHandler";
-   
-   public String getName()
-   {
-      return NAME;
-   }
-   
-   public static PagesDotXmlDeploymentHandler instance()
-   {
-      if (Contexts.isEventContextActive())
-      {
-         if (Contexts.getEventContext().isSet(WarRootDeploymentStrategy.NAME))
-         {
-            DeploymentStrategy deploymentStrategy = (DeploymentStrategy) Contexts.getEventContext().get(WarRootDeploymentStrategy.NAME);
-            Object deploymentHandler = deploymentStrategy.getDeploymentHandlers().get(NAME);
-            if (deploymentHandler != null)
-            {
-               return (PagesDotXmlDeploymentHandler) deploymentHandler;
-            }
-         }
-         return null;
-      }
-      else
-      {
-         throw new IllegalStateException("Event context not active");
-      }
-   }
-   
-   public DeploymentMetadata getMetadata()
-   {
-      return PAGESDOTXML_SUFFIX_FILE_METADATA;
-   }
-   
-}

Copied: tags/JBoss_Seam_2_2_0_GA/src/main/org/jboss/seam/deployment/PagesDotXmlDeploymentHandler.java (from rev 11283, branches/community/Seam_2_2/src/main/org/jboss/seam/deployment/PagesDotXmlDeploymentHandler.java)
===================================================================
--- tags/JBoss_Seam_2_2_0_GA/src/main/org/jboss/seam/deployment/PagesDotXmlDeploymentHandler.java	                        (rev 0)
+++ tags/JBoss_Seam_2_2_0_GA/src/main/org/jboss/seam/deployment/PagesDotXmlDeploymentHandler.java	2009-07-13 20:49:44 UTC (rev 11284)
@@ -0,0 +1,61 @@
+package org.jboss.seam.deployment;
+
+import org.jboss.seam.contexts.Contexts;
+
+/**
+ * The {@link PagesDotXmlDeploymentHandler} process pages.xml files
+ * Its only purpose is to make sure pages.xml gets updated by hot deploy
+ * 
+ * @author Stuart Douglas
+ * 
+ */
+public class PagesDotXmlDeploymentHandler extends AbstractDeploymentHandler
+{
+   
+   private static DeploymentMetadata PAGESDOTXML_SUFFIX_FILE_METADATA = new DeploymentMetadata()
+   {
+      
+      public String getFileNameSuffix()
+      {
+         return "WEB-INF/pages.xml";
+      }
+      
+   };
+   
+   /**
+    * Name under which this {@link DeploymentHandler} is registered
+    */
+   public static final String NAME = "org.jboss.seam.deployment.PagesDotXmlDeploymentHandler";
+   
+   public String getName()
+   {
+      return NAME;
+   }
+   
+   public static PagesDotXmlDeploymentHandler instance()
+   {
+      if (Contexts.isEventContextActive())
+      {
+         if (Contexts.getEventContext().isSet(WarRootDeploymentStrategy.NAME))
+         {
+            DeploymentStrategy deploymentStrategy = (DeploymentStrategy) Contexts.getEventContext().get(WarRootDeploymentStrategy.NAME);
+            Object deploymentHandler = deploymentStrategy.getDeploymentHandlers().get(NAME);
+            if (deploymentHandler != null)
+            {
+               return (PagesDotXmlDeploymentHandler) deploymentHandler;
+            }
+         }
+         return null;
+      }
+      else
+      {
+         throw new IllegalStateException("Event context not active");
+      }
+   }
+   
+   public DeploymentMetadata getMetadata()
+   {
+      return PAGESDOTXML_SUFFIX_FILE_METADATA;
+   }
+   
+}

Modified: tags/JBoss_Seam_2_2_0_GA/src/resteasy/org/jboss/seam/resteasy/ResteasyBootstrap.java
===================================================================
--- tags/JBoss_Seam_2_2_0_GA/src/resteasy/org/jboss/seam/resteasy/ResteasyBootstrap.java	2009-07-13 18:16:28 UTC (rev 11283)
+++ tags/JBoss_Seam_2_2_0_GA/src/resteasy/org/jboss/seam/resteasy/ResteasyBootstrap.java	2009-07-13 20:49:44 UTC (rev 11284)
@@ -299,6 +299,10 @@
    {
 
       Set<Class> handledResources = new HashSet(); // Stuff we don't want to examine twice
+      // These classes themselves should not be registered at all
+      // Configured ResourceHome and ResourceQuery components will be registered later
+      handledResources.add(ResourceHome.class);
+      handledResources.add(ResourceQuery.class);
 
       for (Component seamComponent : seamComponents)
       {
@@ -310,8 +314,6 @@
                seamComponent.getBeanClass().equals(ResourceQuery.class))
          {
             registerHomeQueryResources(seamComponent);
-            handledResources.add(ResourceHome.class);
-            handledResources.add(ResourceQuery.class);
             continue;
          }
 




More information about the seam-commits mailing list