[jboss-svn-commits] JBoss Portal SVN: r5474 - in trunk/wsrp/src: main/org/jboss/portal/test/wsrp main/org/jboss/portal/test/wsrp/framework main/org/jboss/portal/test/wsrp/framework/support main/org/jboss/portal/test/wsrp/v1/consumer resources/tests/test-wsrp-consumer-jar/org/jboss/portal/test/wsrp resources/tests/test-wsrp-consumer-sar/META-INF

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Tue Oct 17 16:28:15 EDT 2006


Author: chris.laprun at jboss.com
Date: 2006-10-17 16:28:05 -0400 (Tue, 17 Oct 2006)
New Revision: 5474

Added:
   trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/
   trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/TestWSRPProducer.java
   trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/TestWSRPProducerImpl.java
   trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/
   trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/BasicInstanceContext.java
   trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/BasicSecurityContext.java
   trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/BasicUserContext.java
   trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/MockHttpServletRequest.java
   trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/MockHttpServletResponse.java
   trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/MockHttpSession.java
   trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/ServiceObjectFactory.java
   trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/TestPortletInvocationContext.java
Removed:
   trunk/wsrp/src/main/org/jboss/portal/test/wsrp/TestWSRPProducer.java
   trunk/wsrp/src/main/org/jboss/portal/test/wsrp/TestWSRPProducerImpl.java
   trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/BasicInstanceContext.java
   trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/BasicSecurityContext.java
   trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/BasicUserContext.java
   trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/MockHttpServletRequest.java
   trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/MockHttpServletResponse.java
   trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/MockHttpSession.java
   trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/SOF.java
   trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/TestPortletInvocationContext.java
Modified:
   trunk/wsrp/src/main/org/jboss/portal/test/wsrp/WSRPConsumerBaseTest.java
   trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/MarkupTestCase.java
   trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/ServiceDescriptionTestCase.java
   trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/V1ConsumerBaseTest.java
   trunk/wsrp/src/resources/tests/test-wsrp-consumer-jar/org/jboss/portal/test/wsrp/jboss-beans.xml
   trunk/wsrp/src/resources/tests/test-wsrp-consumer-sar/META-INF/jboss-service.xml
Log:
- More refactorings: created a framework directory for the test framework.
- Support directory contains support classes :)

Deleted: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/TestWSRPProducer.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/TestWSRPProducer.java	2006-10-17 17:02:25 UTC (rev 5473)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/TestWSRPProducer.java	2006-10-17 20:28:05 UTC (rev 5474)
@@ -1,44 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat                                               *
- * Copyright 2006, 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.jboss.portal.test.wsrp;
-
-import org.jboss.portal.wsrp.WSRPProducer;
-import org.jboss.portal.wsrp.core.ServiceDescription;
-
-import javax.servlet.http.HttpServletResponse;
-
-/**
- * Exposes WSPRProducer test implementation methods - we inject what it returns
- *
- * @author <a href="mailto:boleslaw.dawidowicz at jboss.org">Boleslaw Dawidowicz</a>
- * @version $Revision$
- */
-public interface TestWSRPProducer extends WSRPProducer
-{
-
-   public void setGetServiceDescriptionResponse(ServiceDescription sd);
-
-   void reset();
-
-   void setResponse(HttpServletResponse response);
-}

