use of alien4cloud.rest.orchestrator.model.LocationDTO in project alien4cloud by alien4cloud.
the class LocationController method buildLocationDTO.
private LocationDTO buildLocationDTO(Location location) {
LocationDTO locationDTO = new LocationDTO();
locationDTO.setResources(locationResourceService.getLocationResources(location));
locationDTO.setLocation(location);
locationDTO.setSecretProviderConfigurations(getSecretConfigurations(location));
return locationDTO;
}
use of alien4cloud.rest.orchestrator.model.LocationDTO in project alien4cloud by alien4cloud.
the class LocationController method getAll.
@ApiOperation(value = "Get all locations for a given orchestrator.")
@RequestMapping(method = RequestMethod.GET)
@PreAuthorize("isAuthenticated()")
public RestResponse<List<LocationDTO>> getAll(@ApiParam(value = "Id of the orchestrator for which to get all locations.") @PathVariable String orchestratorId) {
List<Location> locations = locationService.getAll(orchestratorId);
List<LocationDTO> locationDTOs = Lists.newArrayList();
for (Location location : locations) {
locationDTOs.add(buildLocationDTO(location));
}
return RestResponseBuilder.<List<LocationDTO>>builder().data(locationDTOs).build();
}
use of alien4cloud.rest.orchestrator.model.LocationDTO in project alien4cloud by alien4cloud.
the class AbstractLocationResourceSteps method resourceFoundInLocation.
private boolean resourceFoundInLocation(String resourceName, String resourceType, IResourceAccessor resourceAccessor) throws IOException {
String restResponse = Context.getInstance().getRestResponse();
RestResponse<LocationDTO> response = JsonUtil.read(restResponse, LocationDTO.class, Context.getJsonMapper());
LocationDTO locationDTO = response.getData();
boolean found = false;
final List<? extends AbstractLocationResourceTemplate> templates = resourceAccessor.getResources(locationDTO.getResources());
for (AbstractLocationResourceTemplate lrt : templates) {
if (lrt.getName().equals(resourceName) && lrt.getTypes().contains(resourceType)) {
found = true;
break;
}
}
return found;
}
use of alien4cloud.rest.orchestrator.model.LocationDTO in project alien4cloud by alien4cloud.
the class LocationsDefinitionsSteps method Response_should_contains_meta_property_for_the_location.
@Then("^Response should contains (\\d+) meta-property for the location \"([^\"]*)\"$")
public void Response_should_contains_meta_property_for_the_location(int count, String locationName) throws Throwable {
RestResponse<List> response = JsonUtil.read(Context.getInstance().getRestResponse(), List.class);
assertNotNull(response);
for (Object obj : response.getData()) {
LocationDTO location = Context.getInstance().getJsonMapper().readValue(Context.getInstance().getJsonMapper().writeValueAsString(obj), LocationDTO.class);
if (locationName.equals(location.getLocation().getName())) {
currentMetaProperties = location.getLocation().getMetaProperties();
break;
}
}
Assert.assertEquals(count, currentMetaProperties.size());
}
Aggregations