use of com.cloud.dc.HostPodVO in project cosmic by MissionCriticalCloud.
the class ConfigurationManagerTest method checkIfPodIsDeletableSuccessTest.
@Test
public void checkIfPodIsDeletableSuccessTest() {
final HostPodVO hostPodVO = Mockito.mock(HostPodVO.class);
Mockito.when(hostPodVO.getDataCenterId()).thenReturn(new Random().nextLong());
Mockito.when(_podDao.findById(anyLong())).thenReturn(hostPodVO);
Mockito.when(_privateIpAddressDao.countIPs(anyLong(), anyLong(), anyBoolean())).thenReturn(0);
Mockito.when(_volumeDao.findByPod(anyLong())).thenReturn(new ArrayList<>());
Mockito.when(_hostDao.findByPodId(anyLong())).thenReturn(new ArrayList<>());
Mockito.when(_vmInstanceDao.listByPodId(anyLong())).thenReturn(new ArrayList<>());
Mockito.when(_clusterDao.listByPodId(anyLong())).thenReturn(new ArrayList<>());
configurationMgr.checkIfPodIsDeletable(new Random().nextLong());
}
use of com.cloud.dc.HostPodVO in project cosmic by MissionCriticalCloud.
the class ConfigurationManagerTest method checkIfPodIsDeletableFailureOnClusterTest.
@Test(expected = CloudRuntimeException.class)
public void checkIfPodIsDeletableFailureOnClusterTest() {
final HostPodVO hostPodVO = Mockito.mock(HostPodVO.class);
Mockito.when(hostPodVO.getDataCenterId()).thenReturn(new Random().nextLong());
Mockito.when(_podDao.findById(anyLong())).thenReturn(hostPodVO);
final ClusterVO clusterVO = Mockito.mock(ClusterVO.class);
final ArrayList<ClusterVO> arrayList = new ArrayList<>();
arrayList.add(clusterVO);
Mockito.when(_privateIpAddressDao.countIPs(anyLong(), anyLong(), anyBoolean())).thenReturn(0);
Mockito.when(_volumeDao.findByPod(anyLong())).thenReturn(new ArrayList<>());
Mockito.when(_hostDao.findByPodId(anyLong())).thenReturn(new ArrayList<>());
Mockito.when(_vmInstanceDao.listByPodId(anyLong())).thenReturn(new ArrayList<>());
Mockito.when(_clusterDao.listByPodId(anyLong())).thenReturn(arrayList);
configurationMgr.checkIfPodIsDeletable(new Random().nextLong());
}
use of com.cloud.dc.HostPodVO in project cosmic by MissionCriticalCloud.
the class ConfigurationManagerTest method checkIfPodIsDeletableFailureOnPrivateIpAddressTest.
@Test(expected = CloudRuntimeException.class)
public void checkIfPodIsDeletableFailureOnPrivateIpAddressTest() {
final HostPodVO hostPodVO = Mockito.mock(HostPodVO.class);
Mockito.when(hostPodVO.getDataCenterId()).thenReturn(new Random().nextLong());
Mockito.when(_podDao.findById(anyLong())).thenReturn(hostPodVO);
Mockito.when(_privateIpAddressDao.countIPs(anyLong(), anyLong(), anyBoolean())).thenReturn(1);
Mockito.when(_volumeDao.findByPod(anyLong())).thenReturn(new ArrayList<>());
Mockito.when(_hostDao.findByPodId(anyLong())).thenReturn(new ArrayList<>());
Mockito.when(_vmInstanceDao.listByPodId(anyLong())).thenReturn(new ArrayList<>());
Mockito.when(_clusterDao.listByPodId(anyLong())).thenReturn(new ArrayList<>());
configurationMgr.checkIfPodIsDeletable(new Random().nextLong());
}
use of com.cloud.dc.HostPodVO in project cosmic by MissionCriticalCloud.
the class ConfigurationManagerTest method checkIfPodIsDeletableFailureOnHostTest.
@Test(expected = CloudRuntimeException.class)
public void checkIfPodIsDeletableFailureOnHostTest() {
final HostPodVO hostPodVO = Mockito.mock(HostPodVO.class);
Mockito.when(hostPodVO.getDataCenterId()).thenReturn(new Random().nextLong());
Mockito.when(_podDao.findById(anyLong())).thenReturn(hostPodVO);
final HostVO hostVO = Mockito.mock(HostVO.class);
final ArrayList<HostVO> arrayList = new ArrayList<>();
arrayList.add(hostVO);
Mockito.when(_privateIpAddressDao.countIPs(anyLong(), anyLong(), anyBoolean())).thenReturn(0);
Mockito.when(_volumeDao.findByPod(anyLong())).thenReturn(new ArrayList<>());
Mockito.when(_hostDao.findByPodId(anyLong())).thenReturn(arrayList);
Mockito.when(_vmInstanceDao.listByPodId(anyLong())).thenReturn(new ArrayList<>());
Mockito.when(_clusterDao.listByPodId(anyLong())).thenReturn(new ArrayList<>());
configurationMgr.checkIfPodIsDeletable(new Random().nextLong());
}
use of com.cloud.dc.HostPodVO in project cosmic by MissionCriticalCloud.
the class ConfigurationManagerTest method checkIfPodIsDeletableFailureOnVolumeTest.
@Test(expected = CloudRuntimeException.class)
public void checkIfPodIsDeletableFailureOnVolumeTest() {
final HostPodVO hostPodVO = Mockito.mock(HostPodVO.class);
Mockito.when(hostPodVO.getDataCenterId()).thenReturn(new Random().nextLong());
Mockito.when(_podDao.findById(anyLong())).thenReturn(hostPodVO);
final VolumeVO volumeVO = Mockito.mock(VolumeVO.class);
final ArrayList<VolumeVO> arrayList = new ArrayList<>();
arrayList.add(volumeVO);
Mockito.when(_privateIpAddressDao.countIPs(anyLong(), anyLong(), anyBoolean())).thenReturn(0);
Mockito.when(_volumeDao.findByPod(anyLong())).thenReturn(arrayList);
Mockito.when(_hostDao.findByPodId(anyLong())).thenReturn(new ArrayList<>());
Mockito.when(_vmInstanceDao.listByPodId(anyLong())).thenReturn(new ArrayList<>());
Mockito.when(_clusterDao.listByPodId(anyLong())).thenReturn(new ArrayList<>());
configurationMgr.checkIfPodIsDeletable(new Random().nextLong());
}
Aggregations