Examples of Friendship


Examples of org.springframework.data.neo4j.Friendship

    @Test
    @Transactional
    public void shouldNotCreateSameRelationshipTwice() {
        Person p = persistedPerson("Michael", 35);
        Person p2 = persistedPerson("David", 25);
        Friendship f = p.knows(p2);
        Friendship f2 = p.knows(p2);
        assertEquals(f, f2);
        assertEquals(1, IteratorUtil.count(p.getFriendships()));
    }
View Full Code Here

Examples of org.springframework.data.neo4j.Friendship

    @Test
    @Transactional
    public void testRelationshipSetProperty() {
        Person p = persistedPerson("Michael", 35);
        Person p2 = persistedPerson("David", 25);
        Friendship f = p.knows(p2);
        f.setYears(1);
        assertEquals(1, f.getPersistentState().getProperty("Friendship.years"));
    }
View Full Code Here

Examples of org.springframework.data.neo4j.Friendship

    @Test
    @Transactional
    public void testRelationshipGetProperty() {
        Person p = persistedPerson("Michael", 35);
        Person p2 = persistedPerson("David", 25);
        Friendship f = p.knows(p2);
        f.getPersistentState().setProperty("Friendship.years", 1);
        assertEquals(1, f.getYears());
    }
View Full Code Here

Examples of org.springframework.data.neo4j.Friendship

    @Test
    @Transactional
    public void testRelationshipGetStartNodeAndEndNode() {
        Person p = persistedPerson("Michael", 35);
        Person p2 = persistedPerson("David", 25);
        Friendship f = p.knows(p2);
        assertEquals(p, f.getPerson1());
        assertEquals(p2, f.getPerson2());
    }
View Full Code Here

Examples of org.springframework.data.neo4j.Friendship

    @Test
    @Transactional
    public void testGetRelationshipToReturnsRelationship() {
        Person p = persistedPerson("Michael", 35);
        Person p2 = persistedPerson("David", 25);
        Friendship f = p.knows(p2);
        assertEquals(f,p.getRelationshipTo(p2, Friendship.class, "knows"));
    }
View Full Code Here

Examples of org.springframework.data.neo4j.Friendship

    }

    @Test
    public void testRemoveRelationshipEntity() {
        cleanDb();
        Friendship f;
        Transaction tx = graphDatabaseService.beginTx();
        try
        {
            Person p = persistedPerson("Michael", 35);
            Person p2 = persistedPerson("David", 25);
            f = p.knows(p2);
            tx.success();
        }
        finally
        {
            tx.finish();
        }
        Transaction tx2 = graphDatabaseService.beginTx();
        try
        {
            f.remove();
            tx2.success();
        }
        finally
        {
            tx2.finish();
View Full Code Here

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

    // TODO: Would be nice if this worked outside of a tx
    @Test(expected = NotInTransactionException.class)
    public void foo() {
        Person p = persistedPerson("Michael", 35);
        Person p2 = persistedPerson("David", 26);
        Friendship f = p.knows(p2);
    }
View Full Code Here

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

    @Test
    @Transactional
    public void testRelationshipCreate() {
        Person p = persistedPerson("Michael", 35);
        Person p2 = persistedPerson("David", 25);
        Friendship f = p.knows(p2);
        Relationship rel = getNodeState(p).getSingleRelationship(DynamicRelationshipType.withName("knows"), Direction.OUTGOING);
        assertEquals(getRelationshipState(f), rel);
        assertEquals(getNodeState(p2), rel.getEndNode());
    }
View Full Code Here

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

    @Test
    @Transactional
    public void shouldNotCreateSameRelationshipTwice() {
        Person p = persistedPerson("Michael", 35);
        Person p2 = persistedPerson("David", 25);
        Friendship f = p.knows(p2);
        Friendship f2 = p.knows(p2);
        assertEquals(f, f2);
        assertEquals(1, IteratorUtil.count(p.getFriendships()));
    }
View Full Code Here

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

    @Test
    @Transactional
    public void shouldSupportSetOfRelationshipEntities() {
        Person p = persistedPerson("Michael", 35);
        Person p2 = persistedPerson("David", 25);
        final Friendship friendship = p.knows(p2);
        final Set<Friendship> result = p.getFriendshipsSet();
        assertEquals(1, IteratorUtil.count(result));
        assertEquals(friendship,IteratorUtil.first(result));
    }
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.