use of com.vmware.vim25.mo.InventoryNavigator in project SimianArmy by Netflix.
the class VSphereServiceConnectionWithMockedInventoryNavigator method shouldEncapsulateRuntimeFaultException.
@Test(expectedExceptions = AmazonServiceException.class)
public void shouldEncapsulateRuntimeFaultException() throws RemoteException {
VSphereServiceConnectionWithMockedInventoryNavigator service = new VSphereServiceConnectionWithMockedInventoryNavigator();
InventoryNavigator inventoryNavigatorMock = service.getInventoryNavigatorMock();
when(inventoryNavigatorMock.searchManagedEntities(VIRTUAL_MACHINE_TYPE_NAME)).thenThrow(new RuntimeFault());
service.describeVirtualMachines();
}
use of com.vmware.vim25.mo.InventoryNavigator in project SimianArmy by Netflix.
the class VSphereServiceConnectionWithMockedInventoryNavigator method shouldCallSearchManagedEntityAndReturnVMForDoItGetVirtualMachineById.
@Test
public void shouldCallSearchManagedEntityAndReturnVMForDoItGetVirtualMachineById() throws RemoteException {
VSphereServiceConnectionWithMockedInventoryNavigator service = new VSphereServiceConnectionWithMockedInventoryNavigator();
InventoryNavigator inventoryNavigatorMock = service.getInventoryNavigatorMock();
VirtualMachine vmMock = mock(VirtualMachine.class);
when(inventoryNavigatorMock.searchManagedEntity(VIRTUAL_MACHINE_TYPE_NAME, "instanceId")).thenReturn(vmMock);
VirtualMachine actualVM = service.getVirtualMachineById("instanceId");
verify(inventoryNavigatorMock).searchManagedEntity(VIRTUAL_MACHINE_TYPE_NAME, "instanceId");
assertSame(vmMock, actualVM);
}
Aggregations