use of org.xwiki.observation.event.Event in project xwiki-platform by xwiki.
the class XClassPropertyEventGeneratorListenerTest method testDeleteDocument.
@Test
public void testDeleteDocument() throws ComponentLookupException {
this.xclassOrigin.addTextField("property", "Property", 30);
final Event event = new XClassPropertyDeletedEvent(this.xclassOrigin.getField("property").getReference());
this.mocker.getComponentUnderTest().onEvent(new DocumentDeletedEvent(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()));
}
use of org.xwiki.observation.event.Event in project xwiki-platform by xwiki.
the class XObjectEventGeneratorListenerTest method testDeleteDocument.
@Test
public void testDeleteDocument() throws ComponentLookupException {
this.documentOrigin.addXObject(this.xobject);
final Event event = new XObjectDeletedEvent(this.xobject.getReference());
this.mocker.getComponentUnderTest().onEvent(new DocumentDeletedEvent(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()));
}
use of org.xwiki.observation.event.Event in project xwiki-platform by xwiki.
the class XObjectEventGeneratorListenerTest method testModifiedDocumentXObjectPropertyModified.
@Test
public void testModifiedDocumentXObjectPropertyModified() throws ComponentLookupException {
this.xobject.setStringValue("updatedproperty", "propertyvalue");
BaseObject xobjectModified = this.xobject.clone();
xobjectModified.setStringValue("updatedproperty", "propertyvaluemodified");
this.document.addXObject(this.xobject);
this.documentOrigin.addXObject(xobjectModified);
final Event event = new XObjectPropertyUpdatedEvent(this.xobject.getField("updatedproperty").getReference());
this.mocker.getComponentUnderTest().onEvent(new DocumentUpdatedEvent(this.document.getDocumentReference()), this.document, this.oldcore.getXWikiContext());
// Make sure the listener generated a xobject property updated event
verify(this.mockObservation).notify(eq(event), same(this.document), same(this.oldcore.getXWikiContext()));
}
use of org.xwiki.observation.event.Event in project xwiki-platform by xwiki.
the class XObjectEventGeneratorListenerTest method testModifiedDocumentXObjectAdded.
@Test
public void testModifiedDocumentXObjectAdded() throws ComponentLookupException {
this.document.addXObject(this.xobject);
final Event event = new XObjectAddedEvent(this.xobject.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()));
}
use of org.xwiki.observation.event.Event in project celements-blog by celements.
the class ArticleUpdateListenerTest 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);
}
Aggregations