Package org.jclouds.googlecomputeengine.domain

Examples of org.jclouds.googlecomputeengine.domain.Network


   }

   @Test(groups = "live", dependsOnMethods = "testInsertNetwork")
   public void testGetNetwork() {

      Network network = api().get(NETWORK_NAME);
      assertNotNull(network);
      assertNetworkEquals(network);
   }
View Full Code Here


      GoogleComputeEngineTemplateOptions templateOptions = GoogleComputeEngineTemplateOptions.class.cast(mutableTemplate
              .getOptions());
      assert template.getOptions().equals(templateOptions) : "options didn't clone properly";

      // get or create the network and create a firewall with the users configuration
      Network network = getOrCreateNetwork(templateOptions, sharedResourceName);
      getOrCreateFirewall(templateOptions, network, sharedResourceName);
      templateOptions.network(network.getSelfLink());

      return super.execute(group, count, mutableTemplate, goodNodes, badNodes, customizationResponses);
   }
View Full Code Here

   private Network getOrCreateNetwork(GoogleComputeEngineTemplateOptions templateOptions, String sharedResourceName) {

      String networkName = templateOptions.getNetworkName().or(sharedResourceName);

      // check if the network was previously created (cache???)
      Network network = api.getNetworkApiForProject(userProject.get()).get(networkName);

      if (network != null) {
         return network;
      } else if (templateOptions.getNetwork().isPresent()) {
         throw new IllegalArgumentException("requested network " + networkName + " does not exist");
View Full Code Here

   @Override
   public Network apply(NetworkAndAddressRange input) {
      checkNotNull(input, "input");

      Network nw = api.getNetworkApiForProject(userProject.get()).get(input.getName());
      if (nw != null) {
         return nw;
      }

      if (input.getGateway().isPresent()) {
View Full Code Here

   @Test
   public void testLoadExisting() {
      final GoogleComputeEngineApi api = createMock(GoogleComputeEngineApi.class);
      final NetworkApi nwApi = createMock(NetworkApi.class);

      Network network = Network.builder().IPv4Range("0.0.0.0/0")
              .id("abcd").name("this-network")
              .selfLink(URI.create("https://www.googleapis.com/compute/v1/projects/myproject/global/networks/this-network"))
              .build();

      final Supplier<String> userProject = new Supplier<String>() {
View Full Code Here

   public void testLoadNew() {
      final GoogleComputeEngineApi api = createMock(GoogleComputeEngineApi.class);
      final NetworkApi nwApi = createMock(NetworkApi.class);
      final GlobalOperationApi globalApi = createMock(GlobalOperationApi.class);

      Network network = Network.builder().IPv4Range("0.0.0.0/0")
              .id("abcd").name("this-network")
              .selfLink(URI.create("https://www.googleapis.com/compute/v1/projects/myproject/global/networks/this-network"))
              .build();

      Operation createOp = createMock(Operation.class);
View Full Code Here

   }


   protected void cleanUpNetworksAndFirewallsForGroup(final String groupName) {
      String resourceName = namingConvention.create().sharedNameForGroup(groupName);
      final Network network = api.getNetworkApiForProject(project.get()).get(resourceName);
      FirewallApi firewallApi = api.getFirewallApiForProject(project.get());
      Predicate<Firewall> firewallBelongsToNetwork = new Predicate<Firewall>() {
         @Override
         public boolean apply(Firewall input) {
            return input != null && input.getNetwork().equals(network.getSelfLink());
         }
      };

      Set<AtomicReference<Operation>> operations = Sets.newHashSet();
      for (Firewall firewall : firewallApi.list().concat().filter(firewallBelongsToNetwork)) {
View Full Code Here

   }

   @Test(groups = "live", dependsOnMethods = "testInsertNetwork")
   public void testGetNetwork() {

      Network network = api().get(NETWORK_NAME);
      assertNotNull(network);
      assertNetworkEquals(network);
   }
View Full Code Here

   public void testApply() {
      final GoogleComputeEngineApi api = createMock(GoogleComputeEngineApi.class);
      final NetworkApi nwApi = createMock(NetworkApi.class);
      final GlobalOperationApi globalApi = createMock(GlobalOperationApi.class);

      Network network = Network.builder().IPv4Range("0.0.0.0/0")
              .id("abcd").name("this-network")
              .selfLink(URI.create("https://www.googleapis.com/compute/v1/projects/myproject/global/networks/this-network"))
              .build();

      Operation createOp = createMock(Operation.class);
View Full Code Here

   public void testApplyWithGateway() {
      final GoogleComputeEngineApi api = createMock(GoogleComputeEngineApi.class);
      final NetworkApi nwApi = createMock(NetworkApi.class);
      final GlobalOperationApi globalApi = createMock(GlobalOperationApi.class);

      Network network = Network.builder().IPv4Range("0.0.0.0/0")
              .id("abcd").name("this-network").gatewayIPv4("1.2.3.4")
              .selfLink(URI.create("https://www.googleapis.com/compute/v1/projects/myproject/global/networks/this-network"))
              .build();

      Operation createOp = createMock(Operation.class);
View Full Code Here

TOP

Related Classes of org.jclouds.googlecomputeengine.domain.Network

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.