MARMOTTA-584: improved postgis version info
Project: http://git-wip-us.apache.org/repos/asf/marmotta/repo Commit: http://git-wip-us.apache.org/repos/asf/marmotta/commit/508b7ef1 Tree: http://git-wip-us.apache.org/repos/asf/marmotta/tree/508b7ef1 Diff: http://git-wip-us.apache.org/repos/asf/marmotta/diff/508b7ef1 Branch: refs/heads/MARMOTTA-584 Commit: 508b7ef199cefee4b6dd20066720e91005e9f322 Parents: 1af440e Author: Sergio Fernández <[email protected]> Authored: Fri Sep 11 13:34:28 2015 +0200 Committer: Sergio Fernández <[email protected]> Committed: Fri Sep 11 13:34:28 2015 +0200 ---------------------------------------------------------------------- .../kiwi/sparql/geosparql/GeoSPARQLFunctionsTest.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/marmotta/blob/508b7ef1/libraries/kiwi/kiwi-geosparql/src/test/java/org/apache/marmotta/kiwi/sparql/geosparql/GeoSPARQLFunctionsTest.java ---------------------------------------------------------------------- diff --git a/libraries/kiwi/kiwi-geosparql/src/test/java/org/apache/marmotta/kiwi/sparql/geosparql/GeoSPARQLFunctionsTest.java b/libraries/kiwi/kiwi-geosparql/src/test/java/org/apache/marmotta/kiwi/sparql/geosparql/GeoSPARQLFunctionsTest.java index f79a435..3063fe6 100644 --- a/libraries/kiwi/kiwi-geosparql/src/test/java/org/apache/marmotta/kiwi/sparql/geosparql/GeoSPARQLFunctionsTest.java +++ b/libraries/kiwi/kiwi-geosparql/src/test/java/org/apache/marmotta/kiwi/sparql/geosparql/GeoSPARQLFunctionsTest.java @@ -46,6 +46,8 @@ import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; /** * Test suite for all GeoSPARQL implemented functions. @@ -64,6 +66,8 @@ public class GeoSPARQLFunctionsTest { final Logger log = LoggerFactory.getLogger(this.getClass()); + final static public Pattern POSTGIS_FULL_VERSION = Pattern.compile("^POSTGIS\\=\"(\\d+(\\.\\d+)?(\\.\\d+)?(\\sr\\d+)?)\".*"); + private KiWiStore store; private KiWiSparqlSail sail; private Repository repository; @@ -125,7 +129,13 @@ public class GeoSPARQLFunctionsTest { try (PreparedStatement stmt = conn.prepareStatement("SELECT PostGIS_full_version();")) { ResultSet result = stmt.executeQuery(); if (result.next()) { - log.info("Using PostGIS {}...", result.getString("postgis_full_version")); + final String postgis_full_version = result.getString("postgis_full_version"); + final Matcher matcher = POSTGIS_FULL_VERSION.matcher(postgis_full_version); + if (matcher.find()) { + log.info("Using PostGIS {}...", matcher.group(1)); + } else { + log.info("Using PostGIS {}...", postgis_full_version); + } } }
