DATAGRAPH-384 Upgrade to Neo4j 2.0.0-M06 - fixing tests
This commit is contained in:
8
pom.xml
8
pom.xml
@@ -38,14 +38,14 @@
|
||||
<source.level>1.7</source.level>
|
||||
<target.level>1.7</target.level>
|
||||
|
||||
<neo4j.version>2.0.0-M05</neo4j.version>
|
||||
<neo4j.version>2.0.0-M06</neo4j.version>
|
||||
|
||||
<neo4j.spatial.version>0.12-neo4j-2.0.0-SNAPSHOT</neo4j.spatial.version>
|
||||
<neo4j.graph-collections.version>0.7-neo4j-2.0.0-SNAPSHOT</neo4j.graph-collections.version>
|
||||
<neo4j.spatial.version>0.12-neo4j-2.0.0-M06</neo4j.spatial.version>
|
||||
<neo4j.graph-collections.version>0.7.1-neo4j-2.0.0-M06</neo4j.graph-collections.version>
|
||||
<blueprints.version>1.2</blueprints.version>
|
||||
<gremlin.version>1.5</gremlin.version>
|
||||
<pipes.version>1.5</pipes.version>
|
||||
<neo4j-cypher-dsl.version>1.9</neo4j-cypher-dsl.version>
|
||||
<neo4j-cypher-dsl.version>2.0.0-M06</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-SNAPSHOT</neo4j-rest-graphdb.version>
|
||||
<neo4j-rest-graphdb.version>2.0.0-M06</neo4j-rest-graphdb.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
@@ -27,6 +27,7 @@ import org.neo4j.rest.graphdb.query.RestCypherQueryEngine;
|
||||
import org.neo4j.rest.graphdb.query.RestGremlinQueryEngine;
|
||||
import org.neo4j.rest.graphdb.transaction.NullTransaction;
|
||||
import org.neo4j.rest.graphdb.transaction.NullTransactionManager;
|
||||
import org.neo4j.rest.graphdb.traversal.RestTraversalDescription;
|
||||
import org.neo4j.rest.graphdb.util.Config;
|
||||
import org.springframework.core.convert.ConversionService;
|
||||
import org.springframework.data.neo4j.annotation.QueryType;
|
||||
@@ -108,11 +109,6 @@ public class SpringRestGraphDatabase extends org.neo4j.rest.graphdb.RestGraphDat
|
||||
return super.getRestAPI().createIndex(type, indexName, indexType.getConfig());
|
||||
}
|
||||
|
||||
@Override
|
||||
public TraversalDescription traversalDescription() {
|
||||
return super.getRestAPI().createTraversalDescription();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public <T> QueryEngine<T> queryEngineFor(QueryType type, final ResultConverter resultConverter) {
|
||||
|
||||
@@ -42,11 +42,11 @@ public abstract class QueryTemplates {
|
||||
private static final String DIRECTION_INCOMING = "<-[:`%s`]-";
|
||||
private static final String DIRECTION_OUTGOING = "-[:`%s`]->";
|
||||
private static final String DIRECTION_BOTH = "-[:`%s`]-";
|
||||
static final String MATCH_CLAUSE = "`%s`%s`%s`";
|
||||
static final String MATCH_CLAUSE2 = "%s%s`%s`";
|
||||
static final String MATCH_CLAUSE = "(`%s`)%s(`%s`)";
|
||||
static final String MATCH_CLAUSE2 = "%s%s(`%s`)";
|
||||
|
||||
static final String DEFAULT_INDEXBASED_START_CLAUSE = "`%s`=node:__types__(className=\"%s\")";
|
||||
static final String DEFAULT_LABELBASED_MATCH_START_CLAUSE = "`%s`:`%s`";
|
||||
static final String DEFAULT_LABELBASED_MATCH_START_CLAUSE = "(`%s`:`%s`)";
|
||||
|
||||
public static final String START_NODE_LOOKUP = "`%s`=node({%d})";
|
||||
static final String SKIP_LIMIT = " SKIP %d LIMIT %d";
|
||||
|
||||
@@ -21,12 +21,12 @@ import java.util.Map;
|
||||
*/
|
||||
public class LabelBasedStrategyCypherHelper {
|
||||
|
||||
static final String CYPHER_ADD_LABEL_TO_NODE = "match n where id(n)={nodeId} set n:`%s`";
|
||||
static final String CYPHER_ADD_LABELS_TO_NODE = "match n where id(n)={nodeId} set n%s";
|
||||
static final String CYPHER_COUNT_LABELS_ON_NODE = "match n where id(n)={nodeId} and n:`%s` return count(*) ";
|
||||
static final String CYPHER_RETURN_NODES_WITH_LABEL = "match n:`%s` return n";
|
||||
static final String CYPHER_RETURN_COUNT_OF_NODES_WITH_LABEL = "match n:`%s` return count(*)";
|
||||
static final String CYPHER_RETURN_LABELS_FOR_NODE = "match n where id(n)={nodeId} return labels(n) as labels";
|
||||
static final String CYPHER_ADD_LABEL_TO_NODE = "match (n) where id(n)={nodeId} set n:`%s`";
|
||||
static final String CYPHER_ADD_LABELS_TO_NODE = "match (n) where id(n)={nodeId} set n%s";
|
||||
static final String CYPHER_COUNT_LABELS_ON_NODE = "match (n) where id(n)={nodeId} and n:`%s` return count(*) ";
|
||||
static final String CYPHER_RETURN_NODES_WITH_LABEL = "match (n:`%s`) return n";
|
||||
static final String CYPHER_RETURN_COUNT_OF_NODES_WITH_LABEL = "match (n:`%s`) return count(*)";
|
||||
static final String CYPHER_RETURN_LABELS_FOR_NODE = "match (n) where id(n)={nodeId} return labels(n) as labels";
|
||||
|
||||
private QueryEngine<CypherQuery> queryEngine;
|
||||
|
||||
|
||||
@@ -283,7 +283,6 @@ public class DerivedFinderTests {
|
||||
assertThat(single(recipes).id, is(equalTo(focaccia.id)));
|
||||
}
|
||||
|
||||
@Ignore
|
||||
@Test
|
||||
public void shouldFindUsingMultipleEntities() throws Exception {
|
||||
Set<Recipe> recipes = recipeRepository.findByIngredientAndCookBook(pear, baking101);
|
||||
|
||||
@@ -74,14 +74,14 @@ public class CypherQueryBuilderForIndexBasedTRSUnitTests extends AbstractCypherQ
|
||||
@Override
|
||||
@Test
|
||||
public void createsQueryForPropertyOnRelationShipReference() {
|
||||
this.trsSpecificExpectedQuery = "START `person_group`=node:`Group`(`name`={0}) MATCH `person`<-[:`members`]-`person_group` RETURN `person`";
|
||||
this.trsSpecificExpectedQuery = "START `person_group`=node:`Group`(`name`={0}) MATCH (`person`)<-[:`members`]-(`person_group`) RETURN `person`";
|
||||
super.createsQueryForPropertyOnRelationShipReference();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Test
|
||||
public void createsQueryForMultipleStartClauses() {
|
||||
this.trsSpecificExpectedQuery = "START `person`=node:`Person`(`name`={0}), `person_group`=node:`Group`(`name`={1}) MATCH `person`<-[:`members`]-`person_group` RETURN `person`";
|
||||
this.trsSpecificExpectedQuery = "START `person`=node:`Person`(`name`={0}), `person_group`=node:`Group`(`name`={1}) MATCH (`person`)<-[:`members`]-(`person_group`) RETURN `person`";
|
||||
super.createsQueryForMultipleStartClauses();
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@ public class CypherQueryBuilderForIndexBasedTRSUnitTests extends AbstractCypherQ
|
||||
@Override
|
||||
@Test
|
||||
public void createsSimpleTraversalClauseCorrectly() {
|
||||
this.trsSpecificExpectedQuery = "START `person_group`=node({0}) MATCH `person`<-[:`members`]-`person_group` WHERE `person`.__type__ IN ['Person'] RETURN `person`";
|
||||
this.trsSpecificExpectedQuery = "START `person_group`=node({0}) MATCH (`person`)<-[:`members`]-(`person_group`) WHERE `person`.__type__ IN ['Person'] RETURN `person`";
|
||||
super.createsSimpleTraversalClauseCorrectly();
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ public class CypherQueryBuilderForIndexBasedTRSUnitTests extends AbstractCypherQ
|
||||
public void buildsComplexQueryCorrectly() {
|
||||
this.trsSpecificExpectedQuery =
|
||||
"START `person`=node:`Person`(`name`={0}), `person_group`=node:`Group`(`name`={1}) " +
|
||||
"MATCH `person`<-[:`members`]-`person_group`, `person`<-[:`members`]-`person_group`-[:`members`]->`person_group_members` " +
|
||||
"MATCH (`person`)<-[:`members`]-(`person_group`), (`person`)<-[:`members`]-(`person_group`)-[:`members`]->(`person_group_members`) " +
|
||||
"WHERE `person`.`age` > {2} AND `person_group_members`.`age` = {3} " +
|
||||
"RETURN `person`";
|
||||
super.buildsComplexQueryCorrectly();
|
||||
@@ -114,14 +114,14 @@ public class CypherQueryBuilderForIndexBasedTRSUnitTests extends AbstractCypherQ
|
||||
@Override
|
||||
@Test
|
||||
public void shouldFindByNodeEntity() throws Exception {
|
||||
this.trsSpecificExpectedQuery = "START `person_pet`=node({0}) MATCH `person`-[:`owns`]->`person_pet` WHERE `person`.__type__ IN ['Person'] RETURN `person`";
|
||||
this.trsSpecificExpectedQuery = "START `person_pet`=node({0}) MATCH (`person`)-[:`owns`]->(`person_pet`) WHERE `person`.__type__ IN ['Person'] RETURN `person`";
|
||||
super.shouldFindByNodeEntity();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Test
|
||||
public void shouldFindByNodeEntityForIncomingRelationship() {
|
||||
this.trsSpecificExpectedQuery = "START `person_group`=node({0}) MATCH `person`<-[:`members`]-`person_group` WHERE `person`.__type__ IN ['Person'] RETURN `person`";
|
||||
this.trsSpecificExpectedQuery = "START `person_group`=node({0}) MATCH (`person`)<-[:`members`]-(`person_group`) WHERE `person`.__type__ IN ['Person'] RETURN `person`";
|
||||
super.shouldFindByNodeEntityForIncomingRelationship();
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ import static org.junit.Assert.assertThat;
|
||||
*/
|
||||
public class CypherQueryBuilderForLabelBasedTRSUnitTests extends AbstractCypherQueryBuilderTestBase {
|
||||
|
||||
private final static String DEFAULT_MATCH_STARTING_CLAUSE = " MATCH `person`:`" + CLASS_NAME + "`";
|
||||
private final static String DEFAULT_MATCH_STARTING_CLAUSE = " MATCH (`person`:`" + CLASS_NAME + "`)";
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
@@ -74,7 +74,7 @@ public class CypherQueryBuilderForLabelBasedTRSUnitTests extends AbstractCypherQ
|
||||
@Override
|
||||
@Test
|
||||
public void createsQueryForPropertyOnRelationShipReference() {
|
||||
this.trsSpecificExpectedQuery = "START `person_group`=node:`Group`(`name`={0}) MATCH `person`<-[:`members`]-`person_group` RETURN `person`";
|
||||
this.trsSpecificExpectedQuery = "START `person_group`=node:`Group`(`name`={0}) MATCH (`person`)<-[:`members`]-(`person_group`) RETURN `person`";
|
||||
super.createsQueryForPropertyOnRelationShipReference();
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ public class CypherQueryBuilderForLabelBasedTRSUnitTests extends AbstractCypherQ
|
||||
"`name`={0}), " +
|
||||
"`person_group`=node:" +
|
||||
"`Group`(`name`={1}) " +
|
||||
"MATCH `person`<-[:`members`]-`person_group` " +
|
||||
"MATCH (`person`)<-[:`members`]-(`person_group`) " +
|
||||
"RETURN `person`";
|
||||
super.createsQueryForMultipleStartClauses();
|
||||
}
|
||||
@@ -101,7 +101,7 @@ public class CypherQueryBuilderForLabelBasedTRSUnitTests extends AbstractCypherQ
|
||||
@Override
|
||||
@Test
|
||||
public void createsSimpleTraversalClauseCorrectly() {
|
||||
this.trsSpecificExpectedQuery = "START `person_group`=node({0}) MATCH `person`<-[:`members`]-`person_group` WHERE `person`:`Person` RETURN `person`";
|
||||
this.trsSpecificExpectedQuery = "START `person_group`=node({0}) MATCH (`person`)<-[:`members`]-(`person_group`) WHERE `person`:`Person` RETURN `person`";
|
||||
super.createsSimpleTraversalClauseCorrectly();
|
||||
}
|
||||
|
||||
@@ -110,7 +110,7 @@ public class CypherQueryBuilderForLabelBasedTRSUnitTests extends AbstractCypherQ
|
||||
public void buildsComplexQueryCorrectly() {
|
||||
this.trsSpecificExpectedQuery =
|
||||
"START `person`=node:`Person`(`name`={0}), `person_group`=node:`Group`(`name`={1}) " +
|
||||
"MATCH `person`<-[:`members`]-`person_group`, `person`<-[:`members`]-`person_group`-[:`members`]->`person_group_members` " +
|
||||
"MATCH (`person`)<-[:`members`]-(`person_group`), (`person`)<-[:`members`]-(`person_group`)-[:`members`]->(`person_group_members`) " +
|
||||
"WHERE `person`.`age` > {2} AND `person_group_members`.`age` = {3} " +
|
||||
"RETURN `person`";
|
||||
super.buildsComplexQueryCorrectly();
|
||||
@@ -120,14 +120,14 @@ public class CypherQueryBuilderForLabelBasedTRSUnitTests extends AbstractCypherQ
|
||||
@Override
|
||||
@Test
|
||||
public void shouldFindByNodeEntity() throws Exception {
|
||||
this.trsSpecificExpectedQuery = "START `person_pet`=node({0}) MATCH `person`-[:`owns`]->`person_pet` WHERE `person`:`Person` RETURN `person`";
|
||||
this.trsSpecificExpectedQuery = "START `person_pet`=node({0}) MATCH (`person`)-[:`owns`]->(`person_pet`) WHERE `person`:`Person` RETURN `person`";
|
||||
super.shouldFindByNodeEntity();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Test
|
||||
public void shouldFindByNodeEntityForIncomingRelationship() {
|
||||
this.trsSpecificExpectedQuery = "START `person_group`=node({0}) MATCH `person`<-[:`members`]-`person_group` WHERE `person`:`Person` RETURN `person`";
|
||||
this.trsSpecificExpectedQuery = "START `person_group`=node({0}) MATCH (`person`)<-[:`members`]-(`person_group`) WHERE `person`:`Person` RETURN `person`";
|
||||
super.shouldFindByNodeEntityForIncomingRelationship();
|
||||
}
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ public class DerivedFinderMethodForIndexedBasedTRSTests extends AbstractDerivedF
|
||||
// findByOwnerId
|
||||
this.trsSpecificExpectedQuery =
|
||||
"START `thing_owner`=node({0}) " +
|
||||
"MATCH `thing`-[:`owner`]->`thing_owner` " +
|
||||
"MATCH (`thing`)-[:`owner`]->(`thing_owner`) " +
|
||||
"WHERE `thing`.__type__ IN ['org.springframework.data.neo4j.repository.query.AbstractDerivedFinderMethodTestBase$Thing'] ";
|
||||
super.testQueryWithEntityGraphId();
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ import static org.hamcrest.Matchers.instanceOf;
|
||||
@TestExecutionListeners({CleanContextCacheTestExecutionListener.class, DependencyInjectionTestExecutionListener.class, TransactionalTestExecutionListener.class})
|
||||
public class DerivedFinderMethodForLabelBasedTRSTests extends AbstractDerivedFinderMethodTestBase {
|
||||
|
||||
private static final String DEFAULT_MATCH_CLAUSE = "MATCH `thing`:`org.springframework.data.neo4j.repository.query.AbstractDerivedFinderMethodTestBase$Thing`";
|
||||
private static final String DEFAULT_MATCH_CLAUSE = "MATCH (`thing`:`org.springframework.data.neo4j.repository.query.AbstractDerivedFinderMethodTestBase$Thing`)";
|
||||
|
||||
@Autowired
|
||||
NodeTypeRepresentationStrategy strategy;
|
||||
@@ -61,7 +61,7 @@ public class DerivedFinderMethodForLabelBasedTRSTests extends AbstractDerivedFin
|
||||
@Override
|
||||
public void testQueryWithEntityGraphId() throws Exception {
|
||||
// findByOwnerId
|
||||
this.trsSpecificExpectedQuery = "START `thing_owner`=node({0}) MATCH `thing`-[:`owner`]->`thing_owner` WHERE `thing`:`org.springframework.data.neo4j.repository.query.AbstractDerivedFinderMethodTestBase$Thing` ";
|
||||
this.trsSpecificExpectedQuery = "START `thing_owner`=node({0}) MATCH (`thing`)-[:`owner`]->(`thing_owner`) WHERE `thing`:`org.springframework.data.neo4j.repository.query.AbstractDerivedFinderMethodTestBase$Thing` ";
|
||||
super.testQueryWithEntityGraphId();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user