Deleted: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/TestWSRPProducerImpl.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/TestWSRPProducerImpl.java	2006-10-17 17:02:25 UTC (rev 5473)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/TestWSRPProducerImpl.java	2006-10-17 20:28:05 UTC (rev 5474)
@@ -1,509 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat                                               *
- * Copyright 2006, 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.jboss.portal.test.wsrp;
-
-import org.jboss.invocation.Invocation;
-import org.jboss.portal.jems.as.system.AbstractJBossService;
-import org.jboss.portal.test.wsrp.v1.consumer.SOF;
-import org.jboss.portal.wsrp.WSRPConstants;
-import org.jboss.portal.wsrp.WSRPTypeFactory;
-import org.jboss.portal.wsrp.WSRPUtils;
-import org.jboss.portal.wsrp.core.AccessDeniedFault;
-import org.jboss.portal.wsrp.core.BlockingInteractionResponse;
-import org.jboss.portal.wsrp.core.ClonePortlet;
-import org.jboss.portal.wsrp.core.CookieProtocol;
-import org.jboss.portal.wsrp.core.DestroyPortlets;
-import org.jboss.portal.wsrp.core.DestroyPortletsResponse;
-import org.jboss.portal.wsrp.core.Fault;
-import org.jboss.portal.wsrp.core.GetMarkup;
-import org.jboss.portal.wsrp.core.GetPortletDescription;
-import org.jboss.portal.wsrp.core.GetPortletProperties;
-import org.jboss.portal.wsrp.core.GetPortletPropertyDescription;
-import org.jboss.portal.wsrp.core.GetServiceDescription;
-import org.jboss.portal.wsrp.core.InconsistentParametersFault;
-import org.jboss.portal.wsrp.core.InitCookie;
-import org.jboss.portal.wsrp.core.InvalidCookieFault;
-import org.jboss.portal.wsrp.core.InvalidHandleFault;
-import org.jboss.portal.wsrp.core.InvalidRegistrationFault;
-import org.jboss.portal.wsrp.core.InvalidSessionFault;
-import org.jboss.portal.wsrp.core.InvalidUserCategoryFault;
-import org.jboss.portal.wsrp.core.LocalizedString;
-import org.jboss.portal.wsrp.core.MarkupContext;
-import org.jboss.portal.wsrp.core.MarkupParams;
-import org.jboss.portal.wsrp.core.MarkupResponse;
-import org.jboss.portal.wsrp.core.MarkupType;
-import org.jboss.portal.wsrp.core.MissingParametersFault;
-import org.jboss.portal.wsrp.core.ModelDescription;
-import org.jboss.portal.wsrp.core.ModifyRegistration;
-import org.jboss.portal.wsrp.core.OperationFailedFault;
-import org.jboss.portal.wsrp.core.PerformBlockingInteraction;
-import org.jboss.portal.wsrp.core.PortletContext;
-import org.jboss.portal.wsrp.core.PortletDescription;
-import org.jboss.portal.wsrp.core.PortletDescriptionResponse;
-import org.jboss.portal.wsrp.core.PortletPropertyDescriptionResponse;
-import org.jboss.portal.wsrp.core.PortletStateChangeRequiredFault;
-import org.jboss.portal.wsrp.core.PropertyDescription;
-import org.jboss.portal.wsrp.core.PropertyList;
-import org.jboss.portal.wsrp.core.RegistrationContext;
-import org.jboss.portal.wsrp.core.RegistrationData;
-import org.jboss.portal.wsrp.core.RegistrationState;
-import org.jboss.portal.wsrp.core.ReleaseSessions;
-import org.jboss.portal.wsrp.core.ReturnAny;
-import org.jboss.portal.wsrp.core.ServiceDescription;
-import org.jboss.portal.wsrp.core.SessionContext;
-import org.jboss.portal.wsrp.core.SetPortletProperties;
-import org.jboss.portal.wsrp.core.UnsupportedLocaleFault;
-import org.jboss.portal.wsrp.core.UnsupportedMimeTypeFault;
-import org.jboss.portal.wsrp.core.UnsupportedModeFault;
-import org.jboss.portal.wsrp.core.UnsupportedWindowStateFault;
-import org.jboss.portal.wsrp.core.UpdateResponse;
-
-import javax.servlet.http.Cookie;
-import javax.servlet.http.HttpServletResponse;
-import java.lang.reflect.Method;
-import java.rmi.RemoteException;
-
-/**
- * This is dummy clone of org.jboss.portal.wsrp.producer.WSRPProducerImpl customizable from client side. Just for
- * consumer implementation testing purposes.
- *
- * @author <a href="mailto:Boleslaw.Dawidowicz at jboss.com">Boleslaw Dawidowicz</a>
- * @version $Revision$
- * @since 2.4
- */
-public class TestWSRPProducerImpl extends AbstractJBossService implements TestWSRPProducer
-{
-   //injected objects to return by WS methods (for tests)
-
-   ServiceDescription serviceDescription;
-
-   /**
-    * The ServiceDescription that is returned to an unregistred Consumer when registration is required: no information
-    * is provided apart from the fact that registration is required and what information is required to sucessfully
-    * register.
-    *
-    * @see org.jboss.portal.test.wsrp.TestWSRPProducerImpl#requiredRegistrationInfo
-    */
-   private ServiceDescription requiredRegistrationNotProvidedSD;
-
-   /**
-    * <code>true</code> if registration is required to access this Producer's information and services,
-    * <code>false</code> otherwise. Note: server-side registration is not supported in 2.4
-    */
-   private boolean requiresRegistration;
-
-   private int sessionExpirationTime = DEFAULT_SESSION_EXPIRATION_TIME;
-
-   private CookieProtocol requiresInitCookie = CookieProtocol.none;
-
-   /** Required registration information to be provided by consumers to access this Producer's information and services. */
-   private ModelDescription requiredRegistrationInfo;
-
-   private int count;
-
-   /** Used to set the cookie in initCookie */
-   private HttpServletResponse response;
-
-   public final static String SESSION_ID = "sessionID";
-   public static final String USER_COOKIE = "cookie";
-
-   public TestWSRPProducerImpl()
-   {
-      reset();
-   }
-
-   public void reset()
-   {
-      requiresRegistration = false;
-      requiredRegistrationInfo = new ModelDescription();
-      requiredRegistrationNotProvidedSD = new ServiceDescription(true, null, null, null, null, null, requiresInitCookie,
-         requiredRegistrationInfo, WSRPConstants.DEFAULT_LOCALES, null, null);
-
-      //Prepare sample ServiceDescription
-      serviceDescription = WSRPTypeFactory.createServiceDescription(requiresRegistration);
-
-      //Prepare description of two portlets
-      PortletDescription pd1 = createPortletDescription(SOF.PORTLET_HANDLE_1, "");
-      PortletDescription pd2 = createPortletDescription(SOF.PORTLET_HANDLE_2, "2");
-      serviceDescription.setOfferedPortlets(new PortletDescription[]{pd1, pd2});
-
-      count = 0;
-
-      if (response != null)
-      {
-         response.reset();
-      }
-      response = null;
-
-      requiresInitCookie = null;
-   }
-
-
-   public void setResponse(HttpServletResponse response)
-   {
-      this.response = response;
-   }
-
-   private PortletDescription createPortletDescription(String portletHandle, String suffix)
-   {
-      PortletDescription portletDesc = new PortletDescription();
-      portletDesc.setPortletHandle(portletHandle);
-      portletDesc.setMarkupTypes(new MarkupType[]{new MarkupType("text/html", new String[]{WSRPConstants.NORMAL_WINDOW_STATE},
-         new String[]{WSRPConstants.VIEW_MODE}, WSRPConstants.DEFAULT_LOCALES, null)});
-      portletDesc.setDescription(SOF.createLocalizedString(SOF.SAMPLE_DESCRIPTION + suffix));
-      portletDesc.setTitle(SOF.createLocalizedString(SOF.SAMPLE_TITLE + suffix));
-      portletDesc.setShortTitle(SOF.createLocalizedString(SOF.SAMPLE_SHORTTITLE + suffix));
-      portletDesc.setDisplayName(SOF.createLocalizedString(SOF.SAMPLE_DISPLAYNAME + suffix));
-      portletDesc.setKeywords(new LocalizedString[]{SOF.createLocalizedString(SOF.SAMPLE_KEYWORD + suffix)});
-      return portletDesc;
-   }
-
-   // ServiceDescription implementation ********************************************************************************
-
-   public ServiceDescription getServiceDescription(GetServiceDescription gs)
-      throws InvalidRegistrationFault, OperationFailedFault, RemoteException
-   {
-      return serviceDescription;
-   }
-
-   public void setGetServiceDescriptionResponse(ServiceDescription sd)
-   {
-      serviceDescription = sd;
-   }
-
-   // MarkupService implementation *************************************************************************************
-
-   public MarkupResponse getMarkup(GetMarkup getMarkup)
-      throws UnsupportedWindowStateFault, InvalidCookieFault, InvalidSessionFault, AccessDeniedFault,
-      InconsistentParametersFault, InvalidHandleFault, UnsupportedLocaleFault, UnsupportedModeFault,
-      OperationFailedFault, MissingParametersFault, InvalidUserCategoryFault, InvalidRegistrationFault,
-      UnsupportedMimeTypeFault, RemoteException
-   {
-      String handle = getMarkup.getPortletContext().getPortletHandle();
-      String markupString = null;
-      String sessionId = getMarkup.getRuntimeContext().getSessionID();
-
-      if (SOF.PORTLET_HANDLE_1.equals(handle))
-      {
-         markupString = "portlet1:";
-      }
-      else if (SOF.PORTLET_HANDLE_2.equals(handle)) // markup for SOF.PORTLET_HANDLE_2 simulates using the session
-      {
-         // if we have a session, increments count to simulate session usage
-         if (SESSION_ID.equals(sessionId))
-         {
-            count++;
-         }
-         markupString = "portlet2:" + count + ":";
-      }
-
-      MarkupParams markupParams = getMarkup.getMarkupParams();
-      markupString += WSRPUtils.getJSR168PortletModeFromWSRPName(markupParams.getMode()) + ":";
-      markupString += WSRPUtils.getJSR168WindowStateFromWSRPName(markupParams.getWindowState());
-      String ns = markupParams.getNavigationalState();
-      if (ns != null)
-      {
-         markupString += ":" + ns;
-      }
-
-      if (SOF.NULL_MARKUP_PORTLET_HANDLE.equals(handle))
-      {
-         markupString = null;
-      }
-      else if (SOF.EMPTY_MARKUP_PORTLET_HANDLE.equals(handle))
-      {
-         markupString = "";
-      }
-
-      MarkupContext markupContext = WSRPTypeFactory.createMarkupContext("text/html", markupString);
-      markupContext.setRequiresUrlRewriting(Boolean.TRUE);
-
-      // fake markup caching
-      if (SOF.PORTLET_HANDLE_1.equals(handle))
-      {
-         markupContext.setCacheControl(WSRPTypeFactory.createCacheControl(15, WSRPConstants.CACHE_PER_USER));
-      }
-
-      MarkupResponse markupResponse = WSRPTypeFactory.createMarkupResponse(markupContext);
-
-      // fakes creation of a portlet session if not already present
-      if (count == 0 || SESSION_ID.equals(sessionId))
-      {
-         SessionContext sessionContext = WSRPTypeFactory.createSessionContext(SESSION_ID, 30);
-         markupResponse.setSessionContext(sessionContext);
-      }
-
-      return markupResponse;
-   }
-
-   public BlockingInteractionResponse performBlockingInteraction(PerformBlockingInteraction performBlockingInteraction)
-      throws InvalidSessionFault, UnsupportedModeFault, UnsupportedMimeTypeFault, OperationFailedFault,
-      UnsupportedWindowStateFault, UnsupportedLocaleFault, AccessDeniedFault, PortletStateChangeRequiredFault,
-      InvalidRegistrationFault, MissingParametersFault, InvalidUserCategoryFault, InconsistentParametersFault,
-      InvalidHandleFault, InvalidCookieFault, RemoteException
-   {
-      String handle = performBlockingInteraction.getPortletContext().getPortletHandle();
-      String ns = performBlockingInteraction.getMarkupParams().getNavigationalState();
-      if ("redirect".equals(ns))
-      {
-         return WSRPTypeFactory.createBlockingInteractionResponse("http://jboss.com");
-      }
-
-      if (SOF.PORTLET_HANDLE_1.equals(handle))
-      {
-         ns = "ns1";
-      }
-      if (SOF.PORTLET_HANDLE_2.equals(handle))
-      {
-         ns = "ns2";
-      }
-      UpdateResponse ur = WSRPTypeFactory.createUpdateResponse();
-      ur.setNavigationalState(ns);
-      BlockingInteractionResponse res = WSRPTypeFactory.createBlockingInteractionResponse(ur);
-
-      return res;
-   }
-
-   public ReturnAny releaseSessions(ReleaseSessions releaseSessions)
-      throws InvalidRegistrationFault, OperationFailedFault, MissingParametersFault, AccessDeniedFault, RemoteException
-   {
-      return null;
-   }
-
-   public ReturnAny initCookie(InitCookie initCookie)
-      throws AccessDeniedFault, OperationFailedFault, InvalidRegistrationFault, RemoteException
-   {
-      response.addCookie(new Cookie("cookieName", USER_COOKIE));
-      return null;
-   }
-
-   // Registration implementation **************************************************************************************
-
-   public RegistrationContext register(RegistrationData register) throws MissingParametersFault, OperationFailedFault, RemoteException
-   {
-      return null;
-   }
-
-   public ReturnAny deregister(RegistrationContext deregister) throws OperationFailedFault, InvalidRegistrationFault, RemoteException
-   {
-      return null;
-   }
-
-   public RegistrationState modifyRegistration(ModifyRegistration modifyRegistration) throws MissingParametersFault, OperationFailedFault, InvalidRegistrationFault, RemoteException
-   {
-      return null;
-   }
-
-   // PortletManagement implementation *********************************************************************************
-
-   public PortletDescriptionResponse getPortletDescription(GetPortletDescription getPortletDescription)
-      throws AccessDeniedFault, InvalidHandleFault, InvalidUserCategoryFault, InconsistentParametersFault,
-      MissingParametersFault, InvalidRegistrationFault, OperationFailedFault, RemoteException
-   {
-      return null;
-   }
-
-   public PortletContext clonePortlet(ClonePortlet clonePortlet) throws InvalidUserCategoryFault, AccessDeniedFault, OperationFailedFault, InvalidHandleFault, InvalidRegistrationFault, InconsistentParametersFault, MissingParametersFault, RemoteException
-   {
-      return null;
-   }
-
-   public DestroyPortletsResponse destroyPortlets(DestroyPortlets destroyPortlets) throws InconsistentParametersFault, MissingParametersFault, InvalidRegistrationFault, OperationFailedFault, RemoteException
-   {
-      return null;
-   }
-
-   public PortletContext setPortletProperties(SetPortletProperties setPortletProperties) throws OperationFailedFault, InvalidHandleFault, MissingParametersFault, InconsistentParametersFault, InvalidUserCategoryFault, AccessDeniedFault, InvalidRegistrationFault, RemoteException
-   {
-      return null;
-   }
-
-   public PropertyList getPortletProperties(GetPortletProperties getPortletProperties) throws InvalidHandleFault, MissingParametersFault, InvalidRegistrationFault, AccessDeniedFault, OperationFailedFault, InconsistentParametersFault, InvalidUserCategoryFault, RemoteException
-   {
-      return null;
-   }
-
-   public PortletPropertyDescriptionResponse getPortletPropertyDescription(GetPortletPropertyDescription getPortletPropertyDescription) throws MissingParametersFault, InconsistentParametersFault, InvalidUserCategoryFault, InvalidRegistrationFault, AccessDeniedFault, InvalidHandleFault, OperationFailedFault, RemoteException
-   {
-      return null;
-   }
-
-   // Producer implementation ******************************************************************************************
-
-   public void setRequiresRegistration(boolean requiresRegistration)
-   {
-      this.requiresRegistration = requiresRegistration;
-   }
-
-   public boolean isRequiresRegistration()
-   {
-      return requiresRegistration;
-   }
-
-   public CookieProtocol getRequiresInitCookie()
-   {
-      return requiresInitCookie;
-   }
-
-   public void setRequiresInitCookie(CookieProtocol requiresInitCookie)
-   {
-      this.requiresInitCookie = requiresInitCookie;
-      serviceDescription.setRequiresInitCookie(requiresInitCookie);
-   }
-
-   public int getSessionExpirationTime()
-   {
-      return sessionExpirationTime;
-   }
-
-   public void setSessionExpirationTime(int sessionExpirationTime)
-   {
-      this.sessionExpirationTime = sessionExpirationTime;
-   }
-
-   public PortletDescription getPortletDescription(String handle, String[] locales)
-   {
-      if (handle == null)
-      {
-         throw new IllegalArgumentException("Invalid handle");
-      }
-
-      PortletDescription[] offeredPortlets = serviceDescription.getOfferedPortlets();
-      if (SOF.PORTLET_HANDLE_1.equals(handle))
-      {
-         return offeredPortlets[0];
-      }
-      if (SOF.PORTLET_HANDLE_2.equals(handle))
-      {
-         return offeredPortlets[1];
-      }
-      return null;
-   }
-
-   public void addRegistrationProperty(PropertyDescription propertyDescription)
-   {
-      PropertyDescription[] descriptions = requiredRegistrationInfo.getPropertyDescriptions();
-      if (descriptions == null)
-      {
-         descriptions = new PropertyDescription[]{propertyDescription};
-         requiredRegistrationInfo.setPropertyDescriptions(descriptions);
-      }
-      else
-      {
-         PropertyDescription[] newDescs = new PropertyDescription[descriptions.length + 1];
-         System.arraycopy(descriptions, 0, newDescs, 0, descriptions.length);
-         newDescs[descriptions.length] = propertyDescription;
-         requiredRegistrationInfo.setPropertyDescriptions(newDescs);
-      }
-   }
-
-   public void clearRegistrationProperties()
-   {
-      requiredRegistrationInfo.setPropertyDescriptions(null);
-   }
-
-   // Contract with Invoker implementation *****************************************************************************
-
-   /** Dispatch the invocation to the target by reflection */
-   public Object invoke(Invocation invocation) throws Exception
-   {
-      Method method = invocation.getMethod();
-      Object[] args = invocation.getArguments();
-      return method.invoke(this, args);
-   }
-
-   // Protected methods ************************************************************************************************
-
-   /**
-    * Checks that the specified registration information is valid if this Producer requires registration.
-    *
-    * @param registrationContext
-    * @return
-    */
-   protected boolean isRegistrationValid(RegistrationContext registrationContext)
-   {
-      if (isRequiresRegistration())
-      {
-         // todo: implement more completely
-         if (registrationContext == null)
-         {
-            return false;
-         }
-      }
-      return true;
-   }
-
-   public boolean isSessionValid(String sessionId)
-   {
-      // todo: implement
-      return true;
-   }
-
-   /**
-    * Create a new OperationFailedFault based on the specified cause.
-    *
-    * @param cause the cause why the operation failed
-    * @return a new OperationFailedFault based on the specified cause.
-    */
-   protected OperationFailedFault createOperationFailedFault(Throwable cause)
-   {
-      return (OperationFailedFault)createFaultFrom(OperationFailedFault.class, cause);
-   }
-
-   protected Fault createFaultFrom(Class faultClass, Throwable cause)
-   {
-      Fault fault = null;
-      try
-      {
-         fault = (Fault)faultClass.newInstance();
-         fault.initCause(cause);
-      }
-      catch (Exception e)
-      {
-         // shouldn't happen
-         e.printStackTrace();
-      }
-      return fault;
-   }
-
-   protected void checkMissingValue(Object valueToCheck, String valueName, String context) throws MissingParametersFault
-   {
-      if (valueToCheck == null)
-      {
-         throw(MissingParametersFault)
-            createFaultFrom(MissingParametersFault.class, new NullPointerException("Missing required " + valueName
-               + (context != null ? " in " + context : "")));
-      }
-   }
-
-   /**
-    * Retrieves the service description offered to unregistered consumers when registration is required.
-    *
-    * @return the service description offered to unregistered consumers when registration is required
-    */
-   protected ServiceDescription getRegistrationNotProvidedServiceDescription()
-   {
-      return requiredRegistrationNotProvidedSD;
-   }
-
-}

