DeployerResource implements Resource { @GET @Timed @Produces(MediaType.APPLICATION_JSON) @Path("applications/{seaCloudsId}") @ApiOperation(value = "Get SeaClouds Application details from the Deployer Component") public Response getApplication(@PathParam("seaCloudsId") String seaCloudsId) throws IOException { if (seaCloudsId == null) { LOG.error("Missing input parameters"); return Response.status(Response.Status.NOT_ACCEPTABLE).build(); } else { SeaCloudsApplicationData seaCloudsApplicationData = dataStore.getSeaCloudsApplicationDataById(seaCloudsId); if (seaCloudsApplicationData == null) { return Response.status(Response.Status.BAD_REQUEST).build(); } for (JsonNode application : deployer.getApplicationsTree()) { if(application.get("id").asText().equals(seaCloudsApplicationData.getDeployerApplicationId())){ return Response.ok(application).build(); } } return Response.status(Response.Status.BAD_REQUEST).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 testGetApplication() throws Exception { assertNull(deployerResource.getApplication("this-app-doesn't-exist").getEntity()); SeaCloudsApplicationData application = (SeaCloudsApplicationData) deployerResource.addApplication(getDam()).getEntity(); assertNotNull(deployerResource.getApplication(application.getSeaCloudsApplicationId())); }