Package org.jclouds.domain

Examples of org.jclouds.domain.Location


      ApiContext<AbiquoApi> context = EasyMock.createMock(ApiContext.class);
      DatacenterToLocation function = new DatacenterToLocation();

      Datacenter datacenter = Datacenter.builder(context).name("dc").location("New York").build();
      datacenter.unwrap().setId(5);
      Location location = function.apply(datacenter);

      assertEquals(location.getId(), "5");
      assertEquals(location.getScope(), LocationScope.REGION);
   }
View Full Code Here


      Supplier<Map<Integer, Datacenter>> regionMap = mockRegionMap();
      VirtualDatacenterToLocation function = new VirtualDatacenterToLocation(dcToLocation, regionMap);

      VirtualDatacenter vdc = mockVirtualDatacenter();

      Location location = function.apply(vdc);

      verify(regionMap);
      verify(dcToLocation);

      assertEquals(location.getId(), "5");
      assertEquals(location.getScope(), LocationScope.ZONE);
   }
View Full Code Here

         public boolean apply(Location l) {
            return l.getId().equals(input.getMachineType().getZone());
         }
      });

      Location location = checkNotNull(getOnlyElement(zonesForMachineType),
              "location for %s",
              input.getMachineType().getZone());

      // TODO Figure out a robust way to deal with machineTypes with imageSizeGb==0 rather than just blocking them.
      return new HardwareBuilder()
View Full Code Here

   }

   @Override
   public LoadBalancerMetadata apply(LoadBalancerInRegion input) {

      Location location = findLocationWithId(input.getRegion());

      return new LoadBalancerMetadataImpl(LoadBalancerType.LB, input.getName(), input.getName(), input.slashEncode(),
               location, null, ImmutableMap.<String, String> of(),
               ImmutableSet.of(input.getLoadBalancer().getDnsName()));
   }
View Full Code Here

      this.roles = roles;
    }
   
    @Override
    public Set<NodeMetadata> call() throws Exception {
      Location location = new LocationBuilder().scope(LocationScope.ZONE)
            .id("loc").description("test location").build();
      Set<String> addresses = Sets.newHashSet();
      addresses.add("10.0.0.1");
      LoginCredentials loginCredentials = LoginCredentials.builder().user("id").privateKey("cred").build();
View Full Code Here

@Test(groups = "unit", singleThreaded = true, testName = "EC2CreateNodesInGroupThenAddToSetTest")
public class EC2CreateNodesInGroupThenAddToSetTest {

   @SuppressWarnings("unchecked")
   public void testIpAllocationThenAfterNodeRunningAssignThenUpdateCache() {
      Location location = ZONE_AP_SOUTHEAST_1A;
      String region = "ap-southeast-1";
      String zone = "ap-southeast-1a";

      String imageId = "ami1";
      String instanceCreatedId = "instance1";
View Full Code Here

      String group = this.group + "e";
      int volumeSize = 8;
     
      final Template template = view.getComputeService().templateBuilder().from(ebsTemplate).build();

      Location zone = Iterables.find(view.getComputeService().listAssignableLocations(), new Predicate<Location>() {

         @Override
         public boolean apply(Location arg0) {
            return arg0.getScope() == LocationScope.ZONE
                     && arg0.getParent().getId().equals(template.getLocation().getId());
         }

      });

      // create volume only to make a snapshot
      Volume volume = ebsClient.createVolumeInAvailabilityZone(zone.getId(), 4);
      // Sleep for 5 seconds to make sure the volume creation finishes.
      Thread.sleep(5000);

      Snapshot snapshot = ebsClient.createSnapshotInRegion(volume.getRegion(), volume.getId());
      ebsClient.deleteVolumeInRegion(volume.getRegion(), volume.getId());
View Full Code Here

   public void testDatacenterToLocation() {
      Address address = Address.builder().country("US").state("TX").description("This is Texas!").build();

      Datacenter datacenter = Datacenter.builder().id(1).longName("Texas Datacenter").locationAddress(address).build();

      Location location = function.apply(datacenter);

      assertEquals(location.getId(), Long.toString(datacenter.getId()));
      Set<String> iso3166Codes = location.getIso3166Codes();
      assertEquals(iso3166Codes.size(), 1);
      assertTrue(iso3166Codes.contains("US-TX"));
   }
View Full Code Here

   @Test
   public void testGetIso3166CodeNoCountryAndState() {
      Datacenter datacenter = Datacenter.builder().id(1).longName("Nowhere").build();

      Location location = function.apply(datacenter);

      assertEquals(location.getId(), Long.toString(datacenter.getId()));
      Set<String> iso3166Codes = location.getIso3166Codes();
      assertEquals(iso3166Codes.size(), 0);
   }
View Full Code Here

   public void testGetIso3166CodeCountryOnly() {
      Address address = Address.builder().country("US").description("This is North America!").build();

      Datacenter datacenter = Datacenter.builder().id(1).longName("Nowhere").locationAddress(address).build();

      Location location = function.apply(datacenter);

      assertEquals(location.getId(), Long.toString(datacenter.getId()));
      Set<String> iso3166Codes = location.getIso3166Codes();
      assertEquals(iso3166Codes.size(), 1);
      assertTrue(iso3166Codes.contains("US"));
   }
View Full Code Here

TOP

Related Classes of org.jclouds.domain.Location

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.