notThrown = true;
}
assertFalse(notThrown);
// Reader Catalog
CoverageSlicesCatalog sliceCat = reader.getCatalog();
assertNotNull(sliceCat);
final Transaction t = new DefaultTransaction(Long.toString(System.nanoTime()));
try {
String[] typeNames = sliceCat.getTypeNames();
assertNull(typeNames);
// create new schema 1
final String schemaDef1 = "the_geom:Polygon,coverage:String,imageindex:Integer";
sliceCat.createType("1", schemaDef1);
typeNames = sliceCat.getTypeNames();
assertNotNull(typeNames);
assertEquals(1, typeNames.length);
// add features to it
SimpleFeatureType schema = DataUtilities.createType("1", schemaDef1);
SimpleFeature feat = DataUtilities.template(schema);
feat.setAttribute("coverage", "a");
feat.setAttribute("imageindex", Integer.valueOf(0));
ReferencedEnvelope referencedEnvelope = new ReferencedEnvelope(-180, 180, -90, 90,
DefaultGeographicCRS.WGS84);
feat.setAttribute("the_geom", GEOM_FACTORY.toGeometry(referencedEnvelope));
sliceCat.addGranule("1", feat, t);
t.commit();
// Check if present
Query q = new Query("1");
q.setFilter(Filter.INCLUDE);
// Get ImageIndexes
List<Integer> indexes = reader.getImageIndex(q);
assertNotNull(indexes);
assertTrue(!indexes.isEmpty());
} catch (Exception e) {
t.rollback();
} finally {
if (sliceCat != null) {
sliceCat.dispose();
}
t.close();
FileUtils.deleteDirectory(parentLocation);