diff --git a/src/apps/geoserver/restconfig/src/test/java/org/geoserver/cloud/restconfig/RestConfigApplicationTest.java b/src/apps/geoserver/restconfig/src/test/java/org/geoserver/cloud/restconfig/RestConfigApplicationTest.java index de1114d9d..914a11126 100644 --- a/src/apps/geoserver/restconfig/src/test/java/org/geoserver/cloud/restconfig/RestConfigApplicationTest.java +++ b/src/apps/geoserver/restconfig/src/test/java/org/geoserver/cloud/restconfig/RestConfigApplicationTest.java @@ -53,7 +53,7 @@ static void setUpDataDir(DynamicPropertyRegistry registry) throws IOException { } @BeforeEach - void before() throws Exception { + void before() { restTemplate = restTemplate.withBasicAuth("admin", "geoserver"); } diff --git a/src/apps/geoserver/wcs/src/test/java/org/geoserver/cloud/wcs/WcsApplicationTest.java b/src/apps/geoserver/wcs/src/test/java/org/geoserver/cloud/wcs/WcsApplicationTest.java index 80fbfc9a8..bac39ceae 100644 --- a/src/apps/geoserver/wcs/src/test/java/org/geoserver/cloud/wcs/WcsApplicationTest.java +++ b/src/apps/geoserver/wcs/src/test/java/org/geoserver/cloud/wcs/WcsApplicationTest.java @@ -6,7 +6,6 @@ import static org.assertj.core.api.Assertions.assertThat; -import java.io.IOException; import java.nio.file.Path; import java.util.stream.Stream; import org.junit.jupiter.api.Test; @@ -26,7 +25,7 @@ class WcsApplicationTest { static @TempDir Path datadir; @DynamicPropertySource - static void setUpDataDir(DynamicPropertyRegistry registry) throws IOException { + static void setUpDataDir(DynamicPropertyRegistry registry) { registry.add("geoserver.backend.data-directory.location", datadir::toAbsolutePath); } diff --git a/src/apps/geoserver/wfs/src/test/java/org/geoserver/cloud/wfs/app/WfsApplicationDataDirectoryIT.java b/src/apps/geoserver/wfs/src/test/java/org/geoserver/cloud/wfs/app/WfsApplicationDataDirectoryIT.java index b4752081c..c2b64cf75 100644 --- a/src/apps/geoserver/wfs/src/test/java/org/geoserver/cloud/wfs/app/WfsApplicationDataDirectoryIT.java +++ b/src/apps/geoserver/wfs/src/test/java/org/geoserver/cloud/wfs/app/WfsApplicationDataDirectoryIT.java @@ -4,7 +4,6 @@ */ package org.geoserver.cloud.wfs.app; -import java.io.IOException; import java.nio.file.Path; import org.junit.jupiter.api.io.TempDir; import org.springframework.boot.test.context.SpringBootTest; @@ -20,7 +19,7 @@ class WfsApplicationDataDirectoryIT extends WfsApplicationTest { static @TempDir Path datadir; @DynamicPropertySource - static void setUpDataDir(DynamicPropertyRegistry registry) throws IOException { + static void setUpDataDir(DynamicPropertyRegistry registry) { registry.add("geoserver.backend.data-directory.location", datadir::toAbsolutePath); } } diff --git a/src/apps/geoserver/wms/src/test/java/org/geoserver/cloud/wms/app/WmsApplicationDataDirectoryTest.java b/src/apps/geoserver/wms/src/test/java/org/geoserver/cloud/wms/app/WmsApplicationDataDirectoryTest.java index 7585cf93d..f7960ead4 100644 --- a/src/apps/geoserver/wms/src/test/java/org/geoserver/cloud/wms/app/WmsApplicationDataDirectoryTest.java +++ b/src/apps/geoserver/wms/src/test/java/org/geoserver/cloud/wms/app/WmsApplicationDataDirectoryTest.java @@ -4,7 +4,6 @@ */ package org.geoserver.cloud.wms.app; -import java.io.IOException; import java.nio.file.Path; import java.util.Map; import org.junit.jupiter.api.BeforeEach; @@ -29,7 +28,7 @@ class WmsApplicationDataDirectoryTest extends WmsApplicationTest { static @TempDir Path datadir; @DynamicPropertySource - static void setUpDataDir(DynamicPropertyRegistry registry) throws IOException { + static void setUpDataDir(DynamicPropertyRegistry registry) { var gwcdir = datadir.resolve("gwc"); registry.add("geoserver.backend.data-directory.location", datadir::toAbsolutePath); registry.add("gwc.cache-directory", gwcdir::toAbsolutePath); diff --git a/src/apps/geoserver/wps/src/test/java/org/geoserver/cloud/wps/WpsApplicationTest.java b/src/apps/geoserver/wps/src/test/java/org/geoserver/cloud/wps/WpsApplicationTest.java index 8a145b2fb..e85429570 100644 --- a/src/apps/geoserver/wps/src/test/java/org/geoserver/cloud/wps/WpsApplicationTest.java +++ b/src/apps/geoserver/wps/src/test/java/org/geoserver/cloud/wps/WpsApplicationTest.java @@ -4,7 +4,6 @@ */ package org.geoserver.cloud.wps; -import java.io.IOException; import java.nio.file.Path; import java.util.Map; import org.junit.jupiter.api.Test; @@ -25,7 +24,7 @@ class WpsApplicationTest { static @TempDir Path datadir; @DynamicPropertySource - static void setUpDataDir(DynamicPropertyRegistry registry) throws IOException { + static void setUpDataDir(DynamicPropertyRegistry registry) { var gwcdir = datadir.resolve("gwc"); registry.add("geoserver.backend.data-directory.location", datadir::toAbsolutePath); registry.add("gwc.cache-directory", gwcdir::toAbsolutePath); diff --git a/src/catalog/backends/datadir/src/test/java/org/geoserver/cloud/autoconfigure/catalog/backend/datadir/DataDirectoryUpdateSequenceTest.java b/src/catalog/backends/datadir/src/test/java/org/geoserver/cloud/autoconfigure/catalog/backend/datadir/DataDirectoryUpdateSequenceTest.java index 6b367a94e..f21b0744b 100644 --- a/src/catalog/backends/datadir/src/test/java/org/geoserver/cloud/autoconfigure/catalog/backend/datadir/DataDirectoryUpdateSequenceTest.java +++ b/src/catalog/backends/datadir/src/test/java/org/geoserver/cloud/autoconfigure/catalog/backend/datadir/DataDirectoryUpdateSequenceTest.java @@ -4,7 +4,6 @@ */ package org.geoserver.cloud.autoconfigure.catalog.backend.datadir; -import java.io.IOException; import java.nio.file.Path; import org.geoserver.cloud.config.catalog.backend.datadirectory.DataDirectoryBackendConfiguration; import org.geoserver.cloud.config.catalog.backend.datadirectory.DataDirectoryUpdateSequence; @@ -35,7 +34,7 @@ class DataDirectoryUpdateSequenceTest implements UpdateSequenceConformanceTest { static @TempDir Path datadir; @DynamicPropertySource - static void setUpDataDir(DynamicPropertyRegistry registry) throws IOException { + static void setUpDataDir(DynamicPropertyRegistry registry) { registry.add("geoserver.backend.data-directory.location", datadir::toAbsolutePath); } diff --git a/src/gwc/services/src/main/java/org/geoserver/cloud/gwc/config/services/RESTConfigConfiguration.java b/src/gwc/services/src/main/java/org/geoserver/cloud/gwc/config/services/RESTConfigConfiguration.java index adc9b4372..48c562fc7 100644 --- a/src/gwc/services/src/main/java/org/geoserver/cloud/gwc/config/services/RESTConfigConfiguration.java +++ b/src/gwc/services/src/main/java/org/geoserver/cloud/gwc/config/services/RESTConfigConfiguration.java @@ -55,12 +55,18 @@ @ConditionalOnClass(GWCConverter.class) @ComponentScan( basePackages = "org.geowebcache.rest", + // exclude org.geowebcache.controller.SeedController from component scan, provide an alternative that works with + // spring cloud below excludeFilters = @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, classes = SeedController.class)) public class RESTConfigConfiguration { + /** + * Replacement for {@link SeedController#doPost(javax.servlet.http.HttpServletRequest, java.io.InputStream, String, java.util.Map)} + * working wit spring-boot's stricter path pattern matching + */ @Bean - org.geoserver.cloud.gwc.config.services.SeedController seedController() { - return new org.geoserver.cloud.gwc.config.services.SeedController(); + org.geoserver.cloud.gwc.config.services.SeedControllerOverride seedController() { + return new org.geoserver.cloud.gwc.config.services.SeedControllerOverride(); } /** diff --git a/src/gwc/services/src/main/java/org/geoserver/cloud/gwc/config/services/SeedController.java b/src/gwc/services/src/main/java/org/geoserver/cloud/gwc/config/services/SeedControllerOverride.java similarity index 94% rename from src/gwc/services/src/main/java/org/geoserver/cloud/gwc/config/services/SeedController.java rename to src/gwc/services/src/main/java/org/geoserver/cloud/gwc/config/services/SeedControllerOverride.java index 4a08217ec..fd493074f 100644 --- a/src/gwc/services/src/main/java/org/geoserver/cloud/gwc/config/services/SeedController.java +++ b/src/gwc/services/src/main/java/org/geoserver/cloud/gwc/config/services/SeedControllerOverride.java @@ -14,7 +14,7 @@ @Component @RestController @RequestMapping(path = "${gwc.context.suffix:}/rest") -public class SeedController extends org.geowebcache.rest.controller.SeedController { +public class SeedControllerOverride extends org.geowebcache.rest.controller.SeedController { /** * diff --git a/src/starters/observability/src/main/java/org/geoserver/cloud/logging/accesslog/AccessLogFilterConfig.java b/src/starters/observability/src/main/java/org/geoserver/cloud/logging/accesslog/AccessLogFilterConfig.java index acb10a6d7..774532c45 100644 --- a/src/starters/observability/src/main/java/org/geoserver/cloud/logging/accesslog/AccessLogFilterConfig.java +++ b/src/starters/observability/src/main/java/org/geoserver/cloud/logging/accesslog/AccessLogFilterConfig.java @@ -83,8 +83,8 @@ Level getLogLevel(String uri) { } private boolean matches(String url, List patterns) { - return (patterns == null || patterns.isEmpty()) - ? false - : patterns.stream().anyMatch(pattern -> pattern.matcher(url).matches()); + return patterns != null + && !patterns.isEmpty() + && patterns.stream().anyMatch(pattern -> pattern.matcher(url).matches()); } }