Package org.ops4j.pax.exam.sample2.service

Examples of org.ops4j.pax.exam.sample2.service.UserService


*/
public class UserTests extends ForgeAPITestBase {

  @Test
  public void testListUsers() throws IOException {
    UserService service = getTestUserForge().createUserService();
    List<User> Users = service.list(null);
    assertNotNull("Null User list", Users);
    assertFalse("Empty User list", Users.isEmpty());
  }
View Full Code Here


    assertFalse("Empty User list", Users.isEmpty());
  }

  @Test
  public void testListUsersSorted() throws IOException {
    UserService service = getTestUserForge().createUserService();
    ListPreferences listPrefs = new ListPreferences();
    listPrefs.setLimit(4);
    listPrefs.setOffset(1);
    listPrefs.setSortBy("username");
    listPrefs.setSortOrder("descending");
    List<User> Users = service.list(listPrefs);
    assertNotNull("Null User list", Users);
    assertFalse("Empty User list", Users.isEmpty());
  }
View Full Code Here

    assertFalse("Empty User list", Users.isEmpty());
  }

  @Test
  public void testUserDetail() throws IOException {
    UserService service = getTestUserForge().createUserService();
    User user = service.get(TEST_USER);
    assertNotNull("Null user", user);
  }
View Full Code Here

        Collection<Map<String, ?>> cast = (Collection<Map<String, ?>>) data.get("cast");
        for (Map<String, ?> entry : cast) {
            Integer id = (Integer) entry.get("id");
            String jobName = (String) entry.get("job");
            if ("Actor".equals(jobName)) {
                Actor actor = new Actor();
                actor.setId(id);
                doImportPerson(actor);
                Role role = new Role();
                role.setActor(actor);
                role.setMovie(movie);
                role.setName((String) entry.get("character"));
View Full Code Here

    @PersistenceContext
    private EntityManager em;

    public Actor findById(int id) {
        Actor actor = em.find(Actor.class, id);
        actor.getRoles();
        return actor;
    }
View Full Code Here

                role.setName((String) entry.get("character"));
                em.persist(role);
                movie.getRoles().add(role);
            }
            else if ("Director".equals(jobName)) {
                Director director = new Director();
                director.setId(id);
                director.getMovies().add(movie);
                doImportPerson(director);
                movie.setDirector(director);
            }
            else {
                logger.info("Could not add person with job {} {}", jobName, entry);
View Full Code Here

    @PersistenceContext
    private EntityManager em;

    public Movie findById(int id) {
        Movie movie = em.find(Movie.class, id);
        movie.getActors();
        movie.getRoles();
        movie.getRatings();
        return movie;
    }
View Full Code Here

        List<Movie> result = new ArrayList<Movie>(ids.size());
        for (Integer id : ids) {
            result.add(importService.importMovie(id));
        }

        final Movie movie = movieService.findById(603);
        userService.rate(micha, movie, 5, "Best of the series");
        return result;
    }
View Full Code Here

        return movies;
    }

    private String importMovieFailsafe(Integer id) {
        try {
            Movie movie = doImportMovie(id);
            return movie.getTitle();
        }
        // CHECKSTYLE:SKIP : catch all wanted
        catch (Exception e) {
            return e.getMessage();
        }
View Full Code Here

    }

    private Movie doImportMovie(Integer movieId) {
        logger.info("Importing movie " + movieId);

        Movie movie = new Movie();
        movie.setId(movieId);

        Map<String, ?> data = loadMovieData(movieId);
        if (data.containsKey("not_found")) {
            throw new RuntimeException("Data for Movie " + movieId + " not found.");
        }
View Full Code Here

TOP

Related Classes of org.ops4j.pax.exam.sample2.service.UserService

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.