Examples of InventoryNavigator


Examples of com.vmware.vim25.mo.InventoryNavigator

     */
    protected ManagedEntity searchManagedEntity(String type, String name)
    {
        ManagedEntity ret = null;
        try {
            ret = new InventoryNavigator
                (rootFolder_).searchManagedEntity(type, name);
        } catch (Exception e) { /* InvalidProperty, RuntimeFault, RemoteException */
            logger_.warning(Utility.toString(e));
            return null;
        }
View Full Code Here

Examples of com.vmware.vim25.mo.InventoryNavigator

    {
        List<ManagedEntity> ret = new LinkedList<ManagedEntity>();
       
        ManagedEntity[] mes;
        try {
            mes = new InventoryNavigator(rootFolder_).searchManagedEntities(type);
        } catch (Exception e) { /* InvalidProperty, RuntimeFault, RemoteException */
            return ret;
        }
        assert(mes != null);

View Full Code Here

Examples of com.vmware.vim25.mo.InventoryNavigator

    {
        List<ManagedEntity> ret = new LinkedList<ManagedEntity>();
       
        ManagedEntity[] mes;
        try {
            mes = new InventoryNavigator(rootFolder_).searchManagedEntities
                (new String[][] { {type, name}, }, true);
           
        } catch (Exception e) { /* InvalidProperty, RuntimeFault, RemoteException */
            return ret;
        }
View Full Code Here

Examples of com.vmware.vim25.mo.InventoryNavigator

    @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);
View Full Code Here

Examples of com.vmware.vim25.mo.InventoryNavigator

    @Test
    public void shouldCallSearchManagedEntitiesOnDescribeWhenAtLeastOneVMIsReturned()
                    throws RemoteException {
        VSphereServiceConnectionWithMockedInventoryNavigator service =
                        new VSphereServiceConnectionWithMockedInventoryNavigator();
        InventoryNavigator inventoryNavigatorMock = service.getInventoryNavigatorMock();

        ManagedEntity[] meMocks = new ManagedEntity[] {mock(VirtualMachine.class)};
        when(inventoryNavigatorMock.searchManagedEntities(VIRTUAL_MACHINE_TYPE_NAME)).thenReturn(meMocks);

        VirtualMachine[] actualVMs = service.describeVirtualMachines();

        verify(inventoryNavigatorMock).searchManagedEntities(VIRTUAL_MACHINE_TYPE_NAME);
        assertSame(meMocks[0], actualVMs[0]);
View Full Code Here

Examples of com.vmware.vim25.mo.InventoryNavigator

    @Test(expectedExceptions = AmazonServiceException.class)
    public void shouldEncapsulateInvalidPropertyException() throws RemoteException {
        VSphereServiceConnectionWithMockedInventoryNavigator service =
                        new VSphereServiceConnectionWithMockedInventoryNavigator();
        InventoryNavigator inventoryNavigatorMock = service.getInventoryNavigatorMock();
        when(inventoryNavigatorMock.searchManagedEntities(VIRTUAL_MACHINE_TYPE_NAME)).thenThrow(new InvalidProperty());

        service.describeVirtualMachines();
    }
View Full Code Here

Examples of com.vmware.vim25.mo.InventoryNavigator

    @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();
    }
View Full Code Here

Examples of com.vmware.vim25.mo.InventoryNavigator

    @Test(expectedExceptions = AmazonServiceException.class)
    public void shouldEncapsulateRemoteExceptionException() throws RemoteException {
        VSphereServiceConnectionWithMockedInventoryNavigator service =
                        new VSphereServiceConnectionWithMockedInventoryNavigator();
        InventoryNavigator inventoryNavigatorMock = service.getInventoryNavigatorMock();
        when(inventoryNavigatorMock.searchManagedEntities(VIRTUAL_MACHINE_TYPE_NAME)).thenThrow(new RemoteException());

        service.describeVirtualMachines();
    }
View Full Code Here

Examples of com.vmware.vim25.mo.InventoryNavigator

            return Arrays.copyOf(mes, mes.length, VirtualMachine[].class);
        }
    }

    protected InventoryNavigator getInventoryNavigator() {
        return new InventoryNavigator(service.getRootFolder());
    }
View Full Code Here

Examples of com.vmware.vim25.mo.InventoryNavigator

    /**
     * Gets the named VirtualMachine.
     */
    public VirtualMachine getVirtualMachineById(String instanceId) throws RemoteException {
        InventoryNavigator inventoryNavigator = getInventoryNavigator();
        VirtualMachine virtualMachine = (VirtualMachine) inventoryNavigator.searchManagedEntity(
                VIRTUAL_MACHINE_TYPE_NAME, instanceId);

        return virtualMachine;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.