[gatein-commits] gatein SVN: r4449 - in components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp: protocol/v2 and 3 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Thu Sep 30 15:21:42 EDT 2010


Author: chris.laprun at jboss.com
Date: 2010-09-30 15:21:41 -0400 (Thu, 30 Sep 2010)
New Revision: 4449

Added:
   components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/support/RequestedMarkupBehavior.java
Modified:
   components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/protocol/v1/MarkupTestCase.java
   components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/protocol/v1/WSRP1ConsumerBaseTest.java
   components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/protocol/v2/MarkupTestCase.java
   components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/protocol/v2/WSRP2ConsumerBaseTest.java
   components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/BehaviorBackedServiceFactory.java
   components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/BehaviorBackedServiceFactory.java
Log:
- GTNWSRP-82: Added RequestedMarkupBehavior class to record currently requested markup behavior so that we can remove dependency of BehaviorBackedServiceFactory on tests.

Modified: components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/protocol/v1/MarkupTestCase.java
===================================================================
--- components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/protocol/v1/MarkupTestCase.java	2010-09-30 18:47:31 UTC (rev 4448)
+++ components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/protocol/v1/MarkupTestCase.java	2010-09-30 19:21:41 UTC (rev 4449)
@@ -54,6 +54,7 @@
 import org.gatein.wsrp.test.protocol.v1.behaviors.ResourceMarkupBehavior;
 import org.gatein.wsrp.test.protocol.v1.behaviors.SessionMarkupBehavior;
 import org.gatein.wsrp.test.support.MockHttpServletRequest;
+import org.gatein.wsrp.test.support.RequestedMarkupBehavior;
 import org.gatein.wsrp.test.support.TestPortletInvocationContext;
 import org.oasis.wsrp.v1.V1CookieProtocol;
 import org.oasis.wsrp.v1.V1Extension;
@@ -298,7 +299,7 @@
       render.setWindowContext(new AbstractWindowContext("windowcontext"));
       render.setPortalContext(new AbstractPortalContext());
 
-      requestedMarkupBehavior = portletHandle;
+      RequestedMarkupBehavior.setRequestedMarkupBehavior(portletHandle);
 
       return render;
    }
@@ -312,7 +313,7 @@
       action.setUserContext(new MockUserContext());
       action.setTarget(PortletContext.createPortletContext(portletHandle));
 
-      requestedMarkupBehavior = portletHandle;
+      RequestedMarkupBehavior.setRequestedMarkupBehavior(portletHandle);
 
       return action;
    }

Modified: components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/protocol/v1/WSRP1ConsumerBaseTest.java
===================================================================
--- components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/protocol/v1/WSRP1ConsumerBaseTest.java	2010-09-30 18:47:31 UTC (rev 4448)
+++ components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/protocol/v1/WSRP1ConsumerBaseTest.java	2010-09-30 19:21:41 UTC (rev 4449)
@@ -47,6 +47,7 @@
 import org.gatein.wsrp.test.protocol.v1.behaviors.ResourceMarkupBehavior;
 import org.gatein.wsrp.test.protocol.v1.behaviors.SessionMarkupBehavior;
 import org.gatein.wsrp.test.support.MockConsumerRegistry;
+import org.gatein.wsrp.test.support.RequestedMarkupBehavior;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -70,9 +71,7 @@
    protected WSRPConsumerImpl consumer = new WSRPConsumerImpl();
 
    private boolean strict = true;
-   protected static String requestedMarkupBehavior;
 
-
    public void setUp() throws Exception
    {
       // reset producer state
@@ -202,21 +201,10 @@
       return producer.getBehaviorRegistry().getServiceDescriptionBehavior().getPortletNumber();
    }
 
-   /**
-    * So that BehaviorBackedServiceFactory can retrieve the proper behavior when retrieving the markup service for
-    * invocation.
-    *
-    * @return
-    */
-   public static String getRequestedMarkupBehavior()
-   {
-      return requestedMarkupBehavior;
-   }
-
    @Override
    protected void tearDown() throws Exception
    {
       // reset the requested markup behavior
-      requestedMarkupBehavior = null;
+      RequestedMarkupBehavior.setRequestedMarkupBehavior(null);
    }
 }

