Search in sources :

Example 81 with When

use of cucumber.api.java.en.When in project apollo by spotify.

the class RequestStepdefs method sending_a_request_to.

@When("^sending a request to \"([^\"]*)\"$")
public void sending_a_request_to(String uri) throws Throwable {
    Request request = Request.forUri(uri);
    responseFuture = ServiceStepdefs.serviceHelper.request(request);
}
Also used : Request(com.spotify.apollo.Request) When(cucumber.api.java.en.When)

Example 82 with When

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

the class EditorStepDefs method i_upload_unzipped_CSAR_From_path.

@When("^I upload unzipped CSAR from path \"(.*?)\"$")
public void i_upload_unzipped_CSAR_From_path(String path) throws Throwable {
    Path source = Paths.get(path);
    Path csarTargetPath = CSAR_TARGET_PATH.resolve(source.getFileName() + ".csar");
    FileUtil.zip(source, csarTargetPath);
    uploadCsar(csarTargetPath);
}
Also used : Path(java.nio.file.Path) When(cucumber.api.java.en.When)

Example 83 with When

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

the class EditorStepDefs method iResetTheTopology.

@When("^I reset the topology$")
public void iResetTheTopology() throws Throwable {
    thrownException = null;
    try {
        TopologyDTO dto = editorService.reset(topologyIds.getLast(), topologyIdToLastOperationId.get(topologyIds.getLast()));
        topologyIdToLastOperationId.put(topologyIds.getLast(), null);
        dtoEvaluationContext = new StandardEvaluationContext(dto);
        topologyEvaluationContext = new StandardEvaluationContext(dto.getTopology());
    } catch (Exception e) {
        log.error("Error occurred when resetting the topology", e);
        thrownException = e;
        exceptionEvaluationContext = new StandardEvaluationContext(e);
    }
}
Also used : StandardEvaluationContext(org.springframework.expression.spel.support.StandardEvaluationContext) TopologyDTO(alien4cloud.topology.TopologyDTO) NotFoundException(alien4cloud.exception.NotFoundException) IOException(java.io.IOException) When(cucumber.api.java.en.When)

Example 84 with When

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

the class ApplicationsDeploymentStepDefinitions method I_deploy_all_applications_on_the_location.

@When("^I deploy all applications on the location \"([^\"]*)\"/\"([^\"]*)\"$")
public void I_deploy_all_applications_on_the_location(String orchestratorName, String locationName) throws Throwable {
    assertNotNull(ApplicationStepDefinitions.CURRENT_APPLICATIONS);
    for (String key : ApplicationStepDefinitions.CURRENT_APPLICATIONS.keySet()) {
        Application app = ApplicationStepDefinitions.CURRENT_APPLICATIONS.get(key);
        Context.getInstance().registerApplication(app);
        deploymentTopoSteps.I_Set_a_unique_location_policy_to_for_all_nodes(orchestratorName, locationName);
        String appName = app.getName();
        Map<String, String> environments = Context.getInstance().getAllEnvironmentForApplication(appName);
        DeployApplicationRequest deployApplicationRequest = null;
        for (Map.Entry<String, String> env : environments.entrySet()) {
            String envName = env.getKey();
            deployApplicationRequest = getDeploymentAppRequest(appName, envName);
            String response = deploy(deployApplicationRequest);
            Context.getInstance().registerRestResponse(response);
        }
        commonSteps.I_should_receive_a_RestResponse_with_no_error();
    }
}
Also used : DeployApplicationRequest(alien4cloud.rest.application.model.DeployApplicationRequest) Application(alien4cloud.model.application.Application) Map(java.util.Map) When(cucumber.api.java.en.When)

Example 85 with When

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

the class ApplicationsDeploymentStepDefinitions method I_ask_for_detailed_deployments_for_orchestrator.

@When("^I ask for detailed deployments for orchestrator \"([^\"]*)\"$")
public void I_ask_for_detailed_deployments_for_orchestrator(String orchestratorName) throws Throwable {
    List<NameValuePair> nvps = Lists.newArrayList();
    NameValuePair nvp0 = new BasicNameValuePair("includeAppSummary", "true");
    nvps.add(nvp0);
    if (orchestratorName != null) {
        String orchestratorId = Context.getInstance().getOrchestratorId(orchestratorName);
        NameValuePair nvp1 = new BasicNameValuePair("orchestratorId", orchestratorId);
        nvps.add(nvp1);
    }
    String response = Context.getRestClientInstance().getUrlEncoded("/rest/v1/deployments", nvps);
    Context.getInstance().registerRestResponse(response);
}
Also used : NameValuePair(org.apache.http.NameValuePair) BasicNameValuePair(org.apache.http.message.BasicNameValuePair) BasicNameValuePair(org.apache.http.message.BasicNameValuePair) 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