Skip to content

Commit

Permalink
bumping neo4j version to 3.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
sarmbruster authored and jexp committed Jan 24, 2017
1 parent 72e87c3 commit 66a6504
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 35 deletions.
17 changes: 9 additions & 8 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<properties>
<neo4j.version>3.0.4</neo4j.version>
<neo4j.java.version>1.7</neo4j.java.version>
<neo4j.version>3.1.0</neo4j.version>
<neo4j.java.version>1.8</neo4j.java.version>
<maven-compiler-plugin.version>3.1</maven-compiler-plugin.version>
<maven-gpg-plugin.version>1.4</maven-gpg-plugin.version>
<maven-resources-plugin.version>2.6</maven-resources-plugin.version>
Expand All @@ -21,7 +21,7 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>neo4j-spatial</artifactId>
<groupId>org.neo4j</groupId>
<version>0.23-neo4j-3.0.4</version>
<version>0.24-neo4j-3.1.0</version>
<name>Neo4j - Spatial Components</name>
<description>Spatial utilities and components for Neo4j</description>
<url>http://components.neo4j.org/${project.artifactId}/${project.version}</url>
Expand Down Expand Up @@ -414,11 +414,12 @@
<version>1.1</version>
<type>jar</type>
</dependency>
<!-- <dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version></version>
</dependency>-->

<!-- <dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version></version>
</dependency>-->
</dependencies>
<repositories>
<repository>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -150,7 +150,7 @@ private static void populateEncoderClasses() {
public Stream<NameResult> listProcedures() {
Procedures procedures = ((GraphDatabaseAPI)db).getDependencyResolver().resolveDependency( Procedures.class );
Stream.Builder<NameResult> 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()));
}
Expand Down Expand Up @@ -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);
Expand All @@ -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<Double> 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;
Expand All @@ -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<String, Object>) value;
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/org/neo4j/gis/spatial/Neo4jTestCase.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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();
}

Expand Down Expand Up @@ -238,7 +232,7 @@ public void cleanContent()
ImpermanentGraphDatabase graphdb = (ImpermanentGraphDatabase) graphdb();
graphdb.cleanContent();
//clean
gen.get().setGraph( graphdb() );
// gen.get().setGraph( graphdb() ); // FIXME

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public static void testResult(GraphDatabaseService db, String call, Map<String,
}

public static void registerProcedure(GraphDatabaseService db, Class<?> procedure) throws KernelException {
((GraphDatabaseAPI) db).getDependencyResolver().resolveDependency(Procedures.class).register(procedure);
((GraphDatabaseAPI) db).getDependencyResolver().resolveDependency(Procedures.class).registerProcedure(procedure);
}

@Test
Expand Down Expand Up @@ -206,7 +206,8 @@ public void literal_geometry_return() {
public void create_node_decode_to_geometry() {
execute("CALL spatial.addWKTLayer('geom','geom')");
ResourceIterator<Object> 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();
}

Expand Down

0 comments on commit 66a6504

Please sign in to comment.