instance, String strProvider, String strIconKey)
+ {
+ if ( instance.isAmbiguous( ) )
+ {
+ AppLogService.error( "icon API: Multiple providers found for '{}', iconKey '{}'", strProvider, strIconKey );
}
- catch ( NoSuchBeanDefinitionException e )
+ else
{
- AppLogService.error( "icon API: Missing strProvider " + strProvider + " , strIconKey " + strIconKey +
- ", exception " + e );
-
- return "default";
+ AppLogService.error( "icon API: Provider '{}' not found, iconKey '{}'", strProvider, strIconKey );
}
}
}
diff --git a/src/site/fr/xdoc/index.xml b/src/site/fr/xdoc/index.xml
index 9e66e18..1d45b20 100644
--- a/src/site/fr/xdoc/index.xml
+++ b/src/site/fr/xdoc/index.xml
@@ -18,11 +18,11 @@
Dans sa version actuelle, il n'intervient pas dans l'écriture du HTML/javascript, il fournit seulement des fonctionnalités coté serveur. L'utilisateur doit intégrer la carte dans sa page lui-même.
- Le mécanisme principal pour choisir des icône est de créer un bean spring "leaflet-icon-provider-XXX" qui implémente l'interface fr.paris.lutece.plugins.leaflet.service.IIconProvider. L'implémentation doit retourner un nom d'icône. Le code java générant la page peut alors appeler la fonction fr.paris.lutece.plugins.leaflet.service.IconService.getIcon() pour obtenir un nom d'icône pour la ressource.
+ Le mécanisme principal pour choisir des icône est de créer un bean CDI "leaflet-icon-provider-XXX" qui implémente l'interface fr.paris.lutece.plugins.leaflet.service.IIconProvider. L'implémentation doit retourner un nom d'icône. Le code java générant la page peut alors appeler la fonction fr.paris.lutece.plugins.leaflet.service.IconService.getIcon() pour obtenir un nom d'icône pour la ressource.
fr.paris.lutece.plugins.leaflet.service.IconService.getList() renvoie la liste des icônes disponibles, ce qui permet de faire des interfaces utilisateur permettant de choisir l'icône. Pour ajouter des icônes à cette liste, il faut insérer une valeur dans le datastore de la forme ('leaflet.icon.icons.ICON_NAME.installed', 'true').
- Le mécanisme principal pour obtenir des popups est de créer un bean spring "leaflet-rest-popup-provider-XXX" qui implémente l'interface fr.paris.lutece.plugins.leaflet.rest.service.IPopupContentProvider. L'implémentation doit produire des fragment d'html. Ils seront accessibles automatiquement à l'URL rest/leaflet/popup/{XXX}/{docid}/{code} et peuvent être chargés dynamiquement quand l'utilisateur clique sur le marqueur en AJAX.
+ Le mécanisme principal pour obtenir des popups est de créer un bean CDI "leaflet-rest-popup-provider-XXX" qui implémente l'interface fr.paris.lutece.plugins.leaflet.rest.service.IPopupContentProvider. L'implémentation doit produire des fragment d'html. Ils seront accessibles automatiquement à l'URL rest/leaflet/popup/{XXX}/{docid}/{code} et peuvent être chargés dynamiquement quand l'utilisateur clique sur le marqueur en AJAX.
Les headers CORS peuvent être activés avec les propriétés suivantes:
- leaflet.cors.enabled (default false)
diff --git a/src/site/xdoc/index.xml b/src/site/xdoc/index.xml
index e455624..e86169c 100644
--- a/src/site/xdoc/index.xml
+++ b/src/site/xdoc/index.xml
@@ -18,11 +18,11 @@
In it's current form, it doesn't provide any html/javascript scaffolding, only server-side features. The user must integrate the map in a page itself.
- The main mechanism to use icons is to have a spring bean named "leaflet-icon-provider-XXX" implement the interface fr.paris.lutece.plugins.leaflet.service.IIconProvider. The implementor must return an icon name. The Java code for pages displaying the map can then call fr.paris.lutece.plugins.leaflet.service.IconService.getIcon() to retrieve the icon name from the resource.
+ The main mechanism to use icons is to have a CDI bean named "leaflet-icon-provider-XXX" implement the interface fr.paris.lutece.plugins.leaflet.service.IIconProvider. The implementor must return an icon name. The Java code for pages displaying the map can then call fr.paris.lutece.plugins.leaflet.service.IconService.getIcon() to retrieve the icon name from the resource.
fr.paris.lutece.plugins.leaflet.service.IconService.getList() can be used to get a List of available icons, for example to build GUIs for users to choose an icon. To add icons to this list, add an entry in the datastore in the form ('leaflet.icon.icons.ICON_NAME.installed', 'true').
- The main mechanism to use popups is to have a spring bean named "leaflet-rest-popup-provider-XXX" implement the interface fr.paris.lutece.plugins.leaflet.rest.service.IPopupContentProvider. The implementor must produce html snippets. They will be automatically accessible at the URL rest/leaflet/popup/{XXX}/{docid}/{code} and can be loaded when the user clicks a marker with AJAX.
+ The main mechanism to use popups is to have a CDI bean named "leaflet-rest-popup-provider-XXX" implement the interface fr.paris.lutece.plugins.leaflet.rest.service.IPopupContentProvider. The implementor must produce html snippets. They will be automatically accessible at the URL rest/leaflet/popup/{XXX}/{docid}/{code} and can be loaded when the user clicks a marker with AJAX.
CORS headers can be enabled with the following properties:
- leaflet.cors.enabled (default false)
diff --git a/src/test/java/fr/paris/lutece/plugins/leaflet/AllTests.java b/src/test/java/fr/paris/lutece/plugins/leaflet/AllTests.java
deleted file mode 100644
index 08cce68..0000000
--- a/src/test/java/fr/paris/lutece/plugins/leaflet/AllTests.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright (c) 2002-2015, Mairie de Paris
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice
- * and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright notice
- * and the following disclaimer in the documentation and/or other materials
- * provided with the distribution.
- *
- * 3. Neither the name of 'Mairie de Paris' nor 'Lutece' nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * License 1.0
- */
-package fr.paris.lutece.plugins.leaflet;
-
-import fr.paris.lutece.plugins.leaflet.business.GeolocItemTest;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-
-public final class AllTests
-{
- /**
- * Constructor (private)
- */
- private AllTests( )
- {
- }
-
- /**
- * A set of tests
- * @return Test the tests
- */
- public static Test suite( )
- {
- TestSuite suite = new TestSuite( "Test of the package fr.paris.lutece.plugins.leaflet" );
-
- //$JUnit-BEGIN$
- // Add tests of the current package
- suite.addTest( new TestSuite( GeolocItemTest.class ) );
-
- // Add tests of sublevel packages
- //suite.addTest( fr.paris.lutece.plugins.myplugin.business.AllTests.suite( ) );
- //suite.addTest( fr.paris.lutece.plugins.myplugin.web.AllTests.suite( ) );
-
- //$JUnit-END$
- return suite;
- }
-}
diff --git a/src/test/java/fr/paris/lutece/plugins/leaflet/business/GeolocItemTest.java b/src/test/java/fr/paris/lutece/plugins/leaflet/business/GeolocItemTest.java
index de7f365..17af913 100644
--- a/src/test/java/fr/paris/lutece/plugins/leaflet/business/GeolocItemTest.java
+++ b/src/test/java/fr/paris/lutece/plugins/leaflet/business/GeolocItemTest.java
@@ -33,30 +33,34 @@
*/
package fr.paris.lutece.plugins.leaflet.business;
-import junit.framework.TestCase;
-
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
+import org.junit.jupiter.api.Test;
import java.io.IOException;
import java.util.Arrays;
import java.util.HashMap;
+import java.util.Map;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
-public class GeolocItemTest extends TestCase
+public class GeolocItemTest
{
- public void testSerialize( ) throws JsonParseException, JsonMappingException, IOException
+ @Test
+ void testSerialize( ) throws JsonParseException, JsonMappingException, IOException
{
GeolocItem ref = new GeolocItem( );
- HashMap pref = new HashMap( );
+ Map pref = new HashMap<>();
pref.put( "layer", "aco" );
pref.put( "icon", "ico" );
pref.put( "address", "addo" );
- HashMap gref = new HashMap( );
+ Map gref = new HashMap<>();
+ gref.put( "type", "Point" );
gref.put( "coordinates", Arrays.asList( new Double[] { 2.31272, 48.83632 } ) );
ref.setGeometry( gref );
ref.setProperties( pref );
@@ -70,27 +74,28 @@ public void testSerialize( ) throws JsonParseException, JsonMappingException, I
assert a.equals( b ) : "Parsing ref string and ref.toJSON should produce equal objects";
GeolocItem g = GeolocItem.fromJSON( s );
- assert g.getLonLat( ).equals( ref.getLonLat( ) ) : "Check serialized field";
- assert g.getAddress( ).equals( ref.getAddress( ) ) : "Check serialized field";
- assert g.getIcon( ).equals( ref.getIcon( ) ) : "Check serialized field";
- assert g.getLayer( ).equals( ref.getLayer( ) ) : "Check serialized field";
+ assertEquals( g.getLonLat( ), ref.getLonLat( ), "Check serialized field" );
+ assertEquals( g.getAddress( ), ref.getAddress( ), "Check serialized field" );
+ assertEquals( g.getIcon( ), ref.getIcon( ), "Check serialized field" );
+ assertEquals( g.getLayer( ), ref.getLayer( ), "Check serialized field" );
GeolocItem g2 = GeolocItem.fromJSON( g.toJSON( ) );
- assert g2.getLonLat( ).equals( ref.getLonLat( ) ) : "Check serialized field";
- assert g2.getAddress( ).equals( ref.getAddress( ) ) : "Check serialized field";
- assert g2.getIcon( ).equals( ref.getIcon( ) ) : "Check serialized field";
- assert g2.getLayer( ).equals( ref.getLayer( ) ) : "Check serialized field";
+ assertEquals( g2.getLonLat( ), ref.getLonLat( ), "Check serialized field" );
+ assertEquals( g2.getAddress( ), ref.getAddress( ), "Check serialized field" );
+ assertEquals( g2.getIcon( ), ref.getIcon( ), "Check serialized field" );
+ assertEquals( g2.getLayer( ), ref.getLayer( ), "Check serialized field" );
String strRefXML = "\r\n" + "2.31272\r\n" + "48.83632\r\n" +
"\r\n" + "ico\r\n" + "aco\r\n" +
"\r\n";
String strXML = ref.toXML( );
- assert strRefXML.equals( strXML ) : "Test xml marshalling: ref:\n" + strRefXML + "\n; got:\n" + strXML;
+ assertEquals( strRefXML, strXML, "Test xml marshalling: ref:\n" + strRefXML + "\n; got:\n" + strXML );
GeolocItem missingref = new GeolocItem( );
- HashMap missingpref = new HashMap( );
- HashMap missinggref = new HashMap( );
+ Map missingpref = new HashMap<>( );
+ Map missinggref = new HashMap<>( );
+ missinggref.put( "type", "Point" );
missinggref.put( "coordinates", Arrays.asList( new Double[] { 2.31272, 48.83632 } ) );
missingref.setGeometry( missinggref );
missingref.setProperties( missingpref );
@@ -99,14 +104,14 @@ public void testSerialize( ) throws JsonParseException, JsonMappingException, I
"\r\n";
String strMissingXML = missingref.toXML( );
- assert strMissingRefXML.equals( strMissingXML ) : "Test missing xml marshalling: ref:\n" + strRefXML +
- "\n; got:\n" + strXML;
+ assertEquals( strMissingRefXML, strMissingXML, "Test missing xml marshalling: ref:\n" + strRefXML +
+ "\n; got:\n" + strXML);
String smissing = "{\"type\":\"Feature\",\"geometry\":{\"type\":\"Point\",\"coordinates\":[2.31272,48.83632]},\"properties\":{}}";
JsonNode bmissing = objectMapper.readTree( smissing );
String jsonmissing = missingref.toJSON( );
JsonNode bmissingref = objectMapper.readTree( jsonmissing );
- assert bmissingref.equals( bmissing ) : "Parsing,for missing fields, ref string and ref.toJSON should produce equal objects. strings are: \n" +
- smissing + "\n and \n" + jsonmissing;
+ assertEquals( bmissingref, bmissing, "Parsing,for missing fields, ref string and ref.toJSON should produce equal objects. strings are: \n" +
+ smissing + "\n and \n" + jsonmissing );
}
}
diff --git a/src/test/java/fr/paris/lutece/plugins/leaflet/service/CorsUtilTest.java b/src/test/java/fr/paris/lutece/plugins/leaflet/service/CorsUtilTest.java
index 5638c83..7791e7f 100644
--- a/src/test/java/fr/paris/lutece/plugins/leaflet/service/CorsUtilTest.java
+++ b/src/test/java/fr/paris/lutece/plugins/leaflet/service/CorsUtilTest.java
@@ -33,22 +33,23 @@
*/
package fr.paris.lutece.plugins.leaflet.service;
-import static org.junit.Assert.assertTrue;
+import org.junit.jupiter.api.Test;
-import org.junit.Test;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* The Class CorsUtilTest.
*/
-public class CorsUtilTest {
+public class CorsUtilTest
+{
+
-
/**
* Checks if is valid origin test.
*/
@Test
- public void isValidOriginTest()
+ void isValidOriginTest()
{
String strPattern="https://*.paris.mdp:443/*,https://*.paris.mdp/*,https://*.paris.fr:443/*,https://*.paris.fr/*,https://*.paris.mdp:443,https://*.paris.mdp";
diff --git a/webapp/WEB-INF/conf/plugins/leaflet_context.xml b/webapp/WEB-INF/conf/plugins/leaflet_context.xml
deleted file mode 100644
index 62ac817..0000000
--- a/webapp/WEB-INF/conf/plugins/leaflet_context.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
-
-
-
-
diff --git a/webapp/WEB-INF/plugins/leaflet.xml b/webapp/WEB-INF/plugins/leaflet.xml
index 4b84d79..383aa21 100644
--- a/webapp/WEB-INF/plugins/leaflet.xml
+++ b/webapp/WEB-INF/plugins/leaflet.xml
@@ -1,7 +1,7 @@
leaflet
fr.paris.lutece.portal.service.plugin.PluginDefaultImplementation
- 1.0.5-SNAPSHOT
+ 2.0.0-SNAPSHOT
@@ -10,11 +10,11 @@
leaflet.plugin.provider
http://dev.lutece.paris.fr
images/admin/skin/feature_default_icon.png
- Copyright (c) 2015 Mairie de Paris
+ Copyright (c) 2025 Ville de Paris
0
- 4.1.0
+ 8.0.0