assertEquals("true", element.getNillable());
assertEquals("java.lang.Integer", element.getBinding());
}
}
RESTStructuredCoverageGranulesList granulesList = null;
RESTStructuredCoverageGranule granule = null;
// get with paging
granulesList = manager.getGranules(DEFAULT_WS, coverageStoreName, coverageName , null, 0, 1);
assertNotNull(granulesList);
assertEquals(1, granulesList.size());
assertFalse(granulesList.isEmpty());
granule = granulesList.get(0);
assertNotNull(granule);
granulesList = manager.getGranules(DEFAULT_WS, coverageStoreName, coverageName, null, null, 2);
assertNotNull(granulesList);
assertEquals(2, granulesList.size());
assertFalse(granulesList.isEmpty());
granule = granulesList.get(0);
assertNotNull(granule);
// get with no paging
granulesList = manager.getGranules(DEFAULT_WS, coverageStoreName, coverageName);
assertNotNull(granulesList);
assertEquals(4, granulesList.size());
assertFalse(granulesList.isEmpty());
granule = granulesList.get(0);
assertNotNull(granule);
// examples of filtering with CQL
granulesList = manager.getGranules(DEFAULT_WS, coverageStoreName, coverageName, "depth = 100", null, null);
assertNotNull(granulesList);
assertEquals(2, granulesList.size());
assertFalse(granulesList.isEmpty());
granule = granulesList.get(0);
assertNotNull(granule);
granulesList = manager.getGranules(DEFAULT_WS, coverageStoreName, coverageName, "depth = 100 AND date='20081101T0000000'", null, null);
assertNotNull(granulesList);
assertEquals(1, granulesList.size());
assertFalse(granulesList.isEmpty());
granule = granulesList.get(0);
assertNotNull(granule);
granulesList = manager.getGranules(DEFAULT_WS, coverageStoreName, coverageName, "location LIKE 'NCOM_wattemp%'", 0, 1);
assertNotNull(granulesList);
assertEquals(1, granulesList.size());
assertFalse(granulesList.isEmpty());
granule = granulesList.get(0);
assertNotNull(granule);
// remove by filter
final String fileLocation = "NCOM_wattemp_100_20081101T0000000_12.tiff";
boolean result = manager.removeGranulesByCQL(DEFAULT_WS, coverageStoreName, coverageName, "location = '" + fileLocation + "'");
Assert.assertTrue(result);
granulesList = manager.getGranules(DEFAULT_WS, coverageStoreName, coverageName);
assertNotNull(granulesList);
assertFalse(granulesList.isEmpty());
assertEquals(3, granulesList.size());
granule = granulesList.get(0);
assertNotNull(granule);
// Readding that granule with harvest
result = manager.harvestExternal(DEFAULT_WS, coverageStoreName, format, new ClassPathResource("testdata/granules/NCOM_wattemp_100_20081101T0000000_12.tiff").getFile().getAbsolutePath() );
Assert.assertTrue(result);
granulesList = manager.getGranules(DEFAULT_WS, coverageStoreName, coverageName, null, null, null);
assertNotNull(granulesList);
assertEquals(4, granulesList.size());
assertFalse(granulesList.isEmpty());
granule = granulesList.get(0);
assertNotNull(granule);
// delete
delete(DEFAULT_WS, coverageStoreName);