use of org.neo4j.ogm.metadata.FieldInfo in project neo4j-ogm by neo4j.
the class RelationalReaderWriterTest method testUserV8.
// DATAGRAPH-636
@Test
public void testUserV8() {
ClassInfo classInfo = this.domainInfo.getClass(UserV8.class.getName());
UserV8 instance = new UserV8();
UserV8 relatedObject = new UserV8();
assertThat(EntityAccessManager.getRelationalReader(classInfo, KNOWS, Relationship.Direction.OUTGOING)).isNull();
assertThat(EntityAccessManager.getRelationalWriter(classInfo, KNOWS, Relationship.Direction.OUTGOING, relatedObject)).isNull();
FieldInfo relationalReader = EntityAccessManager.getRelationalReader(classInfo, KNOWS, Relationship.Direction.INCOMING);
FieldInfo relationalWriter = EntityAccessManager.getRelationalWriter(classInfo, KNOWS, Relationship.Direction.INCOMING, relatedObject);
relationalWriter.write(instance, relatedObject);
assertThat(instance.getKnows()).isEqualTo(relatedObject);
assertThat(relationalReader.read(instance)).isEqualTo(relatedObject);
}
use of org.neo4j.ogm.metadata.FieldInfo in project neo4j-ogm by neo4j.
the class RelationalReaderWriterTest method testUserV1.
// DATAGRAPH-636
@Test
public void testUserV1() {
final String KNOWN_BY = "KNOWN_BY";
ClassInfo classInfo = this.domainInfo.getClass(UserV1.class.getName());
UserV1 instance = new UserV1();
UserV1 relatedObject = new UserV1();
assertThat(EntityAccessManager.getRelationalReader(classInfo, KNOWN_BY, Relationship.Direction.OUTGOING)).isNull();
assertThat(EntityAccessManager.getRelationalWriter(classInfo, KNOWN_BY, Relationship.Direction.OUTGOING, relatedObject)).isNull();
FieldInfo relationalReader = EntityAccessManager.getRelationalReader(classInfo, KNOWN_BY, Relationship.Direction.INCOMING);
FieldInfo relationalWriter = EntityAccessManager.getRelationalWriter(classInfo, KNOWN_BY, Relationship.Direction.INCOMING, relatedObject);
relationalWriter.write(instance, relatedObject);
assertThat(instance.getKnownBy()).isEqualTo(relatedObject);
assertThat(relationalReader.read(instance)).isEqualTo(relatedObject);
}
use of org.neo4j.ogm.metadata.FieldInfo in project neo4j-ogm by neo4j.
the class RelationalReaderWriterTest method testUserV11.
// DATAGRAPH-636
@Test
public void testUserV11() {
ClassInfo classInfo = this.domainInfo.getClass(UserV11.class.getName());
UserV11 instance = new UserV11();
UserV11 relatedObjectOut = new UserV11();
UserV11 relatedObjectIn = new UserV11();
FieldInfo relationalReader = EntityAccessManager.getRelationalReader(classInfo, LIKES, Relationship.Direction.OUTGOING);
FieldInfo relationalWriter = EntityAccessManager.getRelationalWriter(classInfo, LIKES, Relationship.Direction.OUTGOING, relatedObjectOut);
relationalWriter.write(instance, relatedObjectOut);
assertThat(instance.getFriend()).isEqualTo(relatedObjectOut);
assertThat(relationalReader.read(instance)).isEqualTo(relatedObjectOut);
relationalReader = EntityAccessManager.getRelationalReader(classInfo, LIKES, Relationship.Direction.INCOMING);
relationalWriter = EntityAccessManager.getRelationalWriter(classInfo, LIKES, Relationship.Direction.INCOMING, relatedObjectIn);
relationalWriter.write(instance, relatedObjectIn);
assertThat(instance.getFriendOf()).isEqualTo(relatedObjectIn);
assertThat(relationalReader.read(instance)).isEqualTo(relatedObjectIn);
}
use of org.neo4j.ogm.metadata.FieldInfo in project neo4j-ogm by neo4j.
the class RelationalReaderWriterTest method testUserV21.
// GH-36
@Test
public void testUserV21() {
ClassInfo classInfo = this.domainInfo.getClass(UserV21.class.getName());
UserV21 instance = new UserV21();
UserV21 relatedObject = new UserV21();
PlainUser otherRelatedObject = new PlainUser();
assertThat(EntityAccessManager.getRelationalReader(classInfo, KNOWS, Relationship.Direction.INCOMING)).isNull();
assertThat(EntityAccessManager.getRelationalWriter(classInfo, KNOWS, Relationship.Direction.INCOMING, relatedObject)).isNull();
FieldInfo relationalWriter = EntityAccessManager.getRelationalWriter(classInfo, KNOWS, Relationship.Direction.OUTGOING, relatedObject);
relationalWriter.write(instance, relatedObject);
assertThat(instance.getUser()).isEqualTo(relatedObject);
assertThat(EntityAccessManager.getRelationalWriter(classInfo, KNOWS, Relationship.Direction.INCOMING, otherRelatedObject)).isNull();
relationalWriter = EntityAccessManager.getRelationalWriter(classInfo, KNOWS, Relationship.Direction.OUTGOING, otherRelatedObject);
relationalWriter.write(instance, otherRelatedObject);
assertThat(instance.getPlainUser()).isEqualTo(otherRelatedObject);
}
use of org.neo4j.ogm.metadata.FieldInfo in project neo4j-ogm by neo4j.
the class RelationalReaderWriterTest method testUserV6.
// DATAGRAPH-636
@Test
public void testUserV6() {
ClassInfo classInfo = this.domainInfo.getClass(UserV6.class.getName());
UserV6 instance = new UserV6();
UserV6 relatedObject = new UserV6();
FieldInfo relationalReader = EntityAccessManager.getRelationalReader(classInfo, KNOWS, Relationship.Direction.OUTGOING);
FieldInfo relationalWriter = EntityAccessManager.getRelationalWriter(classInfo, KNOWS, Relationship.Direction.OUTGOING, relatedObject);
relationalWriter.write(instance, relatedObject);
assertThat(instance.getKnowsPerson()).isEqualTo(relatedObject);
assertThat(relationalReader.read(instance)).isEqualTo(relatedObject);
}
Aggregations