use of org.neo4j.ogm.metadata.ClassInfo in project neo4j-ogm by neo4j.
the class RelationalReaderWriterTest method testUserV15.
// DATAGRAPH-636
@Test
public void testUserV15() {
ClassInfo classInfo = this.domainInfo.getClass(UserV15.class.getName());
UserV15 instance = new UserV15();
UserV15 relatedObjectOut = new UserV15();
UserV15 relatedObjectIn = new UserV15();
FieldInfo relationalReader = EntityAccessManager.getRelationalReader(classInfo, KNOWS, Relationship.Direction.OUTGOING);
FieldInfo relationalWriter = EntityAccessManager.getRelationalWriter(classInfo, KNOWS, Relationship.Direction.OUTGOING, relatedObjectOut);
relationalWriter.write(instance, relatedObjectOut);
assertThat(instance.getKnows()).isEqualTo(relatedObjectOut);
assertThat(relationalReader.read(instance)).isEqualTo(relatedObjectOut);
instance = new UserV15();
relationalReader = EntityAccessManager.getRelationalReader(classInfo, KNOWS, Relationship.Direction.INCOMING);
relationalWriter = EntityAccessManager.getRelationalWriter(classInfo, KNOWS, Relationship.Direction.INCOMING, relatedObjectIn);
relationalWriter.write(instance, relatedObjectIn);
assertThat(instance.getKnows()).isEqualTo(relatedObjectIn);
assertThat(relationalReader.read(instance)).isEqualTo(relatedObjectIn);
}
use of org.neo4j.ogm.metadata.ClassInfo in project neo4j-ogm by neo4j.
the class RelationalReaderWriterTest method testUserV20.
// GH-36
@Test
public void testUserV20() {
ClassInfo classInfo = this.domainInfo.getClass(UserV20.class.getName());
UserV20 instance = new UserV20();
UserV20 relatedObject = new UserV20();
PlainUser otherRelatedObject = new PlainUser();
assertThat(EntityAccessManager.getRelationalReader(classInfo, KNOWS, Relationship.Direction.OUTGOING)).isNull();
assertThat(EntityAccessManager.getRelationalWriter(classInfo, KNOWS, Relationship.Direction.OUTGOING, relatedObject)).isNull();
FieldInfo relationalWriter = EntityAccessManager.getRelationalWriter(classInfo, KNOWS, Relationship.Direction.INCOMING, relatedObject);
relationalWriter.write(instance, relatedObject);
assertThat(instance.getUser()).isEqualTo(relatedObject);
assertThat(EntityAccessManager.getRelationalWriter(classInfo, KNOWS, Relationship.Direction.OUTGOING, otherRelatedObject)).isNull();
relationalWriter = EntityAccessManager.getRelationalWriter(classInfo, KNOWS, Relationship.Direction.INCOMING, otherRelatedObject);
relationalWriter.write(instance, otherRelatedObject);
assertThat(instance.getPlainUser()).isEqualTo(otherRelatedObject);
}
use of org.neo4j.ogm.metadata.ClassInfo in project neo4j-ogm by neo4j.
the class RelationalReaderWriterTest method testUserV5.
// DATAGRAPH-636
@Test
public void testUserV5() {
ClassInfo classInfo = this.domainInfo.getClass(UserV5.class.getName());
UserV5 instance = new UserV5();
UserV5 relatedObject = new UserV5();
assertThat(EntityAccessManager.getRelationalReader(classInfo, KNOWS, Relationship.Direction.INCOMING)).isNull();
assertThat(EntityAccessManager.getRelationalWriter(classInfo, KNOWS, Relationship.Direction.INCOMING, relatedObject)).isNull();
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.getFriend()).isEqualTo(relatedObject);
assertThat(relationalReader.read(instance)).isEqualTo(relatedObject);
}
use of org.neo4j.ogm.metadata.ClassInfo in project neo4j-ogm by neo4j.
the class RelationalReaderWriterTest method testUserV13.
// DATAGRAPH-636
@Test
public void testUserV13() {
ClassInfo classInfo = this.domainInfo.getClass(UserV13.class.getName());
UserV13 instance = new UserV13();
UserV13 relatedObject = new UserV13();
assertThat(EntityAccessManager.getRelationalReader(classInfo, KNOWS, Relationship.Direction.INCOMING)).isNull();
assertThat(EntityAccessManager.getRelationalWriter(classInfo, KNOWS, Relationship.Direction.INCOMING, relatedObject)).isNull();
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.getKnows()).isEqualTo(relatedObject);
assertThat(relationalReader.read(instance)).isEqualTo(relatedObject);
}
use of org.neo4j.ogm.metadata.ClassInfo in project neo4j-ogm by neo4j.
the class RelationalReaderWriterTest method testUserV7.
// DATAGRAPH-636
@Test
public void testUserV7() {
ClassInfo classInfo = this.domainInfo.getClass(UserV7.class.getName());
UserV7 instance = new UserV7();
UserV7 relatedObject = new UserV7();
assertThat(EntityAccessManager.getRelationalReader(classInfo, KNOWS, Relationship.Direction.INCOMING)).isNull();
assertThat(EntityAccessManager.getRelationalWriter(classInfo, KNOWS, Relationship.Direction.INCOMING, relatedObject)).isNull();
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.getKnows()).isEqualTo(relatedObject);
assertThat(relationalReader.read(instance)).isEqualTo(relatedObject);
}
Aggregations