Search in sources :

Example 36 with ExternalLoadBalancerDeviceVO

use of com.cloud.network.dao.ExternalLoadBalancerDeviceVO in project cloudstack by apache.

the class ExternalLoadBalancerDeviceManagerImplTest method setupLBHealthChecksMocks.

private void setupLBHealthChecksMocks() throws URISyntaxException {
    Mockito.when(network.getId()).thenReturn(42l);
    Mockito.when(network.getNetworkOfferingId()).thenReturn(1l);
    Mockito.when(network.getBroadcastUri()).thenReturn(new URI("vlan://1"));
    NetworkExternalLoadBalancerVO externalLb = Mockito.mock(NetworkExternalLoadBalancerVO.class);
    Mockito.when(externalLb.getExternalLBDeviceId()).thenReturn(66l);
    Mockito.when(_networkExternalLBDao.findByNetworkId(42)).thenReturn(externalLb);
    ExternalLoadBalancerDeviceVO lbDevice = Mockito.mock(ExternalLoadBalancerDeviceVO.class);
    Mockito.when(_externalLoadBalancerDeviceDao.findById(66l)).thenReturn(lbDevice);
    Mockito.when(rule.getAlgorithm()).thenReturn("TEST");
    Mockito.when(rule.getProtocol()).thenReturn("TEST");
    Mockito.when(rule.getSourceIp()).thenReturn(new Ip(1l));
    Mockito.when(lbDevice.getHostId()).thenReturn(99l);
    HostVO hostVo = Mockito.mock(HostVO.class);
    Mockito.when(_hostDao.findById(Mockito.anyLong())).thenReturn(hostVo);
}
Also used : ExternalLoadBalancerDeviceVO(com.cloud.network.dao.ExternalLoadBalancerDeviceVO) Ip(com.cloud.utils.net.Ip) NetworkExternalLoadBalancerVO(com.cloud.network.dao.NetworkExternalLoadBalancerVO) URI(java.net.URI) HostVO(com.cloud.host.HostVO)

Aggregations

ExternalLoadBalancerDeviceVO (com.cloud.network.dao.ExternalLoadBalancerDeviceVO)36 InvalidParameterValueException (com.cloud.exception.InvalidParameterValueException)26 CloudRuntimeException (com.cloud.utils.exception.CloudRuntimeException)17 ArrayList (java.util.ArrayList)14 ResourceUnavailableException (com.cloud.exception.ResourceUnavailableException)12 NetworkExternalLoadBalancerVO (com.cloud.network.dao.NetworkExternalLoadBalancerVO)12 InsufficientNetworkCapacityException (com.cloud.exception.InsufficientNetworkCapacityException)11 HostVO (com.cloud.host.HostVO)10 InsufficientCapacityException (com.cloud.exception.InsufficientCapacityException)9 ConfigurationException (javax.naming.ConfigurationException)9 ServerApiException (org.apache.cloudstack.api.ServerApiException)9 PhysicalNetworkVO (com.cloud.network.dao.PhysicalNetworkVO)8 HealthCheckLBConfigAnswer (com.cloud.agent.api.routing.HealthCheckLBConfigAnswer)6 DataCenterVO (com.cloud.dc.DataCenterVO)5 UnableDeleteHostException (com.cloud.resource.UnableDeleteHostException)5 TransactionCallbackWithException (com.cloud.utils.db.TransactionCallbackWithException)5 URISyntaxException (java.net.URISyntaxException)5 Answer (com.cloud.agent.api.Answer)4 LoadBalancerTO (com.cloud.agent.api.to.LoadBalancerTO)4 AgentUnavailableException (com.cloud.exception.AgentUnavailableException)4