use of com.cloud.api.commands.DeleteNuageVspDeviceCmd in project cloudstack by apache.
the class NuageVspManagerTest method testDeleteNuageVspDevice.
@Test
public void testDeleteNuageVspDevice() throws ConfigurationException {
final PhysicalNetworkVO physicalNetwork = mock(PhysicalNetworkVO.class);
when(physicalNetwork.getDataCenterId()).thenReturn(NETWORK_ID);
when(physicalNetwork.getId()).thenReturn(NETWORK_ID);
when(_physicalNetworkDao.findById(NETWORK_ID)).thenReturn(physicalNetwork);
final NuageVspDeviceVO nuageVspDevice = mock(NuageVspDeviceVO.class);
when(nuageVspDevice.getPhysicalNetworkId()).thenReturn(NETWORK_ID);
when(nuageVspDevice.getHostId()).thenReturn(NETWORK_ID);
when(_nuageVspDao.findById(NETWORK_ID)).thenReturn(nuageVspDevice);
when(_networkDao.listByPhysicalNetwork(NETWORK_ID)).thenReturn(new ArrayList<NetworkVO>());
final HostVO host = mock(HostVO.class);
when(host.getId()).thenReturn(NETWORK_ID);
when(_hostDao.findById(NETWORK_ID)).thenReturn(host);
final DeleteNuageVspDeviceCmd cmd = mock(DeleteNuageVspDeviceCmd.class);
when(cmd.getNuageVspDeviceId()).thenReturn(NETWORK_ID);
ConfigurationVO cmsIdConfig = mock(ConfigurationVO.class);
when(cmsIdConfig.getValue()).thenReturn("1:1");
when(_configurationDao.findByName("nuagevsp.cms.id")).thenReturn(cmsIdConfig);
final SyncNuageVspCmsIdAnswer answer = mock(SyncNuageVspCmsIdAnswer.class);
when(answer.getResult()).thenReturn(true);
when(_agentManager.easySend(eq(NETWORK_ID), (Command) any())).thenReturn(answer);
_nuageVspManager.deleteNuageVspDevice(cmd);
}
Aggregations