Author: julien(a)jboss.com
Date: 2008-03-10 19:27:00 -0400 (Mon, 10 Mar 2008)
New Revision: 10253
Added:
modules/portlet/trunk/controller/src/test/java/org/jboss/portal/portlet/controller/EventControllerContextFailureTestCase.java
modules/portlet/trunk/controller/src/test/java/org/jboss/portal/portlet/controller/handlers/
modules/portlet/trunk/controller/src/test/java/org/jboss/portal/portlet/controller/handlers/EventProducerActionHandler.java
modules/portlet/trunk/controller/src/test/java/org/jboss/portal/portlet/controller/handlers/EventProducerEventHandler.java
modules/portlet/trunk/controller/src/test/java/org/jboss/portal/portlet/controller/handlers/FailingEventHandler.java
modules/portlet/trunk/controller/src/test/java/org/jboss/portal/portlet/controller/handlers/NoOpEventHandler.java
Modified:
modules/portlet/trunk/controller/src/test/java/org/jboss/portal/portlet/controller/PortletControllerTestCase.java
modules/portlet/trunk/controller/src/test/resources/local-jboss-unit.xml
Log:
started to test the failures during an event controller context callback.
Added:
modules/portlet/trunk/controller/src/test/java/org/jboss/portal/portlet/controller/EventControllerContextFailureTestCase.java
===================================================================
---
modules/portlet/trunk/controller/src/test/java/org/jboss/portal/portlet/controller/EventControllerContextFailureTestCase.java
(rev 0)
+++
modules/portlet/trunk/controller/src/test/java/org/jboss/portal/portlet/controller/EventControllerContextFailureTestCase.java 2008-03-10
23:27:00 UTC (rev 10253)
@@ -0,0 +1,238 @@
+/******************************************************************************
+ * 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.portlet.controller;
+
+import org.jboss.portal.portlet.support.PortletInvokerSupport;
+import org.jboss.portal.portlet.support.PortletSupport;
+import org.jboss.portal.portlet.controller.request.ControllerRequest;
+import org.jboss.portal.portlet.controller.event.EventPhaseContext;
+import org.jboss.portal.portlet.controller.event.Event;
+import org.jboss.portal.portlet.controller.event.AbstractEventControllerContext;
+import org.jboss.portal.portlet.controller.response.ControllerResponse;
+import org.jboss.portal.portlet.controller.response.PageUpdateResponse;
+import org.jboss.portal.portlet.controller.response.PortletResponse;
+import org.jboss.portal.portlet.controller.handlers.EventProducerActionHandler;
+import org.jboss.portal.portlet.controller.handlers.FailingEventHandler;
+import org.jboss.portal.portlet.controller.handlers.NoOpEventHandler;
+import org.jboss.portal.portlet.PortletInvokerException;
+import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
+import org.jboss.unit.api.pojo.annotations.Test;
+import org.jboss.unit.api.pojo.annotations.Create;
+import static org.jboss.unit.api.Assert.assertInstanceOf;
+import static org.jboss.unit.api.Assert.assertEquals;
+import static org.jboss.unit.api.Assert.assertTrue;
+import static org.jboss.unit.api.Assert.fail;
+import static org.jboss.unit.api.Assert.assertSame;
+
+import javax.xml.namespace.QName;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien
Viet</a>
+ * @version $Revision: 630 $
+ */
+@Test
+public class EventControllerContextFailureTestCase
+{
+
+ /** . */
+ private PortletController controller = new PortletController();
+
+ /** . */
+ private PortletControllerContextSupport context = new
PortletControllerContextSupport();
+
+ /** . */
+ private PortletInvokerSupport invoker = context.getInvoker();
+
+ /** . */
+ private ControllerRequest request;
+
+ /** . */
+ private QName srcName;
+
+ /** . */
+ private QName dstName;
+
+ /** . */
+ private PortletSupport fooPortlet;
+
+ /** . */
+ private PortletSupport barPortlet;
+
+ /** . */
+ private boolean called;
+
+ @Create
+ public void create()
+ {
+ request = context.createActionRequest("foo");
+ srcName = new QName("juu", "foo");
+ dstName = new QName("juu", "bar");
+ fooPortlet = invoker.addPortlet("foo");
+ barPortlet = invoker.addPortlet("bar");
+ called = false;
+ }
+
+ @Test
+ public void testEventControllerContextFailsDuringEventConsumedCallback() throws
PortletInvokerException
+ {
+ WiringEventControllerContext ecc = new WiringEventControllerContext()
+ {
+ public void eventConsumed(EventPhaseContext context, Event consumedEvent,
PortletInvocationResponse consumerResponse)
+ {
+ called = true;
+ throw new RuntimeException();
+ }
+ };
+ ecc.createWire(srcName, "foo", dstName, "bar");
+
+ // We test that a runtime exception thrown does not interrrupt the flow of the
controller
+ context.setEventControllerContext(ecc);
+ fooPortlet.addHandler(new EventProducerActionHandler(srcName));
+ barPortlet.addHandler(new NoOpEventHandler());
+ ControllerResponse response = controller.process(context, request);
+ PageUpdateResponse updateResponse = assertInstanceOf(response,
PageUpdateResponse.class);
+ assertEquals(PortletResponse.DISTRIBUTION_DONE,
updateResponse.getEventDistributionStatus());
+ assertTrue(called);
+
+ //
+ called = false;
+ final Error error = new Error();
+ ecc = new WiringEventControllerContext()
+ {
+ public void eventConsumed(EventPhaseContext context, Event consumedEvent,
PortletInvocationResponse consumerResponse)
+ {
+ called = true;
+ throw error;
+ }
+ };
+ ecc.createWire(srcName, "foo", dstName, "bar");
+
+ //
+ context.setEventControllerContext(ecc);
+ fooPortlet.addHandler(new EventProducerActionHandler(srcName));
+ barPortlet.addHandler(new NoOpEventHandler());
+ try
+ {
+ controller.process(context, request);
+ fail();
+ }
+ catch (Error ignore)
+ {
+ assertSame(error, ignore);
+ assertTrue(called);
+ }
+ }
+
+ @Test
+ public void testEventControllerContextFailsDuringEventProducedCallback() throws
PortletInvokerException
+ {
+ AbstractEventControllerContext ecc = new AbstractEventControllerContext()
+ {
+ public void eventProduced(EventPhaseContext context, Event sourceEvent, Event
producedEvent)
+ {
+ throw new RuntimeException();
+ }
+ };
+
+ // We test that a runtime exception thrown does not interrrupt the flow of the
controller
+ context.setEventControllerContext(ecc);
+ fooPortlet.addHandler(new EventProducerActionHandler(srcName));
+ ControllerResponse response = controller.process(context, request);
+ PageUpdateResponse updateResponse = assertInstanceOf(response,
PageUpdateResponse.class);
+ assertEquals(PortletResponse.DISTRIBUTION_DONE,
updateResponse.getEventDistributionStatus());
+
+ //
+ final Error error = new Error();
+ ecc = new AbstractEventControllerContext()
+ {
+ public void eventProduced(EventPhaseContext context, Event sourceEvent, Event
producedEvent)
+ {
+ throw error;
+ }
+ };
+
+ // We test than an error thrown interrupts the flow of the controller
+ context.setEventControllerContext(ecc);
+ fooPortlet.addHandler(new EventProducerActionHandler(srcName));
+ try
+ {
+ controller.process(context, request);
+ fail();
+ }
+ catch (Error ignore)
+ {
+ assertSame(error, ignore);
+ }
+ }
+
+ @Test
+ public void testEventControllerContextFailsDuringEventFailedCallback() throws
PortletInvokerException
+ {
+ WiringEventControllerContext ecc = new WiringEventControllerContext()
+ {
+ public void eventFailed(EventPhaseContext context, Event failedEvent, Throwable
throwable)
+ {
+ called = true;
+ throw new RuntimeException();
+ }
+ };
+ ecc.createWire(srcName, "foo", dstName, "bar");
+
+ // We test that a runtime exception thrown does not interrrupt the flow of the
controller
+ context.setEventControllerContext(ecc);
+ fooPortlet.addHandler(new EventProducerActionHandler(srcName));
+ barPortlet.addHandler(new FailingEventHandler(new RuntimeException()));
+ ControllerResponse response = controller.process(context, request);
+ PageUpdateResponse updateResponse = assertInstanceOf(response,
PageUpdateResponse.class);
+ assertEquals(PortletResponse.DISTRIBUTION_DONE,
updateResponse.getEventDistributionStatus());
+ assertTrue(called);
+
+ //
+ called = false;
+ final Error error = new Error();
+ ecc = new WiringEventControllerContext()
+ {
+ public void eventFailed(EventPhaseContext context, Event failedEvent, Throwable
throwable)
+ {
+ called = true;
+ throw error;
+ }
+ };
+ ecc.createWire(srcName, "foo", dstName, "bar");
+
+ //
+ context.setEventControllerContext(ecc);
+ fooPortlet.addHandler(new EventProducerActionHandler(srcName));
+ barPortlet.addHandler(new FailingEventHandler(new RuntimeException()));
+ try
+ {
+ controller.process(context, request);
+ fail();
+ }
+ catch (Error ignore)
+ {
+ assertSame(error, ignore);
+ assertTrue(called);
+ }
+ }
+}
Modified:
modules/portlet/trunk/controller/src/test/java/org/jboss/portal/portlet/controller/PortletControllerTestCase.java
===================================================================
---
modules/portlet/trunk/controller/src/test/java/org/jboss/portal/portlet/controller/PortletControllerTestCase.java 2008-03-10
09:45:04 UTC (rev 10252)
+++
modules/portlet/trunk/controller/src/test/java/org/jboss/portal/portlet/controller/PortletControllerTestCase.java 2008-03-10
23:27:00 UTC (rev 10253)
@@ -30,6 +30,9 @@
import org.jboss.portal.portlet.controller.event.EventPhaseContext;
import org.jboss.portal.portlet.controller.event.Event;
import org.jboss.portal.portlet.controller.event.AbstractEventControllerContext;
+import org.jboss.portal.portlet.controller.handlers.EventProducerActionHandler;
+import org.jboss.portal.portlet.controller.handlers.EventProducerEventHandler;
+import org.jboss.portal.portlet.controller.handlers.NoOpEventHandler;
import org.jboss.portal.portlet.PortletInvokerException;
import org.jboss.portal.portlet.support.PortletSupport;
import org.jboss.portal.portlet.support.PortletInvokerSupport;
@@ -37,14 +40,12 @@
import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
import org.jboss.portal.portlet.invocation.response.UpdateNavigationalStateResponse;
import org.jboss.portal.portlet.invocation.ActionInvocation;
-import org.jboss.portal.portlet.invocation.EventInvocation;
import org.jboss.portal.common.util.Tools;
import org.jboss.unit.api.pojo.annotations.Test;
import org.jboss.unit.api.pojo.annotations.Create;
import static org.jboss.unit.api.Assert.*;
import javax.xml.namespace.QName;
-import java.io.Serializable;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -128,7 +129,7 @@
PortletSupport fooPortlet = invoker.addPortlet("foo");
PortletSupport barPortlet = invoker.addPortlet("bar");
EventProducerActionHandler eventProducerHandler = new
EventProducerActionHandler(srcName);
- NoOpEventProcessor eventConsumer = new NoOpEventProcessor();
+ NoOpEventHandler eventConsumer = new NoOpEventHandler();
eventControllerContext.createWire(srcName, "foo", dstName,
"bar");
ControllerRequest request = context.createActionRequest("foo");
@@ -265,108 +266,4 @@
PageUpdateResponse updateResponse = assertInstanceOf(response,
PageUpdateResponse.class);
assertEquals(PortletResponse.INTERRUPTED,
updateResponse.getEventDistributionStatus());
}
-
- @Test
- public void testEventControllerContextFails() throws PortletInvokerException
- {
- QName srcName = new QName("juu", "foo");
- PortletSupport fooPortlet = invoker.addPortlet("foo");
- eventControllerContext.createWire(srcName, "foo", srcName,
"foo");
- ControllerRequest request = context.createActionRequest("foo");
-
- //
- EventProducerActionHandler eventProducerActionHandler = new
EventProducerActionHandler(srcName);
-
- // We test that a runtime exception thrown does not interrrupt the flow of the
controller
- controller.setConsumedEventThreshold(10);
- controller.setProducedEventThreshold(10);
- context.setEventControllerContext(new AbstractEventControllerContext()
- {
- public void eventProduced(EventPhaseContext context, Event sourceEvent, Event
producedEvent)
- {
- throw new RuntimeException();
- }
- });
- fooPortlet.addHandler(eventProducerActionHandler);
- ControllerResponse response = controller.process(context, request);
- PageUpdateResponse updateResponse = assertInstanceOf(response,
PageUpdateResponse.class);
- assertEquals(PortletResponse.DISTRIBUTION_DONE,
updateResponse.getEventDistributionStatus());
-
- // We test than an error thrown interrupts the flow of the controller
- final Error error = new Error();
- context.setEventControllerContext(new AbstractEventControllerContext()
- {
- public void eventProduced(EventPhaseContext context, Event sourceEvent, Event
producedEvent)
- {
- throw error;
- }
- });
- fooPortlet.addHandler(eventProducerActionHandler);
- try
- {
- controller.process(context, request);
- fail();
- }
- catch (Error ignore)
- {
- assertSame(error, ignore);
- }
- }
-
- private static class EventProducerActionHandler extends PortletSupport.ActionHandler
- {
-
- /** . */
- private final QName name;
-
- private EventProducerActionHandler(QName name)
- {
- this.name = name;
- }
-
- protected PortletInvocationResponse invoke(ActionInvocation action) throws
PortletInvokerException
- {
- UpdateNavigationalStateResponse update = new UpdateNavigationalStateResponse();
- update.queueEvent(new UpdateNavigationalStateResponse.Event(name, null));
- return update;
- }
- }
-
- private static class EventProducerEventHandler extends PortletSupport.EventHandler
- {
-
- /** . */
- private final QName name;
-
- private EventProducerEventHandler(QName name)
- {
- this.name = name;
- }
-
- protected PortletInvocationResponse invoke(EventInvocation action) throws
PortletInvokerException
- {
- UpdateNavigationalStateResponse update = new UpdateNavigationalStateResponse();
- update.queueEvent(new UpdateNavigationalStateResponse.Event(name, null));
- return update;
- }
- }
-
- private static class NoOpEventProcessor extends PortletSupport.EventHandler
- {
-
- /** . */
- private QName name;
-
- /** . */
- private Serializable payload;
-
- protected PortletInvocationResponse invoke(EventInvocation action) throws
PortletInvokerException
- {
- name = action.getName();
- payload = action.getPayload();
-
- //
- return new UpdateNavigationalStateResponse();
- }
- }
}
Added:
modules/portlet/trunk/controller/src/test/java/org/jboss/portal/portlet/controller/handlers/EventProducerActionHandler.java
===================================================================
---
modules/portlet/trunk/controller/src/test/java/org/jboss/portal/portlet/controller/handlers/EventProducerActionHandler.java
(rev 0)
+++
modules/portlet/trunk/controller/src/test/java/org/jboss/portal/portlet/controller/handlers/EventProducerActionHandler.java 2008-03-10
23:27:00 UTC (rev 10253)
@@ -0,0 +1,54 @@
+/******************************************************************************
+ * 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.portlet.controller.handlers;
+
+import org.jboss.portal.portlet.support.PortletSupport;
+import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
+import org.jboss.portal.portlet.invocation.response.UpdateNavigationalStateResponse;
+import org.jboss.portal.portlet.invocation.ActionInvocation;
+import org.jboss.portal.portlet.PortletInvokerException;
+
+import javax.xml.namespace.QName;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien
Viet</a>
+ * @version $Revision: 630 $
+ */
+public class EventProducerActionHandler extends PortletSupport.ActionHandler
+{
+
+ /** . */
+ private final QName name;
+
+ public EventProducerActionHandler(QName name)
+ {
+ this.name = name;
+ }
+
+ protected PortletInvocationResponse invoke(ActionInvocation action) throws
PortletInvokerException
+ {
+ UpdateNavigationalStateResponse update = new UpdateNavigationalStateResponse();
+ update.queueEvent(new UpdateNavigationalStateResponse.Event(name, null));
+ return update;
+ }
+}
Added:
modules/portlet/trunk/controller/src/test/java/org/jboss/portal/portlet/controller/handlers/EventProducerEventHandler.java
===================================================================
---
modules/portlet/trunk/controller/src/test/java/org/jboss/portal/portlet/controller/handlers/EventProducerEventHandler.java
(rev 0)
+++
modules/portlet/trunk/controller/src/test/java/org/jboss/portal/portlet/controller/handlers/EventProducerEventHandler.java 2008-03-10
23:27:00 UTC (rev 10253)
@@ -0,0 +1,54 @@
+/******************************************************************************
+ * 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.portlet.controller.handlers;
+
+import org.jboss.portal.portlet.support.PortletSupport;
+import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
+import org.jboss.portal.portlet.invocation.response.UpdateNavigationalStateResponse;
+import org.jboss.portal.portlet.invocation.EventInvocation;
+import org.jboss.portal.portlet.PortletInvokerException;
+
+import javax.xml.namespace.QName;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien
Viet</a>
+ * @version $Revision: 630 $
+ */
+public class EventProducerEventHandler extends PortletSupport.EventHandler
+{
+
+ /** . */
+ private final QName name;
+
+ public EventProducerEventHandler(QName name)
+ {
+ this.name = name;
+ }
+
+ protected PortletInvocationResponse invoke(EventInvocation action) throws
PortletInvokerException
+ {
+ UpdateNavigationalStateResponse update = new UpdateNavigationalStateResponse();
+ update.queueEvent(new UpdateNavigationalStateResponse.Event(name, null));
+ return update;
+ }
+}
Added:
modules/portlet/trunk/controller/src/test/java/org/jboss/portal/portlet/controller/handlers/FailingEventHandler.java
===================================================================
---
modules/portlet/trunk/controller/src/test/java/org/jboss/portal/portlet/controller/handlers/FailingEventHandler.java
(rev 0)
+++
modules/portlet/trunk/controller/src/test/java/org/jboss/portal/portlet/controller/handlers/FailingEventHandler.java 2008-03-10
23:27:00 UTC (rev 10253)
@@ -0,0 +1,60 @@
+/******************************************************************************
+ * 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.portlet.controller.handlers;
+
+import org.jboss.portal.portlet.support.PortletSupport;
+import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
+import org.jboss.portal.portlet.invocation.EventInvocation;
+import org.jboss.portal.portlet.PortletInvokerException;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien
Viet</a>
+ * @version $Revision: 630 $
+ */
+public class FailingEventHandler extends PortletSupport.EventHandler
+{
+
+ /** . */
+ private Throwable throwable;
+
+ public FailingEventHandler(Throwable throwable)
+ {
+ this.throwable = throwable;
+ }
+
+ protected PortletInvocationResponse invoke(EventInvocation action) throws
PortletInvokerException
+ {
+ if (throwable instanceof RuntimeException)
+ {
+ throw (RuntimeException)throwable;
+ }
+ else if (throwable instanceof Error)
+ {
+ throw (Error)throwable;
+ }
+ else
+ {
+ throw new AssertionError();
+ }
+ }
+}
Added:
modules/portlet/trunk/controller/src/test/java/org/jboss/portal/portlet/controller/handlers/NoOpEventHandler.java
===================================================================
---
modules/portlet/trunk/controller/src/test/java/org/jboss/portal/portlet/controller/handlers/NoOpEventHandler.java
(rev 0)
+++
modules/portlet/trunk/controller/src/test/java/org/jboss/portal/portlet/controller/handlers/NoOpEventHandler.java 2008-03-10
23:27:00 UTC (rev 10253)
@@ -0,0 +1,65 @@
+/******************************************************************************
+ * 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.portlet.controller.handlers;
+
+import org.jboss.portal.portlet.support.PortletSupport;
+import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
+import org.jboss.portal.portlet.invocation.response.UpdateNavigationalStateResponse;
+import org.jboss.portal.portlet.invocation.EventInvocation;
+import org.jboss.portal.portlet.PortletInvokerException;
+
+import javax.xml.namespace.QName;
+import java.io.Serializable;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien
Viet</a>
+ * @version $Revision: 630 $
+ */
+public class NoOpEventHandler extends PortletSupport.EventHandler
+{
+
+ /** . */
+ private QName name;
+
+ /** . */
+ private Serializable payload;
+
+ protected PortletInvocationResponse invoke(EventInvocation action) throws
PortletInvokerException
+ {
+ name = action.getName();
+ payload = action.getPayload();
+
+ //
+ return new UpdateNavigationalStateResponse();
+ }
+
+ public QName getName()
+ {
+ return name;
+ }
+
+ public Serializable getPayload()
+ {
+ return payload;
+ }
+}
Modified: modules/portlet/trunk/controller/src/test/resources/local-jboss-unit.xml
===================================================================
--- modules/portlet/trunk/controller/src/test/resources/local-jboss-unit.xml 2008-03-10
09:45:04 UTC (rev 10252)
+++ modules/portlet/trunk/controller/src/test/resources/local-jboss-unit.xml 2008-03-10
23:27:00 UTC (rev 10253)
@@ -7,5 +7,8 @@
<test>
<class
name="org.jboss.portal.portlet.controller.PortletControllerTestCase"/>
</test>
+ <test>
+ <class
name="org.jboss.portal.portlet.controller.EventControllerContextFailureTestCase"/>
+ </test>
</pojo>
</jboss-unit>