use of org.xwiki.observation.event.DocumentSaveEvent in project xwiki-platform by xwiki.
the class DocumentEventTest method testMatchesWithDocumentNameConstructor.
@Test
public void testMatchesWithDocumentNameConstructor() {
DocumentSaveEvent event = new DocumentSaveEvent("document");
Assert.assertTrue(event.matches(new DocumentSaveEvent("document")));
Assert.assertFalse(event.matches(new DocumentSaveEvent("wrong")));
}
use of org.xwiki.observation.event.DocumentSaveEvent in project xwiki-platform by xwiki.
the class DocumentEventTest method testMatchesWithRegexFilter.
@Test
public void testMatchesWithRegexFilter() {
DocumentSaveEvent event = new DocumentSaveEvent(new RegexEventFilter(".*Doc.*"));
Assert.assertTrue(event.matches(new DocumentSaveEvent("some.Document")));
Assert.assertFalse(event.matches(new DocumentSaveEvent("some.document")));
}
use of org.xwiki.observation.event.DocumentSaveEvent in project xwiki-platform by xwiki.
the class DocumentEventTest method testMatchesWithEmptyConstructor.
@Test
public void testMatchesWithEmptyConstructor() {
DocumentSaveEvent event = new DocumentSaveEvent();
Assert.assertTrue(event.matches(new DocumentSaveEvent("whatever")));
}
use of org.xwiki.observation.event.DocumentSaveEvent 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());
}
Aggregations