Search in sources :

Example 26 with Event

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

the class XClassPropertyEventGeneratorListenerTest method testModifiedDocumentXClassPropertyAdded.

@Test
public void testModifiedDocumentXClassPropertyAdded() throws ComponentLookupException {
    this.xclass.addTextField("property", "Property", 30);
    final Event event = new XClassPropertyAddedEvent(this.xclass.getField("property").getReference());
    this.mocker.getComponentUnderTest().onEvent(new DocumentUpdatedEvent(this.document.getDocumentReference()), this.document, this.oldcore.getXWikiContext());
    // Make sure the listener generated a xobject added event
    verify(this.mockObservation).notify(eq(event), same(this.document), same(this.oldcore.getXWikiContext()));
}
Also used : DocumentCreatedEvent(org.xwiki.bridge.event.DocumentCreatedEvent) Event(org.xwiki.observation.event.Event) DocumentUpdatedEvent(org.xwiki.bridge.event.DocumentUpdatedEvent) DocumentDeletedEvent(org.xwiki.bridge.event.DocumentDeletedEvent) DocumentUpdatedEvent(org.xwiki.bridge.event.DocumentUpdatedEvent) Test(org.junit.Test)

Example 27 with Event

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

the class XClassPropertyEventGeneratorListenerTest method testAddDocument.

@Test
public void testAddDocument() throws ComponentLookupException {
    this.xclass.addTextField("property", "Property", 30);
    final Event event = new XClassPropertyAddedEvent(this.xclass.getField("property").getReference());
    this.mocker.getComponentUnderTest().onEvent(new DocumentCreatedEvent(this.document.getDocumentReference()), this.document, this.oldcore.getXWikiContext());
    // Make sure the listener generated a xobject added event
    verify(this.mockObservation).notify(eq(event), same(this.document), same(this.oldcore.getXWikiContext()));
}
Also used : DocumentCreatedEvent(org.xwiki.bridge.event.DocumentCreatedEvent) DocumentCreatedEvent(org.xwiki.bridge.event.DocumentCreatedEvent) Event(org.xwiki.observation.event.Event) DocumentUpdatedEvent(org.xwiki.bridge.event.DocumentUpdatedEvent) DocumentDeletedEvent(org.xwiki.bridge.event.DocumentDeletedEvent) Test(org.junit.Test)

Example 28 with Event

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

the class XClassPropertyEventGeneratorListenerTest method testModifiedDocumentXClassPropertyModified.

@Test
public void testModifiedDocumentXClassPropertyModified() throws ComponentLookupException {
    this.xclassOrigin.addTextField("property", "Property", 30);
    this.xclass.addTextField("property", "New Property", 30);
    final Event event = new XClassPropertyUpdatedEvent(this.xclassOrigin.getField("property").getReference());
    this.mocker.getComponentUnderTest().onEvent(new DocumentUpdatedEvent(this.document.getDocumentReference()), this.document, this.oldcore.getXWikiContext());
    // Make sure the listener generated a xobject added event
    verify(this.mockObservation).notify(eq(event), same(this.document), same(this.oldcore.getXWikiContext()));
}
Also used : DocumentCreatedEvent(org.xwiki.bridge.event.DocumentCreatedEvent) Event(org.xwiki.observation.event.Event) DocumentUpdatedEvent(org.xwiki.bridge.event.DocumentUpdatedEvent) DocumentDeletedEvent(org.xwiki.bridge.event.DocumentDeletedEvent) DocumentUpdatedEvent(org.xwiki.bridge.event.DocumentUpdatedEvent) Test(org.junit.Test)

Example 29 with Event

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

the class XClassPropertyEventGeneratorListenerTest method testModifiedDocumentXClassPropertyDeleted.

@Test
public void testModifiedDocumentXClassPropertyDeleted() throws ComponentLookupException {
    this.xclassOrigin.addTextField("property", "Property", 30);
    final Event event = new XClassPropertyDeletedEvent(this.xclassOrigin.getField("property").getReference());
    this.mocker.getComponentUnderTest().onEvent(new DocumentUpdatedEvent(this.document.getDocumentReference()), this.document, this.oldcore.getXWikiContext());
    // Make sure the listener generated a xobject added event
    verify(this.mockObservation).notify(eq(event), same(this.document), same(this.oldcore.getXWikiContext()));
}
Also used : DocumentCreatedEvent(org.xwiki.bridge.event.DocumentCreatedEvent) Event(org.xwiki.observation.event.Event) DocumentUpdatedEvent(org.xwiki.bridge.event.DocumentUpdatedEvent) DocumentDeletedEvent(org.xwiki.bridge.event.DocumentDeletedEvent) DocumentUpdatedEvent(org.xwiki.bridge.event.DocumentUpdatedEvent) Test(org.junit.Test)

Example 30 with Event

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

the class XObjectEventGeneratorListenerTest method testModifiedDocumentXObjectDeleted.

@Test
public void testModifiedDocumentXObjectDeleted() throws ComponentLookupException {
    this.documentOrigin.addXObject(this.xobject);
    final Event event = new XObjectDeletedEvent(this.xobject.getReference());
    this.mocker.getComponentUnderTest().onEvent(new DocumentUpdatedEvent(this.document.getDocumentReference()), this.document, this.oldcore.getXWikiContext());
    // Make sure the listener generated a xobject deleted event
    verify(this.mockObservation).notify(eq(event), same(this.document), same(this.oldcore.getXWikiContext()));
}
Also used : DocumentCreatedEvent(org.xwiki.bridge.event.DocumentCreatedEvent) Event(org.xwiki.observation.event.Event) DocumentUpdatedEvent(org.xwiki.bridge.event.DocumentUpdatedEvent) DocumentDeletedEvent(org.xwiki.bridge.event.DocumentDeletedEvent) DocumentUpdatedEvent(org.xwiki.bridge.event.DocumentUpdatedEvent) 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