From 8ff150d539becc68714c28b32866e94f19593593 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9cile=20Vuilleumier?= Date: Mon, 6 May 2024 11:47:29 +0200 Subject: [PATCH] Add graticule extension --- README.md | 1 + .../ExtensionsAutoConfiguration.java | 4 +- .../graticule/GraticuleAutoConfiguration.java | 19 ++++++++ .../GraticuleAutoConfigurationTest.java | 46 +++++++++++++++++++ src/pom.xml | 15 ++++++ src/starters/vector-formats/pom.xml | 4 ++ 6 files changed, 88 insertions(+), 1 deletion(-) create mode 100644 src/apps/geoserver/webui/src/main/java/org/geoserver/cloud/autoconfigure/web/extension/graticule/GraticuleAutoConfiguration.java create mode 100644 src/apps/geoserver/webui/src/test/java/org/geoserver/cloud/autoconfigure/web/extension/graticule/GraticuleAutoConfigurationTest.java diff --git a/README.md b/README.md index a979241c6..7074a3086 100644 --- a/README.md +++ b/README.md @@ -56,6 +56,7 @@ Only a curated list of the [vast amount](http://geoserver.org/release/stable/) o - cog - importer - imagepyramid +- graticules Advanced ACL system is available through the project [GeoServer ACL](https://github.com/geoserver/geoserver-acl) which offers the same capacities as GeoFence. diff --git a/src/apps/geoserver/webui/src/main/java/org/geoserver/cloud/autoconfigure/web/extension/ExtensionsAutoConfiguration.java b/src/apps/geoserver/webui/src/main/java/org/geoserver/cloud/autoconfigure/web/extension/ExtensionsAutoConfiguration.java index ef2bd3dab..3ca3a79b3 100644 --- a/src/apps/geoserver/webui/src/main/java/org/geoserver/cloud/autoconfigure/web/extension/ExtensionsAutoConfiguration.java +++ b/src/apps/geoserver/webui/src/main/java/org/geoserver/cloud/autoconfigure/web/extension/ExtensionsAutoConfiguration.java @@ -4,12 +4,14 @@ */ package org.geoserver.cloud.autoconfigure.web.extension; +import org.geoserver.cloud.autoconfigure.web.extension.graticule.GraticuleAutoConfiguration; import org.geoserver.cloud.autoconfigure.web.extension.importer.ImporterAutoConfiguration; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; @Configuration @Import({ - ImporterAutoConfiguration.class // + ImporterAutoConfiguration.class, // + GraticuleAutoConfiguration.class }) public class ExtensionsAutoConfiguration {} diff --git a/src/apps/geoserver/webui/src/main/java/org/geoserver/cloud/autoconfigure/web/extension/graticule/GraticuleAutoConfiguration.java b/src/apps/geoserver/webui/src/main/java/org/geoserver/cloud/autoconfigure/web/extension/graticule/GraticuleAutoConfiguration.java new file mode 100644 index 000000000..f6aed1b0c --- /dev/null +++ b/src/apps/geoserver/webui/src/main/java/org/geoserver/cloud/autoconfigure/web/extension/graticule/GraticuleAutoConfiguration.java @@ -0,0 +1,19 @@ +/* + * (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.web.extension.graticule; + +import org.geoserver.cloud.config.factory.FilteringXmlBeanDefinitionReader; +import org.geotools.data.graticule.GraticuleDataStoreFactory; +import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.ImportResource; + +/** Auto configuration to enable the graticule customized store panel. */ +@Configuration +@ConditionalOnClass(GraticuleDataStoreFactory.class) +@ImportResource( // + reader = FilteringXmlBeanDefinitionReader.class, // + locations = {"jar:gs-graticule-.*!/applicationContext.xml"}) +public class GraticuleAutoConfiguration {} diff --git a/src/apps/geoserver/webui/src/test/java/org/geoserver/cloud/autoconfigure/web/extension/graticule/GraticuleAutoConfigurationTest.java b/src/apps/geoserver/webui/src/test/java/org/geoserver/cloud/autoconfigure/web/extension/graticule/GraticuleAutoConfigurationTest.java new file mode 100644 index 000000000..7e382746a --- /dev/null +++ b/src/apps/geoserver/webui/src/test/java/org/geoserver/cloud/autoconfigure/web/extension/graticule/GraticuleAutoConfigurationTest.java @@ -0,0 +1,46 @@ +/* + * (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.web.extension.graticule; + +import static org.assertj.core.api.Assertions.assertThat; + +import org.geoserver.web.data.resource.DataStorePanelInfo; +import org.geoserver.web.data.store.graticule.GraticuleStoreEditPanel; +import org.geotools.data.graticule.GraticuleDataStoreFactory; +import org.junit.jupiter.api.Test; +import org.springframework.boot.autoconfigure.AutoConfigurations; +import org.springframework.boot.test.context.runner.ApplicationContextRunner; + +/** + * Test suite for {@link GraticuleAutoConfiguration} + * + * @since 1.8 + */ +class GraticuleAutoConfigurationTest { + + private final ApplicationContextRunner contextRunner = + new ApplicationContextRunner() + .withConfiguration(AutoConfigurations.of(GraticuleAutoConfiguration.class)); + + @Test + void test_enabled() { + + contextRunner.run( + context -> { + assertThat(context) + .hasBean("graticuleStorePanel") + .getBean("graticuleStorePanel") + .isInstanceOf(DataStorePanelInfo.class); + + assertThat(context.getBean("graticuleStorePanel", DataStorePanelInfo.class)) + .hasFieldOrPropertyWithValue( + "factoryClass", GraticuleDataStoreFactory.class); + + assertThat(context.getBean("graticuleStorePanel", DataStorePanelInfo.class)) + .hasFieldOrPropertyWithValue( + "componentClass", GraticuleStoreEditPanel.class); + }); + } +} diff --git a/src/pom.xml b/src/pom.xml index 7192160ae..0f06a995b 100644 --- a/src/pom.xml +++ b/src/pom.xml @@ -652,6 +652,21 @@ + + org.geoserver.community + gs-graticule + ${gs.community.version} + + + org.apache.wicket + wicket-core + + + org.geoserver.web + gs-web-core + + + software.amazon.awssdk diff --git a/src/starters/vector-formats/pom.xml b/src/starters/vector-formats/pom.xml index a50a29e43..a296236f3 100644 --- a/src/starters/vector-formats/pom.xml +++ b/src/starters/vector-formats/pom.xml @@ -38,5 +38,9 @@ org.geoserver.extension gs-feature-pregeneralized + + org.geoserver.community + gs-graticule +