Package org.jclouds.providers

Examples of org.jclouds.providers.ProviderMetadata


      assertEquals(newMd.getDefaultProperties(), md.getDefaultProperties());
   }
  
   @Test
   public void testProviderMetadataWithUpdatedIso3166CodesUpdatesAndRetainsAllDefaultPropertiesExceptIso3166Codes() {
      ProviderMetadata md = AnonymousProviderMetadata.forClientMappedToAsyncClientOnEndpoint(
               IntegrationTestClient.class, IntegrationTestAsyncClient.class, "http://localhost");

      Properties props = new Properties();
      props.putAll(md.getDefaultProperties());
      props.setProperty(PROPERTY_ISO3166_CODES, "US-CA");

      ProviderMetadata newMd = new UpdateProviderMetadataFromProperties(md).apply(props);

      assertEquals(newMd.getIso3166Codes(), ImmutableSet.of("US-CA"));
      assertEquals(newMd.getDefaultProperties(), md.getDefaultProperties());
   }
View Full Code Here


   }

   @Test
   public void testRawAndExplicit() {
      ProviderMetadata md = AnonymousProviderMetadata.forClientMappedToAsyncClientOnEndpoint(
               IntegrationTestClient.class, IntegrationTestAsyncClient.class, "http://localhost");

      ExpectedBindings bindings = injectorFor(md).getInstance(ExpectedBindings.class);
      assertEquals(bindings.raw, bindings.explicit);
   }
View Full Code Here

   }

   @Test
   public void testRawExplicitAndWildCardExtends() {
      ProviderMetadata md = AnonymousProviderMetadata.forClientMappedToAsyncClientOnEndpoint(
               IntegrationTestClient.class, IntegrationTestAsyncClient.class, "http://localhost");

      TypeToken<? extends Context> wildCardExtendsType = new TypeToken<RestContext<? extends IntegrationTestClient, ? extends IntegrationTestAsyncClient>>() {
         private static final long serialVersionUID = 1L;
      };
     
      md = md.toBuilder().apiMetadata(md.getApiMetadata().toBuilder().context(wildCardExtendsType).build()).build();

      ExpectedBindingsWithWildCardExtends bindings = injectorFor(md).getInstance(ExpectedBindingsWithWildCardExtends.class);
      assertEquals(bindings.raw, bindings.explicit);
      assertEquals(bindings.explicit, bindings.wildcardExtends);
   }
View Full Code Here

   }

   @Test
   public void testRawAndExplicit() {
      ProviderMetadata md = AnonymousProviderMetadata.forApiOnEndpoint(IntegrationTestClient.class, "http://localhost");

      ExpectedBindings bindings = injectorFor(md).getInstance(ExpectedBindings.class);
      assertEquals(bindings.raw, bindings.explicit);
   }
View Full Code Here

   }

   @Test
   public void testRawExplicitAndWildCardExtends() {
      ProviderMetadata md = AnonymousProviderMetadata.forApiOnEndpoint(IntegrationTestClient.class, "http://localhost");

      TypeToken<? extends Context> wildCardExtendsType = new TypeToken<ApiContext<? extends IntegrationTestClient>>() {
         private static final long serialVersionUID = 1L;
      };

      md = md.toBuilder().apiMetadata(md.getApiMetadata().toBuilder().context(wildCardExtendsType).build()).build();

      ExpectedBindingsWithWildCardExtends bindings = injectorFor(md).getInstance(
            ExpectedBindingsWithWildCardExtends.class);
      assertEquals(bindings.raw, bindings.explicit);
      assertEquals(bindings.explicit, bindings.wildcardExtends);
View Full Code Here

   protected ApiMetadata createApiMetadata() {
      return null;
   }

   protected Injector createInjector() {
      ProviderMetadata pm = createProviderMetadata();

      ContextBuilder builder = pm != null ? ContextBuilder.newBuilder(pm) : ContextBuilder.newBuilder(ApiMetadata.class
            .cast(checkNotNull(createApiMetadata(),
                  "either createApiMetadata or createProviderMetadata must be overridden")));
View Full Code Here

                  .warning("provider ["
                        + provider
                        + "] is not setup as META-INF/services/org.jclouds.apis.ApiMetadata or META-INF/services/org.jclouds.providers.ProviderMetadata");
         }

      ProviderMetadata pm = createProviderMetadata();

      ContextBuilder builder = pm != null ? ContextBuilder.newBuilder(pm) : ContextBuilder
            .newBuilder(ApiMetadata.class.cast(checkNotNull(createApiMetadata(),
                  "either createApiMetadata or createProviderMetadata must be overridden")));
      return builder;
View Full Code Here

    } else {
      overrides.put(AWSEC2Constants.PROPERTY_EC2_AMI_QUERY, "state=available;image-type=machine;root-device-type=ebs;name=*" + searchTerm.trim() + "*");
    }
    overrides.put(AWSEC2Constants.PROPERTY_EC2_CC_REGIONS, this.location);

    ProviderMetadata selectedProvider = selectedCloud.getProvider();
    ApiMetadata selectedApi = selectedCloud.getApi();
    if (selectedProvider != null && selectedProvider != JClouds.EMPTY_PROVIDER) {
      context = ContextBuilder.newBuilder(selectedProvider)
                    .credentials(selectedCloud.getIdentity(), selectedCloud.getCredential())
                    .overrides(overrides)
View Full Code Here

      return null;
    }
    }   
   
    public static ComputeService createComputeService(CloudDetails details) {
        ProviderMetadata selectedProvider = details.getProvider();
        ApiMetadata selectedApi = details.getApi();

        if (selectedProvider == JClouds.EMPTY_PROVIDER &&
          selectedApi == JClouds.EMPTY_API) return null;
       
        String identity = details.getIdentity();
        String credential = details.getCredential();
        String endpoint = details.getEndpoint();

        if (selectedProvider != null && !Strings.isBlank(identity) && !Strings.isBlank(credential)) {
            String providerId = selectedProvider.getId();
            String owner = details.getOwnerId();
            Properties props = new Properties();

            props.put("provider", providerId);
            props.put(PROPERTY_IDENTITY, identity);
View Full Code Here

      }
     
        providerNameField.addSelectionChangedListener(new ISelectionChangedListener() {
      @Override
      public void selectionChanged(SelectionChangedEvent event) {
        ProviderMetadata item = (ProviderMetadata)Selections.getFirstSelection(event.getSelection());
        apiNameField.getCombo().setEnabled(item == JClouds.EMPTY_PROVIDER);
        validate();
      }
    });
        apiNameField.addSelectionChangedListener(new ISelectionChangedListener() {
      @Override
      public void selectionChanged(SelectionChangedEvent event) {
        ApiMetadata item = (ApiMetadata)Selections.getFirstSelection(event.getSelection());
        providerNameField.getCombo().setEnabled(item == JClouds.EMPTY_API);
        validate();
      }
    });

        ProviderMetadata provider = details.getProvider();
        if (provider != null) {
            providerNameField.setSelection(new StructuredSelection(provider));
        }
        ApiMetadata api = details.getApi();
        if (api != null) {
View Full Code Here

TOP

Related Classes of org.jclouds.providers.ProviderMetadata

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.