Modified: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/WSRPConsumerBaseTest.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/WSRPConsumerBaseTest.java	2006-10-17 17:02:25 UTC (rev 5473)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/WSRPConsumerBaseTest.java	2006-10-17 20:28:05 UTC (rev 5474)
@@ -23,6 +23,7 @@
 package org.jboss.portal.test.wsrp;
 
 import org.jboss.portal.test.framework.ServiceLookup;
+import org.jboss.portal.test.wsrp.framework.TestWSRPProducer;
 import org.jboss.portal.wsrp.WSRPConsumer;
 
 /**

Copied: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/TestWSRPProducer.java (from rev 5472, trunk/wsrp/src/main/org/jboss/portal/test/wsrp/TestWSRPProducer.java)
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/TestWSRPProducer.java	2006-10-17 00:12:37 UTC (rev 5472)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/TestWSRPProducer.java	2006-10-17 20:28:05 UTC (rev 5474)
@@ -0,0 +1,44 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat                                               *
+ * Copyright 2006, 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.jboss.portal.test.wsrp.framework;
+
+import org.jboss.portal.wsrp.WSRPProducer;
+import org.jboss.portal.wsrp.core.ServiceDescription;
+
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * Exposes WSPRProducer test implementation methods - we inject what it returns
+ *
+ * @author <a href="mailto:boleslaw.dawidowicz at jboss.org">Boleslaw Dawidowicz</a>
+ * @version $Revision$
+ */
+public interface TestWSRPProducer extends WSRPProducer
+{
+
+   public void setGetServiceDescriptionResponse(ServiceDescription sd);
+
+   void reset();
+
+   void setResponse(HttpServletResponse response);
+}


