Search in sources :

Example 1 with DeploymentDTO

use of alien4cloud.rest.deployment.DeploymentDTO in project alien4cloud by alien4cloud.

the class ApplicationsDeploymentStepDefinitions method I_should_not_get_a_deployment_if_I_ask_one_for_application.

@Then("^I should not get a deployment if I ask one for application \"([^\"]*)\" on orchestrator \"([^\"]*)\"$")
public void I_should_not_get_a_deployment_if_I_ask_one_for_application(String applicationName, String orchestrator) throws Throwable {
    String orchestratorId = Context.getInstance().getOrchestratorId(orchestrator);
    assertNotNull(ApplicationStepDefinitions.CURRENT_APPLICATIONS);
    Application app = ApplicationStepDefinitions.CURRENT_APPLICATIONS.get(applicationName);
    NameValuePair nvp = new BasicNameValuePair("sourceId", app.getId());
    NameValuePair nvp1 = new BasicNameValuePair("orchestratorId", orchestratorId);
    String responseString = Context.getRestClientInstance().getUrlEncoded("/rest/v1/deployments", Lists.newArrayList(nvp, nvp1));
    RestResponse<?> response = JsonUtil.read(responseString);
    assertNull(response.getError());
    List<DeploymentDTO> deployments = JsonUtil.toList(JsonUtil.toString(response.getData()), DeploymentDTO.class, Application.class, Context.getJsonMapper());
    Assert.assertTrue(CollectionUtils.isEmpty(deployments));
}
Also used : NameValuePair(org.apache.http.NameValuePair) BasicNameValuePair(org.apache.http.message.BasicNameValuePair) DeploymentDTO(alien4cloud.rest.deployment.DeploymentDTO) BasicNameValuePair(org.apache.http.message.BasicNameValuePair) Application(alien4cloud.model.application.Application) Then(cucumber.api.java.en.Then)

Example 2 with DeploymentDTO

use of alien4cloud.rest.deployment.DeploymentDTO in project alien4cloud by alien4cloud.

the class ApplicationsDeploymentStepDefinitions method getApplicationNames.

private String[] getApplicationNames(Collection<DeploymentDTO> list) {
    String[] names = null;
    for (DeploymentDTO dto : list) {
        names = ArrayUtils.add(names, dto.getSource().getName());
    }
    Arrays.sort(names);
    return names;
}
Also used : DeploymentDTO(alien4cloud.rest.deployment.DeploymentDTO)

Aggregations

DeploymentDTO (alien4cloud.rest.deployment.DeploymentDTO)2 Application (alien4cloud.model.application.Application)1 Then (cucumber.api.java.en.Then)1 NameValuePair (org.apache.http.NameValuePair)1 BasicNameValuePair (org.apache.http.message.BasicNameValuePair)1