Search in sources :

Example 1 with Program

use of org.neo4j.ogm.domain.satellites.Program in project neo4j-ogm by neo4j.

the class SatelliteIntegrationTest method shouldReturnProgramsSortedByRefDesc.

@Test
public void shouldReturnProgramsSortedByRefDesc() {
    Collection<Program> objects = session.loadAll(Program.class, new SortOrder().add(SortOrder.Direction.DESC, "ref"));
    Iterator<Program> iter = objects.iterator();
    Program first = iter.next();
    while (iter.hasNext()) {
        Program next = iter.next();
        assertThat(first.getRef().compareTo(next.getRef()) > 0).isTrue();
        first = next;
    }
}
Also used : Program(org.neo4j.ogm.domain.satellites.Program) SortOrder(org.neo4j.ogm.cypher.query.SortOrder) Test(org.junit.Test)

Example 2 with Program

use of org.neo4j.ogm.domain.satellites.Program in project neo4j-ogm by neo4j.

the class EntityAccessManagerTest method shouldRetrieveObjectAccessForWritingIterableObject.

@Test
public void shouldRetrieveObjectAccessForWritingIterableObject() {
    ClassInfo classInfo = this.domainInfo.getClass(Program.class.getName());
    FieldInfo iterableAccess = EntityAccessManager.getIterableField(classInfo, Satellite.class, "satellites", Relationship.Direction.OUTGOING);
    assertThat(iterableAccess).as("The resultant object accessor shouldn't be null").isNotNull();
    Program spaceProgramme = new Program();
    iterableAccess.write(spaceProgramme, Arrays.asList(new Satellite()));
    assertThat(spaceProgramme.getSatellites()).as("The satellites list wasn't set correctly").isNotNull();
    assertThat(spaceProgramme.getSatellites().isEmpty()).as("The satellites list wasn't set correctly").isFalse();
}
Also used : Program(org.neo4j.ogm.domain.satellites.Program) Satellite(org.neo4j.ogm.domain.satellites.Satellite) FieldInfo(org.neo4j.ogm.metadata.FieldInfo) ClassInfo(org.neo4j.ogm.metadata.ClassInfo) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)2 Program (org.neo4j.ogm.domain.satellites.Program)2 SortOrder (org.neo4j.ogm.cypher.query.SortOrder)1 Satellite (org.neo4j.ogm.domain.satellites.Satellite)1 ClassInfo (org.neo4j.ogm.metadata.ClassInfo)1 FieldInfo (org.neo4j.ogm.metadata.FieldInfo)1