ComponentResource { @POST @Consumes(MediaType.APPLICATION_JSON) @Timed @UnitOfWork @UserRequired @ApiOperation(value = "Save computation", response = ComponentDomain.class) public Response save(@NotNull @Valid final ComponentDomain component) { final ComponentDomain savedComponent = service.save(component); return Response.status(Response.Status.CREATED).entity(savedComponent).build(); }  @POST @Consumes(MediaType.APPLICATION_JSON) @Timed @UnitOfWork @UserRequired @ApiOperation(value = "Save computation", response = ComponentDomain.class) Response save(@NotNull @Valid final ComponentDomain component); @GET @Path("/versions") @Timed @UnitOfWork(transactional = false) @ApiOperation(value = "Get all computation grouped by version", response = ComponentDomain.class) Response getAllGroupedByVersion(@QueryParam("namespace") final String namespace,
            @QueryParam("name") final String name); @GET @Path("/{namespace}/{name}/{version}") @Timed @UnitOfWork(transactional = false) @ApiOperation(value = "Get component based on namespace, name and version", response = ComponentDomain.class) Response get(@PathParam("namespace") final String namespace, @PathParam("name") final String name,
            @PathParam("version") final String version); @GET @Timed @UnitOfWork(transactional = false) @ApiOperation(value = "Searches component based on param", response = Set.class) Response search(@QueryParam("namespace") final String namespace, @QueryParam("name") final String name,
            @QueryParam("version") final String version); @GET @Path("/{id}") @UnitOfWork(transactional = false) @ApiOperation(value = "Get component by id", response = ComponentDomain.class) Response get(@PathParam("id") final int internalId); @POST @Consumes(MediaType.APPLICATION_JSON) @Path("/register") @Timed @UnitOfWork @UserRequired @ApiOperation(value = "Registers a processor/source jar from url", response = List.class) Response register(@Context final UriInfo uriinfo, @QueryParam("url") final String url); @UserRequired @POST @Consumes(MediaType.APPLICATION_JSON) @Path("/artifact") @Timed @UnitOfWork @ApiOperation(value = "Registers a processor/source jar from artifactory", response = List.class) Response registerFromArtifactory(@Context UriInfo uriinfo,
            @NotNull final ArtifactoryRegistrationRequest request);  }
@Test public void testValidSave() { doReturn(component).when(service).save(any(ComponentDomain.class)); final Response response = resource.save(component); Assert.assertEquals(response.getStatus(), 201); Assert.assertEquals(response.getEntity(), component); }