DeployerResource implements Resource { @POST @Timed @Produces(MediaType.APPLICATION_JSON) @Path("applications") @ApiOperation("Adds new application to SeaClouds Platform based on a SeaClouds-compliant TOSCA DAM specification") public Response addApplication(@ApiParam() String dam) { SeaCloudsApplicationData seaCloudsApplication = null; if (dam == null) { LOG.error("Missing input parameters"); return Response.status(Response.Status.NOT_ACCEPTABLE).build(); } else { try { LOG.debug("Deploy new application process started"); seaCloudsApplication = new SeaCloudsApplicationData(dam); TaskSummary taskSummary = deployer.deployApplication(dam); seaCloudsApplication.setDeployerApplicationId(taskSummary); dataStore.addSeaCloudsApplicationData(seaCloudsApplication); return Response.ok(seaCloudsApplication).build(); } catch (Exception e) { LOG.error(e.getMessage(), e); return Response.status(Response.Status.BAD_REQUEST).entity(e).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 testAddApplication() throws Exception { SeaCloudsApplicationData application = (SeaCloudsApplicationData) deployerResource.addApplication(getDam()).getEntity(); assertNotNull(application.getName()); assertNotNull(application.getToscaDam()); assertNotNull(application.getAgreementId()); assertNotNull(application.getDeployerApplicationId()); assertNotNull(application.getMonitoringRulesIds()); }