use of org.neo4j.ogm.metadata.ClassInfo in project neo4j-ogm by neo4j.
the class RelationalReaderWriterTest method testUserV10.
// DATAGRAPH-636
@Test
public void testUserV10() {
ClassInfo classInfo = this.domainInfo.getClass(UserV10.class.getName());
UserV10 instance = new UserV10();
UserV10 relatedObjectOut = new UserV10();
UserV10 relatedObjectIn = new UserV10();
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.getLikes()).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.getLikedBy()).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 testUserV14.
// DATAGRAPH-636
@Test
public void testUserV14() {
ClassInfo classInfo = this.domainInfo.getClass(UserV14.class.getName());
UserV14 instance = new UserV14();
UserV14 relatedObject = new UserV14();
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.knows).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 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.ClassInfo 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.ClassInfo 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);
}
Aggregations