Search in sources :

Example 1 with ProjectProducer

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());
}
Also used : Project(org.openstack4j.model.identity.v3.Project) ProjectProducer(org.apache.camel.component.openstack.keystone.producer.ProjectProducer) ArrayList(java.util.ArrayList) Before(org.junit.Before)

Example 2 with ProjectProducer

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());
}
Also used : DefaultCamelContext(org.apache.camel.impl.DefaultCamelContext) CamelContext(org.apache.camel.CamelContext) DefaultMessage(org.apache.camel.impl.DefaultMessage) Exchange(org.apache.camel.Exchange) Project(org.openstack4j.model.identity.v3.Project) 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) ProjectProducer(org.apache.camel.component.openstack.keystone.producer.ProjectProducer) DefaultHeadersMapFactory(org.apache.camel.impl.DefaultHeadersMapFactory) KeystoneEndpoint(org.apache.camel.component.openstack.keystone.KeystoneEndpoint) Test(org.junit.Test)

Aggregations

ProjectProducer (org.apache.camel.component.openstack.keystone.producer.ProjectProducer)2 Project (org.openstack4j.model.identity.v3.Project)2 ArrayList (java.util.ArrayList)1 CamelContext (org.apache.camel.CamelContext)1 Exchange (org.apache.camel.Exchange)1 Message (org.apache.camel.Message)1 Producer (org.apache.camel.Producer)1 VolumeProducer (org.apache.camel.component.openstack.cinder.producer.VolumeProducer)1 GlanceProducer (org.apache.camel.component.openstack.glance.GlanceProducer)1 KeystoneEndpoint (org.apache.camel.component.openstack.keystone.KeystoneEndpoint)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