Package org.jclouds.joyent.cloudapi.v6_5

Examples of org.jclouds.joyent.cloudapi.v6_5.JoyentCloudApi


@Test(testName = "DatasetToOperatingSystemTest")
public class DatasetToOperatingSystemTest {

   public void testCentos6() {

      Dataset datasetToConvert = new ParseDatasetTest().expected();

      OperatingSystem convertedOs = new DatasetToOperatingSystem(ImmutableMap.<OsFamily, Map<String, String>> of(
            OsFamily.CENTOS, ImmutableMap.of("6", "6.0"))).apply(datasetToConvert);

      assertEquals(convertedOs.getName(), datasetToConvert.getName());
      assertEquals(convertedOs.getFamily(), OsFamily.CENTOS);
      assertEquals(convertedOs.getDescription(), datasetToConvert.getUrn());
      assertEquals(convertedOs.getVersion(), "6.0");
      assertEquals(convertedOs.getArch(), null);
      assertTrue(convertedOs.is64Bit());
   }
View Full Code Here


            return keyPair;
         }

      };
      KeyApi keyApi = createMock(KeyApi.class);
      Key key = Key.builder().name("group-foo").key(keyPair.get("public")).build();

      expect(cloudApiApi.getKeyApi()).andReturn(keyApi);

      expect(keyApi.create(key)).andReturn(key);
View Full Code Here

      String publicKey = keyPair.get("public");
      String privateKey = keyPair.get("private");

      logger.debug(">> creating key datacenter(%s) prefix(%s)", datacenterId, prefix);

      Key key = null;
      while (key == null) {
         String name = namingConvention.createWithoutPrefix().uniqueNameForGroup(prefix);
         try {
            key = cloudApiApi.getKeyApi().create(Key.builder().name(name).key(publicKey).build());
         } catch (IllegalStateException e) {
            logger.trace("error creating keypair named %s, %s", name, e.getMessage());
         }
      }

      logger.debug("<< created key(%s)", key.getName());
      return KeyAndPrivateKey.fromKeyAndPrivateKey(key, privateKey);
   }
View Full Code Here

   public void testListAndGetKeys() throws Exception {
      KeyApi api = cloudApiContext.getApi().getKeyApi();
      Set<Key> response = api.list();
      assert null != response;
      for (Key key : response) {
         Key newDetails = api.get(key.getName());
         assertEquals(newDetails.getName(), key.getName());
         assertEquals(newDetails.get(), key.get());
         assertEquals(newDetails.getCreated(), key.getCreated());
      }

   }
View Full Code Here

   }

   public void testCreateKey() {
      KeyApi api = cloudApiContext.getApi().getKeyApi();

      Key newKey = api.create(Key.builder().name(fingerprint).key(keyText).build());
      assertEquals(newKey.getName(), fingerprint);
      assertEquals(newKey.get(), keyText);

      newKey = api.get(fingerprint);
      assertEquals(newKey.getName(), fingerprint);
      assertEquals(newKey.get(), keyText);
   }
View Full Code Here

   public void testListAndGetKeys() throws Exception {
      KeyApi api = cloudApiContext.getApi().getKeyApi();
      Set<Key> response = api.list();
      assert null != response;
      for (Key key : response) {
         Key newDetails = api.get(key.getName());
         assertEquals(newDetails.getName(), key.getName());
         assertEquals(newDetails.get(), key.get());
         assertEquals(newDetails.getCreated(), key.getCreated());
      }

   }
View Full Code Here

   }

   public void testCreateKey() {
      KeyApi api = cloudApiContext.getApi().getKeyApi();

      Key newKey = api.create(Key.builder().name(fingerprint).key(keyText).build());
      assertEquals(newKey.getName(), fingerprint);
      assertEquals(newKey.get(), keyText);

      newKey = api.get(fingerprint);
      assertEquals(newKey.getName(), fingerprint);
      assertEquals(newKey.get(), keyText);
   }
View Full Code Here

            return keyPair;
         }

      };
      KeyApi keyApi = createMock(KeyApi.class);
      Key key = Key.builder().name("group-foo").key(keyPair.get("public")).build();

      expect(cloudApiApi.getKeyApi()).andReturn(keyApi);

      expect(keyApi.create(key)).andReturn(key);
View Full Code Here

      String publicKey = keyPair.get("public");
      String privateKey = keyPair.get("private");

      logger.debug(">> creating key datacenter(%s) prefix(%s)", datacenterId, prefix);

      Key key = null;
      while (key == null) {
         String name = namingConvention.createWithoutPrefix().uniqueNameForGroup(prefix);
         try {
            key = cloudApiApi.getKeyApi().create(Key.builder().name(name).key(publicKey).build());
         } catch (IllegalStateException e) {
            logger.trace("error creating keypair named %s, %s", name, e.getMessage());
         }
      }

      logger.debug("<< created key(%s)", key.getName());
      return KeyAndPrivateKey.fromKeyAndPrivateKey(key, privateKey);
   }
View Full Code Here

      String datacenterId = template.getLocation().getId();
      String datasetURN = template.getImage().getProviderId();

      logger.debug(">> creating new machine datacenter(%s) datasetURN(%s) options(%s)", datacenterId, datasetURN,
            options);
      Machine machine = cloudApiApi.getMachineApiForDatacenter(datacenterId).createWithDataset(datasetURN, options);

      logger.trace("<< machine(%s)", machine.getId());

      MachineInDatacenter machineInDatacenter = new MachineInDatacenter(machine, datacenterId);

      //TODO machineInDatacenter.metadata for password
      if (template.getOptions().getLoginPrivateKey() != null){
View Full Code Here

TOP

Related Classes of org.jclouds.joyent.cloudapi.v6_5.JoyentCloudApi

Copyright © 2018 www.massapicom. 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.