DeployerResource implements Resource { @GET @Timed @Produces(MediaType.APPLICATION_JSON) @Path("applications") @ApiOperation(value = "List all SeaClouds deployed Applications") public Response listApplications() throws IOException { List<SeaCloudsApplicationData> applications = dataStore.listSeaCloudsApplicationData(); for (SeaCloudsApplicationData application : applications) { ApplicationSummary applicationSummary = deployer.getApplication(application.getDeployerApplicationId()); application.setDeploymentStatus(applicationSummary.getStatus()); if (application.getAgreementId() != null) { GuaranteeTermsStatus agreementStatus = sla.getAgreementStatus(application.getAgreementId()); application.setAgreementStatus(IGuaranteeTerm.GuaranteeTermStatusEnum.valueOf(agreementStatus.getValue())); } } return Response.ok(applications).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 testListApplications() throws Exception { List<SeaCloudsApplicationData> list = (List<SeaCloudsApplicationData>) deployerResource.listApplications().getEntity(); assertTrue(list.isEmpty()); deployerResource.addApplication(getDam()); deployerResource.addApplication(getDam()); deployerResource.addApplication(getDam()); list = (List<SeaCloudsApplicationData>) deployerResource.listApplications().getEntity(); assertEquals(list.size(), 3); }