[jboss-cvs] jboss-portal/portlet/src/main/org/jboss/portal/test/portlet/state ...
Julien Viet
julien at jboss.com
Thu Aug 24 09:21:38 EDT 2006
User: julien
Date: 06/08/24 09:21:38
Modified: portlet/src/main/org/jboss/portal/test/portlet/state
StatefulPortletInvokerTestCase.java
Log:
updated the implementation of destroyClone to now destroy a list of ids and return the list of non destroyed ids. updated the InstanceContainer accordingly
Revision Changes Path
1.6 +22 -28 jboss-portal/portlet/src/main/org/jboss/portal/test/portlet/state/StatefulPortletInvokerTestCase.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: StatefulPortletInvokerTestCase.java
===================================================================
RCS file: /cvsroot/jboss/jboss-portal/portlet/src/main/org/jboss/portal/test/portlet/state/StatefulPortletInvokerTestCase.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- StatefulPortletInvokerTestCase.java 23 Aug 2006 12:55:02 -0000 1.5
+++ StatefulPortletInvokerTestCase.java 24 Aug 2006 13:21:38 -0000 1.6
@@ -25,9 +25,11 @@
import org.jboss.portal.portlet.state.producer.StatefulPortletInvoker;
import org.jboss.portal.portlet.state.producer.State;
import org.jboss.portal.portlet.state.producer.NoSuchStateException;
+import org.jboss.portal.portlet.state.producer.InvalidStateIdException;
import org.jboss.portal.portlet.state.PropertyMap;
import org.jboss.portal.portlet.state.SimplePropertyMap;
import org.jboss.portal.portlet.state.PropertyChange;
+import org.jboss.portal.portlet.state.DestroyCloneFailure;
import org.jboss.portal.portlet.NoSuchPortletException;
import org.jboss.portal.portlet.InvalidPortletIdException;
import org.jboss.portal.portlet.test.ValueMapAssert;
@@ -38,10 +40,12 @@
import org.jboss.portal.common.util.CollectionBuilder;
import java.util.HashSet;
+import java.util.Collections;
+import java.util.List;
/**
* @author <a href="mailto:julien at jboss.org">Julien Viet</a>
- * @version $Revision: 1.5 $
+ * @version $Revision: 1.6 $
*/
public class StatefulPortletInvokerTestCase extends TestCase
{
@@ -241,7 +245,7 @@
{
try
{
- invoker.destroyClone(null);
+ invoker.destroyClones(null);
fail("was expecting an IllegalArgumentException");
}
catch (IllegalArgumentException expected)
@@ -253,14 +257,10 @@
{
nextInvoker.addPortlet(new PortletSupport("PortletId"));
String popId = invoker.wrapPOPId("PortletId");
- try
- {
- invoker.destroyClone(popId);
- fail("was expecting an IllegalArgumentException");
- }
- catch (InvalidPortletIdException expected)
- {
- }
+ List failures = invoker.destroyClones(Collections.singletonList(popId));
+ assertEquals(1, failures.size());
+ DestroyCloneFailure failure = (DestroyCloneFailure)failures.get(0);
+ assertEquals("PortletId", failure.getPortletId());
}
public void testDestroyCCP() throws Exception
@@ -268,41 +268,35 @@
nextInvoker.addPortlet(new PortletSupport("PortletId"));
String stateId = stateStore.createState("PortletId", new SimplePropertyMap());
String cloneId = invoker.wrapCCPId(stateId);
- invoker.destroyClone(cloneId);
+ List failures = invoker.destroyClones(Collections.singletonList(cloneId));
+ assertEquals(0, failures.size());
try
{
stateStore.loadState(stateId);
- fail("Was expecting NoSuchStateException");
+ fail("Was expecting a NoSuchStateException");
}
catch (NoSuchStateException e)
{
+
}
}
public void testDestroyInvalidCCP() throws Exception
{
String ccpId = invoker.wrapCCPId("PortletId");
- try
- {
- invoker.destroyClone(ccpId);
- fail("was expecting a InvalidPortletIdException");
- }
- catch (InvalidPortletIdException expected)
- {
- }
+ List failures = invoker.destroyClones(Collections.singletonList(ccpId));
+ assertEquals(1, failures.size());
+ DestroyCloneFailure failure = (DestroyCloneFailure)failures.get(0);
+ assertEquals(ccpId, failure.getPortletId());
}
public void testDestroyNonExistingCCP() throws Exception
{
String ccpId = invoker.wrapCCPId("1");
- try
- {
- invoker.destroyClone(ccpId);
- fail("was expecting a NoSuchPortletException");
- }
- catch (NoSuchPortletException expected)
- {
- }
+ List failures = invoker.destroyClones(Collections.singletonList(ccpId));
+ assertEquals(1, failures.size());
+ DestroyCloneFailure failure = (DestroyCloneFailure)failures.get(0);
+ assertEquals(ccpId, failure.getPortletId());
}
public void testGetPropertiesWithNullPortlet() throws Exception
More information about the jboss-cvs-commits
mailing list