Package org.springframework.data.neo4j.aspects

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


        assertThat(loaded.getMentorship(), is(nullValue()));
    }
    @Test
    @Transactional
    public void testUpdateSingleRelatedToViaField() {
        Group group = persist(new Group());
        group.setMentorship(new Mentorship(persist(new Person()),group));
        persist(group);
        final Long firstMentorshipId = group.getMentorship().getId();
        final Person mentor2 = new Person();
        group.setMentorship(new Mentorship(persist(mentor2),group));
        persist(group);
        final Node node = neo4jTemplate.getPersistentState(group);
        assertEquals(1,IteratorUtil.count(node.getRelationships(Direction.INCOMING,DynamicRelationshipType.withName("mentors"))));
        final Group loaded = neo4jTemplate.load(node, Group.class);
        assertFalse(loaded.getMentorship().getId().equals(firstMentorshipId));
        assertEquals(mentor2, group.getMentorship().getMentor());
        assertEquals(group, group.getMentorship().getGroup());
    }
View Full Code Here


        assertEquals(testTeam.emil.getName(),michael.getBossName());
    }

    @Test
    public void testEmptyQueryReturnsZero() {
        final Group group = neo4jTemplate.save(new Group());
        assertEquals("empty result leads to zero",(Long)0L, group.getMemberCount());
    }
View Full Code Here

    private static final String NAME_VALUE2 = "aSecondName";

    @Test
    @Transactional
    public void testFindGroupByInstanceIndex() {
        Group group = persist(new SubGroup());
        group.setIndexLevelName("indexLevelNameValue");
        Index<Node> subGroupIndex = neo4jTemplate.getIndex(SubGroup.class);
        final Node found = subGroupIndex.get("indexLevelName", "indexLevelNameValue").getSingle();
        final SubGroup foundEntity = neo4jTemplate.createEntityFromState(found, SubGroup.class, neo4jTemplate.getMappingPolicy(SubGroup.class));
        assertEquals(group, foundEntity);
    }
View Full Code Here

    }

    @Test
    @Transactional
    public void testDontFindGroupByNonIndexedFieldWithAnnotation() {
        Group group = persist(new Group());
        group.setUnindexedName("value-unindexedName");
        final Group found = this.groupRepository.findByPropertyValue("unindexedName", "value-unindexedName");
        assertNull(found);
    }
View Full Code Here

    }

    @Test
    @Transactional
    public void testFindByNamedQuery() {
        Group team = personRepository.findTeam(testTeam.michael);
        assertThat(team, is(testTeam.sdg));
    }
View Full Code Here

    @Test
    @Transactional
    public void testTraverseFromGroupToPeople() {
        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 = neo4jTemplate.<Person>traverse(group, Person.class, traversalDescription);
        final HashSet<Person> found = new HashSet<Person>();
        for (Person person : people) {
            found.add(person);
View Full Code Here

    @SuppressWarnings("unchecked")
    @Test
    @Transactional
    public void testTraverseFromGroupToPeoplePaths() {
        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"), Direction.OUTGOING).evaluator(Evaluators.excludeStartPosition());
        Iterable<EntityPath<Group,Person>> paths = (Iterable<EntityPath<Group, Person>>) neo4jTemplate.<EntityPath<Group,Person>>traverse(group, EntityPath.class, traversalDescription);
        for (EntityPath<Group, Person> path : paths) {
            assertEquals(group, path.startEntity());
            assertEquals(p, path.endEntity());
View Full Code Here

    @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

TOP

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

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.