コード例 #1
0
  public void testBuilderPropertiesWithCredential() {
    RestContextSpec<IntegrationTestClient, IntegrationTestAsyncClient> contextSpec =
        contextSpec(
            provider,
            "http://localhost",
            "1",
            "",
            "dummy",
            "credential",
            IntegrationTestClient.class,
            IntegrationTestAsyncClient.class);

    Properties props = RestContextFactory.toProperties(contextSpec);
    assertEquals(props.getProperty("test.endpoint"), "http://localhost");
    assertEquals(props.getProperty("test.apiversion"), "1");
    assertEquals(props.getProperty("test.identity"), "dummy");
    assertEquals(props.getProperty("test.credential"), "credential");
    assertEquals(props.getProperty("test.sync"), IntegrationTestClient.class.getName());
    assertEquals(props.getProperty("test.async"), IntegrationTestAsyncClient.class.getName());
    assertEquals(props.getProperty("test.propertiesbuilder"), null);
    assertEquals(props.getProperty("test.contextbuilder"), null);
    assertEquals(props.getProperty("test.modules"), null);

    new RestContextFactory().createContext(provider, props);
  }
コード例 #2
0
  @SuppressWarnings("unchecked")
  public void testBuilderPropertiesWithModules() {
    @SuppressWarnings("rawtypes")
    RestContextSpec<IntegrationTestClient, IntegrationTestAsyncClient> contextSpec =
        contextSpec(
            provider,
            "http://localhost",
            "1",
            "",
            "dummy",
            null,
            (Class) null,
            (Class) null,
            PropertiesBuilder.class,
            (Class) IntegrationTestContextBuilder.class,
            Arrays.<Module>asList(new A(), new B()));

    Properties props = RestContextFactory.toProperties(contextSpec);
    assertEquals(props.getProperty("test.endpoint"), "http://localhost");
    assertEquals(props.getProperty("test.apiversion"), "1");
    assertEquals(props.getProperty("test.identity"), "dummy");
    assertEquals(props.getProperty("test.credential"), null);
    assertEquals(props.getProperty("test.sync"), null);
    assertEquals(props.getProperty("test.async"), null);
    assertEquals(props.getProperty("test.propertiesbuilder"), PropertiesBuilder.class.getName());
    assertEquals(
        props.getProperty("test.contextbuilder"), IntegrationTestContextBuilder.class.getName());
    assertEquals(
        props.getProperty("test.modules"),
        "org.jclouds.rest.RestContextFactoryTest$A,org.jclouds.rest.RestContextFactoryTest$B");

    new RestContextFactory().createContext(provider, props);
  }
コード例 #3
0
 protected Properties setupRestProperties() {
   return RestContextFactory.getPropertiesFromResource("/rest.properties");
 }