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);
}
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));
}
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));
}
}
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)));
}
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);
}
Aggregations