@Test public void keypairContent() throws CloudException, InternalException { IdentityServices services = tm.getProvider().getIdentityServices(); if (services != null) { ShellKeySupport support = services.getShellKeySupport(); if (support != null) { if (testKeyId != null) { SSHKeypair keypair = support.getKeypair(testKeyId); assertNotNull("Failed to find the test keypair", keypair); tm.out("Keypair ID", keypair.getProviderKeypairId()); tm.out("Name", keypair.getName()); tm.out("Owner Account", keypair.getProviderOwnerId()); tm.out("Region ID", keypair.getProviderRegionId()); tm.out("Fingerprint", keypair.getFingerprint()); tm.out("Public Key", keypair.getPublicKey()); tm.out("PrivateKey", keypair.getPrivateKey()); assertNotNull("Keypair ID may not be null", keypair.getProviderKeypairId()); assertNotNull("Keypair name may not be null", keypair.getName()); assertNotNull("Keypair owning account may not be null", keypair.getProviderOwnerId()); assertEquals( "Keypair region must match current region context", tm.getContext().getRegionId(), keypair.getProviderRegionId()); if (keypair.getFingerprint() == null) { tm.warn("A keypair really, really should have a fingerprint if supported by the cloud"); } } else { tm.warn("No test key was specified, this test is probably invalid"); } } else { tm.ok("No shell key support in this cloud"); } } else { tm.ok("No identity services in this cloud"); } }