Search in sources :

Example 61 with When

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

the class TopologyTemplateStepDefinitions method iSearchForTopologiesFromWithResultSizeOf.

@When("^I search for topologies from (\\d+) with result size of (\\d+)$")
public void iSearchForTopologiesFromWithResultSizeOf(int from, int size) throws Throwable {
    FilteredSearchRequest searchRequest = new FilteredSearchRequest();
    searchRequest.setFrom(from);
    searchRequest.setSize(size);
    String response = Context.getRestClientInstance().postJSon("/rest/v1/catalog/topologies/search", JsonUtil.toString(searchRequest));
    Context.getInstance().registerRestResponse(response);
}
Also used : FilteredSearchRequest(alien4cloud.rest.model.FilteredSearchRequest) When(cucumber.api.java.en.When)

Example 62 with When

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

the class UsersDefinitionsSteps method I_search_in_users_for_from_with_result_size_of.

@When("^I search in users for \"([^\"]*)\" from (\\d+) with result size of (\\d+)$")
public void I_search_in_users_for_from_with_result_size_of(String searchedText, int from, int size) throws Throwable {
    UserSearchRequest req = new UserSearchRequest(searchedText, null, from, size);
    String jSon = Context.getInstance().getJsonMapper().writeValueAsString(req);
    Context.getInstance().registerRestResponse(Context.getRestClientInstance().postJSon("/rest/v1/users/search", jSon));
}
Also used : UserSearchRequest(alien4cloud.security.users.rest.UserSearchRequest) When(cucumber.api.java.en.When)

Example 63 with When

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

the class WorkflowStepDefinitions method the_workflow_step_is_preceded_by.

@When("^The workflow step \"(.*?)\" is preceded by: (.*)$")
public void the_workflow_step_is_preceded_by(String stepId, List<String> predecesors) throws Throwable {
    String topologyResponseText = Context.getInstance().getRestResponse();
    RestResponse<TopologyDTO> topologyResponse = JsonUtil.read(topologyResponseText, TopologyDTO.class, Context.getJsonMapper());
    String workflowName = Context.getInstance().getCurrentWorkflowName();
    Workflow workflow = topologyResponse.getData().getTopology().getWorkflows().get(workflowName);
    WorkflowStep step = workflow.getSteps().get(stepId);
    Set<String> actualPredecessors = step.getPrecedingSteps();
    assertNotNull(actualPredecessors);
    assertEquals(predecesors.size(), actualPredecessors.size());
    for (String expectedPredecessor : predecesors) {
        // we just remove the surrounding quotes
        String predecessor = expectedPredecessor.substring(1, expectedPredecessor.length() - 1);
        assertTrue(actualPredecessors.contains(predecessor));
    }
}
Also used : TopologyDTO(alien4cloud.topology.TopologyDTO) WorkflowStep(org.alien4cloud.tosca.model.workflow.WorkflowStep) Workflow(org.alien4cloud.tosca.model.workflow.Workflow) When(cucumber.api.java.en.When)

Example 64 with When

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

the class PluginDefinitionsSteps method I_upload_a_plugin_which.

@When("^I upload a plugin which \"([^\"]*)\"$")
public void I_upload_a_plugin_which(String pluginCondition) throws Throwable {
    Path path = conditionToPath.get(pluginCondition);
    Context.getInstance().registerRestResponse(Context.getRestClientInstance().postMultipart("/rest/v1/plugins", "file", Files.newInputStream(path)));
}
Also used : Path(java.nio.file.Path) When(cucumber.api.java.en.When)

Example 65 with When

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

the class ScpStepsDefinitions method I_download_the_remote_file_from_the_node_with_the_keypair_and_user.

@When("^I download the remote file \"([^\"]*)\" from the node \"([^\"]*)\" with the keypair \"([^\"]*)\" and user \"([^\"]*)\"$")
public void I_download_the_remote_file_from_the_node_with_the_keypair_and_user(String remoteFilePath, String nodeName, String keypair, String user) throws Throwable {
    Path keyPath = Context.LOCAL_TEST_DATA_PATH.resolve(keypair);
    SSHUtil.download(user, AttributeUtil.getAttribute(nodeName, "public_ip_address"), Context.SCP_PORT, keyPath.toString(), remoteFilePath, CURRENT_DOWNLOADED_FILE_PATH);
}
Also used : Path(java.nio.file.Path) 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