Package org.jclouds.providers

Examples of org.jclouds.providers.ProviderMetadata


      assertEquals(newMd.getDefaultProperties(), md.getDefaultProperties());
   }
  
   @Test
   public void testProviderMetadataWithUpdatedIso3166CodesUpdatesAndRetainsAllDefaultPropertiesExceptIso3166Codes() {
      ProviderMetadata md = forApiOnEndpoint(IntegrationTestClient.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


      this.views = expectedApi.getViews();
   }

   @Test
   public void testWithId() {
      ProviderMetadata providerMetadata = Providers.withId(toTest.getId());

      assertEquals(toTest, providerMetadata);
      assert providerMetadata.getLinkedServices().contains(toTest.getId());
   }
View Full Code Here

   }

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

      Supplier<Credentials> creds = Suppliers.<Credentials> ofInstance(LoginCredentials.builder().user("user")
            .password("password").build());

      ExpectedBindings bindings = Guice.createInjector(new BindProviderMetadataContextAndCredentials(md, creds))
View Full Code Here

      assertEquals(bindings.creds.credential, "password");
   }

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

      Supplier<Credentials> creds = Suppliers.<Credentials> ofInstance(LoginCredentials.builder().user("user").build());

      ExpectedBindings bindings = Guice.createInjector(new BindProviderMetadataContextAndCredentials(md, creds))
               .getInstance(ExpectedBindings.class);
View Full Code Here

      assertEquals(bindings.creds.credential, null);
   }
  
   @Test
   public void testExpectedBindingsWhenBuildVersionAbsent() {
      ProviderMetadata md = forApiOnEndpoint(IntegrationTestClient.class, "http://localhost");

      ApiMetadata apiMd = md.getApiMetadata().toBuilder().buildVersion(null).build();
      md = md.toBuilder().apiMetadata(apiMd).build();
      Supplier<Credentials> creds = Suppliers.<Credentials> ofInstance(LoginCredentials.builder().user("user").build());

      ExpectedBindings bindings = Guice.createInjector(new BindProviderMetadataContextAndCredentials(md, creds))
               .getInstance(ExpectedBindings.class);
      assertEquals(bindings.buildVersion, null);
View Full Code Here

      assertEquals(bindings.buildVersion, null);
   }

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

      Properties defaultProps = md.getDefaultProperties();
      defaultProps.setProperty(Constants.PROPERTY_SESSION_INTERVAL, Integer.MAX_VALUE + "");
      md = md.toBuilder().defaultProperties(defaultProps).build();

      Supplier<Credentials> creds = Suppliers.<Credentials> ofInstance(LoginCredentials.builder().user("user").build());

      int session = Guice.createInjector(new BindProviderMetadataContextAndCredentials(md, creds)).getInstance(
               Key.get(int.class, Names.named(Constants.PROPERTY_SESSION_INTERVAL)));
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.