@Test public void getURL() throws Exception { WikiReference currentWikiReference = new WikiReference("wiki"); ModelContext modelContext = this.componentManager.getInstance(ModelContext.class); when(modelContext.getCurrentEntityReference()).thenReturn(currentWikiReference); DocumentAccessBridge dab = this.componentManager.getInstance(DocumentAccessBridge.class); when(dab.getDocumentURL(new DocumentReference("wiki", "space", "page"), "temp", null, null)).thenReturn( "temp/Space/Page"); String location = this.componentManager.getComponentUnderTest().getURL(new ImageId(new ChartMacroParameters())); Assert.assertTrue("Got: " + location, location.toString().matches("temp/Space/Page/chart/.*\\.png")); }
@Override public String getURL(ImageId imageId) throws MacroExecutionException { DocumentReference reference = new DocumentReference(getCurrentWiki(), SPACE, PAGE); String prefix = this.documentAccessBridge.getDocumentURL(reference, "temp", null, null); return String.format("%s/%s/%s.png", prefix, MODULE_NAME, imageId.getId()); }
TemporaryChartImageWriter implements ChartImageWriter { @Override public String getURL(ImageId imageId) throws MacroExecutionException { DocumentReference reference = new DocumentReference(getCurrentWiki(), SPACE, PAGE); String prefix = this.documentAccessBridge.getDocumentURL(reference, "temp", null, null); return String.format("%s/%s/%s.png", prefix, MODULE_NAME, imageId.getId()); } }
TemporaryChartImageWriter implements ChartImageWriter { @Override public String getURL(ImageId imageId) throws MacroExecutionException { DocumentReference reference = new DocumentReference(getCurrentWiki(), SPACE, PAGE); String prefix = this.documentAccessBridge.getDocumentURL(reference, "temp", null, null); return String.format("%s/%s/%s.png", prefix, MODULE_NAME, imageId.getId()); }  }
TemporaryChartImageWriter implements ChartImageWriter { @Override public String getURL(ImageId imageId) throws MacroExecutionException { DocumentReference reference = new DocumentReference(getCurrentWiki(), SPACE, PAGE); String prefix = this.documentAccessBridge.getDocumentURL(reference, "temp", null, null); return String.format("%s/%s/%s.png", prefix, MODULE_NAME, imageId.getId()); }  @Override void writeImage(ImageId imageId, byte[] imageData); @Override String getURL(ImageId imageId); }
TemporaryChartImageWriter implements ChartImageWriter { @Override public String getURL(ImageId imageId) throws MacroExecutionException { DocumentReference reference = new DocumentReference(getCurrentWiki(), SPACE, PAGE); String prefix = this.documentAccessBridge.getDocumentURL(reference, "temp", null, null); return String.format("%s/%s/%s.png", prefix, MODULE_NAME, imageId.getId()); }  @Override void writeImage(ImageId imageId, byte[] imageData); @Override String getURL(ImageId imageId);  }