Property changes on: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/TestWSRPProducer.java
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Copied: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/TestWSRPProducerImpl.java (from rev 5472, trunk/wsrp/src/main/org/jboss/portal/test/wsrp/TestWSRPProducerImpl.java)
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/TestWSRPProducerImpl.java	2006-10-17 00:12:37 UTC (rev 5472)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/TestWSRPProducerImpl.java	2006-10-17 20:28:05 UTC (rev 5474)
@@ -0,0 +1,510 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat                                               *
+ * Copyright 2006, 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.jboss.portal.test.wsrp.framework;
+
+import org.jboss.invocation.Invocation;
+import org.jboss.portal.jems.as.system.AbstractJBossService;
+import org.jboss.portal.test.wsrp.framework.support.ServiceObjectFactory;
+import org.jboss.portal.wsrp.WSRPConstants;
+import org.jboss.portal.wsrp.WSRPTypeFactory;
+import org.jboss.portal.wsrp.WSRPUtils;
+import org.jboss.portal.wsrp.core.AccessDeniedFault;
+import org.jboss.portal.wsrp.core.BlockingInteractionResponse;
+import org.jboss.portal.wsrp.core.ClonePortlet;
+import org.jboss.portal.wsrp.core.CookieProtocol;
+import org.jboss.portal.wsrp.core.DestroyPortlets;
+import org.jboss.portal.wsrp.core.DestroyPortletsResponse;
+import org.jboss.portal.wsrp.core.Fault;
+import org.jboss.portal.wsrp.core.GetMarkup;
+import org.jboss.portal.wsrp.core.GetPortletDescription;
+import org.jboss.portal.wsrp.core.GetPortletProperties;
+import org.jboss.portal.wsrp.core.GetPortletPropertyDescription;
+import org.jboss.portal.wsrp.core.GetServiceDescription;
+import org.jboss.portal.wsrp.core.InconsistentParametersFault;
+import org.jboss.portal.wsrp.core.InitCookie;
+import org.jboss.portal.wsrp.core.InvalidCookieFault;
+import org.jboss.portal.wsrp.core.InvalidHandleFault;
+import org.jboss.portal.wsrp.core.InvalidRegistrationFault;
+import org.jboss.portal.wsrp.core.InvalidSessionFault;
+import org.jboss.portal.wsrp.core.InvalidUserCategoryFault;
+import org.jboss.portal.wsrp.core.LocalizedString;
+import org.jboss.portal.wsrp.core.MarkupContext;
+import org.jboss.portal.wsrp.core.MarkupParams;
+import org.jboss.portal.wsrp.core.MarkupResponse;
+import org.jboss.portal.wsrp.core.MarkupType;
+import org.jboss.portal.wsrp.core.MissingParametersFault;
+import org.jboss.portal.wsrp.core.ModelDescription;
+import org.jboss.portal.wsrp.core.ModifyRegistration;
+import org.jboss.portal.wsrp.core.OperationFailedFault;
+import org.jboss.portal.wsrp.core.PerformBlockingInteraction;
+import org.jboss.portal.wsrp.core.PortletContext;
+import org.jboss.portal.wsrp.core.PortletDescription;
+import org.jboss.portal.wsrp.core.PortletDescriptionResponse;
+import org.jboss.portal.wsrp.core.PortletPropertyDescriptionResponse;
+import org.jboss.portal.wsrp.core.PortletStateChangeRequiredFault;
+import org.jboss.portal.wsrp.core.PropertyDescription;
+import org.jboss.portal.wsrp.core.PropertyList;
+import org.jboss.portal.wsrp.core.RegistrationContext;
+import org.jboss.portal.wsrp.core.RegistrationData;
+import org.jboss.portal.wsrp.core.RegistrationState;
+import org.jboss.portal.wsrp.core.ReleaseSessions;
+import org.jboss.portal.wsrp.core.ReturnAny;
+import org.jboss.portal.wsrp.core.ServiceDescription;
+import org.jboss.portal.wsrp.core.SessionContext;
+import org.jboss.portal.wsrp.core.SetPortletProperties;
+import org.jboss.portal.wsrp.core.UnsupportedLocaleFault;
+import org.jboss.portal.wsrp.core.UnsupportedMimeTypeFault;
+import org.jboss.portal.wsrp.core.UnsupportedModeFault;
+import org.jboss.portal.wsrp.core.UnsupportedWindowStateFault;
+import org.jboss.portal.wsrp.core.UpdateResponse;
+
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletResponse;
+import java.lang.reflect.Method;
+import java.rmi.RemoteException;
+
+/**
+ * This is dummy clone of org.jboss.portal.wsrp.producer.WSRPProducerImpl customizable from client side. Just for
+ * consumer implementation testing purposes.
+ *
+ * @author <a href="mailto:Boleslaw.Dawidowicz at jboss.com">Boleslaw Dawidowicz</a>
+ * @version $Revision$
+ * @since 2.4
+ */
+public class TestWSRPProducerImpl extends AbstractJBossService implements TestWSRPProducer
+{
+   //injected objects to return by WS methods (for tests)
+
+   ServiceDescription serviceDescription;
+
+   /**
+    * The ServiceDescription that is returned to an unregistred Consumer when registration is required: no information
+    * is provided apart from the fact that registration is required and what information is required to sucessfully
+    * register.
+    *
+    * @see TestWSRPProducerImpl#requiredRegistrationInfo
+    */
+   private ServiceDescription requiredRegistrationNotProvidedSD;
+
+   /**
+    * <code>true</code> if registration is required to access this Producer's information and services,
+    * <code>false</code> otherwise. Note: server-side registration is not supported in 2.4
+    */
+   private boolean requiresRegistration;
+
+   private int sessionExpirationTime = DEFAULT_SESSION_EXPIRATION_TIME;
+
+   private CookieProtocol requiresInitCookie = CookieProtocol.none;
+
+   /** Required registration information to be provided by consumers to access this Producer's information and services. */
+   private ModelDescription requiredRegistrationInfo;
+
+   private int count;
+
+   /** Used to set the cookie in initCookie */
+   private HttpServletResponse response;
+
+   public final static String SESSION_ID = "sessionID";
+   public static final String USER_COOKIE = "cookie";
+
+   public TestWSRPProducerImpl()
+   {
+      reset();
+   }
+
+   public void reset()
+   {
+      requiresRegistration = false;
+      requiredRegistrationInfo = new ModelDescription();
+      requiredRegistrationNotProvidedSD = new ServiceDescription(true, null, null, null, null, null, requiresInitCookie,
+         requiredRegistrationInfo, WSRPConstants.DEFAULT_LOCALES, null, null);
+
+      //Prepare sample ServiceDescription
+      serviceDescription = WSRPTypeFactory.createServiceDescription(requiresRegistration);
+
+      //Prepare description of two portlets
+      PortletDescription pd1 = createPortletDescription(ServiceObjectFactory.PORTLET_HANDLE_1, "");
+      PortletDescription pd2 = createPortletDescription(ServiceObjectFactory.PORTLET_HANDLE_2, "2");
+      serviceDescription.setOfferedPortlets(new PortletDescription[]{pd1, pd2});
+
+      count = 0;
+
+      if (response != null)
+      {
+         response.reset();
+      }
+      response = null;
+
+      requiresInitCookie = null;
+   }
+
+
+   public void setResponse(HttpServletResponse response)
+   {
+      this.response = response;
+   }
+
+   private PortletDescription createPortletDescription(String portletHandle, String suffix)
+   {
+      PortletDescription portletDesc = new PortletDescription();
+      portletDesc.setPortletHandle(portletHandle);
+      portletDesc.setMarkupTypes(new MarkupType[]{new MarkupType("text/html", new String[]{WSRPConstants.NORMAL_WINDOW_STATE},
+         new String[]{WSRPConstants.VIEW_MODE}, WSRPConstants.DEFAULT_LOCALES, null)});
+      portletDesc.setDescription(ServiceObjectFactory.createLocalizedString(ServiceObjectFactory.SAMPLE_DESCRIPTION + suffix));
+      portletDesc.setTitle(ServiceObjectFactory.createLocalizedString(ServiceObjectFactory.SAMPLE_TITLE + suffix));
+      portletDesc.setShortTitle(ServiceObjectFactory.createLocalizedString(ServiceObjectFactory.SAMPLE_SHORTTITLE + suffix));
+      portletDesc.setDisplayName(ServiceObjectFactory.createLocalizedString(ServiceObjectFactory.SAMPLE_DISPLAYNAME + suffix));
+      portletDesc.setKeywords(new LocalizedString[]{ServiceObjectFactory.createLocalizedString(ServiceObjectFactory.SAMPLE_KEYWORD + suffix)});
+      return portletDesc;
+   }
+
+   // ServiceDescription implementation ********************************************************************************
+
+   public ServiceDescription getServiceDescription(GetServiceDescription gs)
+      throws InvalidRegistrationFault, OperationFailedFault, RemoteException
+   {
+      return serviceDescription;
+   }
+
+   public void setGetServiceDescriptionResponse(ServiceDescription sd)
+   {
+      serviceDescription = sd;
+   }
+
+   // MarkupService implementation *************************************************************************************
+
+   public MarkupResponse getMarkup(GetMarkup getMarkup)
+      throws UnsupportedWindowStateFault, InvalidCookieFault, InvalidSessionFault, AccessDeniedFault,
+      InconsistentParametersFault, InvalidHandleFault, UnsupportedLocaleFault, UnsupportedModeFault,
+      OperationFailedFault, MissingParametersFault, InvalidUserCategoryFault, InvalidRegistrationFault,
+      UnsupportedMimeTypeFault, RemoteException
+   {
+      String handle = getMarkup.getPortletContext().getPortletHandle();
+      String markupString = null;
+      String sessionId = getMarkup.getRuntimeContext().getSessionID();
+
+      if (ServiceObjectFactory.PORTLET_HANDLE_1.equals(handle))
+      {
+         markupString = "portlet1:";
+      }
+      else
+      if (ServiceObjectFactory.PORTLET_HANDLE_2.equals(handle)) // markup for ServiceObjectFactory.PORTLET_HANDLE_2 simulates using the session
+      {
+         // if we have a session, increments count to simulate session usage
+         if (SESSION_ID.equals(sessionId))
+         {
+            count++;
+         }
+         markupString = "portlet2:" + count + ":";
+      }
+
+      MarkupParams markupParams = getMarkup.getMarkupParams();
+      markupString += WSRPUtils.getJSR168PortletModeFromWSRPName(markupParams.getMode()) + ":";
+      markupString += WSRPUtils.getJSR168WindowStateFromWSRPName(markupParams.getWindowState());
+      String ns = markupParams.getNavigationalState();
+      if (ns != null)
+      {
+         markupString += ":" + ns;
+      }
+
+      if (ServiceObjectFactory.NULL_MARKUP_PORTLET_HANDLE.equals(handle))
+      {
+         markupString = null;
+      }
+      else if (ServiceObjectFactory.EMPTY_MARKUP_PORTLET_HANDLE.equals(handle))
+      {
+         markupString = "";
+      }
+
+      MarkupContext markupContext = WSRPTypeFactory.createMarkupContext("text/html", markupString);
+      markupContext.setRequiresUrlRewriting(Boolean.TRUE);
+
+      // fake markup caching
+      if (ServiceObjectFactory.PORTLET_HANDLE_1.equals(handle))
+      {
+         markupContext.setCacheControl(WSRPTypeFactory.createCacheControl(15, WSRPConstants.CACHE_PER_USER));
+      }
+
+      MarkupResponse markupResponse = WSRPTypeFactory.createMarkupResponse(markupContext);
+
+      // fakes creation of a portlet session if not already present
+      if (count == 0 || SESSION_ID.equals(sessionId))
+      {
+         SessionContext sessionContext = WSRPTypeFactory.createSessionContext(SESSION_ID, 30);
+         markupResponse.setSessionContext(sessionContext);
+      }
+
+      return markupResponse;
+   }
+
+   public BlockingInteractionResponse performBlockingInteraction(PerformBlockingInteraction performBlockingInteraction)
+      throws InvalidSessionFault, UnsupportedModeFault, UnsupportedMimeTypeFault, OperationFailedFault,
+      UnsupportedWindowStateFault, UnsupportedLocaleFault, AccessDeniedFault, PortletStateChangeRequiredFault,
+      InvalidRegistrationFault, MissingParametersFault, InvalidUserCategoryFault, InconsistentParametersFault,
+      InvalidHandleFault, InvalidCookieFault, RemoteException
+   {
+      String handle = performBlockingInteraction.getPortletContext().getPortletHandle();
+      String ns = performBlockingInteraction.getMarkupParams().getNavigationalState();
+      if ("redirect".equals(ns))
+      {
+         return WSRPTypeFactory.createBlockingInteractionResponse("http://jboss.com");
+      }
+
+      if (ServiceObjectFactory.PORTLET_HANDLE_1.equals(handle))
+      {
+         ns = "ns1";
+      }
+      if (ServiceObjectFactory.PORTLET_HANDLE_2.equals(handle))
+      {
+         ns = "ns2";
+      }
+      UpdateResponse ur = WSRPTypeFactory.createUpdateResponse();
+      ur.setNavigationalState(ns);
+      BlockingInteractionResponse res = WSRPTypeFactory.createBlockingInteractionResponse(ur);
+
+      return res;
+   }
+
+   public ReturnAny releaseSessions(ReleaseSessions releaseSessions)
+      throws InvalidRegistrationFault, OperationFailedFault, MissingParametersFault, AccessDeniedFault, RemoteException
+   {
+      return null;
+   }
+
+   public ReturnAny initCookie(InitCookie initCookie)
+      throws AccessDeniedFault, OperationFailedFault, InvalidRegistrationFault, RemoteException
+   {
+      response.addCookie(new Cookie("cookieName", USER_COOKIE));
+      return null;
+   }
+
+   // Registration implementation **************************************************************************************
+
+   public RegistrationContext register(RegistrationData register) throws MissingParametersFault, OperationFailedFault, RemoteException
+   {
+      return null;
+   }
+
+   public ReturnAny deregister(RegistrationContext deregister) throws OperationFailedFault, InvalidRegistrationFault, RemoteException
+   {
+      return null;
+   }
+
+   public RegistrationState modifyRegistration(ModifyRegistration modifyRegistration) throws MissingParametersFault, OperationFailedFault, InvalidRegistrationFault, RemoteException
+   {
+      return null;
+   }
+
+   // PortletManagement implementation *********************************************************************************
+
+   public PortletDescriptionResponse getPortletDescription(GetPortletDescription getPortletDescription)
+      throws AccessDeniedFault, InvalidHandleFault, InvalidUserCategoryFault, InconsistentParametersFault,
+      MissingParametersFault, InvalidRegistrationFault, OperationFailedFault, RemoteException
+   {
+      return null;
+   }
+
+   public PortletContext clonePortlet(ClonePortlet clonePortlet) throws InvalidUserCategoryFault, AccessDeniedFault, OperationFailedFault, InvalidHandleFault, InvalidRegistrationFault, InconsistentParametersFault, MissingParametersFault, RemoteException
+   {
+      return null;
+   }
+
+   public DestroyPortletsResponse destroyPortlets(DestroyPortlets destroyPortlets) throws InconsistentParametersFault, MissingParametersFault, InvalidRegistrationFault, OperationFailedFault, RemoteException
+   {
+      return null;
+   }
+
+   public PortletContext setPortletProperties(SetPortletProperties setPortletProperties) throws OperationFailedFault, InvalidHandleFault, MissingParametersFault, InconsistentParametersFault, InvalidUserCategoryFault, AccessDeniedFault, InvalidRegistrationFault, RemoteException
+   {
+      return null;
+   }
+
+   public PropertyList getPortletProperties(GetPortletProperties getPortletProperties) throws InvalidHandleFault, MissingParametersFault, InvalidRegistrationFault, AccessDeniedFault, OperationFailedFault, InconsistentParametersFault, InvalidUserCategoryFault, RemoteException
+   {
+      return null;
+   }
+
+   public PortletPropertyDescriptionResponse getPortletPropertyDescription(GetPortletPropertyDescription getPortletPropertyDescription) throws MissingParametersFault, InconsistentParametersFault, InvalidUserCategoryFault, InvalidRegistrationFault, AccessDeniedFault, InvalidHandleFault, OperationFailedFault, RemoteException
+   {
+      return null;
+   }
+
+   // Producer implementation ******************************************************************************************
+
+   public void setRequiresRegistration(boolean requiresRegistration)
+   {
+      this.requiresRegistration = requiresRegistration;
+   }
+
+   public boolean isRequiresRegistration()
+   {
+      return requiresRegistration;
+   }
+
+   public CookieProtocol getRequiresInitCookie()
+   {
+      return requiresInitCookie;
+   }
+
+   public void setRequiresInitCookie(CookieProtocol requiresInitCookie)
+   {
+      this.requiresInitCookie = requiresInitCookie;
+      serviceDescription.setRequiresInitCookie(requiresInitCookie);
+   }
+
+   public int getSessionExpirationTime()
+   {
+      return sessionExpirationTime;
+   }
+
+   public void setSessionExpirationTime(int sessionExpirationTime)
+   {
+      this.sessionExpirationTime = sessionExpirationTime;
+   }
+
+   public PortletDescription getPortletDescription(String handle, String[] locales)
+   {
+      if (handle == null)
+      {
+         throw new IllegalArgumentException("Invalid handle");
+      }
+
+      PortletDescription[] offeredPortlets = serviceDescription.getOfferedPortlets();
+      if (ServiceObjectFactory.PORTLET_HANDLE_1.equals(handle))
+      {
+         return offeredPortlets[0];
+      }
+      if (ServiceObjectFactory.PORTLET_HANDLE_2.equals(handle))
+      {
+         return offeredPortlets[1];
+      }
+      return null;
+   }
+
+   public void addRegistrationProperty(PropertyDescription propertyDescription)
+   {
+      PropertyDescription[] descriptions = requiredRegistrationInfo.getPropertyDescriptions();
+      if (descriptions == null)
+      {
+         descriptions = new PropertyDescription[]{propertyDescription};
+         requiredRegistrationInfo.setPropertyDescriptions(descriptions);
+      }
+      else
+      {
+         PropertyDescription[] newDescs = new PropertyDescription[descriptions.length + 1];
+         System.arraycopy(descriptions, 0, newDescs, 0, descriptions.length);
+         newDescs[descriptions.length] = propertyDescription;
+         requiredRegistrationInfo.setPropertyDescriptions(newDescs);
+      }
+   }
+
+   public void clearRegistrationProperties()
+   {
+      requiredRegistrationInfo.setPropertyDescriptions(null);
+   }
+
+   // Contract with Invoker implementation *****************************************************************************
+
+   /** Dispatch the invocation to the target by reflection */
+   public Object invoke(Invocation invocation) throws Exception
+   {
+      Method method = invocation.getMethod();
+      Object[] args = invocation.getArguments();
+      return method.invoke(this, args);
+   }
+
+   // Protected methods ************************************************************************************************
+
+   /**
+    * Checks that the specified registration information is valid if this Producer requires registration.
+    *
+    * @param registrationContext
+    * @return
+    */
+   protected boolean isRegistrationValid(RegistrationContext registrationContext)
+   {
+      if (isRequiresRegistration())
+      {
+         // todo: implement more completely
+         if (registrationContext == null)
+         {
+            return false;
+         }
+      }
+      return true;
+   }
+
+   public boolean isSessionValid(String sessionId)
+   {
+      // todo: implement
+      return true;
+   }
+
+   /**
+    * Create a new OperationFailedFault based on the specified cause.
+    *
+    * @param cause the cause why the operation failed
+    * @return a new OperationFailedFault based on the specified cause.
+    */
+   protected OperationFailedFault createOperationFailedFault(Throwable cause)
+   {
+      return (OperationFailedFault)createFaultFrom(OperationFailedFault.class, cause);
+   }
+
+   protected Fault createFaultFrom(Class faultClass, Throwable cause)
+   {
+      Fault fault = null;
+      try
+      {
+         fault = (Fault)faultClass.newInstance();
+         fault.initCause(cause);
+      }
+      catch (Exception e)
+      {
+         // shouldn't happen
+         e.printStackTrace();
+      }
+      return fault;
+   }
+
+   protected void checkMissingValue(Object valueToCheck, String valueName, String context) throws MissingParametersFault
+   {
+      if (valueToCheck == null)
+      {
+         throw(MissingParametersFault)
+            createFaultFrom(MissingParametersFault.class, new NullPointerException("Missing required " + valueName
+               + (context != null ? " in " + context : "")));
+      }
+   }
+
+   /**
+    * Retrieves the service description offered to unregistered consumers when registration is required.
+    *
+    * @return the service description offered to unregistered consumers when registration is required
+    */
+   protected ServiceDescription getRegistrationNotProvidedServiceDescription()
+   {
+      return requiredRegistrationNotProvidedSD;
+   }
+
+}


