Author: julien(a)jboss.com
Date: 2008-04-19 10:51:15 -0400 (Sat, 19 Apr 2008)
New Revision: 10653
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/StateAwareResponseImpl.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/event/NonDeclaredEventPublicationDuringActionTestCase.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/event/NonDeclaredEventPublicationDuringEventTestCase.java
Log:
- fix a bug when the publication of a non declared event with a payload was throwing an
NPE
- complete the NonDeclaredEventPublicationDuring*TestCase to publish an event with a
payload
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/StateAwareResponseImpl.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/StateAwareResponseImpl.java 2008-04-19
14:21:09 UTC (rev 10652)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/StateAwareResponseImpl.java 2008-04-19
14:51:15 UTC (rev 10653)
@@ -290,20 +290,24 @@
}
}
- //
-
// Check type
ContainerEventInfo eventInfo =
preq.container.getInfo().getEventing().getProducedEvents().get(name);
- ContainerTypeInfo typeInfo = eventInfo.getType();
- if (typeInfo != null)
+
+ // If we have event info it means we need to check the type validity otherwise
it is a non declared event
+ // and it is up to the controller to manage the payload.
+ if (eventInfo != null)
{
- Class expectedType = typeInfo.getType();
+ ContainerTypeInfo typeInfo = eventInfo.getType();
+ if (typeInfo != null)
+ {
+ Class expectedType = typeInfo.getType();
- //
- if (!expectedType.isInstance(value))
- {
- throw new IllegalArgumentException("The provided event value type
" + valueType.getName() +
- " does not match the declared event type " +
expectedType.getName());
+ //
+ if (!expectedType.isInstance(value))
+ {
+ throw new IllegalArgumentException("The provided event value type
" + valueType.getName() +
+ " does not match the declared event type " +
expectedType.getName());
+ }
}
}
}
Modified:
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/event/NonDeclaredEventPublicationDuringActionTestCase.java
===================================================================
---
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/event/NonDeclaredEventPublicationDuringActionTestCase.java 2008-04-19
14:21:09 UTC (rev 10652)
+++
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/event/NonDeclaredEventPublicationDuringActionTestCase.java 2008-04-19
14:51:15 UTC (rev 10653)
@@ -66,7 +66,7 @@
{
protected void run(Portlet portlet, ActionRequest request, ActionResponse
response, PortletTestContext context) throws PortletException, IOException
{
- // We just test that we can publish it
+ // We test that we can publish it
try
{
response.setEvent("SomeNonDeclaredString", null);
@@ -75,6 +75,16 @@
{
fail(e);
}
+
+ // We test that we can publish it with a payload
+ try
+ {
+ response.setEvent("SomeNonDeclaredString",
"Payload");
+ }
+ catch (IllegalArgumentException e)
+ {
+ fail(e);
+ }
}
});
seq.bindAction(1, UTP7.EVENT_JOIN_POINT, new PortletEventTestAction()
Modified:
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/event/NonDeclaredEventPublicationDuringEventTestCase.java
===================================================================
---
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/event/NonDeclaredEventPublicationDuringEventTestCase.java 2008-04-19
14:21:09 UTC (rev 10652)
+++
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/event/NonDeclaredEventPublicationDuringEventTestCase.java 2008-04-19
14:51:15 UTC (rev 10653)
@@ -75,7 +75,7 @@
{
protected void run(Portlet portlet, EventRequest request, EventResponse
response, PortletTestContext context) throws PortletException, IOException
{
- // We just test that we can publish it
+ // We test that we can publish it
try
{
response.setEvent("SomeNonDeclaredString", null);
@@ -84,6 +84,16 @@
{
fail(e);
}
+
+ // We test that we can publish it with a payload
+ try
+ {
+ response.setEvent("SomeNonDeclaredString",
"Payload");
+ }
+ catch (IllegalArgumentException e)
+ {
+ fail(e);
+ }
}
});
seq.bindAction(1, UTP8.RENDER_JOIN_POINT, new PortletRenderTestAction()
Show replies by date