Package org.jclouds.joyent.cloudapi.v6_5.compute.options

Examples of org.jclouds.joyent.cloudapi.v6_5.compute.options.JoyentCloudTemplateOptions$Builder


      assertEquals(options.getSeconds(), 30);
   }

   @Test(expectedExceptions = IllegalArgumentException.class)
   public void testinboundPortsBadFormat() {
      JoyentCloudTemplateOptions options = new JoyentCloudTemplateOptions();
      options.inboundPorts(-1, -1);
   }


      options.inboundPorts(-1, -1);
   }

   @Test
   public void testinboundPorts() {
      JoyentCloudTemplateOptions options = new JoyentCloudTemplateOptions();
      options.inboundPorts(22, 30);
      assertEquals(options.getInboundPorts()[0], 22);
      assertEquals(options.getInboundPorts()[1], 30);

   }

   }

   @Test
   public void testDefaultOpen22() {
      JoyentCloudTemplateOptions options = new JoyentCloudTemplateOptions();
      assertEquals(options.getInboundPorts()[0], 22);
   }

      assertEquals(options.getInboundPorts()[0], 22);
   }

   @Test
   public void testinboundPortsStatic() {
      JoyentCloudTemplateOptions options = inboundPorts(22, 30);
      assertEquals(options.getInboundPorts()[0], 22);
      assertEquals(options.getInboundPorts()[1], 30);
   }

public class OrphanedGroupsByDatacenterId implements Function<Set<? extends NodeMetadata>, Multimap<String, String>> {
   private final Predicate<DatacenterAndName> allNodesInGroupTerminated;

   @Inject
   protected OrphanedGroupsByDatacenterId(ComputeService computeService) {
      this(new AllNodesInGroupTerminated(checkNotNull(computeService, "computeService")));
   }

@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());
   }

   }

   @Override
   public DatasetInDatacenter getImage(String id) {
      DatacenterAndId datacenterAndId = DatacenterAndId.fromSlashEncoded(id);
      Dataset dataset = cloudApiApi.getDatasetApiForDatacenter(datacenterAndId.getDatacenter()).get(
            datacenterAndId.getId());
      return dataset == null ? null : new DatasetInDatacenter(dataset, datacenterAndId.getDatacenter());
   }

   @Override
   public Image apply(DatasetInDatacenter datasetInDatacenter) {
      Location location = locationIndex.get().get(datasetInDatacenter.getDatacenter());
      checkState(location != null, "location %s not in locationIndex: %s", datasetInDatacenter.getDatacenter(),
            locationIndex.get());
      Dataset dataset = datasetInDatacenter.get();
      return new ImageBuilder()
            .id(datasetInDatacenter.slashEncode())
            // note that it is urn that is the expected value!
            .providerId(dataset.getUrn())
            .name(dataset.getName())
            .operatingSystem(imageToOs.apply(dataset))
            .description(dataset.getDescription())
            .version(dataset.getVersion())
            .location(location)
            .status(Image.Status.AVAILABLE).build();
   }

      for (String datacenterId : cloudApiContext.getApi().getConfiguredDatacenters()) {
         DatasetApi api = cloudApiContext.getApi().getDatasetApiForDatacenter(datacenterId);
         Set<Dataset> response = api.list();
         assert null != response;
         for (Dataset dataset : response) {
            Dataset newDetails = api.get(dataset.getId());
            assertEquals(newDetails.getId(), dataset.getId());
            assertEquals(newDetails.getName(), dataset.getName());
            assertEquals(newDetails.getType(), dataset.getType());
            assertEquals(newDetails.getVersion(), dataset.getVersion());
            assertEquals(newDetails.getUrn(), dataset.getUrn());
            assertEquals(newDetails.getCreated(), dataset.getCreated());
            assertEquals(newDetails.isDefault(), dataset.isDefault());
         }
      }
   }

            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);

TOP

Related Classes of org.jclouds.joyent.cloudapi.v6_5.compute.options.JoyentCloudTemplateOptions$Builder

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.