Compare the finger prints in the live tests.

This commit is contained in:
vijaykiran 2011-11-07 14:34:18 +01:00
parent f0f77e7ce7
commit 392a200cd4
1 changed files with 9 additions and 3 deletions

View File

@ -20,6 +20,7 @@ package org.jclouds.cloudstack.features;
import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertEquals;
import java.util.Map;
import java.util.Set; import java.util.Set;
import org.jclouds.cloudstack.domain.SshKeyPair; import org.jclouds.cloudstack.domain.SshKeyPair;
@ -50,15 +51,20 @@ public class SSHKeyPairClientLiveTest extends BaseCloudStackClientLiveTest {
client.getSSHKeyPairClient().deleteSSHKeyPair(sshKeyPair.getName()); client.getSSHKeyPairClient().deleteSSHKeyPair(sshKeyPair.getName());
assertEquals(client.getSSHKeyPairClient().getSSHKeyPair(sshKeyPair.getName()), null); assertEquals(client.getSSHKeyPairClient().getSSHKeyPair(sshKeyPair.getName()), null);
// Set the keypair to null , if the delete test is passed. // Set the keypair to null , if the delete test is passed.
assertEquals(SshKeys.fingerprintPrivateKey(sshKeyPair.getPrivateKey()), sshKeyPair.getFingerprint());
sshKeyPair = null; sshKeyPair = null;
} }
public void testRegisterDeleteSSHKeyPair() { public void testRegisterDeleteSSHKeyPair() {
final String publickey = SshKeys.generate().get("public"); final Map<String, String> sshKey = SshKeys.generate();
sshKeyPair = client.getSSHKeyPairClient().registerSSHKeyPair(prefix + "jclouds-keypair", publickey); final String publicKey = sshKey.get("public");
final String privateKey = sshKey.get("private");
sshKeyPair = client.getSSHKeyPairClient().registerSSHKeyPair(prefix + "jclouds-keypair", publicKey);
checkSSHKeyPair(sshKeyPair); checkSSHKeyPair(sshKeyPair);
client.getSSHKeyPairClient().deleteSSHKeyPair(sshKeyPair.getName()); client.getSSHKeyPairClient().deleteSSHKeyPair(prefix + "jclouds-keypair");
assertEquals(client.getSSHKeyPairClient().getSSHKeyPair(sshKeyPair.getName()), null); assertEquals(client.getSSHKeyPairClient().getSSHKeyPair(sshKeyPair.getName()), null);
assertEquals(SshKeys.fingerprintPublicKey(publicKey), sshKeyPair.getFingerprint());
// Set the keypair to null , if the delete test is passed. // Set the keypair to null , if the delete test is passed.
sshKeyPair = null; sshKeyPair = null;