Package org.springframework.data.neo4j.model

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


  @Autowired
  private FriendshipRepository friendshipRepo;
 
  @Test(expected=ValidationException.class)
  public void testNodePropertyValidation() {
      personRepo.save(new Person("Li", 102));
  }
View Full Code Here


      personRepo.save(new Person("Li", 102));
  }
 
  @Test(expected=ValidationException.class)
    public void testRelationshipPropertyValidation() {
        final Person john = personRepo.save(new Person("John", 50));
        final Person jack = personRepo.save(new Person("Jack", 45));
        final Friendship friendship = john.knows(jack);
        friendship.setYears(100);
        friendshipRepo.save(friendship);
    }
View Full Code Here

        storeInGraph(emil);
        michael.setHeight((short)182);
        michael.setPersonality(Personality.EXTROVERT);
        michael.setBoss(emil);
        storeInGraph(michael);
        final Person loaded = template.findOne(michael.getId(), Person.class);
        assertEquals("loaded id", michael.getId(),loaded.getId());
        assertEquals("loaded simple property", michael.getName(),loaded.getName());
        assertEquals("loaded simple short property", michael.getHeight(),loaded.getHeight());
        assertEquals("loaded simple converted property", michael.getPersonality(),loaded.getPersonality());
        final Person boss = loaded.getBoss();
        assertNotNull("instance non-fetch relationship", boss);
        assertEquals("id of non-fetch relationship", emil.getId(), boss.getId());
        assertNull("no properties of non-fetch relationship", boss.getName());

    }
View Full Code Here

        final Node existingNode = createNewNode();
        existingNode.setProperty("name", "Michael");
        existingNode.setProperty("age", 36);
        existingNode.setProperty("personality", "EXTROVERT");
        existingNode.setProperty("birthdate", "100");
        final Person p = readPerson(existingNode);
        assertEquals("Michael", p.getName());
        assertEquals(36, p.getAge());
        assertEquals(new Date(100), p.getBirthdate());
        assertEquals(Personality.EXTROVERT, p.getPersonality());
    }
View Full Code Here

    }

    private <T> void neo4jPropertyTest(final T value) {
        michael.setDynamicProperty(value);
        storeInGraph(michael);
        final Person loaded = template.findOne(michael.getId(), Person.class);
        assertEquals(value, loaded.getDynamicProperty());
    }
View Full Code Here

    @Test
    public void testReadEntityFromExistingNode() {
        final Node node = createNewNode();
        node.setProperty("name", "Emil");
        final Person p = readPerson(node);
        assertEquals("Emil", p.getName());
    }
View Full Code Here

        assertEquals("Emil", p.getName());
    }

    @Test
    public void testSetRelationshipWithPreExistingNode() {
        Person emil1 = emil;
        storeInGraph(emil1);
        michael.setBoss(emil);
        storeInGraph(michael);
        final Node boss = getRelatedNodes(michaelNode(), "boss", Direction.INCOMING).get(0);
        assertEquals("added additional relationship end node", emil.getId(), (Long) boss.getId());
View Full Code Here

        storeInGraph(michael);
        storeInGraph(andres);

        Relationship friendshipRelationship = makeFriends(michaelNode(), andresNode(), 19);

        Person m = readPerson(michaelNode());
        Friendship friendship = first(m.getFriendships());

        assertEquals((Long) friendshipRelationship.getId(), friendship.getId());
        assertEquals(19, friendship.getYears());
        assertEquals(friendship.getPerson1(), michael);
        assertEquals(friendship.getPerson2(), andres);
View Full Code Here

        conversionService = template.getConversionService();


        tx = template.getGraphDatabase().beginTx();
        group = new Group();
        michael = new Person("Michael", 37);
        emil = new Person("Emil", 30);
        andres = new Person("Andrés", 36);
    }
View Full Code Here

    public void testBasicRepositoryFunctionality() {
        startJavaBasedAppCtx();
        GraphDatabaseService graphDatabaseService = appCtx.getBean(GraphDatabaseService.class);
        PersonRepository personRepository = appCtx.getBean(PersonRepository.class);
        try (Transaction tx = graphDatabaseService.beginTx()) {
            Person person = new Person("Howdy",50);
            personRepository.save(person);
            assertNotNull(person.getId());
            tx.success();
        }
    }
View Full Code Here

TOP

Related Classes of org.springframework.data.neo4j.model.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.