use of cucumber.api.java.en.When in project alien4cloud by alien4cloud.
the class ApplicationEnvironmentStepDefinitions method getAllApplicationEnvironments.
@When("^I get all application environments for application \"([^\"]*)\"$")
public void getAllApplicationEnvironments(String applicationId) throws Throwable {
FilteredSearchRequest request = new FilteredSearchRequest();
request.setFrom(0);
// This is actually the maximum search size in a4c (1000 by default)
request.setSize(AlienConstants.MAX_ES_SEARCH_SIZE);
Context.getInstance().registerRestResponse(Context.getRestClientInstance().postJSon("/rest/v1/applications/" + applicationId + "/environments/search", JsonUtil.toString(request)));
try {
RestResponse<GetMultipleDataResult> restResponse = JsonUtil.read(Context.getInstance().getRestResponse(), GetMultipleDataResult.class);
ALL_ENVIRONMENTS = new ApplicationEnvironmentDTO[restResponse.getData().getData().length];
TestUtils.convert(restResponse.getData(), ALL_ENVIRONMENTS, ApplicationEnvironmentDTO.class);
CURRENT_ENVIRONMENT_DTO = ALL_ENVIRONMENTS[0];
} catch (IOException e) {
// Registration is optional
}
}
use of cucumber.api.java.en.When in project alien4cloud by alien4cloud.
the class ApplicationsDeploymentStepDefinitions method I_deploy_it.
@When("^I deploy it$")
public void I_deploy_it() throws Throwable {
// deploys the current application on default "Environment"
log.info("Deploy : Deploying the application " + ApplicationStepDefinitions.CURRENT_APPLICATION.getName());
DeployApplicationRequest deployApplicationRequest = getDeploymentAppRequest(ApplicationStepDefinitions.CURRENT_APPLICATION.getName(), null);
String response = deploy(deployApplicationRequest);
Context.getInstance().registerRestResponse(response);
}
use of cucumber.api.java.en.When in project alien4cloud by alien4cloud.
the class DeploymentTopologyStepDefinitions method iSetTheInputsPropertyAsASecretWithTheFollowingParameters.
@When("^I set the inputs property \"([^\"]*)\" as a secret with the following parameters$")
public void iSetTheInputsPropertyAsASecretWithTheFollowingParameters(String propertyName, Map<String, String> parameters) throws Throwable {
FunctionPropertyValue functionPropertyValue = new FunctionPropertyValue();
functionPropertyValue.setFunction(parameters.get("functionName"));
functionPropertyValue.setParameters(Arrays.asList(parameters.get("secretPath")));
UpdateDeploymentTopologyRequest request = new UpdateDeploymentTopologyRequest();
request.setInputProperties(parseAndReplaceProperties(ImmutableMap.of(propertyName, functionPropertyValue)));
executeUpdateDeploymentTopologyCall(request);
}
use of cucumber.api.java.en.When in project alien4cloud by alien4cloud.
the class DeploymentTopologyStepDefinitions method iSelectTheFileFromTheCurrentTopologyArchiveForTheInputArtifact.
@When("^I select the file \"([^\"]*)\" from the current topology archive for the input artifact \"([^\"]*)\"$")
public void iSelectTheFileFromTheCurrentTopologyArchiveForTheInputArtifact(String fileRef, String inputArtifactName) throws Throwable {
Application application = Context.getInstance().getApplication();
String envId = Context.getInstance().getDefaultApplicationEnvironmentId(application.getName());
String url = String.format("/rest/applications/%s/environments/%s/deployment-topology/inputArtifacts/%s/update", application.getId(), envId, inputArtifactName);
DeploymentArtifact inputArtifact = new DeploymentArtifact();
inputArtifact.setArchiveName(application.getId());
inputArtifact.setArchiveVersion(TestUtils.getVersionFromId(Context.getInstance().getTopologyId()));
inputArtifact.setArtifactRef(fileRef);
inputArtifact.setArtifactRepository(ArtifactRepositoryConstants.ALIEN_TOPOLOGY_REPOSITORY);
Context.getInstance().registerRestResponse(Context.getRestClientInstance().postJSon(url, JsonUtil.toString(inputArtifact)));
}
use of cucumber.api.java.en.When in project alien4cloud by alien4cloud.
the class DeploymentTopologyStepDefinitions method I_get_the_deployment_toology_for_the_current_application.
@When("^I get the deployment topology for the current application$")
public void I_get_the_deployment_toology_for_the_current_application() throws Throwable {
Application application = Context.getInstance().getApplication();
String environmentId = Context.getInstance().getDefaultApplicationEnvironmentId(application.getName());
String restUrl = String.format("/rest/v1/applications/%s/environments/%s/deployment-topology/", application.getId(), environmentId);
String response = Context.getRestClientInstance().get(restUrl);
Context.getInstance().registerRestResponse(response);
}
Aggregations