Search in sources :

Example 21 with Event

use of org.xwiki.observation.event.Event in project celements-blog by celements.

the class ArticleDeleteListenerTest method testDeletingEvent.

@Test
public void testDeletingEvent() {
    Event event = listener.getDeletingEvent(null);
    assertNotNull(event);
    assertSame(ArticleDeletingEvent.class, event.getClass());
    assertTrue(event.matches(new ArticleDeletingEvent()));
    assertNotSame(listener.getDeletingEvent(null), event);
}
Also used : ArticleDeletingEvent(com.celements.blog.observation.event.ArticleDeletingEvent) Event(org.xwiki.observation.event.Event) ArticleDeletedEvent(com.celements.blog.observation.event.ArticleDeletedEvent) ArticleDeletingEvent(com.celements.blog.observation.event.ArticleDeletingEvent) Test(org.junit.Test)

Example 22 with Event

use of org.xwiki.observation.event.Event in project celements-blog by celements.

the class ArticleDeleteListenerTest method testDeletedEvent.

@Test
public void testDeletedEvent() {
    Event event = listener.getDeletedEvent(null);
    assertNotNull(event);
    assertSame(ArticleDeletedEvent.class, event.getClass());
    assertTrue(event.matches(new ArticleDeletedEvent()));
    assertNotSame(listener.getDeletedEvent(null), event);
}
Also used : ArticleDeletingEvent(com.celements.blog.observation.event.ArticleDeletingEvent) Event(org.xwiki.observation.event.Event) ArticleDeletedEvent(com.celements.blog.observation.event.ArticleDeletedEvent) ArticleDeletedEvent(com.celements.blog.observation.event.ArticleDeletedEvent) Test(org.junit.Test)

Example 23 with Event

use of org.xwiki.observation.event.Event in project celements-blog by celements.

the class BlogDeleteListenerTest method testDeletedEvent.

@Test
public void testDeletedEvent() {
    Event event = listener.getDeletedEvent(null);
    assertNotNull(event);
    assertSame(BlogDeletedEvent.class, event.getClass());
    assertTrue(event.matches(new BlogDeletedEvent()));
    assertNotSame(listener.getDeletedEvent(null), event);
}
Also used : BlogDeletedEvent(com.celements.blog.observation.event.BlogDeletedEvent) BlogDeletingEvent(com.celements.blog.observation.event.BlogDeletingEvent) Event(org.xwiki.observation.event.Event) BlogDeletedEvent(com.celements.blog.observation.event.BlogDeletedEvent) Test(org.junit.Test)

Example 24 with Event

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

the class ActionExecutionEventTest method testActionExecutionEventEquals.

@Test
public void testActionExecutionEventEquals() {
    Event e1 = new ActionExecutionEvent("test");
    Event e2 = new ActionExecutionEvent("test");
    Event e3 = new ActionExecutionEvent("different");
    Assert.assertTrue(e1.equals(e1));
    Assert.assertTrue(e1.equals(e2));
    Assert.assertFalse(e1.equals(e3));
}
Also used : ActionExecutionEvent(org.xwiki.observation.event.ActionExecutionEvent) ActionExecutionEvent(org.xwiki.observation.event.ActionExecutionEvent) Event(org.xwiki.observation.event.Event) Test(org.junit.Test)

Example 25 with Event

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

the class CommentEventGeneratorListenerTest method testModifiedComment.

@Test
public void testModifiedComment() throws ComponentLookupException {
    this.document.addXObject(this.commentXObject);
    this.documentOrigin.addXObject(this.commentXObject.clone());
    this.commentXObject.setStringValue("comment", "comment");
    final Event event = new CommentUpdatedEvent("wiki:space.page", "0");
    this.mocker.getComponentUnderTest().onEvent(new XObjectUpdatedEvent(this.commentXObject.getReference()), this.document, this.oldcore.getXWikiContext());
    // Make sure the listener generated a comment updated event
    verify(this.mockObservation).notify(any(event.getClass()), same(document), same(this.oldcore.getXWikiContext()));
}
Also used : Event(org.xwiki.observation.event.Event) Test(org.junit.Test)

Aggregations

Event (org.xwiki.observation.event.Event)54 Test (org.junit.Test)48 DocumentDeletedEvent (org.xwiki.bridge.event.DocumentDeletedEvent)23 DocumentUpdatedEvent (org.xwiki.bridge.event.DocumentUpdatedEvent)23 DocumentCreatedEvent (org.xwiki.bridge.event.DocumentCreatedEvent)21 ArticleCreatingEvent (com.celements.blog.observation.event.ArticleCreatingEvent)9 BaseObject (com.xpn.xwiki.objects.BaseObject)9 ArticleCreatedEvent (com.celements.blog.observation.event.ArticleCreatedEvent)8 ArticleDeletedEvent (com.celements.blog.observation.event.ArticleDeletedEvent)8 ArticleDeletingEvent (com.celements.blog.observation.event.ArticleDeletingEvent)8 BlogCreatedEvent (com.celements.blog.observation.event.BlogCreatedEvent)8 BlogCreatingEvent (com.celements.blog.observation.event.BlogCreatingEvent)8 BlogDeletedEvent (com.celements.blog.observation.event.BlogDeletedEvent)8 BlogDeletingEvent (com.celements.blog.observation.event.BlogDeletingEvent)8 XWikiDocument (com.xpn.xwiki.doc.XWikiDocument)8 ArticleUpdatingEvent (com.celements.blog.observation.event.ArticleUpdatingEvent)7 ArrayList (java.util.ArrayList)7 ArticleUpdatedEvent (com.celements.blog.observation.event.ArticleUpdatedEvent)6 BlogUpdatedEvent (com.celements.blog.observation.event.BlogUpdatedEvent)6 BlogUpdatingEvent (com.celements.blog.observation.event.BlogUpdatingEvent)6