TaxonomyService extends BaseService { @DELETE @Path("{taxonomyName}") @Produces(Servlets.JSON_MEDIA_TYPE) public Response deleteTaxonomy(@Context HttpHeaders headers, @Context UriInfo ui, @PathParam("taxonomyName") String taxonomyName) throws CatalogException { AtlasPerfTracer perf = null; try { if (AtlasPerfTracer.isPerfTraceEnabled(PERF_LOG)) { perf = AtlasPerfTracer.getPerfTracer(PERF_LOG, "TaxonomyService.deleteTaxonomy(" + taxonomyName + ")"); } Map<String, Object> properties = new HashMap<>(); properties.put("name", taxonomyName); deleteResource(taxonomyResourceProvider, new InstanceRequest(properties)); return Response.status(Response.Status.OK).entity( new Results(ui.getRequestUri().toString(), 200)).build(); } finally { AtlasPerfTracer.log(perf); } }  @Inject void setMetadataService(MetadataService metadataService, AtlasTypeDefStore typeDefStore); @GET @Path("{taxonomyName}") @Produces(Servlets.JSON_MEDIA_TYPE) Response getTaxonomy(@Context HttpHeaders headers,
                                @Context UriInfo ui,
                                @PathParam("taxonomyName") String taxonomyName); @GET @Produces(Servlets.JSON_MEDIA_TYPE) Response getTaxonomies(@Context HttpHeaders headers, @Context UriInfo ui); @POST @Path("{taxonomyName}") @Produces(Servlets.JSON_MEDIA_TYPE) Response createTaxonomy(String body,
                                   @Context HttpHeaders headers,
                                   @Context UriInfo ui,
                                   @PathParam("taxonomyName") String taxonomyName); @PUT @Path("{taxonomyName}") @Produces(Servlets.JSON_MEDIA_TYPE) Response updateTaxonomy(String body,
                                   @Context HttpHeaders headers,
                                   @Context UriInfo ui,
                                   @PathParam("taxonomyName") String taxonomyName); @DELETE @Path("{taxonomyName}") @Produces(Servlets.JSON_MEDIA_TYPE) Response deleteTaxonomy(@Context HttpHeaders headers,
                                   @Context UriInfo ui,
                                   @PathParam("taxonomyName") String taxonomyName); @GET @Path("{taxonomyName}/terms/{termName}") @Produces(Servlets.JSON_MEDIA_TYPE) Response getTaxonomyTerm(@Context HttpHeaders headers,
                                    @Context UriInfo ui,
                                    @PathParam("taxonomyName") String taxonomyName,
                                    @PathParam("termName") String termName); @GET @Path("{taxonomyName}/terms") @Produces(Servlets.JSON_MEDIA_TYPE) Response getTaxonomyTerms(@Context HttpHeaders headers,
                                     @Context UriInfo ui,
                                     @PathParam("taxonomyName") String taxonomyName); @GET @Path("{taxonomyName}/terms/{rootTerm}/{remainder:.*}") @Produces(Servlets.JSON_MEDIA_TYPE) Response getSubTerms(@Context HttpHeaders headers,
                            @Context UriInfo ui,
                            @PathParam("taxonomyName") String taxonomyName,
                            @PathParam("rootTerm") String rootTerm,
                            @PathParam("remainder") String remainder); @POST @Path("{taxonomyName}/terms/{termName}") @Produces(Servlets.JSON_MEDIA_TYPE) Response createTerm(String body,
                               @Context HttpHeaders headers,
                               @Context UriInfo ui,
                               @PathParam("taxonomyName") String taxonomyName,
                               @PathParam("termName") String termName); @POST @Path("{taxonomyName}/terms/{termName}/{remainder:.*}") @Produces(Servlets.JSON_MEDIA_TYPE) Response createSubTerm(String body,
                                  @Context HttpHeaders headers,
                                  @Context UriInfo ui,
                                  @PathParam("taxonomyName") String taxonomyName,
                                  @PathParam("termName") String termName,
                                  @PathParam("remainder") String remainder); @PUT @Path("{taxonomyName}/terms/{termName}") @Produces(Servlets.JSON_MEDIA_TYPE) Response updateTerm(String body,
                               @Context HttpHeaders headers,
                               @Context UriInfo ui,
                               @PathParam("taxonomyName") String taxonomyName,
                               @PathParam("termName") String termName); @PUT @Path("{taxonomyName}/terms/{termName}/{remainder:.*}") @Produces(Servlets.JSON_MEDIA_TYPE) Response updateSubTerm(String body,
                                  @Context HttpHeaders headers,
                                  @Context UriInfo ui,
                                  @PathParam("taxonomyName") String taxonomyName,
                                  @PathParam("termName") String termName,
                                  @PathParam("remainder") String remainder); @DELETE @Path("{taxonomyName}/terms/{termName}") @Produces(Servlets.JSON_MEDIA_TYPE) Response deleteTerm(@Context HttpHeaders headers,
                               @Context UriInfo ui,
                               @PathParam("taxonomyName") String taxonomyName,
                               @PathParam("termName") String termName); @DELETE @Path("{taxonomyName}/terms/{termName}/{remainder:.*}") @Produces(Servlets.JSON_MEDIA_TYPE) Response deleteSubTerm(@Context HttpHeaders headers,
                                  @Context UriInfo ui,
                                  @PathParam("taxonomyName") String taxonomyName,
                                  @PathParam("termName") String termName,
                                  @PathParam("remainder") String remainder);  }
@Test public void testDeleteTaxonomy() throws Exception { MetadataService metadataService = createStrictMock(MetadataService.class); AtlasTypeDefStore typeDefStore = createStrictMock(AtlasTypeDefStore.class); ResourceProvider taxonomyResourceProvider = createStrictMock(ResourceProvider.class); ResourceProvider termResourceProvider = createStrictMock(ResourceProvider.class); UriInfo uriInfo = createNiceMock(UriInfo.class); URI uri = new URI("http: Capture<Request> requestCapture = newCapture(); expect(uriInfo.getRequestUri()).andReturn(uri); taxonomyResourceProvider.deleteResourceById(capture(requestCapture)); expect(metadataService.getTypeDefinition(TaxonomyResourceProvider.TAXONOMY_TERM_TYPE)).andReturn(TaxonomyResourceProvider.TAXONOMY_TERM_TYPE + "-definition"); replay(uriInfo, metadataService, taxonomyResourceProvider, termResourceProvider); TestTaxonomyService service = new TestTaxonomyService( metadataService, typeDefStore, taxonomyResourceProvider, termResourceProvider, null); Response response = service.deleteTaxonomy(null, uriInfo, "testTaxonomy"); Request request = requestCapture.getValue(); assertEquals(request.getQueryProperties().size(), 1); assertEquals(request.getQueryProperties().get("name"), "testTaxonomy"); assertNull(request.getQueryString()); assertEquals(response.getStatus(), 200); BaseService.Results createResults = (BaseService.Results) response.getEntity(); assertEquals(createResults.href, "http: assertEquals(createResults.status, 200); verify(uriInfo, taxonomyResourceProvider, termResourceProvider); }