mirror of https://github.com/apache/jclouds.git
Fixed and improved live tests for SSHKeyPairClient
This commit is contained in:
parent
5856f466e4
commit
7ea0e8629f
|
@ -28,6 +28,8 @@ import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import static org.testng.Assert.assertEquals;
|
import static org.testng.Assert.assertEquals;
|
||||||
|
import static org.testng.Assert.assertNotNull;
|
||||||
|
import static org.testng.Assert.assertNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests behavior of {@code SSHKeyPairClient}
|
* Tests behavior of {@code SSHKeyPairClient}
|
||||||
|
@ -58,6 +60,7 @@ public class SSHKeyPairClientLiveTest extends BaseCloudStackClientLiveTest {
|
||||||
@Test
|
@Test
|
||||||
public void testCreateDeleteSSHKeyPair() {
|
public void testCreateDeleteSSHKeyPair() {
|
||||||
sshKeyPair = client.getSSHKeyPairClient().createSSHKeyPair(keyPairName);
|
sshKeyPair = client.getSSHKeyPairClient().createSSHKeyPair(keyPairName);
|
||||||
|
assertNotNull(sshKeyPair.getPrivateKey());
|
||||||
checkSSHKeyPair(sshKeyPair);
|
checkSSHKeyPair(sshKeyPair);
|
||||||
client.getSSHKeyPairClient().deleteSSHKeyPair(sshKeyPair.getName());
|
client.getSSHKeyPairClient().deleteSSHKeyPair(sshKeyPair.getName());
|
||||||
|
|
||||||
|
@ -73,6 +76,7 @@ public class SSHKeyPairClientLiveTest extends BaseCloudStackClientLiveTest {
|
||||||
final String publicKey = sshKey.get("public");
|
final String publicKey = sshKey.get("public");
|
||||||
|
|
||||||
sshKeyPair = client.getSSHKeyPairClient().registerSSHKeyPair(keyPairName, publicKey);
|
sshKeyPair = client.getSSHKeyPairClient().registerSSHKeyPair(keyPairName, publicKey);
|
||||||
|
assertNull(sshKeyPair.getPrivateKey());
|
||||||
checkSSHKeyPair(sshKeyPair);
|
checkSSHKeyPair(sshKeyPair);
|
||||||
client.getSSHKeyPairClient().deleteSSHKeyPair(keyPairName);
|
client.getSSHKeyPairClient().deleteSSHKeyPair(keyPairName);
|
||||||
|
|
||||||
|
@ -84,7 +88,8 @@ public class SSHKeyPairClientLiveTest extends BaseCloudStackClientLiveTest {
|
||||||
|
|
||||||
protected void checkSSHKeyPair(SshKeyPair pair) {
|
protected void checkSSHKeyPair(SshKeyPair pair) {
|
||||||
assert pair.getName() != null : pair;
|
assert pair.getName() != null : pair;
|
||||||
assertEquals(pair.toString(), client.getSSHKeyPairClient().getSSHKeyPair(pair.getName()).toString());
|
assertEquals(pair.getFingerprint(),
|
||||||
|
client.getSSHKeyPairClient().getSSHKeyPair(pair.getName()).getFingerprint());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue