use of org.neo4j.ogm.metadata.FieldInfo in project neo4j-ogm by neo4j.
the class IterableRelationalReaderWriterTest method testUserV2.
/**
* @see DATAGRAPH-636
*/
@Test
public void testUserV2() {
ClassInfo classInfo = this.domainInfo.getClass(UserV2.class.getName());
UserV2 instance = new UserV2();
Set<UserV2> relatedObject = Collections.singleton(new UserV2());
assertThat(EntityAccessManager.getIterableField(classInfo, UserV2.class, KNOWS, Relationship.Direction.INCOMING)).isNull();
FieldInfo relationalWriter = EntityAccessManager.getIterableField(classInfo, UserV2.class, KNOWS, Relationship.Direction.OUTGOING);
relationalWriter.write(instance, relatedObject);
assertThat(instance.getKnows()).isEqualTo(relatedObject);
assertThat(relationalWriter.read(instance)).isEqualTo(relatedObject);
}
use of org.neo4j.ogm.metadata.FieldInfo in project neo4j-ogm by neo4j.
the class IterableRelationalReaderWriterTest method testUserV16.
/**
* @see DATAGRAPH-636
*/
@Test
public void testUserV16() {
ClassInfo classInfo = this.domainInfo.getClass(UserV16.class.getName());
UserV16 instance = new UserV16();
Set<UserV16> relatedObjectOut = Collections.singleton(new UserV16());
Set<UserV16> relatedObjectIn = Collections.singleton(new UserV16());
FieldInfo relationalReader = EntityAccessManager.getIterableField(classInfo, UserV16.class, KNOWS, Relationship.Direction.OUTGOING);
FieldInfo relationalWriter = EntityAccessManager.getIterableField(classInfo, UserV16.class, KNOWS, Relationship.Direction.OUTGOING);
relationalWriter.write(instance, relatedObjectOut);
assertThat(instance.getKnows()).isEqualTo(relatedObjectOut);
assertThat(relationalReader.read(instance)).isEqualTo(relatedObjectOut);
instance = new UserV16();
relationalReader = EntityAccessManager.getIterableField(classInfo, UserV16.class, KNOWS, Relationship.Direction.INCOMING);
relationalWriter = EntityAccessManager.getIterableField(classInfo, UserV16.class, KNOWS, Relationship.Direction.INCOMING);
relationalWriter.write(instance, relatedObjectIn);
assertThat(instance.getKnows()).isEqualTo(relatedObjectIn);
assertThat(relationalReader.read(instance)).isEqualTo(relatedObjectIn);
}
use of org.neo4j.ogm.metadata.FieldInfo in project neo4j-ogm by neo4j.
the class IterableRelationalReaderWriterTest method testUserV15.
/**
* @see DATAGRAPH-636
*/
@Test
public void testUserV15() {
ClassInfo classInfo = this.domainInfo.getClass(UserV15.class.getName());
UserV15 instance = new UserV15();
Set<UserV15> relatedObjectOut = Collections.singleton(new UserV15());
Set<UserV15> relatedObjectIn = Collections.singleton(new UserV15());
FieldInfo relationalReader = EntityAccessManager.getIterableField(classInfo, UserV15.class, KNOWS, Relationship.Direction.OUTGOING);
FieldInfo relationalWriter = EntityAccessManager.getIterableField(classInfo, UserV15.class, KNOWS, Relationship.Direction.OUTGOING);
relationalWriter.write(instance, relatedObjectOut);
assertThat(instance.getKnows()).isEqualTo(relatedObjectOut);
assertThat(relationalReader.read(instance)).isEqualTo(relatedObjectOut);
instance = new UserV15();
relationalReader = EntityAccessManager.getIterableField(classInfo, UserV15.class, KNOWS, Relationship.Direction.INCOMING);
relationalWriter = EntityAccessManager.getIterableField(classInfo, UserV15.class, KNOWS, Relationship.Direction.INCOMING);
relationalWriter.write(instance, relatedObjectIn);
assertThat(instance.getKnows()).isEqualTo(relatedObjectIn);
assertThat(relationalReader.read(instance)).isEqualTo(relatedObjectIn);
}
use of org.neo4j.ogm.metadata.FieldInfo in project neo4j-ogm by neo4j.
the class IterableRelationalReaderWriterTest method testUserV4.
/**
* @see DATAGRAPH-636
*/
@Test
public void testUserV4() {
ClassInfo classInfo = this.domainInfo.getClass(UserV4.class.getName());
UserV4 instance = new UserV4();
Set<UserV4> relatedObject = Collections.singleton(new UserV4());
assertThat(EntityAccessManager.getIterableField(classInfo, UserV4.class, KNOWS, Relationship.Direction.OUTGOING)).isNull();
assertThat(EntityAccessManager.getIterableField(classInfo, UserV4.class, KNOWS, Relationship.Direction.OUTGOING)).isNull();
FieldInfo relationalReader = EntityAccessManager.getIterableField(classInfo, UserV4.class, KNOWS, Relationship.Direction.INCOMING);
FieldInfo relationalWriter = EntityAccessManager.getIterableField(classInfo, UserV4.class, KNOWS, Relationship.Direction.INCOMING);
relationalWriter.write(instance, relatedObject);
assertThat(instance.getFriend()).isEqualTo(relatedObject);
assertThat(relationalReader.read(instance)).isEqualTo(relatedObject);
}
use of org.neo4j.ogm.metadata.FieldInfo in project neo4j-ogm by neo4j.
the class IterableRelationalReaderWriterTest method testUserV19.
/**
* @see DATAGRAPH-636
*/
@Test
public void testUserV19() {
ClassInfo classInfo = this.domainInfo.getClass(UserV19.class.getName());
UserV19 instance = new UserV19();
Set<UserV19> relatedObject = Collections.singleton(new UserV19());
assertThat(EntityAccessManager.getIterableField(classInfo, UserV19.class, KNOWS, Relationship.Direction.OUTGOING)).isNull();
assertThat(EntityAccessManager.getIterableField(classInfo, UserV19.class, KNOWS, Relationship.Direction.OUTGOING)).isNull();
FieldInfo relationalReader = EntityAccessManager.getIterableField(classInfo, UserV19.class, KNOWS, Relationship.Direction.INCOMING);
FieldInfo relationalWriter = EntityAccessManager.getIterableField(classInfo, UserV19.class, KNOWS, Relationship.Direction.INCOMING);
relationalWriter.write(instance, relatedObject);
assertThat(instance.getKnows()).isEqualTo(relatedObject);
assertThat(relationalReader.read(instance)).isEqualTo(relatedObject);
}
Aggregations