From eb44b08d73faf47c4ddaef66fe84549c48fad1a4 Mon Sep 17 00:00:00 2001 From: Pierre Mauduit Date: Tue, 1 Oct 2024 17:21:37 +0200 Subject: [PATCH] gwc - cleaning up late comments on PR529 --- .../gwc/app/GeoWebCacheApplicationTest.java | 11 ---- .../gwc/GeoWebCacheUIAutoConfiguration.java | 65 +------------------ .../GeoWebCacheUIAutoConfigurationTest.java | 42 ------------ .../gwc/web/rest/GeoWebCacheController.java | 4 -- 4 files changed, 2 insertions(+), 120 deletions(-) delete mode 100644 src/gwc/autoconfigure/src/test/java/org/geoserver/cloud/autoconfigure/gwc/web/gwc/GeoWebCacheUIAutoConfigurationTest.java diff --git a/src/apps/geoserver/gwc/src/test/java/org/geoserver/cloud/gwc/app/GeoWebCacheApplicationTest.java b/src/apps/geoserver/gwc/src/test/java/org/geoserver/cloud/gwc/app/GeoWebCacheApplicationTest.java index af83b7a89..ea29252ce 100644 --- a/src/apps/geoserver/gwc/src/test/java/org/geoserver/cloud/gwc/app/GeoWebCacheApplicationTest.java +++ b/src/apps/geoserver/gwc/src/test/java/org/geoserver/cloud/gwc/app/GeoWebCacheApplicationTest.java @@ -11,7 +11,6 @@ import com.google.gson.JsonParser; import org.geoserver.catalog.GeoServerCatalogTestData; -import org.geoserver.gwc.controller.GwcUrlHandlerMapping; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -81,16 +80,6 @@ void testRESTPathExtensionContentNegotiation() { testGetRequestContentType("/gwc/rest/layers.xml", APPLICATION_XML); } - @Test - void testGwcUrlHandlerMappingArePresentInTheClasspath() { - assertThat(context.isTypeMatch("gwcDemoUrlHandlerMapping", GwcUrlHandlerMapping.class)) - .as("expected a bean gwcDemoUrlHandlerMapping of type GwcUrlHandlerMapping") - .isTrue(); - assertThat(context.isTypeMatch("gwcRestWebUrlHandlerMapping", GwcUrlHandlerMapping.class)) - .as("expected a bean gwcRestWebUrlHandlerMapping of type GwcUrlHandlerMapping") - .isTrue(); - } - @Test void testGeneralGwcHome() { ResponseEntity response = testGetRequestContentType("/gwc/home", TEXT_HTML); diff --git a/src/gwc/autoconfigure/src/main/java/org/geoserver/cloud/autoconfigure/web/gwc/GeoWebCacheUIAutoConfiguration.java b/src/gwc/autoconfigure/src/main/java/org/geoserver/cloud/autoconfigure/web/gwc/GeoWebCacheUIAutoConfiguration.java index c8849d58a..68e90e142 100644 --- a/src/gwc/autoconfigure/src/main/java/org/geoserver/cloud/autoconfigure/web/gwc/GeoWebCacheUIAutoConfiguration.java +++ b/src/gwc/autoconfigure/src/main/java/org/geoserver/cloud/autoconfigure/web/gwc/GeoWebCacheUIAutoConfiguration.java @@ -10,8 +10,6 @@ import org.geoserver.cloud.autoconfigure.gwc.ConditionalOnWebUIEnabled; import org.geoserver.cloud.gwc.config.core.GeoWebCacheConfigurationProperties; import org.geoserver.cloud.virtualservice.VirtualServiceVerifier; -import org.geoserver.gwc.controller.GwcUrlHandlerMapping; -import org.geoserver.ows.Dispatcher; import org.geowebcache.GeoWebCacheDispatcher; import org.geowebcache.rest.controller.ByteStreamController; import org.gwc.web.rest.GeoWebCacheController; @@ -33,10 +31,8 @@ public class GeoWebCacheUIAutoConfiguration { @Bean GeoWebCacheController gwcController( - Dispatcher geoserverDispatcher, - GeoWebCacheDispatcher geoWebCacheDispatcher, - VirtualServiceVerifier verifier) { - return new GeoWebCacheController(geoserverDispatcher, geoWebCacheDispatcher, verifier); + GeoWebCacheDispatcher geoWebCacheDispatcher, VirtualServiceVerifier verifier) { + return new GeoWebCacheController(geoWebCacheDispatcher, verifier); } /** ConditionalOnGeoWebCacheRestConfigEnabled} is disabled */ @@ -50,61 +46,4 @@ ByteStreamController byteStreamController() { VirtualServiceVerifier virtualServiceVerifier(@Qualifier("rawCatalog") Catalog catalog) { return new VirtualServiceVerifier(catalog); } - - /** - * GS's src/web/gwc/src/main/java/applicationContext.xml - * - * - * - * - * - * - * - */ - @Bean - @Qualifier("gwcDemoUrlHandlerMapping") - GwcUrlHandlerMapping gwcDemoUrlHandlerMapping(@Qualifier("rawCatalog") Catalog catalog) { - GwcUrlHandlerMapping handler = new GwcUrlHandlerMapping(catalog, "/gwc/demo"); - handler.setAlwaysUseFullPath(true); - handler.setOrder(10); - - return handler; - } - - /* - @Bean - WebMvcRegistrations gwcDemoUrlHandlerMappingRegistrations( - @Qualifier("gwcDemoUrlHandlerMapping") GwcUrlHandlerMapping handler) { - return new WebMvcRegistrations() { - @Override - public RequestMappingHandlerMapping getRequestMappingHandlerMapping() { - return handler; - } - }; - }*/ - - @Bean - @Qualifier("gwcRestWebUrlHandlerMapping") - GwcUrlHandlerMapping gwcRestWebUrlHandlerMapping(@Qualifier("rawCatalog") Catalog catalog) { - GwcUrlHandlerMapping handler = new GwcUrlHandlerMapping(catalog, "/gwc/rest/web"); - handler.setAlwaysUseFullPath(true); - handler.setOrder(10); - - return handler; - } - - /* - @Bean - WebMvcRegistrations gwcRestWebUrlHandlerMappingRegistrations( - @Qualifier("gwcRestWebUrlHandlerMapping") GwcUrlHandlerMapping handler) { - return new WebMvcRegistrations() { - @Override - public RequestMappingHandlerMapping getRequestMappingHandlerMapping() { - return handler; - } - }; - }*/ } diff --git a/src/gwc/autoconfigure/src/test/java/org/geoserver/cloud/autoconfigure/gwc/web/gwc/GeoWebCacheUIAutoConfigurationTest.java b/src/gwc/autoconfigure/src/test/java/org/geoserver/cloud/autoconfigure/gwc/web/gwc/GeoWebCacheUIAutoConfigurationTest.java deleted file mode 100644 index 95e48578e..000000000 --- a/src/gwc/autoconfigure/src/test/java/org/geoserver/cloud/autoconfigure/gwc/web/gwc/GeoWebCacheUIAutoConfigurationTest.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * (c) 2024 Open Source Geospatial Foundation - all rights reserved This code is licensed under the - * GPL 2.0 license, available at the root application directory. - */ -package org.geoserver.cloud.autoconfigure.gwc.web.gwc; - -import static org.junit.jupiter.api.Assertions.assertNotNull; - -import org.geoserver.cloud.autoconfigure.gwc.GeoWebCacheContextRunner; -import org.geoserver.cloud.autoconfigure.web.gwc.GeoWebCacheUIAutoConfiguration; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.io.TempDir; -import org.springframework.boot.autoconfigure.AutoConfigurations; -import org.springframework.boot.test.context.runner.WebApplicationContextRunner; - -import java.io.File; - -public class GeoWebCacheUIAutoConfigurationTest { - - WebApplicationContextRunner runner; - - @TempDir File tmpDir; - - @BeforeEach - void setUp() throws Exception { - runner = - GeoWebCacheContextRunner.newMinimalGeoWebCacheContextRunner(tmpDir) - .withPropertyValues("gwc.web-ui=true") - .withConfiguration( - AutoConfigurations.of(GeoWebCacheUIAutoConfiguration.class)); - } - - @Test - void beansForLocalWorkspacePathsHandlingArePresent() { - runner.run( - context -> { - assertNotNull(context.getBean("gwcDemoUrlHandlerMapping")); - assertNotNull(context.getBean("gwcRestWebUrlHandlerMapping")); - }); - } -} diff --git a/src/gwc/services/src/main/java/org/gwc/web/rest/GeoWebCacheController.java b/src/gwc/services/src/main/java/org/gwc/web/rest/GeoWebCacheController.java index a1f03d242..49b2d8a8b 100644 --- a/src/gwc/services/src/main/java/org/gwc/web/rest/GeoWebCacheController.java +++ b/src/gwc/services/src/main/java/org/gwc/web/rest/GeoWebCacheController.java @@ -9,7 +9,6 @@ import org.geoserver.cloud.virtualservice.VirtualServiceVerifier; import org.geoserver.gwc.dispatch.GeoServerGWCDispatcherController; -import org.geoserver.ows.Dispatcher; import org.geowebcache.GeoWebCacheDispatcher; import org.geowebcache.controller.GeoWebCacheDispatcherController; import org.springframework.stereotype.Controller; @@ -29,9 +28,6 @@ @Controller @RequiredArgsConstructor public class GeoWebCacheController { - - private final @NonNull Dispatcher geoserverDispatcher; - private final @NonNull GeoWebCacheDispatcher geoWebCacheDispatcher; private final @NonNull VirtualServiceVerifier virtualServiceVerifier;