Search in sources :

Example 86 with When

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

the class ApplicationsDeploymentStepDefinitions method iUpdateTheDeploymentWithTheFollowingCredentialsDefinedByTheSecretProviderPlugin.

@When("^I update the deployment with the following credentials defined by the secret provider plugin \"([^\"]*)\"$")
public void iUpdateTheDeploymentWithTheFollowingCredentialsDefinedByTheSecretProviderPlugin(String pluginName, DataTable table) throws Throwable {
    SecretProviderCredentials secretProviderCredentials = new SecretProviderCredentials();
    secretProviderCredentials.setPluginName(pluginName);
    secretProviderCredentials.setCredentials(DataTableUtils.dataTableToMap(table));
    doUpdateDeployment(ApplicationStepDefinitions.CURRENT_APPLICATION.getName(), null, secretProviderCredentials);
}
Also used : SecretProviderCredentials(alien4cloud.deployment.model.SecretProviderCredentials) When(cucumber.api.java.en.When)

Example 87 with When

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

the class ApplicationsDeploymentStepDefinitions method iDeployItWithTheFollowingCredentialsDefinedByTheSecretProviderPlugin.

@When("^I deploy it with the following credentials defined by the secret provider plugin \"([^\"]*)\"$")
public void iDeployItWithTheFollowingCredentialsDefinedByTheSecretProviderPlugin(String pluginName, DataTable table) throws Throwable {
    DeployApplicationRequest deployApplicationRequest = getDeploymentAppRequest(ApplicationStepDefinitions.CURRENT_APPLICATION.getName(), null);
    deployApplicationRequest.setSecretProviderCredentials(DataTableUtils.dataTableToMap(table));
    deployApplicationRequest.setSecretProviderPluginName(pluginName);
    String response = deploy(deployApplicationRequest);
    Context.getInstance().registerRestResponse(response);
}
Also used : DeployApplicationRequest(alien4cloud.rest.application.model.DeployApplicationRequest) When(cucumber.api.java.en.When)

Example 88 with When

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

the class ApplicationStepDefinitions method I_update_the_application_environment_named_with_values.

@When("^I update the application environment named \"([^\"]*)\" with values$")
public void I_update_the_application_environment_named_with_values(String applicationEnvironmentName, DataTable appEnvAttributeValues) throws Throwable {
    UpdateApplicationEnvironmentRequest appEnvRequest = new UpdateApplicationEnvironmentRequest();
    String attribute = null, attributeValue = null;
    for (List<String> attributesToUpdate : appEnvAttributeValues.raw()) {
        attribute = attributesToUpdate.get(0);
        attributeValue = attributesToUpdate.get(1);
        switch(attribute) {
            case "name":
                appEnvRequest.setName(attributeValue);
                break;
            case "description":
                appEnvRequest.setDescription(attributeValue);
                break;
            case "environmentType":
                appEnvRequest.setEnvironmentType(EnvironmentType.valueOf(attributeValue));
                break;
            case "currentVersionId":
                appEnvRequest.setCurrentVersionId(attributeValue);
                break;
            default:
                log.info("Attribute [ {} ] not found in ApplicationEnvironmentRequest object", attribute);
                break;
        }
    }
    String environmentId = Context.getInstance().getApplicationEnvironmentId(CURRENT_APPLICATION.getName(), applicationEnvironmentName);
    // send the update request
    Context.getInstance().registerRestResponse(getRestClientInstance().putJSon("/rest/v1/applications/" + CURRENT_APPLICATION.getId() + "/environments/" + environmentId, JsonUtil.toString(appEnvRequest)));
    if (StringUtils.isNotBlank(appEnvRequest.getName())) {
        Context.getInstance().registerApplicationEnvironmentId(CURRENT_APPLICATION.getId(), appEnvRequest.getName(), environmentId);
    }
}
Also used : UpdateApplicationEnvironmentRequest(alien4cloud.rest.application.model.UpdateApplicationEnvironmentRequest) TestUtils.nullAsString(alien4cloud.it.utils.TestUtils.nullAsString) When(cucumber.api.java.en.When)

Example 89 with When

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

the class ApplicationStepDefinitions method I_search_applications_from_with_result_size_of.

@When("^I search applications from (\\d+) with result size of (\\d+)$")
public void I_search_applications_from_with_result_size_of(int from, int to) throws Throwable {
    FilteredSearchRequest searchRequest = new FilteredSearchRequest("", from, to, null);
    previousRestResponse = Context.getInstance().getRestResponse();
    Context.getInstance().registerRestResponse(getRestClientInstance().postJSon("/rest/v1/applications/search", JsonUtil.toString(searchRequest)));
}
Also used : FilteredSearchRequest(alien4cloud.rest.model.FilteredSearchRequest) When(cucumber.api.java.en.When)

Example 90 with When

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

the class DefineAsDefaultForCapabilityDefinitionsSteps method I_unflag_the_node_type_as_default_for_the_capability.

@When("^I unflag the node type \"([^\"]*)\" as default for the \"([^\"]*)\" capability$")
public void I_unflag_the_node_type_as_default_for_the_capability(String componentId, String capability) throws Throwable {
    RecommendationRequest recRequest = new RecommendationRequest(componentId, capability);
    String jSon = jsonMapper.writeValueAsString(recRequest);
    Context.getInstance().registerRestResponse(Context.getRestClientInstance().postJSon("/rest/v1/components/unflag", jSon));
}
Also used : RecommendationRequest(alien4cloud.rest.component.RecommendationRequest) When(cucumber.api.java.en.When)

Aggregations

When (cucumber.api.java.en.When)148 TestUtils.nullAsString (alien4cloud.it.utils.TestUtils.nullAsString)12 Application (alien4cloud.model.application.Application)10 FlowPayload (org.openkilda.messaging.payload.flow.FlowPayload)6 StandardEvaluationContext (org.springframework.expression.spel.support.StandardEvaluationContext)6 ComponentSearchRequest (alien4cloud.rest.component.ComponentSearchRequest)5 FilteredSearchRequest (alien4cloud.rest.model.FilteredSearchRequest)5 TopologyDTO (alien4cloud.topology.TopologyDTO)4 Path (java.nio.file.Path)4 List (java.util.List)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 MvcResult (org.springframework.test.web.servlet.MvcResult)4 NotFoundException (alien4cloud.exception.NotFoundException)3 Context (alien4cloud.it.Context)3 MetaPropConfiguration (alien4cloud.model.common.MetaPropConfiguration)3 DeployApplicationRequest (alien4cloud.rest.application.model.DeployApplicationRequest)3 UpdateDeploymentTopologyRequest (alien4cloud.rest.application.model.UpdateDeploymentTopologyRequest)3