[jboss-cvs] jboss-portal/portlet/src/main/org/jboss/portal/test/portlet/state ...
Julien Viet
julien at jboss.com
Tue Aug 22 10:51:49 EDT 2006
User: julien
Date: 06/08/22 10:51:49
Modified: portlet/src/main/org/jboss/portal/test/portlet/state
StatefulPortletInvokerTestCase.java
Log:
added getProperties(String portletId, Set keys) on PortletInvoker to match WSRP semantics
Revision Changes Path
1.4 +91 -1 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.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- StatefulPortletInvokerTestCase.java 22 Aug 2006 14:08:55 -0000 1.3
+++ StatefulPortletInvokerTestCase.java 22 Aug 2006 14:51:49 -0000 1.4
@@ -34,10 +34,13 @@
import org.jboss.portal.portlet.test.support.state.StateStoreSupport;
import org.jboss.portal.portlet.test.support.PortletSupport;
import org.jboss.portal.common.value.StringValue;
+import org.jboss.portal.common.util.CollectionBuilder;
+
+import java.util.HashSet;
/**
* @author <a href="mailto:julien at jboss.org">Julien Viet</a>
- * @version $Revision: 1.3 $
+ * @version $Revision: 1.4 $
*/
public class StatefulPortletInvokerTestCase extends TestCase
{
@@ -311,6 +314,14 @@
catch (IllegalArgumentException e)
{
}
+ try
+ {
+ invoker.getProperties(null, new HashSet());
+ fail("was expecting an IllegalArgumentException");
+ }
+ catch (IllegalArgumentException e)
+ {
+ }
}
public void testGetNonExistingPOPProperties() throws Exception
@@ -324,6 +335,14 @@
catch (NoSuchPortletException e)
{
}
+ try
+ {
+ invoker.getProperties(popId, new HashSet());
+ fail("was expecting a NoSuchPortletException");
+ }
+ catch (NoSuchPortletException e)
+ {
+ }
}
public void testGetInvalidPOPProperties() throws Exception
@@ -338,6 +357,14 @@
catch (InvalidPortletIdException e)
{
}
+ try
+ {
+ invoker.getProperties(popId, new HashSet());
+ fail("was expecting an InvalidPortletIdException");
+ }
+ catch (InvalidPortletIdException e)
+ {
+ }
}
public void testGetNonExistingCCPProperties() throws Exception
@@ -351,6 +378,14 @@
catch (NoSuchPortletException e)
{
}
+ try
+ {
+ invoker.getProperties(ccpId, new HashSet());
+ fail("was expecting a NoSuchPortletException");
+ }
+ catch (NoSuchPortletException e)
+ {
+ }
}
public void testGetInvalidCCPProperties() throws Exception
@@ -364,6 +399,44 @@
catch (InvalidPortletIdException e)
{
}
+ try
+ {
+ invoker.getProperties(ccpId, new HashSet());
+ fail("was expecting a nInvalidPortletIdException");
+ }
+ catch (InvalidPortletIdException e)
+ {
+ }
+ }
+
+ public void testGetPOPWithNullKeys() throws Exception
+ {
+ nextInvoker.addPortlet(new PortletSupport("PortletId"));
+ String popId = invoker.wrapPOPId("PortletId");
+ try
+ {
+ invoker.getProperties(popId, null);
+ fail("was expecting an IllegalArgumentException");
+ }
+ catch (IllegalArgumentException e)
+ {
+ }
+ }
+
+ public void testGetCCPWithNullKeys() throws Exception
+ {
+ nextInvoker.addPortlet(new PortletSupport("PortletId"));
+ PropertyMap ccpProps = new SimplePropertyMap();
+ String stateId = stateStore.createState("PortletId", ccpProps);
+ String ccpId = invoker.wrapCCPId(stateId);
+ try
+ {
+ invoker.getProperties(ccpId, null);
+ fail("was expecting an IllegalArgumentException");
+ }
+ catch (IllegalArgumentException e)
+ {
+ }
}
public void testGetPOPProperties() throws Exception
@@ -376,11 +449,19 @@
}
});
String popId = invoker.wrapPOPId("PortletId");
+
+ //
PropertyMap props = invoker.getProperties(popId);
PropertyMap expectedProps = new SimplePropertyMap();
expectedProps.setProperty("abc", new StringValue("def"));
expectedProps.setProperty("ghi", new StringValue("jkl"));
ValueMapAssert.assertEquals(expectedProps, props);
+
+ //
+ props = invoker.getProperties(popId, new CollectionBuilder().add("abc").add("mno").toHashSet());
+ expectedProps = new SimplePropertyMap();
+ expectedProps.setProperty("abc", new StringValue("def"));
+ ValueMapAssert.assertEquals(expectedProps, props);
}
public void testGetCCPProperties() throws Exception
@@ -399,6 +480,8 @@
ccpProps.setProperty("mno", new StringValue("_pqr"));
String stateId = stateStore.createState("PortletId", ccpProps);
String ccpId = invoker.wrapCCPId(stateId);
+
+ //
PropertyMap props = invoker.getProperties(ccpId);
PropertyMap expectedProps = new SimplePropertyMap();
expectedProps.setProperty("abc", new StringValue("_def"));
@@ -406,6 +489,13 @@
expectedProps.setProperty("mno", new StringValue("pqr"));
expectedProps.setProperty("stu", new StringValue("vwx"));
ValueMapAssert.assertEquals(expectedProps, props);
+
+ //
+ props = invoker.getProperties(ccpId, new CollectionBuilder().add("abc").add("mno").add("yz").toHashSet());
+ expectedProps = new SimplePropertyMap();
+ expectedProps.setProperty("abc", new StringValue("_def"));
+ expectedProps.setProperty("mno", new StringValue("pqr"));
+ ValueMapAssert.assertEquals(expectedProps, props);
}
public void testSetPropertiesWithNullId() throws Exception
More information about the jboss-cvs-commits
mailing list