You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pluto-scm@portals.apache.org by es...@apache.org on 2007/11/30 06:33:18 UTC
svn commit: r599698 - in /portals/pluto/branches/pluto-1.1.x:
pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/portlet/
pluto-descriptor-impl/src/test/java/org/apache/pluto/descriptors/services/castor/
Author: esm
Date: Thu Nov 29 21:33:09 2007
New Revision: 599698
URL: http://svn.apache.org/viewvc?rev=599698&view=rev
Log:
[PLUTO-448]: Exposing constant for an unset portlet expiration. Thanks Eric!
Modified:
portals/pluto/branches/pluto-1.1.x/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/portlet/PortletDD.java
portals/pluto/branches/pluto-1.1.x/pluto-descriptor-impl/src/test/java/org/apache/pluto/descriptors/services/castor/PortletAppDescriptorServiceImplTest.java
Modified: portals/pluto/branches/pluto-1.1.x/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/portlet/PortletDD.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/pluto-1.1.x/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/portlet/PortletDD.java?rev=599698&r1=599697&r2=599698&view=diff
==============================================================================
--- portals/pluto/branches/pluto-1.1.x/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/portlet/PortletDD.java (original)
+++ portals/pluto/branches/pluto-1.1.x/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/portlet/PortletDD.java Thu Nov 29 21:33:09 2007
@@ -30,6 +30,11 @@
* @since Mar 6, 2005
*/
public class PortletDD {
+ /**
+ * The value of the expirationCache property when no expiration cache was configured
+ * in portlet.xml for this portlet descriptor.
+ */
+ public static final int EXPIRATION_CACHE_UNSET = Integer.MIN_VALUE;
// Private Member Variables ------------------------------------------------
@@ -42,7 +47,7 @@
/** The descriptions of the portlet. */
private List descriptions = new ArrayList();
- private int expirationCache = 0;
+ private int expirationCache = EXPIRATION_CACHE_UNSET;
/** The class which implements the portlet interface. */
private String portletClass = null;
Modified: portals/pluto/branches/pluto-1.1.x/pluto-descriptor-impl/src/test/java/org/apache/pluto/descriptors/services/castor/PortletAppDescriptorServiceImplTest.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/pluto-1.1.x/pluto-descriptor-impl/src/test/java/org/apache/pluto/descriptors/services/castor/PortletAppDescriptorServiceImplTest.java?rev=599698&r1=599697&r2=599698&view=diff
==============================================================================
--- portals/pluto/branches/pluto-1.1.x/pluto-descriptor-impl/src/test/java/org/apache/pluto/descriptors/services/castor/PortletAppDescriptorServiceImplTest.java (original)
+++ portals/pluto/branches/pluto-1.1.x/pluto-descriptor-impl/src/test/java/org/apache/pluto/descriptors/services/castor/PortletAppDescriptorServiceImplTest.java Thu Nov 29 21:33:09 2007
@@ -128,4 +128,93 @@
" </user-data-constraint>\n" +
" </security-constraint>" +
"</portlet-app>";
+
+
+
+ public void testParseNoExpirationCache() throws IOException {
+ InputStream in = new ByteArrayInputStream(xmlNoCache.toString().getBytes());
+
+ PortletAppDD dd = service.read(in);
+ assertEquals("1.0", dd.getVersion());
+ assertEquals(1, dd.getPortlets().size());
+
+ PortletDD pd = (PortletDD)dd.getPortlets().get(0);
+ assertEquals(2, pd.getDisplayNames().size());
+ assertEquals(1, pd.getDescriptions().size());
+ assertEquals("About Portlet", ((DisplayNameDD)pd.getDisplayNames().get(0)).getDisplayName());
+ assertEquals("en", ((DisplayNameDD)pd.getDisplayNames().get(0)).getLang());
+ assertEquals("fr", ((DisplayNameDD)pd.getDisplayNames().get(1)).getLang());
+ assertEquals(PortletDD.EXPIRATION_CACHE_UNSET, pd.getExpirationCache());
+ assertEquals(1, pd.getSupportedLocales().size());
+ assertEquals("en", pd.getSupportedLocales().get(0));
+ assertEquals(1, pd.getInitParams().size());
+ assertEquals(1, ((InitParamDD)pd.getInitParams().get(0)).getDescriptions().size());
+
+ assertEquals(2, dd.getCustomPortletModes().size());
+ assertEquals(2, dd.getCustomWindowStates().size());
+ assertEquals(1, dd.getUserAttributes().size());
+ assertEquals(1, dd.getSecurityConstraints().size());
+
+ SecurityConstraintDD sc = (SecurityConstraintDD)dd.getSecurityConstraints().get(0);
+ assertNotNull(sc.getPortletCollection());
+ assertEquals(1, sc.getDisplayNames().size());
+ assertEquals(3, sc.getPortletCollection().getPortletNames().size());
+ assertEquals("a", sc.getPortletCollection().getPortletNames().get(0));
+ assertEquals("b", sc.getPortletCollection().getPortletNames().get(1));
+ assertEquals("c", sc.getPortletCollection().getPortletNames().get(2));
+
+ assertNotNull(sc.getUserDataConstraint());
+ assertEquals(1, sc.getUserDataConstraint().getDescriptions().size());
+ assertEquals("NONE", sc.getUserDataConstraint().getTransportGuarantee());
+
+ }
+
+
+
+ private final String xmlNoCache = "<portlet-app\n" +
+ " xmlns=\"http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd\"\n" +
+ " version=\"1.0\"\n" +
+ " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n" +
+ " xsi:schemaLocation=\"http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd\n" +
+ " http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd\">" +
+ "<portlet>"+
+ "<description>AboutPortletDescription</description>"+
+ "<portlet-name>AboutPortlet</portlet-name>"+
+ "<display-name>About Portlet</display-name>"+
+ "<display-name xml:lang=\"fr\">About Portlet</display-name>"+
+ "<portlet-class>org.apache.pluto.driver.portlets.AboutPortlet</portlet-class>"+
+ " <init-param>\n" +
+ " <description>a</description>\n" +
+ " <name>b</name>\n" +
+ " <value>v</value>\n" +
+ " </init-param>" +
+ "<supports>"+
+ "<mime-type>text/html</mime-type>"+
+ "<portlet-mode>VIEW</portlet-mode>"+
+ "<portlet-mode>EDIT</portlet-mode>"+
+ "<portlet-mode>HELP</portlet-mode>"+
+ "</supports>"+
+ "<supported-locale>en</supported-locale>"+
+ "<portlet-info>"+
+ "<title>About Apache Pluto</title>"+
+ "</portlet-info>"+
+ "</portlet>"+
+ " <custom-portlet-mode><description>Test</description><portlet-mode>customMode</portlet-mode></custom-portlet-mode>" +
+ " <custom-portlet-mode><description>Test2</description><portlet-mode>customMode2</portlet-mode></custom-portlet-mode>" +
+ " <custom-window-state><description>Test</description><window-state>customWindow</window-state></custom-window-state>" +
+ " <custom-window-state><description>Test2</description><window-state>customWindow2</window-state></custom-window-state>" +
+ " <user-attribute><description>Test2</description><name>user</name></user-attribute>" +
+ " <security-constraint>\n" +
+ " <display-name>description</display-name>\n" +
+ " <portlet-collection>\n" +
+ " <portlet-name>a</portlet-name>\n" +
+ " <portlet-name>b</portlet-name>\n" +
+ " <portlet-name>c</portlet-name>\n" +
+ " </portlet-collection>\n" +
+ " <user-data-constraint>\n" +
+ " <description>scdescription</description>\n" +
+ " <transport-guarantee>NONE</transport-guarantee>\n" +
+ " </user-data-constraint>\n" +
+ " </security-constraint>" +
+ "</portlet-app>";
}