Search in sources :

Example 56 with When

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

the class LocationModifierStep method iCreateALocationModifierWithPluginIdAndBeanNameAndPhaseToTheLocationOfTheOrchestrator.

@When("^I create a location modifier with plugin id \"([^\"]*)\" and bean name \"([^\"]*)\" and phase \"([^\"]*)\" to the location \"([^\"]*)\" of the orchestrator \"([^\"]*)\"$")
public void iCreateALocationModifierWithPluginIdAndBeanNameAndPhaseToTheLocationOfTheOrchestrator(String pluginId, String beanName, String phase, String locationName, String orchestratorName) throws Throwable {
    String orchestratorId = Context.getInstance().getOrchestratorId(orchestratorName);
    String locationId = Context.getInstance().getLocationId(orchestratorId, locationName);
    LocationModifierReference modifier = new LocationModifierReference();
    modifier.setPluginId(pluginId);
    modifier.setBeanName(beanName);
    modifier.setPhase(phase);
    String resp = Context.getRestClientInstance().postJSon(String.format("/rest/v1/orchestrators/%s/locations/%s/modifiers", orchestratorId, locationId), JsonUtil.toString(modifier));
    Context.getInstance().registerRestResponse(resp);
}
Also used : LocationModifierReference(alien4cloud.model.orchestrators.locations.LocationModifierReference) When(cucumber.api.java.en.When)

Example 57 with When

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

the class LocationsDefinitionsSteps method I_update_location_name_from_to_of_the_orchestrator.

@When("^I update location name from \"([^\"]*)\" to \"([^\"]*)\" of the orchestrator \"([^\"]*)\"$")
public void I_update_location_name_from_to_of_the_orchestrator(String locationName, String newName, String orchestratorName) throws Throwable {
    String orchestratorId = Context.getInstance().getOrchestratorId(orchestratorName);
    String locationId = getLocationIdFromName(orchestratorName, locationName);
    UpdateLocationRequest request = new UpdateLocationRequest();
    request.setName(newName);
    String restUrl = String.format("/rest/v1/orchestrators/%s/locations/%s", orchestratorId, locationId);
    Context.getInstance().registerRestResponse(Context.getRestClientInstance().putJSon(restUrl, JsonUtil.toString(request)));
}
Also used : UpdateLocationRequest(alien4cloud.rest.orchestrator.model.UpdateLocationRequest) When(cucumber.api.java.en.When)

Example 58 with When

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

the class LocationsDefinitionsSteps method I_create_a_location_named_and_infrastructure_type_to_the_orchestrator.

@When("^I create a location named \"([^\"]*)\" and infrastructure type \"([^\"]*)\" to the orchestrator \"([^\"]*)\"$")
public void I_create_a_location_named_and_infrastructure_type_to_the_orchestrator(String locationName, String infrastructureType, String orchestratorName) throws Throwable {
    String orchestratorId = Context.getInstance().getOrchestratorId(orchestratorName);
    CreateLocationRequest request = new CreateLocationRequest();
    request.setName(locationName);
    request.setInfrastructureType(infrastructureType);
    String resp = Context.getRestClientInstance().postJSon(String.format("/rest/v1/orchestrators/%s/locations", orchestratorId), JsonUtil.toString(request));
    Context.getInstance().registerRestResponse(resp);
    RestResponse<String> idResponse = JsonUtil.read(resp, String.class);
    Context.getInstance().registerOrchestratorLocation(orchestratorId, idResponse.getData(), locationName);
}
Also used : CreateLocationRequest(alien4cloud.rest.orchestrator.model.CreateLocationRequest) When(cucumber.api.java.en.When)

Example 59 with When

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

the class OrchestrationPolicyLocationResourceSteps method iSetThePropertyToASecretWithASecretPathForThePolicyResourceNamedRelatedToTheLocation.

@When("^I set the property \"([^\"]*)\" to a secret with a secret path \"([^\"]*)\" for the policy resource named \"([^\"]*)\" related to the location \"([^\"]*)\"/\"([^\"]*)\"$")
public void iSetThePropertyToASecretWithASecretPathForThePolicyResourceNamedRelatedToTheLocation(String propertyName, String secretPath, String resourceName, String orchestratorName, String locationName) throws Throwable {
    FunctionPropertyValue functionPropertyValue = new FunctionPropertyValue();
    functionPropertyValue.setFunction(ToscaFunctionConstants.GET_SECRET);
    functionPropertyValue.setParameters(Arrays.asList(secretPath));
    updatePropertyValue(orchestratorName, locationName, resourceName, propertyName, functionPropertyValue, getUpdatePropertyUrlFormat());
}
Also used : FunctionPropertyValue(org.alien4cloud.tosca.model.definitions.FunctionPropertyValue) When(cucumber.api.java.en.When)

Example 60 with When

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

the class OrchestratorsDefinitionsSteps method I_update_orchestrator_name_from_to.

@When("^I update orchestrator name from \"([^\"]*)\" to \"([^\"]*)\"$")
public void I_update_orchestrator_name_from_to(String oldName, String newName) throws Throwable {
    String orchestratorId = Context.getInstance().getOrchestratorId(oldName);
    UpdateOrchestratorRequest updateOrchestratorRequest = new UpdateOrchestratorRequest();
    updateOrchestratorRequest.setName(newName);
    Context.getInstance().registerRestResponse(Context.getRestClientInstance().putJSon("/rest/v1/orchestrators/" + orchestratorId, JsonUtil.toString(updateOrchestratorRequest)));
}
Also used : UpdateOrchestratorRequest(alien4cloud.rest.orchestrator.UpdateOrchestratorRequest) 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