Author: mwringe
Date: 2010-08-13 10:41:57 -0400 (Fri, 13 Aug 2010)
New Revision: 3827
Modified:
components/pc/trunk/api/src/main/java/org/gatein/pc/api/PortletInvoker.java
components/pc/trunk/federation/src/main/java/org/gatein/pc/federation/impl/FederatedPortletInvokerService.java
components/pc/trunk/federation/src/main/java/org/gatein/pc/federation/impl/FederatingPortletInvokerService.java
components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/PortletInvokerInterceptor.java
components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/state/consumer/ConsumerPortletInvoker.java
components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/state/producer/ProducerPortletInvoker.java
components/pc/trunk/portlet/src/test/java/org/gatein/pc/portlet/support/PortletInvokerSupport.java
components/pc/trunk/portlet/src/test/java/org/gatein/pc/test/portlet/state/AbstractStatefulPortletInvokerTestCase.java
components/pc/trunk/portlet/src/test/java/org/gatein/pc/test/portlet/state/ConsumerStatefulPortletInvokerTestCase.java
components/pc/trunk/portlet/src/test/java/org/gatein/pc/test/portlet/state/ProducerStatefulPortletInvokerTestCase.java
Log:
GTNPC-26: patch to add support for import/export. Test cases included.
Modified: components/pc/trunk/api/src/main/java/org/gatein/pc/api/PortletInvoker.java
===================================================================
--- components/pc/trunk/api/src/main/java/org/gatein/pc/api/PortletInvoker.java 2010-08-13
13:24:00 UTC (rev 3826)
+++ components/pc/trunk/api/src/main/java/org/gatein/pc/api/PortletInvoker.java 2010-08-13
14:41:57 UTC (rev 3827)
@@ -71,7 +71,7 @@
/**
* Clone a portlet.
*
- * @param stateType the portle state type desired
+ * @param stateType the portlet state type desired
* @param portletContext the portlet context to clone @return the clone id
* @return the cloned portlet context
* @throws IllegalArgumentException if the portletId is null
@@ -125,4 +125,26 @@
* @throws PortletInvokerException a portlet invoker exception
*/
PortletContext setProperties(PortletContext portletContext, PropertyChange[] changes)
throws IllegalArgumentException, PortletInvokerException, UnsupportedOperationException;
+
+ /**
+ * Exports a portlet from the invoker which can be used to recreate this portlet
during an import portlet operation
+ * The returned portlet Id will be the portlet Id of the base portlet, not a cloned
portlet Id
+ * If the portlet contains state, it will be returned regardless if the portlet
invoker is set to persist state locally.
+ *
+ * @param stateType the portlet state type desired
+ * @param originalPortletContext the context of the porlet to be exported
+ * @return A new portlet context which can be used to import a portlet
+ * @throws PortletInvokerException
+ */
+ PortletContext exportPortlet(PortletStateType stateType, PortletContext
originalPortletContext) throws PortletInvokerException;
+
+ /**
+ * Imports a portlet into the invoker.
+ *
+ * @param stateType the portlet state type desired
+ * @param contextToImport the context to be imported
+ * @return The portletcontext for the imported portlet
+ * @throws PortletInvokerException
+ */
+ PortletContext importPortlet(PortletStateType stateType, PortletContext
contextToImport) throws PortletInvokerException;
}
Modified:
components/pc/trunk/federation/src/main/java/org/gatein/pc/federation/impl/FederatedPortletInvokerService.java
===================================================================
---
components/pc/trunk/federation/src/main/java/org/gatein/pc/federation/impl/FederatedPortletInvokerService.java 2010-08-13
13:24:00 UTC (rev 3826)
+++
components/pc/trunk/federation/src/main/java/org/gatein/pc/federation/impl/FederatedPortletInvokerService.java 2010-08-13
14:41:57 UTC (rev 3827)
@@ -219,6 +219,21 @@
}
+ public PortletContext exportPortlet(PortletStateType stateType, PortletContext
compoundPortletContext)
+ throws PortletInvokerException
+ {
+ PortletContext portletContext = dereference(compoundPortletContext);
+ portletContext = portletInvoker.exportPortlet(stateType, portletContext);
+ return reference(portletContext);
+ }
+
+ public PortletContext importPortlet(PortletStateType stateType, PortletContext
compoundPortletContext) throws PortletInvokerException
+ {
+ PortletContext portletContext = dereference(compoundPortletContext);
+ portletContext = portletInvoker.exportPortlet(stateType, portletContext);
+ return reference(portletContext);
+ }
+
private PortletContext dereference(PortletContext compoundPortletContext)
{
String portletId = compoundPortletContext.getId().substring(id.length() + 1);
Modified:
components/pc/trunk/federation/src/main/java/org/gatein/pc/federation/impl/FederatingPortletInvokerService.java
===================================================================
---
components/pc/trunk/federation/src/main/java/org/gatein/pc/federation/impl/FederatingPortletInvokerService.java 2010-08-13
13:24:00 UTC (rev 3826)
+++
components/pc/trunk/federation/src/main/java/org/gatein/pc/federation/impl/FederatingPortletInvokerService.java 2010-08-13
14:41:57 UTC (rev 3827)
@@ -231,6 +231,20 @@
return federated.setProperties(compoundPortletContext, changes);
}
+ public PortletContext exportPortlet(PortletStateType stateType, PortletContext
compoundPortletContext)
+ throws PortletInvokerException
+ {
+ PortletInvoker federated = getFederatedPortletInvokerFor(compoundPortletContext);
+ return federated.exportPortlet(stateType, compoundPortletContext);
+ }
+
+ public PortletContext importPortlet(PortletStateType stateType, PortletContext
compoundPortletContext)
+ throws PortletInvokerException
+ {
+ PortletInvoker federated = getFederatedPortletInvokerFor(compoundPortletContext);
+ return federated.importPortlet(stateType, compoundPortletContext);
+ }
+
public synchronized void setNullInvokerHandler(NullInvokerHandler nullHandler)
{
if (nullHandler == null)
Modified:
components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/PortletInvokerInterceptor.java
===================================================================
---
components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/PortletInvokerInterceptor.java 2010-08-13
13:24:00 UTC (rev 3826)
+++
components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/PortletInvokerInterceptor.java 2010-08-13
14:41:57 UTC (rev 3827)
@@ -32,7 +32,9 @@
import org.gatein.pc.api.PortletInvokerException;
import org.gatein.pc.api.PortletInvoker;
import org.gatein.pc.api.PortletStateType;
+import org.gatein.pc.portlet.state.StateConversionException;
+import java.io.Serializable;
import java.util.Set;
import java.util.List;
import java.util.concurrent.atomic.AtomicReference;
@@ -131,4 +133,16 @@
//
return next;
}
+
+ public PortletContext exportPortlet(PortletStateType stateType, PortletContext
originalPortletContext)
+ throws PortletInvokerException, IllegalArgumentException
+ {
+ return safeGetNext().exportPortlet(stateType, originalPortletContext);
+ }
+
+ public PortletContext importPortlet(PortletStateType stateType, PortletContext
originalPortletContext)
+ throws PortletInvokerException, IllegalArgumentException
+ {
+ return safeGetNext().importPortlet(stateType, originalPortletContext);
+ }
}
Modified:
components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/state/consumer/ConsumerPortletInvoker.java
===================================================================
---
components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/state/consumer/ConsumerPortletInvoker.java 2010-08-13
13:24:00 UTC (rev 3826)
+++
components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/state/consumer/ConsumerPortletInvoker.java 2010-08-13
14:41:57 UTC (rev 3827)
@@ -225,6 +225,36 @@
}
}
+ public PortletContext importPortlet(PortletStateType stateType,
+ PortletContext portletContext) throws PortletInvokerException,
IllegalArgumentException
+ {
+ ConsumerContext consumerContext = getConsumerContext(portletContext);
+
+ PortletContext importContext = super.importPortlet(stateType,
consumerContext.producerPortletContext);
+
+ if (importContext instanceof StatefulPortletContext)
+ {
+ StatefulPortletContext statefulimportContext =
(StatefulPortletContext)importContext;
+ ConsumerState consumerState = new
ConsumerState<Serializable>(importContext.getId(), statefulimportContext.getType(),
statefulimportContext.getState());
+ String id = persistenceManager.createState(consumerState);
+ return PortletContext.createPortletContext(CLONE_ID_PREFIX + id);
+ }
+ else
+ {
+ return importContext;
+ }
+
+ }
+
+ public PortletContext exportPortlet(PortletStateType stateType,
+ PortletContext portletContext) throws PortletInvokerException,
IllegalArgumentException
+ {
+ ConsumerContext consumerContext = getConsumerContext(portletContext);
+
+ //
+ return super.exportPortlet(stateType, consumerContext.producerPortletContext);
+ }
+
public List<DestroyCloneFailure> destroyClones(List<PortletContext>
portletContexts) throws IllegalArgumentException, PortletInvokerException,
UnsupportedOperationException
{
if (portletContexts == null)
Modified:
components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/state/producer/ProducerPortletInvoker.java
===================================================================
---
components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/state/producer/ProducerPortletInvoker.java 2010-08-13
13:24:00 UTC (rev 3826)
+++
components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/state/producer/ProducerPortletInvoker.java 2010-08-13
14:41:57 UTC (rev 3827)
@@ -630,6 +630,104 @@
}
}
+ public PortletContext exportPortlet(PortletStateType stateType, PortletContext
originalPortletContext) throws PortletInvokerException, IllegalArgumentException
+ {
+ if (originalPortletContext == null)
+ {
+ throw new IllegalArgumentException("No null portlet context
accepted");
+ }
+
+ //
+ InternalContext context = getStateContext(originalPortletContext);
+ String portletId = context.getPortletId();
+
+ //
+ boolean persistLocally = stateManagementPolicy.persistLocally();
+
+ //
+ if (context.isStateful())
+ {
+ StatefulContext statefulContext = (StatefulContext)context;
+ try
+ {
+ PortletState sstate = new PortletState(portletId,
statefulContext.getProperties());
+ Serializable marshalledState = stateConverter.marshall(stateType, sstate);
+ return StatefulPortletContext.create(portletId, stateType, marshalledState);
+ }
+ catch (StateConversionException e)
+ {
+ throw new PortletInvokerException(e);
+ }
+ }
+ else
+ {
+ if (persistLocally)
+ {
+ PropertyMap newState = new SimplePropertyMap();
+ getPropertiesFromMetaData(originalPortletContext, newState);
+ try
+ {
+ PortletState sstate = new PortletState(portletId, newState);
+ Serializable marshalledState = stateConverter.marshall(stateType,
sstate);
+ return StatefulPortletContext.create(portletId, stateType,
marshalledState);
+ }
+ catch (StateConversionException e)
+ {
+ throw new PortletInvokerException(e);
+ }
+ }
+ else
+ {
+ // if we don't have a state associated with this portlet context and we
don't persistLocally then there is nothing to
+ // store here and we need to just return the value we were given.
+ //return context.getPortletContext();
+ return
getPortlet(originalPortletContext).getContext();//originalPortletContext;
+ }
+ }
+ }
+
+ public PortletContext importPortlet(PortletStateType stateType, PortletContext
contextToImport) throws PortletInvokerException
+ {
+ if (contextToImport == null)
+ {
+ throw new IllegalArgumentException("No null portlet id accepted");
+ }
+
+ try
+ {
+ if (contextToImport instanceof StatefulPortletContext)
+ {
+ StatefulPortletContext statefulPortletContext = (StatefulPortletContext)
contextToImport;
+ Boolean persistLocally = stateManagementPolicy.persistLocally();
+
+ PortletState portletState = getStateConverter().unmarshall(stateType,
statefulPortletContext.getState());
+ //
+ if (persistLocally)
+ {
+ // Create the new state
+
+ String cloneStateId =
persistenceManager.createState(statefulPortletContext.getId(),
portletState.getProperties());
+
+ // Return the clone context
+ String cloneId = PRODUCER_CLONE_ID_PREFIX + cloneStateId;
+ return PortletContext.createPortletContext(cloneId);
+ }
+ else
+ {
+ return marshall(statefulPortletContext.getType(),
statefulPortletContext.getId(), portletState.getProperties());
+ }
+ }
+ else
+ {
+ return getPortlet(contextToImport).getContext();
+ }
+ }
+ catch (StateConversionException e)
+ {
+ throw new PortletInvokerException(e);
+ }
+ }
+
private <S extends Serializable> PortletContext
marshall(PortletStateType<S> stateType, String portletId, PropertyMap props) throws
PortletInvokerException
{
try
Modified:
components/pc/trunk/portlet/src/test/java/org/gatein/pc/portlet/support/PortletInvokerSupport.java
===================================================================
---
components/pc/trunk/portlet/src/test/java/org/gatein/pc/portlet/support/PortletInvokerSupport.java 2010-08-13
13:24:00 UTC (rev 3826)
+++
components/pc/trunk/portlet/src/test/java/org/gatein/pc/portlet/support/PortletInvokerSupport.java 2010-08-13
14:41:57 UTC (rev 3827)
@@ -212,4 +212,16 @@
{
throw new UnsupportedOperationException();
}
+
+ public PortletContext exportPortlet(PortletStateType stateType,
+ PortletContext originalPortletContext) throws PortletInvokerException,
IllegalArgumentException
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public PortletContext importPortlet(PortletStateType stateType,
+ PortletContext originalPortletContext) throws PortletInvokerException,
IllegalArgumentException
+ {
+ throw new UnsupportedOperationException();
+ }
}
Modified:
components/pc/trunk/portlet/src/test/java/org/gatein/pc/test/portlet/state/AbstractStatefulPortletInvokerTestCase.java
===================================================================
---
components/pc/trunk/portlet/src/test/java/org/gatein/pc/test/portlet/state/AbstractStatefulPortletInvokerTestCase.java 2010-08-13
13:24:00 UTC (rev 3826)
+++
components/pc/trunk/portlet/src/test/java/org/gatein/pc/test/portlet/state/AbstractStatefulPortletInvokerTestCase.java 2010-08-13
14:41:57 UTC (rev 3827)
@@ -29,8 +29,10 @@
import org.gatein.pc.api.Portlet;
import org.gatein.pc.api.PortletContext;
import org.gatein.pc.api.PortletInvokerException;
+import org.gatein.pc.api.PortletStateType;
import org.gatein.pc.api.StatefulPortletContext;
import org.gatein.pc.api.state.PropertyMap;
+import org.gatein.pc.portlet.impl.state.StateConverterV0;
import org.gatein.pc.portlet.support.info.PortletInfoSupport;
import org.gatein.pc.portlet.support.PortletSupport;
import org.gatein.pc.api.info.MetaInfo;
@@ -38,11 +40,13 @@
import org.gatein.pc.api.invocation.PortletInvocation;
import org.gatein.pc.api.invocation.response.PortletInvocationResponse;
import org.gatein.pc.portlet.state.AbstractPropertyContext;
+import org.gatein.pc.portlet.state.StateConverter;
import org.gatein.pc.api.state.AccessMode;
import org.gatein.pc.api.state.DestroyCloneFailure;
import org.gatein.pc.api.state.PropertyChange;
import org.gatein.pc.api.state.PropertyContext;
import org.gatein.pc.portlet.state.SimplePropertyMap;
+import org.gatein.pc.portlet.state.producer.PortletState;
import static org.jboss.unit.api.Assert.*;
import org.jboss.unit.api.pojo.annotations.Test;
@@ -168,6 +172,17 @@
*
*/
protected abstract void addPreference(PortletContext popRef, String key,
List<String> defaultValue, Boolean readOnly);
+
+ /**
+ *
+ */
+ protected abstract PortletContext exportPortletContext(PortletContext contextToImport)
throws PortletInvokerException;
+
+ /**
+ *
+ */
+ protected abstract PortletContext importPortletContext(PortletContext contextToImport)
throws PortletInvokerException;
+
/**
*
@@ -958,4 +973,240 @@
}
}
}
+
+ @Test
+ public void testExportNullPortletContext() throws Exception
+ {
+ try
+ {
+ exportPortletContext(null);
+ fail("Was expecting an illegal arguement exception.");
+ }
+ catch (IllegalArgumentException e)
+ {
+ //expected
+ }
+ assertNoExistingState();
+ }
+
+ @Test
+ public void testExportsNonExisitngPOP() throws Exception
+ {
+ PortletContext popCTX = createNonExistingPOPRef();
+ try
+ {
+ exportPortletContext(popCTX);
+ fail("Was expecting a NoSuchPortletException.");
+ }
+ catch (NoSuchPortletException e)
+ {
+ //expected
+ }
+ assertNoExistingState();
+ }
+
+ @Test
+ public void testExportNonExisitngCCP() throws Exception
+ {
+ PortletContext ccpCTX = createNonExistingLocalCCPRef();
+ try
+ {
+ exportPortletContext(ccpCTX);
+ fail("Was expecting a NoSuchPortletException.");
+ }
+ catch (NoSuchPortletException e)
+ {
+ //expected
+ }
+ assertNoExistingState();
+ }
+
+ @Test
+ public void testExportInvalidPOP() throws Exception
+ {
+ PortletContext popCtx = createInvalidPOPRef();
+ try
+ {
+ exportPortletContext(popCtx);
+ fail("was expecting an InvalidPortletIdException");
+ }
+ catch (InvalidPortletIdException expected)
+ {
+ }
+ assertNoExistingState();
+ }
+
+ @Test
+ public void testExportPortlet() throws Exception
+ {
+ PropertyMap expectedProperties = new SimplePropertyMap();
+ expectedProperties.setProperty("abc", Arrays.asList("def"));
+
+ PortletInfoSupport info = new PortletInfoSupport();
+ info.getMeta().setDisplayName("MyPortlet");
+ PortletContext popCtx = createPOPRef(info);
+
+ PortletContext export0Ctx = exportPortletContext(popCtx);
+
+ //Make sure we get back the ID for the original portlet
+ assertEquals("PortletId", export0Ctx.getId());
+ //check by doing an import
+ checkWithImportPortlet(export0Ctx, popCtx, new SimplePropertyMap());
+
+
+ //add a preference to the portlet to make it store a state
+ addPreference(popCtx, "abc", Arrays.asList("def"));
+ PortletContext export1Ctx = exportPortletContext(popCtx);
+
+ //Make sure we get back the ID for the original portlet
+ assertEquals("PortletId", export1Ctx.getId());
+ //check by doing an import
+ checkWithImportPortlet(export1Ctx, popCtx, expectedProperties);
+
+ PortletContext ccp1Ctx = createClone(popCtx);
+ PortletContext export2Ctx = exportPortletContext(ccp1Ctx);
+
+ //Make sure we get back the ID for the original portlet
+ assertEquals("PortletId", export2Ctx.getId());
+ //Check by doing an import
+ checkWithImportPortlet(export2Ctx, ccp1Ctx, expectedProperties);
+
+ PortletContext ccp2Ctx = createClone(ccp1Ctx);
+ //make sure that adding a property to the already cloned ccp1Ctx doesn't
interfere with exports
+ PropertyChange[] propertyChanges = new PropertyChange[1];
+ propertyChanges[0] = PropertyChange.newUpdate("123",
Arrays.asList("456"));
+ ccp1Ctx = setProperties(ccp1Ctx, propertyChanges);
+ assertTrue(getProperties(ccp1Ctx).containsKey("123"));
+ assertFalse(getProperties(export2Ctx).containsKey("123"));
+
+ PortletContext export3Ctx = exportPortletContext(ccp2Ctx);
+
+ //Make sure we get back the ID for the original portlet
+ assertEquals("PortletId", export3Ctx.getId());
+ //Check by doing an import
+ checkWithImportPortlet(export3Ctx, ccp2Ctx, expectedProperties);
+ }
+
+ protected void checkWithImportPortlet(PortletContext exportedPortletContext,
PortletContext originalPortletContext, PropertyMap expectedProperties) throws Exception
+ {
+ PortletContext importedPortletContext =
importPortletContext(exportedPortletContext);
+
+ Portlet importedPortlet = getPortlet(importedPortletContext);
+
+ PortletContext portletContext = importedPortlet.getContext();
+
+ //make sure the expected portlet context and the one we get back from the import
are the same
+ assertEquals(originalPortletContext.getApplicationName(),
portletContext.getApplicationName());
+ assertEquals(originalPortletContext.getPortletName(),
portletContext.getPortletName());
+
+ if (originalPortletContext instanceof StatefulPortletContext)
+ {
+ StatefulPortletContext statefulExpected =
(StatefulPortletContext)originalPortletContext;
+
+ assertTrue(portletContext instanceof StatefulPortletContext);
+ StatefulPortletContext statefulPortletContext =
(StatefulPortletContext)portletContext;
+
+ //Check that the states are the same
+ StateConverter sc = new StateConverterV0();
+ PortletState state = sc.unmarshall(PortletStateType.OPAQUE,
(byte[])statefulPortletContext.getState());
+ PortletState expectedState = sc.unmarshall(PortletStateType.OPAQUE,
(byte[])statefulExpected.getState());
+
+ assertEquals(expectedState.getPortletId(), state.getPortletId());
+ assertEquals(expectedState.getProperties(), state.getProperties());
+ assertEquals(expectedState.getTerminationTime(), state.getTerminationTime());
+ assertEquals(expectedState.getClass(), state.getClass());
+ }
+
+ PropertyMap properties = getProperties(portletContext);
+ assertEquals(expectedProperties, properties);
+ assertEquals(getProperties(originalPortletContext), properties);
+
+ }
+
+ @Test
+ public void testImportNullPortletContext() throws Exception
+ {
+ try
+ {
+ importPortletContext(null);
+ fail("Was expecting an illegal arguement exception.");
+ }
+ catch (IllegalArgumentException e)
+ {
+ //expected
+ }
+ assertNoExistingState();
+ }
+
+ @Test
+ public void testImportsNonExisitngPOP() throws Exception
+ {
+ PortletContext popCTX = createNonExistingPOPRef();
+ try
+ {
+ importPortletContext(popCTX);
+ fail("Was expecting a NoSuchPortletException.");
+ }
+ catch (NoSuchPortletException e)
+ {
+ //expected
+ }
+ assertNoExistingState();
+ }
+
+ @Test
+ public void testImportNonExisitngCCP() throws Exception
+ {
+ PortletContext ccpCTX = createNonExistingLocalCCPRef();
+ try
+ {
+ importPortletContext(ccpCTX);
+ fail("Was expecting a NoSuchPortletException.");
+ }
+ catch (NoSuchPortletException e)
+ {
+ //expected
+ }
+ assertNoExistingState();
+ }
+
+ @Test
+ public void testImportInvalidPOP() throws Exception
+ {
+ PortletContext popCtx = createInvalidPOPRef();
+ try
+ {
+ importPortletContext(popCtx);
+ fail("was expecting an InvalidPortletIdException");
+ }
+ catch (InvalidPortletIdException expected)
+ {
+ }
+ assertNoExistingState();
+ }
+
+ @Test
+ public void testImport() throws Exception
+ {
+ //This will create the portlet into the container and check that it doesn't
have any properties set
+ PortletContext popCtx = createPOPRef(new PortletInfoSupport());
+ assertTrue(getProperties(popCtx).isEmpty());
+
+ //Create the state bytes manually and create the portletcontext.
+ //Tests what happens if a stateful portlet is export on one machine and imported
into another
+ StateConverter sc = new StateConverterV0();
+ PropertyMap propertyMap = new SimplePropertyMap();
+ propertyMap.setProperty("test", Arrays.asList("123"));
+ PortletState portletState = new PortletState("PortletId", propertyMap);
+ byte[] stateBytes = sc.marshall(PortletStateType.OPAQUE, portletState);
+
+ StatefulPortletContext portletContext =
StatefulPortletContext.create("PortletId", PortletStateType.OPAQUE,
stateBytes);
+
+ //import portlet
+ PortletContext importedPortletContext = importPortletContext(portletContext);
+
+ //Make sure that this new portlet has the properties we want
+ assertEquals(propertyMap, getProperties(importedPortletContext));
+ }
+
}
Modified:
components/pc/trunk/portlet/src/test/java/org/gatein/pc/test/portlet/state/ConsumerStatefulPortletInvokerTestCase.java
===================================================================
---
components/pc/trunk/portlet/src/test/java/org/gatein/pc/test/portlet/state/ConsumerStatefulPortletInvokerTestCase.java 2010-08-13
13:24:00 UTC (rev 3826)
+++
components/pc/trunk/portlet/src/test/java/org/gatein/pc/test/portlet/state/ConsumerStatefulPortletInvokerTestCase.java 2010-08-13
14:41:57 UTC (rev 3827)
@@ -252,4 +252,14 @@
assertEquals(1, portlets.size());
return (Portlet)portlets.iterator().next();
}
+
+ protected PortletContext importPortletContext(PortletContext contextToImport) throws
PortletInvokerException
+ {
+ return consumer.importPortlet(PortletStateType.OPAQUE, contextToImport);
+ }
+
+ protected PortletContext exportPortletContext(PortletContext originalPortletContext)
throws PortletInvokerException
+ {
+ return consumer.exportPortlet(PortletStateType.OPAQUE, originalPortletContext);
+ }
}
Modified:
components/pc/trunk/portlet/src/test/java/org/gatein/pc/test/portlet/state/ProducerStatefulPortletInvokerTestCase.java
===================================================================
---
components/pc/trunk/portlet/src/test/java/org/gatein/pc/test/portlet/state/ProducerStatefulPortletInvokerTestCase.java 2010-08-13
13:24:00 UTC (rev 3826)
+++
components/pc/trunk/portlet/src/test/java/org/gatein/pc/test/portlet/state/ProducerStatefulPortletInvokerTestCase.java 2010-08-13
14:41:57 UTC (rev 3827)
@@ -237,4 +237,14 @@
assertEquals(1, portlets.size());
return (Portlet)portlets.iterator().next();
}
+
+ protected PortletContext importPortletContext(PortletContext contextToImport) throws
PortletInvokerException
+ {
+ return producer.importPortlet(PortletStateType.OPAQUE, contextToImport);
+ }
+
+ protected PortletContext exportPortletContext(PortletContext originalPortletContext)
throws PortletInvokerException
+ {
+ return producer.exportPortlet(PortletStateType.OPAQUE, originalPortletContext);
+ }
}