Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -259,8 +259,8 @@ public void testMigrateWithStorageSendCommand() {
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 VolumeTO volume1 = MockVolumeTO(path);
final VolumeTO volume2 = MockVolumeTO(path);

final SR sr1 = Mockito.mock(SR.class);
final SR sr2 = Mockito.mock(SR.class);
Expand Down Expand Up @@ -295,9 +295,6 @@ public void testMigrateWithStorageSendCommand() {
when(xenServer610Resource.getConnection()).thenReturn(conn);
when(vmSpec.getName()).thenReturn(vmName);

when(volume1.getPath()).thenReturn(path);
when(volume2.getPath()).thenReturn(path);

when(nic1.getMac()).thenReturn(mac);
when(nic2.getMac()).thenReturn(mac);

Expand Down Expand Up @@ -369,8 +366,8 @@ public void testMigrateWithStorageSendCommandNetException() {
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 VolumeTO volume1 = MockVolumeTO(path);
final VolumeTO volume2 = MockVolumeTO(path);

final SR sr1 = Mockito.mock(SR.class);
final SR sr2 = Mockito.mock(SR.class);
Expand Down Expand Up @@ -399,9 +396,6 @@ public void testMigrateWithStorageSendCommandNetException() {
when(xenServer610Resource.getConnection()).thenReturn(conn);
when(vmSpec.getName()).thenReturn(vmName);

when(volume1.getPath()).thenReturn(path);
when(volume2.getPath()).thenReturn(path);

when(xenServer610Resource.getVDIbyUuid(conn, volume1.getPath())).thenReturn(vdi1);
when(xenServer610Resource.getVDIbyUuid(conn, volume2.getPath())).thenReturn(vdi2);

Expand Down Expand Up @@ -481,4 +475,10 @@ public void testXenServer610MigrateVolumeCommandWrapper() {

assertFalse(answer.getResult());
}

VolumeTO MockVolumeTO(String path){
VolumeTO vol = Mockito.mock(VolumeTO.class);
when(vol.getPath()).thenReturn(path);
return vol;
}
}