Search in sources :

Example 6 with VirtualRouterProviderVO

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());
}
Also used : Type(com.cloud.network.VirtualRouterProvider.Type) NetworkType(com.cloud.dc.DataCenter.NetworkType) TrafficType(com.cloud.network.Networks.TrafficType) PhysicalNetworkServiceProviderVO(com.cloud.network.dao.PhysicalNetworkServiceProviderVO) VirtualRouterProviderVO(com.cloud.network.element.VirtualRouterProviderVO) Test(org.junit.Test)

Aggregations

VirtualRouterProviderVO (com.cloud.network.element.VirtualRouterProviderVO)6 PhysicalNetworkServiceProviderVO (com.cloud.network.dao.PhysicalNetworkServiceProviderVO)3 InvalidParameterValueException (com.cloud.exception.InvalidParameterValueException)2 Before (org.junit.Before)2 DataCenter (com.cloud.dc.DataCenter)1 NetworkType (com.cloud.dc.DataCenter.NetworkType)1 DataCenterVO (com.cloud.dc.DataCenterVO)1 TrafficType (com.cloud.network.Networks.TrafficType)1 PhysicalNetworkServiceProvider (com.cloud.network.PhysicalNetworkServiceProvider)1 Type (com.cloud.network.VirtualRouterProvider.Type)1 DomainRouterVO (com.cloud.vm.DomainRouterVO)1 Test (org.junit.Test)1