Search in sources :

Example 71 with DomainRouterVO

use of com.cloud.vm.DomainRouterVO in project cloudstack by apache.

the class LoadBalanceRuleHandlerTest method testStartWhenElbVmIsNull.

@Test(expected = NullPointerException.class)
public void testStartWhenElbVmIsNull() throws Exception {
    DomainRouterVO elbVm = null;
    Map<Param, Object> params = new HashMap<Param, Object>();
    loadBalanceRuleHandler.start(elbVm, params);
}
Also used : HashMap(java.util.HashMap) Param(com.cloud.vm.VirtualMachineProfile.Param) DomainRouterVO(com.cloud.vm.DomainRouterVO) Test(org.junit.Test)

Example 72 with DomainRouterVO

use of com.cloud.vm.DomainRouterVO in project cloudstack by apache.

the class LoadBalanceRuleHandlerTest method testFindElbVmWithCapacityWhenIpAddrIsNull.

@Test
public void testFindElbVmWithCapacityWhenIpAddrIsNull() throws Exception {
    IPAddressVO ipAddr = null;
    DomainRouterVO actual = loadBalanceRuleHandler.findElbVmWithCapacity(ipAddr);
    assertNull(actual);
}
Also used : IPAddressVO(com.cloud.network.dao.IPAddressVO) DomainRouterVO(com.cloud.vm.DomainRouterVO) Test(org.junit.Test)

Example 73 with DomainRouterVO

use of com.cloud.vm.DomainRouterVO in project cloudstack by apache.

the class LoadBalanceRuleHandlerTest method testAddCandidateVmIsPodIpMatchesWhenIdsHaveSameValue.

@Test
public void testAddCandidateVmIsPodIpMatchesWhenIdsHaveSameValue() throws Exception {
    DomainRouterVO candidateVmMock = mock(DomainRouterVO.class);
    when(candidateVmMock.getPodIdToDeployIn()).thenReturn(new Long(1));
    Long podIdForDirectIp = new Long(1);
    List<DomainRouterVO> candidateVms = new ArrayList<DomainRouterVO>();
    LoadBalanceRuleHandler.addCandidateVmIsPodIpMatches(candidateVmMock, podIdForDirectIp, candidateVms);
    assertEquals(1, candidateVms.size());
}
Also used : ArrayList(java.util.ArrayList) DomainRouterVO(com.cloud.vm.DomainRouterVO) Test(org.junit.Test)

Example 74 with DomainRouterVO

use of com.cloud.vm.DomainRouterVO in project cloudstack by apache.

the class LoadBalanceRuleHandlerTest method testStart.

@Test
public void testStart() throws Exception {
    DomainRouterVO elbVmMock = mock(DomainRouterVO.class);
    String uuid = "uuid";
    when(elbVmMock.getUuid()).thenReturn(uuid);
    long id = 1L;
    when(elbVmMock.getId()).thenReturn(id);
    Map<Param, Object> params = new HashMap<Param, Object>();
    params.put(mock(Param.class), new Object());
    loadBalanceRuleHandler.start(elbVmMock, params);
    verify(virtualMachineManagerMock, times(1)).start(uuid, params);
    verify(domainRouterDaoMock, times(1)).findById(id);
}
Also used : HashMap(java.util.HashMap) Param(com.cloud.vm.VirtualMachineProfile.Param) DomainRouterVO(com.cloud.vm.DomainRouterVO) Test(org.junit.Test)

Example 75 with DomainRouterVO

use of com.cloud.vm.DomainRouterVO in project cloudstack by apache.

the class LoadBalanceRuleHandlerTest method testAddCandidateVmIsPodIpMatchesWhenPodIdForDirectIpIsNull.

@Test
public void testAddCandidateVmIsPodIpMatchesWhenPodIdForDirectIpIsNull() throws Exception {
    DomainRouterVO candidateVmMock = mock(DomainRouterVO.class);
    when(candidateVmMock.getPodIdToDeployIn()).thenReturn(new Long(1));
    Long podIdForDirectIp = null;
    List<DomainRouterVO> candidateVms = new ArrayList<DomainRouterVO>();
    LoadBalanceRuleHandler.addCandidateVmIsPodIpMatches(candidateVmMock, podIdForDirectIp, candidateVms);
    assertEquals(0, candidateVms.size());
}
Also used : ArrayList(java.util.ArrayList) DomainRouterVO(com.cloud.vm.DomainRouterVO) Test(org.junit.Test)

Aggregations

DomainRouterVO (com.cloud.vm.DomainRouterVO)148 ArrayList (java.util.ArrayList)39 DataCenterVO (com.cloud.dc.DataCenterVO)33 ResourceUnavailableException (com.cloud.exception.ResourceUnavailableException)33 NetworkTopology (org.apache.cloudstack.network.topology.NetworkTopology)27 Test (org.junit.Test)26 CloudRuntimeException (com.cloud.utils.exception.CloudRuntimeException)24 Network (com.cloud.network.Network)20 NicProfile (com.cloud.vm.NicProfile)17 Account (com.cloud.user.Account)12 NetworkVO (com.cloud.network.dao.NetworkVO)11 Answer (com.cloud.agent.api.Answer)10 ConcurrentOperationException (com.cloud.exception.ConcurrentOperationException)10 InvalidParameterValueException (com.cloud.exception.InvalidParameterValueException)10 VirtualMachineProfile (com.cloud.vm.VirtualMachineProfile)10 UserVmVO (com.cloud.vm.UserVmVO)9 Vpc (com.cloud.network.vpc.Vpc)8 ServiceOfferingVO (com.cloud.service.ServiceOfferingVO)8 UserVO (com.cloud.user.UserVO)8 HashMap (java.util.HashMap)8