Search in sources :

Example 1 with Client

use of com.vmware.vim25.ws.Client in project SimianArmy by Netflix.

the class TestVSpehereClient method shouldTerminateCorrectly.

@Test
public void shouldTerminateCorrectly() throws RemoteException {
    VSphereServiceConnection connection = mock(VSphereServiceConnection.class);
    VirtualMachine vm1 = createVMMock("vm1");
    when(connection.getVirtualMachineById("vm1")).thenReturn(vm1);
    TerminationStrategy strategy = mock(PropertyBasedTerminationStrategy.class);
    VSphereClient client = new VSphereClient(strategy, connection);
    client.terminateInstance("vm1");
    verify(strategy, times(1)).terminate(vm1);
}
Also used : VirtualMachine(com.vmware.vim25.mo.VirtualMachine) Test(org.testng.annotations.Test)

Example 2 with Client

use of com.vmware.vim25.ws.Client in project opennms by OpenNMS.

the class VmwareViJavaAccess method setTimeout.

/**
     * Sets the timeout for server connections.
     *
     * @param timeout the timeout to be used for connecting
     * @return true, if the operation was successful
     */
public boolean setTimeout(int timeout) {
    if (m_serviceInstance != null) {
        ServerConnection serverConnection = m_serviceInstance.getServerConnection();
        if (serverConnection != null) {
            VimPortType vimService = serverConnection.getVimService();
            if (vimService != null) {
                Client client = vimService.getWsc();
                if (client != null) {
                    client.setConnectTimeout(timeout);
                    client.setReadTimeout(timeout);
                    return true;
                }
            }
        }
    }
    return false;
}
Also used : ServerConnection(com.vmware.vim25.mo.ServerConnection) Client(com.vmware.vim25.ws.Client) CIMClient(org.sblim.wbem.client.CIMClient) VimPortType(com.vmware.vim25.VimPortType)

Aggregations

VimPortType (com.vmware.vim25.VimPortType)1 ServerConnection (com.vmware.vim25.mo.ServerConnection)1 VirtualMachine (com.vmware.vim25.mo.VirtualMachine)1 Client (com.vmware.vim25.ws.Client)1 CIMClient (org.sblim.wbem.client.CIMClient)1 Test (org.testng.annotations.Test)1