Package org.jclouds.domain

Examples of org.jclouds.domain.LocationBuilder


   @Test
   public void test() throws SecurityException, NoSuchMethodException {
      JustProvider fn = new JustProvider("servo", Suppliers.ofInstance(URI.create("http://servo")), ImmutableSet.of("US"));
      assertEquals(
            fn.get(),
            ImmutableSet.of(new LocationBuilder().scope(LocationScope.PROVIDER).id("servo").description("http://servo")
                  .iso3166Codes(ImmutableSet.of("US")).build()));
   }
View Full Code Here


                        "region2", Suppliers.<Set<String>>ofInstance(ImmutableSet.of("US-VA"))
                        ));
      RegionToProvider fn = new RegionToProvider(justProvider, regionIdsSupplier, locationToIsoCodes);
     
      assertEquals(fn.get(), ImmutableSet.of(
               new LocationBuilder().scope(LocationScope.REGION).id("region1").description("region1").iso3166Codes(ImmutableSet.of("US-CA")).parent(provider).build(),
               new LocationBuilder().scope(LocationScope.REGION).id("region2").description("region2").iso3166Codes(ImmutableSet.of("US-VA")).parent(provider).build()
               ));
   }
View Full Code Here

                        "zone2", Suppliers.<Set<String>>ofInstance(ImmutableSet.of("US-VA"))
                        ));
      ZoneToProvider fn = new ZoneToProvider(justProvider, zoneIdsSupplier, locationToIsoCodes);
     
      assertEquals(fn.get(), ImmutableSet.of(
               new LocationBuilder().scope(LocationScope.ZONE).id("zone1").description("zone1").iso3166Codes(ImmutableSet.of("US-CA")).parent(provider).build(),
               new LocationBuilder().scope(LocationScope.ZONE).id("zone2").description("zone2").iso3166Codes(ImmutableSet.of("US-VA")).parent(provider).build()
               ));
   }
View Full Code Here

    ClusterControllerFactory factory = mock(ClusterControllerFactory.class);
    ClusterController controller = mock(ClusterController.class);
    when(factory.create((String) any())).thenReturn(controller);

    NodeMetadata node1 = new NodeMetadataBuilder().name("name1").ids("id1")
        .location(new LocationBuilder().scope(LocationScope.PROVIDER)
          .id("location-id1").description("location-desc1").build())
        .imageId("image-id").state(NodeState.RUNNING)
        .publicAddresses(Lists.newArrayList("127.0.0.1"))
        .privateAddresses(Lists.newArrayList("127.0.0.1")).build();

    NodeMetadata node2 = new NodeMetadataBuilder().name("name2").ids("id2")
        .location(new LocationBuilder().scope(LocationScope.PROVIDER)
          .id("location-id2").description("location-desc2").build())
        .imageId("image-id").state(NodeState.RUNNING)
        .publicAddresses(Lists.newArrayList("127.0.0.2"))
        .privateAddresses(Lists.newArrayList("127.0.0.2")).build();
View Full Code Here

                  .getDetails(system.getId()));
         }
         for (VSystemWithDetails system : Futures.successfulAsList(futures)
               .get()) {

            Location systemLocation = new LocationBuilder()
                  .scope(LocationScope.SYSTEM)
                  .parent(Iterables.getOnlyElement(regionProvider.get()))
                  .description(system.getName()).id(system.getId())
                  .build();

            for (VNet net : system.getNetworks()) {

               locations.add(new LocationBuilder()
                     .scope(LocationScope.NETWORK)
                     .parent(systemLocation)
                     .description(
                           net.getNetworkId().replaceFirst(
                                 ".+(DMZ|SECURE.)", "\\1"))
View Full Code Here

      });
   }

   public void testWhenVDCIsLocation() {
      Location location = new LocationBuilder().id("https://1.1.1.1/api/v1.0/vdc/1").description("description")
            .scope(LocationScope.PROVIDER).build();
      Injector injector = createInjectorWithLocation(location);
      InputStream is = getClass().getResourceAsStream("/vapp-pool.xml");
      Factory factory = injector.getInstance(ParseSax.Factory.class);
      VApp result = factory.create(injector.getInstance(VAppHandler.class)).parse(is);
View Full Code Here

      assertEquals(node.getPrivateAddresses(), ImmutableSet.of("172.16.7.230"));
      assertEquals(node.getPublicAddresses(), ImmutableSet.of());
   }

   public void testWithMetadataParseException() {
      Location location = new LocationBuilder().id("https://1.1.1.1/api/v1.0/vdc/1").description("description")
         .scope(LocationScope.PROVIDER).build();
      Injector injector = createInjectorWithLocation(location);
      InputStream is = getClass().getResourceAsStream("/vapp-pool.xml");
      Factory factory = injector.getInstance(ParseSax.Factory.class);
      VApp result = factory.create(injector.getInstance(VAppHandler.class)).parse(is);
View Full Code Here

      assertEquals(node.getUserMetadata(), metadata);
      assertEquals(node.getTags(), tags);
   }

   public void testWithMetadataNoNewLines() {
      Location location = new LocationBuilder().id("https://1.1.1.1/api/v1.0/vdc/1").description("description")
         .scope(LocationScope.PROVIDER).build();
      Injector injector = createInjectorWithLocation(location);
      InputStream is = getClass().getResourceAsStream("/vapp-pool.xml");
      Factory factory = injector.getInstance(ParseSax.Factory.class);
      VApp result = factory.create(injector.getInstance(VAppHandler.class)).parse(is);
View Full Code Here

      assertEquals(node.getUserMetadata(), metadata);
      assertEquals(node.getTags(), tags);
   }

   public void testWithEncodedMetadata() {
      Location location = new LocationBuilder().id("https://1.1.1.1/api/v1.0/vdc/1").description("description")
            .scope(LocationScope.PROVIDER).build();
      Injector injector = createInjectorWithLocation(location);
      InputStream is = getClass().getResourceAsStream("/vapp-pool.xml");
      Factory factory = injector.getInstance(ParseSax.Factory.class);
      VApp result = factory.create(injector.getInstance(VAppHandler.class)).parse(is);
View Full Code Here

      assertEquals(node.getTags(), tags);

   }

   public void testGracefulWhenNoIPs() {
      Location location = new LocationBuilder().id("https://1.1.1.1/api/v1.0/vdc/1").description("description")
            .scope(LocationScope.PROVIDER).build();
      Injector injector = createInjectorWithLocation(location);
      InputStream is = getClass().getResourceAsStream("/vapp-none.xml");
      Factory factory = injector.getInstance(ParseSax.Factory.class);
      VApp result = factory.create(injector.getInstance(VAppHandler.class)).parse(is);
View Full Code Here

TOP

Related Classes of org.jclouds.domain.LocationBuilder

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.