@Test public void testSLCOperatorLimitGetSecurityEvents() throws URISyntaxException { injector.setOperatorContext(); URI mockUri = new URI("/rest/securityEvent?limit=2&offset=0"); when(uriInfo.getRequestUri()).thenReturn(mockUri); Response response = resource.getAll(uriInfo); Object responseEntityObj = null; if (response.getEntity() instanceof EntityResponse) { EntityResponse resp = (EntityResponse) response.getEntity(); responseEntityObj = resp.getEntity(); } else { fail("Should always return EntityResponse: " + response); } if (responseEntityObj instanceof EntityBody) { assertNotNull(responseEntityObj); } else if (responseEntityObj instanceof List<?>) { @SuppressWarnings("unchecked") List<EntityBody> results = (List<EntityBody>) responseEntityObj; assertEquals("unexpected number of entities", 2, results.size()); } else { fail("Response entity not recognized: " + response); } }
@Override @GET @RightsAllowed({ Right.SECURITY_EVENT_VIEW }) public Response getAll(@Context final UriInfo uriInfo) { return getAllResponseBuilder.build(uriInfo, getOnePartTemplate(), ResourceMethod.GET, new GetResourceLogic() { @Override public ServiceResponse run(Resource resource) { return resourceService.getEntities(resource, uriInfo.getRequestUri(), false); } }); }
SecurityEventResource extends UnversionedResource { @Override @GET @RightsAllowed({ Right.SECURITY_EVENT_VIEW }) public Response getAll(@Context final UriInfo uriInfo) { return getAllResponseBuilder.build(uriInfo, getOnePartTemplate(), ResourceMethod.GET, new GetResourceLogic() { @Override public ServiceResponse run(Resource resource) { return resourceService.getEntities(resource, uriInfo.getRequestUri(), false); } }); } }
SecurityEventResource extends UnversionedResource { @Override @GET @RightsAllowed({ Right.SECURITY_EVENT_VIEW }) public Response getAll(@Context final UriInfo uriInfo) { return getAllResponseBuilder.build(uriInfo, getOnePartTemplate(), ResourceMethod.GET, new GetResourceLogic() { @Override public ServiceResponse run(Resource resource) { return resourceService.getEntities(resource, uriInfo.getRequestUri(), false); } }); }  }
SecurityEventResource extends UnversionedResource { @Override @GET @RightsAllowed({ Right.SECURITY_EVENT_VIEW }) public Response getAll(@Context final UriInfo uriInfo) { return getAllResponseBuilder.build(uriInfo, getOnePartTemplate(), ResourceMethod.GET, new GetResourceLogic() { @Override public ServiceResponse run(Resource resource) { return resourceService.getEntities(resource, uriInfo.getRequestUri(), false); } }); }  @Override @GET @RightsAllowed({ Right.SECURITY_EVENT_VIEW }) Response getAll(@Context final UriInfo uriInfo); @Override @GET @Path("{id}") @RightsAllowed({ Right.SECURITY_EVENT_VIEW}) Response getWithId(@PathParam("id") final String idList, @Context final UriInfo uriInfo); @Override @RightsAllowed({ Right.SECURITY_EVENT_VIEW}) CustomEntityResource getCustomResource(final String id, final UriInfo uriInfo); @Override @POST @RightsAllowed({ Right.SECURITY_EVENT_VIEW}) Response post(final EntityBody entityBody, @Context final UriInfo uriInfo); @PUT @Path("{id}") @RightsAllowed({ Right.SECURITY_EVENT_VIEW}) Response put(@PathParam("id") final String id, final EntityBody entityBody,
            @Context final UriInfo uriInfo); @Override @DELETE @Path("{id}") @RightsAllowed({ Right.SECURITY_EVENT_VIEW}) Response delete(@PathParam("id") final String id, @Context final UriInfo uriInfo); @Override @PATCH @Path("{id}") @RightsAllowed({ Right.SECURITY_EVENT_VIEW}) Response patch(@PathParam("id") final String id,
                          final EntityBody entityBody,
                          @Context final UriInfo uriInfo); @OPTIONS @RightsAllowed({Right.SECURITY_EVENT_VIEW}) Response options(); }
SecurityEventResource extends UnversionedResource { @Override @GET @RightsAllowed({ Right.SECURITY_EVENT_VIEW }) public Response getAll(@Context final UriInfo uriInfo) { return getAllResponseBuilder.build(uriInfo, getOnePartTemplate(), ResourceMethod.GET, new GetResourceLogic() { @Override public ServiceResponse run(Resource resource) { return resourceService.getEntities(resource, uriInfo.getRequestUri(), false); } }); }  @Override @GET @RightsAllowed({ Right.SECURITY_EVENT_VIEW }) Response getAll(@Context final UriInfo uriInfo); @Override @GET @Path("{id}") @RightsAllowed({ Right.SECURITY_EVENT_VIEW}) Response getWithId(@PathParam("id") final String idList, @Context final UriInfo uriInfo); @Override @RightsAllowed({ Right.SECURITY_EVENT_VIEW}) CustomEntityResource getCustomResource(final String id, final UriInfo uriInfo); @Override @POST @RightsAllowed({ Right.SECURITY_EVENT_VIEW}) Response post(final EntityBody entityBody, @Context final UriInfo uriInfo); @PUT @Path("{id}") @RightsAllowed({ Right.SECURITY_EVENT_VIEW}) Response put(@PathParam("id") final String id, final EntityBody entityBody,
            @Context final UriInfo uriInfo); @Override @DELETE @Path("{id}") @RightsAllowed({ Right.SECURITY_EVENT_VIEW}) Response delete(@PathParam("id") final String id, @Context final UriInfo uriInfo); @Override @PATCH @Path("{id}") @RightsAllowed({ Right.SECURITY_EVENT_VIEW}) Response patch(@PathParam("id") final String id,
                          final EntityBody entityBody,
                          @Context final UriInfo uriInfo); @OPTIONS @RightsAllowed({Right.SECURITY_EVENT_VIEW}) Response options(); static final String RESOURCE_NAME; }