Package org.jclouds

Examples of org.jclouds.Context


      overrides.setProperty(NodePoolProperties.MIN_SIZE, "0");
      overrides.setProperty(NodePoolProperties.BASEDIR, baseDir);
      overrides.setProperty(POOL_ADMIN_ACCESS, "adminUsername=pooluser,adminPassword=poolpass");
      // note no ssh module since we are stub and not trying ssh, yet
      overrides.setProperty(NodePoolProperties.BACKEND_MODULES, SLF4JLoggingModule.class.getName());
      Context nodePoolCtx = ContextBuilder.newBuilder("nodepool").credentials("foo", "bar").overrides(overrides)
               .build();
      return nodePoolCtx.utils().getInjector();
   }
View Full Code Here


     * @return
     */
    public static <T> String toId(T service) {
        String id = null;
        try {
            Context context = toContext(service);
            if (View.class.isAssignableFrom(context.getClass())) {
                id = ((View) context).unwrap().getId();
            } else {
                id = context.getId();
            }
        } catch (IllegalArgumentException ex) {
            //Fallback to pure reflection
            id = callMethod(service, "getId", String.class);
        }
View Full Code Here

     * @return
     */
    public static <T> String toName(T service) {
        String name = null;
        try {
            Context context = toContext(service);
            if (View.class.isAssignableFrom(context.getClass())) {
                name = ((View) context).unwrap().getName();
            } else {
                name = context.getName();
            }
        } catch (IllegalArgumentException ex) {
            //Fallback to pure reflection
            name = callMethod(service, "getName", String.class);
        }
View Full Code Here

     * @param service
     * @param <T>
     * @return
     */
    public static <T> Context toContext(T service) {
        Context ctx = null;
        Class c = service.getClass();
        try {
            //Ugly way to get the Context, but there doesn't seem to be a better one.
            Method m = c.getMethod("getContext");
            Object obj = m.invoke(service);
View Full Code Here

      overrides.setProperty(NodePoolProperties.MIN_SIZE, "0");
      overrides.setProperty(NodePoolProperties.BASEDIR, baseDir);
      overrides.setProperty(POOL_ADMIN_ACCESS, "adminUsername=pooluser,adminPassword=poolpass");
      // note no ssh module since we are stub and not trying ssh, yet
      overrides.setProperty(NodePoolProperties.BACKEND_MODULES, SLF4JLoggingModule.class.getName());
      Context nodePoolCtx = ContextBuilder.newBuilder("nodepool").credentials("foo", "bar").overrides(overrides)
               .build();
      return nodePoolCtx.utils().getInjector();
   }
View Full Code Here

public class GaeSocketOpenTest {

   @Test(expectedExceptions=UnsupportedOperationException.class)
   public void testSocketOpenThrowsUnsupported() {
      Context context = ContextBuilder.newBuilder(
                  AnonymousProviderMetadata.forClientMappedToAsyncClientOnEndpoint(IntegrationTestClient.class, IntegrationTestAsyncClient.class,
                        "dummyurl"))
            .modules(ImmutableSet.of(new GoogleAppEngineConfigurationModule()))
            .build();

      SocketOpen socketOpen = context.utils().injector().getInstance(SocketOpen.class);
      socketOpen.apply(HostAndPort.fromParts("localhost", 22));
   }
View Full Code Here

public class GaeSocketOpenTest {

   @Test(expectedExceptions = UnsupportedOperationException.class)
   public void testSocketOpenThrowsUnsupported() {
      Context context = ContextBuilder.newBuilder(
                  AnonymousProviderMetadata.forClientMappedToAsyncClientOnEndpoint(IntegrationTestClient.class, IntegrationTestAsyncClient.class,
                        "dummyurl"))
            .modules(ImmutableSet.of(new GoogleAppEngineConfigurationModule()))
            .build();

      SocketOpen socketOpen = context.utils().injector().getInstance(SocketOpen.class);
      socketOpen.apply(HostAndPort.fromParts("localhost", 22));
   }
View Full Code Here

public class GaeSocketOpenTest {

   @Test(expectedExceptions=UnsupportedOperationException.class)
   public void testSocketOpenThrowsUnsupported() {
      Context context = ContextBuilder.newBuilder(
                  AnonymousProviderMetadata.forClientMappedToAsyncClientOnEndpoint(IntegrationTestClient.class, IntegrationTestAsyncClient.class,
                        "dummyurl"))
            .modules(ImmutableSet.of(new GoogleAppEngineConfigurationModule()))
            .build();

      SocketOpen socketOpen = context.utils().injector().getInstance(SocketOpen.class);
      socketOpen.apply(HostAndPort.fromParts("localhost", 22));
   }
View Full Code Here

public class GaeSocketOpenTest {

   @Test(expectedExceptions = UnsupportedOperationException.class)
   public void testSocketOpenThrowsUnsupported() {
      Context context = ContextBuilder.newBuilder(forApiOnEndpoint(IntegrationTestClient.class, "dummyurl"))
            .modules(ImmutableSet.of(new GoogleAppEngineConfigurationModule()))
            .build();

      SocketOpen socketOpen = context.utils().injector().getInstance(SocketOpen.class);
      socketOpen.apply(HostAndPort.fromParts("localhost", 22));
   }
View Full Code Here

TOP

Related Classes of org.jclouds.Context

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.