SystemService extends BasicService { @GET @Path("/configsections") @Produces(MediaType.APPLICATION_JSON) public List<ConfigSection> getConfigSections() { if (!isAdmin()) { throwUnauthorized(); } return ConfigUtil.getConfigSections(true); }  @GET @Path("/info") @Produces(MediaType.APPLICATION_JSON) SystemInfo getSytemInfo(); @GET @Path("/sampledata") @Produces(MediaType.APPLICATION_JSON) Response createSampleData(); @GET @Path("/configsections") @Produces(MediaType.APPLICATION_JSON) List<ConfigSection> getConfigSections(); @PUT @Path("/configsections/{group}") @Consumes(MediaType.APPLICATION_JSON) Response updateConfigSection(ConfigSection section, @PathParam("group") String group); @DELETE @Path("/configsections/{group}/{key}") @Consumes(MediaType.APPLICATION_JSON) Response deleteDBConfigKey(@PathParam("group") String group, @PathParam("key") String key); @POST @Path("/reloadconfig") Response reloadConfiguration(); @POST @Path("/clearcache") @Produces(MediaType.APPLICATION_JSON) Response clearCaches();  }
@Test public void testGetConfiguration() throws Exception { doReturn(true).when(systemService).isAdmin(); assertTrue(systemService.getConfigSections().size() > 0); assertTrue(systemService.getConfigSections().get(0).getParameters().size() > 0); assertNotNull(systemService.getConfigSections().get(0).getParameters().get(0).getCurrentValue()); }
@Test(expected = WebApplicationException.class) public void testGetConfigAsNonAdmin() throws Exception { systemService.getConfigSections(); }