Package org.springframework.data.neo4j.examples.hellograph.domain

Examples of org.springframework.data.neo4j.examples.hellograph.domain.World


        // the NodeBacked class is being used here as its helpful to
        // IDE's which struggle with aspectj stuff
        //
    //     return new World(name, moons).persist();

        World world = new World(name, moons);
        ((NodeBacked)world).persist();
        return world;
  }
View Full Code Here


       
    // Solar worlds   
    worlds.add(createWorld("Mercury", 0));
    worlds.add(createWorld("Venus", 0));
       
        World earth = createWorld("Earth", 1);       
        World mars = createWorld("Mars", 2);       
        mars.addRocketRouteTo(earth);
        worldRepository.save(mars);
        worlds.add(earth);
        worlds.add(mars);
       
        worlds.add(createWorld("Jupiter", 63));
View Full Code Here

  }
 
  @Test
    public void shouldAllowDirectWorldCreation() {
    assertEquals(0, galaxyService.getNumberOfWorlds());
    World myWorld = galaxyService.createWorld("mine", 0);
        assertEquals(1, galaxyService.getNumberOfWorlds());
       
        Iterable<World> foundWorlds = galaxyService.getAllWorlds();
        World mine = foundWorlds.iterator().next();
        assertEquals(myWorld.getName(), mine.getName());
    }
View Full Code Here

    @Test
    public void shouldFindWorldsById() {
      galaxyService.makeSomeWorlds();
     
        for(World world : galaxyService.getAllWorlds()) {
          World foundWorld = galaxyService.findWorldById(world.getId());
            assertNotNull(foundWorld);
        }
    }
View Full Code Here

    @Test
    public void shouldFindWorldsByName() {
      galaxyService.makeSomeWorlds();
     
        for(World world : galaxyService.getAllWorlds()) {
          World foundWorld = galaxyService.findWorldByName(world.getName());
            assertNotNull(foundWorld);
        }
    }
View Full Code Here

   
    @Test
    public void shouldReachMarsFromEarth() {
        galaxyService.makeSomeWorlds();

        World earth = galaxyService.findWorldByName("Earth");
        World mars = galaxyService.findWorldByName("Mars");

        assertTrue(mars.canBeReachedFrom(earth));
        assertTrue(earth.canBeReachedFrom(mars));
    }
View Full Code Here

    }
   
  @Test
  public void shouldNotFindKrypton() {
    galaxyService.makeSomeWorlds();
    World krypton = galaxyService.findWorldByName("Krypton");
    assertNull(krypton);
  }
View Full Code Here

  public long getNumberOfWorlds() {
    return worldRepository.count();
  }
 
  public World createWorld(String name, int moons) {
    return worldRepository.save(new World(name, moons));
  }
View Full Code Here

       
    // Solar worlds   
    worlds.add(createWorld("Mercury", 0));
    worlds.add(createWorld("Venus", 0));
       
        World earth = createWorld("Earth", 1);       
        World mars = createWorld("Mars", 2);       
        mars.addRocketRouteTo(earth);
        worldRepository.save(mars);
        worlds.add(earth);
        worlds.add(mars);
       
        worlds.add(createWorld("Jupiter", 63));
View Full Code Here

  }
 
  @Test
    public void shouldAllowDirectWorldCreation() {
    assertEquals(0, galaxyService.getNumberOfWorlds());
    World myWorld = galaxyService.createWorld("mine", 0);
        assertEquals(1, galaxyService.getNumberOfWorlds());
       
        Iterable<World> foundWorlds = galaxyService.getAllWorlds();
        World mine = foundWorlds.iterator().next();
        assertEquals(myWorld.getName(), mine.getName());
    }
View Full Code Here

TOP

Related Classes of org.springframework.data.neo4j.examples.hellograph.domain.World

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.