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

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


      Builder<MachineInDatacenter> builder = ImmutableSet.builder();
      for (final String datacenterId : datacenterIds.get()) {
         builder.addAll(transform(cloudApiApi.getMachineApiForDatacenter(datacenterId).list(),
               new Function<Machine, MachineInDatacenter>() {
                  public MachineInDatacenter apply(Machine arg0) {
                     return new MachineInDatacenter(arg0, datacenterId);
                  }
               }));
      }
      return builder.build();
   }
View Full Code Here


   @Override
   public MachineInDatacenter getNode(String id) {
      DatacenterAndId datacenterAndId = DatacenterAndId.fromSlashEncoded(id);
      Machine machine = cloudApiApi.getMachineApiForDatacenter(datacenterAndId.getDatacenter()).get(
            datacenterAndId.getId());
      return machine == null ? null : new MachineInDatacenter(machine, datacenterAndId.getDatacenter());
   }
View Full Code Here

      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,
            Suppliers.<Set<? extends Image>> ofInstance(images),
            Suppliers.<Set<? extends Hardware>> ofInstance(hardwares), namingConvention);

      NodeMetadata convertedNodeMetadata = converter.apply(machineInDatacenterToConvert);

      assertEquals(machineInDatacenterToConvert.slashEncode(), convertedNodeMetadata.getId());
      assertEquals(machineToConvert.getId(), convertedNodeMetadata.getProviderId());

      assertEquals(convertedNodeMetadata.getLocation().getScope(), LocationScope.ZONE);
      assertEquals(convertedNodeMetadata.getLocation().getId(), "us-sw-1");
View Full Code Here

   }

   @Test
   public void testWhenComputeServiceSaysAllNodesAreDeadNoGroupsAreReturned() {

      MachineInDatacenter machine1 = new MachineInDatacenter(new ParseMachineTest().expected(), "us-east-1");
      MachineInDatacenter machine2 = new MachineInDatacenter(new ParseMachineTest().expected(), "us-east-1");

      MachineInDatacenterToNodeMetadata converter = new MachineInDatacenterToNodeMetadata(
               JoyentCloudComputeServiceContextModule.toPortableNodeStatus, locationIndex, Suppliers
                        .<Set<? extends Image>> ofInstance(ImmutableSet.<Image> of()), Suppliers
                        .<Set<? extends Hardware>> ofInstance(ImmutableSet.<Hardware> of()), namingConvention);
View Full Code Here

   }

   @Test
   public void testWhenComputeServiceSaysAllNodesAreDeadNoGroupsAreReturned() {

      MachineInDatacenter machine1 = new MachineInDatacenter(new ParseMachineTest().expected(), "us-east-1");
      MachineInDatacenter machine2 = new MachineInDatacenter(new ParseMachineTest().expected(), "us-east-1");

      MachineInDatacenterToNodeMetadata converter = new MachineInDatacenterToNodeMetadata(
               JoyentCloudComputeServiceContextModule.toPortableNodeStatus, locationIndex, Suppliers
                        .<Set<? extends Image>> ofInstance(ImmutableSet.<Image> of()), Suppliers
                        .<Set<? extends Hardware>> ofInstance(ImmutableSet.<Hardware> of()), namingConvention);
View Full Code Here

      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,
            Suppliers.<Set<? extends Image>> ofInstance(images),
            Suppliers.<Set<? extends Hardware>> ofInstance(hardwares), namingConvention);

      NodeMetadata convertedNodeMetadata = converter.apply(machineInDatacenterToConvert);

      assertEquals(machineInDatacenterToConvert.slashEncode(), convertedNodeMetadata.getId());
      assertEquals(machineToConvert.getId(), convertedNodeMetadata.getProviderId());

      assertEquals(convertedNodeMetadata.getLocation().getScope(), LocationScope.ZONE);
      assertEquals(convertedNodeMetadata.getLocation().getId(), "us-sw-1");
View Full Code Here

      Builder<PackageInDatacenter> builder = ImmutableSet.builder();
      for (final String datacenterId : datacenterIds.get()) {
         builder.addAll(transform(cloudApiApi.getPackageApiForDatacenter(datacenterId).list(),
               new Function<org.jclouds.joyent.cloudapi.v6_5.domain.Package, PackageInDatacenter>() {
                  public PackageInDatacenter apply(org.jclouds.joyent.cloudapi.v6_5.domain.Package arg0) {
                     return new PackageInDatacenter(arg0, datacenterId);
                  }
               }));
      }
      return builder.build();
   }
View Full Code Here

         .diskSizeGb(30720).swapSizeMb(2048).isDefault(true).build();

   @Test
   public void testConversionWhereLocationFound() {

      PackageInDatacenter packageInZoneToConvert = new PackageInDatacenter(packageToConvert, "us-sw-1");

      Hardware converted = new PackageInDatacenterToHardware(locationIndex).apply(packageInZoneToConvert);

      assertEquals(converted.getName(), packageToConvert.getName());
      assertEquals(converted.getId(), packageInZoneToConvert.slashEncode());
      assertEquals(converted.getProviderId(), packageToConvert.getName());
      assertEquals(converted.getLocation(), locationIndex.get().get("us-sw-1"));

      assertEquals(converted.getRam(), packageToConvert.getMemorySizeMb());
View Full Code Here

   }

   @Test(expectedExceptions = IllegalStateException.class)
   public void testConversionWhereLocationNotFound() {

      PackageInDatacenter packageInZoneToConvert = new PackageInDatacenter(packageToConvert, "South");
      new PackageInDatacenterToHardware(locationIndex).apply(packageInZoneToConvert);
   }
View Full Code Here

         .diskSizeGb(30720).swapSizeMb(2048).isDefault(true).build();

   @Test
   public void testConversionWhereLocationFound() {

      PackageInDatacenter packageInZoneToConvert = new PackageInDatacenter(packageToConvert, "us-sw-1");

      Hardware converted = new PackageInDatacenterToHardware(locationIndex).apply(packageInZoneToConvert);

      assertEquals(converted.getName(), packageToConvert.getName());
      assertEquals(converted.getId(), packageInZoneToConvert.slashEncode());
      assertEquals(converted.getProviderId(), packageToConvert.getName());
      assertEquals(converted.getLocation(), locationIndex.get().get("us-sw-1"));

      assertEquals(converted.getRam(), packageToConvert.getMemorySizeMb());
View Full Code Here

TOP

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

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.