mirror of https://github.com/apache/cloudstack.git
Update XenServer610WrapperTest.java (#8139)
* Update XenServer610WrapperTest.java * Apply suggestions from code review Co-authored-by: Rohit Yadav <rohityadav89@gmail.com> --------- Co-authored-by: Rohit Yadav <rohityadav89@gmail.com>
This commit is contained in:
parent
ec3d0f54fe
commit
39c0706f1f
|
|
@ -259,8 +259,8 @@ public class XenServer610WrapperTest {
|
|||
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);
|
||||
|
|
@ -295,9 +295,6 @@ public class XenServer610WrapperTest {
|
|||
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);
|
||||
|
||||
|
|
@ -369,8 +366,8 @@ public class XenServer610WrapperTest {
|
|||
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);
|
||||
|
|
@ -399,9 +396,6 @@ public class XenServer610WrapperTest {
|
|||
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);
|
||||
|
||||
|
|
@ -481,4 +475,10 @@ public class XenServer610WrapperTest {
|
|||
|
||||
assertFalse(answer.getResult());
|
||||
}
|
||||
|
||||
VolumeTO MockVolumeTO(String path){
|
||||
VolumeTO vol = Mockito.mock(VolumeTO.class);
|
||||
when(vol.getPath()).thenReturn(path);
|
||||
return vol;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue