use of org.xwiki.rendering.macro.chart.ChartMacroParameters in project xwiki-platform by xwiki.
the class ImageIdTest method testGetIdWithSameParametersButDifferentInstances.
/**
* Verify id are different even when using same parameters (but different instances of parameters).
*/
@Test
public void testGetIdWithSameParametersButDifferentInstances() {
ChartMacroParameters parameters1 = new ChartMacroParameters();
ChartMacroParameters parameters2 = new ChartMacroParameters();
Assert.assertFalse(new ImageId(parameters1).getId().equals(new ImageId(parameters2).getId()));
}
use of org.xwiki.rendering.macro.chart.ChartMacroParameters in project xwiki-platform by xwiki.
the class TemporaryChartImageWriterTest method getStorageLocation.
@Test
public void getStorageLocation() throws Exception {
WikiReference currentWikiReference = new WikiReference("wiki");
ModelContext modelContext = this.componentManager.getInstance(ModelContext.class);
when(modelContext.getCurrentEntityReference()).thenReturn(currentWikiReference);
Environment environment = this.componentManager.getInstance(Environment.class);
when(environment.getTemporaryDirectory()).thenReturn(new File("/tmpdir"));
File location = this.componentManager.getComponentUnderTest().getStorageLocation(new ImageId(new ChartMacroParameters()));
Assert.assertTrue("Got: " + location.toString(), location.toString().matches("/tmpdir/temp/chart/wiki/space/page/.*\\.png"));
}
use of org.xwiki.rendering.macro.chart.ChartMacroParameters in project xwiki-platform by xwiki.
the class TemporaryChartImageWriterTest method getURL.
@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"));
}
Aggregations