use of com.cloud.legacymodel.to.VolumeTO in project cosmic by MissionCriticalCloud.
the class XenServer610WrapperTest method testMigrateWithStorageSendCommandSRException.
@Test
public void testMigrateWithStorageSendCommandSRException() {
final String vmName = "small";
final Connection conn = Mockito.mock(Connection.class);
final VirtualMachineTO vmSpec = Mockito.mock(VirtualMachineTO.class);
final VolumeTO volume1 = Mockito.mock(VolumeTO.class);
final VolumeTO volume2 = Mockito.mock(VolumeTO.class);
final List<Pair<VolumeTO, Object>> volumeToSr = new ArrayList<>();
volumeToSr.add(new Pair<>(volume1, new String("a")));
volumeToSr.add(new Pair<>(volume2, new String("b")));
final List<Pair<NicTO, Object>> nicToNetwork = new ArrayList<>();
final Map<String, String> token = new HashMap<>();
final MigrateWithStorageSendCommand migrateStorageCommand = new MigrateWithStorageSendCommand(vmSpec, volumeToSr, nicToNetwork, token);
final CitrixRequestWrapper wrapper = CitrixRequestWrapper.getInstance();
assertNotNull(wrapper);
when(xenServer610Resource.getConnection()).thenReturn(conn);
when(vmSpec.getName()).thenReturn(vmName);
final Answer answer = wrapper.execute(migrateStorageCommand, xenServer610Resource);
verify(xenServer610Resource, times(1)).getConnection();
assertFalse(answer.getResult());
}
Aggregations