use of alien4cloud.model.orchestrators.locations.LocationResourceTemplate in project alien4cloud by alien4cloud.
the class OrchestrationLocationResourceSteps method I_autogenerate_the_on_demand_resources_for_the_location_.
@When("^I autogenerate the on-demand resources for the location \"([^\"]*)\"/\"([^\"]*)\"$")
public void I_autogenerate_the_on_demand_resources_for_the_location_(String orchestratorName, String locationName) throws Throwable {
String orchestratorId = Context.getInstance().getOrchestratorId(orchestratorName);
String locationId = Context.getInstance().getLocationId(orchestratorId, locationName);
String restUrl = String.format(LOCATION_RESOURCES_BASE_ENDPOINT + "/auto-configure", orchestratorId, locationId);
String resp = Context.getRestClientInstance().get(restUrl);
Context.getInstance().registerRestResponse(resp);
RestResponse<List> response = JsonUtil.read(resp, List.class, Context.getJsonMapper());
if (response.getData() != null) {
List<LocationResourceTemplate> resources = JsonUtil.toList(JsonUtil.toString(response.getData()), LocationResourceTemplate.class, Context.getJsonMapper());
for (LocationResourceTemplate locationResourceTemplate : resources) {
Context.getInstance().registerOrchestratorLocationResource(orchestratorId, locationId, locationResourceTemplate.getId(), locationResourceTemplate.getName());
}
}
}
use of alien4cloud.model.orchestrators.locations.LocationResourceTemplate in project alien4cloud by alien4cloud.
the class NodeMatchingStepDefinitions method checkSubstitutionCounts.
@Then("^Available substitution should contains (\\d+) proposal including (\\d+) service$")
public void checkSubstitutionCounts(int proposals, int services) throws Throwable {
RestResponse<DeploymentTopologyDTO> restResponse = JsonUtil.read(Context.getInstance().getRestResponse(), DeploymentTopologyDTO.class);
Assert.assertEquals(proposals, restResponse.getData().getAvailableSubstitutions().getSubstitutionsTemplates().size());
int actualServices = 0;
for (LocationResourceTemplate resourceTemplate : restResponse.getData().getAvailableSubstitutions().getSubstitutionsTemplates().values()) {
if (resourceTemplate.isService()) {
actualServices++;
}
}
Assert.assertEquals(services, actualServices);
}
Aggregations