Author: julien_viet
Date: 2011-09-27 03:35:03 -0400 (Tue, 27 Sep 2011)
New Revision: 7514
Added:
components/pc/trunk/portlet/src/test/resources/metadata/event/portlet-event-resource-bundle.xml
Modified:
components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/impl/deployment/staxnav/PortletApplicationMetaDataBuilder.java
components/pc/trunk/portlet/src/test/java/org/gatein/pc/portlet/deployment/EventTestEverythingTestCase.java
Log:
GTNPC-73 : Incorrect parsing of resource bundle inside a portlet element
Modified:
components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/impl/deployment/staxnav/PortletApplicationMetaDataBuilder.java
===================================================================
---
components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/impl/deployment/staxnav/PortletApplicationMetaDataBuilder.java 2011-09-27
07:31:58 UTC (rev 7513)
+++
components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/impl/deployment/staxnav/PortletApplicationMetaDataBuilder.java 2011-09-27
07:35:03 UTC (rev 7514)
@@ -439,7 +439,7 @@
}
//
- if (nav.find(Element.resource_bundle))
+ if (nav.sibling(Element.resource_bundle))
{
md.setResourceBundle(nav.getContent());
nav.next();
Modified:
components/pc/trunk/portlet/src/test/java/org/gatein/pc/portlet/deployment/EventTestEverythingTestCase.java
===================================================================
---
components/pc/trunk/portlet/src/test/java/org/gatein/pc/portlet/deployment/EventTestEverythingTestCase.java 2011-09-27
07:31:58 UTC (rev 7513)
+++
components/pc/trunk/portlet/src/test/java/org/gatein/pc/portlet/deployment/EventTestEverythingTestCase.java 2011-09-27
07:35:03 UTC (rev 7514)
@@ -126,4 +126,26 @@
String xmlFile = "metadata/event/portlet-event2-fail.xml";
unmarshall(xmlFile, true);
}
+
+ public void testFoo() throws Exception
+ {
+ String xmlFile = "metadata/event/portlet-event-resource-bundle.xml";
+ PortletApplication20MetaData md = unmarshall(xmlFile);
+
+ //
+ assertNotNull(md);
+ PortletMetaData portletMD = md.getPortlet("Portlet");
+ assertNotNull(portletMD);
+ assertEquals("bundle", portletMD.getResourceBundle());
+
+ //
+ assertEquals(null, md.getResourceBundle());
+ List<EventDefinitionMetaData> events = md.getEvents();
+ assertNotNull(events);
+ assertEquals(1, events.size());
+ EventDefinitionMetaData event = events.get(0);
+ assertNotNull(event);
+ assertEquals("event", event.getName());
+ assertEquals("org.jboss.portal.event.invoke.refill.beer",
event.getValueType());
+ }
}
Added:
components/pc/trunk/portlet/src/test/resources/metadata/event/portlet-event-resource-bundle.xml
===================================================================
---
components/pc/trunk/portlet/src/test/resources/metadata/event/portlet-event-resource-bundle.xml
(rev 0)
+++
components/pc/trunk/portlet/src/test/resources/metadata/event/portlet-event-resource-bundle.xml 2011-09-27
07:35:03 UTC (rev 7514)
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2006, 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+<portlet-app
xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2...
http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
+ version="2.0">
+
+ <portlet>
+ <portlet-name>Portlet</portlet-name>
+ <portlet-class>WhatevetPortlet</portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <resource-bundle>bundle</resource-bundle>
+ <supported-publishing-event>
+ <name>event</name>
+ </supported-publishing-event>
+ </portlet>
+
+ <event-definition>
+ <name>event</name>
+ <value-type>org.jboss.portal.event.invoke.refill.beer</value-type>
+ </event-definition>
+
+
+</portlet-app>
\ No newline at end of file