Examples of KeyPairApi


Examples of org.jclouds.openstack.nova.v2_0.extensions.KeyPairApi

    * Delete the public key in the cloud and the local private key.
    */
   private void deleteKeyPair(KeyPair keyPair) {
      System.out.format("  Delete Key Pair%n");

      KeyPairApi keyPairApi = novaApi.getKeyPairExtensionForZone(ZONE).get();
      keyPairApi.delete(keyPair.getName());

      if (keyPairFile.delete()) {
         System.out.format("    Deleted %s%n", keyPairFile.getAbsolutePath());
      }
      else {
View Full Code Here

Examples of org.jclouds.openstack.nova.v2_0.extensions.KeyPairApi

public class CreateUniqueKeyPairTest {

   @Test
   public void testApply() throws UnknownHostException {
      final NovaApi api = createMock(NovaApi.class);
      KeyPairApi keyApi = createMock(KeyPairApi.class);

      KeyPair pair = createMock(KeyPair.class);

      Optional optKeyApi = Optional.of(keyApi);

      expect(api.getKeyPairApi("region")).andReturn(optKeyApi).atLeastOnce();

      expect(keyApi.create("group-1")).andReturn(pair);

      replay(api, keyApi);

      CreateUniqueKeyPair parser = Guice.createInjector(new AbstractModule() {
View Full Code Here

Examples of org.jclouds.openstack.nova.v2_0.extensions.KeyPairApi

   }

   @Test
   public void testApplyWithIllegalStateException() throws UnknownHostException {
      final NovaApi api = createMock(NovaApi.class);
      KeyPairApi keyApi = createMock(KeyPairApi.class);
      @SuppressWarnings("unchecked")
      final Supplier<String> uniqueIdSupplier = createMock(Supplier.class);

      KeyPair pair = createMock(KeyPair.class);

      expect(api.getKeyPairApi("region")).andReturn((Optional) Optional.of(keyApi)).atLeastOnce();

      expect(uniqueIdSupplier.get()).andReturn("1");
      expect(keyApi.create("group-1")).andThrow(new IllegalStateException());
      expect(uniqueIdSupplier.get()).andReturn("2");
      expect(keyApi.create("group-2")).andReturn(pair);

      replay(api, keyApi, uniqueIdSupplier);

      CreateUniqueKeyPair parser = Guice.createInjector(new AbstractModule() {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.