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);
}
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;
}
Aggregations