}
public void testDeleteGridSet() throws InterruptedException {
// put some data into the two gridsets
String layerName = "topp:states";
TileSet tset1 = new TileSet(layerName, "EPSG:4326", "image/jpeg", null);
addToQuotaStore(tset1);
TileSet tset2 = new TileSet(layerName, "EPSG:900913", "image/jpeg", null);
addToQuotaStore(tset2);
Quota tset1Quota = store.getUsedQuotaByTileSetId(tset1.getId());
Quota tset2Quota = store.getUsedQuotaByTileSetId(tset2.getId());
Quota globalQuota = store.getGloballyUsedQuota();
Quota sum = new Quota();
sum.add(tset1Quota);
sum.add(tset2Quota);
assertEquals(globalQuota.getBytes(), sum.getBytes());
assertEquals(8, countTileSetsByLayerName("topp:states"));
store.deleteGridSubset("topp:states", "EPSG:900913");
assertEquals(4, countTileSetsByLayerName("topp:states"));
// verify the quota for tset2 got erased and that now the total is equal to tset1
tset1Quota = store.getUsedQuotaByTileSetId(tset1.getId());
tset2Quota = store.getUsedQuotaByTileSetId(tset2.getId());
globalQuota = store.getGloballyUsedQuota();
assertNull(tset2Quota);
assertEquals(tset1Quota.getBytes(), globalQuota.getBytes());
}