From e9078059eeb231b7fe1f1b5474e82fe31f9e45d4 Mon Sep 17 00:00:00 2001 From: Michael Hunger Date: Mon, 9 Aug 2010 09:59:18 +0200 Subject: [PATCH] some TODOs and suggestions for further development --- .project | 95 ++++++++++--------- .../graph/neo4j/Neo4jNodeBacking.aj | 40 ++++---- .../persistence/test/Person.java | 17 ++++ .../test/graph/Neo4jGraphPersistenceTest.java | 22 ++++- 4 files changed, 114 insertions(+), 60 deletions(-) diff --git a/.project b/.project index 3c4dbb279..486c32f2c 100644 --- a/.project +++ b/.project @@ -1,44 +1,53 @@ + - datastore-graph - - - - - org.eclipse.jdt.core.javabuilder - - - org.maven.ide.eclipse.maven2Builder - - - org.eclipse.ajdt.core.ajbuilder - - - org.eclipse.wst.common.project.facet.core.builder - - - org.eclipse.wst.validation.validationbuilder - - - org.eclipse.ajdt.core.ajbuilder - - - aspectPath - org.springframework.aspects - - - - - org.springframework.ide.eclipse.core.springbuilder - - - - org.eclipse.jdt.core.javanature - org.maven.ide.eclipse.maven2Nature - org.eclipse.wst.common.project.facet.core.nature - org.eclipse.ajdt.ui.ajnature - org.eclipse.wst.common.modulecore.ModuleCoreNature - org.eclipse.jem.workbench.JavaEMFNature - com.springsource.sts.roo.core.nature - org.springframework.ide.eclipse.core.springnature - - \ No newline at end of file + datastore-graph + + + + + + org.maven.ide.eclipse.maven2Builder + + + + + org.eclipse.ajdt.core.ajbuilder + + + + + org.eclipse.wst.common.project.facet.core.builder + + + + + org.eclipse.wst.validation.validationbuilder + + + + + org.eclipse.ajdt.core.ajbuilder + + + aspectPath + org.springframework.aspects + + + + + org.springframework.ide.eclipse.core.springbuilder + + + + + + org.eclipse.jdt.core.javanature + org.maven.ide.eclipse.maven2Nature + org.eclipse.wst.common.project.facet.core.nature + org.eclipse.ajdt.ui.ajnature + org.eclipse.wst.common.modulecore.ModuleCoreNature + org.eclipse.jem.workbench.JavaEMFNature + com.springsource.sts.roo.core.nature + org.springframework.ide.eclipse.core.springnature + + diff --git a/src/main/java/org/springframework/persistence/graph/neo4j/Neo4jNodeBacking.aj b/src/main/java/org/springframework/persistence/graph/neo4j/Neo4jNodeBacking.aj index a828022b9..e9723c596 100644 --- a/src/main/java/org/springframework/persistence/graph/neo4j/Neo4jNodeBacking.aj +++ b/src/main/java/org/springframework/persistence/graph/neo4j/Neo4jNodeBacking.aj @@ -104,9 +104,9 @@ public aspect Neo4jNodeBacking extends AbstractTypeAnnotatingMixinFields Neo4J simple node property [" + propName + "] with value=[" + newVal + "]"); return null; @@ -162,12 +162,10 @@ public aspect Neo4jNodeBacking extends AbstractTypeAnnotatingMixinFields Neo4J relationship with value=[" + newVal + "]"); return null; } @@ -176,9 +174,19 @@ public aspect Neo4jNodeBacking extends AbstractTypeAnnotatingMixinFields children; + */ + public Person(String name, int age) { this.name = name; this.age = age; diff --git a/src/test/java/org/springframework/persistence/test/graph/Neo4jGraphPersistenceTest.java b/src/test/java/org/springframework/persistence/test/graph/Neo4jGraphPersistenceTest.java index b942cc818..1a0797f6e 100644 --- a/src/test/java/org/springframework/persistence/test/graph/Neo4jGraphPersistenceTest.java +++ b/src/test/java/org/springframework/persistence/test/graph/Neo4jGraphPersistenceTest.java @@ -3,6 +3,7 @@ package org.springframework.persistence.test.graph; import junit.framework.Assert; import org.junit.After; +import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.neo4j.graphdb.DynamicRelationshipType; @@ -51,15 +52,34 @@ public class Neo4jGraphPersistenceTest { @Test @Transactional - public void testCreateRelationshipOnSet() { + public void testCreateRelationshipWithoutAnnotationOnSet() { Person p = new Person("Michael", 35); Person spouse=new Person("Tina",36); p.setSpouse(spouse); Assert.assertEquals("Tina", p.getSpouse().getUnderlyingNode().getProperty("Person.name")); Node spouseNode=p.getUnderlyingNode().getSingleRelationship(DynamicRelationshipType.withName("Person.spouse"), org.neo4j.graphdb.Direction.OUTGOING).getEndNode(); Assert.assertEquals(spouse.getUnderlyingNode(), spouseNode); + Assert.assertEquals(spouse, p.getSpouse()); } + @Test + @Ignore + @Transactional + public void testCreateRelationshipWithAnnotationOnSet() { + Person p = new Person("Michael", 35); + Person mother=new Person("Gabi",60); + p.setMother(mother); + Assert.assertEquals("Gabi", p.getMother().getUnderlyingNode().getProperty("Person.name")); + Node motherNode=p.getUnderlyingNode().getSingleRelationship(DynamicRelationshipType.withName("mother"), org.neo4j.graphdb.Direction.BOTH).getEndNode(); + Assert.assertEquals(mother.getUnderlyingNode(), motherNode); + Assert.assertEquals(mother, p.getMother()); + } + + // TODO test delete relationship + // TODO test delete previous relationship + // TODO test incoming relationship + // TODO test bidirectional relationship + // TODO test remove property (set to null) @Test @Transactional