Examples of Friendship


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

    @Test(expected = NotFoundException.class)
    @Transactional
    public void testRelationshipSetTransientPropertyFieldNotManaged() {
        Person p = persistedPerson("Michael", 35);
        Person p2 = persistedPerson("David", 25);
        Friendship f = p.knows(p2);
        f.setLatestLocation("Menlo Park");
        getRelationshipState(f).getProperty("Friendship.latestLocation");
    }
View Full Code Here

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

    @Test
    @Transactional
    public void testRelationshipGetTransientPropertyFieldNotManaged() {
        Person p = persistedPerson("Michael", 35);
        Person p2 = persistedPerson("David", 25);
        Friendship f = p.knows(p2);
        f.setLatestLocation("Menlo Park");
        getRelationshipState(f).setProperty("Friendship.latestLocation", "Palo Alto");
        assertEquals("Should not have read transient value from graph.", "Menlo Park", f.getLatestLocation());
    }
View Full Code Here

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

    @Test
    @Transactional
    public void testRelationshipIdField() {
        Person p = persistedPerson("Michael", 35);
        Person p2 = persistedPerson("David", 25);
        Friendship f = p.knows(p2);
    assertEquals("Wrong ID.", (Long) getRelationshipState(f).getId(), getRelationshipId(f));
    }
View Full Code Here

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

    @Transactional
    public void testRelationshipGetEntities() {
        Person p = persistedPerson("Michael", 35);
        Person p2 = persistedPerson("David", 25);
        Person p3 = persistedPerson("Emil", 32);
        Friendship f2 = p.knows(p2);
        Friendship f3 = p.knows(p3);
        assertEquals(new HashSet<Friendship>(Arrays.asList(f2, f3)), IteratorUtil.addToCollection(p.getFriendships().iterator(), new HashSet<Friendship>()));
    }
View Full Code Here

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

    @Test
    @Transactional
    public void multipleRelationshipsOfSameTypeBetweenTwoEntities() {
        Person michael = persistedPerson("Michael", 35);
        Person david = persistedPerson("David", 25);
        Friendship friendship1 = neo4jTemplate.createRelationshipBetween(michael, david, Friendship.class, "knows", true);
        friendship1.setYears(1);
        Friendship friendship2 = neo4jTemplate.createRelationshipBetween(michael, david, Friendship.class, "knows", true);
        friendship2.setYears(2);
        assertTrue("two different relationships", friendship1 != friendship2);
        assertTrue("two different relationships", getRelationshipState(friendship1) != getRelationshipState(friendship2));
        assertEquals(1, friendship1.getYears());
        assertEquals(2,friendship2.getYears());
        final Collection<Relationship> friends = IteratorUtil.asCollection(getNodeState(michael).getRelationships(Direction.OUTGOING, DynamicRelationshipType.withName("knows")));
        assertEquals(2,friends.size());
        assertTrue(friends.contains(getRelationshipState(friendship1)));
        assertTrue(friends.contains(getRelationshipState(friendship2)));
    }
View Full Code Here

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

    @Test
    @Transactional
    public void testCanIndexIntFieldsOnRelationshipEntities() {
        Person p = persistedPerson(NAME_VALUE, 35);
        Person p2 = persistedPerson(NAME_VALUE2, 25);
        Friendship friendship = p.knows(p2);
        friendship.setYears(1);
        GraphRepository<Friendship> friendshipFinder = neo4jTemplate.repositoryFor(Friendship.class);
        assertEquals(friendship, friendshipFinder.findByPropertyValue("Friendship.years", 1));
    }
View Full Code Here

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

    @Test
    @Transactional
    public void testFindRelationshipEntity() {
        Person p1 = persistedPerson("Michael", 35);
        Person p2 = persistedPerson("David", 27);
        Friendship friendship = p1.knows(p2);
        assertEquals("Wrong friendship count.", 1L, (long) friendshipRepository.count());
        assertEquals(friendship, friendshipRepository.findOne(getRelationshipId(friendship)));
        assertEquals("Did not find friendship.", Collections.singleton(friendship), new HashSet<Friendship>(IteratorUtil.asCollection(friendshipRepository.findAll())));
    }
View Full Code Here

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

    @Test
    @Transactional
    public void testRelationshipProperties() {
        Person james = persistedPerson("James", 36);
        Person john = persistedPerson("John", 36);
        Friendship f = john.knows(james);
        DynamicProperties props = f.getPersonalProperties();
        props.setProperty("s", "String");
        props.setProperty("x", 100);
        props.setProperty("pi", 3.1415);

        Relationship rel = getNodeState(john).getSingleRelationship(DynamicRelationshipType.withName("knows"), Direction.OUTGOING);
View Full Code Here

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

    @Test
    @Transactional
    public void testRelationshipRemoveProperty() {
        Person james = persistedPerson("James", 36);
        Person john = persistedPerson("John", 36);
        Friendship f = john.knows(james);
        DynamicProperties props = f.getPersonalProperties();
        props.setProperty("s", "String");
        props.setProperty("x", 100);
        props.setProperty("pi", 3.1415);

        Relationship rel = getNodeState(john).getSingleRelationship(DynamicRelationshipType.withName("knows"), Direction.OUTGOING);
View Full Code Here

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

    @Transactional
    @Ignore
    public void testCanIndexIntFieldsOnRelationshipEntities() {
        Person p = persistedPerson(NAME_VALUE, 35);
        Person p2 = persistedPerson(NAME_VALUE2, 25);
        Friendship friendship = p.knows(p2);
        friendship.setYears(1);
        GraphRepository<Friendship> friendshipFinder = neo4jTemplate.repositoryFor(Friendship.class);
        assertEquals(friendship, friendshipFinder.findByPropertyValue("Friendship.years", 1));
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.