Package org.springframework.data.neo4j

Examples of org.springframework.data.neo4j.Friendship


    @Transactional
    @Rollback(false)
    public void testRelationshipSetPropertyDate() {
        Person p = persistedPerson("Michael", 35);
        Person p2 = persistedPerson("David", 25);
        Friendship f = p.knows(p2);
        f.setFirstMeetingDate(new Date(3));
        assertEquals("Date not serialized properly.", "3", f.getPersistentState().getProperty("Friendship.firstMeetingDate"));
    }
View Full Code Here


    @Test
    @Transactional
    public void testRelationshipGetPropertyDate() {
        Person p = persistedPerson("Michael", 35);
        Person p2 = persistedPerson("David", 25);
        Friendship f = p.knows(p2);
        f.getPersistentState().setProperty("Friendship.firstMeetingDate", "3");
        assertEquals("Date not deserialized properly.", new Date(3), f.getFirstMeetingDate());
    }
View Full Code Here

    @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");
        f.getPersistentState().getProperty("Friendship.latestLocation");
    }
View Full Code Here

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

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

    // 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

    @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

    @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 = john.getPersistentState().getSingleRelationship(DynamicRelationshipType.withName("knows"), Direction.OUTGOING);
View Full Code Here

    @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 = john.getPersistentState().getSingleRelationship(DynamicRelationshipType.withName("knows"), Direction.OUTGOING);
View Full Code Here

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

TOP

Related Classes of org.springframework.data.neo4j.Friendship

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.