Package org.springframework.data.neo4j.inheritance.model

Examples of org.springframework.data.neo4j.inheritance.model.Project


    @Autowired ProjectDetailRepository projectDetailRepository;
    @Autowired Neo4jTemplate template;
    @Test
    @Transactional
    public void testCreatedProjectWithInheritance() throws Exception {
        Project project = new Project();
        project = projectRepository.save(project);

        ProjectDetail projectDetail = new ProjectDetail(validName);
        projectDetailRepository.save(projectDetail);

        ProjectDetailRelationship projectDetailRelationship = new ProjectDetailRelationship(null, project, projectDetail);
        template.save(projectDetailRelationship);

        project.getProjectDetailRelationships().add(projectDetailRelationship);
        project = projectRepository.save(project);

        assertEquals(1, count(projectRepository.findAll()));
        assertEquals(1, count(projectDetailRepository.findAll()));

        ProjectDetail actualProjectDetail = projectDetailRepository.findAll().iterator().next();
        assertEquals(validName, actualProjectDetail.getName());
        assertEquals(project.getEntityId(), actualProjectDetail.getParentProject().getEntityId());

        //all tests above pass without issue -- the test below fails: expected:<1> but was:<0>
        Project actualProject = projectRepository.findOne(project.getEntityId());
        assertEquals(1, actualProject.getProjectDetailRelationships().size());
    }
View Full Code Here

TOP

Related Classes of org.springframework.data.neo4j.inheritance.model.Project

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.