Fixed broken test in VirtualBox.

This commit is contained in:
Mattias Holmqvist 2011-12-27 07:31:55 +01:00
parent 53563179a8
commit 683b26d876
1 changed files with 14 additions and 16 deletions

View File

@ -19,30 +19,28 @@
package org.jclouds.virtualbox.functions.admin; package org.jclouds.virtualbox.functions.admin;
import static org.easymock.EasyMock.expect; import com.google.common.base.Predicate;
import static org.easymock.classextension.EasyMock.createMock; import com.google.common.collect.ImmutableSet;
import static org.easymock.classextension.EasyMock.replay; import com.google.common.collect.Iterables;
import static org.easymock.classextension.EasyMock.verify; import com.google.inject.AbstractModule;
import static org.testng.Assert.assertEquals; import com.google.inject.Module;
import java.net.URI;
import org.jclouds.compute.ComputeService; import org.jclouds.compute.ComputeService;
import org.jclouds.compute.ComputeServiceContextFactory; import org.jclouds.compute.ComputeServiceContextFactory;
import org.jclouds.compute.domain.ExecResponse; import org.jclouds.compute.domain.ExecResponse;
import org.jclouds.compute.domain.NodeMetadata; import org.jclouds.compute.domain.NodeMetadata;
import org.jclouds.domain.Credentials; import org.jclouds.domain.Credentials;
import org.jclouds.domain.LoginCredentials;
import org.jclouds.net.IPSocket; import org.jclouds.net.IPSocket;
import org.jclouds.ssh.ConfiguresSshClient; import org.jclouds.ssh.ConfiguresSshClient;
import org.jclouds.ssh.SshClient; import org.jclouds.ssh.SshClient;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import org.virtualbox_4_1.VirtualBoxManager; import org.virtualbox_4_1.VirtualBoxManager;
import com.google.common.base.Predicate; import java.net.URI;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Iterables; import static org.easymock.EasyMock.expect;
import com.google.inject.AbstractModule; import static org.easymock.classextension.EasyMock.*;
import com.google.inject.Module; import static org.testng.Assert.assertEquals;
@Test(groups = "unit", singleThreaded = true, testName = "StartVBoxIfNotAlreadyRunningTest") @Test(groups = "unit", singleThreaded = true, testName = "StartVBoxIfNotAlreadyRunningTest")
public class StartVBoxIfNotAlreadyRunningTest { public class StartVBoxIfNotAlreadyRunningTest {
@ -112,11 +110,11 @@ public class StartVBoxIfNotAlreadyRunningTest {
// these values. Right now, it is node 2 since the above test made node // these values. Right now, it is node 2 since the above test made node
// 1. // 1.
IPSocket expectedSshSockectFor2ndCreatedNode = new IPSocket("144.175.1.2", 22); IPSocket expectedSshSockectFor2ndCreatedNode = new IPSocket("144.175.1.2", 22);
Credentials expectedCredentialsFor2ndCreatedNode = new Credentials("root", "password2"); LoginCredentials loginCredentials = new LoginCredentials("root", "password2", null, false);
expect(factory.create(expectedSshSockectFor2ndCreatedNode, expectedCredentialsFor2ndCreatedNode)).andReturn( expect(factory.create(expectedSshSockectFor2ndCreatedNode, loginCredentials)).andReturn(
client).times(2); client).times(2);
expect(client.getUsername()).andReturn(expectedCredentialsFor2ndCreatedNode.identity).times(2); expect(client.getUsername()).andReturn(loginCredentials.identity).times(2);
expect(client.getHostAddress()).andReturn(expectedSshSockectFor2ndCreatedNode.getAddress()).times(2); expect(client.getHostAddress()).andReturn(expectedSshSockectFor2ndCreatedNode.getAddress()).times(2);
client.disconnect(); client.disconnect();