Modified: components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/protocol/v2/MarkupTestCase.java
===================================================================
--- components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/protocol/v2/MarkupTestCase.java	2010-09-30 18:47:31 UTC (rev 4448)
+++ components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/protocol/v2/MarkupTestCase.java	2010-09-30 19:21:41 UTC (rev 4449)
@@ -54,6 +54,7 @@
 import org.gatein.wsrp.test.protocol.v2.behaviors.ResourceMarkupBehavior;
 import org.gatein.wsrp.test.protocol.v2.behaviors.SessionMarkupBehavior;
 import org.gatein.wsrp.test.support.MockHttpServletRequest;
+import org.gatein.wsrp.test.support.RequestedMarkupBehavior;
 import org.gatein.wsrp.test.support.TestPortletInvocationContext;
 import org.oasis.wsrp.v2.CookieProtocol;
 import org.oasis.wsrp.v2.EventDescription;
@@ -302,7 +303,7 @@
       render.setWindowContext(new AbstractWindowContext("windowcontext"));
       render.setPortalContext(new AbstractPortalContext());
 
-      requestedMarkupBehavior = portletHandle;
+      RequestedMarkupBehavior.setRequestedMarkupBehavior(portletHandle);
 
       return render;
    }
@@ -316,7 +317,7 @@
       action.setUserContext(new MockUserContext());
       action.setTarget(PortletContext.createPortletContext(portletHandle));
 
-      requestedMarkupBehavior = portletHandle;
+      RequestedMarkupBehavior.setRequestedMarkupBehavior(portletHandle);
 
       return action;
    }

Modified: components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/protocol/v2/WSRP2ConsumerBaseTest.java
===================================================================
--- components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/protocol/v2/WSRP2ConsumerBaseTest.java	2010-09-30 18:47:31 UTC (rev 4448)
+++ components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/protocol/v2/WSRP2ConsumerBaseTest.java	2010-09-30 19:21:41 UTC (rev 4449)
@@ -47,6 +47,7 @@
 import org.gatein.wsrp.test.protocol.v2.behaviors.ResourceMarkupBehavior;
 import org.gatein.wsrp.test.protocol.v2.behaviors.SessionMarkupBehavior;
 import org.gatein.wsrp.test.support.MockConsumerRegistry;
+import org.gatein.wsrp.test.support.RequestedMarkupBehavior;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -70,9 +71,7 @@
    protected WSRPConsumerImpl consumer = new WSRPConsumerImpl();
 
    private boolean strict = true;
-   protected static String requestedMarkupBehavior;
 
-
    public void setUp() throws Exception
    {
       // reset producer state
@@ -202,21 +201,10 @@
       return producer.getBehaviorRegistry().getServiceDescriptionBehavior().getPortletNumber();
    }
 
-   /**
-    * So that BehaviorBackedServiceFactory can retrieve the proper behavior when retrieving the markup service for
-    * invocation.
-    *
-    * @return
-    */
-   public static String getRequestedMarkupBehavior()
-   {
-      return requestedMarkupBehavior;
-   }
-
    @Override
    protected void tearDown() throws Exception
    {
       // reset the requested markup behavior
-      requestedMarkupBehavior = null;
+      RequestedMarkupBehavior.setRequestedMarkupBehavior(null);
    }
 }

Modified: components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/BehaviorBackedServiceFactory.java
===================================================================
--- components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/BehaviorBackedServiceFactory.java	2010-09-30 18:47:31 UTC (rev 4448)
+++ components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/BehaviorBackedServiceFactory.java	2010-09-30 19:21:41 UTC (rev 4449)
@@ -26,7 +26,6 @@
 import org.gatein.common.NotYetImplemented;
 import org.gatein.pc.api.Mode;
 import org.gatein.pc.api.WindowState;
