mirror of https://github.com/apache/jclouds.git
Issue 85: removed HttpMethod enum, as it is inherently non-extensible. Documented http://code.google.com/p/jclouds/wiki/NewService
git-svn-id: http://jclouds.googlecode.com/svn/trunk@1859 3d8758e0-26b5-11de-8745-db77d3ebf521
This commit is contained in:
parent
1740912593
commit
93866572a0
|
@ -23,6 +23,7 @@
|
||||||
*/
|
*/
|
||||||
package org.jclouds.aws.s3.handlers;
|
package org.jclouds.aws.s3.handlers;
|
||||||
|
|
||||||
|
import javax.ws.rs.HttpMethod;
|
||||||
import javax.ws.rs.core.HttpHeaders;
|
import javax.ws.rs.core.HttpHeaders;
|
||||||
|
|
||||||
import org.jclouds.aws.domain.AWSError;
|
import org.jclouds.aws.domain.AWSError;
|
||||||
|
@ -31,7 +32,6 @@ import org.jclouds.aws.s3.util.S3Utils;
|
||||||
import org.jclouds.aws.s3.xml.S3ParserFactory;
|
import org.jclouds.aws.s3.xml.S3ParserFactory;
|
||||||
import org.jclouds.http.HttpCommand;
|
import org.jclouds.http.HttpCommand;
|
||||||
import org.jclouds.http.HttpException;
|
import org.jclouds.http.HttpException;
|
||||||
import org.jclouds.http.HttpMethod;
|
|
||||||
import org.jclouds.http.HttpResponse;
|
import org.jclouds.http.HttpResponse;
|
||||||
import org.jclouds.http.handlers.BackoffLimitedRetryHandler;
|
import org.jclouds.http.handlers.BackoffLimitedRetryHandler;
|
||||||
import org.jclouds.http.handlers.RedirectionRetryHandler;
|
import org.jclouds.http.handlers.RedirectionRetryHandler;
|
||||||
|
|
|
@ -27,10 +27,10 @@ import static org.testng.Assert.assertEquals;
|
||||||
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
|
|
||||||
|
import javax.ws.rs.HttpMethod;
|
||||||
import javax.ws.rs.core.HttpHeaders;
|
import javax.ws.rs.core.HttpHeaders;
|
||||||
|
|
||||||
import org.jclouds.aws.s3.reference.S3Constants;
|
import org.jclouds.aws.s3.reference.S3Constants;
|
||||||
import org.jclouds.http.HttpMethod;
|
|
||||||
import org.jclouds.http.HttpRequest;
|
import org.jclouds.http.HttpRequest;
|
||||||
import org.jclouds.util.DateService;
|
import org.jclouds.util.DateService;
|
||||||
import org.testng.annotations.BeforeClass;
|
import org.testng.annotations.BeforeClass;
|
||||||
|
|
|
@ -48,5 +48,5 @@ public interface HttpCommand extends EndpointCommand<URI, HttpRequest, HttpRespo
|
||||||
/**
|
/**
|
||||||
* to allow redirects to work on methods that were HEAD
|
* to allow redirects to work on methods that were HEAD
|
||||||
*/
|
*/
|
||||||
HttpRequest setMethod(HttpMethod method);
|
HttpRequest setMethod(String method);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,33 +0,0 @@
|
||||||
/**
|
|
||||||
*
|
|
||||||
* Copyright (C) 2009 Global Cloud Specialists, Inc. <info@globalcloudspecialists.com>
|
|
||||||
*
|
|
||||||
* ====================================================================
|
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one
|
|
||||||
* or more contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. The ASF licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
* ====================================================================
|
|
||||||
*/
|
|
||||||
package org.jclouds.http;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@code HttpMethod} is an enumeration of HTTP methods used in {@link TransformingHttpCommand}
|
|
||||||
*
|
|
||||||
* @author Adrian Cole
|
|
||||||
*/
|
|
||||||
public enum HttpMethod {
|
|
||||||
DELETE, GET, HEAD, POST, PUT
|
|
||||||
}
|
|
|
@ -43,7 +43,7 @@ public class HttpRequest extends HttpMessage implements Request<URI> {
|
||||||
|
|
||||||
private List<HttpRequestFilter> requestFilters = Lists.newArrayList();
|
private List<HttpRequestFilter> requestFilters = Lists.newArrayList();
|
||||||
|
|
||||||
private final HttpMethod method;
|
private final String method;
|
||||||
private final URI endpoint;
|
private final URI endpoint;
|
||||||
private Object entity;
|
private Object entity;
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ public class HttpRequest extends HttpMessage implements Request<URI> {
|
||||||
* @param method
|
* @param method
|
||||||
* If the request is HEAD, this may change to GET due to redirects
|
* If the request is HEAD, this may change to GET due to redirects
|
||||||
*/
|
*/
|
||||||
public HttpRequest(HttpMethod method, URI endPoint) {
|
public HttpRequest(String method, URI endPoint) {
|
||||||
this.method = checkNotNull(method, "method");
|
this.method = checkNotNull(method, "method");
|
||||||
this.endpoint = checkNotNull(endPoint, "endPoint");
|
this.endpoint = checkNotNull(endPoint, "endPoint");
|
||||||
}
|
}
|
||||||
|
@ -66,7 +66,7 @@ public class HttpRequest extends HttpMessage implements Request<URI> {
|
||||||
* @param method
|
* @param method
|
||||||
* If the request is HEAD, this may change to GET due to redirects
|
* If the request is HEAD, this may change to GET due to redirects
|
||||||
*/
|
*/
|
||||||
public HttpRequest(HttpMethod method, URI endPoint, Multimap<String, String> headers) {
|
public HttpRequest(String method, URI endPoint, Multimap<String, String> headers) {
|
||||||
this(method, endPoint);
|
this(method, endPoint);
|
||||||
setHeaders(checkNotNull(headers, "headers"));
|
setHeaders(checkNotNull(headers, "headers"));
|
||||||
}
|
}
|
||||||
|
@ -78,7 +78,7 @@ public class HttpRequest extends HttpMessage implements Request<URI> {
|
||||||
* @param method
|
* @param method
|
||||||
* If the request is HEAD, this may change to GET due to redirects
|
* If the request is HEAD, this may change to GET due to redirects
|
||||||
*/
|
*/
|
||||||
public HttpRequest(HttpMethod method, URI endPoint, Multimap<String, String> headers,
|
public HttpRequest(String method, URI endPoint, Multimap<String, String> headers,
|
||||||
@Nullable Object entity) {
|
@Nullable Object entity) {
|
||||||
this(method, endPoint);
|
this(method, endPoint);
|
||||||
setHeaders(checkNotNull(headers, "headers"));
|
setHeaders(checkNotNull(headers, "headers"));
|
||||||
|
@ -101,7 +101,11 @@ public class HttpRequest extends HttpMessage implements Request<URI> {
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public HttpMethod getMethod() {
|
/**
|
||||||
|
* We cannot return an enum, as per specification custom methods are allowed. Enums are not extensible.
|
||||||
|
* @see http://www.w3.org/Protocols/rfc2616/rfc2616-sec5.html#sec5.1.1
|
||||||
|
*/
|
||||||
|
public String getMethod() {
|
||||||
return method;
|
return method;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -122,7 +122,7 @@ public class TransformingHttpCommandImpl<T> implements TransformingHttpCommand<T
|
||||||
*
|
*
|
||||||
* @param method
|
* @param method
|
||||||
*/
|
*/
|
||||||
public HttpRequest setMethod(HttpMethod method) {
|
public HttpRequest setMethod(String method) {
|
||||||
request = new HttpRequest(method, request.getEndpoint(), request.getHeaders());
|
request = new HttpRequest(method, request.getEndpoint(), request.getHeaders());
|
||||||
return request;
|
return request;
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,6 @@ import javax.ws.rs.core.HttpHeaders;
|
||||||
import javax.ws.rs.core.UriBuilder;
|
import javax.ws.rs.core.UriBuilder;
|
||||||
|
|
||||||
import org.jboss.resteasy.util.IsHttpMethod;
|
import org.jboss.resteasy.util.IsHttpMethod;
|
||||||
import org.jclouds.http.HttpMethod;
|
|
||||||
import org.jclouds.http.HttpRequest;
|
import org.jclouds.http.HttpRequest;
|
||||||
import org.jclouds.http.HttpRequestFilter;
|
import org.jclouds.http.HttpRequestFilter;
|
||||||
import org.jclouds.http.HttpResponse;
|
import org.jclouds.http.HttpResponse;
|
||||||
|
@ -209,7 +208,7 @@ public class JaxrsAnnotationProcessor {
|
||||||
private HttpRequestOptionsBinder optionsBinder;
|
private HttpRequestOptionsBinder optionsBinder;
|
||||||
|
|
||||||
public HttpRequest createRequest(URI endpoint, Method method, Object[] args) {
|
public HttpRequest createRequest(URI endpoint, Method method, Object[] args) {
|
||||||
HttpMethod httpMethod = getHttpMethodOrConstantOrThrowException(method);
|
String httpMethod = getHttpMethodOrConstantOrThrowException(method);
|
||||||
|
|
||||||
UriBuilder builder = addHostPrefixIfPresent(endpoint, method, args);
|
UriBuilder builder = addHostPrefixIfPresent(endpoint, method, args);
|
||||||
builder.path(declaring);
|
builder.path(declaring);
|
||||||
|
@ -370,14 +369,14 @@ public class JaxrsAnnotationProcessor {
|
||||||
constants.put(key, value);
|
constants.put(key, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public HttpMethod getHttpMethodOrConstantOrThrowException(Method method) {
|
public String getHttpMethodOrConstantOrThrowException(Method method) {
|
||||||
Set<String> httpMethods = IsHttpMethod.getHttpMethods(method);
|
Set<String> httpMethods = IsHttpMethod.getHttpMethods(method);
|
||||||
if (httpMethods == null || httpMethods.size() != 1) {
|
if (httpMethods == null || httpMethods.size() != 1) {
|
||||||
throw new IllegalStateException(
|
throw new IllegalStateException(
|
||||||
"You must use at least one, but no more than one http method or pathparam annotation on: "
|
"You must use at least one, but no more than one http method or pathparam annotation on: "
|
||||||
+ method.toString());
|
+ method.toString());
|
||||||
}
|
}
|
||||||
return HttpMethod.valueOf(httpMethods.iterator().next());
|
return httpMethods.iterator().next();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addHostHeaderIfAnnotatedWithVirtualHost(Multimap<String, String> headers,
|
public void addHostHeaderIfAnnotatedWithVirtualHost(Multimap<String, String> headers,
|
||||||
|
@ -390,44 +389,42 @@ public class JaxrsAnnotationProcessor {
|
||||||
|
|
||||||
public HttpRequest buildEntityIfPostOrPutRequest(Method method, Object[] args,
|
public HttpRequest buildEntityIfPostOrPutRequest(Method method, Object[] args,
|
||||||
HttpRequest request) {
|
HttpRequest request) {
|
||||||
switch (request.getMethod()) {
|
OUTER: if (request.getMethod().toUpperCase().equals("POST")
|
||||||
case POST:
|
|| request.getMethod().toUpperCase().equals("PUT")) {
|
||||||
case PUT:
|
MapEntityBinder mapBinder = getMapEntityBinderOrNull(method, args);
|
||||||
MapEntityBinder mapBinder = getMapEntityBinderOrNull(method, args);
|
Map<String, String> mapParams = buildPostParams(method, args);
|
||||||
Map<String, String> mapParams = buildPostParams(method, args);
|
// MapEntityBinder is only useful if there are parameters. We guard here in case the
|
||||||
// MapEntityBinder is only useful if there are parameters. We guard here in case the
|
// MapEntityBinder is also an EntityBinder. If so, it can be used with or without
|
||||||
// MapEntityBinder is also an EntityBinder. If so, it can be used with or without
|
// parameters.
|
||||||
// parameters.
|
if (mapBinder != null) {
|
||||||
if (mapBinder != null) {
|
mapBinder.addEntityToRequest(mapParams, request);
|
||||||
mapBinder.addEntityToRequest(mapParams, request);
|
break OUTER;
|
||||||
break;
|
}
|
||||||
|
HttpRequestOptions options = findOptionsIn(method, args);
|
||||||
|
if (options != null) {
|
||||||
|
optionsBinder.addEntityToRequest(options, request);
|
||||||
|
}
|
||||||
|
if (request.getEntity() == null) {
|
||||||
|
|
||||||
|
Map<Integer, Set<Annotation>> indexToEntityAnnotation = getIndexToEntityAnnotation(method);
|
||||||
|
|
||||||
|
if (indexToEntityAnnotation.size() == 1) {
|
||||||
|
Entry<Integer, Set<Annotation>> entry = indexToEntityAnnotation.entrySet()
|
||||||
|
.iterator().next();
|
||||||
|
EntityParam entityAnnotation = (EntityParam) entry.getValue().iterator().next();
|
||||||
|
|
||||||
|
Object entity = args[entry.getKey()];
|
||||||
|
EntityBinder binder = injector.getInstance(entityAnnotation.value());
|
||||||
|
|
||||||
|
binder.addEntityToRequest(entity, request);
|
||||||
|
} else if (indexToEntityAnnotation.size() > 1) {
|
||||||
|
throw new IllegalStateException("cannot have multiple @Entity annotations on "
|
||||||
|
+ method);
|
||||||
|
} else {
|
||||||
|
request.getHeaders().replaceValues(HttpHeaders.CONTENT_LENGTH,
|
||||||
|
Lists.newArrayList("0"));
|
||||||
}
|
}
|
||||||
HttpRequestOptions options = findOptionsIn(method, args);
|
}
|
||||||
if (options != null) {
|
|
||||||
optionsBinder.addEntityToRequest(options, request);
|
|
||||||
}
|
|
||||||
if (request.getEntity() == null) {
|
|
||||||
|
|
||||||
Map<Integer, Set<Annotation>> indexToEntityAnnotation = getIndexToEntityAnnotation(method);
|
|
||||||
|
|
||||||
if (indexToEntityAnnotation.size() == 1) {
|
|
||||||
Entry<Integer, Set<Annotation>> entry = indexToEntityAnnotation.entrySet()
|
|
||||||
.iterator().next();
|
|
||||||
EntityParam entityAnnotation = (EntityParam) entry.getValue().iterator().next();
|
|
||||||
|
|
||||||
Object entity = args[entry.getKey()];
|
|
||||||
EntityBinder binder = injector.getInstance(entityAnnotation.value());
|
|
||||||
|
|
||||||
binder.addEntityToRequest(entity, request);
|
|
||||||
} else if (indexToEntityAnnotation.size() > 1) {
|
|
||||||
throw new IllegalStateException("cannot have multiple @Entity annotations on "
|
|
||||||
+ method);
|
|
||||||
} else {
|
|
||||||
request.getHeaders().replaceValues(HttpHeaders.CONTENT_LENGTH,
|
|
||||||
Lists.newArrayList("0"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
return request;
|
return request;
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,6 @@ import java.util.concurrent.ExecutorService;
|
||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
|
|
||||||
import org.jclouds.http.HttpCommand;
|
import org.jclouds.http.HttpCommand;
|
||||||
import org.jclouds.http.HttpMethod;
|
|
||||||
import org.jclouds.http.HttpRequest;
|
import org.jclouds.http.HttpRequest;
|
||||||
import org.jclouds.http.HttpResponse;
|
import org.jclouds.http.HttpResponse;
|
||||||
import org.jclouds.http.TransformingHttpCommandExecutorServiceImpl;
|
import org.jclouds.http.TransformingHttpCommandExecutorServiceImpl;
|
||||||
|
@ -137,7 +136,7 @@ public class BackoffLimitedRetryHandlerTest {
|
||||||
assertEquals(response.getContent().read(), -1);
|
assertEquals(response.getContent().read(), -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
private final HttpRequest request = new HttpRequest(HttpMethod.HEAD, END_POINT);
|
private final HttpRequest request = new HttpRequest("HEAD", END_POINT);
|
||||||
|
|
||||||
private HttpCommand createCommand() {
|
private HttpCommand createCommand() {
|
||||||
HttpCommand command = new TransformingHttpCommandImpl<String>(executorService, request,
|
HttpCommand command = new TransformingHttpCommandImpl<String>(executorService, request,
|
||||||
|
|
|
@ -27,6 +27,10 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
import static org.testng.Assert.assertEquals;
|
import static org.testng.Assert.assertEquals;
|
||||||
|
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
|
import java.lang.annotation.ElementType;
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
import java.lang.annotation.Target;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
|
@ -37,6 +41,7 @@ import java.util.concurrent.Future;
|
||||||
|
|
||||||
import javax.ws.rs.GET;
|
import javax.ws.rs.GET;
|
||||||
import javax.ws.rs.HeaderParam;
|
import javax.ws.rs.HeaderParam;
|
||||||
|
import javax.ws.rs.HttpMethod;
|
||||||
import javax.ws.rs.POST;
|
import javax.ws.rs.POST;
|
||||||
import javax.ws.rs.PUT;
|
import javax.ws.rs.PUT;
|
||||||
import javax.ws.rs.Path;
|
import javax.ws.rs.Path;
|
||||||
|
@ -45,7 +50,6 @@ import javax.ws.rs.PathParam;
|
||||||
import org.jclouds.concurrent.WithinThreadExecutorService;
|
import org.jclouds.concurrent.WithinThreadExecutorService;
|
||||||
import org.jclouds.concurrent.config.ExecutorServiceModule;
|
import org.jclouds.concurrent.config.ExecutorServiceModule;
|
||||||
import org.jclouds.http.HttpException;
|
import org.jclouds.http.HttpException;
|
||||||
import org.jclouds.http.HttpMethod;
|
|
||||||
import org.jclouds.http.HttpRequest;
|
import org.jclouds.http.HttpRequest;
|
||||||
import org.jclouds.http.HttpRequestFilter;
|
import org.jclouds.http.HttpRequestFilter;
|
||||||
import org.jclouds.http.HttpResponse;
|
import org.jclouds.http.HttpResponse;
|
||||||
|
@ -80,6 +84,28 @@ import com.google.inject.name.Names;
|
||||||
@Test(groups = "unit", testName = "jaxrs.JaxrsUtilTest")
|
@Test(groups = "unit", testName = "jaxrs.JaxrsUtilTest")
|
||||||
public class JaxrsAnnotationProcessorTest {
|
public class JaxrsAnnotationProcessorTest {
|
||||||
|
|
||||||
|
@Target( { ElementType.METHOD })
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
@javax.ws.rs.HttpMethod("FOO")
|
||||||
|
public @interface FOO {
|
||||||
|
}
|
||||||
|
|
||||||
|
public class TestCustomMethod {
|
||||||
|
@FOO
|
||||||
|
public void foo() {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testCustomMethod() throws SecurityException, NoSuchMethodException {
|
||||||
|
Method method = TestCustomMethod.class.getMethod("foo");
|
||||||
|
URI endpoint = URI.create("http://localhost");
|
||||||
|
HttpRequest httpMethod = factory.create(TestCustomMethod.class).createRequest(endpoint,
|
||||||
|
method, new Object[] {});
|
||||||
|
assertEquals(httpMethod.getEndpoint().getHost(), "localhost");
|
||||||
|
assertEquals(httpMethod.getEndpoint().getPath(), "");
|
||||||
|
assertEquals(httpMethod.getMethod(), "FOO");
|
||||||
|
}
|
||||||
|
|
||||||
public class TestPost {
|
public class TestPost {
|
||||||
@POST
|
@POST
|
||||||
public void post(@EntityParam String content) {
|
public void post(@EntityParam String content) {
|
||||||
|
|
|
@ -40,10 +40,10 @@ import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.ExecutorService;
|
import java.util.concurrent.ExecutorService;
|
||||||
|
|
||||||
|
import javax.ws.rs.HttpMethod;
|
||||||
import javax.ws.rs.core.HttpHeaders;
|
import javax.ws.rs.core.HttpHeaders;
|
||||||
|
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
import org.jclouds.http.HttpMethod;
|
|
||||||
import org.jclouds.http.HttpRequest;
|
import org.jclouds.http.HttpRequest;
|
||||||
import org.jclouds.http.HttpResponse;
|
import org.jclouds.http.HttpResponse;
|
||||||
import org.jclouds.http.handlers.DelegatingErrorHandler;
|
import org.jclouds.http.handlers.DelegatingErrorHandler;
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
*/
|
*/
|
||||||
package org.jclouds.rackspace.cloudservers.domain;
|
package org.jclouds.rackspace.cloudservers.domain;
|
||||||
|
|
||||||
import org.jclouds.http.HttpMethod;
|
import javax.ws.rs.HttpMethod;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
|
@ -27,9 +27,9 @@ import static org.jclouds.rackspace.cloudservers.options.CreateServerOptions.Bui
|
||||||
import static org.jclouds.rackspace.cloudservers.options.CreateServerOptions.Builder.withMetadata;
|
import static org.jclouds.rackspace.cloudservers.options.CreateServerOptions.Builder.withMetadata;
|
||||||
import static org.jclouds.rackspace.cloudservers.options.CreateServerOptions.Builder.withSharedIpGroup;
|
import static org.jclouds.rackspace.cloudservers.options.CreateServerOptions.Builder.withSharedIpGroup;
|
||||||
import static org.jclouds.rackspace.cloudservers.options.CreateSharedIpGroupOptions.Builder.withServer;
|
import static org.jclouds.rackspace.cloudservers.options.CreateSharedIpGroupOptions.Builder.withServer;
|
||||||
import static org.jclouds.rackspace.cloudservers.options.RebuildServerOptions.Builder.withImage;
|
|
||||||
import static org.jclouds.rackspace.cloudservers.options.ListOptions.Builder.changesSince;
|
import static org.jclouds.rackspace.cloudservers.options.ListOptions.Builder.changesSince;
|
||||||
import static org.jclouds.rackspace.cloudservers.options.ListOptions.Builder.withDetails;
|
import static org.jclouds.rackspace.cloudservers.options.ListOptions.Builder.withDetails;
|
||||||
|
import static org.jclouds.rackspace.cloudservers.options.RebuildServerOptions.Builder.withImage;
|
||||||
import static org.testng.Assert.assertEquals;
|
import static org.testng.Assert.assertEquals;
|
||||||
import static org.testng.Assert.assertNotNull;
|
import static org.testng.Assert.assertNotNull;
|
||||||
|
|
||||||
|
@ -39,12 +39,12 @@ import java.net.URI;
|
||||||
import java.net.UnknownHostException;
|
import java.net.UnknownHostException;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
|
||||||
|
import javax.ws.rs.HttpMethod;
|
||||||
import javax.ws.rs.core.HttpHeaders;
|
import javax.ws.rs.core.HttpHeaders;
|
||||||
import javax.ws.rs.core.MediaType;
|
import javax.ws.rs.core.MediaType;
|
||||||
|
|
||||||
import org.jclouds.concurrent.WithinThreadExecutorService;
|
import org.jclouds.concurrent.WithinThreadExecutorService;
|
||||||
import org.jclouds.concurrent.config.ExecutorServiceModule;
|
import org.jclouds.concurrent.config.ExecutorServiceModule;
|
||||||
import org.jclouds.http.HttpMethod;
|
|
||||||
import org.jclouds.http.HttpRequest;
|
import org.jclouds.http.HttpRequest;
|
||||||
import org.jclouds.http.config.JavaUrlHttpCommandExecutorServiceModule;
|
import org.jclouds.http.config.JavaUrlHttpCommandExecutorServiceModule;
|
||||||
import org.jclouds.http.functions.ReturnFalseOn404;
|
import org.jclouds.http.functions.ReturnFalseOn404;
|
||||||
|
|
|
@ -28,10 +28,10 @@ import static org.testng.Assert.assertEquals;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
|
|
||||||
import org.jclouds.http.HttpMethod;
|
import javax.ws.rs.HttpMethod;
|
||||||
|
|
||||||
import org.jclouds.http.HttpRequest;
|
import org.jclouds.http.HttpRequest;
|
||||||
import org.jclouds.http.functions.config.ParserModule;
|
import org.jclouds.http.functions.config.ParserModule;
|
||||||
import org.jclouds.rackspace.cloudservers.binders.ChangeAdminPassBinder;
|
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
|
|
|
@ -28,10 +28,10 @@ import static org.testng.Assert.assertEquals;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
|
|
||||||
import org.jclouds.http.HttpMethod;
|
import javax.ws.rs.HttpMethod;
|
||||||
|
|
||||||
import org.jclouds.http.HttpRequest;
|
import org.jclouds.http.HttpRequest;
|
||||||
import org.jclouds.http.functions.config.ParserModule;
|
import org.jclouds.http.functions.config.ParserModule;
|
||||||
import org.jclouds.rackspace.cloudservers.binders.ChangeServerNameBinder;
|
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
|
|
|
@ -28,10 +28,10 @@ import static org.testng.Assert.assertEquals;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
|
|
||||||
import org.jclouds.http.HttpMethod;
|
import javax.ws.rs.HttpMethod;
|
||||||
|
|
||||||
import org.jclouds.http.HttpRequest;
|
import org.jclouds.http.HttpRequest;
|
||||||
import org.jclouds.http.functions.config.ParserModule;
|
import org.jclouds.http.functions.config.ParserModule;
|
||||||
import org.jclouds.rackspace.cloudservers.binders.CreateImageBinder;
|
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
|
|
|
@ -28,10 +28,10 @@ import static org.testng.Assert.assertEquals;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
|
|
||||||
import org.jclouds.http.HttpMethod;
|
import javax.ws.rs.HttpMethod;
|
||||||
|
|
||||||
import org.jclouds.http.HttpRequest;
|
import org.jclouds.http.HttpRequest;
|
||||||
import org.jclouds.http.functions.config.ParserModule;
|
import org.jclouds.http.functions.config.ParserModule;
|
||||||
import org.jclouds.rackspace.cloudservers.binders.RebootTypeBinder;
|
|
||||||
import org.jclouds.rackspace.cloudservers.domain.RebootType;
|
import org.jclouds.rackspace.cloudservers.domain.RebootType;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
|
|
@ -23,13 +23,17 @@
|
||||||
*/
|
*/
|
||||||
package org.jclouds.rackspace.cloudservers.options;
|
package org.jclouds.rackspace.cloudservers.options;
|
||||||
|
|
||||||
|
import static org.jclouds.rackspace.cloudservers.options.CreateServerOptions.Builder.withFile;
|
||||||
|
import static org.jclouds.rackspace.cloudservers.options.CreateServerOptions.Builder.withSharedIp;
|
||||||
|
import static org.jclouds.rackspace.cloudservers.options.CreateServerOptions.Builder.withSharedIpGroup;
|
||||||
import static org.testng.Assert.assertEquals;
|
import static org.testng.Assert.assertEquals;
|
||||||
|
|
||||||
import java.net.InetAddress;
|
import java.net.InetAddress;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.net.UnknownHostException;
|
import java.net.UnknownHostException;
|
||||||
|
|
||||||
import org.jclouds.http.HttpMethod;
|
import javax.ws.rs.HttpMethod;
|
||||||
|
|
||||||
import org.jclouds.http.HttpRequest;
|
import org.jclouds.http.HttpRequest;
|
||||||
import org.jclouds.http.functions.config.ParserModule;
|
import org.jclouds.http.functions.config.ParserModule;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
@ -37,7 +41,6 @@ import org.testng.annotations.Test;
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
import com.google.inject.Guice;
|
import com.google.inject.Guice;
|
||||||
import com.google.inject.Injector;
|
import com.google.inject.Injector;
|
||||||
import static org.jclouds.rackspace.cloudservers.options.CreateServerOptions.Builder.*;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests behavior of {@code ParseFlavorFromGsonResponse}
|
* Tests behavior of {@code ParseFlavorFromGsonResponse}
|
||||||
|
|
|
@ -28,7 +28,8 @@ import static org.testng.Assert.assertEquals;
|
||||||
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
|
|
||||||
import org.jclouds.http.HttpMethod;
|
import javax.ws.rs.HttpMethod;
|
||||||
|
|
||||||
import org.jclouds.http.HttpRequest;
|
import org.jclouds.http.HttpRequest;
|
||||||
import org.jclouds.http.functions.config.ParserModule;
|
import org.jclouds.http.functions.config.ParserModule;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
|
@ -29,7 +29,8 @@ import static org.testng.Assert.assertEquals;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
import org.jclouds.http.HttpMethod;
|
import javax.ws.rs.HttpMethod;
|
||||||
|
|
||||||
import org.jclouds.http.HttpRequest;
|
import org.jclouds.http.HttpRequest;
|
||||||
import org.jclouds.http.functions.config.ParserModule;
|
import org.jclouds.http.functions.config.ParserModule;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
|
@ -29,9 +29,10 @@ import java.lang.reflect.Method;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
|
||||||
|
import javax.ws.rs.HttpMethod;
|
||||||
|
|
||||||
import org.jclouds.concurrent.WithinThreadExecutorService;
|
import org.jclouds.concurrent.WithinThreadExecutorService;
|
||||||
import org.jclouds.concurrent.config.ExecutorServiceModule;
|
import org.jclouds.concurrent.config.ExecutorServiceModule;
|
||||||
import org.jclouds.http.HttpMethod;
|
|
||||||
import org.jclouds.http.HttpRequest;
|
import org.jclouds.http.HttpRequest;
|
||||||
import org.jclouds.http.config.JavaUrlHttpCommandExecutorServiceModule;
|
import org.jclouds.http.config.JavaUrlHttpCommandExecutorServiceModule;
|
||||||
import org.jclouds.rackspace.functions.ParseAuthenticationResponseFromHeaders;
|
import org.jclouds.rackspace.functions.ParseAuthenticationResponseFromHeaders;
|
||||||
|
|
Loading…
Reference in New Issue