Package org.jclouds.joyent.cloudapi.v6_5.features

Examples of org.jclouds.joyent.cloudapi.v6_5.features.KeyApi


         cleanupOrphanedKeysInZone(ImmutableSet.copyOf(entry.getValue()), entry.getKey());
      }
   }

   private void cleanupOrphanedKeysInZone(Set<String> groups, String datacenterId) {
      KeyApi keyApi = novaApi.getKeyApi();
      for (String group : groups) {
         for (Key key : Iterables.filter(keyApi.list(),
               KeyPredicates.nameMatches(namingConvention.create().containsGroup(group)))) {
            DatacenterAndName datacenterAndName = DatacenterAndName.fromDatacenterAndName(datacenterId, key.getName());
            logger.debug(">> deleting key(%s)", datacenterAndName);
            keyApi.delete(key.getName());
            // TODO: test this clear happens
            keyCache.invalidate(datacenterAndName);
            logger.debug("<< deleted key(%s)", datacenterAndName);
         }
View Full Code Here


@Test(groups = "live", singleThreaded = true, testName = "KeyApiLiveTest")
public class KeyApiLiveTest extends BaseJoyentCloudApiLiveTest {

   @Test
   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

      keyText = SshKeys.generate().get("public");
      fingerprint = SshKeys.fingerprintPublicKey(keyText);
   }

   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

      assertEquals(newKey.get(), keyText);
   }

   @Test(dependsOnMethods = "testCreateKey", expectedExceptions = IllegalStateException.class)
   public void testDuplicateKey() {
      KeyApi api = cloudApiContext.getApi().getKeyApi();
      api.create(Key.builder().name(fingerprint).key(keyText).build());
   }
View Full Code Here

      api.create(Key.builder().name(fingerprint).key(keyText).build());
   }

   @Test(dependsOnMethods = "testDuplicateKey")
   public void testDestroyKey() {
      final KeyApi api = cloudApiContext.getApi().getKeyApi();
      api.delete(fingerprint);
      // not that eventhough the key is destroyed it is visible via GET for at
      // least 45 seconds. This may be a cache issue on the server
   }
View Full Code Here

   public NodeAndInitialCredentials<MachineInDatacenter> createNodeWithGroupEncodedIntoName(String group, String name,
         Template template) {

      LoginCredentials.Builder credentialsBuilder = LoginCredentials.builder();

      CreateMachineOptions options = new CreateMachineOptions();
      options.name(name);
      options.packageName(template.getHardware().getProviderId());
      options.metadata(metadataAndTagsAsCommaDelimitedValue(template.getOptions()));

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

      logger.debug(">> creating new machine datacenter(%s) datasetURN(%s) options(%s)", datacenterId, datasetURN,
View Full Code Here

         String expectedImageId, OperatingSystem expectedOs, Image existingImage) {

      Set<Image> images = existingImage == null ? ImmutableSet.<Image> of() : ImmutableSet.of(existingImage);
      Set<Hardware> hardwares = existingHardware == null ? ImmutableSet.<Hardware> of() : ImmutableSet
            .of(existingHardware);
      Machine machineToConvert = new ParseCreatedMachineTest().expected();

      MachineInDatacenter machineInDatacenterToConvert = new MachineInDatacenter(machineToConvert, "us-sw-1");

      MachineInDatacenterToNodeMetadata converter = new MachineInDatacenterToNodeMetadata(
            JoyentCloudComputeServiceContextModule.toPortableNodeStatus, locationIndex,
View Full Code Here

      assertEquals(
            apiWithNewMachine
                  .getMachineApiForDatacenter("us-sw-1")
                  .createWithDataset("sdc:sdc:centos-5.7:1.2.1",
                        CreateMachineOptions.Builder.name("sample-e92").packageName("Small 1GB")).toString(),
            new ParseCreatedMachineTest().expected().toString());
   }
View Full Code Here

         String expectedImageId, OperatingSystem expectedOs, Image existingImage) {

      Set<Image> images = existingImage == null ? ImmutableSet.<Image> of() : ImmutableSet.of(existingImage);
      Set<Hardware> hardwares = existingHardware == null ? ImmutableSet.<Hardware> of() : ImmutableSet
            .of(existingHardware);
      Machine machineToConvert = new ParseCreatedMachineTest().expected();

      MachineInDatacenter machineInDatacenterToConvert = new MachineInDatacenter(machineToConvert, "us-sw-1");

      MachineInDatacenterToNodeMetadata converter = new MachineInDatacenterToNodeMetadata(
            JoyentCloudComputeServiceContextModule.toPortableNodeStatus, locationIndex,
View Full Code Here

  
   public void testListDatasetsWhenResponseIs2xx() {

      JoyentCloudApi apiWhenDatasetsExists = requestsSendResponses(getDatacenters, getDatacentersResponse, list, listResponse);

      assertEquals(apiWhenDatasetsExists.getDatasetApiForDatacenter("us-sw-1").list().toString(), new ParseDatasetListTest()
               .expected().toString());
   }
View Full Code Here

TOP

Related Classes of org.jclouds.joyent.cloudapi.v6_5.features.KeyApi

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.