@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()); verify(this.mockObservation).notify(eq(event), same(this.document), same(this.oldcore.getXWikiContext())); }
@Override public void onEvent(Event event, Object source, Object data) { XWikiDocument doc = (XWikiDocument) source; XWikiDocument originalDoc = doc.getOriginalDocument(); XWikiContext context = (XWikiContext) data; if (event instanceof DocumentUpdatedEvent) { onDocumentUpdatedEvent(originalDoc, doc, context); } else if (event instanceof DocumentDeletedEvent) { onDocumentDeletedEvent(originalDoc, doc, context); } else if (event instanceof DocumentCreatedEvent) { onDocumentCreatedEvent(originalDoc, doc, context); } }
XObjectEventGeneratorListener implements EventListener { @Override public void onEvent(Event event, Object source, Object data) { XWikiDocument doc = (XWikiDocument) source; XWikiDocument originalDoc = doc.getOriginalDocument(); XWikiContext context = (XWikiContext) data; if (event instanceof DocumentUpdatedEvent) { onDocumentUpdatedEvent(originalDoc, doc, context); } else if (event instanceof DocumentDeletedEvent) { onDocumentDeletedEvent(originalDoc, doc, context); } else if (event instanceof DocumentCreatedEvent) { onDocumentCreatedEvent(originalDoc, doc, context); } } }
XObjectEventGeneratorListener implements EventListener { @Override public void onEvent(Event event, Object source, Object data) { XWikiDocument doc = (XWikiDocument) source; XWikiDocument originalDoc = doc.getOriginalDocument(); XWikiContext context = (XWikiContext) data; if (event instanceof DocumentUpdatedEvent) { onDocumentUpdatedEvent(originalDoc, doc, context); } else if (event instanceof DocumentDeletedEvent) { onDocumentDeletedEvent(originalDoc, doc, context); } else if (event instanceof DocumentCreatedEvent) { onDocumentCreatedEvent(originalDoc, doc, context); } }  }
XObjectEventGeneratorListener implements EventListener { @Override public void onEvent(Event event, Object source, Object data) { XWikiDocument doc = (XWikiDocument) source; XWikiDocument originalDoc = doc.getOriginalDocument(); XWikiContext context = (XWikiContext) data; if (event instanceof DocumentUpdatedEvent) { onDocumentUpdatedEvent(originalDoc, doc, context); } else if (event instanceof DocumentDeletedEvent) { onDocumentDeletedEvent(originalDoc, doc, context); } else if (event instanceof DocumentCreatedEvent) { onDocumentCreatedEvent(originalDoc, doc, context); } }  @Override String getName(); @Override List<Event> getEvents(); @Override void onEvent(Event event, Object source, Object data); }
XObjectEventGeneratorListener implements EventListener { @Override public void onEvent(Event event, Object source, Object data) { XWikiDocument doc = (XWikiDocument) source; XWikiDocument originalDoc = doc.getOriginalDocument(); XWikiContext context = (XWikiContext) data; if (event instanceof DocumentUpdatedEvent) { onDocumentUpdatedEvent(originalDoc, doc, context); } else if (event instanceof DocumentDeletedEvent) { onDocumentDeletedEvent(originalDoc, doc, context); } else if (event instanceof DocumentCreatedEvent) { onDocumentCreatedEvent(originalDoc, doc, context); } }  @Override String getName(); @Override List<Event> getEvents(); @Override void onEvent(Event event, Object source, Object data);  }