Search in sources :

Example 21 with When

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

the class EditorStepDefs method i_Get_The_Archive_With_Name_And_Version.

@When("^I get the archive with name \"([^\"]*)\" and version \"([^\"]*)\"$")
public void i_Get_The_Archive_With_Name_And_Version(String name, String version) throws Throwable {
    Csar csar = csarService.get(name, version);
    csarEvaluationContext = new StandardEvaluationContext(csar);
}
Also used : Csar(org.alien4cloud.tosca.model.Csar) StandardEvaluationContext(org.springframework.expression.spel.support.StandardEvaluationContext) When(cucumber.api.java.en.When)

Example 22 with When

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

the class ApplicationStepDefinitions method I_update_the_environment_named_to_use_cloud_for_application.

@When("^I update the environment named \"([^\"]*)\" to use cloud \"([^\"]*)\" for application \"([^\"]*)\"$")
public void I_update_the_environment_named_to_use_cloud_for_application(String envName, String cloudName, String appName) throws Throwable {
    UpdateApplicationEnvironmentRequest appEnvRequest = new UpdateApplicationEnvironmentRequest();
    // appEnvRequest.setCloudId(Context.getInstance().getCloudId(cloudName));
    Assert.fail("Fix test");
    String applicationId = Context.getInstance().getApplicationId(appName);
    String applicationEnvironmentId = Context.getInstance().getApplicationEnvironmentId(appName, envName);
    // send the update request
    Context.getInstance().registerRestResponse(getRestClientInstance().putJSon("/rest/v1/applications/" + applicationId + "/environments/" + applicationEnvironmentId, JsonUtil.toString(appEnvRequest)));
}
Also used : UpdateApplicationEnvironmentRequest(alien4cloud.rest.application.model.UpdateApplicationEnvironmentRequest) TestUtils.nullAsString(alien4cloud.it.utils.TestUtils.nullAsString) When(cucumber.api.java.en.When)

Example 23 with When

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

the class ApplicationStepDefinitions method I_get_the_application_environment_named.

@When("^I get the application environment named \"([^\"]*)\"$")
public void I_get_the_application_environment_named(String applicationEnvironmentName) throws Throwable {
    Assert.assertNotNull(CURRENT_APPLICATION);
    String applicationEnvId = Context.getInstance().getApplicationEnvironmentId(CURRENT_APPLICATION.getName(), applicationEnvironmentName);
    Context.getInstance().registerRestResponse(getRestClientInstance().get("/rest/v1/applications/" + CURRENT_APPLICATION.getId() + "/environments/" + applicationEnvId));
    RestResponse<ApplicationEnvironmentDTO> appEnvironment = JsonUtil.read(Context.getInstance().getRestResponse(), ApplicationEnvironmentDTO.class);
    Assert.assertNotNull(appEnvironment.getData());
    Assert.assertEquals(appEnvironment.getData().getId(), applicationEnvId);
}
Also used : ApplicationEnvironmentDTO(alien4cloud.rest.application.model.ApplicationEnvironmentDTO) TestUtils.nullAsString(alien4cloud.it.utils.TestUtils.nullAsString) When(cucumber.api.java.en.When)

Example 24 with When

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

the class ApplicationStepDefinitions method i_update_its_image.

@When("^i update its image$")
public void i_update_its_image() throws Throwable {
    String appId = JsonUtil.read(Context.getInstance().getRestResponse(), String.class).getData();
    RestResponse<String> response = JsonUtil.read(getRestClientInstance().postMultipart("/rest/v1/applications/" + appId + "/image", "file", Files.newInputStream(Paths.get(TEST_APPLICATION_IMAGE))), String.class);
    assertNull(response.getError());
}
Also used : TestUtils.nullAsString(alien4cloud.it.utils.TestUtils.nullAsString) When(cucumber.api.java.en.When)

Example 25 with When

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

the class ApplicationStepDefinitions method I_search_for_application.

@When("^I search for \"([^\"]*)\" application$")
public void I_search_for_application(String applicationName) throws Throwable {
    ComponentSearchRequest searchRequest = new ComponentSearchRequest(null, applicationName, 0, 10, null);
    String searchResponse = getRestClientInstance().postJSon("/rest/v1/applications/search", JsonUtil.toString(searchRequest));
    Context.getInstance().registerRestResponse(searchResponse);
    RestResponse<FacetedSearchResult> response = JsonUtil.read(searchResponse, FacetedSearchResult.class);
    for (Object appAsObj : response.getData().getData()) {
        Application app = JsonUtil.readObject(JsonUtil.toString(appAsObj), Application.class);
        if (applicationName.equals(app.getName())) {
            CURRENT_APPLICATION = app;
        }
    }
}
Also used : ComponentSearchRequest(alien4cloud.rest.component.ComponentSearchRequest) TestUtils.nullAsString(alien4cloud.it.utils.TestUtils.nullAsString) Application(alien4cloud.model.application.Application) FacetedSearchResult(alien4cloud.dao.model.FacetedSearchResult) 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