Package org.springframework.data.neo4j.aspects

Examples of org.springframework.data.neo4j.aspects.Person


    }

    @Test
    @Transactional
    public void testTraverseFieldFromGroupToPeople() {
        Person p = persistedPerson("Michael", 35);
        Group group = persist(new Group());
        group.addPerson(p);
        assertEquals(Collections.singletonList(p),IteratorUtil.asCollection(group.getPeople()));
    }
View Full Code Here


//    @Ignore("TODO - add back when strict setting working properly again in AbstractMappingContext.getPersistentEntity")
    @Test
    @Transactional
    public void testTraverseFieldFromGroupToPeopleNodes() {
        Person p = persistedPerson("Michael", 35);
        Group group = persist(new Group());
        group.addPerson(p);
        assertEquals(Collections.singletonList(getNodeState(p)), IteratorUtil.asCollection(group.getPeopleNodes()));
    }
View Full Code Here

//    @Ignore("TODO - add back when strict setting working properly again in AbstractMappingContext.getPersistentEntity")
    @Test
    @Transactional
    public void testTraverseFieldFromGroupToPeopleRelationships() {
        Person p = persistedPerson("Michael", 35);
        Group group = persist(new Group());
        group.addPerson(p);
        Relationship personRelationship = getNodeState(group).getSingleRelationship(DynamicRelationshipType.withName("persons"), Direction.OUTGOING);
        assertEquals(Collections.singletonList(personRelationship), IteratorUtil.asCollection(group.getPeopleRelationships()));
    }
View Full Code Here

    @Test
    @Transactional
    public void testTraverseFromGroupToPeopleWithFinder() {
        final GraphRepository<Person> finder = neo4jTemplate.repositoryFor(Person.class);
        Person p = persistedPerson("Michael", 35);
        Group group = persist(new Group());
        group.setName("dev");
        group.addPerson(p);
        final TraversalDescription traversalDescription = Traversal.description().relationships(DynamicRelationshipType.withName("persons")).evaluator(Evaluators.excludeStartPosition());
        Iterable<Person> people = finder.findAllByTraversal(group, traversalDescription);
View Full Code Here

public class FinderTests extends EntityTestBase {

    @Test
    @Transactional
    public void testFinderFindAll() {
        Person p1 = persistedPerson("Michael", 35);
        Person p2 = persistedPerson("David", 25);
        Iterable<Person> allPersons = personRepository.findAll();
        assertThat(asCollection(allPersons), hasItems(p1, p2));
    }
View Full Code Here

    @Test
    @Transactional
    public void testFindPersonWithQueryAnnotation() {
        testTeam.createSDGTeam();
        Person boss = personRepository.findBoss(testTeam.michael);
        assertThat(boss, is(testTeam.emil));
    }
View Full Code Here

    }

    @Test
    @Transactional
    public void testSaveManyPeople() {
        Person p1 = new Person("Michael", 35);
        Person p2 = new Person("David", 25);
        personRepository.save(asList(p1,p2));
        assertEquals("persisted person 1", true, hasPersistentState(p1));
        assertEquals("persisted person 2", true, hasPersistentState(p2));
        assertThat(asCollection(personRepository.findAll()), hasItems(p2, p1));
    }
View Full Code Here

    }

    @Test
    @Transactional
    public void testSavePerson() {
        Person p1 = new Person("Michael", 35);
        personRepository.save(p1);
        assertEquals("persisted person", true, hasPersistentState(p1));
        assertThat(personRepository.findOne(p1.getId()), is(p1));
    }
View Full Code Here

        assertEquals("persisted person", true, hasPersistentState(p1));
        assertThat(personRepository.findOne(p1.getId()), is(p1));
    }
    @Test
    public void testDeletePerson() {
        Person p1 = persistedPerson("Michael", 35);
        personRepository.delete(p1);
        try (Transaction tx = graphDatabaseService.beginTx()) {
            assertEquals("people deleted", false, personRepository.findAll().iterator().hasNext());
            tx.success();
        }
View Full Code Here

            tx.success();
        }
    }
    @Test
    public void testDeletePeople() {
        Person p1 = persistedPerson("Michael", 35);
        Person p2 = persistedPerson("David", 26);
        personRepository.delete(asList(p1,p2));
        try (Transaction tx = graphDatabaseService.beginTx()) {
            assertEquals("people deleted", false, personRepository.findAll().iterator().hasNext());
            tx.success();
        }
View Full Code Here

TOP

Related Classes of org.springframework.data.neo4j.aspects.Person

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.