Search in sources :

Example 31 with When

use of cucumber.api.java.en.When in project alien4cloud by alien4cloud.

the class ApplicationEnvironmentStepDefinitions method getAllApplicationEnvironments.

@When("^I get all application environments for application \"([^\"]*)\"$")
public void getAllApplicationEnvironments(String applicationId) throws Throwable {
    FilteredSearchRequest request = new FilteredSearchRequest();
    request.setFrom(0);
    // This is actually the maximum search size in a4c (1000 by default)
    request.setSize(AlienConstants.MAX_ES_SEARCH_SIZE);
    Context.getInstance().registerRestResponse(Context.getRestClientInstance().postJSon("/rest/v1/applications/" + applicationId + "/environments/search", JsonUtil.toString(request)));
    try {
        RestResponse<GetMultipleDataResult> restResponse = JsonUtil.read(Context.getInstance().getRestResponse(), GetMultipleDataResult.class);
        ALL_ENVIRONMENTS = new ApplicationEnvironmentDTO[restResponse.getData().getData().length];
        TestUtils.convert(restResponse.getData(), ALL_ENVIRONMENTS, ApplicationEnvironmentDTO.class);
        CURRENT_ENVIRONMENT_DTO = ALL_ENVIRONMENTS[0];
    } catch (IOException e) {
    // Registration is optional
    }
}
Also used : FilteredSearchRequest(alien4cloud.rest.model.FilteredSearchRequest) IOException(java.io.IOException) GetMultipleDataResult(alien4cloud.dao.model.GetMultipleDataResult) When(cucumber.api.java.en.When)

Example 32 with When

use of cucumber.api.java.en.When in project alien4cloud by alien4cloud.

the class ApplicationsDeploymentStepDefinitions method I_deploy_it.

@When("^I deploy it$")
public void I_deploy_it() throws Throwable {
    // deploys the current application on default "Environment"
    log.info("Deploy : Deploying the application " + ApplicationStepDefinitions.CURRENT_APPLICATION.getName());
    DeployApplicationRequest deployApplicationRequest = getDeploymentAppRequest(ApplicationStepDefinitions.CURRENT_APPLICATION.getName(), null);
    String response = deploy(deployApplicationRequest);
    Context.getInstance().registerRestResponse(response);
}
Also used : DeployApplicationRequest(alien4cloud.rest.application.model.DeployApplicationRequest) When(cucumber.api.java.en.When)

Example 33 with When

use of cucumber.api.java.en.When in project alien4cloud by alien4cloud.

the class DeploymentTopologyStepDefinitions method iSetTheInputsPropertyAsASecretWithTheFollowingParameters.

@When("^I set the inputs property \"([^\"]*)\" as a secret with the following parameters$")
public void iSetTheInputsPropertyAsASecretWithTheFollowingParameters(String propertyName, Map<String, String> parameters) throws Throwable {
    FunctionPropertyValue functionPropertyValue = new FunctionPropertyValue();
    functionPropertyValue.setFunction(parameters.get("functionName"));
    functionPropertyValue.setParameters(Arrays.asList(parameters.get("secretPath")));
    UpdateDeploymentTopologyRequest request = new UpdateDeploymentTopologyRequest();
    request.setInputProperties(parseAndReplaceProperties(ImmutableMap.of(propertyName, functionPropertyValue)));
    executeUpdateDeploymentTopologyCall(request);
}
Also used : FunctionPropertyValue(org.alien4cloud.tosca.model.definitions.FunctionPropertyValue) UpdateDeploymentTopologyRequest(alien4cloud.rest.application.model.UpdateDeploymentTopologyRequest) When(cucumber.api.java.en.When)

Example 34 with When

use of cucumber.api.java.en.When in project alien4cloud by alien4cloud.

the class DeploymentTopologyStepDefinitions method iSelectTheFileFromTheCurrentTopologyArchiveForTheInputArtifact.

@When("^I select the file \"([^\"]*)\" from the current topology archive for the input artifact \"([^\"]*)\"$")
public void iSelectTheFileFromTheCurrentTopologyArchiveForTheInputArtifact(String fileRef, 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/update", application.getId(), envId, inputArtifactName);
    DeploymentArtifact inputArtifact = new DeploymentArtifact();
    inputArtifact.setArchiveName(application.getId());
    inputArtifact.setArchiveVersion(TestUtils.getVersionFromId(Context.getInstance().getTopologyId()));
    inputArtifact.setArtifactRef(fileRef);
    inputArtifact.setArtifactRepository(ArtifactRepositoryConstants.ALIEN_TOPOLOGY_REPOSITORY);
    Context.getInstance().registerRestResponse(Context.getRestClientInstance().postJSon(url, JsonUtil.toString(inputArtifact)));
}
Also used : Application(alien4cloud.model.application.Application) DeploymentArtifact(org.alien4cloud.tosca.model.definitions.DeploymentArtifact) When(cucumber.api.java.en.When)

Example 35 with When

use of cucumber.api.java.en.When 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)

Aggregations

When (cucumber.api.java.en.When)161 TestUtils.nullAsString (alien4cloud.it.utils.TestUtils.nullAsString)12 Application (alien4cloud.model.application.Application)10 FlowPayload (org.openkilda.messaging.payload.flow.FlowPayload)9 Response (com.jayway.restassured.response.Response)7 IOException (java.io.IOException)6 List (java.util.List)6 StandardEvaluationContext (org.springframework.expression.spel.support.StandardEvaluationContext)6 FilteredSearchRequest (alien4cloud.rest.model.FilteredSearchRequest)5 Then (cucumber.api.java.en.Then)5 Collectors (java.util.stream.Collectors)5 Action (org.talend.dataprep.helper.api.Action)5 ComponentSearchRequest (alien4cloud.rest.component.ComponentSearchRequest)4 TopologyDTO (alien4cloud.topology.TopologyDTO)4 Path (java.nio.file.Path)4 HashMap (java.util.HashMap)4 UiApplicationDriver (org.activityinfo.test.driver.UiApplicationDriver)4 PivotTableEditor (org.activityinfo.test.pageobject.web.reports.PivotTableEditor)4 IslInfoData (org.openkilda.messaging.info.event.IslInfoData)4 WebElement (org.openqa.selenium.WebElement)4