use of org.openstack4j.model.identity.v3.Region in project camel by apache.
the class RegionProducer method doUpdate.
private void doUpdate(Exchange exchange) {
final Message msg = exchange.getIn();
final Region in = messageToRegion(msg);
final Region out = osV3Client.identity().regions().update(in);
msg.setBody(out);
}
use of org.openstack4j.model.identity.v3.Region in project camel by apache.
the class RegionProducer method messageToRegion.
private Region messageToRegion(Message message) {
Region region = message.getBody(Region.class);
if (region == null) {
Map headers = message.getHeaders();
RegionBuilder builder = Builders.region();
if (headers.containsKey(KeystoneConstants.DESCRIPTION)) {
builder.description(message.getHeader(KeystoneConstants.DESCRIPTION, String.class));
}
region = builder.build();
}
return region;
}
use of org.openstack4j.model.identity.v3.Region in project camel by apache.
the class RegionProducer method doGet.
private void doGet(Exchange exchange) {
final String id = exchange.getIn().getHeader(OpenstackConstants.ID, String.class);
ObjectHelper.notEmpty(id, "Region ID");
final Region out = osV3Client.identity().regions().get(id);
exchange.getIn().setBody(out);
}
use of org.openstack4j.model.identity.v3.Region in project openstack4j by ContainX.
the class KeystoneRegionServiceTest method region_crud_test.
// ------------ Region Tests ------------
// The following tests are to verify the update() method of the
// RegionService
// using HTTP PATCH, which is not supported by betamax.
// Find more tests in KeystoneRegionServiceSpec in core-integration-test
// module.
public void region_crud_test() throws Exception {
respondWith(JSON_REGIONS_GET_BYID);
Region region_setToUpdate = osv3().identity().regions().get(REGION_CRUD_ID);
assertEquals(region_setToUpdate.getId(), REGION_CRUD_ID);
assertEquals(region_setToUpdate.getDescription(), REGION_CRUD_DESCRIPTION);
respondWith(JSON_REGIONS_UPDATE);
Region updatedRegion = osv3().identity().regions().update(region_setToUpdate.toBuilder().description(REGION_CRUD_DESCRIPTION_UPDATE).build());
assertEquals(updatedRegion.getId(), REGION_CRUD_ID);
assertEquals(updatedRegion.getDescription(), REGION_CRUD_DESCRIPTION_UPDATE);
assertEquals(updatedRegion.getParentRegionId(), REGION_CRUD_PARENTREGIONID);
}
use of org.openstack4j.model.identity.v3.Region in project camel by apache.
the class RegionProducer method doCreate.
private void doCreate(Exchange exchange) {
final Region in = messageToRegion(exchange.getIn());
final Region out = osV3Client.identity().regions().create(in);
exchange.getIn().setBody(out);
}
Aggregations