{
String mosaicDir = classFile.getAbsoluteFile().getParent();
UNREDDLayer layer = new UNREDDLayer();
layer.setAttribute(UNREDDLayer.Attributes.MOSAICPATH, mosaicDir);
RESTResource layerRes = layer.createRESTResource();
layerRes.setName(LAYERNAME);
gstcu.insert(layerRes);
}
// add a layerUpdate
{
gstcu.insertLayerUpdate(LAYERNAME, "2010", null, null);
}
// add a statsDef
{
File dataFile = loadFile("reprocess/stats/rdc_area.tif");
assertNotNull(dataFile);
String smallStat = " <statisticConfiguration>"
+ " <name>area_admin_small</name>"
+ " <title>Low resolution admin areas</title>"
+ " <description>Compute the area for the administrative areas. Low resolutions raster.</description>"
+ " <stats>"
+ " <stat>SUM</stat>"
+ " <stat>MIN</stat>"
+ " <stat>MAX</stat>"
+ " <stat>COUNT</stat>"
+ " </stats>"
+ " <deferredMode>true</deferredMode>"
+ " <dataLayer>"
+ " <file>"+dataFile.getAbsolutePath()+"</file>" // in production, this will be a fixed string as here
+ " </dataLayer>"
+ " <classificationLayer zonal=\"true\">"
+ " <file>{"+Tokens.FILEPATH+"}</file>" // in production, this will be expanded as a token as in here
+ " <nodata>65535</nodata>"
+ " </classificationLayer>"
+ " <output>"
+ " <format>CSV</format>"
+ " <separator>;</separator>"
+ " <NaNValue>-1</NaNValue>"
+ " </output>"
+ "</statisticConfiguration>";
UNREDDGeoStoreTestUtil.insertStatsDef(STATSDEFNAME, smallStat, LAYERNAME);
// Resource statsDef = gstcu.getFullResource(sdId);
}
// insert chartScript
{
File testScript = loadFile("configuration/script/testScript.groovy");
LOGGER.info("Test groovy script is " + testScript);
UNREDDChartScript chartScript = new UNREDDChartScript();
chartScript.setAttribute(Attributes.SCRIPTPATH, testScript.getAbsolutePath());
chartScript.addReverseAttribute(ReverseAttributes.STATSDEF, STATSDEFNAME);
RESTResource chartScriptRes = chartScript.createRESTResource();
chartScriptRes.setName("testChartScript");
gstcu.insert(chartScriptRes);
}
LOGGER.info("--------------- Data setup complete-- running real test ----------");