update to neo4j 2.0.1
This commit is contained in:
10
pom.xml
10
pom.xml
@@ -15,7 +15,7 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.data.build</groupId>
|
||||
<artifactId>spring-data-parent</artifactId>
|
||||
<version>1.3.0.RC1</version>
|
||||
<version>1.3.0.BUILD-SNAPSHOT</version>
|
||||
<relativePath>../spring-data-build/parent/pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
@@ -38,11 +38,11 @@
|
||||
<source.level>1.7</source.level>
|
||||
<target.level>1.7</target.level>
|
||||
|
||||
<neo4j.version>2.0.0</neo4j.version>
|
||||
<neo4j.version>2.0.1</neo4j.version>
|
||||
|
||||
<neo4j.spatial.version>0.12-neo4j-2.0.0</neo4j.spatial.version>
|
||||
<neo4j.graph-collections.version>0.7.1-neo4j-2.0.0</neo4j.graph-collections.version>
|
||||
<neo4j-cypher-dsl.version>2.0.0</neo4j-cypher-dsl.version>
|
||||
<neo4j.spatial.version>0.12-neo4j-2.0.1-SNAPSHOT</neo4j.spatial.version>
|
||||
<neo4j.graph-collections.version>0.7.1-neo4j-2.0.1-SNAPSHOT</neo4j.graph-collections.version>
|
||||
<neo4j-cypher-dsl.version>2.0.1-SNAPSHOT</neo4j-cypher-dsl.version>
|
||||
</properties>
|
||||
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
<properties>
|
||||
<validation>1.0.0.GA</validation>
|
||||
<jersey.version>1.9</jersey.version>
|
||||
<neo4j-rest-graphdb.version>2.0.0</neo4j-rest-graphdb.version>
|
||||
<neo4j-rest-graphdb.version>2.0.1-SNAPSHOT</neo4j-rest-graphdb.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
@@ -115,6 +115,10 @@
|
||||
<groupId>org.neo4j</groupId>
|
||||
<artifactId>neo4j-lucene-index</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.neo4j</groupId>
|
||||
<artifactId>server-api</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
|
||||
@@ -197,6 +197,10 @@
|
||||
<groupId>org.neo4j</groupId>
|
||||
<artifactId>neo4j</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.neo4j</groupId>
|
||||
<artifactId>neo4j-lucene-index</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
|
||||
@@ -20,6 +20,8 @@ import org.neo4j.graphdb.*;
|
||||
import org.neo4j.graphdb.index.Index;
|
||||
import org.neo4j.graphdb.index.IndexManager;
|
||||
import org.neo4j.graphdb.index.RelationshipIndex;
|
||||
import org.neo4j.kernel.GraphDatabaseAPI;
|
||||
import org.neo4j.kernel.impl.core.NodeManager;
|
||||
import org.neo4j.tooling.GlobalGraphOperations;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -80,10 +82,13 @@ public abstract class Neo4jHelper {
|
||||
}
|
||||
|
||||
private static void removeNodes(GraphDatabaseService graphDatabaseService, boolean includeReferenceNode) {
|
||||
GraphDatabaseAPI api = (GraphDatabaseAPI) graphDatabaseService;
|
||||
NodeManager nodeManager = api.getDependencyResolver().resolveDependency(NodeManager.class);
|
||||
final GlobalGraphOperations globalGraphOperations = GlobalGraphOperations.at(graphDatabaseService);
|
||||
for (Node node : globalGraphOperations.getAllNodes()) {
|
||||
for (Relationship rel : node.getRelationships(Direction.OUTGOING)) {
|
||||
try {
|
||||
if (nodeManager.isDeleted(rel)) continue;
|
||||
rel.delete();
|
||||
} catch(IllegalStateException ise) {
|
||||
if (!ise.getMessage().contains("since it has already been deleted")) throw ise;
|
||||
@@ -93,6 +98,7 @@ public abstract class Neo4jHelper {
|
||||
}
|
||||
for (Node node : globalGraphOperations.getAllNodes()) {
|
||||
try {
|
||||
if (nodeManager.isDeleted(node)) continue;
|
||||
node.delete();
|
||||
} catch(IllegalStateException ise) {
|
||||
if (!ise.getMessage().contains("since it has already been deleted")) throw ise;
|
||||
|
||||
@@ -56,7 +56,7 @@ public class TypeRepresentationStrategyFactory {
|
||||
if (SubReferenceNodeTypeRepresentationStrategy.isStrategyAlreadyInUse(graphDatabaseService)) return Strategy.SubRef;
|
||||
if (LabelBasedNodeTypeRepresentationStrategy.isStrategyAlreadyInUse(graphDatabaseService)) return Strategy.Labeled;
|
||||
tx.success();
|
||||
return Strategy.Labeled;
|
||||
return Strategy.Indexed;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.neo4j.graphdb.GraphDatabaseService;
|
||||
import org.neo4j.graphdb.Node;
|
||||
import org.neo4j.graphdb.Transaction;
|
||||
import org.neo4j.helpers.collection.IteratorUtil;
|
||||
import org.neo4j.test.TestGraphDatabaseFactory;
|
||||
@@ -205,7 +206,7 @@ public class DerivedFinderTests {
|
||||
|
||||
CRUDRepository<Ingredient> ingredientRepository = template.repositoryFor(Ingredient.class);
|
||||
|
||||
transaction = graphDatabaseService.beginTx();
|
||||
Transaction tx = graphDatabaseService.beginTx();
|
||||
try {
|
||||
chocolate = ingredientRepository.save(new Ingredient("chocolate"));
|
||||
fish = ingredientRepository.save(new Ingredient("fish"));
|
||||
@@ -224,17 +225,29 @@ public class DerivedFinderTests {
|
||||
whiteChocolateSquares = recipeRepository.save(new Recipe("Heston", "White Chocolate squares", chocolate, null, null));
|
||||
|
||||
dish = dishRepository.save(new Dish(100));
|
||||
transaction.success();
|
||||
tx.success();
|
||||
} finally {
|
||||
transaction.finish();
|
||||
tx.close();
|
||||
}
|
||||
tx = graphDatabaseService.beginTx();
|
||||
try {
|
||||
for (Node node : graphDatabaseService.getAllNodes()) {
|
||||
System.out.println("node = " + node);
|
||||
}
|
||||
tx.success();
|
||||
} finally {
|
||||
tx.close();
|
||||
}
|
||||
|
||||
transaction = graphDatabaseService.beginTx();
|
||||
}
|
||||
|
||||
@After
|
||||
public void tearDown() throws Exception {
|
||||
if (transaction!=null) {
|
||||
transaction.success();transaction.finish();
|
||||
transaction.success();
|
||||
transaction.close();
|
||||
transaction = null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -340,6 +353,10 @@ public class DerivedFinderTests {
|
||||
public void shouldFindUsingEntityAndPropertyTraversal() throws Exception {
|
||||
Set<Recipe> recipes = recipeRepository.findByIngredientAndCookBookTitle(oliveOil, "Naked Chef");
|
||||
|
||||
for (Node node : graphDatabaseService.getAllNodes()) {
|
||||
System.out.println("in test = " + node);
|
||||
}
|
||||
|
||||
assertThat(single(recipes).title, is(equalTo("pesto")));
|
||||
}
|
||||
@Test
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package org.springframework.data.neo4j.repository;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.slf4j.Logger;
|
||||
@@ -97,4 +98,20 @@ public class SpatialGraphRepositoryTests {
|
||||
Iterable<Person> teamMembers = personRepository.findWithinDistance("personLayer", 16,56,70);
|
||||
assertThat(asCollection(teamMembers), hasItems(testTeam.michael, testTeam.david));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void testPerformance() throws Exception {
|
||||
long time=System.currentTimeMillis();
|
||||
for (int i=0;i<5000;i++) {
|
||||
if (i % 1000 == 0) {
|
||||
long now = System.currentTimeMillis();
|
||||
System.out.println(i+". entries " + (now-time));
|
||||
time=now;
|
||||
}
|
||||
Person person = new Person("John " + i, 40 + i);
|
||||
person.setLocation((i % 180) - 90,(i % 180) - 90);
|
||||
personRepository.save(person);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user