@Test public void testGetPlaylists() throws Exception { doReturn(true).when(dbService).isDBAdmin(); assertEquals(0, dbService.getPlaylists().size()); playlistService.createPlaylist(new Playlist("d1")); assertEquals(1, dbService.getPlaylists().size()); }
@GET @Path("/playlists") @Produces(MediaType.APPLICATION_JSON) public List<Playlist> getPlaylists() { if (!isDBAdmin()) { throwUnauthorized(); } return new PlaylistDAO().getAll("name"); }
DBService extends BasicService { @GET @Path("/playlists") @Produces(MediaType.APPLICATION_JSON) public List<Playlist> getPlaylists() { if (!isDBAdmin()) { throwUnauthorized(); } return new PlaylistDAO().getAll("name"); } }
DBService extends BasicService { @GET @Path("/playlists") @Produces(MediaType.APPLICATION_JSON) public List<Playlist> getPlaylists() { if (!isDBAdmin()) { throwUnauthorized(); } return new PlaylistDAO().getAll("name"); }  }
DBService extends BasicService { @GET @Path("/playlists") @Produces(MediaType.APPLICATION_JSON) public List<Playlist> getPlaylists() { if (!isDBAdmin()) { throwUnauthorized(); } return new PlaylistDAO().getAll("name"); }  @GET @Path("/users") @Produces(MediaType.APPLICATION_JSON) List<User> getUsers(); @GET @Path("/pages") @Produces(MediaType.APPLICATION_JSON) List<Page> getPages(); @GET @Path("/files") @Produces(MediaType.APPLICATION_JSON) List<File> getFiles(); @GET @Path("/playlists") @Produces(MediaType.APPLICATION_JSON) List<Playlist> getPlaylists(); @GET @Path("/screens") @Produces(MediaType.APPLICATION_JSON) List<Screen> getScreens(); @GET @Path("/owners") @Produces(MediaType.APPLICATION_JSON) List<Owner> getOwners(); @GET @Path("/pagereferences") @Produces(MediaType.APPLICATION_JSON) List<PageReference> getPageReferences(); }
DBService extends BasicService { @GET @Path("/playlists") @Produces(MediaType.APPLICATION_JSON) public List<Playlist> getPlaylists() { if (!isDBAdmin()) { throwUnauthorized(); } return new PlaylistDAO().getAll("name"); }  @GET @Path("/users") @Produces(MediaType.APPLICATION_JSON) List<User> getUsers(); @GET @Path("/pages") @Produces(MediaType.APPLICATION_JSON) List<Page> getPages(); @GET @Path("/files") @Produces(MediaType.APPLICATION_JSON) List<File> getFiles(); @GET @Path("/playlists") @Produces(MediaType.APPLICATION_JSON) List<Playlist> getPlaylists(); @GET @Path("/screens") @Produces(MediaType.APPLICATION_JSON) List<Screen> getScreens(); @GET @Path("/owners") @Produces(MediaType.APPLICATION_JSON) List<Owner> getOwners(); @GET @Path("/pagereferences") @Produces(MediaType.APPLICATION_JSON) List<PageReference> getPageReferences();  }