Skip to content

Commit

Permalink
Update XenServer610WrapperTest.java
Browse files Browse the repository at this point in the history
  • Loading branch information
gzhao9 committed Oct 24, 2023
1 parent 543c54c commit b6369bc
Showing 1 changed file with 9 additions and 10 deletions.
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,9 @@ public void testXenServer610MigrateVolumeCommandWrapper() {

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

0 comments on commit b6369bc

Please sign in to comment.