@Test public void updateAuthor() throws Exception { this.request.setReplaceDocumentAuthor(true); this.request.setReplaceDocumentContentAuthor(true); when(this.document.getAuthorReference()).thenReturn(alice); when(this.document.getContentAuthorReference()).thenReturn(alice); this.replaceUserJob.update(this.document.getDocumentReference()); verify(this.document).setAuthorReference(bob); verify(this.document).setContentAuthorReference(bob); verify(this.xwiki).saveDocument(this.document, "Replaced user [test:Users.Alice] in fields [author, contentAuthor] to user [test:Users.Bob]", this.xcontext); }
@Override protected void update(DocumentReference documentReference) { XWikiContext xcontext = this.xcontextProvider.get(); try { update(xcontext.getWiki().getDocument(documentReference, xcontext)); } catch (XWikiException e) { this.logger.error("Failed to update document [{}]. Root cause is [{}].", documentReference, ExceptionUtils.getRootCauseMessage(e)); } }
ReplaceUserJob extends AbstractReplaceUserJob { @Override protected void update(DocumentReference documentReference) { XWikiContext xcontext = this.xcontextProvider.get(); try { update(xcontext.getWiki().getDocument(documentReference, xcontext)); } catch (XWikiException e) { this.logger.error("Failed to update document [{}]. Root cause is [{}].", documentReference, ExceptionUtils.getRootCauseMessage(e)); } } }
ReplaceUserJob extends AbstractReplaceUserJob { @Override protected void update(DocumentReference documentReference) { XWikiContext xcontext = this.xcontextProvider.get(); try { update(xcontext.getWiki().getDocument(documentReference, xcontext)); } catch (XWikiException e) { this.logger.error("Failed to update document [{}]. Root cause is [{}].", documentReference, ExceptionUtils.getRootCauseMessage(e)); } }  }
ReplaceUserJob extends AbstractReplaceUserJob { @Override protected void update(DocumentReference documentReference) { XWikiContext xcontext = this.xcontextProvider.get(); try { update(xcontext.getWiki().getDocument(documentReference, xcontext)); } catch (XWikiException e) { this.logger.error("Failed to update document [{}]. Root cause is [{}].", documentReference, ExceptionUtils.getRootCauseMessage(e)); } }   }
ReplaceUserJob extends AbstractReplaceUserJob { @Override protected void update(DocumentReference documentReference) { XWikiContext xcontext = this.xcontextProvider.get(); try { update(xcontext.getWiki().getDocument(documentReference, xcontext)); } catch (XWikiException e) { this.logger.error("Failed to update document [{}]. Root cause is [{}].", documentReference, ExceptionUtils.getRootCauseMessage(e)); } }    }