Search in sources :

Example 6 with RouterInterface

use of org.openstack4j.model.network.RouterInterface in project camel by apache.

the class RouterProducerTest method attachTest.

@Test
public void attachTest() throws Exception {
    final String routerID = "myRouterID";
    final String subnetId = "subnet";
    final RouterInterface ifce = new NeutronRouterInterface(subnetId, null);
    when(routerService.attachInterface(anyString(), any(AttachInterfaceType.class), anyString())).thenReturn(ifce);
    msg.setHeader(OpenstackConstants.OPERATION, NeutronConstants.ATTACH_INTERFACE);
    msg.setHeader(NeutronConstants.ROUTER_ID, routerID);
    msg.setHeader(NeutronConstants.SUBNET_ID, subnetId);
    msg.setHeader(NeutronConstants.ITERFACE_TYPE, AttachInterfaceType.SUBNET);
    producer.process(exchange);
    ArgumentCaptor<String> routerC = ArgumentCaptor.forClass(String.class);
    ArgumentCaptor<AttachInterfaceType> itfType = ArgumentCaptor.forClass(AttachInterfaceType.class);
    ArgumentCaptor<String> subnetC = ArgumentCaptor.forClass(String.class);
    verify(routerService).attachInterface(routerC.capture(), itfType.capture(), subnetC.capture());
    assertEquals(routerID, routerC.getValue());
    assertEquals(AttachInterfaceType.SUBNET, itfType.getValue());
    assertEquals(subnetId, subnetC.getValue());
    assertEquals(ifce, msg.getBody(RouterInterface.class));
}
Also used : RouterInterface(org.openstack4j.model.network.RouterInterface) NeutronRouterInterface(org.openstack4j.openstack.networking.domain.NeutronRouterInterface) Matchers.anyString(org.mockito.Matchers.anyString) NeutronRouterInterface(org.openstack4j.openstack.networking.domain.NeutronRouterInterface) AttachInterfaceType(org.openstack4j.model.network.AttachInterfaceType) Test(org.junit.Test)

Aggregations

RouterInterface (org.openstack4j.model.network.RouterInterface)6 Test (org.junit.Test)3 FileNotFoundException (java.io.FileNotFoundException)2 Message (org.apache.camel.Message)2 Matchers.anyString (org.mockito.Matchers.anyString)2 AttachInterfaceType (org.openstack4j.model.network.AttachInterfaceType)2 Router (org.openstack4j.model.network.Router)2 Subnet (org.openstack4j.model.network.Subnet)2 NeutronRouterInterface (org.openstack4j.openstack.networking.domain.NeutronRouterInterface)2 CloudInterface (org.apache.airavata.cloud.intf.CloudInterface)1 OpenstackIntfImpl (org.apache.airavata.cloud.intf.impl.OpenstackIntfImpl)1 Ignore (org.junit.Ignore)1 Network (org.openstack4j.model.network.Network)1