@Test void getXDOM() throws Exception { ResourceReference reference = new ResourceReference("reference", ResourceType.DOCUMENT); EntityReference documentReference = new DocumentReference("wiki", "space", "page"); when(this.referenceResolver.resolve(reference, EntityType.DOCUMENT)).thenReturn(documentReference); DocumentModelBridge dmb = mock(DocumentModelBridge.class); when(this.documentAccessBridge.getTranslatedDocumentInstance(documentReference)).thenReturn(dmb); XDOM xdom = new XDOM(Collections.emptyList()); when(dmb.getXDOM()).thenReturn(xdom); assertEquals(xdom, this.wikiModel.getXDOM(reference)); }
@Override public XDOM getXDOM(ResourceReference resourceReference) throws WikiModelException { EntityReference entityReference = getDocumentEntityReference(resourceReference); if (entityReference == null) { throw new IllegalArgumentException(String.valueOf(resourceReference)); } try { return this.documentAccessBridge.getTranslatedDocumentInstance(entityReference).getXDOM(); } catch (Exception e) { throw new WikiModelException(String.format("Failed to get XDOM for [%s]", resourceReference), e); } }
XWikiWikiModel implements WikiModel { @Override public XDOM getXDOM(ResourceReference resourceReference) throws WikiModelException { EntityReference entityReference = getDocumentEntityReference(resourceReference); if (entityReference == null) { throw new IllegalArgumentException(String.valueOf(resourceReference)); } try { return this.documentAccessBridge.getTranslatedDocumentInstance(entityReference).getXDOM(); } catch (Exception e) { throw new WikiModelException(String.format("Failed to get XDOM for [%s]", resourceReference), e); } } }
XWikiWikiModel implements WikiModel { @Override public XDOM getXDOM(ResourceReference resourceReference) throws WikiModelException { EntityReference entityReference = getDocumentEntityReference(resourceReference); if (entityReference == null) { throw new IllegalArgumentException(String.valueOf(resourceReference)); } try { return this.documentAccessBridge.getTranslatedDocumentInstance(entityReference).getXDOM(); } catch (Exception e) { throw new WikiModelException(String.format("Failed to get XDOM for [%s]", resourceReference), e); } }  }
XWikiWikiModel implements WikiModel { @Override public XDOM getXDOM(ResourceReference resourceReference) throws WikiModelException { EntityReference entityReference = getDocumentEntityReference(resourceReference); if (entityReference == null) { throw new IllegalArgumentException(String.valueOf(resourceReference)); } try { return this.documentAccessBridge.getTranslatedDocumentInstance(entityReference).getXDOM(); } catch (Exception e) { throw new WikiModelException(String.format("Failed to get XDOM for [%s]", resourceReference), e); } }  @Override String getLinkURL(ResourceReference linkReference); @Override String getImageURL(ResourceReference imageReference, Map<String, String> parameters); @Override boolean isDocumentAvailable(ResourceReference resourceReference); @Override String getDocumentViewURL(ResourceReference resourceReference); @Override String getDocumentEditURL(ResourceReference resourceReference); @Override XDOM getXDOM(ResourceReference resourceReference); }
XWikiWikiModel implements WikiModel { @Override public XDOM getXDOM(ResourceReference resourceReference) throws WikiModelException { EntityReference entityReference = getDocumentEntityReference(resourceReference); if (entityReference == null) { throw new IllegalArgumentException(String.valueOf(resourceReference)); } try { return this.documentAccessBridge.getTranslatedDocumentInstance(entityReference).getXDOM(); } catch (Exception e) { throw new WikiModelException(String.format("Failed to get XDOM for [%s]", resourceReference), e); } }  @Override String getLinkURL(ResourceReference linkReference); @Override String getImageURL(ResourceReference imageReference, Map<String, String> parameters); @Override boolean isDocumentAvailable(ResourceReference resourceReference); @Override String getDocumentViewURL(ResourceReference resourceReference); @Override String getDocumentEditURL(ResourceReference resourceReference); @Override XDOM getXDOM(ResourceReference resourceReference);  }