Package org.jclouds.domain

Examples of org.jclouds.domain.Location


      Address address = Address.builder().country(" US ").state("  TX  ").description("This is spaced out Texas")
            .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-TX"));
   }
View Full Code Here


   @Test(enabled = true, dependsOnMethods = "testCreateTwoNodesWithOneSpecifiedName")
   public void testCreateAnotherNodeWithANewContextToEnsureSharedMemIsntRequired() throws Exception {
      initializeContext();

      Location existingLocation = Iterables.get(this.nodes, 0).getLocation();
      boolean existingLocationIsAssignable = Iterables.any(client.listAssignableLocations(),
            Predicates.equalTo(existingLocation));

      if (existingLocationIsAssignable) {
         getAnonymousLogger().info("creating another node based on existing nodes' location: " + existingLocation);
         template = addRunScriptToTemplate(client.templateBuilder().fromTemplate(template)
               .locationId(existingLocation.getId()).build());
      } else {
         refreshTemplate();
         getAnonymousLogger().info(
               format("%s is not assignable; using template's location %s as  ", existingLocation,
                     template.getLocation()));
View Full Code Here

            break;
         case REGION:
            assertProvider(location.getParent());
            break;
         case ZONE:
            Location provider = location.getParent().getParent();
            // zone can be a direct descendant of provider
            if (provider == null)
               provider = location.getParent();
            assertProvider(provider);
            break;
         case HOST:
            Location provider2 = location.getParent().getParent().getParent();
            // zone can be a direct descendant of provider
            if (provider2 == null)
               provider2 = location.getParent().getParent();
            assertProvider(provider2);
            break;
View Full Code Here

   @Test(enabled = true, dependsOnMethods = "testCreateTwoNodesWithOneSpecifiedName")
   public void testCreateAnotherNodeWithANewContextToEnsureSharedMemIsntRequired() throws Exception {
      initializeContext();

      Location existingLocation = Iterables.get(this.nodes, 0).getLocation();
      boolean existingLocationIsAssignable = Iterables.any(client.listAssignableLocations(),
            Predicates.equalTo(existingLocation));

      if (existingLocationIsAssignable) {
         getAnonymousLogger().info("creating another node based on existing nodes' location: " + existingLocation);
         template = addRunScriptToTemplate(client.templateBuilder().fromTemplate(template)
               .locationId(existingLocation.getId()).build());
      } else {
         refreshTemplate();
         getAnonymousLogger().info(
               format("%s is not assignable; using template's location %s as  ", existingLocation,
                     template.getLocation()));
View Full Code Here

            break;
         case REGION:
            assertProvider(location.getParent());
            break;
         case ZONE:
            Location provider = location.getParent().getParent();
            // zone can be a direct descendant of provider
            if (provider == null)
               provider = location.getParent();
            assertProvider(provider);
            break;
         case HOST:
            Location provider2 = location.getParent().getParent().getParent();
            // zone can be a direct descendant of provider
            if (provider2 == null)
               provider2 = location.getParent().getParent();
            assertProvider(provider2);
            break;
View Full Code Here

   @Test(enabled = true, dependsOnMethods = "testCreateTwoNodesWithOneSpecifiedName")
   public void testCreateAnotherNodeWithANewContextToEnsureSharedMemIsntRequired() throws Exception {
      initializeContext();

      Location existingLocation = Iterables.get(this.nodes, 0).getLocation();
      boolean existingLocationIsAssignable = Iterables.any(client.listAssignableLocations(),
            Predicates.equalTo(existingLocation));

      if (existingLocationIsAssignable) {
         getAnonymousLogger().info("creating another node based on existing nodes' location: " + existingLocation);
         template = addRunScriptToTemplate(client.templateBuilder().fromTemplate(template)
               .locationId(existingLocation.getId()).build());
      } else {
         refreshTemplate();
         getAnonymousLogger().info(
               format("%s is not assignable; using template's location %s as  ", existingLocation,
                     template.getLocation()));
View Full Code Here

            break;
         case REGION:
            assertProvider(location.getParent());
            break;
         case ZONE:
            Location provider = location.getParent().getParent();
            // zone can be a direct descendant of provider
            if (provider == null)
               provider = location.getParent();
            assertProvider(provider);
            break;
         case HOST:
            Location provider2 = location.getParent().getParent().getParent();
            // zone can be a direct descendant of provider
            if (provider2 == null)
               provider2 = location.getParent().getParent();
            assertProvider(provider2);
            break;
View Full Code Here

      Set<String> publicAddresses = nullSafeSet(instance.getIpAddress());
      Set<String> privateAddresses = nullSafeSet(instance.getPrivateIpAddress());

      Map<String, String> extra = getExtra(instance);

      Location location = getLocationForAvailabilityZone(instance);

      Image image = resolveImageForInstanceInLocation(instance, location);

      return new NodeMetadataImpl(id, name, instance.getRegion() + "/" + instance.getId(),
               location, uri, userMetadata, tag, image, state, publicAddresses, privateAddresses,
View Full Code Here

   }

   private Location getLocationForAvailabilityZone(final RunningInstance instance) {
      final String locationId = instance.getAvailabilityZone();

      Location location = Iterables.find(locations, new Predicate<Location>() {

         @Override
         public boolean apply(Location input) {
            return input.getId().equals(locationId);
         }
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

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.