Property changes on: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/TestWSRPProducerImpl.java
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Copied: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/BasicInstanceContext.java (from rev 5472, trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/BasicInstanceContext.java)
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/BasicInstanceContext.java	2006-10-17 00:12:37 UTC (rev 5472)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/BasicInstanceContext.java	2006-10-17 20:28:05 UTC (rev 5474)
@@ -0,0 +1,53 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat                                               *
+ * Copyright 2006, 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.jboss.portal.test.wsrp.framework.support;
+
+import org.jboss.portal.portlet.state.AccessMode;
+import org.jboss.portal.portlet.support.spi.InstanceContextSupport;
+
+/**
+ * @author <a href="mailto:chris.laprun at jboss.com?subject=org.jboss.portal.test.wsrp.framework.support.BasicInstanceContext">Chris
+ *         Laprun</a>
+ * @version $Revision$
+ * @since 2.4
+ */
+public class BasicInstanceContext extends InstanceContextSupport
+{
+   String id;
+
+   public BasicInstanceContext(String id)
+   {
+      this.id = id;
+   }
+
+   public String getId()
+   {
+      return id;
+   }
+
+   public AccessMode getAccessMode()
+   {
+      return AccessMode.READ_ONLY;
+   }
+}


Property changes on: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/BasicInstanceContext.java
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Copied: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/BasicSecurityContext.java (from rev 5472, trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/BasicSecurityContext.java)
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/BasicSecurityContext.java	2006-10-17 00:12:37 UTC (rev 5472)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/BasicSecurityContext.java	2006-10-17 20:28:05 UTC (rev 5474)
@@ -0,0 +1,45 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat                                               *
+ * Copyright 2006, 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.jboss.portal.test.wsrp.framework.support;
+
+import org.jboss.portal.portlet.support.spi.SecurityContextSupport;
+
+/**
+ * @author <a href="mailto:chris.laprun at jboss.com?subject=org.jboss.portal.test.wsrp.framework.support.BasicSecurityContext">Chris
+ *         Laprun</a>
+ * @version $Revision$
+ * @since 2.4
+ */
+public class BasicSecurityContext extends SecurityContextSupport
+{
+   public String getAuthType()
+   {
+      return null;
+   }
+
+   public boolean isSecure()
+   {
+      return false;
+   }
+}


Property changes on: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/BasicSecurityContext.java
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Copied: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/BasicUserContext.java (from rev 5472, trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/BasicUserContext.java)
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/BasicUserContext.java	2006-10-17 00:12:37 UTC (rev 5472)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/BasicUserContext.java	2006-10-17 20:28:05 UTC (rev 5474)
@@ -0,0 +1,55 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat                                               *
+ * Copyright 2006, 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.jboss.portal.test.wsrp.framework.support;
+
+import org.jboss.portal.portlet.support.spi.UserContextSupport;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.Locale;
+
+/**
+ * @author <a href="mailto:chris.laprun at jboss.com?subject=org.jboss.portal.test.wsrp.framework.support.BasicUserContext">Chris
+ *         Laprun</a>
+ * @version $Revision$
+ * @since 2.4
+ */
+public class BasicUserContext extends UserContextSupport
+{
+
+   public String getId()
+   {
+      return null;
+   }
+
+   public Locale getLocale()
+   {
+      return Locale.ENGLISH;
+   }
+
+   public List getLocales()
+   {
+      return Collections.singletonList(getLocale());
+   }
+}


Property changes on: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/BasicUserContext.java
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Copied: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/MockHttpServletRequest.java (from rev 5472, trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/MockHttpServletRequest.java)
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/MockHttpServletRequest.java	2006-10-17 00:12:37 UTC (rev 5472)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/MockHttpServletRequest.java	2006-10-17 20:28:05 UTC (rev 5474)
@@ -0,0 +1,95 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat                                               *
+ * Copyright 2006, 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.jboss.portal.test.wsrp.framework.support;
+
+import javax.servlet.http.HttpSession;
+import java.io.Serializable;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:chris.laprun at jboss.com?subject=org.jboss.portal.test.wsrp.framework.support.MockHttpServletRequest">Chris
+ *         Laprun</a>
+ * @version $Revision$
+ * @since 2.4
+ */
+public class MockHttpServletRequest implements InvocationHandler, Serializable
+{
+   private HttpSession session;
+
+   private Map attrs;
+
+   public MockHttpServletRequest(HttpSession session)
+   {
+      this.session = session;
+      this.attrs = new HashMap();
+   }
+
+   public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
+   {
+      String methodName = method.getName();
+      if ("getSession".equals(methodName))
+      {
+         return session;
+      }
+      if ("getHeader".equals(methodName))
+      {
+         if ("User-Agent".equals(args[0]))
+         {
+            return "Mock Client User Agent";
+         }
+         return null;
+      }
+      if ("toString".equals(methodName))
+      {
+         return "MockHttpServletResponse";
+      }
+      if ("getAttribute".equals(methodName))
+      {
+         return attrs.get(args[0]);
+      }
+      if ("setAttribute".equals(methodName))
+      {
+         String name = (String)args[0];
+         Object value = args[1];
+         if (value != null)
+         {
+            attrs.put(name, value);
+         }
+         else
+         {
+            attrs.remove(value);
+         }
+         return null;
+      }
+      if ("removeAttribute".equals(methodName))
+      {
+         String name = (String)args[0];
+         attrs.remove(name);
+      }
+      throw new UnsupportedOperationException("MockHttpServletRequest does not support: " + method);
+   }
+}


Property changes on: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/MockHttpServletRequest.java
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Copied: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/MockHttpServletResponse.java (from rev 5472, trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/MockHttpServletResponse.java)
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/MockHttpServletResponse.java	2006-10-17 00:12:37 UTC (rev 5472)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/MockHttpServletResponse.java	2006-10-17 20:28:05 UTC (rev 5474)
@@ -0,0 +1,63 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat                                               *
+ * Copyright 2006, 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.jboss.portal.test.wsrp.framework.support;
+
+import java.io.Serializable;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+
+/**
+ * @author <a href="mailto:chris.laprun at jboss.com?subject=org.jboss.portal.test.wsrp.framework.support.MockHttpServletResponse">Chris
+ *         Laprun</a>
+ * @version $Revision$
+ * @since 2.4
+ */
+public class MockHttpServletResponse implements InvocationHandler, Serializable
+{
+   Object cookie;
+
+   public MockHttpServletResponse()
+   {
+   }
+
+   public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
+   {
+      String methodName = method.getName();
+      if ("addCookie".equals(methodName))
+      {
+         cookie = args[0];
+         return null;
+      }
+      else if ("reset".equals(methodName))
+      {
+         cookie = null;
+         return null;
+      }
+      else if ("toString".equals(methodName))
+      {
+         return "MockHttpServletResponse";
+      }
+      throw new UnsupportedOperationException("MockHttpServletResponse does not support: " + method);
+   }
+}


Property changes on: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/MockHttpServletResponse.java
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Copied: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/MockHttpSession.java (from rev 5472, trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/MockHttpSession.java)
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/MockHttpSession.java	2006-10-17 00:12:37 UTC (rev 5472)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/MockHttpSession.java	2006-10-17 20:28:05 UTC (rev 5474)
@@ -0,0 +1,74 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat                                               *
+ * Copyright 2006, 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.jboss.portal.test.wsrp.framework.support;
+
+import org.jboss.portal.common.util.Tools;
+
+import java.io.Serializable;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:chris.laprun at jboss.com?subject=org.jboss.portal.test.wsrp.framework.support.MockHttpSession">Chris
+ *         Laprun</a>
+ * @version $Revision$
+ * @since 2.4
+ */
+public class MockHttpSession implements InvocationHandler, Serializable
+{
+   private final Map map = new HashMap();
+
+   public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
+   {
+      String methodName = method.getName();
+      if ("setAttribute".equals(methodName))
+      {
+         map.put(args[0], args[1]);
+         return null;
+      }
+      else if ("removeAttribute".equals(methodName))
+      {
+         map.remove(args[0]);
+         return null;
+      }
+      else if ("getAttribute".equals(methodName))
+      {
+         return map.get(args[0]);
+      }
+      else if ("getAttributeNames".equals(methodName))
+      {
+         return Tools.toEnumeration(map.keySet().iterator());
+      }
+      else if ("toString".equals(methodName))
+      {
+         return "MockHttpSession";
+      }
+      else
+      {
+         throw new UnsupportedOperationException("MockHttpSession does not support: " + method);
+      }
+   }
+}


