use of org.xwiki.bridge.event.DocumentUpdatedEvent 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()));
}
use of org.xwiki.bridge.event.DocumentUpdatedEvent 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()));
}
use of org.xwiki.bridge.event.DocumentUpdatedEvent in project xwiki-platform by xwiki.
the class XObjectEventGeneratorListenerTest method testModifiedDocumentXObjectModified.
@Test
public void testModifiedDocumentXObjectModified() throws ComponentLookupException {
this.document.addXObject(this.xobject);
this.documentOrigin.addXObject(this.xobject.clone());
this.xobject.setStringValue("newproperty", "newvalue");
final Event event = new XObjectUpdatedEvent(this.xobject.getReference());
this.mocker.getComponentUnderTest().onEvent(new DocumentUpdatedEvent(this.document.getDocumentReference()), this.document, this.oldcore.getXWikiContext());
// Make sure the listener generated a xobject updated event
verify(this.mockObservation).notify(eq(event), same(this.document), same(this.oldcore.getXWikiContext()));
}
use of org.xwiki.bridge.event.DocumentUpdatedEvent in project xwiki-platform by xwiki.
the class XObjectEventGeneratorListenerTest method testModifiedDocumentXObjectPropertyAdded.
@Test
public void testModifiedDocumentXObjectPropertyAdded() throws ComponentLookupException {
this.document.addXObject(this.xobject);
this.documentOrigin.addXObject(this.xobject.clone());
this.xobject.setStringValue("newproperty", "newvalue");
final Event event = new XObjectPropertyAddedEvent(this.xobject.getField("newproperty").getReference());
this.mocker.getComponentUnderTest().onEvent(new DocumentUpdatedEvent(this.document.getDocumentReference()), this.document, this.oldcore.getXWikiContext());
// Make sure the listener generated a xobject property added event
verify(this.mockObservation).notify(eq(event), same(this.document), same(this.oldcore.getXWikiContext()));
}
use of org.xwiki.bridge.event.DocumentUpdatedEvent in project xwiki-platform by xwiki.
the class XObjectEventGeneratorListenerTest method testModifiedDocumentXObjectPropertyDeleted.
@Test
public void testModifiedDocumentXObjectPropertyDeleted() throws ComponentLookupException {
this.document.addXObject(this.xobject.clone());
this.documentOrigin.addXObject(this.xobject);
this.xobject.setStringValue("deletedproperty", "deletedvalue");
final Event event = new XObjectPropertyDeletedEvent(this.xobject.getField("deletedproperty").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()));
}
Aggregations