Search in sources :

Example 1 with DeleteNuageVspDeviceCmd

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);
}
Also used : NuageVspDeviceVO(com.cloud.network.NuageVspDeviceVO) NetworkVO(com.cloud.network.dao.NetworkVO) PhysicalNetworkVO(com.cloud.network.dao.PhysicalNetworkVO) DeleteNuageVspDeviceCmd(com.cloud.api.commands.DeleteNuageVspDeviceCmd) ConfigurationVO(org.apache.cloudstack.framework.config.impl.ConfigurationVO) PhysicalNetworkVO(com.cloud.network.dao.PhysicalNetworkVO) SyncNuageVspCmsIdAnswer(com.cloud.agent.api.sync.SyncNuageVspCmsIdAnswer) HostVO(com.cloud.host.HostVO) NuageTest(com.cloud.NuageTest) Test(org.junit.Test)

Aggregations

NuageTest (com.cloud.NuageTest)1 SyncNuageVspCmsIdAnswer (com.cloud.agent.api.sync.SyncNuageVspCmsIdAnswer)1 DeleteNuageVspDeviceCmd (com.cloud.api.commands.DeleteNuageVspDeviceCmd)1 HostVO (com.cloud.host.HostVO)1 NuageVspDeviceVO (com.cloud.network.NuageVspDeviceVO)1 NetworkVO (com.cloud.network.dao.NetworkVO)1 PhysicalNetworkVO (com.cloud.network.dao.PhysicalNetworkVO)1 ConfigurationVO (org.apache.cloudstack.framework.config.impl.ConfigurationVO)1 Test (org.junit.Test)1