Package org.jclouds.compute

Examples of org.jclouds.compute.ComputeServiceContext.unwrap()


   @Test
   public void testUnwrapIsCorrectType() {
      ComputeServiceContext context = ContextBuilder.newBuilder("smartos-ssh")
               .modules(ImmutableSet.<Module> of(getSshModule())).build(ComputeServiceContext.class);

      assertEquals(context.unwrap().getClass(), ContextImpl.class);

      context.close();
   }

   protected Module getSshModule() {
View Full Code Here


   }

   private void checkAuthAsUser(ApiKeyPair keyPair) {
      ComputeServiceContext context = createView(credentialsAsProperties(keyPair), setupModules());

      CloudStackClient client = context.unwrap(CloudStackApiMetadata.CONTEXT_TOKEN).getApi();
      Set<Account> accounts = client.getAccountClient().listAccounts();

      assert accounts.size() > 0;

      context.close();
View Full Code Here

         assertFalse(InetAddresses2.isPrivateIPAddress(ip));
         HostAndPort socket = HostAndPort.fromParts(ip, 22);
         assertTrue(socketTester.apply(socket), String.format("failed to open socket %s on node %s", socket, node));

         // check that there is an elastic ip correlating to it
         EC2Client ec2 = EC2Client.class.cast(context.unwrap(EC2ApiMetadata.CONTEXT_TOKEN).getApi());
         Set<PublicIpInstanceIdPair> ipidpairs =
               ec2.getElasticIPAddressServices().describeAddressesInRegion(region, publicIps.toArray(new String[0]));
         assertEquals(ipidpairs.size(), 1, String.format("there should only be one address pair (%s)",
               Iterables.toString(ipidpairs)));
View Full Code Here

  public synchronized void releaseAddress(IaasProvider iaasInfo, String ip) {

    ComputeServiceContext context = iaasInfo.getComputeService()
        .getContext();

    NovaApi novaApi = context.unwrap(NovaApiMetadata.CONTEXT_TOKEN).getApi();
    String region = ComputeServiceBuilderUtil.extractRegion(iaasInfo);

    FloatingIPApi floatingIPApi = novaApi
        .getFloatingIPExtensionForZone(region).get();
View Full Code Here

    String ec2Msg = " ec2. Region: " + region + " - Key Pair Name: ";

    ComputeServiceContext context = iaasInfo.getComputeService()
        .getContext();
    AWSEC2Client ec2Client = context.unwrap(AWSEC2ApiMetadata.CONTEXT_TOKEN).getApi();

    ImportOrReturnExistingKeypair importer = new ImportOrReturnExistingKeypair(
        ec2Client);

    RegionNameAndPublicKeyMaterial regionNameAndKey = new RegionNameAndPublicKeyMaterial(
View Full Code Here

  public synchronized String associateAddress(IaasProvider iaasInfo,
      NodeMetadata node) {

    ComputeServiceContext context = iaasInfo.getComputeService()
        .getContext();
    AWSEC2Client ec2Client = context.unwrap(AWSEC2ApiMetadata.CONTEXT_TOKEN).getApi();
    String region = ComputeServiceBuilderUtil.extractRegion(iaasInfo);
   
    String ip = null;

    // first try to find an unassigned IP.
View Full Code Here

  @Override
  public synchronized void releaseAddress(IaasProvider iaasInfo, String ip) {

    ComputeServiceContext context = iaasInfo.getComputeService()
        .getContext();
    AWSEC2Client ec2Client = context.unwrap(AWSEC2ApiMetadata.CONTEXT_TOKEN).getApi();
    String region = ComputeServiceBuilderUtil.extractRegion(iaasInfo);

    ec2Client.getElasticIPAddressServices().disassociateAddressInRegion(
        region, ip);
    ec2Client.getElasticIPAddressServices().releaseAddressInRegion(region,
View Full Code Here

    String openstackNovaMsg = " Openstack-nova. Region: " + region
        + " - Name: ";

    ComputeServiceContext context = iaasInfo.getComputeService()
        .getContext();
    NovaApi novaApi = context.unwrap(NovaApiMetadata.CONTEXT_TOKEN).getApi();

    KeyPairApi api = novaApi.getKeyPairExtensionForZone(region).get();

    KeyPair keyPair = api.createWithPublicKey(keyPairName, publicKey);
View Full Code Here

      NodeMetadata node) {

    ComputeServiceContext context = iaasInfo.getComputeService()
        .getContext();

    NovaApi novaClient = context.unwrap(NovaApiMetadata.CONTEXT_TOKEN).getApi();
    String region = ComputeServiceBuilderUtil.extractRegion(iaasInfo);

    FloatingIPApi floatingIp = novaClient.getFloatingIPExtensionForZone(
        region).get();
View Full Code Here

   @Test
   public void testUnwrapIsCorrectType() {
      ComputeServiceContext context = ContextBuilder.newBuilder("smartos-ssh")
               .modules(ImmutableSet.<Module> of(getSshModule())).build(ComputeServiceContext.class);

      assertEquals(context.unwrap().getClass(), ContextImpl.class);

      context.close();
   }

   protected Module getSshModule() {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.