Issue 220: changed test to use dummy credentials

This commit is contained in:
Adrian Cole 2010-06-01 09:08:07 -06:00
parent 14e16fbfa6
commit 9fbc3068f2
2 changed files with 20 additions and 10 deletions

View File

@ -104,6 +104,17 @@ public abstract class BaseComputeServiceLiveTest {
if (tag == null) if (tag == null)
tag = checkNotNull(service, "service"); tag = checkNotNull(service, "service");
setupCredentials(); setupCredentials();
setupKeyPair();
initializeContextAndClient();
Injector injector = createSshClientInjector();
sshFactory = injector.getInstance(SshClient.Factory.class);
SocketOpen socketOpen = injector.getInstance(SocketOpen.class);
socketTester = new RetryablePredicate<IPSocket>(socketOpen, 60, 1, TimeUnit.SECONDS);
injector.injectMembers(socketOpen); // add logger
}
protected void setupKeyPair() throws FileNotFoundException, IOException {
String secretKeyFile; String secretKeyFile;
try { try {
secretKeyFile = checkNotNull(System.getProperty("jclouds.test.ssh.keyfile"), secretKeyFile = checkNotNull(System.getProperty("jclouds.test.ssh.keyfile"),
@ -116,14 +127,6 @@ public abstract class BaseComputeServiceLiveTest {
assert secret.startsWith("-----BEGIN RSA PRIVATE KEY-----") : "invalid key:\n" + secret; assert secret.startsWith("-----BEGIN RSA PRIVATE KEY-----") : "invalid key:\n" + secret;
keyPair = ImmutableMap.<String, String> of("private", secret, "public", Files.toString( keyPair = ImmutableMap.<String, String> of("private", secret, "public", Files.toString(
new File(secretKeyFile + ".pub"), Charsets.UTF_8)); new File(secretKeyFile + ".pub"), Charsets.UTF_8));
initializeContextAndClient();
Injector injector = createSshClientInjector();
sshFactory = injector.getInstance(SshClient.Factory.class);
SocketOpen socketOpen = injector.getInstance(SocketOpen.class);
socketTester = new RetryablePredicate<IPSocket>(socketOpen, 60, 1, TimeUnit.SECONDS);
injector.injectMembers(socketOpen); // add logger
// keyPair = sshFactory.generateRSAKeyPair("", "");
} }
protected void setupCredentials() { protected void setupCredentials() {

View File

@ -27,6 +27,7 @@ import static org.easymock.classextension.EasyMock.createMock;
import static org.easymock.classextension.EasyMock.replay; import static org.easymock.classextension.EasyMock.replay;
import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertEquals;
import java.io.FileNotFoundException;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.Serializable; import java.io.Serializable;
@ -307,4 +308,10 @@ public class StubComputeServiceIntegrationTest extends BaseComputeServiceLiveTes
} }
@Override
protected void setupKeyPair() throws FileNotFoundException, IOException {
keyPair = ImmutableMap.<String, String> of("public", "ssh-rsa", "private",
"-----BEGIN RSA PRIVATE KEY-----");
}
} }