mirror of https://github.com/apache/jclouds.git
freshen ning
This commit is contained in:
parent
d99c18140e
commit
51e5e4c4bb
|
@ -60,7 +60,7 @@
|
|||
<dependency>
|
||||
<groupId>com.ning</groupId>
|
||||
<artifactId>async-http-client</artifactId>
|
||||
<version>1.6.3</version>
|
||||
<version>1.7.4</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
|
|
|
@ -31,6 +31,7 @@ import java.util.concurrent.Future;
|
|||
import javax.inject.Singleton;
|
||||
import javax.ws.rs.core.HttpHeaders;
|
||||
|
||||
import org.jclouds.JcloudsVersion;
|
||||
import org.jclouds.crypto.CryptoStreams;
|
||||
import org.jclouds.http.HttpCommand;
|
||||
import org.jclouds.http.HttpCommandExecutorService;
|
||||
|
@ -50,7 +51,6 @@ import com.google.common.base.Throwables;
|
|||
import com.google.common.collect.LinkedHashMultimap;
|
||||
import com.google.common.collect.Multimap;
|
||||
import com.google.common.io.Closeables;
|
||||
import com.google.common.util.concurrent.AbstractFuture;
|
||||
import com.google.common.util.concurrent.Futures;
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
import com.google.inject.Inject;
|
||||
|
@ -68,7 +68,8 @@ import com.ning.http.client.generators.InputStreamBodyGenerator;
|
|||
*/
|
||||
public class NingHttpCommandExecutorService implements HttpCommandExecutorService {
|
||||
|
||||
public static final String USER_AGENT = "jclouds/1.0 ning http/1.0.0";
|
||||
//TODO: get async version from maven or something
|
||||
public static final String USER_AGENT = String.format("jclouds/%s async-http-client/%s", JcloudsVersion.get(), "1.7.4");
|
||||
|
||||
private final AsyncHttpClient client;
|
||||
private final ConvertToNingRequest convertToNingRequest;
|
||||
|
@ -99,10 +100,10 @@ public class NingHttpCommandExecutorService implements HttpCommandExecutorServic
|
|||
continue;
|
||||
} else {
|
||||
errorHandler.handleError(command, httpResponse);
|
||||
return wrapAsFuture(httpResponse);
|
||||
return Futures.immediateFuture(httpResponse);
|
||||
}
|
||||
} else {
|
||||
return wrapAsFuture(httpResponse);
|
||||
return Futures.immediateFuture(httpResponse);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -115,15 +116,6 @@ public class NingHttpCommandExecutorService implements HttpCommandExecutorServic
|
|||
}
|
||||
}
|
||||
|
||||
private ListenableFuture<HttpResponse> wrapAsFuture(final HttpResponse httpResponse) {
|
||||
return Futures.makeListenable(new AbstractFuture<HttpResponse>() {
|
||||
@Override
|
||||
public HttpResponse get() throws InterruptedException, ExecutionException {
|
||||
return httpResponse;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Singleton
|
||||
public static class ConvertToNingRequest implements Function<HttpRequest, Request> {
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@ import java.util.Properties;
|
|||
|
||||
import org.jclouds.http.BaseHttpCommandExecutorServiceIntegrationTest;
|
||||
import org.jclouds.http.ning.config.NingHttpCommandExecutorServiceModule;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.inject.Module;
|
||||
|
||||
|
@ -37,6 +38,7 @@ import com.google.inject.Module;
|
|||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@Test(testName = "NingHttpCommandExecutorServiceTest")
|
||||
public class NingHttpCommandExecutorServiceTest extends BaseHttpCommandExecutorServiceIntegrationTest {
|
||||
static {
|
||||
System.setProperty("http.conn-manager.timeout", 1000 + "");
|
||||
|
|
Loading…
Reference in New Issue