DeployerResource implements Resource { @DELETE @Timed @Produces(MediaType.APPLICATION_JSON) @Path("applications/{seaCloudsId}") @ApiOperation(value = "Remove SeaClouds Application from SeaClouds") public Response removeApplication(@PathParam("seaCloudsId") String seaCloudsId) { if (seaCloudsId == null) { LOG.error("Missing input parameters"); return Response.status(Response.Status.NOT_ACCEPTABLE).build(); } SeaCloudsApplicationData seaCloudsApplicationData = dataStore.getSeaCloudsApplicationDataById(seaCloudsId); if (seaCloudsApplicationData == null) { return Response.status(Response.Status.BAD_REQUEST).build(); } dataStore.removeSeaCloudsApplicationDataById(seaCloudsApplicationData.getSeaCloudsApplicationId()); return Response.ok().build(); } DeployerResource(DeployerProxy deployerProxy, SlaProxy slaProxy); @POST @Timed @Produces(MediaType.APPLICATION_JSON) @Path("applications") @ApiOperation("Adds new application to SeaClouds Platform based on a SeaClouds-compliant TOSCA DAM specification") Response addApplication(@ApiParam() String dam); @GET @Timed @Produces(MediaType.APPLICATION_JSON) @Path("applications") @ApiOperation(value = "List all SeaClouds deployed Applications") Response listApplications(); @GET @Timed @Produces(MediaType.APPLICATION_JSON) @Path("applications/{seaCloudsId}") @ApiOperation(value = "Get SeaClouds Application details from the Deployer Component") Response getApplication(@PathParam("seaCloudsId") String seaCloudsId); @DELETE @Timed @Produces(MediaType.APPLICATION_JSON) @Path("applications/{seaCloudsId}") @ApiOperation(value = "Remove SeaClouds Application from SeaClouds") Response removeApplication(@PathParam("seaCloudsId") String seaCloudsId);  }
@Test public void testRemoveApplication() throws Exception { SeaCloudsApplicationData application = (SeaCloudsApplicationData) deployerResource.addApplication(getDam()).getEntity(); deployerResource.addApplication(getDam()); deployerResource.addApplication(getDam()); List<SeaCloudsApplicationData> list = (List<SeaCloudsApplicationData>) deployerResource.listApplications().getEntity(); assertEquals(list.size(), 3); deployerResource.removeApplication(application.getSeaCloudsApplicationId()); list = (List<SeaCloudsApplicationData>) deployerResource.listApplications().getEntity(); assertEquals(list.size(), 2); }