public void testInitialization() throws Exception {
Set<TileSet> tileSets = store.getTileSets();
assertNotNull(tileSets);
assertEquals(10, tileSets.size());
TileSet tileSet = new TileSet("topp:states", "EPSG:900913", "image/png", null);
assertTrue(tileSets.contains(tileSet));
tileSet = new TileSet("topp:states", "EPSG:900913", "image/jpeg", null);
assertTrue(tileSets.contains(tileSet));
tileSet = new TileSet("topp:states", "EPSG:900913", "image/gif", null);
assertTrue(tileSets.contains(tileSet));
tileSet = new TileSet("topp:states", "EPSG:900913", "application/vnd.google-earth.kml+xml",
null);
assertTrue(tileSets.contains(tileSet));
tileSet = new TileSet("topp:states", "EPSG:4326", "image/png", null);
assertTrue(tileSets.contains(tileSet));
tileSet = new TileSet("topp:states", "EPSG:4326", "image/jpeg", null);
assertTrue(tileSets.contains(tileSet));
tileSet = new TileSet("topp:states", "EPSG:4326", "image/gif", null);
assertTrue(tileSets.contains(tileSet));
tileSet = new TileSet("topp:states", "EPSG:4326", "application/vnd.google-earth.kml+xml",
null);
assertTrue(tileSets.contains(tileSet));
tileSet = new TileSet("topp:states2", "EPSG:2163", "image/png", null);
assertTrue(tileSets.contains(tileSet));
tileSet = new TileSet("topp:states2", "EPSG:2163", "image/jpeg", null);
assertTrue(tileSets.contains(tileSet));
// remove one layer from the dispatcher
Configuration configuration = layerDispatcher.removeLayer("topp:states");
configuration.save();
// and make sure at the next startup the store catches up (note this behaviour is just a
// startup consistency check in case the store got out of sync for some reason. On normal
// situations the store should have been notified through store.deleteLayer(layerName) if
// the layer was removed programmatically through StorageBroker.deleteLayer
store.close();
store.startUp();
tileSets = store.getTileSets();
assertNotNull(tileSets);
assertEquals(2, tileSets.size());
tileSet = new TileSet("topp:states2", "EPSG:2163", "image/png", null);
assertTrue(tileSets.contains(tileSet));
tileSet = new TileSet("topp:states2", "EPSG:2163", "image/jpeg", null);
assertTrue(tileSets.contains(tileSet));
}