OwnerContentResource { @ApiOperation(notes = "Retrieves a single Content", value = "getContent") @ApiResponses({ @ApiResponse(code = 400, message = "") }) @GET @Produces(MediaType.APPLICATION_JSON) @Path("/{content_id}") public ContentDTO getContent( @Verify(Owner.class) @PathParam("owner_key") String ownerKey, @PathParam("content_id") String contentId) { Owner owner = this.getOwnerByKey(ownerKey); Content content = this.fetchContent(owner, contentId); return this.translator.translate(content, ContentDTO.class); } @Inject  OwnerContentResource(ContentCurator contentCurator, ContentManager contentManager,
        EnvironmentContentCurator envContentCurator, I18n i18n, OwnerCurator ownerCurator,
        OwnerContentCurator ownerContentCurator, PoolManager poolManager, ProductCurator productCurator,
        UniqueIdGenerator idGenerator,  ProductCachedSerializationModule productCachedModule,
        ContentAccessManager contentAccessManager, ModelTranslator translator); @ApiOperation(notes = "Retrieves list of Content", value = "list", response = ContentDTO.class, responseContainer = "list") @GET @Produces(MediaType.APPLICATION_JSON) CandlepinQuery<ContentDTO> listContent(
        @Verify(Owner.class) @PathParam("owner_key") String ownerKey); @ApiOperation(notes = "Retrieves a single Content", value = "getContent") @ApiResponses({ @ApiResponse(code = 400, message = "") }) @GET @Produces(MediaType.APPLICATION_JSON) @Path("/{content_id}") ContentDTO getContent(
        @Verify(Owner.class) @PathParam("owner_key") String ownerKey,
        @PathParam("content_id") String contentId); @ApiOperation(notes = "Creates a Content", value = "createContent") @POST @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) ContentDTO createContent(@PathParam("owner_key") String ownerKey,
        @ApiParam(name = "content", required = true) ContentDTO content); @ApiOperation(notes = "Creates Contents in bulk", value = "createBatchContent") @POST @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) @Path("/batch") @Transactional Collection<ContentDTO> createBatchContent(@PathParam("owner_key") String ownerKey,
        @ApiParam(name = "contents", required = true) List<ContentDTO> contents); @ApiOperation(notes = "Updates a Content", value = "updateContent") @PUT @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) @Path("/{content_id}") ContentDTO updateContent(@PathParam("owner_key") String ownerKey,
        @PathParam("content_id") String contentId,
        @ApiParam(name = "content", required = true) ContentDTO content); @ApiOperation(notes = "Deletes a Content", value = "remove") @DELETE @Produces(MediaType.APPLICATION_JSON) @Path("/{content_id}") void remove(@PathParam("owner_key") String ownerKey,
        @PathParam("content_id") String contentId);  }
@Test public void getContent() { Owner owner = this.createOwner("test_owner"); Content content = this.createContent("test_content", "test_content", owner); ContentDTO output = this.ownerContentResource.getContent(owner.getKey(), content.getId()); assertNotNull(output); assertEquals(content.getId(), output.getId()); }
@Test public void getContentNotFound() { Owner owner = this.createOwner("test_owner"); assertThrows(NotFoundException.class, () -> this.ownerContentResource.getContent(owner.getKey(), "test_content") ); }