Search in sources :

Example 36 with Application

use of alien4cloud.model.application.Application in project alien4cloud by alien4cloud.

the class DeploymentTopologyStepDefinitions method I_get_the_deployment_toology_for_the_current_application.

@When("^I get the deployment topology for the current application$")
public void I_get_the_deployment_toology_for_the_current_application() throws Throwable {
    Application application = Context.getInstance().getApplication();
    String environmentId = Context.getInstance().getDefaultApplicationEnvironmentId(application.getName());
    String restUrl = String.format("/rest/v1/applications/%s/environments/%s/deployment-topology/", application.getId(), environmentId);
    String response = Context.getRestClientInstance().get(restUrl);
    Context.getInstance().registerRestResponse(response);
}
Also used : Application(alien4cloud.model.application.Application) When(cucumber.api.java.en.When)

Example 37 with Application

use of alien4cloud.model.application.Application in project alien4cloud by alien4cloud.

the class DeploymentTopologyStepDefinitions method executeUpdateDeploymentTopologyCall.

private void executeUpdateDeploymentTopologyCall(UpdateDeploymentTopologyRequest request) throws IOException {
    Application application = Context.getInstance().getApplication();
    String envId = Context.getInstance().getDefaultApplicationEnvironmentId(application.getName());
    String restUrl = String.format("/rest/v1/applications/%s/environments/%s/deployment-topology", application.getId(), envId);
    String response = Context.getRestClientInstance().putJSon(restUrl, JsonUtil.toString(request));
    Context.getInstance().registerRestResponse(response);
}
Also used : Application(alien4cloud.model.application.Application)

Example 38 with Application

use of alien4cloud.model.application.Application in project alien4cloud by alien4cloud.

the class DeploymentTopologyStepDefinitions method I_Set_the_following_location_policies_for_groups.

@When("^I Set the following location policies with orchestrator \"([^\"]*)\" for groups$")
public void I_Set_the_following_location_policies_for_groups(String orchestratorName, Map<String, String> locationPolicies) throws Throwable {
    SetLocationPoliciesRequest request = new SetLocationPoliciesRequest();
    String orchestratorId = Context.getInstance().getOrchestratorId(orchestratorName);
    request.setOrchestratorId(orchestratorId);
    Map<String, String> formatedPolicies = Maps.newHashMap();
    for (Entry<String, String> entry : locationPolicies.entrySet()) {
        formatedPolicies.put(entry.getKey(), Context.getInstance().getLocationId(orchestratorId, entry.getValue()));
    }
    request.setGroupsToLocations(formatedPolicies);
    Application application = Context.getInstance().getApplication();
    String environmentId = Context.getInstance().getDefaultApplicationEnvironmentId(application.getName());
    String restUrl = String.format("/rest/v1/applications/%s/environments/%s/deployment-topology/location-policies", application.getId(), environmentId);
    String response = Context.getRestClientInstance().postJSon(restUrl, JsonUtil.toString(request));
    Context.getInstance().registerRestResponse(response);
}
Also used : SetLocationPoliciesRequest(alien4cloud.rest.application.model.SetLocationPoliciesRequest) Application(alien4cloud.model.application.Application) When(cucumber.api.java.en.When)

Example 39 with Application

use of alien4cloud.model.application.Application in project alien4cloud by alien4cloud.

the class DeploymentTopologyStepDefinitions method iUploadAFileLocatedAtForTheInputArtifact.

@When("^I upload a file located at \"([^\"]*)\" for the input artifact \"([^\"]*)\"$")
public void iUploadAFileLocatedAtForTheInputArtifact(String localFile, String inputArtifactName) throws Throwable {
    Application application = Context.getInstance().getApplication();
    String envId = Context.getInstance().getDefaultApplicationEnvironmentId(application.getName());
    String url = String.format("/rest/applications/%s/environments/%s/deployment-topology/inputArtifacts/%s/upload", application.getId(), envId, inputArtifactName);
    Context.getInstance().registerRestResponse(Context.getRestClientInstance().postMultipart(url, Paths.get(localFile).getFileName().toString(), Files.newInputStream(Paths.get(localFile))));
}
Also used : Application(alien4cloud.model.application.Application) When(cucumber.api.java.en.When)

Example 40 with Application

use of alien4cloud.model.application.Application in project alien4cloud by alien4cloud.

the class DeploymentTopologyStepDefinitions method i_update_the_capability_property_to_for_the_subtituted_node.

@When("^I update the capability \"(.*?)\" property \"(.*?)\" to \"(.*?)\" for the subtituted node \"(.*?)\"$")
public void i_update_the_capability_property_to_for_the_subtituted_node(String capabilityName, String propertyName, String propertyValue, String nodeName) throws Throwable {
    Context context = Context.getInstance();
    Application application = context.getApplication();
    String envId = context.getDefaultApplicationEnvironmentId(application.getName());
    UpdatePropertyRequest request = new UpdatePropertyRequest(propertyName, propertyValue);
    String restUrl = String.format("/rest/v1/applications/%s/environments/%s/deployment-topology/substitutions/%s/capabilities/%s/properties", application.getId(), envId, nodeName, capabilityName);
    String response = Context.getRestClientInstance().postJSon(restUrl, JsonUtil.toString(request));
    context.registerRestResponse(response);
}
Also used : EvaluationContext(org.springframework.expression.EvaluationContext) Context(alien4cloud.it.Context) StandardEvaluationContext(org.springframework.expression.spel.support.StandardEvaluationContext) UpdatePropertyRequest(alien4cloud.rest.topology.UpdatePropertyRequest) Application(alien4cloud.model.application.Application) When(cucumber.api.java.en.When)

Aggregations

Application (alien4cloud.model.application.Application)103 PreAuthorize (org.springframework.security.access.prepost.PreAuthorize)45 ApiOperation (io.swagger.annotations.ApiOperation)43 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)39 ApplicationEnvironment (alien4cloud.model.application.ApplicationEnvironment)38 Audit (alien4cloud.audit.annotation.Audit)28 List (java.util.List)14 Topology (org.alien4cloud.tosca.model.templates.Topology)14 Set (java.util.Set)12 DeploymentTopology (alien4cloud.model.deployment.DeploymentTopology)11 RestResponse (alien4cloud.rest.model.RestResponse)11 Collectors (java.util.stream.Collectors)11 Map (java.util.Map)10 ApplicationEnvironmentService (alien4cloud.application.ApplicationEnvironmentService)9 ApplicationTopologyVersion (alien4cloud.model.application.ApplicationTopologyVersion)9 Arrays (java.util.Arrays)9 When (cucumber.api.java.en.When)8 Deployment (alien4cloud.model.deployment.Deployment)7 RestResponseBuilder (alien4cloud.rest.model.RestResponseBuilder)7 ApplicationEnvironmentAuthorizationDTO (alien4cloud.rest.orchestrator.model.ApplicationEnvironmentAuthorizationDTO)7