Author: julien(a)jboss.com
Date: 2008-03-09 18:35:43 -0400 (Sun, 09 Mar 2008)
New Revision: 10251
Added:
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr168/ext/portletconfig/InlineBundleWithEmptyTitleTestCase.java
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerInfoBuilder.java
modules/portlet/trunk/test/src/test/resources/jsr168/ext/portletconfig-war/WEB-INF/portlet.xml
Log:
- when no title is provided with a non null portlet info, use an empty string
- added test case for title with empty value in portlet metadata
- now all portlet container tests are passing
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerInfoBuilder.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerInfoBuilder.java 2008-03-09
21:26:45 UTC (rev 10250)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerInfoBuilder.java 2008-03-09
22:35:43 UTC (rev 10251)
@@ -824,10 +824,19 @@
String[] inlines = null;
if (portletInfoMD != null)
{
+ // JBoss XB would give null for an empty title, but we know that
+ // there must be a title according to the schema
+ String title = portletInfoMD.getTitle();
+ if (title == null)
+ {
+ title = "";
+ }
+
+ //
inlines = new String[]{
- portletMD.getPortletInfo().getTitle(),
- portletMD.getPortletInfo().getShortTitle(),
- portletMD.getPortletInfo().getKeywords()
+ title,
+ portletInfoMD.getShortTitle(),
+ portletInfoMD.getKeywords()
};
}
Added:
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr168/ext/portletconfig/InlineBundleWithEmptyTitleTestCase.java
===================================================================
---
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr168/ext/portletconfig/InlineBundleWithEmptyTitleTestCase.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr168/ext/portletconfig/InlineBundleWithEmptyTitleTestCase.java 2008-03-09
22:35:43 UTC (rev 10251)
@@ -0,0 +1,70 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, 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.portlet.jsr168.ext.portletconfig;
+
+import org.jboss.portal.unit.annotations.TestCase;
+import org.jboss.portal.unit.PortletTestCase;
+import org.jboss.portal.unit.PortletTestContext;
+import org.jboss.portal.unit.base.AbstractUniversalTestPortlet;
+import org.jboss.portal.unit.actions.PortletRenderTestAction;
+import org.jboss.portal.test.portlet.framework.UTP1;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.EndTestResponse;
+import static org.jboss.unit.api.Assert.*;
+
+import javax.portlet.Portlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.PortletException;
+import javax.portlet.PortletConfig;
+import java.io.IOException;
+import java.util.Locale;
+import java.util.ResourceBundle;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien
Viet</a>
+ * @version $Revision: 630 $
+ */
+@TestCase
+public class InlineBundleWithEmptyTitleTestCase
+{
+ public InlineBundleWithEmptyTitleTestCase(PortletTestCase seq)
+ {
+ seq.bindAction(0, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context) throws PortletException, IOException
+ {
+ PortletConfig config =
((AbstractUniversalTestPortlet)portlet).getPortletConfig();
+ assertNotNull(config);
+ ResourceBundle bundle = config.getResourceBundle(Locale.ENGLISH);
+ assertNotNull(bundle);
+
+ //
+ assertEquals("",
bundle.getString("javax.portlet.title"));
+
+ //
+ return new EndTestResponse();
+ }
+ });
+ }
+}
Modified:
modules/portlet/trunk/test/src/test/resources/jsr168/ext/portletconfig-war/WEB-INF/portlet.xml
===================================================================
---
modules/portlet/trunk/test/src/test/resources/jsr168/ext/portletconfig-war/WEB-INF/portlet.xml 2008-03-09
21:26:45 UTC (rev 10250)
+++
modules/portlet/trunk/test/src/test/resources/jsr168/ext/portletconfig-war/WEB-INF/portlet.xml 2008-03-09
22:35:43 UTC (rev 10251)
@@ -69,5 +69,17 @@
</portlet-info>
</portlet>
-
+ <portlet>
+ <portlet-name>UniversalTestPortletA</portlet-name>
+
<portlet-class>org.jboss.portal.test.portlet.framework.UTP1</portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title></title>
+ <short-title></short-title>
+ <keywords></keywords>
+ </portlet-info>
+ </portlet>
+
</portlet-app>