Package org.jclouds.trmk.vcloud_0_8.domain

Examples of org.jclouds.trmk.vcloud_0_8.domain.IpAddress


   }

   @Override
   public Entry<InternetService, PublicIpAddress> getNewInternetServiceAndIp(VApp vApp, int port, Protocol protocol) {
      logger.debug(">> creating InternetService in vDC %s:%s:%d", vApp.getVDC().getHref(), protocol, port);
      InternetService is = client.addInternetServiceToVDC(
            vApp.getVDC().getHref(),
            vApp.getName() + "-" + port,
            protocol,
            port,
            withDescription(String.format("port %d access to serverId: %s name: %s", port, vApp.getName(),
                  vApp.getName())));
      PublicIpAddress ip = is.getPublicIpAddress();
      Map<InternetService, PublicIpAddress> result = ImmutableMap.<InternetService, PublicIpAddress> of(is, ip);
      Entry<InternetService, PublicIpAddress> entry = Iterables.getOnlyElement(result.entrySet());
      return entry;
   }
View Full Code Here


   }

   @Override
   public Entry<InternetService, PublicIpAddress> getNewInternetServiceAndIp(VApp vApp, int port, Protocol protocol) {
      logger.debug(">> creating InternetService in vDC %s:%s:%d", vApp.getVDC().getHref(), protocol, port);
      InternetService is = null;
      PublicIpAddress ip = null;
      try {
         ip = client.activatePublicIpInVDC(vApp.getVDC().getHref());
      } catch (InsufficientResourcesException e) {
         logger.warn(">> no more ip addresses available, looking for one to re-use");
View Full Code Here

   private int thisDepth;

   @Override
   public InternetService getResult() {
      return new InternetService(serviceName, location, publicIpAddress, port, protocol, enabled, timeout, description);
   }
View Full Code Here

            status = IpAddress.Status.fromValue(current);
         } else if (!skip && qName.equals("Server")) {
            server = current;
         }
      } else if (qName.equals("IpAddress")) {
         addresses.add(new IpAddress(address, status, server));
         address = null;
         status = null;
         server = null;
      }
      currentText = new StringBuilder();
View Full Code Here

   public void test1() throws UnknownHostException {
      InputStream is = getClass().getResourceAsStream("/ipAddresses.xml");

      Set<IpAddress> result = factory.create(injector.getInstance(IpAddressesHandler.class))
               .parse(is);
      assertEquals(result, ImmutableSet.of(new IpAddress("10.114.34.131", Status.ASSIGNED,
               "testforjcloud2"), new IpAddress("10.114.34.132", Status.AVAILABLE, null)));
   }
View Full Code Here

   public void test1() throws UnknownHostException {
      InputStream is = getClass().getResourceAsStream("/ipAddresses.xml");

      Set<IpAddress> result = factory.create(injector.getInstance(IpAddressesHandler.class))
               .parse(is);
      assertEquals(result, ImmutableSet.of(new IpAddress("10.114.34.131", Status.ASSIGNED,
               "testforjcloud2"), new IpAddress("10.114.34.132", Status.AVAILABLE, null)));
   }
View Full Code Here

            status = IpAddress.Status.fromValue(current);
         } else if (!skip && qName.equals("Server")) {
            server = current;
         }
      } else if (qName.equals("IpAddress")) {
         addresses.add(new IpAddress(address, status, server));
         address = null;
         status = null;
         server = null;
      }
      currentText = new StringBuilder();
View Full Code Here

public class KeyPairByNameHandlerTest extends BaseHandlerTest {

   public void testGood() throws UnknownHostException {
      InputStream is = getClass().getResourceAsStream("/keysList.xml");

      KeyPair result = factory.create(
            addOrgAndNameToHandler(injector.getInstance(KeyPairByNameHandler.class), "org", "default")).parse(is);
      assertEquals(result,
            new KeyPair(URI.create("https://services.vcloudexpress.terremark.com/api/v0.8a-ext1.6/extensions/key/9"),
                  "default", true, null, "4e:af:8a:9f:e9:d2:72:d7:4b:a0:da:98:72:98:4d:7d"));

   }
View Full Code Here

   }

   public void testNotFound() throws UnknownHostException {
      InputStream is = getClass().getResourceAsStream("/keysList.xml");

      KeyPair result = factory.create(
            addOrgAndNameToHandler(injector.getInstance(KeyPairByNameHandler.class), "org", "monster")).parse(is);
      assertNull(result);
   }
View Full Code Here

      TerremarkVCloudTemplateOptions options = new TerremarkVCloudTemplateOptions();

      // create mocks
      CreateNewKeyPairUnlessUserSpecifiedOtherwise strategy = setupStrategy();
      LoginCredentials keyPairCredentials = LoginCredentials.builder().privateKey(KeyPairHandlerTest.keyPair.getPrivateKey()).build();
      KeyPair keyPair = createMock(KeyPair.class);

      // setup expectations
      expect(strategy.credentialStore.containsKey("group#group")).andReturn(false);
      expect(strategy.createUniqueKeyPair.apply(new OrgAndName(org, "group"))).andReturn(keyPair);
      expect(keyPair.getFingerPrint()).andReturn(KeyPairHandlerTest.keyPair.getFingerPrint()).atLeastOnce();
      expect(strategy.credentialStore.put("group#group", keyPairCredentials)).andReturn(null);

      // replay mocks
      replay(keyPair);
      replayStrategy(strategy);
View Full Code Here

TOP

Related Classes of org.jclouds.trmk.vcloud_0_8.domain.IpAddress

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.