@Test public void toCompatibleEntityReferenceWhenPage() { PageReference pageReference = new PageReference("wiki", "page"); DocumentReference documentReference = new DocumentReference("wiki", "page", "WebHome"); when(this.currentResolver.resolve(pageReference, pageReference.getType())).thenReturn(pageReference); doReturn(documentReference).when(this.oldcore.getSpyXWiki()).getDocumentReference(pageReference, this.oldcore.getXWikiContext()); assertEquals(documentReference, this.bridge.toCompatibleEntityReference(pageReference)); }
@Override public EntityReference toCompatibleEntityReference(EntityReference reference) { if (reference == null) { return reference; } EntityReference compatibleReference = this.currentResolver.resolve(reference, reference.getType()); if (compatibleReference.getType() == EntityType.PAGE || compatibleReference.getType().isAllowedAncestor(EntityType.PAGE)) { XWikiContext xcontext = this.xcontextProvider.get(); compatibleReference = xcontext.getWiki().getDocumentReference(reference, xcontext); } return compatibleReference; }
DefaultXWikiBridge implements XWikiBridge { @Override public EntityReference toCompatibleEntityReference(EntityReference reference) { if (reference == null) { return reference; } EntityReference compatibleReference = this.currentResolver.resolve(reference, reference.getType()); if (compatibleReference.getType() == EntityType.PAGE || compatibleReference.getType().isAllowedAncestor(EntityType.PAGE)) { XWikiContext xcontext = this.xcontextProvider.get(); compatibleReference = xcontext.getWiki().getDocumentReference(reference, xcontext); } return compatibleReference; } }
DefaultXWikiBridge implements XWikiBridge { @Override public EntityReference toCompatibleEntityReference(EntityReference reference) { if (reference == null) { return reference; } EntityReference compatibleReference = this.currentResolver.resolve(reference, reference.getType()); if (compatibleReference.getType() == EntityType.PAGE || compatibleReference.getType().isAllowedAncestor(EntityType.PAGE)) { XWikiContext xcontext = this.xcontextProvider.get(); compatibleReference = xcontext.getWiki().getDocumentReference(reference, xcontext); } return compatibleReference; }  }
DefaultXWikiBridge implements XWikiBridge { @Override public EntityReference toCompatibleEntityReference(EntityReference reference) { if (reference == null) { return reference; } EntityReference compatibleReference = this.currentResolver.resolve(reference, reference.getType()); if (compatibleReference.getType() == EntityType.PAGE || compatibleReference.getType().isAllowedAncestor(EntityType.PAGE)) { XWikiContext xcontext = this.xcontextProvider.get(); compatibleReference = xcontext.getWiki().getDocumentReference(reference, xcontext); } return compatibleReference; }  @Override WikiReference getMainWikiReference(); @Override boolean isWikiReadOnly(); @Override boolean needsAuthentication(Right right); @Override EntityReference toCompatibleEntityReference(EntityReference reference); }
DefaultXWikiBridge implements XWikiBridge { @Override public EntityReference toCompatibleEntityReference(EntityReference reference) { if (reference == null) { return reference; } EntityReference compatibleReference = this.currentResolver.resolve(reference, reference.getType()); if (compatibleReference.getType() == EntityType.PAGE || compatibleReference.getType().isAllowedAncestor(EntityType.PAGE)) { XWikiContext xcontext = this.xcontextProvider.get(); compatibleReference = xcontext.getWiki().getDocumentReference(reference, xcontext); } return compatibleReference; }  @Override WikiReference getMainWikiReference(); @Override boolean isWikiReadOnly(); @Override boolean needsAuthentication(Right right); @Override EntityReference toCompatibleEntityReference(EntityReference reference);  }