use of org.apache.camel.component.openstack.cinder.producer.VolumeProducer in project camel by apache.
the class VolumeProducerTest method setUp.
@Before
public void setUp() {
producer = new VolumeProducer(endpoint, client);
when(volumeService.create(Matchers.any(org.openstack4j.model.storage.block.Volume.class))).thenReturn(testOSVolume);
when(volumeService.get(Matchers.anyString())).thenReturn(testOSVolume);
dummyVolume = createTestVolume();
when(testOSVolume.getId()).thenReturn(UUID.randomUUID().toString());
when(testOSVolume.getName()).thenReturn(dummyVolume.getName());
when(testOSVolume.getDescription()).thenReturn(dummyVolume.getDescription());
when(testOSVolume.getImageRef()).thenReturn(dummyVolume.getImageRef());
when(testOSVolume.getSize()).thenReturn(dummyVolume.getSize());
when(testOSVolume.getVolumeType()).thenReturn(dummyVolume.getVolumeType());
}
use of org.apache.camel.component.openstack.cinder.producer.VolumeProducer in project wildfly-camel by wildfly-extras.
the class OpenstackIntegrationTest method createCinderVolume.
@Test
public void createCinderVolume() throws Exception {
CamelContext camelContext = Mockito.mock(CamelContext.class);
when(camelContext.getHeadersMapFactory()).thenReturn(new DefaultHeadersMapFactory());
Message msg = new DefaultMessage(camelContext);
Exchange exchange = Mockito.mock(Exchange.class);
when(exchange.getIn()).thenReturn(msg);
CinderEndpoint endpoint = Mockito.mock(CinderEndpoint.class);
when(endpoint.getOperation()).thenReturn(OpenstackConstants.CREATE);
msg.setBody(dummyVolume);
Producer producer = new VolumeProducer(endpoint, client);
producer.process(exchange);
assertEqualVolumes(dummyVolume, msg.getBody(Volume.class));
}
Aggregations