GSLayerEncoder layerEncoder=new GSLayerEncoder();
layerEncoder.setDefaultStyle(styleName);
LOGGER.info(layerEncoder.toString());
// creation test
RESTCoverageStore coverageStore =null;
try {
final File mosaicFile = new ClassPathResource("testdata/time_geotiff/").getFile();
if (!publisher.publishExternalMosaic(wsName,coverageStoreName,mosaicFile,coverageEncoder,layerEncoder)){
fail();
}
coverageStore = reader.getCoverageStore(wsName,coverageStoreName);
if (coverageStore==null){
LOGGER.error("*** coveragestore " + coverageStoreName + " has not been created.");
fail("*** coveragestore " + coverageStoreName + " has not been created.");
}
} catch (FileNotFoundException e) {
e.printStackTrace();
fail(e.getLocalizedMessage());
} catch (IOException e) {
e.printStackTrace();
fail(e.getLocalizedMessage());
}
// Get a Granule
String coverageName = "time_geotiff";
RESTStructuredCoverageGranulesList granules = reader.getGranules(wsName, coverageStoreName, coverageName, null, null, null);
String granuleId = granules.get(0).getFid();
// Test Granule Exists
assertTrue(reader.existsGranule(wsName, coverageStoreName, coverageName, granuleId));
// test a Granule does not exists
assertFalse(reader.existsGranule(wsName, coverageStoreName, coverageName, granuleId.substring(0, granuleId.indexOf(".")) + "." + granules.size() + 1));
// removing recursively coveragestore
boolean removed = publisher.removeCoverageStore(coverageStore.getWorkspaceName(), coverageStore.getName(), true);
if( ! removed ){
LOGGER.error("*** CoverageStore " + coverageStoreName + " has not been removed.");
fail("*** CoverageStore " + coverageStoreName + " has not been removed.");
}