use of org.openstack4j.openstack.networking.domain.NeutronRouterInterface in project camel by apache.
the class RouterProducerTest method detachTest.
@Test
public void detachTest() throws Exception {
final String routerID = "myRouterID";
final String portId = "port";
final String subnetId = "subnet";
final RouterInterface ifce = new NeutronRouterInterface(subnetId, portId);
when(routerService.detachInterface(anyString(), anyString(), anyString())).thenReturn(ifce);
msg.setHeader(OpenstackConstants.OPERATION, NeutronConstants.DETACH_INTERFACE);
msg.setHeader(NeutronConstants.ROUTER_ID, routerID);
msg.setHeader(NeutronConstants.SUBNET_ID, subnetId);
msg.setHeader(NeutronConstants.PORT_ID, portId);
producer.process(exchange);
ArgumentCaptor<String> routerC = ArgumentCaptor.forClass(String.class);
ArgumentCaptor<String> portC = ArgumentCaptor.forClass(String.class);
ArgumentCaptor<String> subnetC = ArgumentCaptor.forClass(String.class);
verify(routerService).detachInterface(routerC.capture(), subnetC.capture(), portC.capture());
assertEquals(routerID, routerC.getValue());
assertEquals(subnetId, subnetC.getValue());
assertEquals(portId, portC.getValue());
assertEquals(ifce, msg.getBody(RouterInterface.class));
}
use of org.openstack4j.openstack.networking.domain.NeutronRouterInterface 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));
}
Aggregations