@Test public void listKeypairs() throws CloudException, InternalException { IdentityServices services = tm.getProvider().getIdentityServices(); if (services != null) { ShellKeySupport support = services.getShellKeySupport(); if (support != null) { Iterable<SSHKeypair> keypairs = support.list(); boolean found = false; int count = 0; assertNotNull("The list of keypairs may not be null", keypairs); for (SSHKeypair keypair : keypairs) { count++; tm.out("Keypair", keypair); if (testKeyId != null && testKeyId.equals(keypair.getProviderKeypairId())) { found = true; } } tm.out("Total Keypair Count", count); if (count < 1) { tm.warn("No keypairs were found, so this test may have been invalid"); } if (testKeyId != null) { assertNotNull("Unable to find the test keypair among the listed keypairs", found); } else { tm.warn("No test key exists, so unable to validate key listing"); } } else { tm.ok("No shell key support in this cloud"); } } else { tm.ok("No identity services in this cloud"); } }