Search in sources :

Example 1 with VolumeProducer

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());
}
Also used : Volume(org.openstack4j.model.storage.block.Volume) VolumeProducer(org.apache.camel.component.openstack.cinder.producer.VolumeProducer) Before(org.junit.Before)

Example 2 with VolumeProducer

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));
}
Also used : DefaultCamelContext(org.apache.camel.impl.DefaultCamelContext) CamelContext(org.apache.camel.CamelContext) DefaultMessage(org.apache.camel.impl.DefaultMessage) Exchange(org.apache.camel.Exchange) Message(org.apache.camel.Message) DefaultMessage(org.apache.camel.impl.DefaultMessage) VolumeProducer(org.apache.camel.component.openstack.cinder.producer.VolumeProducer) ProjectProducer(org.apache.camel.component.openstack.keystone.producer.ProjectProducer) ContainerProducer(org.apache.camel.component.openstack.swift.producer.ContainerProducer) GlanceProducer(org.apache.camel.component.openstack.glance.GlanceProducer) KeypairProducer(org.apache.camel.component.openstack.nova.producer.KeypairProducer) Producer(org.apache.camel.Producer) NetworkProducer(org.apache.camel.component.openstack.neutron.producer.NetworkProducer) Volume(org.openstack4j.model.storage.block.Volume) CinderEndpoint(org.apache.camel.component.openstack.cinder.CinderEndpoint) VolumeProducer(org.apache.camel.component.openstack.cinder.producer.VolumeProducer) DefaultHeadersMapFactory(org.apache.camel.impl.DefaultHeadersMapFactory) Test(org.junit.Test)

Aggregations

VolumeProducer (org.apache.camel.component.openstack.cinder.producer.VolumeProducer)2 Volume (org.openstack4j.model.storage.block.Volume)2 CamelContext (org.apache.camel.CamelContext)1 Exchange (org.apache.camel.Exchange)1 Message (org.apache.camel.Message)1 Producer (org.apache.camel.Producer)1 CinderEndpoint (org.apache.camel.component.openstack.cinder.CinderEndpoint)1 GlanceProducer (org.apache.camel.component.openstack.glance.GlanceProducer)1 ProjectProducer (org.apache.camel.component.openstack.keystone.producer.ProjectProducer)1 NetworkProducer (org.apache.camel.component.openstack.neutron.producer.NetworkProducer)1 KeypairProducer (org.apache.camel.component.openstack.nova.producer.KeypairProducer)1 ContainerProducer (org.apache.camel.component.openstack.swift.producer.ContainerProducer)1 DefaultCamelContext (org.apache.camel.impl.DefaultCamelContext)1 DefaultHeadersMapFactory (org.apache.camel.impl.DefaultHeadersMapFactory)1 DefaultMessage (org.apache.camel.impl.DefaultMessage)1 Before (org.junit.Before)1 Test (org.junit.Test)1