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