Property changes on: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/MockHttpSession.java
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Copied: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/ServiceObjectFactory.java (from rev 5472, trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/SOF.java)
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/SOF.java	2006-10-17 00:12:37 UTC (rev 5472)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/ServiceObjectFactory.java	2006-10-17 20:28:05 UTC (rev 5474)
@@ -0,0 +1,64 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat                                               *
+ * Copyright 2006, 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.jboss.portal.test.wsrp.framework.support;
+
+import org.jboss.portal.wsrp.core.LocalizedString;
+
+/**
+ * Service Object Factory for testing
+ *
+ * @author <a href="mailto:boleslaw.dawidowicz at jboss.org">Boleslaw Dawidowicz</a>
+ * @version $Revision$
+ */
+public class ServiceObjectFactory
+{
+   public static final String SAMPLE_DESCRIPTION = "SampleDescription";
+
+   public static final String SAMPLE_SHORTTITLE = "SampleShortTitle";
+
+   public static final String SAMPLE_TITLE = "SampleTitle";
+
+   public static final String SAMPLE_DISPLAYNAME = "SampleDisplayName";
+   public static final String SAMPLE_KEYWORD = "keyword";
+   public static final String PORTLET_HANDLE_1 = "SamplePortletHandle";
+   public static final String PORTLET_HANDLE_2 = "SecondPortletHandle";
+   public static final String EMPTY_MARKUP_PORTLET_HANDLE = "empty";
+   public static final String NULL_MARKUP_PORTLET_HANDLE = "null";
+
+   /**
+    * Create the dummiest form of LocalizedString
+    *
+    * @param value
+    * @return
+    */
+   public static LocalizedString createLocalizedString(String value)
+   {
+      return new LocalizedString("en", null, value);
+   }
+
+   /** Produces String from LocalizedString */
+   public static String extractString(org.jboss.portal.common.util.LocalizedString ls)
+   {
+      return ls.getPreferredOrBestLocalizedMappingFor(new String[]{"en"}).getString();
+   }
+}


Property changes on: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/ServiceObjectFactory.java
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Copied: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/TestPortletInvocationContext.java (from rev 5472, trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/TestPortletInvocationContext.java)
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/TestPortletInvocationContext.java	2006-10-17 00:12:37 UTC (rev 5472)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/TestPortletInvocationContext.java	2006-10-17 20:28:05 UTC (rev 5474)
@@ -0,0 +1,166 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat                                               *
+ * Copyright 2006, 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.jboss.portal.test.wsrp.framework.support;
+
+import org.jboss.portal.Mode;
+import org.jboss.portal.WindowState;
+import org.jboss.portal.common.MediaType;
+import org.jboss.portal.portlet.Parameters;
+import org.jboss.portal.portlet.PortletURL;
+import org.jboss.portal.portlet.StateString;
+import org.jboss.portal.portlet.impl.spi.AbstractPortletInvocationContext;
+import org.jboss.portal.portlet.invocation.PortletInvocation;
+import org.jboss.portal.portlet.spi.ActionContext;
+import org.jboss.portal.portlet.spi.PortletInvocationContext;
+import org.jboss.portal.portlet.spi.RenderContext;
+import org.jboss.portal.server.impl.RequestAttributeResolver;
+import org.jboss.portal.server.util.HTTPStreamInfo;
+import org.jboss.portal.wsrp.WSRPConstants;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.reflect.Proxy;
+
+/**
+ * @author <a href="mailto:chris.laprun at jboss.com?subject=org.jboss.portal.test.wsrp.v1.consumer.TestInvocationContext">Chris
+ *         Laprun</a>
+ * @version $Revision: 5064 $
+ * @since 2.4
+ */
+public class TestPortletInvocationContext extends AbstractPortletInvocationContext
+   implements PortletInvocationContext, RenderContext, ActionContext
+{
+   private String ns;
+   private HttpServletRequest mockRequest;
+   private HttpServletResponse mockResponse;
+
+   public TestPortletInvocationContext()
+   {
+      ClassLoader classLoader = getClass().getClassLoader();
+      HttpSession session = (HttpSession)Proxy.newProxyInstance(classLoader, new Class[]{HttpSession.class},
+         new MockHttpSession());
+      mockRequest = (HttpServletRequest)Proxy.newProxyInstance(classLoader, new Class[]{HttpServletRequest.class},
+         new MockHttpServletRequest(session));
+      mockResponse = (HttpServletResponse)Proxy.newProxyInstance(classLoader, new Class[]{HttpServletResponse.class},
+         new MockHttpServletResponse());
+
+      addResolver(PortletInvocation.REQUEST_SCOPE, new RequestAttributeResolver(mockRequest));
+   }
+
+
+   public void setNs(String ns)
+   {
+      this.ns = ns;
+   }
+
+
+   public void setMockRequest(HttpServletRequest mockRequest)
+   {
+      this.mockRequest = mockRequest;
+   }
+
+   public void setMockResponse(HttpServletResponse mockResponse)
+   {
+      this.mockResponse = mockResponse;
+   }
+
+   public StateString getNavigationalState()
+   {
+      return StateString.createFrom(ns);
+   }
+
+   public Mode getMode()
+   {
+      return Mode.VIEW;
+   }
+
+   public WindowState getWindowState()
+   {
+      return WindowState.MAXIMIZED;
+   }
+
+   public HTTPStreamInfo getStreamInfo()
+   {
+      return new HTTPStreamInfo(MediaType.HTML, WSRPConstants.DEFAULT_CHARACTER_SET);
+   }
+
+   public HttpServletRequest getClientRequest()
+   {
+      return mockRequest;
+   }
+
+   public HttpServletResponse getClientResponse()
+   {
+      return mockResponse;
+   }
+
+   public String encodeURL(String url)
+   {
+      return null;
+   }
+
+   public String encodeURL(PortletURL portletURL, Boolean wantSecure, Boolean wantAuthenticated, boolean relative)
+   {
+      return null;
+   }
+
+   public String getCharacterEncoding()
+   {
+      return null;
+   }
+
+   public int getContentLength()
+   {
+      return 0;
+   }
+
+   public BufferedReader getReader() throws IOException
+   {
+      return null;
+   }
+
+   public InputStream getInputStream() throws IOException
+   {
+      return null;
+   }
+
+   public String getContentType()
+   {
+      return null;
+   }
+
+   public StateString getInteractionState()
+   {
+      return null;
+   }
+
+   public Parameters getForm()
+   {
+      return null;
+   }
+}


Property changes on: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/TestPortletInvocationContext.java
___________________________________________________________________
Name: svn:executable
   + *

Deleted: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/BasicInstanceContext.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/BasicInstanceContext.java	2006-10-17 17:02:25 UTC (rev 5473)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/BasicInstanceContext.java	2006-10-17 20:28:05 UTC (rev 5474)
@@ -1,53 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat                                               *
- * Copyright 2006, 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.jboss.portal.test.wsrp.v1.consumer;
-
-import org.jboss.portal.portlet.state.AccessMode;
-import org.jboss.portal.portlet.support.spi.InstanceContextSupport;
-
-/**
- * @author <a href="mailto:chris.laprun at jboss.com?subject=org.jboss.portal.test.wsrp.v1.consumer.BasicInstanceContext">Chris
- *         Laprun</a>
- * @version $Revision$
- * @since 2.4
- */
-class BasicInstanceContext extends InstanceContextSupport
-{
-   String id;
-
-   public BasicInstanceContext(String id)
-   {
-      this.id = id;
-   }
-
-   public String getId()
-   {
-      return id;
-   }
-
-   public AccessMode getAccessMode()
-   {
-      return AccessMode.READ_ONLY;
-   }
-}

Deleted: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/BasicSecurityContext.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/BasicSecurityContext.java	2006-10-17 17:02:25 UTC (rev 5473)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/BasicSecurityContext.java	2006-10-17 20:28:05 UTC (rev 5474)
@@ -1,45 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat                                               *
- * Copyright 2006, 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.jboss.portal.test.wsrp.v1.consumer;
-
-import org.jboss.portal.portlet.support.spi.SecurityContextSupport;
-
-/**
- * @author <a href="mailto:chris.laprun at jboss.com?subject=org.jboss.portal.test.wsrp.v1.consumer.BasicSecurityContext">Chris
- *         Laprun</a>
- * @version $Revision$
- * @since 2.4
- */
-class BasicSecurityContext extends SecurityContextSupport
-{
-   public String getAuthType()
-   {
-      return null;
-   }
-
-   public boolean isSecure()
-   {
-      return false;
-   }
-}

Deleted: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/BasicUserContext.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/BasicUserContext.java	2006-10-17 17:02:25 UTC (rev 5473)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/BasicUserContext.java	2006-10-17 20:28:05 UTC (rev 5474)
@@ -1,55 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat                                               *
- * Copyright 2006, 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.jboss.portal.test.wsrp.v1.consumer;
-
-import org.jboss.portal.portlet.support.spi.UserContextSupport;
-
-import java.util.Collections;
-import java.util.List;
-import java.util.Locale;
-
-/**
- * @author <a href="mailto:chris.laprun at jboss.com?subject=org.jboss.portal.test.wsrp.v1.consumer.BasicUserContext">Chris
- *         Laprun</a>
- * @version $Revision$
- * @since 2.4
- */
-class BasicUserContext extends UserContextSupport
-{
-
-   public String getId()
-   {
-      return null;
-   }
-
-   public Locale getLocale()
-   {
-      return Locale.ENGLISH;
-   }
-
-   public List getLocales()
-   {
-      return Collections.singletonList(getLocale());
-   }
-}

Modified: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/MarkupTestCase.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/MarkupTestCase.java	2006-10-17 17:02:25 UTC (rev 5473)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/MarkupTestCase.java	2006-10-17 20:28:05 UTC (rev 5474)
@@ -32,7 +32,12 @@
 import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
 import org.jboss.portal.portlet.invocation.response.RenderResponse;
 import org.jboss.portal.portlet.spi.WindowContext;
-import org.jboss.portal.test.wsrp.TestWSRPProducerImpl;
+import org.jboss.portal.test.wsrp.framework.TestWSRPProducerImpl;
+import org.jboss.portal.test.wsrp.framework.support.BasicInstanceContext;
+import org.jboss.portal.test.wsrp.framework.support.BasicSecurityContext;
+import org.jboss.portal.test.wsrp.framework.support.BasicUserContext;
+import org.jboss.portal.test.wsrp.framework.support.ServiceObjectFactory;
+import org.jboss.portal.test.wsrp.framework.support.TestPortletInvocationContext;
 import org.jboss.portal.wsrp.consumer.ProducerSessionInformation;
 import org.jboss.portal.wsrp.core.CookieProtocol;
 
