use of org.apache.camel.component.openstack.keystone.producer.ProjectProducer in project camel by apache.
the class ProjectProducerTest method setUp.
@Before
public void setUp() {
producer = new ProjectProducer(endpoint, client);
when(projectService.create(any(Project.class))).thenReturn(testOSproject);
when(projectService.get(anyString())).thenReturn(testOSproject);
List<Project> getAllList = new ArrayList<>();
getAllList.add(testOSproject);
getAllList.add(testOSproject);
doReturn(getAllList).when(projectService).list();
dummyProject = createProject();
when(testOSproject.getName()).thenReturn(dummyProject.getName());
when(testOSproject.getDescription()).thenReturn(dummyProject.getDescription());
}
use of org.apache.camel.component.openstack.keystone.producer.ProjectProducer in project wildfly-camel by wildfly-extras.
the class OpenstackIntegrationTest method createKeystoneProject.
@Test
public void createKeystoneProject() 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);
msg.setHeader(OpenstackConstants.OPERATION, OpenstackConstants.CREATE);
msg.setHeader(OpenstackConstants.NAME, dummyProject.getName());
msg.setHeader(KeystoneConstants.DESCRIPTION, dummyProject.getDescription());
msg.setHeader(KeystoneConstants.DOMAIN_ID, dummyProject.getDomainId());
msg.setHeader(KeystoneConstants.PARENT_ID, dummyProject.getParentId());
KeystoneEndpoint endpoint = Mockito.mock(KeystoneEndpoint.class);
Producer producer = new ProjectProducer(endpoint, client);
producer.process(exchange);
ArgumentCaptor<Project> captor = ArgumentCaptor.forClass(Project.class);
verify(projectService).create(captor.capture());
assertEqualsProject(dummyProject, captor.getValue());
}
Aggregations