Package org.neo4j.cineasts.domain

Examples of org.neo4j.cineasts.domain.Movie


    @Autowired
    CineastsRepository repository;

    @Test
    public void testGetMovie() throws Exception {
        Movie movie = new Movie("1", "Test-Movie").persist();
        Movie found = repository.getMovie("1");
        assertEquals("movie found by id", movie, found);

    }
View Full Code Here


    }

    @Test
    public void testFindTwoMovies() throws Exception {
        Movie movie1 = new Movie("1", "Test-Movie1").persist();
        Movie movie2 = new Movie("2", "Test-Movie2").persist();
        Movie movie3 = new Movie("3", "Another-Movie3").persist();
        List<Movie> found = repository.findMovies("Test*", 2);
        assertEquals("2 movies found",2,found.size());
        assertEquals("2 correct movies found by query", new HashSet<Movie>(asList(movie1, movie2)), new HashSet<Movie>(found));
    }
View Full Code Here

        assertEquals("2 correct movies found by query", new HashSet<Movie>(asList(movie1, movie2)), new HashSet<Movie>(found));
    }

    @Test
    public void testFindTwoMoviesButRestrictToOne() throws Exception {
        Movie movie1 = new Movie("1", "Test-Movie1").persist();
        Movie movie2 = new Movie("2", "Test-Movie2").persist();
        Movie movie3 = new Movie("3", "Another-Movie3").persist();
        List<Movie> found = repository.findMovies("Test*", 1);
        assertEquals("1 movie found",1,found.size());
        assertTrue("1 correct movie found by query", found.get(0).getTitle().startsWith("Test"));
    }
View Full Code Here


    @RequestMapping(value = "/movies/{movieId}", method = RequestMethod.GET, headers = "Accept=text/html")
    public String singleMovieView(final Model model, @PathVariable String movieId) {
        User user = addUser(model);
        Movie movie = moviesRepository.getMovie(movieId);
        model.addAttribute("id", movieId);
        if (movie != null) {
            model.addAttribute("movie", movie);
            final int stars = movie.getStars();
            model.addAttribute("stars", stars);
            Rating rating = null;
            if (user!=null) rating = movie.getRelationshipTo(user, Rating.class, "RATED");
            if (rating == null) rating = new Rating().rate(stars,null);
            model.addAttribute("userRating",rating);
        }
        return "/movies/show";
    }
View Full Code Here

        return "/movies/show";
    }

    @RequestMapping(value = "/movies/{movieId}", method = RequestMethod.POST, headers = "Accept=text/html")
    public String updateMovie(Model model, @PathVariable String movieId, @RequestParam(value = "rated",required = false) Integer stars, @RequestParam(value = "comment",required = false) String comment) {
        Movie movie = moviesRepository.getMovie(movieId);
        User user = userDetailsService.getUserFromSession();
        moviesRepository.rateMovie(movie,user, stars==null ? -1 : stars,comment!=null ? comment.trim() : null);
        return singleMovieView(model,movieId);
    }
View Full Code Here

    @Autowired
    CineastsRepository cineastsRepository;

    @Test
    public void testImportMovie() throws Exception {
        Movie movie = importService.importMovie("2");
        assertEquals("movie-id","2", movie.getId());
        assertEquals("movie-title","Ariel", movie.getTitle());
    }
View Full Code Here

        assertEquals("movie-title","Ariel", movie.getTitle());
    }

    @Test
    public void testImportMovieTwice() throws Exception {
        Movie movie = importService.importMovie("2");
        Movie movie2 = importService.importMovie("2");
        final Movie foundMovie = cineastsRepository.getMovie("2");
        assertEquals("movie-id", movie, foundMovie);
    }
View Full Code Here

    @Autowired
    MovieRepository movieRepository;

    @Test
    public void testImportMovie() throws Exception {
        Movie movie = importService.importMovie("2");
        assertEquals("movie-id","2", movie.getId());
        assertEquals("movie-title","Ariel", movie.getTitle());
    }
View Full Code Here

        assertEquals("movie-title","Ariel", movie.getTitle());
    }

    @Test
    public void testImportMovieTwice() throws Exception {
        Movie movie = importService.importMovie("2");
        Movie movie2 = importService.importMovie("2");
        final Movie foundMovie = movieRepository.findById("2");
        assertEquals("movie-id", movie, foundMovie);
    }
View Full Code Here

    @Autowired
    MovieRepository movieRepository;

    @Test
    public void testGetMovie() throws Exception {
        Movie movie = new Movie("1", "Test-Movie").persist();
        Movie found = movieRepository.findById("1");
        assertEquals("movie found by id", movie, found);

    }
View Full Code Here

TOP

Related Classes of org.neo4j.cineasts.domain.Movie

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.