@Override @SelectJson("sshkeypair") public Set<SshKeyPair> expected() { return ImmutableSet.<SshKeyPair> of(SshKeyPair.builder().name("jclouds-keypair") .fingerprint("1c:06:74:52:3b:99:1c:95:5c:04:c2:f4:ba:77:6e:7b").build()); }
@Override @SelectJson("sshkeypair") public Set<SshKeyPair> expected() { return ImmutableSet.<SshKeyPair> of(SshKeyPair.builder().name("jclouds-keypair") .fingerprint("1c:06:74:52:3b:99:1c:95:5c:04:c2:f4:ba:77:6e:7b").build()); }
@Test public void testListAndGetSSHKeyPairsWhenResponseIs2xx() { HttpResponse response = HttpResponse.builder() .statusCode(200) .payload(payloadFromResource("/listsshkeypairsresponse.json")) .build(); SSHKeyPairClient client = requestSendsResponse(HttpRequest.builder() .method("GET") .endpoint( URI.create("http://localhost:8080/client/api?response=json&" + "command=listSSHKeyPairs&listAll=true&apiKey=identity&signature=5d2J9u%2BdKpkQsadDbl9i9OcUSLQ%3D")) .addHeader("Accept", "application/json") .build(), response); assertEquals(client.listSSHKeyPairs(), ImmutableSet.of( SshKeyPair.builder().name("jclouds-keypair") .fingerprint("1c:06:74:52:3b:99:1c:95:5c:04:c2:f4:ba:77:6e:7b").build())); client = requestSendsResponse(HttpRequest.builder() .method("GET") .endpoint( URI.create("http://localhost:8080/client/api?response=json&command=listSSHKeyPairs&listAll=true&" + "name=jclouds-keypair&apiKey=identity&signature=hJIVCFOHhdOww3aq19tFHpeD2HI%3D")) .addHeader("Accept", "application/json") .build(), response); assertEquals(client.getSSHKeyPair("jclouds-keypair"), SshKeyPair.builder().name("jclouds-keypair") .fingerprint("1c:06:74:52:3b:99:1c:95:5c:04:c2:f4:ba:77:6e:7b").build()); }
@Test public void testListAndGetSSHKeyPairsWhenResponseIs2xx() { HttpResponse response = HttpResponse.builder() .statusCode(200) .payload(payloadFromResource("/listsshkeypairsresponse.json")) .build(); SSHKeyPairApi client = requestSendsResponse(HttpRequest.builder() .method("GET") .endpoint( URI.create("http://localhost:8080/client/api?response=json&" + "command=listSSHKeyPairs&listAll=true&apiKey=identity&signature=5d2J9u%2BdKpkQsadDbl9i9OcUSLQ%3D")) .addHeader("Accept", "application/json") .build(), response); assertEquals(client.listSSHKeyPairs(), ImmutableSet.of( SshKeyPair.builder().name("jclouds-keypair") .fingerprint("1c:06:74:52:3b:99:1c:95:5c:04:c2:f4:ba:77:6e:7b").build())); client = requestSendsResponse(HttpRequest.builder() .method("GET") .endpoint( URI.create("http://localhost:8080/client/api?response=json&command=listSSHKeyPairs&listAll=true&" + "name=jclouds-keypair&apiKey=identity&signature=hJIVCFOHhdOww3aq19tFHpeD2HI%3D")) .addHeader("Accept", "application/json") .build(), response); assertEquals(client.getSSHKeyPair("jclouds-keypair"), SshKeyPair.builder().name("jclouds-keypair") .fingerprint("1c:06:74:52:3b:99:1c:95:5c:04:c2:f4:ba:77:6e:7b").build()); }
SshKeyPair expected = SshKeyPair.builder().name("jclouds-keypair") .fingerprint(expectedFingerprint).build();
SshKeyPair expected = SshKeyPair.builder().name("jclouds-keypair") .fingerprint(expectedFingerprint).build();
SshKeyPair expected = SshKeyPair.builder().name("jclouds-keypair") .fingerprint("1c:06:74:52:3b:99:1c:95:5c:04:c2:f4:ba:77:6e:7b") .privateKey("-----BEGIN RSA PRIVATE KEY-----\n" +
SshKeyPair expected = SshKeyPair.builder().name("jclouds-keypair") .fingerprint("1c:06:74:52:3b:99:1c:95:5c:04:c2:f4:ba:77:6e:7b") .privateKey("-----BEGIN RSA PRIVATE KEY-----\n" +
if (templateOptions.getLoginPrivateKey() != null) { String pem = templateOptions.getLoginPrivateKey(); keyPair = SshKeyPair.builder().name(templateOptions.getKeyPair()) .fingerprint(fingerprintPrivateKey(pem)).privateKey(pem).build(); keyPairCache.asMap().put(keyPair.getName(), keyPair);