use of com.cloud.network.element.VirtualRouterProviderVO in project cloudstack by apache.
the class RouterDeploymentDefinitionTest method testFindVirtualProvider.
@Test
public void testFindVirtualProvider() {
// Prepare
when(mockNetworkModel.getPhysicalNetworkId(deployment.guestNetwork)).thenReturn(PHYSICAL_NW_ID);
final Type type = Type.VirtualRouter;
final PhysicalNetworkServiceProviderVO physicalNwSrvProvider = mock(PhysicalNetworkServiceProviderVO.class);
when(physicalProviderDao.findByServiceProvider(PHYSICAL_NW_ID, type.toString())).thenReturn(physicalNwSrvProvider);
when(physicalNwSrvProvider.getId()).thenReturn(PROVIDER_ID);
final VirtualRouterProviderVO vrProvider = mock(VirtualRouterProviderVO.class);
when(mockVrProviderDao.findByNspIdAndType(PROVIDER_ID, type)).thenReturn(vrProvider);
// Execute
deployment.findVirtualProvider();
// Assert
assertEquals("Didn't find and set the VirtualRouterProvider as expected", vrProvider, deployment.getVirtualProvider());
}
Aggregations