Search in sources :

Example 11 with ActionExecutedEvent

use of org.xwiki.bridge.event.ActionExecutedEvent in project xwiki-platform by xwiki.

the class ActionExecutedEventTest method testEqualsWithNull.

@Test
public void testEqualsWithNull() {
    ActionExecutedEvent event = new ActionExecutedEvent("something");
    Assert.assertFalse("null was equal!", event.equals(null));
}
Also used : ActionExecutedEvent(org.xwiki.bridge.event.ActionExecutedEvent) Test(org.junit.Test)

Example 12 with ActionExecutedEvent

use of org.xwiki.bridge.event.ActionExecutedEvent in project xwiki-platform by xwiki.

the class ActionExecutedEventTest method testDoesntMatchDifferentTypeOfAction.

@Test
public void testDoesntMatchDifferentTypeOfAction() {
    ActionExecutedEvent event = new ActionExecutedEvent("something");
    Assert.assertFalse("A different type of action was matched!", event.matches(new ActionExecutingEvent("something")));
}
Also used : ActionExecutedEvent(org.xwiki.bridge.event.ActionExecutedEvent) ActionExecutingEvent(org.xwiki.bridge.event.ActionExecutingEvent) Test(org.junit.Test)

Example 13 with ActionExecutedEvent

use of org.xwiki.bridge.event.ActionExecutedEvent in project xwiki-platform by xwiki.

the class ActionExecutedEventTest method testWildcardActionDoesntEqualOtherActions.

@Test
public void testWildcardActionDoesntEqualOtherActions() {
    ActionExecutedEvent event = new ActionExecutedEvent("something");
    Assert.assertFalse("Wildcard action equals another action!", new ActionExecutedEvent().equals(event));
}
Also used : ActionExecutedEvent(org.xwiki.bridge.event.ActionExecutedEvent) Test(org.junit.Test)

Example 14 with ActionExecutedEvent

use of org.xwiki.bridge.event.ActionExecutedEvent in project xwiki-platform by xwiki.

the class LegacyEventDispatcher method getEvents.

@Override
public List<Event> getEvents() {
    return new ArrayList<Event>() {

        {
            add(new DocumentDeletedEvent());
            add(new DocumentCreatedEvent());
            add(new DocumentUpdatedEvent());
            add(new ActionExecutedEvent());
        }
    };
}
Also used : DocumentDeletedEvent(org.xwiki.bridge.event.DocumentDeletedEvent) ArrayList(java.util.ArrayList) DocumentCreatedEvent(org.xwiki.bridge.event.DocumentCreatedEvent) ActionExecutedEvent(org.xwiki.bridge.event.ActionExecutedEvent) DocumentUpdatedEvent(org.xwiki.bridge.event.DocumentUpdatedEvent)

Example 15 with ActionExecutedEvent

use of org.xwiki.bridge.event.ActionExecutedEvent in project xwiki-platform by xwiki.

the class ActionExecutionEventConverter method toRemote.

@Override
public boolean toRemote(LocalEventData localEvent, RemoteEventData remoteEvent) {
    if (localEvent.getEvent() instanceof ActionExecutedEvent || localEvent.getEvent() instanceof ActionExecutingEvent) {
        AbstractActionExecutionEvent event = (AbstractActionExecutionEvent) localEvent.getEvent();
        if (this.actions.contains(event.getActionName())) {
            // fill the remote event
            remoteEvent.setEvent(event);
            remoteEvent.setSource(serializeXWikiDocument((XWikiDocument) localEvent.getSource()));
            remoteEvent.setData(serializeXWikiContext((XWikiContext) localEvent.getData()));
        }
        return true;
    }
    return false;
}
Also used : XWikiDocument(com.xpn.xwiki.doc.XWikiDocument) AbstractActionExecutionEvent(org.xwiki.bridge.event.AbstractActionExecutionEvent) ActionExecutedEvent(org.xwiki.bridge.event.ActionExecutedEvent) XWikiContext(com.xpn.xwiki.XWikiContext) ActionExecutingEvent(org.xwiki.bridge.event.ActionExecutingEvent)

Aggregations

ActionExecutedEvent (org.xwiki.bridge.event.ActionExecutedEvent)32 Test (org.junit.Test)25 ActionExecutingEvent (org.xwiki.bridge.event.ActionExecutingEvent)9 XWikiContext (com.xpn.xwiki.XWikiContext)4 XWikiDocument (com.xpn.xwiki.doc.XWikiDocument)4 XWikiException (com.xpn.xwiki.XWikiException)3 DocumentCreatedEvent (org.xwiki.bridge.event.DocumentCreatedEvent)3 DocumentDeletedEvent (org.xwiki.bridge.event.DocumentDeletedEvent)3 DocumentUpdatedEvent (org.xwiki.bridge.event.DocumentUpdatedEvent)3 ArrayList (java.util.ArrayList)2 DocumentCreatingEvent (org.xwiki.bridge.event.DocumentCreatingEvent)2 DocumentDeletingEvent (org.xwiki.bridge.event.DocumentDeletingEvent)2 DocumentUpdatingEvent (org.xwiki.bridge.event.DocumentUpdatingEvent)2 XWiki (com.xpn.xwiki.XWiki)1 MonitorPlugin (com.xpn.xwiki.monitor.api.MonitorPlugin)1 XWikiNotificationManager (com.xpn.xwiki.notify.XWikiNotificationManager)1 FileUploadPlugin (com.xpn.xwiki.plugin.fileupload.FileUploadPlugin)1 IOException (java.io.IOException)1 Collection (java.util.Collection)1 ServletException (javax.servlet.ServletException)1