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);
}
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);
}
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());
}
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);
}
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());
}
Aggregations