-import org.gatein.wsrp.protocol.v1.WSRP1ConsumerBaseTest;
 import org.gatein.wsrp.services.MarkupService;
 import org.gatein.wsrp.services.PortletManagementService;
 import org.gatein.wsrp.services.RegistrationService;
@@ -36,6 +35,7 @@
 import org.gatein.wsrp.services.v1.V1PortletManagementService;
 import org.gatein.wsrp.services.v1.V1RegistrationService;
 import org.gatein.wsrp.services.v1.V1ServiceDescriptionService;
+import org.gatein.wsrp.test.support.RequestedMarkupBehavior;
 import org.oasis.wsrp.v1.V1AccessDenied;
 import org.oasis.wsrp.v1.V1GetMarkup;
 import org.oasis.wsrp.v1.V1InconsistentParameters;
@@ -94,7 +94,7 @@
       }
       if (WSRPV1MarkupPortType.class.isAssignableFrom(serviceClass))
       {
-         String requestedMarkupBehavior = WSRP1ConsumerBaseTest.getRequestedMarkupBehavior();
+         String requestedMarkupBehavior = RequestedMarkupBehavior.getRequestedMarkupBehavior();
          if (requestedMarkupBehavior == null)
          {
             requestedMarkupBehavior = MARKUP;

Modified: components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/BehaviorBackedServiceFactory.java
===================================================================
--- components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/BehaviorBackedServiceFactory.java	2010-09-30 18:47:31 UTC (rev 4448)
+++ components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/BehaviorBackedServiceFactory.java	2010-09-30 19:21:41 UTC (rev 4449)
@@ -26,7 +26,6 @@
 import org.gatein.common.NotYetImplemented;
 import org.gatein.pc.api.Mode;
 import org.gatein.pc.api.WindowState;
-import org.gatein.wsrp.protocol.v2.WSRP2ConsumerBaseTest;
 import org.gatein.wsrp.services.MarkupService;
 import org.gatein.wsrp.services.PortletManagementService;
 import org.gatein.wsrp.services.RegistrationService;
@@ -36,6 +35,7 @@
 import org.gatein.wsrp.services.v2.V2PortletManagementService;
 import org.gatein.wsrp.services.v2.V2RegistrationService;
 import org.gatein.wsrp.services.v2.V2ServiceDescriptionService;
+import org.gatein.wsrp.test.support.RequestedMarkupBehavior;
 import org.oasis.wsrp.v2.AccessDenied;
 import org.oasis.wsrp.v2.GetMarkup;
 import org.oasis.wsrp.v2.InconsistentParameters;
@@ -94,7 +94,7 @@
       }
       if (WSRPV2MarkupPortType.class.isAssignableFrom(serviceClass))
       {
-         String requestedMarkupBehavior = WSRP2ConsumerBaseTest.getRequestedMarkupBehavior();
+         String requestedMarkupBehavior = RequestedMarkupBehavior.getRequestedMarkupBehavior();
          if (requestedMarkupBehavior == null)
          {
             requestedMarkupBehavior = MARKUP;

Added: components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/support/RequestedMarkupBehavior.java
===================================================================
--- components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/support/RequestedMarkupBehavior.java	                        (rev 0)
+++ components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/support/RequestedMarkupBehavior.java	2010-09-30 19:21:41 UTC (rev 4449)
@@ -0,0 +1,43 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2010, Red Hat Middleware, LLC, and individual
+ * contributors as indicated by the @authors tag. See the
+ * copyright.txt in the distribution for a full listing of
+ * individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.gatein.wsrp.test.support;
+
+/**
+ * @author <a href="mailto:chris.laprun at jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+public class RequestedMarkupBehavior
+{
+   private static ThreadLocal<String> requestedMarkupBehavior = new ThreadLocal<String>();
+
+   public static String getRequestedMarkupBehavior()
+   {
+      return requestedMarkupBehavior.get();
+   }
+
+   public static void setRequestedMarkupBehavior(String requestedMarkupBehavior)
+   {
+      RequestedMarkupBehavior.requestedMarkupBehavior.set(requestedMarkupBehavior);
+   }
+}



More information about the gatein-commits mailing list