diff --git a/src/gwc/core/src/main/java/org/geoserver/cloud/gwc/repository/CachingTileLayerCatalog.java b/src/gwc/core/src/main/java/org/geoserver/cloud/gwc/repository/CachingTileLayerCatalog.java index 02c3f4f68..eba96f1ab 100644 --- a/src/gwc/core/src/main/java/org/geoserver/cloud/gwc/repository/CachingTileLayerCatalog.java +++ b/src/gwc/core/src/main/java/org/geoserver/cloud/gwc/repository/CachingTileLayerCatalog.java @@ -70,6 +70,11 @@ public void onTileLayerEvent(TileLayerEvent event) { } } + @Override + public Set getLayerIds() { + return Set.copyOf(this.namesById.keySet()); + } + @Override public Set getLayerNames() { return Set.copyOf(this.namesById.values()); diff --git a/src/gwc/core/src/test/java/org/geoserver/cloud/gwc/repository/CachingTileLayerCatalogTest.java b/src/gwc/core/src/test/java/org/geoserver/cloud/gwc/repository/CachingTileLayerCatalogTest.java index 46d8df5b2..aafefa385 100644 --- a/src/gwc/core/src/test/java/org/geoserver/cloud/gwc/repository/CachingTileLayerCatalogTest.java +++ b/src/gwc/core/src/test/java/org/geoserver/cloud/gwc/repository/CachingTileLayerCatalogTest.java @@ -138,12 +138,26 @@ public void onEvent(String layerId, Type type) { assertThat(caching.namesById.get("tl1")).isNull(); } + @Test + public void getLayerIds() { + add(catalog, "tl1"); + add(catalog, "tl2"); + assertThat(caching.getLayerIds()).isEmpty(); + caching.initialize(); + assertThat(caching.getLayerIds()).isEqualTo(catalog.getLayerIds()); + add(caching, "tl3"); + assertThat(caching.getLayerIds()).isEqualTo(catalog.getLayerIds()); + } + @Test public void getLayerNames() { add(catalog, "tl1"); add(catalog, "tl2"); + assertThat(caching.getLayerNames()).isEmpty(); caching.initialize(); assertThat(caching.getLayerNames()).isEqualTo(catalog.getLayerNames()); + add(caching, "tl3"); + assertThat(caching.getLayerNames()).isEqualTo(catalog.getLayerNames()); } @Test