Package org.jclouds.cloudstack.features

Examples of org.jclouds.cloudstack.features.AddressClient


   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(
            ImmutableSet.<PublicIPAddress> of(address));

      replay(client);
      replay(blockUntilJobCompletesAndReturnResult);
      replay(addressClient);
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);
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(
            ImmutableSet.<PublicIPAddress> of(address));

      replay(client);
      replay(blockUntilJobCompletesAndReturnResult);
      replay(addressClient);
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);
View Full Code Here

TOP

Related Classes of org.jclouds.cloudstack.features.AddressClient

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.