use of org.apache.camel.component.openstack.glance.GlanceProducer 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);
}
Aggregations