Search in sources :

Example 6 with DefaultHeadersMapFactory

use of org.apache.camel.impl.DefaultHeadersMapFactory in project wildfly-camel by wildfly-extras.

the class OpenstackIntegrationTest method reserveGlanceImage.

@Test
public void reserveGlanceImage() throws Exception {
    CamelContext camelContext = Mockito.mock(CamelContext.class);
    when(camelContext.getHeadersMapFactory()).thenReturn(new DefaultHeadersMapFactory());
    GlanceEndpoint endpoint = Mockito.mock(GlanceEndpoint.class);
    when(endpoint.getOperation()).thenReturn(GlanceConstants.RESERVE);
    Message msg = new DefaultMessage(camelContext);
    msg.setBody(dummyImage);
    Exchange exchange = Mockito.mock(Exchange.class);
    when(exchange.getIn()).thenReturn(msg);
    Producer producer = new GlanceProducer(endpoint, client);
    producer.process(exchange);
    ArgumentCaptor<Image> captor = ArgumentCaptor.forClass(Image.class);
    verify(imageService).reserve(captor.capture());
    assertEquals(dummyImage, captor.getValue());
    Image result = msg.getBody(Image.class);
    assertNotNull(result.getId());
    assertEqualsImages(dummyImage, result);
}
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) DefaultHeadersMapFactory(org.apache.camel.impl.DefaultHeadersMapFactory) GlanceProducer(org.apache.camel.component.openstack.glance.GlanceProducer) Image(org.openstack4j.model.image.Image) GlanceImage(org.openstack4j.openstack.image.domain.GlanceImage) GlanceEndpoint(org.apache.camel.component.openstack.glance.GlanceEndpoint) Test(org.junit.Test)

Aggregations

CamelContext (org.apache.camel.CamelContext)6 Exchange (org.apache.camel.Exchange)6 Message (org.apache.camel.Message)6 Producer (org.apache.camel.Producer)6 VolumeProducer (org.apache.camel.component.openstack.cinder.producer.VolumeProducer)6 GlanceProducer (org.apache.camel.component.openstack.glance.GlanceProducer)6 ProjectProducer (org.apache.camel.component.openstack.keystone.producer.ProjectProducer)6 NetworkProducer (org.apache.camel.component.openstack.neutron.producer.NetworkProducer)6 KeypairProducer (org.apache.camel.component.openstack.nova.producer.KeypairProducer)6 ContainerProducer (org.apache.camel.component.openstack.swift.producer.ContainerProducer)6 DefaultCamelContext (org.apache.camel.impl.DefaultCamelContext)6 DefaultHeadersMapFactory (org.apache.camel.impl.DefaultHeadersMapFactory)6 DefaultMessage (org.apache.camel.impl.DefaultMessage)6 Test (org.junit.Test)6 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)2 CinderEndpoint (org.apache.camel.component.openstack.cinder.CinderEndpoint)1 GlanceEndpoint (org.apache.camel.component.openstack.glance.GlanceEndpoint)1 KeystoneEndpoint (org.apache.camel.component.openstack.keystone.KeystoneEndpoint)1 NeutronEndpoint (org.apache.camel.component.openstack.neutron.NeutronEndpoint)1 NovaEndpoint (org.apache.camel.component.openstack.nova.NovaEndpoint)1