Search in sources :

Example 26 with ActionExecutingEvent

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

the class ActionExecutingEventTest method testMatchesSameAction.

@Test
public void testMatchesSameAction() {
    ActionExecutingEvent event = new ActionExecutingEvent("something");
    Assert.assertTrue("Same action wasn't matched!", event.matches(new ActionExecutingEvent("something")));
}
Also used : ActionExecutingEvent(org.xwiki.bridge.event.ActionExecutingEvent) Test(org.junit.Test)

Example 27 with ActionExecutingEvent

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

the class LegacyNotificationDispatcher method getEvents.

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

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

Example 28 with ActionExecutingEvent

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

the class ActionExecutingEventTest method testDoesntMatchDifferentCaseAction.

@Test
public void testDoesntMatchDifferentCaseAction() {
    ActionExecutingEvent event = new ActionExecutingEvent("something");
    Assert.assertFalse("Action matching was case insensitive!", event.matches(new ActionExecutingEvent("SomeThing")));
}
Also used : ActionExecutingEvent(org.xwiki.bridge.event.ActionExecutingEvent) Test(org.junit.Test)

Example 29 with ActionExecutingEvent

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

the class ActionExecutingEventTest method testCancelWithReason.

@Test
public void testCancelWithReason() {
    ActionExecutingEvent event = new ActionExecutingEvent("something");
    event.cancel("Testing reason");
    Assert.assertEquals("Cancelling reason was lost!", "Testing reason", event.getReason());
}
Also used : ActionExecutingEvent(org.xwiki.bridge.event.ActionExecutingEvent) Test(org.junit.Test)

Example 30 with ActionExecutingEvent

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

the class ActionExecutingEventTest method testHashCodeWithEmptyAction.

@Test
public void testHashCodeWithEmptyAction() {
    ActionExecutingEvent event = new ActionExecutingEvent("");
    Assert.assertTrue("Hashcode for empty string action wasn't zero!", event.hashCode() == 0);
}
Also used : ActionExecutingEvent(org.xwiki.bridge.event.ActionExecutingEvent) Test(org.junit.Test)

Aggregations

ActionExecutingEvent (org.xwiki.bridge.event.ActionExecutingEvent)37 Test (org.junit.Test)32 ActionExecutedEvent (org.xwiki.bridge.event.ActionExecutedEvent)9 XWikiContext (com.xpn.xwiki.XWikiContext)5 XWikiDocument (com.xpn.xwiki.doc.XWikiDocument)3 XWikiException (com.xpn.xwiki.XWikiException)2 XWikiRequest (com.xpn.xwiki.web.XWikiRequest)2 DocumentCreatedEvent (org.xwiki.bridge.event.DocumentCreatedEvent)2 DocumentCreatingEvent (org.xwiki.bridge.event.DocumentCreatingEvent)2 DocumentDeletedEvent (org.xwiki.bridge.event.DocumentDeletedEvent)2 DocumentDeletingEvent (org.xwiki.bridge.event.DocumentDeletingEvent)2 DocumentUpdatedEvent (org.xwiki.bridge.event.DocumentUpdatedEvent)2 DocumentUpdatingEvent (org.xwiki.bridge.event.DocumentUpdatingEvent)2 LESSContext (org.xwiki.lesscss.internal.LESSContext)2 DocumentReference (org.xwiki.model.reference.DocumentReference)2 ObservationManager (org.xwiki.observation.ObservationManager)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