diff --git a/pom.xml b/pom.xml index 3b49bc72b..032238414 100644 --- a/pom.xml +++ b/pom.xml @@ -1,8 +1,8 @@ - 3.0.4 - 1.7 + 3.1.0 + 1.8 3.1 1.4 2.6 @@ -21,7 +21,7 @@ 4.0.0 neo4j-spatial org.neo4j - 0.23-neo4j-3.0.4 + 0.24-neo4j-3.1.0 Neo4j - Spatial Components Spatial utilities and components for Neo4j http://components.neo4j.org/${project.artifactId}/${project.version} @@ -414,11 +414,12 @@ 1.1 jar - + + diff --git a/src/main/java/org/neo4j/gis/spatial/procedures/SpatialProcedures.java b/src/main/java/org/neo4j/gis/spatial/procedures/SpatialProcedures.java index 2de9cb755..7a143e803 100644 --- a/src/main/java/org/neo4j/gis/spatial/procedures/SpatialProcedures.java +++ b/src/main/java/org/neo4j/gis/spatial/procedures/SpatialProcedures.java @@ -25,7 +25,7 @@ import com.vividsolutions.jts.geom.Point; import com.vividsolutions.jts.io.ParseException; import com.vividsolutions.jts.io.WKTReader; -import org.neo4j.cypher.internal.compiler.v3_0.GeographicPoint; +import org.neo4j.cypher.internal.compiler.v3_1.GeographicPoint; import org.neo4j.gis.spatial.*; import org.neo4j.gis.spatial.encoders.SimpleGraphEncoder; import org.neo4j.gis.spatial.encoders.SimplePointEncoder; @@ -150,7 +150,7 @@ private static void populateEncoderClasses() { public Stream listProcedures() { Procedures procedures = ((GraphDatabaseAPI)db).getDependencyResolver().resolveDependency( Procedures.class ); Stream.Builder builder = Stream.builder(); - for (ProcedureSignature proc : procedures.getAll()) { + for (ProcedureSignature proc : procedures.getAllProcedures()) { if (proc.name().namespace()[0].equals("spatial")) { builder.accept(new NameResult(proc.name().toString(), proc.toString())); } @@ -645,15 +645,15 @@ private org.neo4j.graphdb.spatial.Geometry toNeo4jGeometry(Layer layer, Object v throw new RuntimeException("Can't convert " + value + " to a geometry"); } - private org.neo4j.cypher.internal.compiler.v3_0.Geometry makeCypherGeometry(double x, double y, org.neo4j.cypher.internal.compiler.v3_0.CRS crs) { - if (crs.equals(org.neo4j.cypher.internal.compiler.v3_0.CRS.Cartesian())) { - return new org.neo4j.cypher.internal.compiler.v3_0.CartesianPoint(x, y, crs); + private org.neo4j.cypher.internal.compiler.v3_1.Geometry makeCypherGeometry(double x, double y, org.neo4j.cypher.internal.compiler.v3_1.CRS crs) { + if (crs.equals(org.neo4j.cypher.internal.compiler.v3_1.CRS.Cartesian())) { + return new org.neo4j.cypher.internal.compiler.v3_1.CartesianPoint(x, y, crs); } else { - return new org.neo4j.cypher.internal.compiler.v3_0.GeographicPoint(x, y, crs); + return new org.neo4j.cypher.internal.compiler.v3_1.GeographicPoint(x, y, crs); } } - private org.neo4j.cypher.internal.compiler.v3_0.Geometry makeCypherGeometry(Geometry geometry, org.neo4j.cypher.internal.compiler.v3_0.CRS crs) { + private org.neo4j.cypher.internal.compiler.v3_1.Geometry makeCypherGeometry(Geometry geometry, org.neo4j.cypher.internal.compiler.v3_1.CRS crs) { if (geometry.getGeometryType().toLowerCase().equals("point")) { Coordinate coordinate = geometry.getCoordinates()[0]; return makeCypherGeometry(coordinate.getOrdinate(0), coordinate.getOrdinate(1), crs); @@ -662,27 +662,27 @@ private org.neo4j.cypher.internal.compiler.v3_0.Geometry makeCypherGeometry(Geom } } - private org.neo4j.cypher.internal.compiler.v3_0.Geometry toCypherGeometry(Layer layer, Object value) { - if (value instanceof org.neo4j.cypher.internal.compiler.v3_0.Geometry) { - return (org.neo4j.cypher.internal.compiler.v3_0.Geometry) value; + private org.neo4j.cypher.internal.compiler.v3_1.Geometry toCypherGeometry(Layer layer, Object value) { + if (value instanceof org.neo4j.cypher.internal.compiler.v3_1.Geometry) { + return (org.neo4j.cypher.internal.compiler.v3_1.Geometry) value; } if ( value instanceof org.neo4j.graphdb.spatial.Point) { org.neo4j.graphdb.spatial.Point point = (org.neo4j.graphdb.spatial.Point) value; List coord = point.getCoordinate().getCoordinate(); - return makeCypherGeometry(coord.get(0), coord.get(1), org.neo4j.cypher.internal.compiler.v3_0.CRS.fromSRID(point.getCRS().getCode())); + return makeCypherGeometry(coord.get(0), coord.get(1), org.neo4j.cypher.internal.compiler.v3_1.CRS.fromSRID(point.getCRS().getCode())); } - org.neo4j.cypher.internal.compiler.v3_0.CRS crs = org.neo4j.cypher.internal.compiler.v3_0.CRS.Cartesian(); + org.neo4j.cypher.internal.compiler.v3_1.CRS crs = org.neo4j.cypher.internal.compiler.v3_1.CRS.Cartesian(); if (layer != null) { CoordinateReferenceSystem layerCRS = layer.getCoordinateReferenceSystem(); if (layerCRS != null) { ReferenceIdentifier crsRef = layer.getCoordinateReferenceSystem().getName(); - crs = org.neo4j.cypher.internal.compiler.v3_0.CRS.fromName(crsRef.toString()); + crs = org.neo4j.cypher.internal.compiler.v3_1.CRS.fromName(crsRef.toString()); } } if (value instanceof Geometry) { Geometry geometry = (Geometry) value; if (geometry.getSRID() > 0) { - crs = org.neo4j.cypher.internal.compiler.v3_0.CRS.fromSRID(geometry.getSRID()); + crs = org.neo4j.cypher.internal.compiler.v3_1.CRS.fromSRID(geometry.getSRID()); } if (geometry instanceof Point) { Point point = (Point) geometry; @@ -704,7 +704,7 @@ private org.neo4j.cypher.internal.compiler.v3_0.Geometry toCypherGeometry(Layer if (value instanceof PropertyContainer) { latLon = ((PropertyContainer) value).getProperties("latitude", "longitude", "lat", "lon"); if (layer == null) { - crs = org.neo4j.cypher.internal.compiler.v3_0.CRS.WGS84(); + crs = org.neo4j.cypher.internal.compiler.v3_1.CRS.WGS84(); } } if (value instanceof Map) latLon = (Map) value; diff --git a/src/test/java/org/neo4j/gis/spatial/Neo4jTestCase.java b/src/test/java/org/neo4j/gis/spatial/Neo4jTestCase.java index 6089f9ed8..93ff7d858 100644 --- a/src/test/java/org/neo4j/gis/spatial/Neo4jTestCase.java +++ b/src/test/java/org/neo4j/gis/spatial/Neo4jTestCase.java @@ -44,7 +44,7 @@ import org.neo4j.graphdb.factory.GraphDatabaseSettings; import org.neo4j.graphdb.mockfs.EphemeralFileSystemAbstraction; import org.neo4j.io.fs.FileUtils; -import org.neo4j.test.EphemeralFileSystemRule; +import org.neo4j.test.rule.fs.EphemeralFileSystemRule; import org.neo4j.unsafe.batchinsert.BatchInserter; import org.neo4j.unsafe.batchinsert.BatchInserters; diff --git a/src/test/java/org/neo4j/gis/spatial/SpatialPluginFunctionalTest.java b/src/test/java/org/neo4j/gis/spatial/SpatialPluginFunctionalTest.java index 9d6044514..414be822d 100644 --- a/src/test/java/org/neo4j/gis/spatial/SpatialPluginFunctionalTest.java +++ b/src/test/java/org/neo4j/gis/spatial/SpatialPluginFunctionalTest.java @@ -19,17 +19,12 @@ */ package org.neo4j.gis.spatial; -import static junit.framework.Assert.assertEquals; -import static junit.framework.TestCase.assertFalse; import static org.junit.Assert.assertTrue; import java.io.IOException; -import java.io.PrintWriter; import java.io.UnsupportedEncodingException; import javax.ws.rs.core.Response.Status; -import org.codehaus.jackson.JsonNode; -import org.codehaus.jackson.map.ObjectMapper; import org.json.simple.JSONArray; import org.json.simple.JSONObject; import org.json.simple.parser.JSONParser; @@ -40,8 +35,7 @@ import org.junit.Test; import org.neo4j.graphdb.GraphDatabaseService; -import org.neo4j.graphdb.Result; -import org.neo4j.helpers.HostnamePort; +import org.neo4j.helpers.ListenSocketAddress; import org.neo4j.kernel.impl.annotations.Documented; import org.neo4j.server.NeoServer; import org.neo4j.server.helpers.CommunityServerBuilder; @@ -64,7 +58,7 @@ public class SpatialPluginFunctionalTest extends AbstractRestFunctionalTestBase */ @BeforeClass public static void allocateServer() throws IOException { - altServer = CommunityServerBuilder.server().onAddress( new HostnamePort( "localhost", PORT ) ).build(); + altServer = CommunityServerBuilder.server().onAddress( new ListenSocketAddress( "localhost", PORT ) ).build(); altServer.start(); } @@ -238,7 +232,7 @@ public void cleanContent() ImpermanentGraphDatabase graphdb = (ImpermanentGraphDatabase) graphdb(); graphdb.cleanContent(); //clean - gen.get().setGraph( graphdb() ); + // gen.get().setGraph( graphdb() ); // FIXME } diff --git a/src/test/java/org/neo4j/gis/spatial/procedures/SpatialProceduresTest.java b/src/test/java/org/neo4j/gis/spatial/procedures/SpatialProceduresTest.java index 16b7633f1..92f63f972 100644 --- a/src/test/java/org/neo4j/gis/spatial/procedures/SpatialProceduresTest.java +++ b/src/test/java/org/neo4j/gis/spatial/procedures/SpatialProceduresTest.java @@ -120,7 +120,7 @@ public static void testResult(GraphDatabaseService db, String call, Map procedure) throws KernelException { - ((GraphDatabaseAPI) db).getDependencyResolver().resolveDependency(Procedures.class).register(procedure); + ((GraphDatabaseAPI) db).getDependencyResolver().resolveDependency(Procedures.class).registerProcedure(procedure); } @Test @@ -206,7 +206,8 @@ public void literal_geometry_return() { public void create_node_decode_to_geometry() { execute("CALL spatial.addWKTLayer('geom','geom')"); ResourceIterator results = db.execute("CREATE (n:Node {geom:'POINT(4.0 5.0)'}) WITH n CALL spatial.decodeGeometry('geom',n) YIELD geometry RETURN geometry").columnAs("geometry"); - assertThat("Should be Geometry type", results.next(), instanceOf(Geometry.class)); + Object actual = results.next(); + assertThat("Should be Geometry type", actual, instanceOf(Geometry.class)); results.close(); }