Package org.jclouds.cloudstack.strategy

Examples of org.jclouds.cloudstack.strategy.BlockUntilJobCompletesAndReturnResult


      injector.injectMembers(adminVirtualMachineRunning);
      virtualMachineDestroyed = retry(new VirtualMachineDestroyed(client), 600, 5, 5, SECONDS);
      injector.injectMembers(virtualMachineDestroyed);
      adminVirtualMachineDestroyed = retry(new VirtualMachineDestroyed(adminClient), 600, 5, 5, SECONDS);
      injector.injectMembers(adminVirtualMachineDestroyed);
      reuseOrAssociate = new ReuseOrAssociateNewPublicIPAddress(client, new BlockUntilJobCompletesAndReturnResult(
            client, jobComplete));
      injector.injectMembers(reuseOrAssociate);
   }
View Full Code Here


   }

   public void testCreateIPForwardingRule() throws Exception {
      if (networksDisabled)
         return;
      BlockUntilJobCompletesAndReturnResult blocker = new BlockUntilJobCompletesAndReturnResult(client, jobComplete);
      StaticNATVirtualMachineInNetwork fn = new StaticNATVirtualMachineInNetwork(client, reuseOrAssociate, network);
      CreatePortForwardingRulesForIP createPortForwardingRulesForIP = new CreatePortForwardingRulesForIP(client,
            blocker, CacheBuilder.newBuilder().<String, Set<IPForwardingRule>> build(
                  new GetIPForwardingRulesByVirtualMachine(client)));
View Full Code Here

      replay(client);
      replay(jobClient);

      assertEquals(
            new BlockUntilJobCompletesAndReturnResult(client, jobComplete).<String>apply(AsyncCreateResponse.builder().id(id).jobId(
                  jobId).build()), "foo");

      verify(client);
      verify(jobClient);
View Full Code Here

      replay(client);
      replay(jobClient);

      assertEquals(
            new BlockUntilJobCompletesAndReturnResult(client, jobComplete).<String>apply(
                  AsyncCreateResponse.builder().id(id).jobId(jobId).build()), "foo");

      verify(client);
      verify(jobClient);
View Full Code Here

      replay(client);
      replay(jobClient);

      assertEquals(
            new BlockUntilJobCompletesAndReturnResult(client, jobComplete).<String>apply(
                  AsyncCreateResponse.builder().id(id).jobId(jobId).build()), "foo");

      verify(client);
      verify(jobClient);
View Full Code Here

   public void testReuseWorks() throws SecurityException, NoSuchMethodException {

      // create mocks
      CloudStackClient client = createMock(CloudStackClient.class);
      BlockUntilJobCompletesAndReturnResult blockUntilJobCompletesAndReturnResult = createMock(BlockUntilJobCompletesAndReturnResult.class);
      AddressClient addressClient = createMock(AddressClient.class);
      expect(client.getAddressClient()).andReturn(addressClient).atLeastOnce();

      // an address is available
      expect(addressClient.listPublicIPAddresses(allocatedOnly(true).networkId(networkId))).andReturn(
View Full Code Here

   public void testAssociateWorks() throws SecurityException, NoSuchMethodException {

      // create mocks
      CloudStackClient client = createMock(CloudStackClient.class);
      BlockUntilJobCompletesAndReturnResult blockUntilJobCompletesAndReturnResult = createMock(BlockUntilJobCompletesAndReturnResult.class);
      AddressClient addressClient = createMock(AddressClient.class);
      expect(client.getAddressClient()).andReturn(addressClient).atLeastOnce();

      // no ip addresses available
      expect(addressClient.listPublicIPAddresses(allocatedOnly(true).networkId(networkId))).andReturn(
            ImmutableSet.<PublicIPAddress> of());

      AsyncCreateResponse job = AsyncCreateResponse.builder().id("1").jobId("2").build();
      // make sure we created the job relating to a new ip
      expect(addressClient.associateIPAddressInZone(zoneId, networkId(networkId))).andReturn(job);

      expect(blockUntilJobCompletesAndReturnResult.apply(job)).andReturn(address);

      replay(client);
      replay(addressClient);
      replay(blockUntilJobCompletesAndReturnResult);
View Full Code Here

      injector.injectMembers(adminVirtualMachineRunning);
      virtualMachineDestroyed = retry(new VirtualMachineDestroyed(client), 600, 5, 5, SECONDS);
      injector.injectMembers(virtualMachineDestroyed);
      adminVirtualMachineDestroyed = retry(new VirtualMachineDestroyed(adminClient), 600, 5, 5, SECONDS);
      injector.injectMembers(adminVirtualMachineDestroyed);
      reuseOrAssociate = new ReuseOrAssociateNewPublicIPAddress(client, new BlockUntilJobCompletesAndReturnResult(
            client, jobComplete));
      injector.injectMembers(reuseOrAssociate);
   }
View Full Code Here

   }

   public void testCreateIPForwardingRule() throws Exception {
      if (networksDisabled)
         return;
      BlockUntilJobCompletesAndReturnResult blocker = new BlockUntilJobCompletesAndReturnResult(client, jobComplete);
      StaticNATVirtualMachineInNetwork fn = new StaticNATVirtualMachineInNetwork(client, reuseOrAssociate, network);
      CreatePortForwardingRulesForIP createPortForwardingRulesForIP = new CreatePortForwardingRulesForIP(client,
            blocker, CacheBuilder.newBuilder().<String, Set<IPForwardingRule>> build(
                  new GetIPForwardingRulesByVirtualMachine(client)));
View Full Code Here

      replay(client);
      replay(jobClient);

      assertEquals(
            new BlockUntilJobCompletesAndReturnResult(client, jobComplete).<String>apply(AsyncCreateResponse.builder().id(id).jobId(
                  jobId).build()), "foo");

      verify(client);
      verify(jobClient);
View Full Code Here

TOP

Related Classes of org.jclouds.cloudstack.strategy.BlockUntilJobCompletesAndReturnResult

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.