}
// 1) Check that cite:Lakes
boolean foundLakes = false;
while(tlIter.hasNext()) {
TileLayer tl = tlIter.next();
if(tl.getName().equals("cite:Lakes")) {
//tl.isInitialized();
foundLakes = true;
break;
}
}
assertTrue(foundLakes);
// 2) Check sf:GenerictEntity is present and initialized
boolean foudAGF = false;
while(tlIter.hasNext()) {
TileLayer tl = tlIter.next();
System.out.println(tl.getName());
if(tl.getName().equals("sf:AggregateGeoFeature")) {
//tl.isInitialized();
foudAGF = true;
GridSubset epsg4326 = tl.getGridSubset(gwcListener.gridSetBroker.WORLD_EPSG4326.getName());
assertTrue(epsg4326.getGridSetBounds().equals( new BoundingBox(-180.0,-90.0,180.0,90.0)));
String mime = tl.getMimeTypes().get(1).getMimeType();
assertTrue(mime.startsWith("image/") || mime.startsWith("application/vnd.google-earth.kml+xml"));
}
}
assertTrue(foudAGF);
// 3) Basic get
LayerInfo li = cat.getLayers().get(1);
String layerName = li.getResource().getPrefixedName();
TileLayer tl = tld.getTileLayer(layerName);
assertEquals(layerName, tl.getName());
// 4) Removal of LayerInfo from catalog
cat.remove(li);
assertTrue(cat.getLayerByName(tl.getName()) == null);
boolean caughtException = false;
try {
TileLayer tl2 = tld.getTileLayer(layerName);
} catch (GeoWebCacheException gwce) {
caughtException = true;
}
assertTrue(caughtException);
// 5) Introducing new LayerInfo
LayerInfo layerInfo = cat.getFactory().createLayer();
layerInfo.setName("hithere");
ResourceInfo resInfo = li.getResource();
resInfo.setName("hithere");
resInfo.getNamespace().setPrefix("sf");
layerInfo.setResource(resInfo);
cat.add(layerInfo);
TileLayer tl3 = tld.getTileLayer("sf:hithere");
assertEquals(tl3.getName(),"sf:hithere");
}