BaseEndpoint { @GET @Path("info/organization") @RestQuery(name = "getorganizationinfo", description = "Returns the current organization.", returnDescription = "", responses = { @RestResponse(description = "The organization details are returned.", responseCode = HttpServletResponse.SC_OK) }) public Response getOrganizationInfo() { final Organization org = securityService.getOrganization(); JValue json = obj(f("adminRole", v(org.getAdminRole())), f("anonymousRole", v(org.getAnonymousRole())), f("id", v(org.getId())), f("name", v(org.getName()))); return RestUtil.R.ok(MediaType.APPLICATION_JSON_TYPE, serializer.toJson(json)); }  @GET @Path("") @RestQuery(name = "getendpointinfo", description = "Returns key characteristics of the API such as the server name and the default version.", returnDescription = "", responses = { @RestResponse(description = "The api information is returned.", responseCode = HttpServletResponse.SC_OK) }) Response getEndpointInfo(); @GET @Path("info/me") @RestQuery(name = "getuserinfo", description = "Returns information on the logged in user.", returnDescription = "", responses = { @RestResponse(description = "The user information is returned.", responseCode = HttpServletResponse.SC_OK) }) Response getUserInfo(); @GET @Path("info/me/roles") @RestQuery(name = "getuserroles", description = "Returns current user's roles.", returnDescription = "", responses = { @RestResponse(description = "The set of roles is returned.", responseCode = HttpServletResponse.SC_OK) }) Response getUserRoles(); @GET @Path("info/organization") @RestQuery(name = "getorganizationinfo", description = "Returns the current organization.", returnDescription = "", responses = { @RestResponse(description = "The organization details are returned.", responseCode = HttpServletResponse.SC_OK) }) Response getOrganizationInfo(); @GET @Path("info/organization/properties") @RestQuery(name = "getorganizationproperties", description = "Returns the current organization's properties.", returnDescription = "", responses = { @RestResponse(description = "The organization properties are returned.", responseCode = HttpServletResponse.SC_OK) }) Response getOrganizationProperties(); @GET @Path("info/organization/properties/engageuiurl") @RestQuery(name = "getorganizationpropertiesengageuiurl", description = "Returns the engage ui url property.", returnDescription = "", responses = { @RestResponse(description = "The engage ui url is returned.", responseCode = HttpServletResponse.SC_OK) }) Response getOrganizationPropertiesEngageUiUrl(); @GET @Path("version") @RestQuery(name = "getversion", description = "Returns a list of available version as well as the default version.", returnDescription = "", responses = { @RestResponse(description = "The default version is returned.", responseCode = HttpServletResponse.SC_OK) }) Response getVersion(); @GET @Path("version/default") @RestQuery(name = "getversiondefault", description = "Returns the default version.", returnDescription = "", responses = { @RestResponse(description = "The default version is returned.", responseCode = HttpServletResponse.SC_OK) }) Response getVersionDefault(); @POST @Path("clearIndex") @RestQuery(name = "clearIndex", description = "Clear the External index", returnDescription = "OK if index is cleared", responses = { @RestResponse(description = "Index is cleared", responseCode = HttpServletResponse.SC_OK), @RestResponse(description = "Unable to clear index", responseCode = HttpServletResponse.SC_INTERNAL_SERVER_ERROR) }) Response clearIndex(); @POST @Path("recreateIndex/{service}") @RestQuery(name = "recreateIndexFromService", description = "Repopulates the external Index from an specific service", returnDescription = "OK if repopulation has started", pathParameters = { @RestParameter(name = "service", isRequired = true, description = "The service to recreate index from. " + "The available services are: Groups, Acl, Themes, Series, Scheduler, Workflow, AssetManager and Comments. " + "The service order (see above) is very important! Make sure, you do not run index rebuild for more than one " + "service at a time!", type = RestParameter.Type.STRING) }, responses = { @RestResponse(description = "OK if repopulation has started", responseCode = HttpServletResponse.SC_OK) }) Response recreateIndexFromService(@PathParam("service") final String service); @POST @Path("recreateIndex") @RestQuery(name = "recreateIndex", description = "Repopulates the External Index directly from the Services", returnDescription = "OK if repopulation has started", responses = { @RestResponse(description = "OK if repopulation has started", responseCode = HttpServletResponse.SC_OK) }) Response recreateIndex();  }
@Test public void testGetOrganizationInfo() throws Exception { final String response = given().log().all().expect().statusCode(SC_OK).when().get(env.host("/info/organization")) .asString(); JSONObject json = (JSONObject) parser.parse(response); assertEquals("ROLE_ADMIN", json.get("adminRole")); assertEquals("ROLE_ANONYMOUS", json.get("anonymousRole")); assertEquals("opencast", json.get("id")); assertEquals("Opencast", json.get("name")); }