Issue 1004: GAE uses SocketOpenUnsupported

This commit is contained in:
Aled Sage 2012-07-06 10:30:32 +01:00
parent 95c35487f0
commit 9e0f22207c
2 changed files with 32 additions and 0 deletions

View File

@ -27,6 +27,8 @@ import org.jclouds.http.HttpCommandExecutorService;
import org.jclouds.http.TransformingHttpCommandExecutorService;
import org.jclouds.http.TransformingHttpCommandExecutorServiceImpl;
import org.jclouds.http.config.ConfiguresHttpCommandExecutorService;
import org.jclouds.predicates.SocketOpen;
import org.jclouds.predicates.SocketOpenUnsupported;
import com.google.appengine.api.urlfetch.URLFetchService;
import com.google.appengine.api.urlfetch.URLFetchServiceFactory;
@ -35,6 +37,7 @@ import com.google.common.util.concurrent.ListeningExecutorService;
import com.google.inject.AbstractModule;
import com.google.inject.Module;
import com.google.inject.Provides;
import com.google.inject.Scopes;
/**
* Configures {@link GaeHttpCommandExecutorService}.
@ -75,6 +78,7 @@ public class GoogleAppEngineConfigurationModule extends AbstractModule {
protected void configure() {
install(executorServiceModule);
bind(TransformingHttpCommandExecutorService.class).to(TransformingHttpCommandExecutorServiceImpl.class);
bind(SocketOpen.class).to(SocketOpenUnsupported.class).in(Scopes.SINGLETON);
bindHttpCommandExecutorService();
}

View File

@ -0,0 +1,28 @@
package org.jclouds.gae;
import org.jclouds.Context;
import org.jclouds.ContextBuilder;
import org.jclouds.gae.config.GoogleAppEngineConfigurationModule;
import org.jclouds.http.IntegrationTestAsyncClient;
import org.jclouds.http.IntegrationTestClient;
import org.jclouds.predicates.SocketOpen;
import org.jclouds.providers.AnonymousProviderMetadata;
import org.testng.annotations.Test;
import com.google.common.collect.ImmutableSet;
import com.google.common.net.HostAndPort;
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.getUtils().getInjector().getInstance(SocketOpen.class);
socketOpen.apply(HostAndPort.fromParts("localhost", 22));
}
}