use of org.openstack4j.model.storage.object.options.CreateUpdateContainerOptions in project camel by apache.
the class ContainerProducerTest method createTestWithOptions.
@Test
public void createTestWithOptions() throws Exception {
when(containerService.create(anyString(), any(CreateUpdateContainerOptions.class))).thenReturn(ActionResponse.actionSuccess());
msg.setHeader(OpenstackConstants.OPERATION, OpenstackConstants.CREATE);
msg.setHeader(SwiftConstants.CONTAINER_NAME, CONTAINER_NAME);
final CreateUpdateContainerOptions options = CreateUpdateContainerOptions.create().accessAnybodyRead();
msg.setBody(options);
producer.process(exchange);
ArgumentCaptor<String> containerNameCaptor = ArgumentCaptor.forClass(String.class);
ArgumentCaptor<CreateUpdateContainerOptions> optionsCaptor = ArgumentCaptor.forClass(CreateUpdateContainerOptions.class);
verify(containerService).create(containerNameCaptor.capture(), optionsCaptor.capture());
assertEquals(CONTAINER_NAME, containerNameCaptor.getValue());
assertEquals(options, optionsCaptor.getValue());
assertFalse(msg.isFault());
}
use of org.openstack4j.model.storage.object.options.CreateUpdateContainerOptions in project camel by apache.
the class ContainerProducer method doCreate.
private void doCreate(Exchange exchange) {
final Message msg = exchange.getIn();
final String name = msg.getHeader(OpenstackConstants.NAME, msg.getHeader(SwiftConstants.CONTAINER_NAME, String.class), String.class);
ObjectHelper.notEmpty(name, "Container name");
final CreateUpdateContainerOptions options = messageToCreateUpdateOptions(msg);
final ActionResponse out = os.objectStorage().containers().create(name, options);
checkFailure(out, msg, "Create container " + name);
}
use of org.openstack4j.model.storage.object.options.CreateUpdateContainerOptions in project camel by apache.
the class ContainerProducer method doUpdate.
private void doUpdate(Exchange exchange) {
final Message msg = exchange.getIn();
final String name = msg.getHeader(OpenstackConstants.NAME, msg.getHeader(SwiftConstants.CONTAINER_NAME, String.class), String.class);
ObjectHelper.notEmpty(name, "Container name");
final CreateUpdateContainerOptions options = messageToCreateUpdateOptions(msg);
final ActionResponse out = os.objectStorage().containers().update(name, options);
checkFailure(out, msg, "Update container " + name);
}
Aggregations