@@ -53,13 +58,13 @@
 
    public void testEmptyAndNullRender() throws Exception
    {
-      RenderInvocation render = createRenderInvocation(SOF.NULL_MARKUP_PORTLET_HANDLE);
+      RenderInvocation render = createRenderInvocation(ServiceObjectFactory.NULL_MARKUP_PORTLET_HANDLE);
 
       PortletInvocationResponse response = consumer.invoke(render);
 
       assertTrue(response instanceof ErrorResponse);
 
-      render = createRenderInvocation(SOF.EMPTY_MARKUP_PORTLET_HANDLE);
+      render = createRenderInvocation(ServiceObjectFactory.EMPTY_MARKUP_PORTLET_HANDLE);
 
       response = consumer.invoke(render);
 
@@ -68,14 +73,14 @@
 
    public void testRender() throws Exception
    {
-      RenderInvocation render = createRenderInvocation(SOF.PORTLET_HANDLE_1);
+      RenderInvocation render = createRenderInvocation(ServiceObjectFactory.PORTLET_HANDLE_1);
 
       PortletInvocationResponse response = consumer.invoke(render);
 
       FragmentResponse result = checkRenderResult(response, "portlet1:view:maximized");
       assertEquals(15, result.getExpirationSecs());
 
-      render = createRenderInvocation(SOF.PORTLET_HANDLE_2);
+      render = createRenderInvocation(ServiceObjectFactory.PORTLET_HANDLE_2);
 
       response = consumer.invoke(render);
 
@@ -87,10 +92,10 @@
    {
       TestPortletInvocationContext ac = new TestPortletInvocationContext();
       ActionInvocation action = new ActionInvocation(ac);
-      action.setInstanceContext(new BasicInstanceContext(SOF.PORTLET_HANDLE_1));
+      action.setInstanceContext(new BasicInstanceContext(ServiceObjectFactory.PORTLET_HANDLE_1));
       action.setSecurityContext(new BasicSecurityContext());
       action.setUserContext(new BasicUserContext());
-      action.setAttribute(PortletInvocation.REQUEST_SCOPE, PortletInvocation.PORTLET_CONTEXT_ATTRIBUTE, new PortletContext(SOF.PORTLET_HANDLE_1));
+      action.setAttribute(PortletInvocation.REQUEST_SCOPE, PortletInvocation.PORTLET_CONTEXT_ATTRIBUTE, new PortletContext(ServiceObjectFactory.PORTLET_HANDLE_1));
 
       PortletInvocationResponse response = consumer.invoke(action);
       assertNotNull(response);
@@ -98,8 +103,8 @@
       RenderResponse render = (RenderResponse)response;
       assertEquals("ns1", render.getNavigationalState().getStringValue());
 
-      RenderInvocation renderInvocation = createRenderInvocation(SOF.PORTLET_HANDLE_1);
-      ((TestPortletInvocationContext)renderInvocation.getContext()).ns = "ns1";
+      RenderInvocation renderInvocation = createRenderInvocation(ServiceObjectFactory.PORTLET_HANDLE_1);
+      ((TestPortletInvocationContext)renderInvocation.getContext()).setNs("ns1");
 
       response = consumer.invoke(renderInvocation);
       checkRenderResult(response, "portlet1:view:maximized:ns1");
@@ -107,7 +112,7 @@
 
    public void testSessionHandling() throws Exception
    {
-      RenderInvocation render = createRenderInvocation(SOF.PORTLET_HANDLE_2);
+      RenderInvocation render = createRenderInvocation(ServiceObjectFactory.PORTLET_HANDLE_2);
 
       PortletInvocationResponse response = consumer.invoke(render);
 
@@ -115,7 +120,7 @@
 
       // checking session information
       ProducerSessionInformation sessionInfo = consumer.getProducerSessionInformationFrom(render);
-      String sessionId = sessionInfo.getSessionIdForPortlet(SOF.PORTLET_HANDLE_2);
+      String sessionId = sessionInfo.getSessionIdForPortlet(ServiceObjectFactory.PORTLET_HANDLE_2);
       assertNotNull(sessionId);
       assertEquals(TestWSRPProducerImpl.SESSION_ID, sessionId);
       assertNotNull(sessionInfo.getUserCookie());
@@ -129,10 +134,10 @@
    public void testInitCookie() throws Exception
    {
       // first test that we don't initialize cookies if we don't need it
-      RenderInvocation render = createRenderInvocation(SOF.PORTLET_HANDLE_1);
+      RenderInvocation render = createRenderInvocation(ServiceObjectFactory.PORTLET_HANDLE_1);
       TestPortletInvocationContext invocationContext = (TestPortletInvocationContext)render.getContext();
-      HttpSession session = invocationContext.mockRequest.getSession();
-      producer.setResponse(invocationContext.mockResponse);
+      HttpSession session = invocationContext.getClientRequest().getSession();
+      producer.setResponse(invocationContext.getClientResponse());
 
       consumer.invoke(render);
 
@@ -142,10 +147,10 @@
 
       // now require cookie initialization and check that everything went well
       producer.setRequiresInitCookie(CookieProtocol.perUser);
-      render = createRenderInvocation(SOF.PORTLET_HANDLE_1);
+      render = createRenderInvocation(ServiceObjectFactory.PORTLET_HANDLE_1);
       invocationContext = (TestPortletInvocationContext)render.getContext();
-      session = invocationContext.mockRequest.getSession();
-      producer.setResponse(invocationContext.mockResponse);
+      session = invocationContext.getClientRequest().getSession();
+      producer.setResponse(invocationContext.getClientResponse());
 
       consumer.invoke(render);
 

Deleted: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/MockHttpServletRequest.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/MockHttpServletRequest.java	2006-10-17 17:02:25 UTC (rev 5473)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/MockHttpServletRequest.java	2006-10-17 20:28:05 UTC (rev 5474)
@@ -1,95 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat                                               *
- * Copyright 2006, 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.jboss.portal.test.wsrp.v1.consumer;
-
-import javax.servlet.http.HttpSession;
-import java.io.Serializable;
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Method;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * @author <a href="mailto:chris.laprun at jboss.com?subject=org.jboss.portal.test.wsrp.v1.consumer.MockHttpServletRequest">Chris
- *         Laprun</a>
- * @version $Revision$
- * @since 2.4
- */
-class MockHttpServletRequest implements InvocationHandler, Serializable
-{
-   private HttpSession session;
-
-   private Map attrs;
-
-   public MockHttpServletRequest(HttpSession session)
-   {
-      this.session = session;
-      this.attrs = new HashMap();
-   }
-
-   public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
-   {
-      String methodName = method.getName();
-      if ("getSession".equals(methodName))
-      {
-         return session;
-      }
-      if ("getHeader".equals(methodName))
-      {
-         if ("User-Agent".equals(args[0]))
-         {
-            return "Mock Client User Agent";
-         }
-         return null;
-      }
-      if ("toString".equals(methodName))
-      {
-         return "MockHttpServletResponse";
-      }
-      if ("getAttribute".equals(methodName))
-      {
-         return attrs.get(args[0]);
-      }
-      if ("setAttribute".equals(methodName))
-      {
-         String name = (String)args[0];
-         Object value = args[1];
-         if (value != null)
-         {
-            attrs.put(name, value);
-         }
-         else
-         {
-            attrs.remove(value);
-         }
-         return null;
-      }
-      if ("removeAttribute".equals(methodName))
-      {
-         String name = (String)args[0];
-         attrs.remove(name);
-      }
-      throw new UnsupportedOperationException("MockHttpServletRequest does not support: " + method);
-   }
-}

Deleted: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/MockHttpServletResponse.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/MockHttpServletResponse.java	2006-10-17 17:02:25 UTC (rev 5473)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/MockHttpServletResponse.java	2006-10-17 20:28:05 UTC (rev 5474)
@@ -1,63 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat                                               *
- * Copyright 2006, 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.jboss.portal.test.wsrp.v1.consumer;
-
-import java.io.Serializable;
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Method;
-
-/**
- * @author <a href="mailto:chris.laprun at jboss.com?subject=org.jboss.portal.test.wsrp.v1.consumer.MockHttpServletResponse">Chris
- *         Laprun</a>
- * @version $Revision$
- * @since 2.4
- */
-class MockHttpServletResponse implements InvocationHandler, Serializable
-{
-   Object cookie;
-
-   public MockHttpServletResponse()
-   {
-   }
-
-   public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
-   {
-      String methodName = method.getName();
-      if ("addCookie".equals(methodName))
-      {
-         cookie = args[0];
-         return null;
-      }
-      else if ("reset".equals(methodName))
-      {
-         cookie = null;
-         return null;
-      }
-      else if ("toString".equals(methodName))
-      {
-         return "MockHttpServletResponse";
-      }
-      throw new UnsupportedOperationException("MockHttpServletResponse does not support: " + method);
-   }
-}

Deleted: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/MockHttpSession.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/MockHttpSession.java	2006-10-17 17:02:25 UTC (rev 5473)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/MockHttpSession.java	2006-10-17 20:28:05 UTC (rev 5474)
@@ -1,74 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat                                               *
- * Copyright 2006, 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.jboss.portal.test.wsrp.v1.consumer;
-
-import org.jboss.portal.common.util.Tools;
-
-import java.io.Serializable;
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Method;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * @author <a href="mailto:chris.laprun at jboss.com?subject=org.jboss.portal.test.wsrp.v1.consumer.MockHttpSession">Chris
- *         Laprun</a>
- * @version $Revision$
- * @since 2.4
- */
-class MockHttpSession implements InvocationHandler, Serializable
-{
-   private final Map map = new HashMap();
-
-   public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
-   {
-      String methodName = method.getName();
-      if ("setAttribute".equals(methodName))
-      {
-         map.put(args[0], args[1]);
-         return null;
-      }
-      else if ("removeAttribute".equals(methodName))
-      {
-         map.remove(args[0]);
-         return null;
-      }
-      else if ("getAttribute".equals(methodName))
-      {
-         return map.get(args[0]);
-      }
-      else if ("getAttributeNames".equals(methodName))
-      {
-         return Tools.toEnumeration(map.keySet().iterator());
-      }
-      else if ("toString".equals(methodName))
-      {
-         return "MockHttpSession";
-      }
-      else
-      {
-         throw new UnsupportedOperationException("MockHttpSession does not support: " + method);
-      }
-   }
-}

Deleted: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/SOF.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/SOF.java	2006-10-17 17:02:25 UTC (rev 5473)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/SOF.java	2006-10-17 20:28:05 UTC (rev 5474)
@@ -1,64 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat                                               *
- * Copyright 2006, 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.jboss.portal.test.wsrp.v1.consumer;
-
-import org.jboss.portal.wsrp.core.LocalizedString;
-
-/**
- * Service Object Factory for testing
- *
- * @author <a href="mailto:boleslaw.dawidowicz at jboss.org">Boleslaw Dawidowicz</a>
- * @version $Revision$
- */
-public class SOF
-{
-   public static final String SAMPLE_DESCRIPTION = "SampleDescription";
-
-   public static final String SAMPLE_SHORTTITLE = "SampleShortTitle";
-
-   public static final String SAMPLE_TITLE = "SampleTitle";
-
-   public static final String SAMPLE_DISPLAYNAME = "SampleDisplayName";
-   public static final String SAMPLE_KEYWORD = "keyword";
-   public static final String PORTLET_HANDLE_1 = "SamplePortletHandle";
-   public static final String PORTLET_HANDLE_2 = "SecondPortletHandle";
-   public static final String EMPTY_MARKUP_PORTLET_HANDLE = "empty";
-   public static final String NULL_MARKUP_PORTLET_HANDLE = "null";
-
-   /**
-    * Create the dummiest form of LocalizedString
-    *
-    * @param value
-    * @return
-    */
-   public static LocalizedString createLocalizedString(String value)
-   {
-      return new LocalizedString("en", null, value);
-   }
-
-   /** Produces String from LocalizedString */
-   public static String extractString(org.jboss.portal.common.util.LocalizedString ls)
-   {
-      return ls.getPreferredOrBestLocalizedMappingFor(new String[]{"en"}).getString();
-   }
-}

Modified: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/ServiceDescriptionTestCase.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/ServiceDescriptionTestCase.java	2006-10-17 17:02:25 UTC (rev 5473)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/ServiceDescriptionTestCase.java	2006-10-17 20:28:05 UTC (rev 5474)
@@ -24,6 +24,7 @@
 
 import org.jboss.portal.portlet.Portlet;
 import org.jboss.portal.portlet.PortletContext;
+import org.jboss.portal.test.wsrp.framework.support.ServiceObjectFactory;
 
 import java.util.Set;
 
@@ -52,17 +53,17 @@
       Portlet p1 = portletArray[0];
       Portlet p2 = portletArray[1];
 
-      assertTrue((p1.getContext().getId().equals(SOF.PORTLET_HANDLE_1) && p2.getContext().getId().equals(SOF.PORTLET_HANDLE_2)) ||
-         (p2.getContext().getId().equals(SOF.PORTLET_HANDLE_1) && p1.getContext().getId().equals(SOF.PORTLET_HANDLE_2)));
+      assertTrue((p1.getContext().getId().equals(ServiceObjectFactory.PORTLET_HANDLE_1) && p2.getContext().getId().equals(ServiceObjectFactory.PORTLET_HANDLE_2)) ||
+         (p2.getContext().getId().equals(ServiceObjectFactory.PORTLET_HANDLE_1) && p1.getContext().getId().equals(ServiceObjectFactory.PORTLET_HANDLE_2)));
    }
 
    public void testGetPortlet() throws Exception
    {
       //obtain one portlet
-      Portlet portlet = consumer.getPortlet(new PortletContext(SOF.PORTLET_HANDLE_1));
-      checkPortlet(portlet, "", SOF.PORTLET_HANDLE_1);
+      Portlet portlet = consumer.getPortlet(new PortletContext(ServiceObjectFactory.PORTLET_HANDLE_1));
+      checkPortlet(portlet, "", ServiceObjectFactory.PORTLET_HANDLE_1);
 
-      portlet = consumer.getPortlet(new PortletContext(SOF.PORTLET_HANDLE_2));
-      checkPortlet(portlet, "2", SOF.PORTLET_HANDLE_2);
+      portlet = consumer.getPortlet(new PortletContext(ServiceObjectFactory.PORTLET_HANDLE_2));
+      checkPortlet(portlet, "2", ServiceObjectFactory.PORTLET_HANDLE_2);
    }
 }

Deleted: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/TestPortletInvocationContext.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/TestPortletInvocationContext.java	2006-10-17 17:02:25 UTC (rev 5473)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/TestPortletInvocationContext.java	2006-10-17 20:28:05 UTC (rev 5474)
@@ -1,148 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat                                               *
- * Copyright 2006, 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.jboss.portal.test.wsrp.v1.consumer;
-
-import org.jboss.portal.Mode;
-import org.jboss.portal.WindowState;
-import org.jboss.portal.common.MediaType;
-import org.jboss.portal.portlet.Parameters;
-import org.jboss.portal.portlet.PortletURL;
-import org.jboss.portal.portlet.StateString;
-import org.jboss.portal.portlet.impl.spi.AbstractPortletInvocationContext;
-import org.jboss.portal.portlet.invocation.PortletInvocation;
-import org.jboss.portal.portlet.spi.ActionContext;
-import org.jboss.portal.portlet.spi.PortletInvocationContext;
-import org.jboss.portal.portlet.spi.RenderContext;
-import org.jboss.portal.server.impl.RequestAttributeResolver;
-import org.jboss.portal.server.util.HTTPStreamInfo;
-import org.jboss.portal.wsrp.WSRPConstants;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpSession;
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.lang.reflect.Proxy;
-
-/**
- * @author <a href="mailto:chris.laprun at jboss.com?subject=org.jboss.portal.test.wsrp.v1.consumer.TestInvocationContext">Chris
- *         Laprun</a>
- * @version $Revision: 5064 $
- * @since 2.4
- */
-class TestPortletInvocationContext extends AbstractPortletInvocationContext implements PortletInvocationContext, RenderContext, ActionContext
-{
-   String ns;
-   HttpServletRequest mockRequest;
-   HttpServletResponse mockResponse;
-
-   public TestPortletInvocationContext()
-   {
-      ClassLoader classLoader = getClass().getClassLoader();
-      HttpSession session = (HttpSession)Proxy.newProxyInstance(classLoader, new Class[]{HttpSession.class},
-         new MockHttpSession());
-      mockRequest = (HttpServletRequest)Proxy.newProxyInstance(classLoader, new Class[]{HttpServletRequest.class},
-         new MockHttpServletRequest(session));
-      mockResponse = (HttpServletResponse)Proxy.newProxyInstance(classLoader, new Class[]{HttpServletResponse.class},
-         new MockHttpServletResponse());
-
-      addResolver(PortletInvocation.REQUEST_SCOPE, new RequestAttributeResolver(mockRequest));
-   }
-
-   public StateString getNavigationalState()
-   {
-      return StateString.createFrom(ns);
-   }
-
-   public Mode getMode()
-   {
-      return Mode.VIEW;
-   }
-
-   public WindowState getWindowState()
-   {
-      return WindowState.MAXIMIZED;
-   }
-
-   public HTTPStreamInfo getStreamInfo()
-   {
-      return new HTTPStreamInfo(MediaType.HTML, WSRPConstants.DEFAULT_CHARACTER_SET);
-   }
-
-   public HttpServletRequest getClientRequest()
-   {
-      return mockRequest;
-   }
-
-   public HttpServletResponse getClientResponse()
-   {
-      return mockResponse;
-   }
-
-   public String encodeURL(String url)
-   {
-      return null;
-   }
-
-   public String encodeURL(PortletURL portletURL, Boolean wantSecure, Boolean wantAuthenticated, boolean relative)
-   {
-      return null;
-   }
-
-   public String getCharacterEncoding()
-   {
-      return null;
-   }
-
-   public int getContentLength()
-   {
-      return 0;
-   }
-
-   public BufferedReader getReader() throws IOException
-   {
-      return null;
-   }
-
-   public InputStream getInputStream() throws IOException
-   {
-      return null;
-   }
-
-   public String getContentType()
-   {
-      return null;
-   }
-
-   public StateString getInteractionState()
-   {
-      return null;
-   }
-
-   public Parameters getForm()
-   {
-      return null;
-   }
-}

Modified: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/V1ConsumerBaseTest.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/V1ConsumerBaseTest.java	2006-10-17 17:02:25 UTC (rev 5473)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/V1ConsumerBaseTest.java	2006-10-17 20:28:05 UTC (rev 5474)
@@ -25,6 +25,7 @@
 import org.jboss.portal.portlet.Portlet;
 import org.jboss.portal.portlet.info.MetaInfo;
 import org.jboss.portal.test.wsrp.WSRPConsumerBaseTest;
+import org.jboss.portal.test.wsrp.framework.support.ServiceObjectFactory;
 
 /**
  * @author <a href="mailto:boleslaw.dawidowicz at jboss.org">Boleslaw Dawidowicz</a>
@@ -40,11 +41,11 @@
    {
       MetaInfo meta = portlet.getInfo().getMeta();
       assertEquals(handle, portlet.getContext().getId());
-      assertEquals(SOF.SAMPLE_DESCRIPTION + suffix, SOF.extractString(meta.getMetaValue(MetaInfo.DESCRIPTION)));
-      assertEquals(SOF.SAMPLE_TITLE + suffix, SOF.extractString(meta.getMetaValue(MetaInfo.TITLE)));
-      assertEquals(SOF.SAMPLE_SHORTTITLE + suffix, SOF.extractString(meta.getMetaValue(MetaInfo.SHORT_TITLE)));
-      assertEquals(SOF.SAMPLE_DISPLAYNAME + suffix, SOF.extractString(meta.getMetaValue(MetaInfo.DISPLAY_NAME)));
-      assertEquals(SOF.SAMPLE_KEYWORD + suffix, SOF.extractString(meta.getMetaValue(MetaInfo.KEYWORDS)));
+      assertEquals(ServiceObjectFactory.SAMPLE_DESCRIPTION + suffix, ServiceObjectFactory.extractString(meta.getMetaValue(MetaInfo.DESCRIPTION)));
+      assertEquals(ServiceObjectFactory.SAMPLE_TITLE + suffix, ServiceObjectFactory.extractString(meta.getMetaValue(MetaInfo.TITLE)));
+      assertEquals(ServiceObjectFactory.SAMPLE_SHORTTITLE + suffix, ServiceObjectFactory.extractString(meta.getMetaValue(MetaInfo.SHORT_TITLE)));
+      assertEquals(ServiceObjectFactory.SAMPLE_DISPLAYNAME + suffix, ServiceObjectFactory.extractString(meta.getMetaValue(MetaInfo.DISPLAY_NAME)));
+      assertEquals(ServiceObjectFactory.SAMPLE_KEYWORD + suffix, ServiceObjectFactory.extractString(meta.getMetaValue(MetaInfo.KEYWORDS)));
    }
 
    protected void tearDown() throws Exception

Modified: trunk/wsrp/src/resources/tests/test-wsrp-consumer-jar/org/jboss/portal/test/wsrp/jboss-beans.xml
===================================================================
--- trunk/wsrp/src/resources/tests/test-wsrp-consumer-jar/org/jboss/portal/test/wsrp/jboss-beans.xml	2006-10-17 17:02:25 UTC (rev 5473)
+++ trunk/wsrp/src/resources/tests/test-wsrp-consumer-jar/org/jboss/portal/test/wsrp/jboss-beans.xml	2006-10-17 20:28:05 UTC (rev 5474)
@@ -64,7 +64,7 @@
       <constructor>
          <parameter><inject bean="Node"/></parameter>
          <parameter>portal.wsrp:service=WSRPProducer</parameter>
-         <parameter>org.jboss.portal.test.wsrp.TestWSRPProducer</parameter>
+         <parameter>org.jboss.portal.test.wsrp.framework.TestWSRPProducer</parameter>
       </constructor>
    </bean>
 

Modified: trunk/wsrp/src/resources/tests/test-wsrp-consumer-sar/META-INF/jboss-service.xml
===================================================================
--- trunk/wsrp/src/resources/tests/test-wsrp-consumer-sar/META-INF/jboss-service.xml	2006-10-17 17:02:25 UTC (rev 5473)
+++ trunk/wsrp/src/resources/tests/test-wsrp-consumer-sar/META-INF/jboss-service.xml	2006-10-17 20:28:05 UTC (rev 5474)
@@ -26,7 +26,7 @@
 
    <!-- Dummy test WSRP Producer implementation -->
    <mbean
-      code="org.jboss.portal.test.wsrp.TestWSRPProducerImpl"
+      code="org.jboss.portal.test.wsrp.framework.TestWSRPProducerImpl"
       name="portal.wsrp:service=WSRPProducer"
       xmbean-dd=""
       xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">




More information about the jboss-svn-commits mailing list