Search in sources :

Example 1 with FilterableEvent

use of org.xwiki.observation.event.FilterableEvent in project xwiki-platform by xwiki.

the class LegacyEventDispatcherTest method testLegacyDocumentUpdateEventGetsDispatched.

@Test
public void testLegacyDocumentUpdateEventGetsDispatched() throws Exception {
    this.registerListenerWithLegacyEvent(new DocumentUpdateEvent());
    this.om.notify(new DocumentUpdatedEvent(new DocumentReference("wiki", "space", "name")), null);
    // The notification is synchronous, so the following assertion will only be tested
    // once all matching event listeners have been notified.
    Assert.assertNotNull("Should have been notified by legacy event dispatcher", this.receivedEvent);
    Assert.assertEquals("Wrong event filter", "wiki:space.name", ((FilterableEvent) this.receivedEvent).getEventFilter().getFilter());
}
Also used : DocumentUpdateEvent(org.xwiki.observation.event.DocumentUpdateEvent) FilterableEvent(org.xwiki.observation.event.FilterableEvent) DocumentUpdatedEvent(org.xwiki.bridge.event.DocumentUpdatedEvent) DocumentReference(org.xwiki.model.reference.DocumentReference) Test(org.junit.Test)

Example 2 with FilterableEvent

use of org.xwiki.observation.event.FilterableEvent in project xwiki-platform by xwiki.

the class LegacyEventDispatcherTest method testLegacyDocumentDeleteEventGetsDispatched.

@Test
public void testLegacyDocumentDeleteEventGetsDispatched() throws Exception {
    this.registerListenerWithLegacyEvent(new DocumentDeleteEvent());
    this.om.notify(new DocumentDeletedEvent(new DocumentReference("wiki", "space", "name")), null);
    // The notification is synchronous, so the following assertion will only be tested
    // once all matching event listeners have been notified.
    Assert.assertNotNull("Should have been notified by legacy event dispatcher", this.receivedEvent);
    Assert.assertEquals("Wrong event filter", "wiki:space.name", ((FilterableEvent) this.receivedEvent).getEventFilter().getFilter());
}
Also used : DocumentDeleteEvent(org.xwiki.observation.event.DocumentDeleteEvent) DocumentDeletedEvent(org.xwiki.bridge.event.DocumentDeletedEvent) FilterableEvent(org.xwiki.observation.event.FilterableEvent) DocumentReference(org.xwiki.model.reference.DocumentReference) Test(org.junit.Test)

Example 3 with FilterableEvent

use of org.xwiki.observation.event.FilterableEvent in project xwiki-platform by xwiki.

the class LegacyEventDispatcherTest method testLegacyDocumentSaveEventGetsDispatched.

@Test
public void testLegacyDocumentSaveEventGetsDispatched() throws Exception {
    this.registerListenerWithLegacyEvent(new DocumentSaveEvent());
    this.om.notify(new DocumentCreatedEvent(new DocumentReference("wiki", "space", "name")), null);
    // The notification is synchronous, so the following assertion will only be tested
    // once all matching event listeners have been notified.
    Assert.assertNotNull("Should have been notified by legacy event dispatcher", this.receivedEvent);
    Assert.assertEquals("Wrong event filter", "wiki:space.name", ((FilterableEvent) this.receivedEvent).getEventFilter().getFilter());
}
Also used : FilterableEvent(org.xwiki.observation.event.FilterableEvent) DocumentCreatedEvent(org.xwiki.bridge.event.DocumentCreatedEvent) DocumentSaveEvent(org.xwiki.observation.event.DocumentSaveEvent) DocumentReference(org.xwiki.model.reference.DocumentReference) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)3 DocumentReference (org.xwiki.model.reference.DocumentReference)3 FilterableEvent (org.xwiki.observation.event.FilterableEvent)3 DocumentCreatedEvent (org.xwiki.bridge.event.DocumentCreatedEvent)1 DocumentDeletedEvent (org.xwiki.bridge.event.DocumentDeletedEvent)1 DocumentUpdatedEvent (org.xwiki.bridge.event.DocumentUpdatedEvent)1 DocumentDeleteEvent (org.xwiki.observation.event.DocumentDeleteEvent)1 DocumentSaveEvent (org.xwiki.observation.event.DocumentSaveEvent)1 DocumentUpdateEvent (org.xwiki.observation.event.DocumentUpdateEvent)1