removed custom code that duplicates functionality of guava fallbacks

This commit is contained in:
Adrian Cole 2012-12-27 16:54:31 -08:00
parent 0880245150
commit 9b1872c6ff
369 changed files with 3744 additions and 4862 deletions

View File

@ -31,35 +31,34 @@ import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import org.jclouds.Fallbacks.FalseOnNotFoundOr404;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.Fallbacks.VoidOnNotFoundOr404;
import org.jclouds.atmos.binders.BindMetadataToHeaders;
import org.jclouds.atmos.domain.AtmosObject;
import org.jclouds.atmos.domain.BoundedSet;
import org.jclouds.atmos.domain.DirectoryEntry;
import org.jclouds.atmos.domain.SystemMetadata;
import org.jclouds.atmos.domain.UserMetadata;
import org.jclouds.atmos.fallbacks.EndpointIfAlreadyExists;
import org.jclouds.atmos.filters.SignRequest;
import org.jclouds.atmos.functions.AtmosObjectName;
import org.jclouds.atmos.functions.ParseDirectoryListFromContentAndHeaders;
import org.jclouds.atmos.functions.ParseObjectFromHeadersAndHttpContent;
import org.jclouds.atmos.functions.ParseSystemMetadataFromHeaders;
import org.jclouds.atmos.functions.ParseUserMetadataFromHeaders;
import org.jclouds.atmos.functions.ReturnEndpointIfAlreadyExists;
import org.jclouds.atmos.functions.ReturnTrueIfGroupACLIsOtherRead;
import org.jclouds.atmos.options.ListOptions;
import org.jclouds.atmos.options.PutOptions;
import org.jclouds.blobstore.functions.ThrowContainerNotFoundOn404;
import org.jclouds.blobstore.functions.ThrowKeyNotFoundOn404;
import org.jclouds.blobstore.BlobStoreFallbacks.ThrowContainerNotFoundOn404;
import org.jclouds.blobstore.BlobStoreFallbacks.ThrowKeyNotFoundOn404;
import org.jclouds.http.options.GetOptions;
import org.jclouds.rest.annotations.BinderParam;
import org.jclouds.rest.annotations.ExceptionParser;
import org.jclouds.rest.annotations.Fallback;
import org.jclouds.rest.annotations.ParamParser;
import org.jclouds.rest.annotations.QueryParams;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.ResponseParser;
import org.jclouds.rest.functions.ReturnFalseOnNotFoundOr404;
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
import org.jclouds.rest.functions.ReturnVoidOnNotFoundOr404;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.inject.Provides;
@ -95,7 +94,7 @@ public interface AtmosAsyncClient {
@GET
@Path("/{directoryName}/")
@ResponseParser(ParseDirectoryListFromContentAndHeaders.class)
@ExceptionParser(ThrowContainerNotFoundOn404.class)
@Fallback(ThrowContainerNotFoundOn404.class)
@Consumes(MediaType.TEXT_XML)
ListenableFuture<BoundedSet<? extends DirectoryEntry>> listDirectory(
@PathParam("directoryName") String directoryName, ListOptions... options);
@ -105,7 +104,7 @@ public interface AtmosAsyncClient {
*/
@POST
@Path("/{directoryName}/")
@ExceptionParser(ReturnEndpointIfAlreadyExists.class)
@Fallback(EndpointIfAlreadyExists.class)
@Produces(MediaType.APPLICATION_OCTET_STREAM)
@Consumes(MediaType.WILDCARD)
ListenableFuture<URI> createDirectory(@PathParam("directoryName") String directoryName, PutOptions... options);
@ -126,7 +125,7 @@ public interface AtmosAsyncClient {
*/
@PUT
@Path("/{parent}/{name}")
@ExceptionParser(ThrowKeyNotFoundOn404.class)
@Fallback(ThrowKeyNotFoundOn404.class)
@Consumes(MediaType.WILDCARD)
ListenableFuture<Void> updateFile(
@PathParam("parent") String parent,
@ -138,7 +137,7 @@ public interface AtmosAsyncClient {
*/
@GET
@ResponseParser(ParseObjectFromHeadersAndHttpContent.class)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
@Fallback(NullOnNotFoundOr404.class)
@Path("/{path}")
@Consumes(MediaType.WILDCARD)
ListenableFuture<AtmosObject> readFile(@PathParam("path") String path, GetOptions... options);
@ -148,7 +147,7 @@ public interface AtmosAsyncClient {
*/
@HEAD
@ResponseParser(ParseObjectFromHeadersAndHttpContent.class)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
@Fallback(NullOnNotFoundOr404.class)
@Path("/{path}")
@Consumes(MediaType.WILDCARD)
ListenableFuture<AtmosObject> headFile(@PathParam("path") String path);
@ -158,7 +157,7 @@ public interface AtmosAsyncClient {
*/
@HEAD
@ResponseParser(ParseSystemMetadataFromHeaders.class)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
@Fallback(NullOnNotFoundOr404.class)
// currently throws 403 errors @QueryParams(keys = "metadata/system")
@Path("/{path}")
@Consumes(MediaType.WILDCARD)
@ -169,7 +168,7 @@ public interface AtmosAsyncClient {
*/
@HEAD
@ResponseParser(ParseUserMetadataFromHeaders.class)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
@Fallback(NullOnNotFoundOr404.class)
@Path("/{path}")
@QueryParams(keys = "metadata/user")
@Consumes(MediaType.WILDCARD)
@ -179,7 +178,7 @@ public interface AtmosAsyncClient {
* @see AtmosClient#deletePath
*/
@DELETE
@ExceptionParser(ReturnVoidOnNotFoundOr404.class)
@Fallback(VoidOnNotFoundOr404.class)
@Path("/{path}")
@Consumes(MediaType.WILDCARD)
ListenableFuture<Void> deletePath(@PathParam("path") String path);
@ -188,7 +187,7 @@ public interface AtmosAsyncClient {
* @see AtmosClient#pathExists
*/
@HEAD
@ExceptionParser(ReturnFalseOnNotFoundOr404.class)
@Fallback(FalseOnNotFoundOr404.class)
@Path("/{path}")
@Consumes(MediaType.WILDCARD)
ListenableFuture<Boolean> pathExists(@PathParam("path") String path);
@ -200,7 +199,7 @@ public interface AtmosAsyncClient {
@ResponseParser(ReturnTrueIfGroupACLIsOtherRead.class)
@Path("/{path}")
@Consumes(MediaType.WILDCARD)
@ExceptionParser(ReturnFalseOnNotFoundOr404.class)
@Fallback(FalseOnNotFoundOr404.class)
ListenableFuture<Boolean> isPublic(@PathParam("path") String path);
}

View File

@ -16,9 +16,11 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.atmos.functions;
package org.jclouds.atmos.fallbacks;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Throwables.propagate;
import static com.google.common.util.concurrent.Futures.immediateFuture;
import java.net.URI;
@ -28,32 +30,32 @@ import org.jclouds.javax.annotation.Nullable;
import org.jclouds.rest.InvocationContext;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Function;
import com.google.common.base.Throwables;
import com.google.common.util.concurrent.FutureFallback;
import com.google.common.util.concurrent.ListenableFuture;
/**
*
* @author Adrian Cole
*/
public class ReturnEndpointIfAlreadyExists implements Function<Exception, URI>,
InvocationContext<ReturnEndpointIfAlreadyExists> {
public class EndpointIfAlreadyExists implements FutureFallback<URI>, InvocationContext<EndpointIfAlreadyExists> {
private URI endpoint;
public URI apply(Exception from) {
if (checkNotNull(from, "exception") instanceof KeyAlreadyExistsException) {
return endpoint;
@Override
public ListenableFuture<URI> create(Throwable t) {
if (checkNotNull(t, "throwable") instanceof KeyAlreadyExistsException) {
return immediateFuture(endpoint);
}
throw Throwables.propagate(from);
throw propagate(t);
}
@Override
public ReturnEndpointIfAlreadyExists setContext(HttpRequest request) {
public EndpointIfAlreadyExists setContext(HttpRequest request) {
return setEndpoint(request == null ? null : request.getEndpoint());
}
@VisibleForTesting
ReturnEndpointIfAlreadyExists setEndpoint(@Nullable URI endpoint) {
EndpointIfAlreadyExists setEndpoint(@Nullable URI endpoint) {
this.endpoint = endpoint;
return this;
}

View File

@ -25,30 +25,30 @@ import java.lang.reflect.Method;
import javax.ws.rs.core.HttpHeaders;
import org.jclouds.Fallbacks.FalseOnNotFoundOr404;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.Fallbacks.VoidOnNotFoundOr404;
import org.jclouds.apis.ApiMetadata;
import org.jclouds.atmos.blobstore.functions.BlobToObject;
import org.jclouds.atmos.config.AtmosRestClientModule;
import org.jclouds.atmos.domain.AtmosObject;
import org.jclouds.atmos.fallbacks.EndpointIfAlreadyExists;
import org.jclouds.atmos.filters.SignRequest;
import org.jclouds.atmos.functions.ParseDirectoryListFromContentAndHeaders;
import org.jclouds.atmos.functions.ParseObjectFromHeadersAndHttpContent;
import org.jclouds.atmos.functions.ParseSystemMetadataFromHeaders;
import org.jclouds.atmos.functions.ReturnEndpointIfAlreadyExists;
import org.jclouds.atmos.functions.ReturnTrueIfGroupACLIsOtherRead;
import org.jclouds.atmos.options.ListOptions;
import org.jclouds.atmos.options.PutOptions;
import org.jclouds.blobstore.BlobStoreFallbacks.ThrowContainerNotFoundOn404;
import org.jclouds.blobstore.BlobStoreFallbacks.ThrowKeyNotFoundOn404;
import org.jclouds.blobstore.binders.BindBlobToMultipartFormTest;
import org.jclouds.blobstore.functions.ThrowContainerNotFoundOn404;
import org.jclouds.blobstore.functions.ThrowKeyNotFoundOn404;
import org.jclouds.date.TimeStamp;
import org.jclouds.http.HttpRequest;
import org.jclouds.http.functions.ParseURIFromListOrLocationHeaderIf20x;
import org.jclouds.http.functions.ReleasePayloadAndReturn;
import org.jclouds.http.options.GetOptions;
import org.jclouds.rest.ConfiguresRestClient;
import org.jclouds.rest.functions.ReturnFalseOnNotFoundOr404;
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
import org.jclouds.rest.functions.ReturnVoidOnNotFoundOr404;
import org.jclouds.rest.internal.BaseAsyncClientTest;
import org.jclouds.rest.internal.RestAnnotationProcessor;
import org.testng.annotations.BeforeClass;
@ -79,7 +79,7 @@ public class AtmosAsyncClientTest extends BaseAsyncClientTest<AtmosAsyncClient>
assertResponseParserClassEquals(method, request, ParseDirectoryListFromContentAndHeaders.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, null);
assertFallbackClassEquals(method, null);
checkFilters(request);
}
@ -94,7 +94,7 @@ public class AtmosAsyncClientTest extends BaseAsyncClientTest<AtmosAsyncClient>
assertResponseParserClassEquals(method, request, ParseDirectoryListFromContentAndHeaders.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ThrowContainerNotFoundOn404.class);
assertFallbackClassEquals(method, ThrowContainerNotFoundOn404.class);
checkFilters(request);
}
@ -109,7 +109,7 @@ public class AtmosAsyncClientTest extends BaseAsyncClientTest<AtmosAsyncClient>
assertResponseParserClassEquals(method, request, ParseDirectoryListFromContentAndHeaders.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, null);
assertFallbackClassEquals(method, null);
checkFilters(request);
}
@ -124,7 +124,7 @@ public class AtmosAsyncClientTest extends BaseAsyncClientTest<AtmosAsyncClient>
assertResponseParserClassEquals(method, request, ParseDirectoryListFromContentAndHeaders.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ThrowContainerNotFoundOn404.class);
assertFallbackClassEquals(method, ThrowContainerNotFoundOn404.class);
checkFilters(request);
}
@ -139,7 +139,7 @@ public class AtmosAsyncClientTest extends BaseAsyncClientTest<AtmosAsyncClient>
assertResponseParserClassEquals(method, request, ParseURIFromListOrLocationHeaderIf20x.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnEndpointIfAlreadyExists.class);
assertFallbackClassEquals(method, EndpointIfAlreadyExists.class);
checkFilters(request);
}
@ -155,7 +155,7 @@ public class AtmosAsyncClientTest extends BaseAsyncClientTest<AtmosAsyncClient>
assertResponseParserClassEquals(method, request, ParseURIFromListOrLocationHeaderIf20x.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnEndpointIfAlreadyExists.class);
assertFallbackClassEquals(method, EndpointIfAlreadyExists.class);
checkFilters(request);
}
@ -172,7 +172,7 @@ public class AtmosAsyncClientTest extends BaseAsyncClientTest<AtmosAsyncClient>
assertResponseParserClassEquals(method, request, ParseURIFromListOrLocationHeaderIf20x.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, null);
assertFallbackClassEquals(method, null);
checkFilters(request);
}
@ -190,7 +190,7 @@ public class AtmosAsyncClientTest extends BaseAsyncClientTest<AtmosAsyncClient>
assertResponseParserClassEquals(method, request, ParseURIFromListOrLocationHeaderIf20x.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, null);
assertFallbackClassEquals(method, null);
checkFilters(request);
}
@ -207,7 +207,7 @@ public class AtmosAsyncClientTest extends BaseAsyncClientTest<AtmosAsyncClient>
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ThrowKeyNotFoundOn404.class);
assertFallbackClassEquals(method, ThrowKeyNotFoundOn404.class);
checkFilters(request);
}
@ -225,7 +225,7 @@ public class AtmosAsyncClientTest extends BaseAsyncClientTest<AtmosAsyncClient>
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ThrowKeyNotFoundOn404.class);
assertFallbackClassEquals(method, ThrowKeyNotFoundOn404.class);
checkFilters(request);
}
@ -240,7 +240,7 @@ public class AtmosAsyncClientTest extends BaseAsyncClientTest<AtmosAsyncClient>
assertResponseParserClassEquals(method, request, ParseObjectFromHeadersAndHttpContent.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
checkFilters(request);
}
@ -255,7 +255,7 @@ public class AtmosAsyncClientTest extends BaseAsyncClientTest<AtmosAsyncClient>
assertResponseParserClassEquals(method, request, ParseSystemMetadataFromHeaders.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
checkFilters(request);
}
@ -270,7 +270,7 @@ public class AtmosAsyncClientTest extends BaseAsyncClientTest<AtmosAsyncClient>
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnVoidOnNotFoundOr404.class);
assertFallbackClassEquals(method, VoidOnNotFoundOr404.class);
checkFilters(request);
}
@ -285,7 +285,7 @@ public class AtmosAsyncClientTest extends BaseAsyncClientTest<AtmosAsyncClient>
assertResponseParserClassEquals(method, request, ReturnTrueIfGroupACLIsOtherRead.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnFalseOnNotFoundOr404.class);
assertFallbackClassEquals(method, FalseOnNotFoundOr404.class);
checkFilters(request);
}

View File

@ -16,9 +16,11 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.atmos.functions;
package org.jclouds.atmos.fallbacks;
import static com.google.common.util.concurrent.Futures.getUnchecked;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNull;
import java.net.URI;
@ -30,27 +32,27 @@ import org.testng.annotations.Test;
* @author Adrian Cole
*/
@Test(groups = "unit")
public class ReturnEndpointIfAlreadyExistsTest {
public class EndpointIfAlreadyExistsTest {
@Test
public void testFoundIsNullWhenEndpointNotSet() {
assertEquals(new ReturnEndpointIfAlreadyExists().apply(new KeyAlreadyExistsException()), null);
assertNull(getUnchecked(new EndpointIfAlreadyExists().create(new KeyAlreadyExistsException())));
}
@Test
public void testFoundIsEndpointWhenSet() {
assertEquals(
new ReturnEndpointIfAlreadyExists().setEndpoint(URI.create("foo")).apply(new KeyAlreadyExistsException()),
URI.create("foo"));
getUnchecked(new EndpointIfAlreadyExists().setEndpoint(URI.create("foo")).create(
new KeyAlreadyExistsException())), URI.create("foo"));
}
@Test(expectedExceptions = RuntimeException.class)
public void testNotFoundPropagates() {
new ReturnEndpointIfAlreadyExists().apply(new RuntimeException());
new EndpointIfAlreadyExists().create(new RuntimeException());
}
@Test(expectedExceptions = NullPointerException.class)
public void testNullIsBad() {
new ReturnEndpointIfAlreadyExists().apply(null);
new EndpointIfAlreadyExists().create(null);
}
}

View File

@ -20,6 +20,7 @@ package org.jclouds.cloudfiles;
import java.net.URI;
import java.util.Set;
import java.util.concurrent.ExecutionException;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
@ -32,7 +33,7 @@ import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.core.MediaType;
import org.jclouds.blobstore.functions.ReturnNullOnContainerNotFound;
import org.jclouds.blobstore.BlobStoreFallbacks.NullOnContainerNotFound;
import org.jclouds.cloudfiles.binders.BindIterableToHeadersWithPurgeCDNObjectEmail;
import org.jclouds.cloudfiles.domain.ContainerCDNMetadata;
import org.jclouds.cloudfiles.functions.ParseCdnUriFromHeaders;
@ -44,7 +45,7 @@ import org.jclouds.openstack.swift.CommonSwiftAsyncClient;
import org.jclouds.openstack.swift.Storage;
import org.jclouds.rest.annotations.BinderParam;
import org.jclouds.rest.annotations.Endpoint;
import org.jclouds.rest.annotations.ExceptionParser;
import org.jclouds.rest.annotations.Fallback;
import org.jclouds.rest.annotations.Headers;
import org.jclouds.rest.annotations.QueryParams;
import org.jclouds.rest.annotations.RequestFilters;
@ -82,7 +83,7 @@ public interface CloudFilesAsyncClient extends CommonSwiftAsyncClient {
*/
@HEAD
@ResponseParser(ParseContainerCDNMetadataFromHeaders.class)
@ExceptionParser(ReturnNullOnContainerNotFound.class)
@Fallback(NullOnContainerNotFound.class)
@Path("/{container}")
@Endpoint(CDNManagement.class)
ListenableFuture<ContainerCDNMetadata> getCDNMetadata(@PathParam("container") String container);
@ -161,7 +162,7 @@ public interface CloudFilesAsyncClient extends CommonSwiftAsyncClient {
ListenableFuture<Boolean> disableCDN(@PathParam("container") String container);
/**
* @see CloudFilesClient#purgeCDNObject(String, String, List)
* @see CloudFilesClient#purgeCDNObject(String, String, Iterable)
*/
@DELETE
@Path("/{container}/{object}")

View File

@ -19,6 +19,7 @@
package org.jclouds.cloudservers;
import java.util.Set;
import java.util.concurrent.ExecutionException;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
@ -30,6 +31,10 @@ import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
import org.jclouds.Fallbacks.FalseOnNotFoundOr404;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.Fallbacks.VoidOnNotFoundOr404;
import org.jclouds.cloudservers.binders.BindBackupScheduleToJsonPayload;
import org.jclouds.cloudservers.domain.Addresses;
import org.jclouds.cloudservers.domain.BackupSchedule;
@ -43,23 +48,18 @@ import org.jclouds.cloudservers.options.CreateServerOptions;
import org.jclouds.cloudservers.options.CreateSharedIpGroupOptions;
import org.jclouds.cloudservers.options.ListOptions;
import org.jclouds.cloudservers.options.RebuildServerOptions;
import org.jclouds.http.functions.ReturnFalseOn404;
import org.jclouds.openstack.filters.AddTimestampQuery;
import org.jclouds.openstack.filters.AuthenticateRequest;
import org.jclouds.openstack.services.Compute;
import org.jclouds.rest.annotations.BinderParam;
import org.jclouds.rest.annotations.Endpoint;
import org.jclouds.rest.annotations.ExceptionParser;
import org.jclouds.rest.annotations.Fallback;
import org.jclouds.rest.annotations.MapBinder;
import org.jclouds.rest.annotations.Payload;
import org.jclouds.rest.annotations.PayloadParam;
import org.jclouds.rest.annotations.QueryParams;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.Unwrap;
import org.jclouds.rest.functions.ReturnEmptySetOnNotFoundOr404;
import org.jclouds.rest.functions.ReturnFalseOnNotFoundOr404;
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
import org.jclouds.rest.functions.ReturnVoidOnNotFoundOr404;
import com.google.common.util.concurrent.ListenableFuture;
@ -86,7 +86,7 @@ public interface CloudServersAsyncClient {
@Consumes(MediaType.APPLICATION_JSON)
@QueryParams(keys = "format", values = "json")
@Path("/limits")
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
@Fallback(EmptySetOnNotFoundOr404.class)
ListenableFuture<Limits> getLimits();
/**
@ -97,7 +97,7 @@ public interface CloudServersAsyncClient {
@Consumes(MediaType.APPLICATION_JSON)
@QueryParams(keys = "format", values = "json")
@Path("/servers")
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
@Fallback(EmptySetOnNotFoundOr404.class)
ListenableFuture<? extends Set<Server>> listServers(ListOptions... options);
/**
@ -107,7 +107,7 @@ public interface CloudServersAsyncClient {
@Unwrap
@Consumes(MediaType.APPLICATION_JSON)
@QueryParams(keys = "format", values = "json")
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
@Fallback(NullOnNotFoundOr404.class)
@Path("/servers/{id}")
ListenableFuture<Server> getServer(@PathParam("id") int id);
@ -115,7 +115,7 @@ public interface CloudServersAsyncClient {
* @see CloudServersClient#deleteServer
*/
@DELETE
@ExceptionParser(ReturnFalseOnNotFoundOr404.class)
@Fallback(FalseOnNotFoundOr404.class)
@Path("/servers/{id}")
ListenableFuture<Boolean> deleteServer(@PathParam("id") int id);
@ -196,7 +196,7 @@ public interface CloudServersAsyncClient {
*/
@DELETE
@Path("/servers/{id}/ips/public/{address}")
@ExceptionParser(ReturnVoidOnNotFoundOr404.class)
@Fallback(VoidOnNotFoundOr404.class)
ListenableFuture<Void> unshareIp(@PathParam("address") String addressToShare,
@PathParam("id") int serverToTosignBindressTo);
@ -226,7 +226,7 @@ public interface CloudServersAsyncClient {
@Consumes(MediaType.APPLICATION_JSON)
@QueryParams(keys = "format", values = "json")
@Path("/flavors")
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
@Fallback(EmptySetOnNotFoundOr404.class)
ListenableFuture<? extends Set<Flavor>> listFlavors(ListOptions... options);
/**
@ -237,7 +237,7 @@ public interface CloudServersAsyncClient {
@Consumes(MediaType.APPLICATION_JSON)
@QueryParams(keys = "format", values = "json")
@Path("/flavors/{id}")
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
@Fallback(NullOnNotFoundOr404.class)
ListenableFuture<Flavor> getFlavor(@PathParam("id") int id);
/**
@ -248,7 +248,7 @@ public interface CloudServersAsyncClient {
@Consumes(MediaType.APPLICATION_JSON)
@QueryParams(keys = "format", values = "json")
@Path("/images")
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
@Fallback(EmptySetOnNotFoundOr404.class)
ListenableFuture<? extends Set<Image>> listImages(ListOptions... options);
/**
@ -257,7 +257,7 @@ public interface CloudServersAsyncClient {
@GET
@Unwrap
@Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
@Fallback(NullOnNotFoundOr404.class)
@QueryParams(keys = "format", values = "json")
@Path("/images/{id}")
ListenableFuture<Image> getImage(@PathParam("id") int id);
@ -266,7 +266,7 @@ public interface CloudServersAsyncClient {
* @see CloudServersClient#deleteImage
*/
@DELETE
@ExceptionParser(ReturnFalseOnNotFoundOr404.class)
@Fallback(FalseOnNotFoundOr404.class)
@Path("/images/{id}")
ListenableFuture<Boolean> deleteImage(@PathParam("id") int id);
@ -291,7 +291,7 @@ public interface CloudServersAsyncClient {
@Consumes(MediaType.APPLICATION_JSON)
@QueryParams(keys = "format", values = "json")
@Path("/shared_ip_groups")
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
@Fallback(EmptySetOnNotFoundOr404.class)
ListenableFuture<? extends Set<SharedIpGroup>> listSharedIpGroups(ListOptions... options);
/**
@ -302,7 +302,7 @@ public interface CloudServersAsyncClient {
@Consumes(MediaType.APPLICATION_JSON)
@QueryParams(keys = "format", values = "json")
@Path("/shared_ip_groups/{id}")
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
@Fallback(NullOnNotFoundOr404.class)
ListenableFuture<SharedIpGroup> getSharedIpGroup(@PathParam("id") int id);
/**
@ -321,7 +321,7 @@ public interface CloudServersAsyncClient {
* @see CloudServersClient#deleteSharedIpGroup
*/
@DELETE
@ExceptionParser(ReturnFalseOnNotFoundOr404.class)
@Fallback(FalseOnNotFoundOr404.class)
@Path("/shared_ip_groups/{id}")
ListenableFuture<Boolean> deleteSharedIpGroup(@PathParam("id") int id);
@ -339,7 +339,7 @@ public interface CloudServersAsyncClient {
* @see CloudServersClient#deleteBackupSchedule
*/
@DELETE
@ExceptionParser(ReturnFalseOnNotFoundOr404.class)
@Fallback(FalseOnNotFoundOr404.class)
@Path("/servers/{id}/backup_schedule")
ListenableFuture<Boolean> deleteBackupSchedule(@PathParam("id") int serverId);
@ -347,7 +347,6 @@ public interface CloudServersAsyncClient {
* @see CloudServersClient#replaceBackupSchedule
*/
@POST
@ExceptionParser(ReturnFalseOn404.class)
@Path("/servers/{id}/backup_schedule")
ListenableFuture<Void> replaceBackupSchedule(@PathParam("id") int id,
@BinderParam(BindBackupScheduleToJsonPayload.class) BackupSchedule backupSchedule);
@ -370,7 +369,7 @@ public interface CloudServersAsyncClient {
@Consumes(MediaType.APPLICATION_JSON)
@QueryParams(keys = "format", values = "json")
@Path("/servers/{id}/ips/public")
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
@Fallback(EmptySetOnNotFoundOr404.class)
ListenableFuture<? extends Set<String>> listPublicAddresses(@PathParam("id") int serverId);
/**
@ -381,7 +380,7 @@ public interface CloudServersAsyncClient {
@Consumes(MediaType.APPLICATION_JSON)
@QueryParams(keys = "format", values = "json")
@Path("/servers/{id}/ips/private")
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
@Fallback(EmptySetOnNotFoundOr404.class)
ListenableFuture<? extends Set<String>> listPrivateAddresses(@PathParam("id") int serverId);
}

View File

@ -38,6 +38,10 @@ import java.util.Properties;
import javax.inject.Singleton;
import javax.ws.rs.core.MediaType;
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
import org.jclouds.Fallbacks.FalseOnNotFoundOr404;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.Fallbacks.VoidOnNotFoundOr404;
import org.jclouds.apis.ApiMetadata;
import org.jclouds.cloudservers.config.CloudServersRestClientModule;
import org.jclouds.cloudservers.domain.BackupSchedule;
@ -49,9 +53,9 @@ import org.jclouds.cloudservers.options.CreateSharedIpGroupOptions;
import org.jclouds.cloudservers.options.ListOptions;
import org.jclouds.cloudservers.options.RebuildServerOptions;
import org.jclouds.domain.Credentials;
import org.jclouds.fallbacks.MapHttp4xxCodesToExceptions;
import org.jclouds.http.HttpRequest;
import org.jclouds.http.functions.ReleasePayloadAndReturn;
import org.jclouds.http.functions.ReturnFalseOn404;
import org.jclouds.http.functions.ReturnTrueIf2xx;
import org.jclouds.http.functions.UnwrapOnlyJsonValue;
import org.jclouds.openstack.filters.AddTimestampQuery;
@ -60,11 +64,6 @@ import org.jclouds.openstack.keystone.v1_1.config.AuthenticationServiceModule.Ge
import org.jclouds.openstack.keystone.v1_1.domain.Auth;
import org.jclouds.openstack.keystone.v1_1.parse.ParseAuthTest;
import org.jclouds.rest.ConfiguresRestClient;
import org.jclouds.rest.functions.MapHttp4xxCodesToExceptions;
import org.jclouds.rest.functions.ReturnEmptySetOnNotFoundOr404;
import org.jclouds.rest.functions.ReturnFalseOnNotFoundOr404;
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
import org.jclouds.rest.functions.ReturnVoidOnNotFoundOr404;
import org.jclouds.rest.internal.BaseAsyncClientTest;
import org.jclouds.rest.internal.RestAnnotationProcessor;
import org.testng.annotations.Test;
@ -99,7 +98,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, null);
assertFallbackClassEquals(method, null);
checkFilters(request);
@ -118,7 +117,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, null);
assertFallbackClassEquals(method, null);
checkFilters(request);
}
@ -138,7 +137,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, null);
assertFallbackClassEquals(method, null);
checkFilters(request);
@ -158,7 +157,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, null);
assertFallbackClassEquals(method, null);
checkFilters(request);
@ -180,7 +179,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, null);
assertFallbackClassEquals(method, null);
checkFilters(request);
}
@ -195,7 +194,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
assertResponseParserClassEquals(method, request, ReturnTrueIf2xx.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnFalseOnNotFoundOr404.class);
assertFallbackClassEquals(method, FalseOnNotFoundOr404.class);
checkFilters(request);
}
@ -210,7 +209,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class);
assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
checkFilters(request);
}
@ -225,7 +224,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class);
assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
checkFilters(request);
}
@ -243,7 +242,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class);
assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
checkFilters(request);
}
@ -258,7 +257,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class);
assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
checkFilters(request);
}
@ -273,7 +272,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
checkFilters(request);
}
@ -288,7 +287,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class);
assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
checkFilters(request);
}
@ -304,7 +303,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class);
assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
checkFilters(request);
}
@ -319,7 +318,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class);
assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
checkFilters(request);
}
@ -335,7 +334,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class);
assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
checkFilters(request);
}
@ -350,7 +349,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
checkFilters(request);
}
@ -365,7 +364,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class);
assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
checkFilters(request);
}
@ -380,7 +379,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class);
assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
checkFilters(request);
}
@ -396,7 +395,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class);
assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
checkFilters(request);
}
@ -412,7 +411,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class);
assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
checkFilters(request);
}
@ -427,7 +426,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
checkFilters(request);
}
@ -442,7 +441,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
assertResponseParserClassEquals(method, request, ReturnTrueIf2xx.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnFalseOnNotFoundOr404.class);
assertFallbackClassEquals(method, FalseOnNotFoundOr404.class);
checkFilters(request);
}
@ -459,7 +458,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, null);
assertFallbackClassEquals(method, null);
checkFilters(request);
@ -477,7 +476,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, null);
assertFallbackClassEquals(method, null);
checkFilters(request);
@ -494,7 +493,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnVoidOnNotFoundOr404.class);
assertFallbackClassEquals(method, VoidOnNotFoundOr404.class);
checkFilters(request);
@ -513,7 +512,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnFalseOn404.class);
assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
checkFilters(request);
@ -529,7 +528,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
assertResponseParserClassEquals(method, request, ReturnTrueIf2xx.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnFalseOnNotFoundOr404.class);
assertFallbackClassEquals(method, FalseOnNotFoundOr404.class);
checkFilters(request);
@ -545,7 +544,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, null);
assertFallbackClassEquals(method, null);
checkFilters(request);
@ -561,7 +560,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, null);
assertFallbackClassEquals(method, null);
checkFilters(request);
@ -577,7 +576,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class);
assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
checkFilters(request);
}
@ -593,7 +592,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class);
assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
checkFilters(request);
}
@ -608,7 +607,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class);
assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
checkFilters(request);
}
@ -624,7 +623,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class);
assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
checkFilters(request);
}
@ -639,7 +638,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
checkFilters(request);
}
@ -658,7 +657,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, null);
assertFallbackClassEquals(method, null);
checkFilters(request);
@ -676,7 +675,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, null);
assertFallbackClassEquals(method, null);
checkFilters(request);
}
@ -691,7 +690,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
assertResponseParserClassEquals(method, request, ReturnTrueIf2xx.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnFalseOnNotFoundOr404.class);
assertFallbackClassEquals(method, FalseOnNotFoundOr404.class);
checkFilters(request);
}
@ -706,7 +705,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, null);
assertFallbackClassEquals(method, null);
checkFilters(request);
}
@ -721,7 +720,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class);
assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
checkFilters(request);
}
@ -736,7 +735,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class);
assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
checkFilters(request);
}
@ -751,7 +750,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class);
assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
checkFilters(request);
}
@ -767,7 +766,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, null);
assertFallbackClassEquals(method, null);
checkFilters(request);
@ -787,7 +786,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, null);
assertFallbackClassEquals(method, null);
checkFilters(request);
}
@ -803,7 +802,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, null);
assertFallbackClassEquals(method, null);
checkFilters(request);
}
@ -818,7 +817,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, null);
assertFallbackClassEquals(method, null);
checkFilters(request);
}
@ -833,7 +832,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, null);
assertFallbackClassEquals(method, null);
checkFilters(request);
@ -849,7 +848,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, null);
assertFallbackClassEquals(method, null);
checkFilters(request);
}
@ -864,7 +863,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, null);
assertFallbackClassEquals(method, null);
checkFilters(request);
}

View File

@ -28,6 +28,8 @@ import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.Fallbacks.VoidOnNotFoundOr404;
import org.jclouds.cloudsigma.binders.BindCloneDriveOptionsToPlainTextString;
import org.jclouds.cloudsigma.binders.BindDriveDataToPlainTextString;
import org.jclouds.cloudsigma.binders.BindDriveToPlainTextString;
@ -54,14 +56,12 @@ import org.jclouds.cloudsigma.functions.SplitNewlinesAndReturnSecondField;
import org.jclouds.cloudsigma.options.CloneDriveOptions;
import org.jclouds.http.filters.BasicAuthentication;
import org.jclouds.rest.annotations.BinderParam;
import org.jclouds.rest.annotations.ExceptionParser;
import org.jclouds.rest.annotations.Fallback;
import org.jclouds.rest.annotations.MapBinder;
import org.jclouds.rest.annotations.Payload;
import org.jclouds.rest.annotations.PayloadParam;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.ResponseParser;
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
import org.jclouds.rest.functions.ReturnVoidOnNotFoundOr404;
import com.google.common.util.concurrent.ListenableFuture;
@ -116,7 +116,7 @@ public interface CloudSigmaAsyncClient {
*/
@GET
@Path("/profile/info")
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
@Fallback(NullOnNotFoundOr404.class)
@ResponseParser(KeyValuesDelimitedByBlankLinesToProfileInfo.class)
ListenableFuture<ProfileInfo> getProfileInfo();
@ -132,7 +132,7 @@ public interface CloudSigmaAsyncClient {
* @see CloudSigmaClient#getDriveInfo
*/
@GET
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
@Fallback(NullOnNotFoundOr404.class)
@ResponseParser(KeyValuesDelimitedByBlankLinesToDriveInfo.class)
@Path("/drives/{uuid}/info")
ListenableFuture<DriveInfo> getDriveInfo(@PathParam("uuid") String uuid);
@ -141,7 +141,7 @@ public interface CloudSigmaAsyncClient {
* @see CloudSigmaClient#createDrive
*/
@POST
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
@Fallback(NullOnNotFoundOr404.class)
@ResponseParser(KeyValuesDelimitedByBlankLinesToDriveInfo.class)
@Path("/drives/create")
ListenableFuture<DriveInfo> createDrive(@BinderParam(BindDriveToPlainTextString.class) Drive createDrive);
@ -159,7 +159,7 @@ public interface CloudSigmaAsyncClient {
* @see CloudSigmaClient#createServer
*/
@POST
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
@Fallback(NullOnNotFoundOr404.class)
@ResponseParser(KeyValuesDelimitedByBlankLinesToServerInfo.class)
@Path("/servers/create")
ListenableFuture<ServerInfo> createServer(@BinderParam(BindServerToPlainTextString.class) Server createServer);
@ -176,7 +176,7 @@ public interface CloudSigmaAsyncClient {
* @see CloudSigmaClient#getServerInfo
*/
@GET
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
@Fallback(NullOnNotFoundOr404.class)
@ResponseParser(KeyValuesDelimitedByBlankLinesToServerInfo.class)
@Path("/servers/{uuid}/info")
ListenableFuture<ServerInfo> getServerInfo(@PathParam("uuid") String uuid);
@ -185,7 +185,7 @@ public interface CloudSigmaAsyncClient {
* @see CloudSigmaClient#setServerConfiguration
*/
@POST
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
@Fallback(NullOnNotFoundOr404.class)
@ResponseParser(KeyValuesDelimitedByBlankLinesToServerInfo.class)
@Path("/servers/{uuid}/set")
ListenableFuture<ServerInfo> setServerConfiguration(@PathParam("uuid") String uuid,
@ -204,7 +204,7 @@ public interface CloudSigmaAsyncClient {
*/
@GET
@Path("/servers/{uuid}/destroy")
@ExceptionParser(ReturnVoidOnNotFoundOr404.class)
@Fallback(VoidOnNotFoundOr404.class)
ListenableFuture<Void> destroyServer(@PathParam("uuid") String uuid);
/**
@ -248,14 +248,14 @@ public interface CloudSigmaAsyncClient {
*/
@GET
@Path("/drives/{uuid}/destroy")
@ExceptionParser(ReturnVoidOnNotFoundOr404.class)
@Fallback(VoidOnNotFoundOr404.class)
ListenableFuture<Void> destroyDrive(@PathParam("uuid") String uuid);
/**
* @see CloudSigmaClient#createVLAN
*/
@POST
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
@Fallback(NullOnNotFoundOr404.class)
@ResponseParser(KeyValuesDelimitedByBlankLinesToVLANInfo.class)
@Path("/resources/vlan/create")
@Payload("name {name}\n")
@ -274,7 +274,7 @@ public interface CloudSigmaAsyncClient {
* @see CloudSigmaClient#getVLANInfo
*/
@GET
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
@Fallback(NullOnNotFoundOr404.class)
@ResponseParser(KeyValuesDelimitedByBlankLinesToVLANInfo.class)
@Path("/resources/vlan/{uuid}/info")
ListenableFuture<VLANInfo> getVLANInfo(@PathParam("uuid") String uuid);
@ -302,14 +302,14 @@ public interface CloudSigmaAsyncClient {
*/
@GET
@Path("/resources/vlan/{uuid}/destroy")
@ExceptionParser(ReturnVoidOnNotFoundOr404.class)
@Fallback(VoidOnNotFoundOr404.class)
ListenableFuture<Void> destroyVLAN(@PathParam("uuid") String uuid);
/**
* @see CloudSigmaClient#createStaticIP
*/
@POST
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
@Fallback(NullOnNotFoundOr404.class)
@ResponseParser(KeyValuesDelimitedByBlankLinesToStaticIPInfo.class)
@Path("/resources/ip/create")
ListenableFuture<StaticIPInfo> createStaticIP();
@ -326,7 +326,7 @@ public interface CloudSigmaAsyncClient {
* @see CloudSigmaClient#getStaticIPInfo
*/
@GET
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
@Fallback(NullOnNotFoundOr404.class)
@ResponseParser(KeyValuesDelimitedByBlankLinesToStaticIPInfo.class)
@Path("/resources/ip/{uuid}/info")
ListenableFuture<StaticIPInfo> getStaticIPInfo(@PathParam("uuid") String uuid);
@ -344,7 +344,7 @@ public interface CloudSigmaAsyncClient {
*/
@GET
@Path("/resources/ip/{uuid}/destroy")
@ExceptionParser(ReturnVoidOnNotFoundOr404.class)
@Fallback(VoidOnNotFoundOr404.class)
ListenableFuture<Void> destroyStaticIP(@PathParam("uuid") String uuid);
}

View File

@ -23,6 +23,8 @@ import static org.testng.Assert.assertEquals;
import java.io.IOException;
import java.lang.reflect.Method;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.Fallbacks.VoidOnNotFoundOr404;
import org.jclouds.apis.ApiMetadata;
import org.jclouds.cloudsigma.binders.BindServerToPlainTextStringTest;
import org.jclouds.cloudsigma.domain.CreateDriveRequest;
@ -41,12 +43,10 @@ import org.jclouds.cloudsigma.functions.ListOfKeyValuesDelimitedByBlankLinesToVL
import org.jclouds.cloudsigma.functions.SplitNewlines;
import org.jclouds.cloudsigma.functions.SplitNewlinesAndReturnSecondField;
import org.jclouds.cloudsigma.options.CloneDriveOptions;
import org.jclouds.fallbacks.MapHttp4xxCodesToExceptions;
import org.jclouds.http.HttpRequest;
import org.jclouds.http.filters.BasicAuthentication;
import org.jclouds.http.functions.ReleasePayloadAndReturn;
import org.jclouds.rest.functions.MapHttp4xxCodesToExceptions;
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
import org.jclouds.rest.functions.ReturnVoidOnNotFoundOr404;
import org.jclouds.rest.internal.BaseAsyncClientTest;
import org.jclouds.rest.internal.RestAnnotationProcessor;
import org.testng.annotations.Test;
@ -74,7 +74,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
assertResponseParserClassEquals(method, httpRequest, KeyValuesDelimitedByBlankLinesToProfileInfo.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
checkFilters(httpRequest);
@ -90,7 +90,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
assertResponseParserClassEquals(method, httpRequest, SplitNewlines.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, null);
assertFallbackClassEquals(method, null);
checkFilters(httpRequest);
}
@ -105,7 +105,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
assertResponseParserClassEquals(method, httpRequest, SplitNewlines.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, null);
assertFallbackClassEquals(method, null);
checkFilters(httpRequest);
}
@ -120,7 +120,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
assertResponseParserClassEquals(method, httpRequest, SplitNewlines.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, null);
assertFallbackClassEquals(method, null);
checkFilters(httpRequest);
}
@ -135,7 +135,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
assertResponseParserClassEquals(method, httpRequest, ListOfKeyValuesDelimitedByBlankLinesToDriveInfoSet.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, null);
assertFallbackClassEquals(method, null);
checkFilters(httpRequest);
}
@ -150,7 +150,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
assertResponseParserClassEquals(method, httpRequest, KeyValuesDelimitedByBlankLinesToDriveInfo.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
checkFilters(httpRequest);
@ -168,7 +168,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
assertResponseParserClassEquals(method, httpRequest, KeyValuesDelimitedByBlankLinesToDriveInfo.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
checkFilters(httpRequest);
@ -185,7 +185,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
assertResponseParserClassEquals(method, httpRequest, KeyValuesDelimitedByBlankLinesToDriveInfo.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class);
assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
checkFilters(httpRequest);
@ -203,7 +203,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
assertResponseParserClassEquals(method, httpRequest, KeyValuesDelimitedByBlankLinesToDriveInfo.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class);
assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
checkFilters(httpRequest);
@ -220,7 +220,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
assertResponseParserClassEquals(method, httpRequest, KeyValuesDelimitedByBlankLinesToDriveInfo.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class);
assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
checkFilters(httpRequest);
@ -247,7 +247,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
// TODO: insert expected response class, which probably extends ParseJson
assertResponseParserClassEquals(method, httpRequest, SplitNewlines.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, null);
assertFallbackClassEquals(method, null);
checkFilters(httpRequest);
@ -263,7 +263,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
assertResponseParserClassEquals(method, httpRequest, ListOfKeyValuesDelimitedByBlankLinesToServerInfoSet.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, null);
assertFallbackClassEquals(method, null);
checkFilters(httpRequest);
}
@ -278,7 +278,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
assertResponseParserClassEquals(method, httpRequest, KeyValuesDelimitedByBlankLinesToServerInfo.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
checkFilters(httpRequest);
@ -294,7 +294,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
assertResponseParserClassEquals(method, httpRequest, KeyValuesDelimitedByBlankLinesToServerInfo.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
checkFilters(httpRequest);
@ -310,7 +310,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
assertResponseParserClassEquals(method, httpRequest, KeyValuesDelimitedByBlankLinesToServerInfo.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
checkFilters(httpRequest);
@ -326,7 +326,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
assertResponseParserClassEquals(method, httpRequest, ReleasePayloadAndReturn.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnVoidOnNotFoundOr404.class);
assertFallbackClassEquals(method, VoidOnNotFoundOr404.class);
checkFilters(httpRequest);
@ -342,7 +342,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
assertResponseParserClassEquals(method, httpRequest, ReleasePayloadAndReturn.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class);
assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
checkFilters(httpRequest);
@ -358,7 +358,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
assertResponseParserClassEquals(method, httpRequest, ReleasePayloadAndReturn.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class);
assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
checkFilters(httpRequest);
@ -374,7 +374,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
assertResponseParserClassEquals(method, httpRequest, ReleasePayloadAndReturn.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class);
assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
checkFilters(httpRequest);
@ -390,7 +390,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
assertResponseParserClassEquals(method, httpRequest, ReleasePayloadAndReturn.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class);
assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
checkFilters(httpRequest);
@ -417,7 +417,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
// TODO: insert expected response class, which probably extends ParseJson
assertResponseParserClassEquals(method, httpRequest, SplitNewlines.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, null);
assertFallbackClassEquals(method, null);
checkFilters(httpRequest);
@ -433,7 +433,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
assertResponseParserClassEquals(method, httpRequest, ReleasePayloadAndReturn.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnVoidOnNotFoundOr404.class);
assertFallbackClassEquals(method, VoidOnNotFoundOr404.class);
checkFilters(httpRequest);
@ -460,7 +460,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
// TODO: insert expected response class, which probably extends ParseJson
assertResponseParserClassEquals(method, httpRequest, SplitNewlinesAndReturnSecondField.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, null);
assertFallbackClassEquals(method, null);
checkFilters(httpRequest);
@ -476,7 +476,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
assertResponseParserClassEquals(method, httpRequest, ListOfKeyValuesDelimitedByBlankLinesToVLANInfoSet.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, null);
assertFallbackClassEquals(method, null);
checkFilters(httpRequest);
}
@ -491,7 +491,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
assertResponseParserClassEquals(method, httpRequest, KeyValuesDelimitedByBlankLinesToVLANInfo.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
checkFilters(httpRequest);
@ -507,7 +507,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
assertResponseParserClassEquals(method, httpRequest, KeyValuesDelimitedByBlankLinesToVLANInfo.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
checkFilters(httpRequest);
@ -523,7 +523,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
assertResponseParserClassEquals(method, httpRequest, KeyValuesDelimitedByBlankLinesToVLANInfo.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class);
assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
checkFilters(httpRequest);
@ -539,7 +539,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
assertResponseParserClassEquals(method, httpRequest, ReleasePayloadAndReturn.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnVoidOnNotFoundOr404.class);
assertFallbackClassEquals(method, VoidOnNotFoundOr404.class);
checkFilters(httpRequest);
@ -566,7 +566,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
// TODO: insert expected response class, which probably extends ParseJson
assertResponseParserClassEquals(method, httpRequest, SplitNewlinesAndReturnSecondField.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, null);
assertFallbackClassEquals(method, null);
checkFilters(httpRequest);
@ -582,7 +582,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
assertResponseParserClassEquals(method, httpRequest, ListOfKeyValuesDelimitedByBlankLinesToStaticIPInfoSet.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, null);
assertFallbackClassEquals(method, null);
checkFilters(httpRequest);
}
@ -597,7 +597,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
assertResponseParserClassEquals(method, httpRequest, KeyValuesDelimitedByBlankLinesToStaticIPInfo.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
checkFilters(httpRequest);
@ -613,7 +613,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
assertResponseParserClassEquals(method, httpRequest, KeyValuesDelimitedByBlankLinesToStaticIPInfo.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
checkFilters(httpRequest);
@ -629,7 +629,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
assertResponseParserClassEquals(method, httpRequest, ReleasePayloadAndReturn.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnVoidOnNotFoundOr404.class);
assertFallbackClassEquals(method, VoidOnNotFoundOr404.class);
checkFilters(httpRequest);

View File

@ -25,16 +25,16 @@ import javax.ws.rs.GET;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.cloudstack.domain.Account;
import org.jclouds.cloudstack.filters.AuthenticationFilter;
import org.jclouds.cloudstack.options.ListAccountsOptions;
import org.jclouds.rest.annotations.ExceptionParser;
import org.jclouds.rest.annotations.Fallback;
import org.jclouds.rest.annotations.OnlyElement;
import org.jclouds.rest.annotations.QueryParams;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.SelectJson;
import org.jclouds.rest.functions.ReturnEmptySetOnNotFoundOr404;
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
import com.google.common.util.concurrent.ListenableFuture;
@ -56,7 +56,7 @@ public interface AccountAsyncClient {
@QueryParams(keys = { "command", "listAll" }, values = { "listAccounts", "true" })
@SelectJson("account")
@Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
@Fallback(EmptySetOnNotFoundOr404.class)
ListenableFuture<Set<Account>> listAccounts(ListAccountsOptions... options);
/**
@ -67,7 +67,7 @@ public interface AccountAsyncClient {
@SelectJson("account")
@OnlyElement
@Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
@Fallback(NullOnNotFoundOr404.class)
ListenableFuture<Account> getAccount(@QueryParam("id") String id);
}

View File

@ -25,20 +25,20 @@ import javax.ws.rs.GET;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.cloudstack.domain.AsyncCreateResponse;
import org.jclouds.cloudstack.domain.PublicIPAddress;
import org.jclouds.cloudstack.filters.AuthenticationFilter;
import org.jclouds.cloudstack.functions.ReturnVoidOnNotFoundOr404OrUnableToFindAccountOwner;
import org.jclouds.cloudstack.functions.CloudStackFallbacks.VoidOnNotFoundOr404OrUnableToFindAccountOwner;
import org.jclouds.cloudstack.options.AssociateIPAddressOptions;
import org.jclouds.cloudstack.options.ListPublicIPAddressesOptions;
import org.jclouds.rest.annotations.ExceptionParser;
import org.jclouds.rest.annotations.Fallback;
import org.jclouds.rest.annotations.OnlyElement;
import org.jclouds.rest.annotations.QueryParams;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.SelectJson;
import org.jclouds.rest.annotations.Unwrap;
import org.jclouds.rest.functions.ReturnEmptySetOnNotFoundOr404;
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
import com.google.common.util.concurrent.ListenableFuture;
@ -61,7 +61,7 @@ public interface AddressAsyncClient {
@QueryParams(keys = { "command", "listAll" }, values = { "listPublicIpAddresses", "true" })
@SelectJson("publicipaddress")
@Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
@Fallback(EmptySetOnNotFoundOr404.class)
ListenableFuture<Set<PublicIPAddress>> listPublicIPAddresses(ListPublicIPAddressesOptions... options);
/**
@ -72,7 +72,7 @@ public interface AddressAsyncClient {
@SelectJson("publicipaddress")
@OnlyElement
@Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
@Fallback(NullOnNotFoundOr404.class)
ListenableFuture<PublicIPAddress> getPublicIPAddress(@QueryParam("id") String id);
/**
@ -90,7 +90,7 @@ public interface AddressAsyncClient {
*/
@GET
@QueryParams(keys = "command", values = "disassociateIpAddress")
@ExceptionParser(ReturnVoidOnNotFoundOr404OrUnableToFindAccountOwner.class)
@Fallback(VoidOnNotFoundOr404OrUnableToFindAccountOwner.class)
ListenableFuture<Void> disassociateIPAddress(@QueryParam("id") String id);
}

View File

@ -25,17 +25,17 @@ import javax.ws.rs.GET;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.cloudstack.domain.AsyncJob;
import org.jclouds.cloudstack.filters.AuthenticationFilter;
import org.jclouds.cloudstack.functions.ParseAsyncJobFromHttpResponse;
import org.jclouds.cloudstack.functions.ParseAsyncJobsFromHttpResponse;
import org.jclouds.cloudstack.options.ListAsyncJobsOptions;
import org.jclouds.rest.annotations.ExceptionParser;
import org.jclouds.rest.annotations.Fallback;
import org.jclouds.rest.annotations.QueryParams;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.ResponseParser;
import org.jclouds.rest.functions.ReturnEmptySetOnNotFoundOr404;
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
import com.google.common.util.concurrent.ListenableFuture;
@ -57,7 +57,7 @@ public interface AsyncJobAsyncClient {
@GET
@QueryParams(keys = { "command", "listAll" }, values = { "listAsyncJobs", "true" })
@ResponseParser(ParseAsyncJobsFromHttpResponse.class)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
@Fallback(EmptySetOnNotFoundOr404.class)
ListenableFuture<Set<AsyncJob<?>>> listAsyncJobs(ListAsyncJobsOptions... options);
/**
@ -67,7 +67,7 @@ public interface AsyncJobAsyncClient {
@QueryParams(keys = "command", values = "queryAsyncJobResult")
@Consumes(MediaType.APPLICATION_JSON)
@ResponseParser(ParseAsyncJobFromHttpResponse.class)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
@Fallback(NullOnNotFoundOr404.class)
<T> ListenableFuture<AsyncJob<T>> getAsyncJob(@QueryParam("jobid") String id);
}

View File

@ -23,15 +23,15 @@ import javax.ws.rs.GET;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.cloudstack.domain.Account;
import org.jclouds.cloudstack.domain.AsyncCreateResponse;
import org.jclouds.cloudstack.filters.AuthenticationFilter;
import org.jclouds.rest.annotations.ExceptionParser;
import org.jclouds.rest.annotations.Fallback;
import org.jclouds.rest.annotations.QueryParams;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.SelectJson;
import org.jclouds.rest.annotations.Unwrap;
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
import com.google.common.util.concurrent.ListenableFuture;
@ -55,7 +55,7 @@ public interface DomainAccountAsyncClient extends AccountAsyncClient {
@QueryParams(keys = "command", values = "enableAccount")
@SelectJson("account")
@Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
@Fallback(NullOnNotFoundOr404.class)
ListenableFuture<Account> enableAccount(@QueryParam("account") String accountName, @QueryParam("domainid") String domainId);
@ -66,7 +66,7 @@ public interface DomainAccountAsyncClient extends AccountAsyncClient {
@QueryParams(keys = "command", values = "disableAccount")
@Unwrap
@Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
@Fallback(NullOnNotFoundOr404.class)
ListenableFuture<AsyncCreateResponse> disableAccount(@QueryParam("account") String accountName,
@QueryParam("domainid") String domainId, @QueryParam("lock") boolean onlyLock);

View File

@ -25,17 +25,17 @@ import javax.ws.rs.GET;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.cloudstack.domain.Domain;
import org.jclouds.cloudstack.filters.AuthenticationFilter;
import org.jclouds.cloudstack.options.ListDomainChildrenOptions;
import org.jclouds.cloudstack.options.ListDomainsOptions;
import org.jclouds.rest.annotations.ExceptionParser;
import org.jclouds.rest.annotations.Fallback;
import org.jclouds.rest.annotations.OnlyElement;
import org.jclouds.rest.annotations.QueryParams;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.SelectJson;
import org.jclouds.rest.functions.ReturnEmptySetOnNotFoundOr404;
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
import com.google.common.util.concurrent.ListenableFuture;
@ -59,7 +59,7 @@ public interface DomainDomainAsyncClient {
@QueryParams(keys = { "command", "listAll" }, values = { "listDomains", "true" })
@SelectJson("domain")
@Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
@Fallback(EmptySetOnNotFoundOr404.class)
ListenableFuture<Set<Domain>> listDomains(ListDomainsOptions... options);
/**
@ -70,7 +70,7 @@ public interface DomainDomainAsyncClient {
@SelectJson("domain")
@OnlyElement
@Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
@Fallback(NullOnNotFoundOr404.class)
ListenableFuture<Domain> getDomainById(@QueryParam("id") String domainId);
/**
@ -80,6 +80,6 @@ public interface DomainDomainAsyncClient {
@QueryParams(keys = { "command", "listAll" }, values = { "listDomainChildren", "true" })
@SelectJson("domain")
@Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
@Fallback(EmptySetOnNotFoundOr404.class)
ListenableFuture<Set<Domain>> listDomainChildren(ListDomainChildrenOptions... options);
}

View File

@ -25,17 +25,17 @@ import javax.ws.rs.GET;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.cloudstack.domain.AsyncCreateResponse;
import org.jclouds.cloudstack.domain.User;
import org.jclouds.cloudstack.filters.AuthenticationFilter;
import org.jclouds.cloudstack.options.ListUsersOptions;
import org.jclouds.rest.annotations.ExceptionParser;
import org.jclouds.rest.annotations.Fallback;
import org.jclouds.rest.annotations.QueryParams;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.SelectJson;
import org.jclouds.rest.annotations.Unwrap;
import org.jclouds.rest.functions.ReturnEmptySetOnNotFoundOr404;
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
import com.google.common.util.concurrent.ListenableFuture;
@ -59,7 +59,7 @@ public interface DomainUserAsyncClient {
@QueryParams(keys = "command", values = "listUsers")
@SelectJson("user")
@Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
@Fallback(EmptySetOnNotFoundOr404.class)
ListenableFuture<Set<User>> listUsers(ListUsersOptions... options);
/**
@ -69,7 +69,7 @@ public interface DomainUserAsyncClient {
@QueryParams(keys = "command", values = "enableUser")
@SelectJson("user")
@Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
@Fallback(NullOnNotFoundOr404.class)
ListenableFuture<User> enableUser(@QueryParam("id") String userId);
/**
@ -79,7 +79,7 @@ public interface DomainUserAsyncClient {
@QueryParams(keys = "command", values = "disableUser")
@Unwrap
@Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
@Fallback(NullOnNotFoundOr404.class)
ListenableFuture<AsyncCreateResponse> disableUser(@QueryParam("id") String userId);
}

View File

@ -24,16 +24,16 @@ import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.core.MediaType;
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
import org.jclouds.cloudstack.domain.Event;
import org.jclouds.cloudstack.filters.AuthenticationFilter;
import org.jclouds.cloudstack.functions.ParseEventTypesFromHttpResponse;
import org.jclouds.cloudstack.options.ListEventsOptions;
import org.jclouds.rest.annotations.ExceptionParser;
import org.jclouds.rest.annotations.Fallback;
import org.jclouds.rest.annotations.QueryParams;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.ResponseParser;
import org.jclouds.rest.annotations.SelectJson;
import org.jclouds.rest.functions.ReturnEmptySetOnNotFoundOr404;
import com.google.common.util.concurrent.ListenableFuture;
@ -55,7 +55,7 @@ public interface EventAsyncClient {
@QueryParams(keys = "command", values = "listEventTypes")
@Consumes(MediaType.APPLICATION_JSON)
@ResponseParser(ParseEventTypesFromHttpResponse.class)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
@Fallback(EmptySetOnNotFoundOr404.class)
ListenableFuture<Set<String>> listEventTypes();
/**
@ -65,7 +65,7 @@ public interface EventAsyncClient {
@QueryParams(keys = "command", values = "listEvents")
@SelectJson("event")
@Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
@Fallback(EmptySetOnNotFoundOr404.class)
ListenableFuture<Set<Event>> listEvents(ListEventsOptions...options);
}

View File

@ -25,6 +25,9 @@ import javax.ws.rs.GET;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.Fallbacks.VoidOnNotFoundOr404;
import org.jclouds.cloudstack.domain.AsyncCreateResponse;
import org.jclouds.cloudstack.domain.FirewallRule;
import org.jclouds.cloudstack.domain.PortForwardingRule;
@ -32,15 +35,12 @@ import org.jclouds.cloudstack.filters.AuthenticationFilter;
import org.jclouds.cloudstack.options.CreateFirewallRuleOptions;
import org.jclouds.cloudstack.options.ListFirewallRulesOptions;
import org.jclouds.cloudstack.options.ListPortForwardingRulesOptions;
import org.jclouds.rest.annotations.ExceptionParser;
import org.jclouds.rest.annotations.Fallback;
import org.jclouds.rest.annotations.OnlyElement;
import org.jclouds.rest.annotations.QueryParams;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.SelectJson;
import org.jclouds.rest.annotations.Unwrap;
import org.jclouds.rest.functions.ReturnEmptySetOnNotFoundOr404;
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
import org.jclouds.rest.functions.ReturnVoidOnNotFoundOr404;
import com.google.common.util.concurrent.ListenableFuture;
@ -63,7 +63,7 @@ public interface FirewallAsyncClient {
@QueryParams(keys = { "command", "listAll" }, values = { "listFirewallRules", "true" })
@SelectJson("firewallrule")
@Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
@Fallback(EmptySetOnNotFoundOr404.class)
ListenableFuture<Set<FirewallRule>> listFirewallRules(ListFirewallRulesOptions... options);
/**
@ -74,7 +74,7 @@ public interface FirewallAsyncClient {
@SelectJson("firewallrule")
@OnlyElement
@Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
@Fallback(NullOnNotFoundOr404.class)
ListenableFuture<FirewallRule> getFirewallRule(@QueryParam("id") String id);
/**
@ -105,7 +105,7 @@ public interface FirewallAsyncClient {
*/
@GET
@QueryParams(keys = "command", values = "deleteFirewallRule")
@ExceptionParser(ReturnVoidOnNotFoundOr404.class)
@Fallback(VoidOnNotFoundOr404.class)
ListenableFuture<Void> deleteFirewallRule(@QueryParam("id") String id);
/**
@ -115,7 +115,7 @@ public interface FirewallAsyncClient {
@QueryParams(keys = { "command", "listAll" }, values = { "listPortForwardingRules", "true" })
@SelectJson("portforwardingrule")
@Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
@Fallback(EmptySetOnNotFoundOr404.class)
ListenableFuture<Set<PortForwardingRule>> listPortForwardingRules(ListPortForwardingRulesOptions... options);
/**
@ -126,7 +126,7 @@ public interface FirewallAsyncClient {
@SelectJson("portforwardingrule")
@OnlyElement
@Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
@Fallback(NullOnNotFoundOr404.class)
ListenableFuture<PortForwardingRule> getPortForwardingRule(@QueryParam("id") String id);
/**
@ -146,7 +146,7 @@ public interface FirewallAsyncClient {
*/
@GET
@QueryParams(keys = "command", values = "deletePortForwardingRule")
@ExceptionParser(ReturnVoidOnNotFoundOr404.class)
@Fallback(VoidOnNotFoundOr404.class)
ListenableFuture<Void> deletePortForwardingRule(@QueryParam("id") String id);
}

View File

@ -23,15 +23,15 @@ import javax.ws.rs.GET;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.cloudstack.domain.Account;
import org.jclouds.cloudstack.filters.AuthenticationFilter;
import org.jclouds.cloudstack.options.CreateAccountOptions;
import org.jclouds.cloudstack.options.UpdateAccountOptions;
import org.jclouds.rest.annotations.ExceptionParser;
import org.jclouds.rest.annotations.Fallback;
import org.jclouds.rest.annotations.QueryParams;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.SelectJson;
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
import com.google.common.util.concurrent.ListenableFuture;
@ -55,7 +55,7 @@ public interface GlobalAccountAsyncClient extends DomainAccountAsyncClient {
@QueryParams(keys = "command", values = "createAccount")
@SelectJson("account")
@Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
@Fallback(NullOnNotFoundOr404.class)
ListenableFuture<Account> createAccount(@QueryParam("username") String userName,
@QueryParam("accounttype") Account.Type accountType, @QueryParam("email") String email,
@QueryParam("firstname") String firstName, @QueryParam("lastname") String lastName,
@ -68,7 +68,7 @@ public interface GlobalAccountAsyncClient extends DomainAccountAsyncClient {
@QueryParams(keys = "command", values = "updateAccount")
@SelectJson("account")
@Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
@Fallback(NullOnNotFoundOr404.class)
ListenableFuture<Account> updateAccount(@QueryParam("account") String accountName,
@QueryParam("domainid") String domainId, @QueryParam("newname") String newName, UpdateAccountOptions... options);
@ -78,6 +78,6 @@ public interface GlobalAccountAsyncClient extends DomainAccountAsyncClient {
@GET
@QueryParams(keys = "command", values = "deleteAccount")
@Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
@Fallback(NullOnNotFoundOr404.class)
ListenableFuture<Void> deleteAccount(@QueryParam("id") String id);
}

View File

@ -24,14 +24,14 @@ import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.core.MediaType;
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
import org.jclouds.cloudstack.domain.Alert;
import org.jclouds.cloudstack.filters.AuthenticationFilter;
import org.jclouds.cloudstack.options.ListAlertsOptions;
import org.jclouds.rest.annotations.ExceptionParser;
import org.jclouds.rest.annotations.Fallback;
import org.jclouds.rest.annotations.QueryParams;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.SelectJson;
import org.jclouds.rest.functions.ReturnEmptySetOnNotFoundOr404;
import com.google.common.util.concurrent.ListenableFuture;
@ -55,7 +55,7 @@ public interface GlobalAlertAsyncClient {
@QueryParams(keys = { "command", "listAll" }, values = { "listAlerts", "true" })
@SelectJson("alert")
@Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
@Fallback(EmptySetOnNotFoundOr404.class)
ListenableFuture<Set<Alert>> listAlerts(ListAlertsOptions...options);
}

View File

@ -24,14 +24,14 @@ import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.core.MediaType;
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
import org.jclouds.cloudstack.domain.Capacity;
import org.jclouds.cloudstack.filters.AuthenticationFilter;
import org.jclouds.cloudstack.options.ListCapacityOptions;
import org.jclouds.rest.annotations.ExceptionParser;
import org.jclouds.rest.annotations.Fallback;
import org.jclouds.rest.annotations.QueryParams;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.SelectJson;
import org.jclouds.rest.functions.ReturnEmptySetOnNotFoundOr404;
import com.google.common.util.concurrent.ListenableFuture;
@ -55,7 +55,7 @@ public interface GlobalCapacityAsyncClient {
@QueryParams(keys = { "command", "listAll" }, values = { "listCapacity", "true" })
@SelectJson("capacity")
@Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
@Fallback(EmptySetOnNotFoundOr404.class)
ListenableFuture<Set<Capacity>> listCapacity(ListCapacityOptions...options);
}

View File

@ -25,15 +25,15 @@ import javax.ws.rs.GET;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.cloudstack.domain.ConfigurationEntry;
import org.jclouds.cloudstack.filters.AuthenticationFilter;
import org.jclouds.cloudstack.options.ListConfigurationEntriesOptions;
import org.jclouds.rest.annotations.ExceptionParser;
import org.jclouds.rest.annotations.Fallback;
import org.jclouds.rest.annotations.QueryParams;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.SelectJson;
import org.jclouds.rest.functions.ReturnEmptySetOnNotFoundOr404;
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
import com.google.common.util.concurrent.ListenableFuture;
@ -57,7 +57,7 @@ public interface GlobalConfigurationAsyncClient extends ConfigurationAsyncClient
@QueryParams(keys = { "command", "listAll" }, values = { "listConfigurations", "true" })
@SelectJson("configuration")
@Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
@Fallback(EmptySetOnNotFoundOr404.class)
ListenableFuture<Set<ConfigurationEntry>> listConfigurationEntries(ListConfigurationEntriesOptions... options);
/**
@ -67,7 +67,7 @@ public interface GlobalConfigurationAsyncClient extends ConfigurationAsyncClient
@QueryParams(keys = "command", values = "updateConfiguration")
@SelectJson("configuration")
@Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
@Fallback(NullOnNotFoundOr404.class)
ListenableFuture<ConfigurationEntry> updateConfigurationEntry(
@QueryParam("name") String name, @QueryParam("value") String value);
}

View File

@ -23,16 +23,16 @@ import javax.ws.rs.GET;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.Fallbacks.VoidOnNotFoundOr404;
import org.jclouds.cloudstack.domain.Domain;
import org.jclouds.cloudstack.filters.AuthenticationFilter;
import org.jclouds.cloudstack.options.CreateDomainOptions;
import org.jclouds.cloudstack.options.UpdateDomainOptions;
import org.jclouds.rest.annotations.ExceptionParser;
import org.jclouds.rest.annotations.Fallback;
import org.jclouds.rest.annotations.QueryParams;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.SelectJson;
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
import org.jclouds.rest.functions.ReturnVoidOnNotFoundOr404;
import com.google.common.util.concurrent.ListenableFuture;
@ -56,7 +56,7 @@ public interface GlobalDomainAsyncClient extends DomainDomainAsyncClient {
@QueryParams(keys = "command", values = "createDomain")
@SelectJson("domain")
@Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
@Fallback(NullOnNotFoundOr404.class)
ListenableFuture<Domain> createDomain(@QueryParam("name") String name, CreateDomainOptions... options);
/**
@ -66,7 +66,7 @@ public interface GlobalDomainAsyncClient extends DomainDomainAsyncClient {
@QueryParams(keys = "command", values = "updateDomain")
@SelectJson("domain")
@Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
@Fallback(NullOnNotFoundOr404.class)
ListenableFuture<Domain> updateDomain(@QueryParam("id") String domainId, UpdateDomainOptions... options);
/**
@ -74,7 +74,7 @@ public interface GlobalDomainAsyncClient extends DomainDomainAsyncClient {
*/
@GET
@QueryParams(keys = {"command", "cleanup"}, values = {"deleteDomain", "false"})
@ExceptionParser(ReturnVoidOnNotFoundOr404.class)
@Fallback(VoidOnNotFoundOr404.class)
ListenableFuture<Void> deleteOnlyDomain(@QueryParam("id") String id);
/**
@ -82,7 +82,7 @@ public interface GlobalDomainAsyncClient extends DomainDomainAsyncClient {
*/
@GET
@QueryParams(keys = {"command", "cleanup"}, values = {"deleteDomain", "true"})
@ExceptionParser(ReturnVoidOnNotFoundOr404.class)
@Fallback(VoidOnNotFoundOr404.class)
ListenableFuture<Void> deleteDomainAndAttachedResources(@QueryParam("id") String id);
}

View File

@ -25,6 +25,7 @@ import javax.ws.rs.GET;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
import org.jclouds.cloudstack.domain.Cluster;
import org.jclouds.cloudstack.domain.Host;
import org.jclouds.cloudstack.filters.AuthenticationFilter;
@ -36,11 +37,10 @@ import org.jclouds.cloudstack.options.ListClustersOptions;
import org.jclouds.cloudstack.options.ListHostsOptions;
import org.jclouds.cloudstack.options.UpdateClusterOptions;
import org.jclouds.cloudstack.options.UpdateHostOptions;
import org.jclouds.rest.annotations.ExceptionParser;
import org.jclouds.rest.annotations.Fallback;
import org.jclouds.rest.annotations.QueryParams;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.SelectJson;
import org.jclouds.rest.functions.ReturnEmptySetOnNotFoundOr404;
import com.google.common.util.concurrent.ListenableFuture;
@ -63,7 +63,7 @@ public interface GlobalHostAsyncClient {
@QueryParams(keys = { "command", "listAll" }, values = { "listHosts", "true" })
@SelectJson("host")
@Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
@Fallback(EmptySetOnNotFoundOr404.class)
ListenableFuture<Set<Host>> listHosts(ListHostsOptions... options);
/**
@ -175,7 +175,7 @@ public interface GlobalHostAsyncClient {
@QueryParams(keys = { "command", "listAll" }, values = { "listClusters", "true" })
@SelectJson("cluster")
@Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
@Fallback(EmptySetOnNotFoundOr404.class)
ListenableFuture<Set<Cluster>> listClusters(ListClustersOptions... options);
/**

View File

@ -23,6 +23,7 @@ import javax.ws.rs.GET;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.cloudstack.domain.DiskOffering;
import org.jclouds.cloudstack.domain.NetworkOffering;
import org.jclouds.cloudstack.domain.ServiceOffering;
@ -32,11 +33,10 @@ import org.jclouds.cloudstack.options.CreateServiceOfferingOptions;
import org.jclouds.cloudstack.options.UpdateDiskOfferingOptions;
import org.jclouds.cloudstack.options.UpdateNetworkOfferingOptions;
import org.jclouds.cloudstack.options.UpdateServiceOfferingOptions;
import org.jclouds.rest.annotations.ExceptionParser;
import org.jclouds.rest.annotations.Fallback;
import org.jclouds.rest.annotations.QueryParams;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.SelectJson;
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
import com.google.common.util.concurrent.ListenableFuture;
@ -59,7 +59,7 @@ public interface GlobalOfferingAsyncClient extends OfferingAsyncClient {
@QueryParams(keys = "command", values = "createServiceOffering")
@SelectJson("serviceoffering")
@Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
@Fallback(NullOnNotFoundOr404.class)
ListenableFuture<ServiceOffering> createServiceOffering(@QueryParam("name") String name, @QueryParam("displaytext") String displayText,
@QueryParam("cpunumber") int cpuNumber, @QueryParam("cpuspeed") int cpuSpeedInMHz, @QueryParam("memory") int memoryInMB, CreateServiceOfferingOptions... options);
@ -71,7 +71,7 @@ public interface GlobalOfferingAsyncClient extends OfferingAsyncClient {
@QueryParams(keys = "command", values = "updateServiceOffering")
@SelectJson("serviceoffering")
@Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
@Fallback(NullOnNotFoundOr404.class)
ListenableFuture<ServiceOffering> updateServiceOffering(@QueryParam("id") String id, UpdateServiceOfferingOptions... options);
/**
@ -80,7 +80,7 @@ public interface GlobalOfferingAsyncClient extends OfferingAsyncClient {
@GET
@QueryParams(keys = "command", values = "deleteServiceOffering")
@Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
@Fallback(NullOnNotFoundOr404.class)
ListenableFuture<Void> deleteServiceOffering(@QueryParam("id") String id);
/**
@ -90,7 +90,7 @@ public interface GlobalOfferingAsyncClient extends OfferingAsyncClient {
@QueryParams(keys = "command", values = "createDiskOffering")
@SelectJson("diskoffering")
@Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
@Fallback(NullOnNotFoundOr404.class)
ListenableFuture<DiskOffering> createDiskOffering(@QueryParam("name") String name,
@QueryParam("displaytext") String displayText, CreateDiskOfferingOptions... options);
@ -101,7 +101,7 @@ public interface GlobalOfferingAsyncClient extends OfferingAsyncClient {
@QueryParams(keys = "command", values = "updateDiskOffering")
@SelectJson("diskoffering")
@Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
@Fallback(NullOnNotFoundOr404.class)
ListenableFuture<DiskOffering> updateDiskOffering(@QueryParam("id") String id, UpdateDiskOfferingOptions... options);
/**
@ -110,7 +110,7 @@ public interface GlobalOfferingAsyncClient extends OfferingAsyncClient {
@GET
@QueryParams(keys = "command", values = "deleteDiskOffering")
@Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
@Fallback(NullOnNotFoundOr404.class)
ListenableFuture<Void> deleteDiskOffering(@QueryParam("id") String id);
/**
@ -120,6 +120,6 @@ public interface GlobalOfferingAsyncClient extends OfferingAsyncClient {
@QueryParams(keys = "command", values ="updateNetworkOffering")
@SelectJson("networkoffering")
@Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
@Fallback(NullOnNotFoundOr404.class)
ListenableFuture<NetworkOffering> updateNetworkOffering(@QueryParam("id") String id, UpdateNetworkOfferingOptions... options);
}

View File

@ -25,19 +25,19 @@ import javax.ws.rs.GET;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.Fallbacks.VoidOnNotFoundOr404;
import org.jclouds.cloudstack.domain.Pod;
import org.jclouds.cloudstack.filters.AuthenticationFilter;
import org.jclouds.cloudstack.options.CreatePodOptions;
import org.jclouds.cloudstack.options.ListPodsOptions;
import org.jclouds.cloudstack.options.UpdatePodOptions;
import org.jclouds.rest.annotations.ExceptionParser;
import org.jclouds.rest.annotations.Fallback;
import org.jclouds.rest.annotations.OnlyElement;
import org.jclouds.rest.annotations.QueryParams;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.SelectJson;
import org.jclouds.rest.functions.ReturnEmptySetOnNotFoundOr404;
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
import org.jclouds.rest.functions.ReturnVoidOnNotFoundOr404;
import com.google.common.util.concurrent.ListenableFuture;
@ -61,7 +61,7 @@ public interface GlobalPodAsyncClient {
@QueryParams(keys = { "command", "listAll" }, values = { "listPods", "true" })
@SelectJson("pod")
@Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
@Fallback(EmptySetOnNotFoundOr404.class)
ListenableFuture<Set<Pod>> listPods(ListPodsOptions... options);
/**
@ -72,7 +72,7 @@ public interface GlobalPodAsyncClient {
@SelectJson("pod")
@OnlyElement
@Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
@Fallback(NullOnNotFoundOr404.class)
ListenableFuture<Pod> getPod(@QueryParam("id") String id);
/**
@ -91,7 +91,7 @@ public interface GlobalPodAsyncClient {
@QueryParams(keys = "command", values = "createPod")
@SelectJson("pod")
@Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
@Fallback(NullOnNotFoundOr404.class)
ListenableFuture<Pod> createPod(@QueryParam("name") String name, @QueryParam("zoneid") String zoneId, @QueryParam("startip") String startIp, @QueryParam("endip") String endIp, @QueryParam("gateway") String gateway, @QueryParam("netmask") String netmask, CreatePodOptions... createPodOptions);
/**
@ -109,7 +109,7 @@ public interface GlobalPodAsyncClient {
@QueryParams(keys = "command", values = "createPod")
@SelectJson("pod")
@Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
@Fallback(NullOnNotFoundOr404.class)
ListenableFuture<Pod> createPod(@QueryParam("name") String name, @QueryParam("zoneid") String zoneId, @QueryParam("startip") String startIp, @QueryParam("gateway") String gateway, @QueryParam("netmask") String netmask, CreatePodOptions... createPodOptions);
/**
@ -119,7 +119,7 @@ public interface GlobalPodAsyncClient {
@GET
@QueryParams(keys = "command", values = "deletePod")
@Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnVoidOnNotFoundOr404.class)
@Fallback(VoidOnNotFoundOr404.class)
ListenableFuture<Void> deletePod(@QueryParam("id") String id);
/**
@ -132,7 +132,7 @@ public interface GlobalPodAsyncClient {
@QueryParams(keys = "command", values = "updatePod")
@SelectJson("pod")
@Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
@Fallback(NullOnNotFoundOr404.class)
ListenableFuture<Pod> updatePod(@QueryParam("id") String id, UpdatePodOptions... updatePodOptions);
}

View File

@ -23,16 +23,16 @@ import javax.ws.rs.GET;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.cloudstack.domain.ApiKeyPair;
import org.jclouds.cloudstack.domain.User;
import org.jclouds.cloudstack.filters.AuthenticationFilter;
import org.jclouds.cloudstack.options.CreateUserOptions;
import org.jclouds.cloudstack.options.UpdateUserOptions;
import org.jclouds.rest.annotations.ExceptionParser;
import org.jclouds.rest.annotations.Fallback;
import org.jclouds.rest.annotations.QueryParams;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.SelectJson;
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
import com.google.common.util.concurrent.ListenableFuture;
@ -56,7 +56,7 @@ public interface GlobalUserAsyncClient extends DomainUserAsyncClient {
@QueryParams(keys = "command", values = "createUser")
@SelectJson("user")
@Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
@Fallback(NullOnNotFoundOr404.class)
ListenableFuture<User>createUser(@QueryParam("username") String userName, @QueryParam("account") String accountName,
@QueryParam("email") String email, @QueryParam("password") String hashedPassword,
@QueryParam("firstname") String firstName, @QueryParam("lastname") String lastName, CreateUserOptions... options);
@ -68,7 +68,7 @@ public interface GlobalUserAsyncClient extends DomainUserAsyncClient {
@QueryParams(keys = "command", values = "registerUserKeys")
@SelectJson("userkeys")
@Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
@Fallback(NullOnNotFoundOr404.class)
ListenableFuture<ApiKeyPair> registerUserKeys(@QueryParam("id") String userId);
/**
@ -78,7 +78,7 @@ public interface GlobalUserAsyncClient extends DomainUserAsyncClient {
@QueryParams(keys = "command", values = "updateUser")
@SelectJson("user")
@Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
@Fallback(NullOnNotFoundOr404.class)
ListenableFuture<User> updateUser(@QueryParam("id") String id, UpdateUserOptions... options);
/**
@ -87,6 +87,6 @@ public interface GlobalUserAsyncClient extends DomainUserAsyncClient {
@GET
@QueryParams(keys = "command", values = "deleteUser")
@Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
@Fallback(NullOnNotFoundOr404.class)
ListenableFuture<Void> deleteUser(@QueryParam("id") String id);
}

View File

@ -25,18 +25,18 @@ import javax.ws.rs.GET;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.Fallbacks.VoidOnNotFoundOr404;
import org.jclouds.cloudstack.domain.VlanIPRange;
import org.jclouds.cloudstack.filters.AuthenticationFilter;
import org.jclouds.cloudstack.options.CreateVlanIPRangeOptions;
import org.jclouds.cloudstack.options.ListVlanIPRangesOptions;
import org.jclouds.rest.annotations.ExceptionParser;
import org.jclouds.rest.annotations.Fallback;
import org.jclouds.rest.annotations.OnlyElement;
import org.jclouds.rest.annotations.QueryParams;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.SelectJson;
import org.jclouds.rest.functions.ReturnEmptySetOnNotFoundOr404;
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
import org.jclouds.rest.functions.ReturnVoidOnNotFoundOr404;
import com.google.common.util.concurrent.ListenableFuture;
@ -62,7 +62,7 @@ public interface GlobalVlanAsyncClient {
@SelectJson("vlaniprange")
@OnlyElement
@Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
@Fallback(NullOnNotFoundOr404.class)
ListenableFuture<VlanIPRange> getVlanIPRange(@QueryParam("id") String id);
/**
@ -75,7 +75,7 @@ public interface GlobalVlanAsyncClient {
@QueryParams(keys = { "command", "listAll" }, values = { "listVlanIpRanges", "true" })
@SelectJson("vlaniprange")
@Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
@Fallback(EmptySetOnNotFoundOr404.class)
ListenableFuture<Set<VlanIPRange>> listVlanIPRanges(ListVlanIPRangesOptions... options);
/**
@ -90,7 +90,7 @@ public interface GlobalVlanAsyncClient {
@QueryParams(keys = "command", values = "createVlanIpRange")
@SelectJson("vlaniprange")
@Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
@Fallback(NullOnNotFoundOr404.class)
ListenableFuture<VlanIPRange> createVlanIPRange(@QueryParam("startip") String startIP, @QueryParam("endip") String endIP, CreateVlanIPRangeOptions... options);
/**
@ -101,6 +101,6 @@ public interface GlobalVlanAsyncClient {
@GET
@QueryParams(keys = "command", values = "deleteVlanIpRange")
@Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnVoidOnNotFoundOr404.class)
@Fallback(VoidOnNotFoundOr404.class)
ListenableFuture<Void> deleteVlanIPRange(@QueryParam("id") String rangeId);
}

View File

@ -23,17 +23,17 @@ import javax.ws.rs.GET;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.Fallbacks.VoidOnNotFoundOr404;
import org.jclouds.cloudstack.domain.NetworkType;
import org.jclouds.cloudstack.domain.Zone;
import org.jclouds.cloudstack.filters.AuthenticationFilter;
import org.jclouds.cloudstack.options.CreateZoneOptions;
import org.jclouds.cloudstack.options.UpdateZoneOptions;
import org.jclouds.rest.annotations.ExceptionParser;
import org.jclouds.rest.annotations.Fallback;
import org.jclouds.rest.annotations.QueryParams;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.SelectJson;
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
import org.jclouds.rest.functions.ReturnVoidOnNotFoundOr404;
import com.google.common.util.concurrent.ListenableFuture;
@ -57,7 +57,7 @@ public interface GlobalZoneAsyncClient extends ZoneAsyncClient {
@QueryParams(keys = "command", values = "createZone")
@SelectJson("zone")
@Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
@Fallback(NullOnNotFoundOr404.class)
ListenableFuture<Zone> createZone(@QueryParam("name") String name, @QueryParam("networktype") NetworkType networkType,
@QueryParam("dns1") String externalDns1, @QueryParam("internaldns1") String internalDns1, CreateZoneOptions... options);
@ -68,7 +68,7 @@ public interface GlobalZoneAsyncClient extends ZoneAsyncClient {
@QueryParams(keys = "command", values = "updateZone")
@SelectJson("zone")
@Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
@Fallback(NullOnNotFoundOr404.class)
ListenableFuture<Zone> updateZone(@QueryParam("id") String id, UpdateZoneOptions... options);
/**
@ -77,6 +77,6 @@ public interface GlobalZoneAsyncClient extends ZoneAsyncClient {
@GET
@QueryParams(keys = "command", values = "deleteZone")
@Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnVoidOnNotFoundOr404.class)
@Fallback(VoidOnNotFoundOr404.class)
ListenableFuture<Void> deleteZone(@QueryParam("id") String id);
}

View File

@ -26,19 +26,19 @@ import javax.ws.rs.GET;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.cloudstack.domain.OSType;
import org.jclouds.cloudstack.filters.AuthenticationFilter;
import org.jclouds.cloudstack.functions.ParseIdToNameEntryFromHttpResponse;
import org.jclouds.cloudstack.functions.ParseIdToNameFromHttpResponse;
import org.jclouds.cloudstack.options.ListOSTypesOptions;
import org.jclouds.rest.annotations.ExceptionParser;
import org.jclouds.rest.annotations.Fallback;
import org.jclouds.rest.annotations.OnlyElement;
import org.jclouds.rest.annotations.QueryParams;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.ResponseParser;
import org.jclouds.rest.annotations.SelectJson;
import org.jclouds.rest.functions.ReturnEmptySetOnNotFoundOr404;
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
import com.google.common.util.concurrent.ListenableFuture;
@ -61,7 +61,7 @@ public interface GuestOSAsyncClient {
@QueryParams(keys = { "command", "listAll" }, values = { "listOsTypes", "true" })
@SelectJson("ostype")
@Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
@Fallback(EmptySetOnNotFoundOr404.class)
ListenableFuture<Set<OSType>> listOSTypes(ListOSTypesOptions... options);
/**
@ -72,7 +72,7 @@ public interface GuestOSAsyncClient {
@SelectJson("ostype")
@OnlyElement
@Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
@Fallback(NullOnNotFoundOr404.class)
ListenableFuture<OSType> getOSType(@QueryParam("id") String id);
/**
@ -81,7 +81,7 @@ public interface GuestOSAsyncClient {
@GET
@QueryParams(keys = { "command", "listAll" }, values = { "listOsCategories", "true" })
@ResponseParser(ParseIdToNameFromHttpResponse.class)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
@Fallback(EmptySetOnNotFoundOr404.class)
ListenableFuture<Map<String, String>> listOSCategories();
/**
@ -90,7 +90,7 @@ public interface GuestOSAsyncClient {
@GET
@QueryParams(keys = { "command", "listAll" }, values = { "listOsCategories", "true" })
@ResponseParser(ParseIdToNameEntryFromHttpResponse.class)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
@Fallback(NullOnNotFoundOr404.class)
ListenableFuture<Map.Entry<String, String>> getOSCategory(@QueryParam("id") String id);
}

View File

@ -23,13 +23,13 @@ import java.util.Set;
import javax.ws.rs.GET;
import javax.ws.rs.QueryParam;
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
import org.jclouds.cloudstack.filters.AuthenticationFilter;
import org.jclouds.cloudstack.functions.ParseNamesFromHttpResponse;
import org.jclouds.rest.annotations.ExceptionParser;
import org.jclouds.rest.annotations.Fallback;
import org.jclouds.rest.annotations.QueryParams;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.ResponseParser;
import org.jclouds.rest.functions.ReturnEmptySetOnNotFoundOr404;
import com.google.common.util.concurrent.ListenableFuture;
@ -51,7 +51,7 @@ public interface HypervisorAsyncClient {
@GET
@QueryParams(keys = { "command", "listAll" }, values = { "listHypervisors", "true" })
@ResponseParser(ParseNamesFromHttpResponse.class)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
@Fallback(EmptySetOnNotFoundOr404.class)
ListenableFuture<Set<String>> listHypervisors();
/**
@ -60,6 +60,6 @@ public interface HypervisorAsyncClient {
@GET
@QueryParams(keys = { "command", "listAll" }, values = { "listHypervisors", "true" })
@ResponseParser(ParseNamesFromHttpResponse.class)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
@Fallback(EmptySetOnNotFoundOr404.class)
ListenableFuture<Set<String>> listHypervisorsInZone(@QueryParam("zoneid") String zoneId);
}

View File

@ -25,6 +25,8 @@ import javax.ws.rs.GET;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.cloudstack.domain.AsyncCreateResponse;
import org.jclouds.cloudstack.domain.ExtractMode;
import org.jclouds.cloudstack.domain.ISO;
@ -37,14 +39,12 @@ import org.jclouds.cloudstack.options.ListISOsOptions;
import org.jclouds.cloudstack.options.RegisterISOOptions;
import org.jclouds.cloudstack.options.UpdateISOOptions;
import org.jclouds.cloudstack.options.UpdateISOPermissionsOptions;
import org.jclouds.rest.annotations.ExceptionParser;
import org.jclouds.rest.annotations.Fallback;
import org.jclouds.rest.annotations.OnlyElement;
import org.jclouds.rest.annotations.QueryParams;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.SelectJson;
import org.jclouds.rest.annotations.Unwrap;
import org.jclouds.rest.functions.ReturnEmptySetOnNotFoundOr404;
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
import com.google.common.util.concurrent.ListenableFuture;
@ -96,7 +96,7 @@ public interface ISOAsyncClient {
@QueryParams(keys = { "command", "listAll" }, values = { "listIsos", "true" })
@SelectJson("iso")
@OnlyElement
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
@Fallback(NullOnNotFoundOr404.class)
ListenableFuture<ISO> getISO(@QueryParam("id") String id);
/**
@ -109,7 +109,7 @@ public interface ISOAsyncClient {
@Consumes(MediaType.APPLICATION_JSON)
@QueryParams(keys = { "command", "listAll" }, values = { "listIsos", "true" })
@SelectJson("iso")
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
@Fallback(EmptySetOnNotFoundOr404.class)
ListenableFuture<Set<ISO>> listISOs(ListISOsOptions... options);
/**

View File

@ -24,14 +24,14 @@ import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.core.MediaType;
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
import org.jclouds.cloudstack.domain.ResourceLimit;
import org.jclouds.cloudstack.filters.AuthenticationFilter;
import org.jclouds.cloudstack.options.ListResourceLimitsOptions;
import org.jclouds.rest.annotations.ExceptionParser;
import org.jclouds.rest.annotations.Fallback;
import org.jclouds.rest.annotations.QueryParams;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.SelectJson;
import org.jclouds.rest.functions.ReturnEmptySetOnNotFoundOr404;
import com.google.common.util.concurrent.ListenableFuture;
@ -53,7 +53,7 @@ public interface LimitAsyncClient {
@QueryParams(keys = { "command", "listAll" }, values = { "listResourceLimits", "true" })
@SelectJson("resourcelimit")
@Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
@Fallback(EmptySetOnNotFoundOr404.class)
ListenableFuture<Set<ResourceLimit>> listResourceLimits(ListResourceLimitsOptions... options);
}

View File

@ -25,22 +25,22 @@ import javax.ws.rs.GET;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.cloudstack.domain.LoadBalancerRule;
import org.jclouds.cloudstack.domain.VirtualMachine;
import org.jclouds.cloudstack.domain.LoadBalancerRule.Algorithm;
import org.jclouds.cloudstack.domain.VirtualMachine;
import org.jclouds.cloudstack.filters.AuthenticationFilter;
import org.jclouds.cloudstack.options.CreateLoadBalancerRuleOptions;
import org.jclouds.cloudstack.options.ListLoadBalancerRulesOptions;
import org.jclouds.cloudstack.options.UpdateLoadBalancerRuleOptions;
import org.jclouds.functions.JoinOnComma;
import org.jclouds.rest.annotations.ExceptionParser;
import org.jclouds.rest.annotations.Fallback;
import org.jclouds.rest.annotations.OnlyElement;
import org.jclouds.rest.annotations.ParamParser;
import org.jclouds.rest.annotations.QueryParams;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.SelectJson;
import org.jclouds.rest.functions.ReturnEmptySetOnNotFoundOr404;
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
import com.google.common.util.concurrent.ListenableFuture;
@ -63,7 +63,7 @@ public interface LoadBalancerAsyncClient {
@QueryParams(keys = { "command", "listAll" }, values = { "listLoadBalancerRules", "true" })
@SelectJson("loadbalancerrule")
@Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
@Fallback(EmptySetOnNotFoundOr404.class)
ListenableFuture<Set<LoadBalancerRule>> listLoadBalancerRules(ListLoadBalancerRulesOptions... options);
/**
@ -74,7 +74,7 @@ public interface LoadBalancerAsyncClient {
@SelectJson("loadbalancerrule")
@OnlyElement
@Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
@Fallback(NullOnNotFoundOr404.class)
ListenableFuture<LoadBalancerRule> getLoadBalancerRule(@QueryParam("id") String id);
/**
@ -97,7 +97,7 @@ public interface LoadBalancerAsyncClient {
@SelectJson("loadbalancerrule")
@OnlyElement
@Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
@Fallback(NullOnNotFoundOr404.class)
ListenableFuture<LoadBalancerRule> updateLoadBalancerRule(@QueryParam("id") String id, UpdateLoadBalancerRuleOptions... options);
/**
@ -107,7 +107,7 @@ public interface LoadBalancerAsyncClient {
@QueryParams(keys = "command", values = "deleteLoadBalancerRule")
@SelectJson("jobid")
@Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
@Fallback(NullOnNotFoundOr404.class)
ListenableFuture<String> deleteLoadBalancerRule(@QueryParam("id") String id);
/**
@ -115,7 +115,7 @@ public interface LoadBalancerAsyncClient {
*/
@GET
@QueryParams(keys = "command", values = "assignToLoadBalancerRule")
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
@Fallback(NullOnNotFoundOr404.class)
@SelectJson("jobid")
@Consumes(MediaType.APPLICATION_JSON)
ListenableFuture<String> assignVirtualMachinesToLoadBalancerRule(@QueryParam("id") String id,
@ -126,7 +126,7 @@ public interface LoadBalancerAsyncClient {
*/
@GET
@QueryParams(keys = "command", values = "assignToLoadBalancerRule")
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
@Fallback(NullOnNotFoundOr404.class)
@SelectJson("jobid")
@Consumes(MediaType.APPLICATION_JSON)
ListenableFuture<String> assignVirtualMachinesToLoadBalancerRule(@QueryParam("id") String id,
@ -137,7 +137,7 @@ public interface LoadBalancerAsyncClient {
*/
@GET
@QueryParams(keys = "command", values = "removeFromLoadBalancerRule")
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
@Fallback(NullOnNotFoundOr404.class)
@SelectJson("jobid")
@Consumes(MediaType.APPLICATION_JSON)
ListenableFuture<String> removeVirtualMachinesFromLoadBalancerRule(@QueryParam("id") String id,
@ -148,7 +148,7 @@ public interface LoadBalancerAsyncClient {
*/
@GET
@QueryParams(keys = "command", values = "removeFromLoadBalancerRule")
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
@Fallback(NullOnNotFoundOr404.class)
@SelectJson("jobid")
@Consumes(MediaType.APPLICATION_JSON)
ListenableFuture<String> removeVirtualMachinesFromLoadBalancerRule(@QueryParam("id") String id,
@ -161,7 +161,7 @@ public interface LoadBalancerAsyncClient {
@QueryParams(keys = { "command", "listAll" }, values = { "listLoadBalancerRuleInstances", "true" })
@SelectJson("loadbalancerruleinstance")
@Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
@Fallback(EmptySetOnNotFoundOr404.class)
ListenableFuture<Set<VirtualMachine>> listVirtualMachinesAssignedToLoadBalancerRule(@QueryParam("id") String id);
}

View File

@ -25,19 +25,19 @@ import javax.ws.rs.GET;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.cloudstack.domain.AsyncCreateResponse;
import org.jclouds.cloudstack.domain.IPForwardingRule;
import org.jclouds.cloudstack.filters.AuthenticationFilter;
import org.jclouds.cloudstack.options.CreateIPForwardingRuleOptions;
import org.jclouds.cloudstack.options.ListIPForwardingRulesOptions;
import org.jclouds.rest.annotations.ExceptionParser;
import org.jclouds.rest.annotations.Fallback;
import org.jclouds.rest.annotations.OnlyElement;
import org.jclouds.rest.annotations.QueryParams;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.SelectJson;
import org.jclouds.rest.annotations.Unwrap;
import org.jclouds.rest.functions.ReturnEmptySetOnNotFoundOr404;
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
import com.google.common.util.concurrent.ListenableFuture;
@ -62,7 +62,7 @@ public interface NATAsyncClient {
@QueryParams(keys = { "command", "listAll" }, values = { "listIpForwardingRules", "true" })
@SelectJson("ipforwardingrule")
@Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
@Fallback(EmptySetOnNotFoundOr404.class)
ListenableFuture<Set<IPForwardingRule>> listIPForwardingRules(ListIPForwardingRulesOptions... options);
/**
@ -73,7 +73,7 @@ public interface NATAsyncClient {
@SelectJson("ipforwardingrule")
@OnlyElement
@Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
@Fallback(NullOnNotFoundOr404.class)
ListenableFuture<IPForwardingRule> getIPForwardingRule(@QueryParam("id") String id);
/**
@ -121,7 +121,7 @@ public interface NATAsyncClient {
@QueryParams(keys = "command", values = "deleteIpForwardingRule")
@SelectJson("jobid")
@Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
@Fallback(NullOnNotFoundOr404.class)
ListenableFuture<String> deleteIPForwardingRule(@QueryParam("id") String id);
/**

View File

@ -25,17 +25,17 @@ import javax.ws.rs.GET;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.cloudstack.domain.Network;
import org.jclouds.cloudstack.filters.AuthenticationFilter;
import org.jclouds.cloudstack.options.CreateNetworkOptions;
import org.jclouds.cloudstack.options.ListNetworksOptions;
import org.jclouds.rest.annotations.ExceptionParser;
import org.jclouds.rest.annotations.Fallback;
import org.jclouds.rest.annotations.OnlyElement;
import org.jclouds.rest.annotations.QueryParams;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.SelectJson;
import org.jclouds.rest.functions.ReturnEmptySetOnNotFoundOr404;
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
import com.google.common.util.concurrent.ListenableFuture;
@ -58,7 +58,7 @@ public interface NetworkAsyncClient {
@QueryParams(keys = { "command", "listAll" }, values = { "listNetworks", "true" })
@SelectJson("network")
@Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
@Fallback(EmptySetOnNotFoundOr404.class)
ListenableFuture<Set<Network>> listNetworks(ListNetworksOptions... options);
/**
@ -69,7 +69,7 @@ public interface NetworkAsyncClient {
@SelectJson("network")
@OnlyElement
@Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
@Fallback(NullOnNotFoundOr404.class)
ListenableFuture<Network> getNetwork(@QueryParam("id") String id);
/**
@ -90,6 +90,6 @@ public interface NetworkAsyncClient {
@QueryParams(keys = "command", values = "deleteNetwork")
@SelectJson("jobid")
@Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
@Fallback(NullOnNotFoundOr404.class)
ListenableFuture<String> deleteNetwork(@QueryParam("id") String id);
}

View File

@ -25,6 +25,8 @@ import javax.ws.rs.GET;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.cloudstack.domain.DiskOffering;
import org.jclouds.cloudstack.domain.NetworkOffering;
import org.jclouds.cloudstack.domain.ServiceOffering;
@ -32,13 +34,11 @@ import org.jclouds.cloudstack.filters.AuthenticationFilter;
import org.jclouds.cloudstack.options.ListDiskOfferingsOptions;
import org.jclouds.cloudstack.options.ListNetworkOfferingsOptions;
import org.jclouds.cloudstack.options.ListServiceOfferingsOptions;
import org.jclouds.rest.annotations.ExceptionParser;
import org.jclouds.rest.annotations.Fallback;
import org.jclouds.rest.annotations.OnlyElement;
import org.jclouds.rest.annotations.QueryParams;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.SelectJson;
import org.jclouds.rest.functions.ReturnEmptySetOnNotFoundOr404;
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
import com.google.common.util.concurrent.ListenableFuture;
@ -61,7 +61,7 @@ public interface OfferingAsyncClient {
@QueryParams(keys = { "command", "listAll" }, values = { "listServiceOfferings", "true" })
@SelectJson("serviceoffering")
@Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
@Fallback(EmptySetOnNotFoundOr404.class)
ListenableFuture<Set<ServiceOffering>> listServiceOfferings(ListServiceOfferingsOptions... options);
/**
@ -72,7 +72,7 @@ public interface OfferingAsyncClient {
@SelectJson("serviceoffering")
@OnlyElement
@Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
@Fallback(NullOnNotFoundOr404.class)
ListenableFuture<ServiceOffering> getServiceOffering(@QueryParam("id") String id);
/**
@ -82,7 +82,7 @@ public interface OfferingAsyncClient {
@QueryParams(keys = { "command", "listAll" }, values = { "listDiskOfferings", "true" })
@SelectJson("diskoffering")
@Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
@Fallback(EmptySetOnNotFoundOr404.class)
ListenableFuture<Set<DiskOffering>> listDiskOfferings(ListDiskOfferingsOptions... options);
/**
@ -93,7 +93,7 @@ public interface OfferingAsyncClient {
@SelectJson("diskoffering")
@OnlyElement
@Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
@Fallback(NullOnNotFoundOr404.class)
ListenableFuture<DiskOffering> getDiskOffering(@QueryParam("id") String id);
/**
@ -103,7 +103,7 @@ public interface OfferingAsyncClient {
@QueryParams(keys = { "command", "listAll" }, values = { "listNetworkOfferings", "true" })
@SelectJson("networkoffering")
@Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
@Fallback(EmptySetOnNotFoundOr404.class)
ListenableFuture<Set<NetworkOffering>> listNetworkOfferings(ListNetworkOfferingsOptions... options);
/**
@ -114,7 +114,7 @@ public interface OfferingAsyncClient {
@SelectJson("networkoffering")
@OnlyElement
@Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
@Fallback(NullOnNotFoundOr404.class)
ListenableFuture<NetworkOffering> getNetworkOffering(@QueryParam("id") String id);
}

View File

@ -25,17 +25,17 @@ import javax.ws.rs.GET;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.Fallbacks.VoidOnNotFoundOr404;
import org.jclouds.cloudstack.domain.SshKeyPair;
import org.jclouds.cloudstack.filters.AuthenticationFilter;
import org.jclouds.cloudstack.options.ListSSHKeyPairsOptions;
import org.jclouds.rest.annotations.ExceptionParser;
import org.jclouds.rest.annotations.Fallback;
import org.jclouds.rest.annotations.OnlyElement;
import org.jclouds.rest.annotations.QueryParams;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.SelectJson;
import org.jclouds.rest.functions.ReturnEmptySetOnNotFoundOr404;
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
import org.jclouds.rest.functions.ReturnVoidOnNotFoundOr404;
import com.google.common.util.concurrent.ListenableFuture;
@ -57,7 +57,7 @@ public interface SSHKeyPairAsyncClient {
@QueryParams(keys = { "command", "listAll" }, values = { "listSSHKeyPairs", "true" })
@SelectJson("sshkeypair")
@Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
@Fallback(EmptySetOnNotFoundOr404.class)
ListenableFuture<Set<SshKeyPair>> listSSHKeyPairs(ListSSHKeyPairsOptions... options);
/**
@ -86,7 +86,7 @@ public interface SSHKeyPairAsyncClient {
@SelectJson("sshkeypair")
@OnlyElement()
@Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
@Fallback(NullOnNotFoundOr404.class)
ListenableFuture<SshKeyPair> getSSHKeyPair(@QueryParam("name") String name);
/**
@ -94,7 +94,7 @@ public interface SSHKeyPairAsyncClient {
*/
@GET
@QueryParams(keys = "command", values = "deleteSSHKeyPair")
@ExceptionParser(ReturnVoidOnNotFoundOr404.class)
@Fallback(VoidOnNotFoundOr404.class)
ListenableFuture<Void> deleteSSHKeyPair(@QueryParam("name") String name);
}

View File

@ -25,6 +25,9 @@ import javax.ws.rs.GET;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.Fallbacks.VoidOnNotFoundOr404;
import org.jclouds.cloudstack.binders.BindAccountSecurityGroupPairsToIndexedQueryParams;
import org.jclouds.cloudstack.binders.BindCIDRsToCommaDelimitedQueryParam;
import org.jclouds.cloudstack.domain.SecurityGroup;
@ -32,14 +35,11 @@ import org.jclouds.cloudstack.filters.AuthenticationFilter;
import org.jclouds.cloudstack.options.AccountInDomainOptions;
import org.jclouds.cloudstack.options.ListSecurityGroupsOptions;
import org.jclouds.rest.annotations.BinderParam;
import org.jclouds.rest.annotations.ExceptionParser;
import org.jclouds.rest.annotations.Fallback;
import org.jclouds.rest.annotations.OnlyElement;
import org.jclouds.rest.annotations.QueryParams;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.SelectJson;
import org.jclouds.rest.functions.ReturnEmptySetOnNotFoundOr404;
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
import org.jclouds.rest.functions.ReturnVoidOnNotFoundOr404;
import com.google.common.collect.Multimap;
import com.google.common.util.concurrent.ListenableFuture;
@ -63,7 +63,7 @@ public interface SecurityGroupAsyncClient {
@QueryParams(keys = { "command", "listAll" }, values = { "listSecurityGroups", "true" })
@SelectJson("securitygroup")
@Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
@Fallback(EmptySetOnNotFoundOr404.class)
ListenableFuture<Set<SecurityGroup>> listSecurityGroups(ListSecurityGroupsOptions... options);
/**
@ -74,7 +74,7 @@ public interface SecurityGroupAsyncClient {
@SelectJson("securitygroup")
@OnlyElement
@Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
@Fallback(NullOnNotFoundOr404.class)
ListenableFuture<SecurityGroup> getSecurityGroup(@QueryParam("id") String id);
/**
@ -141,7 +141,7 @@ public interface SecurityGroupAsyncClient {
*/
@GET
@QueryParams(keys = "command", values = "revokeSecurityGroupIngress")
@ExceptionParser(ReturnVoidOnNotFoundOr404.class)
@Fallback(VoidOnNotFoundOr404.class)
@SelectJson("jobid")
@Consumes(MediaType.APPLICATION_JSON)
ListenableFuture<String> revokeIngressRule(@QueryParam("id") String id, AccountInDomainOptions... options);
@ -151,7 +151,7 @@ public interface SecurityGroupAsyncClient {
*/
@GET
@QueryParams(keys = "command", values = "deleteSecurityGroup")
@ExceptionParser(ReturnVoidOnNotFoundOr404.class)
@Fallback(VoidOnNotFoundOr404.class)
ListenableFuture<Void> deleteSecurityGroup(@QueryParam("id") String id);
}

View File

@ -23,13 +23,13 @@ import javax.ws.rs.GET;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.Fallbacks.VoidOnNotFoundOr404;
import org.jclouds.cloudstack.domain.LoginResponse;
import org.jclouds.cloudstack.functions.ParseLoginResponseFromHttpResponse;
import org.jclouds.rest.annotations.ExceptionParser;
import org.jclouds.rest.annotations.Fallback;
import org.jclouds.rest.annotations.QueryParams;
import org.jclouds.rest.annotations.ResponseParser;
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
import org.jclouds.rest.functions.ReturnVoidOnNotFoundOr404;
import com.google.common.util.concurrent.ListenableFuture;
@ -51,7 +51,7 @@ public interface SessionAsyncClient {
@QueryParams(keys = "command", values = "login")
@ResponseParser(ParseLoginResponseFromHttpResponse.class)
@Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
@Fallback(NullOnNotFoundOr404.class)
ListenableFuture<LoginResponse> loginUserInDomainWithHashOfPassword(@QueryParam("username") String userName,
@QueryParam("domain") String domain, @QueryParam("password") String hashedPassword);
@ -60,6 +60,6 @@ public interface SessionAsyncClient {
*/
@GET
@QueryParams(keys = "command", values = "logout")
@ExceptionParser(ReturnVoidOnNotFoundOr404.class)
@Fallback(VoidOnNotFoundOr404.class)
ListenableFuture<Void> logoutUser(@QueryParam("sessionkey") String sessionKey);
}

View File

@ -25,6 +25,9 @@ import javax.ws.rs.GET;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.Fallbacks.VoidOnNotFoundOr404;
import org.jclouds.cloudstack.binders.BindIdListToCommaDelimitedQueryParam;
import org.jclouds.cloudstack.binders.BindSnapshotPolicyScheduleToQueryParam;
import org.jclouds.cloudstack.domain.AsyncCreateResponse;
@ -36,15 +39,12 @@ import org.jclouds.cloudstack.options.CreateSnapshotOptions;
import org.jclouds.cloudstack.options.ListSnapshotPoliciesOptions;
import org.jclouds.cloudstack.options.ListSnapshotsOptions;
import org.jclouds.rest.annotations.BinderParam;
import org.jclouds.rest.annotations.ExceptionParser;
import org.jclouds.rest.annotations.Fallback;
import org.jclouds.rest.annotations.OnlyElement;
import org.jclouds.rest.annotations.QueryParams;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.SelectJson;
import org.jclouds.rest.annotations.Unwrap;
import org.jclouds.rest.functions.ReturnEmptySetOnNotFoundOr404;
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
import org.jclouds.rest.functions.ReturnVoidOnNotFoundOr404;
import com.google.common.util.concurrent.ListenableFuture;
@ -84,7 +84,7 @@ public interface SnapshotAsyncClient {
@QueryParams(keys = { "command", "listAll" }, values = { "listSnapshots", "true" })
@SelectJson("snapshot")
@Unwrap
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
@Fallback(EmptySetOnNotFoundOr404.class)
ListenableFuture<Set<Snapshot>> listSnapshots(ListSnapshotsOptions... options);
/**
@ -98,7 +98,7 @@ public interface SnapshotAsyncClient {
@QueryParams(keys = { "command", "listAll" }, values = { "listSnapshots", "true" })
@SelectJson("snapshot")
@OnlyElement
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
@Fallback(NullOnNotFoundOr404.class)
ListenableFuture<Snapshot> getSnapshot(@QueryParam("id") String id);
/**
@ -110,7 +110,7 @@ public interface SnapshotAsyncClient {
@GET
@Consumes(MediaType.APPLICATION_JSON)
@QueryParams(keys = "command", values = "deleteSnapshot")
@ExceptionParser(ReturnVoidOnNotFoundOr404.class)
@Fallback(VoidOnNotFoundOr404.class)
ListenableFuture<Void> deleteSnapshot(@QueryParam("id") String id);
/**
@ -137,7 +137,7 @@ public interface SnapshotAsyncClient {
@GET
@Consumes(MediaType.APPLICATION_JSON)
@QueryParams(keys = "command", values = "deleteSnapshotPolicies")
@ExceptionParser(ReturnVoidOnNotFoundOr404.class)
@Fallback(VoidOnNotFoundOr404.class)
ListenableFuture<Void> deleteSnapshotPolicy(@QueryParam("id") String id);
/**
@ -149,7 +149,7 @@ public interface SnapshotAsyncClient {
@GET
@Consumes(MediaType.APPLICATION_JSON)
@QueryParams(keys = "command", values = "deleteSnapshotPolicies")
@ExceptionParser(ReturnVoidOnNotFoundOr404.class)
@Fallback(VoidOnNotFoundOr404.class)
ListenableFuture<Void> deleteSnapshotPolicies(@BinderParam(BindIdListToCommaDelimitedQueryParam.class) Iterable<String> id);
/**
@ -163,6 +163,6 @@ public interface SnapshotAsyncClient {
@Consumes(MediaType.APPLICATION_JSON)
@QueryParams(keys = { "command", "listAll" }, values = { "listSnapshotPolicies", "true" })
@Unwrap
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
@Fallback(EmptySetOnNotFoundOr404.class)
ListenableFuture<Set<SnapshotPolicy>> listSnapshotPolicies(@QueryParam("volumeid") String volumeId, ListSnapshotPoliciesOptions... options);
}

View File

@ -25,6 +25,8 @@ import javax.ws.rs.GET;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.cloudstack.binders.BindTemplateMetadataToQueryParams;
import org.jclouds.cloudstack.domain.AsyncCreateResponse;
import org.jclouds.cloudstack.domain.ExtractMode;
@ -41,14 +43,12 @@ import org.jclouds.cloudstack.options.RegisterTemplateOptions;
import org.jclouds.cloudstack.options.UpdateTemplateOptions;
import org.jclouds.cloudstack.options.UpdateTemplatePermissionsOptions;
import org.jclouds.rest.annotations.BinderParam;
import org.jclouds.rest.annotations.ExceptionParser;
import org.jclouds.rest.annotations.Fallback;
import org.jclouds.rest.annotations.OnlyElement;
import org.jclouds.rest.annotations.QueryParams;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.SelectJson;
import org.jclouds.rest.annotations.Unwrap;
import org.jclouds.rest.functions.ReturnEmptySetOnNotFoundOr404;
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
import com.google.common.util.concurrent.ListenableFuture;
@ -124,7 +124,7 @@ public interface TemplateAsyncClient {
@QueryParams(keys = { "command", "listAll", "templatefilter" }, values = { "listTemplates", "true", "executable" })
@SelectJson("template")
@Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
@Fallback(EmptySetOnNotFoundOr404.class)
ListenableFuture<Set<Template>> listTemplates();
/**
@ -134,7 +134,7 @@ public interface TemplateAsyncClient {
@QueryParams(keys = { "command", "listAll" }, values = { "listTemplates", "true" })
@SelectJson("template")
@Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
@Fallback(EmptySetOnNotFoundOr404.class)
ListenableFuture<Set<Template>> listTemplates(ListTemplatesOptions options);
/**
@ -146,7 +146,7 @@ public interface TemplateAsyncClient {
@SelectJson("template")
@OnlyElement
@Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
@Fallback(NullOnNotFoundOr404.class)
ListenableFuture<Template> getTemplateInZone(@QueryParam("id") String templateId, @QueryParam("zoneid") String zoneId);
/**

View File

@ -25,19 +25,19 @@ import javax.ws.rs.GET;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.Fallbacks.VoidOnNotFoundOr404;
import org.jclouds.cloudstack.domain.VMGroup;
import org.jclouds.cloudstack.filters.AuthenticationFilter;
import org.jclouds.cloudstack.options.CreateVMGroupOptions;
import org.jclouds.cloudstack.options.ListVMGroupsOptions;
import org.jclouds.cloudstack.options.UpdateVMGroupOptions;
import org.jclouds.rest.annotations.ExceptionParser;
import org.jclouds.rest.annotations.Fallback;
import org.jclouds.rest.annotations.OnlyElement;
import org.jclouds.rest.annotations.QueryParams;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.SelectJson;
import org.jclouds.rest.functions.ReturnEmptySetOnNotFoundOr404;
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
import org.jclouds.rest.functions.ReturnVoidOnNotFoundOr404;
import com.google.common.util.concurrent.ListenableFuture;
@ -62,7 +62,7 @@ public interface VMGroupAsyncClient {
@QueryParams(keys = { "command", "listAll" }, values = { "listInstanceGroups", "true" })
@SelectJson("instancegroup")
@Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
@Fallback(EmptySetOnNotFoundOr404.class)
ListenableFuture<Set<VMGroup>> listInstanceGroups(ListVMGroupsOptions... options);
/**
@ -73,7 +73,7 @@ public interface VMGroupAsyncClient {
@SelectJson("instancegroup")
@OnlyElement
@Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
@Fallback(NullOnNotFoundOr404.class)
ListenableFuture<VMGroup> getInstanceGroup(@QueryParam("id") String id);
/**
@ -109,6 +109,6 @@ public interface VMGroupAsyncClient {
*/
@GET
@QueryParams(keys = "command", values = "deleteInstanceGroup")
@ExceptionParser(ReturnVoidOnNotFoundOr404.class)
@Fallback(VoidOnNotFoundOr404.class)
ListenableFuture<Void> deleteInstanceGroup(@QueryParam("id") String id);
}

View File

@ -25,20 +25,20 @@ import javax.ws.rs.GET;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.cloudstack.domain.AsyncCreateResponse;
import org.jclouds.cloudstack.domain.VirtualMachine;
import org.jclouds.cloudstack.filters.AuthenticationFilter;
import org.jclouds.cloudstack.options.AssignVirtualMachineOptions;
import org.jclouds.cloudstack.options.DeployVirtualMachineOptions;
import org.jclouds.cloudstack.options.ListVirtualMachinesOptions;
import org.jclouds.rest.annotations.ExceptionParser;
import org.jclouds.rest.annotations.Fallback;
import org.jclouds.rest.annotations.OnlyElement;
import org.jclouds.rest.annotations.QueryParams;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.SelectJson;
import org.jclouds.rest.annotations.Unwrap;
import org.jclouds.rest.functions.ReturnEmptySetOnNotFoundOr404;
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
import com.google.common.util.concurrent.ListenableFuture;
@ -61,7 +61,7 @@ public interface VirtualMachineAsyncClient {
@QueryParams(keys = { "command", "listAll" }, values = { "listVirtualMachines", "true" })
@SelectJson("virtualmachine")
@Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
@Fallback(EmptySetOnNotFoundOr404.class)
ListenableFuture<Set<VirtualMachine>> listVirtualMachines(ListVirtualMachinesOptions... options);
/**
@ -72,7 +72,7 @@ public interface VirtualMachineAsyncClient {
@SelectJson("virtualmachine")
@OnlyElement
@Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
@Fallback(NullOnNotFoundOr404.class)
ListenableFuture<VirtualMachine> getVirtualMachine(@QueryParam("id") String id);
/**
@ -156,7 +156,7 @@ public interface VirtualMachineAsyncClient {
@QueryParams(keys = "command", values = "destroyVirtualMachine")
@SelectJson("jobid")
@Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
@Fallback(NullOnNotFoundOr404.class)
ListenableFuture<String> destroyVirtualMachine(@QueryParam("id") String id);
/**

View File

@ -25,19 +25,19 @@ import javax.ws.rs.GET;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.Fallbacks.VoidOnNotFoundOr404;
import org.jclouds.cloudstack.domain.AsyncCreateResponse;
import org.jclouds.cloudstack.domain.Volume;
import org.jclouds.cloudstack.filters.AuthenticationFilter;
import org.jclouds.cloudstack.options.ListVolumesOptions;
import org.jclouds.rest.annotations.ExceptionParser;
import org.jclouds.rest.annotations.Fallback;
import org.jclouds.rest.annotations.OnlyElement;
import org.jclouds.rest.annotations.QueryParams;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.SelectJson;
import org.jclouds.rest.annotations.Unwrap;
import org.jclouds.rest.functions.ReturnEmptySetOnNotFoundOr404;
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
import org.jclouds.rest.functions.ReturnVoidOnNotFoundOr404;
import com.google.common.util.concurrent.ListenableFuture;
@ -59,7 +59,7 @@ public interface VolumeAsyncClient {
@QueryParams(keys = { "command", "listAll" }, values = { "listVolumes", "true" })
@SelectJson("volume")
@Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
@Fallback(EmptySetOnNotFoundOr404.class)
ListenableFuture<Set<Volume>> listVolumes(ListVolumesOptions... options);
/**
@ -70,7 +70,7 @@ public interface VolumeAsyncClient {
@QueryParams(keys = { "command", "listAll" }, values = { "listVolumes", "true" })
@SelectJson("volume")
@OnlyElement
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
@Fallback(NullOnNotFoundOr404.class)
ListenableFuture<Volume> getVolume(@QueryParam("id") String id);
@ -120,7 +120,7 @@ public interface VolumeAsyncClient {
*/
@GET
@QueryParams(keys = "command", values = "deleteVolume")
@ExceptionParser(ReturnVoidOnNotFoundOr404.class)
@Fallback(VoidOnNotFoundOr404.class)
ListenableFuture<Void> deleteVolume(@QueryParam("id") String id);
}

View File

@ -25,16 +25,16 @@ import javax.ws.rs.GET;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.cloudstack.domain.Zone;
import org.jclouds.cloudstack.filters.AuthenticationFilter;
import org.jclouds.cloudstack.options.ListZonesOptions;
import org.jclouds.rest.annotations.ExceptionParser;
import org.jclouds.rest.annotations.Fallback;
import org.jclouds.rest.annotations.OnlyElement;
import org.jclouds.rest.annotations.QueryParams;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.SelectJson;
import org.jclouds.rest.functions.ReturnEmptySetOnNotFoundOr404;
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
import com.google.common.util.concurrent.ListenableFuture;
@ -57,7 +57,7 @@ public interface ZoneAsyncClient {
@QueryParams(keys = { "command", "listAll" }, values = { "listZones", "true" })
@SelectJson("zone")
@Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
@Fallback(EmptySetOnNotFoundOr404.class)
ListenableFuture<Set<Zone>> listZones(ListZonesOptions... options);
/**
@ -68,7 +68,7 @@ public interface ZoneAsyncClient {
@SelectJson("zone")
@OnlyElement
@Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
@Fallback(NullOnNotFoundOr404.class)
ListenableFuture<Zone> getZone(@QueryParam("id") String id);
}

View File

@ -0,0 +1,49 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.cloudstack.functions;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.util.concurrent.Futures.immediateFuture;
import static org.jclouds.util.Throwables2.getFirstThrowableOfType;
import org.jclouds.Fallbacks;
import com.google.common.util.concurrent.FutureFallback;
import com.google.common.util.concurrent.ListenableFuture;
public final class CloudStackFallbacks {
private CloudStackFallbacks() {
}
/**
* CloudStack is currently sending 431 errors with the text "Unable to find account owner for ip ". In this case, we
* have to ignore as there's no means for us to avoid the problem, or action to take.
*/
public static final class VoidOnNotFoundOr404OrUnableToFindAccountOwner implements FutureFallback<Void> {
@Override
public ListenableFuture<Void> create(final Throwable t) {
IllegalStateException e = getFirstThrowableOfType(checkNotNull(t, "throwable"), IllegalStateException.class);
if (e != null && e.getMessage().indexOf("Unable to find account owner for") != -1) {
return immediateFuture(null);
} else {
return Fallbacks.valOnNotFoundOr404(null, t);
}
}
}
}

View File

@ -1,56 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.cloudstack.functions;
import static com.google.common.base.Preconditions.checkNotNull;
import javax.inject.Inject;
import javax.inject.Singleton;
import org.jclouds.rest.functions.ReturnVoidOnNotFoundOr404;
import org.jclouds.util.Throwables2;
import com.google.common.base.Function;
/**
* CloudStack is currently sending 431 errors with the text
* "Unable to find account owner for ip ". In this case, we have to ignore as
* there's no means for us to avoid the problem, or action to take.
*
* @author Adrian Cole
*/
@Singleton
public class ReturnVoidOnNotFoundOr404OrUnableToFindAccountOwner implements Function<Exception, Void> {
private final ReturnVoidOnNotFoundOr404 rto404;
@Inject
private ReturnVoidOnNotFoundOr404OrUnableToFindAccountOwner(ReturnVoidOnNotFoundOr404 rto404) {
this.rto404 = checkNotNull(rto404, "rto404");
}
public Void apply(Exception from) {
IllegalStateException e = Throwables2.getFirstThrowableOfType(from, IllegalStateException.class);
if (e != null && e.getMessage().indexOf("Unable to find account owner for") != -1) {
return null;
} else {
return rto404.apply(from);
}
}
}

View File

@ -21,13 +21,13 @@ package org.jclouds.cloudstack.features;
import java.io.IOException;
import java.lang.reflect.Method;
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.cloudstack.internal.BaseCloudStackAsyncClientTest;
import org.jclouds.cloudstack.options.ListAccountsOptions;
import org.jclouds.functions.IdentityFunction;
import org.jclouds.http.HttpRequest;
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
import org.jclouds.rest.functions.ReturnEmptySetOnNotFoundOr404;
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
import org.jclouds.rest.internal.RestAnnotationProcessor;
import org.testng.annotations.Test;
@ -55,7 +55,7 @@ public class AccountAsyncClientTest extends BaseCloudStackAsyncClientTest<Accoun
assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class);
assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
checkFilters(httpRequest);
@ -73,7 +73,7 @@ public class AccountAsyncClientTest extends BaseCloudStackAsyncClientTest<Accoun
assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class);
assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
checkFilters(httpRequest);
@ -91,7 +91,7 @@ public class AccountAsyncClientTest extends BaseCloudStackAsyncClientTest<Accoun
assertResponseParserClassEquals(method, httpRequest,
Functions.compose(IdentityFunction.INSTANCE, IdentityFunction.INSTANCE).getClass());
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
checkFilters(httpRequest);

View File

@ -21,18 +21,18 @@ package org.jclouds.cloudstack.features;
import java.io.IOException;
import java.lang.reflect.Method;
import org.jclouds.cloudstack.functions.ReturnVoidOnNotFoundOr404OrUnableToFindAccountOwner;
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.cloudstack.functions.CloudStackFallbacks.VoidOnNotFoundOr404OrUnableToFindAccountOwner;
import org.jclouds.cloudstack.internal.BaseCloudStackAsyncClientTest;
import org.jclouds.cloudstack.options.AssociateIPAddressOptions;
import org.jclouds.cloudstack.options.ListPublicIPAddressesOptions;
import org.jclouds.fallbacks.MapHttp4xxCodesToExceptions;
import org.jclouds.functions.IdentityFunction;
import org.jclouds.http.HttpRequest;
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
import org.jclouds.http.functions.ReleasePayloadAndReturn;
import org.jclouds.http.functions.UnwrapOnlyJsonValue;
import org.jclouds.rest.functions.MapHttp4xxCodesToExceptions;
import org.jclouds.rest.functions.ReturnEmptySetOnNotFoundOr404;
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
import org.jclouds.rest.internal.RestAnnotationProcessor;
import org.testng.annotations.Test;
@ -59,7 +59,7 @@ public class AddressAsyncClientTest extends BaseCloudStackAsyncClientTest<Addres
assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class);
assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
checkFilters(httpRequest);
@ -78,7 +78,7 @@ public class AddressAsyncClientTest extends BaseCloudStackAsyncClientTest<Addres
assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class);
assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
checkFilters(httpRequest);
@ -96,7 +96,7 @@ public class AddressAsyncClientTest extends BaseCloudStackAsyncClientTest<Addres
assertResponseParserClassEquals(method, httpRequest,
Functions.compose(IdentityFunction.INSTANCE, IdentityFunction.INSTANCE).getClass());
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
checkFilters(httpRequest);
@ -114,7 +114,7 @@ public class AddressAsyncClientTest extends BaseCloudStackAsyncClientTest<Addres
assertResponseParserClassEquals(method, httpRequest, UnwrapOnlyJsonValue.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class);
assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
checkFilters(httpRequest);
@ -131,7 +131,7 @@ public class AddressAsyncClientTest extends BaseCloudStackAsyncClientTest<Addres
assertResponseParserClassEquals(method, httpRequest, ReleasePayloadAndReturn.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnVoidOnNotFoundOr404OrUnableToFindAccountOwner.class);
assertFallbackClassEquals(method, VoidOnNotFoundOr404OrUnableToFindAccountOwner.class);
checkFilters(httpRequest);

View File

@ -21,13 +21,13 @@ package org.jclouds.cloudstack.features;
import java.io.IOException;
import java.lang.reflect.Method;
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.cloudstack.functions.ParseAsyncJobFromHttpResponse;
import org.jclouds.cloudstack.functions.ParseAsyncJobsFromHttpResponse;
import org.jclouds.cloudstack.internal.BaseCloudStackAsyncClientTest;
import org.jclouds.cloudstack.options.ListAsyncJobsOptions;
import org.jclouds.http.HttpRequest;
import org.jclouds.rest.functions.ReturnEmptySetOnNotFoundOr404;
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
import org.jclouds.rest.internal.RestAnnotationProcessor;
import org.testng.annotations.Test;
@ -54,7 +54,7 @@ public class AsyncJobAsyncClientTest extends BaseCloudStackAsyncClientTest<Async
assertResponseParserClassEquals(method, httpRequest, ParseAsyncJobFromHttpResponse.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
checkFilters(httpRequest);
@ -71,7 +71,7 @@ public class AsyncJobAsyncClientTest extends BaseCloudStackAsyncClientTest<Async
assertResponseParserClassEquals(method, httpRequest, ParseAsyncJobsFromHttpResponse.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class);
assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
checkFilters(httpRequest);
@ -89,7 +89,7 @@ public class AsyncJobAsyncClientTest extends BaseCloudStackAsyncClientTest<Async
assertResponseParserClassEquals(method, httpRequest, ParseAsyncJobsFromHttpResponse.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class);
assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
checkFilters(httpRequest);

View File

@ -22,9 +22,9 @@ import java.io.IOException;
import java.lang.reflect.Method;
import org.jclouds.cloudstack.internal.BaseCloudStackAsyncClientTest;
import org.jclouds.fallbacks.MapHttp4xxCodesToExceptions;
import org.jclouds.http.HttpRequest;
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
import org.jclouds.rest.functions.MapHttp4xxCodesToExceptions;
import org.jclouds.rest.internal.RestAnnotationProcessor;
import org.testng.annotations.Test;
@ -51,7 +51,7 @@ public class ConfigurationAsyncClientTest extends BaseCloudStackAsyncClientTest<
assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class);
assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
checkFilters(httpRequest);

View File

@ -20,11 +20,11 @@ package org.jclouds.cloudstack.features;
import java.lang.reflect.Method;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.cloudstack.internal.BaseCloudStackAsyncClientTest;
import org.jclouds.http.HttpRequest;
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
import org.jclouds.http.functions.UnwrapOnlyJsonValue;
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
import org.jclouds.rest.internal.RestAnnotationProcessor;
import org.testng.annotations.Test;
@ -49,7 +49,7 @@ public class DomainAccountAsyncClientTest extends BaseCloudStackAsyncClientTest<
assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
checkFilters(httpRequest);
}
@ -65,7 +65,7 @@ public class DomainAccountAsyncClientTest extends BaseCloudStackAsyncClientTest<
assertResponseParserClassEquals(method, httpRequest, UnwrapOnlyJsonValue.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
checkFilters(httpRequest);
}

View File

@ -24,9 +24,9 @@ import java.lang.reflect.Method;
import org.jclouds.cloudstack.domain.ResourceLimit;
import org.jclouds.cloudstack.domain.ResourceLimit.ResourceType;
import org.jclouds.cloudstack.internal.BaseCloudStackAsyncClientTest;
import org.jclouds.fallbacks.MapHttp4xxCodesToExceptions;
import org.jclouds.http.HttpRequest;
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
import org.jclouds.rest.functions.MapHttp4xxCodesToExceptions;
import org.jclouds.rest.internal.RestAnnotationProcessor;
import org.testng.annotations.Test;
@ -53,7 +53,7 @@ public class DomainLimitAsyncClientTest extends BaseCloudStackAsyncClientTest<Do
assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class);
assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
checkFilters(httpRequest);

View File

@ -21,12 +21,12 @@ package org.jclouds.cloudstack.features;
import java.io.IOException;
import java.lang.reflect.Method;
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
import org.jclouds.cloudstack.functions.ParseEventTypesFromHttpResponse;
import org.jclouds.cloudstack.internal.BaseCloudStackAsyncClientTest;
import org.jclouds.cloudstack.options.ListEventsOptions;
import org.jclouds.http.HttpRequest;
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
import org.jclouds.rest.functions.ReturnEmptySetOnNotFoundOr404;
import org.jclouds.rest.internal.RestAnnotationProcessor;
import org.testng.annotations.Test;
@ -53,7 +53,7 @@ public class EventAsyncClientTest extends BaseCloudStackAsyncClientTest<EventAsy
assertResponseParserClassEquals(method, httpRequest, ParseEventTypesFromHttpResponse.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class);
assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
checkFilters(httpRequest);
}
@ -69,7 +69,7 @@ public class EventAsyncClientTest extends BaseCloudStackAsyncClientTest<EventAsy
assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class);
assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
checkFilters(httpRequest);
@ -86,7 +86,7 @@ public class EventAsyncClientTest extends BaseCloudStackAsyncClientTest<EventAsy
assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class);
assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
checkFilters(httpRequest);

View File

@ -21,16 +21,16 @@ package org.jclouds.cloudstack.features;
import java.io.IOException;
import java.lang.reflect.Method;
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
import org.jclouds.Fallbacks.VoidOnNotFoundOr404;
import org.jclouds.cloudstack.domain.PortForwardingRule;
import org.jclouds.cloudstack.internal.BaseCloudStackAsyncClientTest;
import org.jclouds.cloudstack.options.ListPortForwardingRulesOptions;
import org.jclouds.fallbacks.MapHttp4xxCodesToExceptions;
import org.jclouds.http.HttpRequest;
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
import org.jclouds.http.functions.ReleasePayloadAndReturn;
import org.jclouds.http.functions.UnwrapOnlyJsonValue;
import org.jclouds.rest.functions.MapHttp4xxCodesToExceptions;
import org.jclouds.rest.functions.ReturnEmptySetOnNotFoundOr404;
import org.jclouds.rest.functions.ReturnVoidOnNotFoundOr404;
import org.jclouds.rest.internal.RestAnnotationProcessor;
import org.testng.annotations.Test;
@ -57,7 +57,7 @@ public class FirewallAsyncClientTest extends BaseCloudStackAsyncClientTest<Firew
assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class);
assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
checkFilters(httpRequest);
@ -75,7 +75,7 @@ public class FirewallAsyncClientTest extends BaseCloudStackAsyncClientTest<Firew
assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class);
assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
checkFilters(httpRequest);
@ -95,7 +95,7 @@ public class FirewallAsyncClientTest extends BaseCloudStackAsyncClientTest<Firew
assertResponseParserClassEquals(method, httpRequest, UnwrapOnlyJsonValue.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class);
assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
checkFilters(httpRequest);
@ -112,7 +112,7 @@ public class FirewallAsyncClientTest extends BaseCloudStackAsyncClientTest<Firew
assertResponseParserClassEquals(method, httpRequest, ReleasePayloadAndReturn.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnVoidOnNotFoundOr404.class);
assertFallbackClassEquals(method, VoidOnNotFoundOr404.class);
checkFilters(httpRequest);

View File

@ -20,6 +20,7 @@ package org.jclouds.cloudstack.features;
import java.lang.reflect.Method;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.cloudstack.domain.Account;
import org.jclouds.cloudstack.internal.BaseCloudStackAsyncClientTest;
import org.jclouds.cloudstack.options.CreateAccountOptions;
@ -27,7 +28,6 @@ import org.jclouds.cloudstack.options.UpdateAccountOptions;
import org.jclouds.http.HttpRequest;
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
import org.jclouds.http.functions.ReleasePayloadAndReturn;
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
import org.jclouds.rest.internal.RestAnnotationProcessor;
import org.testng.annotations.Test;
@ -55,7 +55,7 @@ public class GlobalAccountAsyncClientTest extends BaseCloudStackAsyncClientTest<
assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
checkFilters(httpRequest);
}
@ -73,7 +73,7 @@ public class GlobalAccountAsyncClientTest extends BaseCloudStackAsyncClientTest<
assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
checkFilters(httpRequest);
}
@ -89,7 +89,7 @@ public class GlobalAccountAsyncClientTest extends BaseCloudStackAsyncClientTest<
assertResponseParserClassEquals(method, httpRequest, ReleasePayloadAndReturn.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
checkFilters(httpRequest);
}

View File

@ -21,11 +21,11 @@ package org.jclouds.cloudstack.features;
import java.io.IOException;
import java.lang.reflect.Method;
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
import org.jclouds.cloudstack.internal.BaseCloudStackAsyncClientTest;
import org.jclouds.cloudstack.options.ListAlertsOptions;
import org.jclouds.http.HttpRequest;
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
import org.jclouds.rest.functions.ReturnEmptySetOnNotFoundOr404;
import org.jclouds.rest.internal.RestAnnotationProcessor;
import org.testng.annotations.Test;
@ -52,7 +52,7 @@ public class GlobalAlertAsyncClientTest extends BaseCloudStackAsyncClientTest<Gl
assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class);
assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
checkFilters(httpRequest);
@ -69,7 +69,7 @@ public class GlobalAlertAsyncClientTest extends BaseCloudStackAsyncClientTest<Gl
assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class);
assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
checkFilters(httpRequest);

View File

@ -21,12 +21,12 @@ package org.jclouds.cloudstack.features;
import java.io.IOException;
import java.lang.reflect.Method;
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
import org.jclouds.cloudstack.domain.Capacity;
import org.jclouds.cloudstack.internal.BaseCloudStackAsyncClientTest;
import org.jclouds.cloudstack.options.ListCapacityOptions;
import org.jclouds.http.HttpRequest;
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
import org.jclouds.rest.functions.ReturnEmptySetOnNotFoundOr404;
import org.jclouds.rest.internal.RestAnnotationProcessor;
import org.testng.annotations.Test;
@ -53,7 +53,7 @@ public class GlobalCapacityAsyncClientTest extends BaseCloudStackAsyncClientTest
assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class);
assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
checkFilters(httpRequest);
}
@ -69,7 +69,7 @@ public class GlobalCapacityAsyncClientTest extends BaseCloudStackAsyncClientTest
assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class);
assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
checkFilters(httpRequest);
}

View File

@ -20,11 +20,11 @@ package org.jclouds.cloudstack.features;
import java.lang.reflect.Method;
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
import org.jclouds.cloudstack.internal.BaseCloudStackAsyncClientTest;
import org.jclouds.cloudstack.options.ListHostsOptions;
import org.jclouds.http.HttpRequest;
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
import org.jclouds.rest.functions.ReturnEmptySetOnNotFoundOr404;
import org.jclouds.rest.internal.RestAnnotationProcessor;
import org.testng.annotations.Test;
@ -49,7 +49,7 @@ public class GlobalHostAsyncClientTest extends BaseCloudStackAsyncClientTest<Glo
assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class);
assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
checkFilters(httpRequest);
}

View File

@ -20,6 +20,7 @@ package org.jclouds.cloudstack.features;
import java.lang.reflect.Method;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.cloudstack.internal.BaseCloudStackAsyncClientTest;
import org.jclouds.cloudstack.options.CreateDiskOfferingOptions;
import org.jclouds.cloudstack.options.CreateServiceOfferingOptions;
@ -29,7 +30,6 @@ import org.jclouds.cloudstack.options.UpdateServiceOfferingOptions;
import org.jclouds.http.HttpRequest;
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
import org.jclouds.http.functions.ReleasePayloadAndReturn;
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
import org.jclouds.rest.internal.RestAnnotationProcessor;
import org.testng.annotations.Test;
@ -55,7 +55,7 @@ public class GlobalOfferingAsyncClientTest extends BaseCloudStackAsyncClientTest
assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
checkFilters(httpRequest);
}
@ -72,7 +72,7 @@ public class GlobalOfferingAsyncClientTest extends BaseCloudStackAsyncClientTest
assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
checkFilters(httpRequest);
}
@ -88,7 +88,7 @@ public class GlobalOfferingAsyncClientTest extends BaseCloudStackAsyncClientTest
assertResponseParserClassEquals(method, httpRequest, ReleasePayloadAndReturn.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
checkFilters(httpRequest);
}
@ -105,7 +105,7 @@ public class GlobalOfferingAsyncClientTest extends BaseCloudStackAsyncClientTest
assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
checkFilters(httpRequest);
}
@ -122,7 +122,7 @@ public class GlobalOfferingAsyncClientTest extends BaseCloudStackAsyncClientTest
assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
checkFilters(httpRequest);
}
@ -138,7 +138,7 @@ public class GlobalOfferingAsyncClientTest extends BaseCloudStackAsyncClientTest
assertResponseParserClassEquals(method, httpRequest, ReleasePayloadAndReturn.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
checkFilters(httpRequest);
}
@ -155,7 +155,7 @@ public class GlobalOfferingAsyncClientTest extends BaseCloudStackAsyncClientTest
assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
checkFilters(httpRequest);
}

View File

@ -22,9 +22,9 @@ import java.lang.reflect.Method;
import org.jclouds.cloudstack.internal.BaseCloudStackAsyncClientTest;
import org.jclouds.cloudstack.options.ListStoragePoolsOptions;
import org.jclouds.fallbacks.MapHttp4xxCodesToExceptions;
import org.jclouds.http.HttpRequest;
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
import org.jclouds.rest.functions.MapHttp4xxCodesToExceptions;
import org.jclouds.rest.internal.RestAnnotationProcessor;
import org.testng.annotations.Test;
@ -49,7 +49,7 @@ public class GlobalStoragePoolAsyncClientTest extends BaseCloudStackAsyncClientT
assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class);
assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
checkFilters(httpRequest);
}
@ -65,7 +65,7 @@ public class GlobalStoragePoolAsyncClientTest extends BaseCloudStackAsyncClientT
assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class);
assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
checkFilters(httpRequest);
}

View File

@ -25,9 +25,9 @@ import java.util.Date;
import org.jclouds.cloudstack.internal.BaseCloudStackAsyncClientTest;
import org.jclouds.cloudstack.options.GenerateUsageRecordsOptions;
import org.jclouds.cloudstack.options.ListUsageRecordsOptions;
import org.jclouds.fallbacks.MapHttp4xxCodesToExceptions;
import org.jclouds.http.HttpRequest;
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
import org.jclouds.rest.functions.MapHttp4xxCodesToExceptions;
import org.jclouds.rest.internal.RestAnnotationProcessor;
import org.testng.annotations.Test;
@ -61,7 +61,7 @@ public class GlobalUsageAsyncClientTest extends BaseCloudStackAsyncClientTest<Gl
assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class);
assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
checkFilters(httpRequest);
}
@ -86,7 +86,7 @@ public class GlobalUsageAsyncClientTest extends BaseCloudStackAsyncClientTest<Gl
assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class);
assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
checkFilters(httpRequest);
}
@ -111,7 +111,7 @@ public class GlobalUsageAsyncClientTest extends BaseCloudStackAsyncClientTest<Gl
assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class);
assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
checkFilters(httpRequest);
}
@ -136,7 +136,7 @@ public class GlobalUsageAsyncClientTest extends BaseCloudStackAsyncClientTest<Gl
assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class);
assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
checkFilters(httpRequest);
}

View File

@ -20,13 +20,13 @@ package org.jclouds.cloudstack.features;
import java.lang.reflect.Method;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.cloudstack.internal.BaseCloudStackAsyncClientTest;
import org.jclouds.cloudstack.options.CreateUserOptions;
import org.jclouds.cloudstack.options.UpdateUserOptions;
import org.jclouds.http.HttpRequest;
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
import org.jclouds.http.functions.ReleasePayloadAndReturn;
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
import org.jclouds.rest.internal.RestAnnotationProcessor;
import org.testng.annotations.Test;
@ -52,7 +52,7 @@ public class GlobalUserAsyncClientTest extends BaseCloudStackAsyncClientTest<Glo
assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
checkFilters(httpRequest);
}
@ -68,7 +68,7 @@ public class GlobalUserAsyncClientTest extends BaseCloudStackAsyncClientTest<Glo
assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
checkFilters(httpRequest);
}
@ -84,7 +84,7 @@ public class GlobalUserAsyncClientTest extends BaseCloudStackAsyncClientTest<Glo
assertResponseParserClassEquals(method, httpRequest, ReleasePayloadAndReturn.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
checkFilters(httpRequest);
}

View File

@ -21,6 +21,8 @@ package org.jclouds.cloudstack.features;
import java.io.IOException;
import java.lang.reflect.Method;
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.cloudstack.functions.ParseIdToNameEntryFromHttpResponse;
import org.jclouds.cloudstack.functions.ParseIdToNameFromHttpResponse;
import org.jclouds.cloudstack.internal.BaseCloudStackAsyncClientTest;
@ -28,8 +30,6 @@ import org.jclouds.cloudstack.options.ListOSTypesOptions;
import org.jclouds.functions.IdentityFunction;
import org.jclouds.http.HttpRequest;
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
import org.jclouds.rest.functions.ReturnEmptySetOnNotFoundOr404;
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
import org.jclouds.rest.internal.RestAnnotationProcessor;
import org.testng.annotations.Test;
@ -57,7 +57,7 @@ public class GuestOSAsyncClientTest extends BaseCloudStackAsyncClientTest<GuestO
assertResponseParserClassEquals(method, httpRequest, ParseIdToNameEntryFromHttpResponse.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
checkFilters(httpRequest);
@ -74,7 +74,7 @@ public class GuestOSAsyncClientTest extends BaseCloudStackAsyncClientTest<GuestO
assertResponseParserClassEquals(method, httpRequest, ParseIdToNameFromHttpResponse.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class);
assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
checkFilters(httpRequest);
@ -92,7 +92,7 @@ public class GuestOSAsyncClientTest extends BaseCloudStackAsyncClientTest<GuestO
assertResponseParserClassEquals(method, httpRequest,
Functions.compose(IdentityFunction.INSTANCE, IdentityFunction.INSTANCE).getClass());
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
checkFilters(httpRequest);
@ -109,7 +109,7 @@ public class GuestOSAsyncClientTest extends BaseCloudStackAsyncClientTest<GuestO
assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class);
assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
checkFilters(httpRequest);
@ -126,7 +126,7 @@ public class GuestOSAsyncClientTest extends BaseCloudStackAsyncClientTest<GuestO
assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class);
assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
checkFilters(httpRequest);

View File

@ -21,10 +21,10 @@ package org.jclouds.cloudstack.features;
import java.io.IOException;
import java.lang.reflect.Method;
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
import org.jclouds.cloudstack.functions.ParseNamesFromHttpResponse;
import org.jclouds.cloudstack.internal.BaseCloudStackAsyncClientTest;
import org.jclouds.http.HttpRequest;
import org.jclouds.rest.functions.ReturnEmptySetOnNotFoundOr404;
import org.jclouds.rest.internal.RestAnnotationProcessor;
import org.testng.annotations.Test;
@ -51,7 +51,7 @@ public class HypervisorAsyncClientTest extends BaseCloudStackAsyncClientTest<Hyp
assertResponseParserClassEquals(method, httpRequest, ParseNamesFromHttpResponse.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class);
assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
checkFilters(httpRequest);
@ -68,7 +68,7 @@ public class HypervisorAsyncClientTest extends BaseCloudStackAsyncClientTest<Hyp
assertResponseParserClassEquals(method, httpRequest, ParseNamesFromHttpResponse.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class);
assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
checkFilters(httpRequest);

View File

@ -28,11 +28,11 @@ import org.jclouds.cloudstack.options.DeleteISOOptions;
import org.jclouds.cloudstack.options.ExtractISOOptions;
import org.jclouds.cloudstack.options.UpdateISOOptions;
import org.jclouds.cloudstack.options.UpdateISOPermissionsOptions;
import org.jclouds.fallbacks.MapHttp4xxCodesToExceptions;
import org.jclouds.http.HttpRequest;
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
import org.jclouds.http.functions.ReleasePayloadAndReturn;
import org.jclouds.http.functions.UnwrapOnlyJsonValue;
import org.jclouds.rest.functions.MapHttp4xxCodesToExceptions;
import org.jclouds.rest.internal.RestAnnotationProcessor;
import org.testng.annotations.Test;
@ -59,7 +59,7 @@ public class ISOAsyncClientTest extends BaseCloudStackAsyncClientTest<ISOAsyncCl
assertResponseParserClassEquals(method, httpRequest, UnwrapOnlyJsonValue.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class);
assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
checkFilters(httpRequest);
}
@ -75,7 +75,7 @@ public class ISOAsyncClientTest extends BaseCloudStackAsyncClientTest<ISOAsyncCl
assertResponseParserClassEquals(method, httpRequest, UnwrapOnlyJsonValue.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class);
assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
checkFilters(httpRequest);
}
@ -91,7 +91,7 @@ public class ISOAsyncClientTest extends BaseCloudStackAsyncClientTest<ISOAsyncCl
assertResponseParserClassEquals(method, httpRequest, UnwrapOnlyJsonValue.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class);
assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
checkFilters(httpRequest);
}
@ -107,7 +107,7 @@ public class ISOAsyncClientTest extends BaseCloudStackAsyncClientTest<ISOAsyncCl
assertResponseParserClassEquals(method, httpRequest, UnwrapOnlyJsonValue.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class);
assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
checkFilters(httpRequest);
}
@ -123,7 +123,7 @@ public class ISOAsyncClientTest extends BaseCloudStackAsyncClientTest<ISOAsyncCl
assertResponseParserClassEquals(method, httpRequest, UnwrapOnlyJsonValue.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class);
assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
checkFilters(httpRequest);
}
@ -139,7 +139,7 @@ public class ISOAsyncClientTest extends BaseCloudStackAsyncClientTest<ISOAsyncCl
assertResponseParserClassEquals(method, httpRequest, UnwrapOnlyJsonValue.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class);
assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
checkFilters(httpRequest);
}
@ -155,7 +155,7 @@ public class ISOAsyncClientTest extends BaseCloudStackAsyncClientTest<ISOAsyncCl
assertResponseParserClassEquals(method, httpRequest, UnwrapOnlyJsonValue.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class);
assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
checkFilters(httpRequest);
}
@ -171,7 +171,7 @@ public class ISOAsyncClientTest extends BaseCloudStackAsyncClientTest<ISOAsyncCl
assertResponseParserClassEquals(method, httpRequest, ReleasePayloadAndReturn.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class);
assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
checkFilters(httpRequest);
}
@ -187,7 +187,7 @@ public class ISOAsyncClientTest extends BaseCloudStackAsyncClientTest<ISOAsyncCl
assertResponseParserClassEquals(method, httpRequest, ReleasePayloadAndReturn.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class);
assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
checkFilters(httpRequest);
}
@ -203,7 +203,7 @@ public class ISOAsyncClientTest extends BaseCloudStackAsyncClientTest<ISOAsyncCl
assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class);
assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
checkFilters(httpRequest);
}
@ -219,7 +219,7 @@ public class ISOAsyncClientTest extends BaseCloudStackAsyncClientTest<ISOAsyncCl
assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class);
assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
checkFilters(httpRequest);
}
@ -235,7 +235,7 @@ public class ISOAsyncClientTest extends BaseCloudStackAsyncClientTest<ISOAsyncCl
assertResponseParserClassEquals(method, httpRequest, UnwrapOnlyJsonValue.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class);
assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
checkFilters(httpRequest);
}
@ -251,7 +251,7 @@ public class ISOAsyncClientTest extends BaseCloudStackAsyncClientTest<ISOAsyncCl
assertResponseParserClassEquals(method, httpRequest, UnwrapOnlyJsonValue.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class);
assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
checkFilters(httpRequest);
}

View File

@ -21,11 +21,11 @@ package org.jclouds.cloudstack.features;
import java.io.IOException;
import java.lang.reflect.Method;
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
import org.jclouds.cloudstack.internal.BaseCloudStackAsyncClientTest;
import org.jclouds.cloudstack.options.ListResourceLimitsOptions;
import org.jclouds.http.HttpRequest;
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
import org.jclouds.rest.functions.ReturnEmptySetOnNotFoundOr404;
import org.jclouds.rest.internal.RestAnnotationProcessor;
import org.testng.annotations.Test;
@ -50,7 +50,7 @@ public class LimitAsyncClientTest extends BaseCloudStackAsyncClientTest<LimitAsy
assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class);
assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
checkFilters(httpRequest);
@ -67,7 +67,7 @@ public class LimitAsyncClientTest extends BaseCloudStackAsyncClientTest<LimitAsy
assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class);
assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
checkFilters(httpRequest);

View File

@ -21,16 +21,16 @@ package org.jclouds.cloudstack.features;
import java.io.IOException;
import java.lang.reflect.Method;
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.cloudstack.domain.LoadBalancerRule.Algorithm;
import org.jclouds.cloudstack.internal.BaseCloudStackAsyncClientTest;
import org.jclouds.cloudstack.options.CreateLoadBalancerRuleOptions;
import org.jclouds.cloudstack.options.ListLoadBalancerRulesOptions;
import org.jclouds.cloudstack.options.UpdateLoadBalancerRuleOptions;
import org.jclouds.fallbacks.MapHttp4xxCodesToExceptions;
import org.jclouds.http.HttpRequest;
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
import org.jclouds.rest.functions.MapHttp4xxCodesToExceptions;
import org.jclouds.rest.functions.ReturnEmptySetOnNotFoundOr404;
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
import org.jclouds.rest.internal.RestAnnotationProcessor;
import org.testng.annotations.Test;
@ -57,7 +57,7 @@ public class LoadBalancerAsyncClientTest extends BaseCloudStackAsyncClientTest<L
assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class);
assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
checkFilters(httpRequest);
@ -75,7 +75,7 @@ public class LoadBalancerAsyncClientTest extends BaseCloudStackAsyncClientTest<L
assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class);
assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
checkFilters(httpRequest);
@ -94,7 +94,7 @@ public class LoadBalancerAsyncClientTest extends BaseCloudStackAsyncClientTest<L
assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class);
assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
checkFilters(httpRequest);
@ -110,7 +110,7 @@ public class LoadBalancerAsyncClientTest extends BaseCloudStackAsyncClientTest<L
assertPayloadEquals(httpRequest, null, null, false);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
checkFilters(httpRequest);
@ -127,7 +127,7 @@ public class LoadBalancerAsyncClientTest extends BaseCloudStackAsyncClientTest<L
assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
checkFilters(httpRequest);
@ -146,7 +146,7 @@ public class LoadBalancerAsyncClientTest extends BaseCloudStackAsyncClientTest<L
assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class);
assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
checkFilters(httpRequest);

View File

@ -21,16 +21,16 @@ package org.jclouds.cloudstack.features;
import java.io.IOException;
import java.lang.reflect.Method;
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.cloudstack.internal.BaseCloudStackAsyncClientTest;
import org.jclouds.cloudstack.options.CreateIPForwardingRuleOptions;
import org.jclouds.cloudstack.options.ListIPForwardingRulesOptions;
import org.jclouds.fallbacks.MapHttp4xxCodesToExceptions;
import org.jclouds.http.HttpRequest;
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
import org.jclouds.http.functions.ReleasePayloadAndReturn;
import org.jclouds.http.functions.UnwrapOnlyJsonValue;
import org.jclouds.rest.functions.MapHttp4xxCodesToExceptions;
import org.jclouds.rest.functions.ReturnEmptySetOnNotFoundOr404;
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
import org.jclouds.rest.internal.RestAnnotationProcessor;
import org.testng.annotations.Test;
@ -56,7 +56,7 @@ public class NATAsyncClientTest extends BaseCloudStackAsyncClientTest<NATAsyncCl
assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class);
assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
checkFilters(httpRequest);
@ -74,7 +74,7 @@ public class NATAsyncClientTest extends BaseCloudStackAsyncClientTest<NATAsyncCl
assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class);
assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
checkFilters(httpRequest);
@ -90,7 +90,7 @@ public class NATAsyncClientTest extends BaseCloudStackAsyncClientTest<NATAsyncCl
assertPayloadEquals(httpRequest, null, null, false);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
checkFilters(httpRequest);
@ -110,7 +110,7 @@ public class NATAsyncClientTest extends BaseCloudStackAsyncClientTest<NATAsyncCl
assertResponseParserClassEquals(method, httpRequest, UnwrapOnlyJsonValue.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class);
assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
checkFilters(httpRequest);
@ -131,7 +131,7 @@ public class NATAsyncClientTest extends BaseCloudStackAsyncClientTest<NATAsyncCl
assertResponseParserClassEquals(method, httpRequest, UnwrapOnlyJsonValue.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class);
assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
checkFilters(httpRequest);
@ -148,7 +148,7 @@ public class NATAsyncClientTest extends BaseCloudStackAsyncClientTest<NATAsyncCl
assertResponseParserClassEquals(method, httpRequest, ReleasePayloadAndReturn.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class);
assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
checkFilters(httpRequest);
@ -165,7 +165,7 @@ public class NATAsyncClientTest extends BaseCloudStackAsyncClientTest<NATAsyncCl
assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class);
assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
checkFilters(httpRequest);
@ -182,7 +182,7 @@ public class NATAsyncClientTest extends BaseCloudStackAsyncClientTest<NATAsyncCl
assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
checkFilters(httpRequest);

View File

@ -21,16 +21,16 @@ package org.jclouds.cloudstack.features;
import java.io.IOException;
import java.lang.reflect.Method;
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.cloudstack.domain.NetworkType;
import org.jclouds.cloudstack.internal.BaseCloudStackAsyncClientTest;
import org.jclouds.cloudstack.options.CreateNetworkOptions;
import org.jclouds.cloudstack.options.ListNetworksOptions;
import org.jclouds.fallbacks.MapHttp4xxCodesToExceptions;
import org.jclouds.functions.IdentityFunction;
import org.jclouds.http.HttpRequest;
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
import org.jclouds.rest.functions.MapHttp4xxCodesToExceptions;
import org.jclouds.rest.functions.ReturnEmptySetOnNotFoundOr404;
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
import org.jclouds.rest.internal.RestAnnotationProcessor;
import org.testng.annotations.Test;
@ -57,7 +57,7 @@ public class NetworkAsyncClientTest extends BaseCloudStackAsyncClientTest<Networ
assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class);
assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
checkFilters(httpRequest);
@ -75,7 +75,7 @@ public class NetworkAsyncClientTest extends BaseCloudStackAsyncClientTest<Networ
assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class);
assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
checkFilters(httpRequest);
@ -93,7 +93,7 @@ public class NetworkAsyncClientTest extends BaseCloudStackAsyncClientTest<Networ
assertResponseParserClassEquals(method, httpRequest,
Functions.compose(IdentityFunction.INSTANCE, IdentityFunction.INSTANCE).getClass());
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
checkFilters(httpRequest);
@ -112,7 +112,7 @@ public class NetworkAsyncClientTest extends BaseCloudStackAsyncClientTest<Networ
assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class);
assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
checkFilters(httpRequest);
@ -133,7 +133,7 @@ public class NetworkAsyncClientTest extends BaseCloudStackAsyncClientTest<Networ
assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class);
assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
checkFilters(httpRequest);
@ -150,7 +150,7 @@ public class NetworkAsyncClientTest extends BaseCloudStackAsyncClientTest<Networ
assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
checkFilters(httpRequest);

View File

@ -23,6 +23,8 @@ import static org.jclouds.cloudstack.domain.NetworkOfferingAvailabilityType.DEFA
import java.io.IOException;
import java.lang.reflect.Method;
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.cloudstack.internal.BaseCloudStackAsyncClientTest;
import org.jclouds.cloudstack.options.ListDiskOfferingsOptions;
import org.jclouds.cloudstack.options.ListNetworkOfferingsOptions;
@ -30,8 +32,6 @@ import org.jclouds.cloudstack.options.ListServiceOfferingsOptions;
import org.jclouds.functions.IdentityFunction;
import org.jclouds.http.HttpRequest;
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
import org.jclouds.rest.functions.ReturnEmptySetOnNotFoundOr404;
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
import org.jclouds.rest.internal.RestAnnotationProcessor;
import org.testng.annotations.Test;
@ -58,7 +58,7 @@ public class OfferingAsyncClientTest extends BaseCloudStackAsyncClientTest<Offer
assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class);
assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
checkFilters(httpRequest);
@ -75,7 +75,7 @@ public class OfferingAsyncClientTest extends BaseCloudStackAsyncClientTest<Offer
assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class);
assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
checkFilters(httpRequest);
@ -93,7 +93,7 @@ public class OfferingAsyncClientTest extends BaseCloudStackAsyncClientTest<Offer
assertResponseParserClassEquals(method, httpRequest,
Functions.compose(IdentityFunction.INSTANCE, IdentityFunction.INSTANCE).getClass());
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
checkFilters(httpRequest);
@ -110,7 +110,7 @@ public class OfferingAsyncClientTest extends BaseCloudStackAsyncClientTest<Offer
assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class);
assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
checkFilters(httpRequest);
@ -129,7 +129,7 @@ public class OfferingAsyncClientTest extends BaseCloudStackAsyncClientTest<Offer
assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class);
assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
checkFilters(httpRequest);
@ -147,7 +147,7 @@ public class OfferingAsyncClientTest extends BaseCloudStackAsyncClientTest<Offer
assertResponseParserClassEquals(method, httpRequest,
Functions.compose(IdentityFunction.INSTANCE, IdentityFunction.INSTANCE).getClass());
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
checkFilters(httpRequest);
@ -164,7 +164,7 @@ public class OfferingAsyncClientTest extends BaseCloudStackAsyncClientTest<Offer
assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class);
assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
checkFilters(httpRequest);
@ -183,7 +183,7 @@ public class OfferingAsyncClientTest extends BaseCloudStackAsyncClientTest<Offer
assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class);
assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
checkFilters(httpRequest);
@ -201,7 +201,7 @@ public class OfferingAsyncClientTest extends BaseCloudStackAsyncClientTest<Offer
assertResponseParserClassEquals(method, httpRequest,
Functions.compose(IdentityFunction.INSTANCE, IdentityFunction.INSTANCE).getClass());
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
checkFilters(httpRequest);

View File

@ -24,18 +24,18 @@ import java.io.IOException;
import java.lang.reflect.Method;
import java.net.URLEncoder;
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.Fallbacks.VoidOnNotFoundOr404;
import org.jclouds.cloudstack.filters.QuerySigner;
import org.jclouds.cloudstack.internal.BaseCloudStackAsyncClientTest;
import org.jclouds.cloudstack.options.ListSSHKeyPairsOptions;
import org.jclouds.crypto.SshKeys;
import org.jclouds.fallbacks.MapHttp4xxCodesToExceptions;
import org.jclouds.functions.IdentityFunction;
import org.jclouds.http.HttpRequest;
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
import org.jclouds.http.functions.ReleasePayloadAndReturn;
import org.jclouds.rest.functions.MapHttp4xxCodesToExceptions;
import org.jclouds.rest.functions.ReturnEmptySetOnNotFoundOr404;
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
import org.jclouds.rest.functions.ReturnVoidOnNotFoundOr404;
import org.jclouds.rest.internal.RestAnnotationProcessor;
import org.testng.annotations.Test;
@ -61,7 +61,7 @@ public class SSHKeyPairAsyncClientTest extends BaseCloudStackAsyncClientTest<SSH
assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class);
assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
checkFilters(httpRequest);
@ -78,7 +78,7 @@ public class SSHKeyPairAsyncClientTest extends BaseCloudStackAsyncClientTest<SSH
assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class);
assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
checkFilters(httpRequest);
@ -96,7 +96,7 @@ public class SSHKeyPairAsyncClientTest extends BaseCloudStackAsyncClientTest<SSH
assertResponseParserClassEquals(method, httpRequest,
Functions.compose(IdentityFunction.INSTANCE, IdentityFunction.INSTANCE).getClass());
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
checkFilters(httpRequest);
@ -115,7 +115,7 @@ public class SSHKeyPairAsyncClientTest extends BaseCloudStackAsyncClientTest<SSH
assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class);
assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
assertEquals(httpRequest.getFilters().size(), 1);
assertEquals(httpRequest.getFilters().get(0).getClass(), QuerySigner.class);
@ -133,7 +133,7 @@ public class SSHKeyPairAsyncClientTest extends BaseCloudStackAsyncClientTest<SSH
assertResponseParserClassEquals(method, httpRequest, ReleasePayloadAndReturn.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnVoidOnNotFoundOr404.class);
assertFallbackClassEquals(method, VoidOnNotFoundOr404.class);
checkFilters(httpRequest);
}

View File

@ -21,17 +21,17 @@ package org.jclouds.cloudstack.features;
import java.io.IOException;
import java.lang.reflect.Method;
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.Fallbacks.VoidOnNotFoundOr404;
import org.jclouds.cloudstack.internal.BaseCloudStackAsyncClientTest;
import org.jclouds.cloudstack.options.AccountInDomainOptions;
import org.jclouds.cloudstack.options.ListSecurityGroupsOptions;
import org.jclouds.fallbacks.MapHttp4xxCodesToExceptions;
import org.jclouds.functions.IdentityFunction;
import org.jclouds.http.HttpRequest;
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
import org.jclouds.http.functions.ReleasePayloadAndReturn;
import org.jclouds.rest.functions.MapHttp4xxCodesToExceptions;
import org.jclouds.rest.functions.ReturnEmptySetOnNotFoundOr404;
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
import org.jclouds.rest.functions.ReturnVoidOnNotFoundOr404;
import org.jclouds.rest.internal.RestAnnotationProcessor;
import org.testng.annotations.Test;
@ -62,7 +62,7 @@ public class SecurityGroupAsyncClientTest extends BaseCloudStackAsyncClientTest<
assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class);
assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
checkFilters(httpRequest);
@ -81,7 +81,7 @@ public class SecurityGroupAsyncClientTest extends BaseCloudStackAsyncClientTest<
assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class);
assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
checkFilters(httpRequest);
@ -99,7 +99,7 @@ public class SecurityGroupAsyncClientTest extends BaseCloudStackAsyncClientTest<
assertResponseParserClassEquals(method, httpRequest,
Functions.compose(IdentityFunction.INSTANCE, IdentityFunction.INSTANCE).getClass());
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
checkFilters(httpRequest);
@ -116,7 +116,7 @@ public class SecurityGroupAsyncClientTest extends BaseCloudStackAsyncClientTest<
assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class);
assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
checkFilters(httpRequest);
@ -136,7 +136,7 @@ public class SecurityGroupAsyncClientTest extends BaseCloudStackAsyncClientTest<
assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class);
assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
checkFilters(httpRequest);
@ -156,7 +156,7 @@ public class SecurityGroupAsyncClientTest extends BaseCloudStackAsyncClientTest<
assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class);
assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
checkFilters(httpRequest);
@ -175,7 +175,7 @@ public class SecurityGroupAsyncClientTest extends BaseCloudStackAsyncClientTest<
assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class);
assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
checkFilters(httpRequest);
@ -195,7 +195,7 @@ public class SecurityGroupAsyncClientTest extends BaseCloudStackAsyncClientTest<
assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class);
assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
checkFilters(httpRequest);
@ -215,7 +215,7 @@ public class SecurityGroupAsyncClientTest extends BaseCloudStackAsyncClientTest<
assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnVoidOnNotFoundOr404.class);
assertFallbackClassEquals(method, VoidOnNotFoundOr404.class);
checkFilters(httpRequest);
@ -232,7 +232,7 @@ public class SecurityGroupAsyncClientTest extends BaseCloudStackAsyncClientTest<
assertResponseParserClassEquals(method, httpRequest, ReleasePayloadAndReturn.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnVoidOnNotFoundOr404.class);
assertFallbackClassEquals(method, VoidOnNotFoundOr404.class);
checkFilters(httpRequest);

View File

@ -20,6 +20,9 @@ package org.jclouds.cloudstack.features;
import java.lang.reflect.Method;
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.Fallbacks.VoidOnNotFoundOr404;
import org.jclouds.cloudstack.domain.Snapshot;
import org.jclouds.cloudstack.domain.SnapshotPolicySchedule;
import org.jclouds.cloudstack.internal.BaseCloudStackAsyncClientTest;
@ -27,15 +30,12 @@ import org.jclouds.cloudstack.options.CreateSnapshotOptions;
import org.jclouds.cloudstack.options.ListSnapshotPoliciesOptions;
import org.jclouds.cloudstack.options.ListSnapshotsOptions;
import org.jclouds.cloudstack.util.SnapshotPolicySchedules;
import org.jclouds.fallbacks.MapHttp4xxCodesToExceptions;
import org.jclouds.functions.IdentityFunction;
import org.jclouds.http.HttpRequest;
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
import org.jclouds.http.functions.ReleasePayloadAndReturn;
import org.jclouds.http.functions.UnwrapOnlyJsonValue;
import org.jclouds.rest.functions.MapHttp4xxCodesToExceptions;
import org.jclouds.rest.functions.ReturnEmptySetOnNotFoundOr404;
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
import org.jclouds.rest.functions.ReturnVoidOnNotFoundOr404;
import org.jclouds.rest.internal.RestAnnotationProcessor;
import org.testng.annotations.Test;
@ -65,7 +65,7 @@ public class SnapshotAsyncClientTest extends BaseCloudStackAsyncClientTest<Snaps
assertResponseParserClassEquals(method, httpRequest, UnwrapOnlyJsonValue.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class);
assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
checkFilters(httpRequest);
}
@ -81,7 +81,7 @@ public class SnapshotAsyncClientTest extends BaseCloudStackAsyncClientTest<Snaps
assertResponseParserClassEquals(method, httpRequest, UnwrapOnlyJsonValue.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class);
assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
checkFilters(httpRequest);
}
@ -97,7 +97,7 @@ public class SnapshotAsyncClientTest extends BaseCloudStackAsyncClientTest<Snaps
assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class);
assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
checkFilters(httpRequest);
}
@ -114,7 +114,7 @@ public class SnapshotAsyncClientTest extends BaseCloudStackAsyncClientTest<Snaps
assertResponseParserClassEquals(method, httpRequest,
Functions.compose(IdentityFunction.INSTANCE, IdentityFunction.INSTANCE).getClass());
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
checkFilters(httpRequest);
}
@ -130,7 +130,7 @@ public class SnapshotAsyncClientTest extends BaseCloudStackAsyncClientTest<Snaps
assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class);
assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
checkFilters(httpRequest);
}
@ -146,7 +146,7 @@ public class SnapshotAsyncClientTest extends BaseCloudStackAsyncClientTest<Snaps
assertResponseParserClassEquals(method, httpRequest, ReleasePayloadAndReturn.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnVoidOnNotFoundOr404.class);
assertFallbackClassEquals(method, VoidOnNotFoundOr404.class);
checkFilters(httpRequest);
}
@ -162,7 +162,7 @@ public class SnapshotAsyncClientTest extends BaseCloudStackAsyncClientTest<Snaps
assertResponseParserClassEquals(method, httpRequest, UnwrapOnlyJsonValue.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class);
assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
checkFilters(httpRequest);
}
@ -178,7 +178,7 @@ public class SnapshotAsyncClientTest extends BaseCloudStackAsyncClientTest<Snaps
assertResponseParserClassEquals(method, httpRequest, ReleasePayloadAndReturn.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnVoidOnNotFoundOr404.class);
assertFallbackClassEquals(method, VoidOnNotFoundOr404.class);
checkFilters(httpRequest);
}
@ -195,7 +195,7 @@ public class SnapshotAsyncClientTest extends BaseCloudStackAsyncClientTest<Snaps
assertResponseParserClassEquals(method, httpRequest, ReleasePayloadAndReturn.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnVoidOnNotFoundOr404.class);
assertFallbackClassEquals(method, VoidOnNotFoundOr404.class);
checkFilters(httpRequest);
}
@ -211,7 +211,7 @@ public class SnapshotAsyncClientTest extends BaseCloudStackAsyncClientTest<Snaps
assertResponseParserClassEquals(method, httpRequest, UnwrapOnlyJsonValue.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class);
assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
checkFilters(httpRequest);
}
@ -227,7 +227,7 @@ public class SnapshotAsyncClientTest extends BaseCloudStackAsyncClientTest<Snaps
assertResponseParserClassEquals(method, httpRequest, UnwrapOnlyJsonValue.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class);
assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
checkFilters(httpRequest);
}

View File

@ -21,6 +21,8 @@ package org.jclouds.cloudstack.features;
import java.io.IOException;
import java.lang.reflect.Method;
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.cloudstack.domain.ExtractMode;
import org.jclouds.cloudstack.domain.Template;
import org.jclouds.cloudstack.domain.TemplateFilter;
@ -34,14 +36,12 @@ import org.jclouds.cloudstack.options.ListTemplatesOptions;
import org.jclouds.cloudstack.options.RegisterTemplateOptions;
import org.jclouds.cloudstack.options.UpdateTemplateOptions;
import org.jclouds.cloudstack.options.UpdateTemplatePermissionsOptions;
import org.jclouds.fallbacks.MapHttp4xxCodesToExceptions;
import org.jclouds.functions.IdentityFunction;
import org.jclouds.http.HttpRequest;
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
import org.jclouds.http.functions.ReleasePayloadAndReturn;
import org.jclouds.http.functions.UnwrapOnlyJsonValue;
import org.jclouds.rest.functions.MapHttp4xxCodesToExceptions;
import org.jclouds.rest.functions.ReturnEmptySetOnNotFoundOr404;
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
import org.jclouds.rest.internal.RestAnnotationProcessor;
import org.testng.annotations.Test;
@ -69,7 +69,7 @@ public class TemplateAsyncClientTest extends BaseCloudStackAsyncClientTest<Templ
assertResponseParserClassEquals(method, httpRequest, UnwrapOnlyJsonValue.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class);
assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
checkFilters(httpRequest);
}
@ -84,7 +84,7 @@ public class TemplateAsyncClientTest extends BaseCloudStackAsyncClientTest<Templ
assertResponseParserClassEquals(method, httpRequest, UnwrapOnlyJsonValue.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class);
assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
checkFilters(httpRequest);
}
@ -99,7 +99,7 @@ public class TemplateAsyncClientTest extends BaseCloudStackAsyncClientTest<Templ
assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class);
assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
checkFilters(httpRequest);
}
@ -115,7 +115,7 @@ public class TemplateAsyncClientTest extends BaseCloudStackAsyncClientTest<Templ
assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class);
assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
checkFilters(httpRequest);
}
@ -130,7 +130,7 @@ public class TemplateAsyncClientTest extends BaseCloudStackAsyncClientTest<Templ
assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class);
assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
checkFilters(httpRequest);
}
@ -145,7 +145,7 @@ public class TemplateAsyncClientTest extends BaseCloudStackAsyncClientTest<Templ
assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class);
assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
checkFilters(httpRequest);
}
@ -160,7 +160,7 @@ public class TemplateAsyncClientTest extends BaseCloudStackAsyncClientTest<Templ
assertResponseParserClassEquals(method, httpRequest, UnwrapOnlyJsonValue.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class);
assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
checkFilters(httpRequest);
}
@ -175,7 +175,7 @@ public class TemplateAsyncClientTest extends BaseCloudStackAsyncClientTest<Templ
assertResponseParserClassEquals(method, httpRequest, UnwrapOnlyJsonValue.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class);
assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
checkFilters(httpRequest);
}
@ -190,7 +190,7 @@ public class TemplateAsyncClientTest extends BaseCloudStackAsyncClientTest<Templ
assertResponseParserClassEquals(method, httpRequest, UnwrapOnlyJsonValue.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class);
assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
checkFilters(httpRequest);
}
@ -206,7 +206,7 @@ public class TemplateAsyncClientTest extends BaseCloudStackAsyncClientTest<Templ
assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class);
assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
checkFilters(httpRequest);
@ -228,7 +228,7 @@ public class TemplateAsyncClientTest extends BaseCloudStackAsyncClientTest<Templ
assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class);
assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
checkFilters(httpRequest);
@ -247,7 +247,7 @@ public class TemplateAsyncClientTest extends BaseCloudStackAsyncClientTest<Templ
assertResponseParserClassEquals(method, httpRequest,
Functions.compose(IdentityFunction.INSTANCE, IdentityFunction.INSTANCE).getClass());
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
checkFilters(httpRequest);
@ -263,7 +263,7 @@ public class TemplateAsyncClientTest extends BaseCloudStackAsyncClientTest<Templ
assertResponseParserClassEquals(method, httpRequest, ReleasePayloadAndReturn.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class);
assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
checkFilters(httpRequest);
}
@ -278,7 +278,7 @@ public class TemplateAsyncClientTest extends BaseCloudStackAsyncClientTest<Templ
assertResponseParserClassEquals(method, httpRequest, ReleasePayloadAndReturn.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class);
assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
checkFilters(httpRequest);
}
@ -293,7 +293,7 @@ public class TemplateAsyncClientTest extends BaseCloudStackAsyncClientTest<Templ
assertResponseParserClassEquals(method, httpRequest, UnwrapOnlyJsonValue.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class);
assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
checkFilters(httpRequest);
}
@ -308,7 +308,7 @@ public class TemplateAsyncClientTest extends BaseCloudStackAsyncClientTest<Templ
assertResponseParserClassEquals(method, httpRequest, UnwrapOnlyJsonValue.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class);
assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
checkFilters(httpRequest);
}
@ -323,7 +323,7 @@ public class TemplateAsyncClientTest extends BaseCloudStackAsyncClientTest<Templ
assertResponseParserClassEquals(method, httpRequest, UnwrapOnlyJsonValue.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class);
assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
checkFilters(httpRequest);
}
@ -338,7 +338,7 @@ public class TemplateAsyncClientTest extends BaseCloudStackAsyncClientTest<Templ
assertResponseParserClassEquals(method, httpRequest, UnwrapOnlyJsonValue.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class);
assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
checkFilters(httpRequest);
}

View File

@ -21,18 +21,18 @@ package org.jclouds.cloudstack.features;
import java.io.IOException;
import java.lang.reflect.Method;
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.Fallbacks.VoidOnNotFoundOr404;
import org.jclouds.cloudstack.internal.BaseCloudStackAsyncClientTest;
import org.jclouds.cloudstack.options.CreateVMGroupOptions;
import org.jclouds.cloudstack.options.ListVMGroupsOptions;
import org.jclouds.cloudstack.options.UpdateVMGroupOptions;
import org.jclouds.fallbacks.MapHttp4xxCodesToExceptions;
import org.jclouds.functions.IdentityFunction;
import org.jclouds.http.HttpRequest;
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
import org.jclouds.http.functions.ReleasePayloadAndReturn;
import org.jclouds.rest.functions.MapHttp4xxCodesToExceptions;
import org.jclouds.rest.functions.ReturnEmptySetOnNotFoundOr404;
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
import org.jclouds.rest.functions.ReturnVoidOnNotFoundOr404;
import org.jclouds.rest.internal.RestAnnotationProcessor;
import org.testng.annotations.Test;
@ -60,7 +60,7 @@ public class VMGroupAsyncClientTest extends BaseCloudStackAsyncClientTest<VMGrou
assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class);
assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
checkFilters(httpRequest);
@ -79,7 +79,7 @@ public class VMGroupAsyncClientTest extends BaseCloudStackAsyncClientTest<VMGrou
assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class);
assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
checkFilters(httpRequest);
@ -97,7 +97,7 @@ public class VMGroupAsyncClientTest extends BaseCloudStackAsyncClientTest<VMGrou
assertResponseParserClassEquals(method, httpRequest,
Functions.compose(IdentityFunction.INSTANCE, IdentityFunction.INSTANCE).getClass());
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
checkFilters(httpRequest);
@ -114,7 +114,7 @@ public class VMGroupAsyncClientTest extends BaseCloudStackAsyncClientTest<VMGrou
assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class);
assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
checkFilters(httpRequest);
@ -131,7 +131,7 @@ public class VMGroupAsyncClientTest extends BaseCloudStackAsyncClientTest<VMGrou
assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class);
assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
checkFilters(httpRequest);
@ -148,7 +148,7 @@ public class VMGroupAsyncClientTest extends BaseCloudStackAsyncClientTest<VMGrou
assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class);
assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
checkFilters(httpRequest);
@ -165,7 +165,7 @@ public class VMGroupAsyncClientTest extends BaseCloudStackAsyncClientTest<VMGrou
assertResponseParserClassEquals(method, httpRequest, ReleasePayloadAndReturn.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnVoidOnNotFoundOr404.class);
assertFallbackClassEquals(method, VoidOnNotFoundOr404.class);
checkFilters(httpRequest);

View File

@ -21,17 +21,17 @@ package org.jclouds.cloudstack.features;
import java.io.IOException;
import java.lang.reflect.Method;
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.cloudstack.internal.BaseCloudStackAsyncClientTest;
import org.jclouds.cloudstack.options.AssignVirtualMachineOptions;
import org.jclouds.cloudstack.options.DeployVirtualMachineOptions;
import org.jclouds.cloudstack.options.ListVirtualMachinesOptions;
import org.jclouds.fallbacks.MapHttp4xxCodesToExceptions;
import org.jclouds.functions.IdentityFunction;
import org.jclouds.http.HttpRequest;
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
import org.jclouds.http.functions.UnwrapOnlyJsonValue;
import org.jclouds.rest.functions.MapHttp4xxCodesToExceptions;
import org.jclouds.rest.functions.ReturnEmptySetOnNotFoundOr404;
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
import org.jclouds.rest.internal.RestAnnotationProcessor;
import org.testng.annotations.Test;
@ -59,7 +59,7 @@ public class VirtualMachineAsyncClientTest extends BaseCloudStackAsyncClientTest
assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class);
assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
checkFilters(httpRequest);
@ -79,7 +79,7 @@ public class VirtualMachineAsyncClientTest extends BaseCloudStackAsyncClientTest
assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class);
assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
checkFilters(httpRequest);
@ -97,7 +97,7 @@ public class VirtualMachineAsyncClientTest extends BaseCloudStackAsyncClientTest
assertResponseParserClassEquals(method, httpRequest,
Functions.compose(IdentityFunction.INSTANCE, IdentityFunction.INSTANCE).getClass());
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
checkFilters(httpRequest);
@ -116,7 +116,7 @@ public class VirtualMachineAsyncClientTest extends BaseCloudStackAsyncClientTest
assertResponseParserClassEquals(method, httpRequest, UnwrapOnlyJsonValue.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class);
assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
checkFilters(httpRequest);
@ -133,7 +133,7 @@ public class VirtualMachineAsyncClientTest extends BaseCloudStackAsyncClientTest
assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class);
assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
checkFilters(httpRequest);
@ -150,7 +150,7 @@ public class VirtualMachineAsyncClientTest extends BaseCloudStackAsyncClientTest
assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class);
assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
checkFilters(httpRequest);
@ -167,7 +167,7 @@ public class VirtualMachineAsyncClientTest extends BaseCloudStackAsyncClientTest
assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class);
assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
checkFilters(httpRequest);
@ -184,7 +184,7 @@ public class VirtualMachineAsyncClientTest extends BaseCloudStackAsyncClientTest
assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class);
assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
checkFilters(httpRequest);
@ -201,7 +201,7 @@ public class VirtualMachineAsyncClientTest extends BaseCloudStackAsyncClientTest
assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class);
assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
checkFilters(httpRequest);
@ -218,7 +218,7 @@ public class VirtualMachineAsyncClientTest extends BaseCloudStackAsyncClientTest
assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class);
assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
checkFilters(httpRequest);
@ -235,7 +235,7 @@ public class VirtualMachineAsyncClientTest extends BaseCloudStackAsyncClientTest
assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
checkFilters(httpRequest);
@ -255,7 +255,7 @@ public class VirtualMachineAsyncClientTest extends BaseCloudStackAsyncClientTest
assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class);
assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
checkFilters(httpRequest);

View File

@ -21,12 +21,12 @@ package org.jclouds.cloudstack.features;
import java.io.IOException;
import java.lang.reflect.Method;
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.Fallbacks.VoidOnNotFoundOr404;
import org.jclouds.cloudstack.internal.BaseCloudStackAsyncClientTest;
import org.jclouds.cloudstack.options.ListVolumesOptions;
import org.jclouds.http.HttpRequest;
import org.jclouds.rest.functions.ReturnEmptySetOnNotFoundOr404;
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
import org.jclouds.rest.functions.ReturnVoidOnNotFoundOr404;
import org.jclouds.rest.internal.RestAnnotationProcessor;
import org.testng.annotations.Test;
@ -52,7 +52,7 @@ public class VolumeAsyncClientTest extends BaseCloudStackAsyncClientTest<VolumeA
assertPayloadEquals(httpRequest, null, null, false);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class);
assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
checkFilters(httpRequest);
@ -68,7 +68,7 @@ public class VolumeAsyncClientTest extends BaseCloudStackAsyncClientTest<VolumeA
assertPayloadEquals(httpRequest, null, null, false);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
checkFilters(httpRequest);
@ -145,7 +145,7 @@ public class VolumeAsyncClientTest extends BaseCloudStackAsyncClientTest<VolumeA
assertPayloadEquals(httpRequest, null, null, false);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnVoidOnNotFoundOr404.class);
assertFallbackClassEquals(method, VoidOnNotFoundOr404.class);
checkFilters(httpRequest);
}

View File

@ -21,13 +21,13 @@ package org.jclouds.cloudstack.features;
import java.io.IOException;
import java.lang.reflect.Method;
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.cloudstack.internal.BaseCloudStackAsyncClientTest;
import org.jclouds.cloudstack.options.ListZonesOptions;
import org.jclouds.functions.IdentityFunction;
import org.jclouds.http.HttpRequest;
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
import org.jclouds.rest.functions.ReturnEmptySetOnNotFoundOr404;
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
import org.jclouds.rest.internal.RestAnnotationProcessor;
import org.testng.annotations.Test;
@ -65,7 +65,7 @@ public class ZoneAsyncClientTest extends BaseCloudStackAsyncClientTest<ZoneAsync
assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class);
assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
checkFilters(httpRequest);
@ -83,7 +83,7 @@ public class ZoneAsyncClientTest extends BaseCloudStackAsyncClientTest<ZoneAsync
assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class);
assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
checkFilters(httpRequest);
@ -101,7 +101,7 @@ public class ZoneAsyncClientTest extends BaseCloudStackAsyncClientTest<ZoneAsync
assertResponseParserClassEquals(method, httpRequest,
Functions.compose(IdentityFunction.INSTANCE, IdentityFunction.INSTANCE).getClass());
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
checkFilters(httpRequest);

View File

@ -23,6 +23,8 @@ import javax.ws.rs.FormParam;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import org.jclouds.Fallbacks.EmptyIterableWithMarkerOnNotFoundOr404;
import org.jclouds.Fallbacks.EmptyPagedIterableOnNotFoundOr404;
import org.jclouds.aws.filters.FormSigner;
import org.jclouds.cloudwatch.binders.GetMetricStatisticsBinder;
import org.jclouds.cloudwatch.binders.MetricDataBinder;
@ -38,14 +40,12 @@ import org.jclouds.cloudwatch.xml.ListMetricsResponseHandler;
import org.jclouds.collect.IterableWithMarker;
import org.jclouds.collect.PagedIterable;
import org.jclouds.rest.annotations.BinderParam;
import org.jclouds.rest.annotations.ExceptionParser;
import org.jclouds.rest.annotations.Fallback;
import org.jclouds.rest.annotations.FormParams;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.Transform;
import org.jclouds.rest.annotations.VirtualHost;
import org.jclouds.rest.annotations.XMLResponseParser;
import org.jclouds.rest.functions.ReturnEmptyIterableWithMarkerOnNotFoundOr404;
import org.jclouds.rest.functions.ReturnEmptyPagedIterableOnNotFoundOr404;
import com.google.common.util.concurrent.ListenableFuture;
@ -69,7 +69,7 @@ public interface MetricAsyncApi {
@XMLResponseParser(ListMetricsResponseHandler.class)
@Transform(MetricsToPagedIterable.class)
@FormParams(keys = "Action", values = "ListMetrics")
@ExceptionParser(ReturnEmptyPagedIterableOnNotFoundOr404.class)
@Fallback(EmptyPagedIterableOnNotFoundOr404.class)
ListenableFuture<? extends PagedIterable<Metric>> list();
/**
@ -80,7 +80,7 @@ public interface MetricAsyncApi {
@Path("/")
@XMLResponseParser(ListMetricsResponseHandler.class)
@FormParams(keys = "Action", values = "ListMetrics")
@ExceptionParser(ReturnEmptyIterableWithMarkerOnNotFoundOr404.class)
@Fallback(EmptyIterableWithMarkerOnNotFoundOr404.class)
ListenableFuture<? extends IterableWithMarker<Metric>> list(ListMetricsOptions options);
/**

View File

@ -77,7 +77,7 @@ public class CloudWatchAsyncApiTest extends BaseAsyncApiTest<CloudWatchAsyncApi>
assertResponseParserClassEquals(method, request, ParseSax.class);
assertSaxResponseParserClassEquals(method, GetMetricStatisticsResponseHandler.class);
assertExceptionParserClassEquals(method, null);
assertFallbackClassEquals(method, null);
checkFilters(request);
}

View File

@ -33,12 +33,13 @@ import org.jclouds.cloudwatch.domain.Unit;
import org.jclouds.cloudwatch.internal.BaseCloudWatchApiExpectTest;
import org.jclouds.cloudwatch.options.GetMetricStatisticsOptions;
import org.jclouds.cloudwatch.options.ListMetricsOptions;
import org.jclouds.collect.IterableWithMarkers;
import org.jclouds.http.HttpRequest;
import org.jclouds.http.HttpResponse;
import org.jclouds.rest.ResourceNotFoundException;
import org.testng.annotations.Test;
import com.google.common.collect.ImmutableSet;
/**
* @author Jeremy Whitlock, Adrian Cole
*/
@ -84,7 +85,7 @@ public class MetricApiExpectTest extends BaseCloudWatchApiExpectTest {
CloudWatchApi apiWhenMetricsDontExist = requestSendsResponse(
listMetrics, listMetricsResponse);
assertEquals(apiWhenMetricsDontExist.getMetricApiForRegion(null).list().get(0), IterableWithMarkers.EMPTY);
assertEquals(apiWhenMetricsDontExist.getMetricApiForRegion(null).list().get(0).toImmutableSet(), ImmutableSet.of());
}
public void testListMetrics2PagesWhenResponseIs2xx() throws Exception {

View File

@ -27,6 +27,10 @@ import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.core.MediaType;
import org.jclouds.Fallbacks.EmptyMultimapOnNotFoundOr404;
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.deltacloud.DeltacloudFallbacks.VoidOnRedirectedDelete;
import org.jclouds.deltacloud.collections.HardwareProfiles;
import org.jclouds.deltacloud.collections.Images;
import org.jclouds.deltacloud.collections.InstanceStates;
@ -36,10 +40,9 @@ import org.jclouds.deltacloud.domain.DeltacloudCollection;
import org.jclouds.deltacloud.domain.HardwareProfile;
import org.jclouds.deltacloud.domain.Image;
import org.jclouds.deltacloud.domain.Instance;
import org.jclouds.deltacloud.domain.Instance.State;
import org.jclouds.deltacloud.domain.Realm;
import org.jclouds.deltacloud.domain.Transition;
import org.jclouds.deltacloud.domain.Instance.State;
import org.jclouds.deltacloud.functions.ReturnVoidOnRedirectedDelete;
import org.jclouds.deltacloud.options.CreateInstanceOptions;
import org.jclouds.deltacloud.xml.DeltacloudCollectionsHandler;
import org.jclouds.deltacloud.xml.HardwareProfileHandler;
@ -55,12 +58,9 @@ import org.jclouds.http.HttpRequest;
import org.jclouds.http.filters.BasicAuthentication;
import org.jclouds.rest.annotations.Endpoint;
import org.jclouds.rest.annotations.EndpointParam;
import org.jclouds.rest.annotations.ExceptionParser;
import org.jclouds.rest.annotations.Fallback;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.XMLResponseParser;
import org.jclouds.rest.functions.ReturnEmptyMultimapOnNotFoundOr404;
import org.jclouds.rest.functions.ReturnEmptySetOnNotFoundOr404;
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
import com.google.common.collect.Multimap;
import com.google.common.util.concurrent.ListenableFuture;
@ -81,7 +81,7 @@ public interface DeltacloudAsyncClient {
* @see DeltacloudClient#getCollections
*/
@GET
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
@Fallback(EmptySetOnNotFoundOr404.class)
@XMLResponseParser(DeltacloudCollectionsHandler.class)
ListenableFuture<Set<DeltacloudCollection>> getCollections();
@ -90,7 +90,7 @@ public interface DeltacloudAsyncClient {
*/
@GET
@Endpoint(InstanceStates.class)
@ExceptionParser(ReturnEmptyMultimapOnNotFoundOr404.class)
@Fallback(EmptyMultimapOnNotFoundOr404.class)
@XMLResponseParser(InstanceStatesHandler.class)
ListenableFuture<Multimap<State, Transition>> getInstanceStates();
@ -99,7 +99,7 @@ public interface DeltacloudAsyncClient {
*/
@GET
@Endpoint(Realms.class)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
@Fallback(EmptySetOnNotFoundOr404.class)
@XMLResponseParser(RealmsHandler.class)
ListenableFuture<Set<Realm>> listRealms();
@ -107,7 +107,7 @@ public interface DeltacloudAsyncClient {
* @see DeltacloudClient#getRealm
*/
@GET
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
@Fallback(NullOnNotFoundOr404.class)
@XMLResponseParser(RealmHandler.class)
ListenableFuture<Realm> getRealm(@EndpointParam URI realmHref);
@ -116,7 +116,7 @@ public interface DeltacloudAsyncClient {
*/
@GET
@Endpoint(Images.class)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
@Fallback(EmptySetOnNotFoundOr404.class)
@XMLResponseParser(ImagesHandler.class)
ListenableFuture<Set<Image>> listImages();
@ -124,7 +124,7 @@ public interface DeltacloudAsyncClient {
* @see DeltacloudClient#getImage
*/
@GET
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
@Fallback(NullOnNotFoundOr404.class)
@XMLResponseParser(ImageHandler.class)
ListenableFuture<Image> getImage(@EndpointParam URI imageHref);
@ -133,7 +133,7 @@ public interface DeltacloudAsyncClient {
*/
@GET
@Endpoint(HardwareProfiles.class)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
@Fallback(EmptySetOnNotFoundOr404.class)
@XMLResponseParser(HardwareProfilesHandler.class)
ListenableFuture<Set<HardwareProfile>> listHardwareProfiles();
@ -141,7 +141,7 @@ public interface DeltacloudAsyncClient {
* @see DeltacloudClient#getHardwareProfile
*/
@GET
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
@Fallback(NullOnNotFoundOr404.class)
@XMLResponseParser(HardwareProfileHandler.class)
ListenableFuture<HardwareProfile> getHardwareProfile(@EndpointParam URI profileHref);
@ -150,7 +150,7 @@ public interface DeltacloudAsyncClient {
*/
@GET
@Endpoint(Instances.class)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
@Fallback(EmptySetOnNotFoundOr404.class)
@XMLResponseParser(InstancesHandler.class)
ListenableFuture<Set<Instance>> listInstances();
@ -158,7 +158,7 @@ public interface DeltacloudAsyncClient {
* @see DeltacloudClient#getInstance
*/
@GET
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
@Fallback(NullOnNotFoundOr404.class)
@XMLResponseParser(InstanceHandler.class)
ListenableFuture<Instance> getInstance(@EndpointParam URI instanceHref);
@ -173,7 +173,7 @@ public interface DeltacloudAsyncClient {
/**
* @see DeltacloudClient#performInstanceAction
*/
@ExceptionParser(ReturnVoidOnRedirectedDelete.class)
@Fallback(VoidOnRedirectedDelete.class)
ListenableFuture<Void> performAction(HttpRequest action);
}

View File

@ -0,0 +1,52 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.deltacloud;
import static com.google.common.base.Throwables.propagate;
import static com.google.common.util.concurrent.Futures.immediateFuture;
import static org.jclouds.util.Throwables2.getFirstThrowableOfType;
import javax.ws.rs.HttpMethod;
import org.jclouds.http.HttpResponseException;
import com.google.common.util.concurrent.FutureFallback;
import com.google.common.util.concurrent.ListenableFuture;
public final class DeltacloudFallbacks {
private DeltacloudFallbacks() {
}
/**
* When a delete operation is performed, Deltacloud returns 302.
*
* @author Adrian Cole
*/
public static final class VoidOnRedirectedDelete implements FutureFallback<Void> {
@Override
public ListenableFuture<Void> create(final Throwable t) {
HttpResponseException exception = getFirstThrowableOfType(t, HttpResponseException.class);
if (exception != null && exception.getCommand().getCurrentRequest().getMethod().equals(HttpMethod.DELETE)
&& exception.getResponse().getStatusCode() == 302) {
return immediateFuture(null);
}
throw propagate(t);
}
}
}

View File

@ -1,46 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.deltacloud.functions;
import javax.inject.Singleton;
import javax.ws.rs.HttpMethod;
import org.jclouds.http.HttpResponseException;
import org.jclouds.util.Throwables2;
import com.google.common.base.Function;
import com.google.common.base.Throwables;
/**
* When a delete operation is performed, Deltacloud returns 302.
*
* @author Adrian Cole
*/
@Singleton
public class ReturnVoidOnRedirectedDelete implements Function<Exception, Void> {
public Void apply(Exception from) {
HttpResponseException exception = Throwables2.getFirstThrowableOfType(from, HttpResponseException.class);
if (exception != null && exception.getCommand().getCurrentRequest().getMethod().equals(HttpMethod.DELETE)
&& exception.getResponse().getStatusCode() == 302) {
return null;
}
throw Throwables.propagate(from);
}
}

View File

@ -25,10 +25,13 @@ import java.lang.reflect.Method;
import java.net.URI;
import java.util.Set;
import org.jclouds.Fallbacks.EmptyMultimapOnNotFoundOr404;
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.apis.ApiMetadata;
import org.jclouds.deltacloud.DeltacloudFallbacks.VoidOnRedirectedDelete;
import org.jclouds.deltacloud.config.DeltacloudRestClientModule;
import org.jclouds.deltacloud.domain.DeltacloudCollection;
import org.jclouds.deltacloud.functions.ReturnVoidOnRedirectedDelete;
import org.jclouds.deltacloud.options.CreateInstanceOptions;
import org.jclouds.deltacloud.xml.DeltacloudCollectionsHandler;
import org.jclouds.deltacloud.xml.HardwareProfileHandler;
@ -45,9 +48,6 @@ import org.jclouds.http.filters.BasicAuthentication;
import org.jclouds.http.functions.ParseSax;
import org.jclouds.http.functions.ReleasePayloadAndReturn;
import org.jclouds.rest.ConfiguresRestClient;
import org.jclouds.rest.functions.ReturnEmptyMultimapOnNotFoundOr404;
import org.jclouds.rest.functions.ReturnEmptySetOnNotFoundOr404;
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
import org.jclouds.rest.internal.BaseAsyncClientTest;
import org.jclouds.rest.internal.GeneratedHttpRequest;
import org.jclouds.rest.internal.RestAnnotationProcessor;
@ -88,7 +88,7 @@ public class DeltacloudAsyncClientTest extends BaseAsyncClientTest<DeltacloudAsy
assertResponseParserClassEquals(method, httpRequest, ParseSax.class);
assertSaxResponseParserClassEquals(method, DeltacloudCollectionsHandler.class);
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class);
assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
checkFilters(httpRequest);
@ -104,7 +104,7 @@ public class DeltacloudAsyncClientTest extends BaseAsyncClientTest<DeltacloudAsy
assertResponseParserClassEquals(method, request, ParseSax.class);
assertSaxResponseParserClassEquals(method, InstanceStatesHandler.class);
assertExceptionParserClassEquals(method, ReturnEmptyMultimapOnNotFoundOr404.class);
assertFallbackClassEquals(method, EmptyMultimapOnNotFoundOr404.class);
checkFilters(request);
}
@ -119,7 +119,7 @@ public class DeltacloudAsyncClientTest extends BaseAsyncClientTest<DeltacloudAsy
assertResponseParserClassEquals(method, request, ParseSax.class);
assertSaxResponseParserClassEquals(method, RealmsHandler.class);
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class);
assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
checkFilters(request);
}
@ -134,7 +134,7 @@ public class DeltacloudAsyncClientTest extends BaseAsyncClientTest<DeltacloudAsy
assertResponseParserClassEquals(method, request, ParseSax.class);
assertSaxResponseParserClassEquals(method, RealmHandler.class);
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
checkFilters(request);
}
@ -149,7 +149,7 @@ public class DeltacloudAsyncClientTest extends BaseAsyncClientTest<DeltacloudAsy
assertResponseParserClassEquals(method, request, ParseSax.class);
assertSaxResponseParserClassEquals(method, ImagesHandler.class);
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class);
assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
checkFilters(request);
}
@ -164,7 +164,7 @@ public class DeltacloudAsyncClientTest extends BaseAsyncClientTest<DeltacloudAsy
assertResponseParserClassEquals(method, request, ParseSax.class);
assertSaxResponseParserClassEquals(method, ImageHandler.class);
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
checkFilters(request);
}
@ -179,7 +179,7 @@ public class DeltacloudAsyncClientTest extends BaseAsyncClientTest<DeltacloudAsy
assertResponseParserClassEquals(method, request, ParseSax.class);
assertSaxResponseParserClassEquals(method, HardwareProfilesHandler.class);
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class);
assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
checkFilters(request);
}
@ -194,7 +194,7 @@ public class DeltacloudAsyncClientTest extends BaseAsyncClientTest<DeltacloudAsy
assertResponseParserClassEquals(method, request, ParseSax.class);
assertSaxResponseParserClassEquals(method, HardwareProfileHandler.class);
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
checkFilters(request);
}
@ -209,7 +209,7 @@ public class DeltacloudAsyncClientTest extends BaseAsyncClientTest<DeltacloudAsy
assertResponseParserClassEquals(method, request, ParseSax.class);
assertSaxResponseParserClassEquals(method, InstancesHandler.class);
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class);
assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
checkFilters(request);
}
@ -224,7 +224,7 @@ public class DeltacloudAsyncClientTest extends BaseAsyncClientTest<DeltacloudAsy
assertResponseParserClassEquals(method, request, ParseSax.class);
assertSaxResponseParserClassEquals(method, InstanceHandler.class);
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
checkFilters(request);
}
@ -240,7 +240,7 @@ public class DeltacloudAsyncClientTest extends BaseAsyncClientTest<DeltacloudAsy
assertResponseParserClassEquals(method, httpRequest, ParseSax.class);
assertSaxResponseParserClassEquals(method, InstanceHandler.class);
assertExceptionParserClassEquals(method, null);
assertFallbackClassEquals(method, null);
checkFilters(httpRequest);
@ -258,7 +258,7 @@ public class DeltacloudAsyncClientTest extends BaseAsyncClientTest<DeltacloudAsy
assertResponseParserClassEquals(method, httpRequest, ParseSax.class);
assertSaxResponseParserClassEquals(method, InstanceHandler.class);
assertExceptionParserClassEquals(method, null);
assertFallbackClassEquals(method, null);
checkFilters(httpRequest);
@ -275,7 +275,7 @@ public class DeltacloudAsyncClientTest extends BaseAsyncClientTest<DeltacloudAsy
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnVoidOnRedirectedDelete.class);
assertFallbackClassEquals(method, VoidOnRedirectedDelete.class);
checkFilters(request);
}

View File

@ -0,0 +1,48 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.ec2;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Throwables.propagate;
import static com.google.common.util.concurrent.Futures.immediateFuture;
import org.jclouds.aws.AWSResponseException;
import com.google.common.base.Predicates;
import com.google.common.collect.ImmutableSet;
import com.google.common.util.concurrent.FutureFallback;
import com.google.common.util.concurrent.ListenableFuture;
public final class EC2Fallbacks {
private EC2Fallbacks() {
}
public static final class VoidOnVolumeAvailable implements FutureFallback<Object> {
@Override
public ListenableFuture<Object> create(final Throwable t) {
if (checkNotNull(t, "throwable") instanceof AWSResponseException) {
AWSResponseException e = AWSResponseException.class.cast(t);
if (Predicates.in(ImmutableSet.of("IncorrectState", "available")).apply(e.getError().getCode()))
return immediateFuture(null);
}
throw propagate(t);
}
}
}

View File

@ -26,6 +26,7 @@ import javax.inject.Named;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import org.jclouds.Fallbacks.EmptyFluentIterableOnNotFoundOr404;
import org.jclouds.aws.filters.FormSigner;
import org.jclouds.ec2.binders.BindFiltersToIndexedFormParams;
import org.jclouds.ec2.binders.BindResourceIdsToIndexedFormParams;
@ -34,13 +35,12 @@ import org.jclouds.ec2.binders.BindTagsToIndexedFormParams;
import org.jclouds.ec2.domain.Tag;
import org.jclouds.ec2.xml.DescribeTagsResponseHandler;
import org.jclouds.rest.annotations.BinderParam;
import org.jclouds.rest.annotations.ExceptionParser;
import org.jclouds.rest.annotations.Fallback;
import org.jclouds.rest.annotations.FormParams;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.SinceApiVersion;
import org.jclouds.rest.annotations.VirtualHost;
import org.jclouds.rest.annotations.XMLResponseParser;
import org.jclouds.rest.functions.ReturnEmptyFluentIterableOnNotFoundOr404;
import com.google.common.collect.FluentIterable;
import com.google.common.collect.Multimap;
@ -94,7 +94,7 @@ public interface TagAsyncApi {
@Path("/")
@FormParams(keys = ACTION, values = "DescribeTags")
@XMLResponseParser(DescribeTagsResponseHandler.class)
@ExceptionParser(ReturnEmptyFluentIterableOnNotFoundOr404.class)
@Fallback(EmptyFluentIterableOnNotFoundOr404.class)
ListenableFuture<FluentIterable<Tag>> list();
/**
@ -107,7 +107,7 @@ public interface TagAsyncApi {
@Path("/")
@FormParams(keys = ACTION, values = "DescribeTags")
@XMLResponseParser(DescribeTagsResponseHandler.class)
@ExceptionParser(ReturnEmptyFluentIterableOnNotFoundOr404.class)
@Fallback(EmptyFluentIterableOnNotFoundOr404.class)
ListenableFuture<FluentIterable<Tag>> filter(
@BinderParam(BindFiltersToIndexedFormParams.class) Multimap<String, String> filter);

View File

@ -25,16 +25,16 @@ import javax.ws.rs.FormParam;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.aws.filters.FormSigner;
import org.jclouds.ec2.domain.PasswordData;
import org.jclouds.ec2.xml.GetPasswordDataResponseHandler;
import org.jclouds.rest.annotations.ExceptionParser;
import org.jclouds.rest.annotations.Fallback;
import org.jclouds.rest.annotations.FormParams;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.SinceApiVersion;
import org.jclouds.rest.annotations.VirtualHost;
import org.jclouds.rest.annotations.XMLResponseParser;
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
import com.google.common.annotations.Beta;
import com.google.common.util.concurrent.ListenableFuture;
@ -61,7 +61,7 @@ public interface WindowsAsyncApi {
@Path("/")
@FormParams(keys = ACTION, values = "GetPasswordData")
@XMLResponseParser(GetPasswordDataResponseHandler.class)
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
@Fallback(NullOnNotFoundOr404.class)
ListenableFuture<PasswordData> getPasswordDataForInstance(@FormParam("InstanceId") String instanceId);
}

View File

@ -1,41 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.ec2.functions;
import javax.inject.Singleton;
import org.jclouds.aws.AWSResponseException;
import com.google.common.base.Function;
import com.google.common.base.Throwables;
@Singleton
public class ReturnVoidOnVolumeAvailable implements Function<Exception, Void> {
public Void apply(Exception from) {
if (from instanceof AWSResponseException) {
AWSResponseException e = (AWSResponseException) from;
if (e.getError().getCode().equals("IncorrectState")
&& e.getError().getCode().contains("available"))
return null;
}
throw Throwables.propagate(from);
}
}

View File

@ -28,12 +28,13 @@ import javax.ws.rs.FormParam;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
import org.jclouds.aws.filters.FormSigner;
import org.jclouds.ec2.binders.BindUserGroupsToIndexedFormParams;
import org.jclouds.ec2.binders.BindUserIdsToIndexedFormParams;
import org.jclouds.ec2.domain.Image;
import org.jclouds.ec2.domain.Permission;
import org.jclouds.ec2.domain.Image.EbsBlockDevice;
import org.jclouds.ec2.domain.Permission;
import org.jclouds.ec2.options.CreateImageOptions;
import org.jclouds.ec2.options.DescribeImagesOptions;
import org.jclouds.ec2.options.RegisterImageBackedByEbsOptions;
@ -46,12 +47,11 @@ import org.jclouds.javax.annotation.Nullable;
import org.jclouds.location.functions.RegionToEndpointOrProviderIfNull;
import org.jclouds.rest.annotations.BinderParam;
import org.jclouds.rest.annotations.EndpointParam;
import org.jclouds.rest.annotations.ExceptionParser;
import org.jclouds.rest.annotations.Fallback;
import org.jclouds.rest.annotations.FormParams;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.VirtualHost;
import org.jclouds.rest.annotations.XMLResponseParser;
import org.jclouds.rest.functions.ReturnEmptySetOnNotFoundOr404;
import com.google.common.util.concurrent.ListenableFuture;
@ -73,7 +73,7 @@ public interface AMIAsyncClient {
@Path("/")
@FormParams(keys = ACTION, values = "DescribeImages")
@XMLResponseParser(DescribeImagesResponseHandler.class)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
@Fallback(EmptySetOnNotFoundOr404.class)
ListenableFuture<Set<? extends Image>> describeImagesInRegion(
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
DescribeImagesOptions... options);

View File

@ -28,6 +28,7 @@ import javax.inject.Named;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
import org.jclouds.aws.filters.FormSigner;
import org.jclouds.ec2.domain.AvailabilityZoneInfo;
import org.jclouds.ec2.options.DescribeAvailabilityZonesOptions;
@ -37,12 +38,11 @@ import org.jclouds.ec2.xml.DescribeRegionsResponseHandler;
import org.jclouds.javax.annotation.Nullable;
import org.jclouds.location.functions.RegionToEndpointOrProviderIfNull;
import org.jclouds.rest.annotations.EndpointParam;
import org.jclouds.rest.annotations.ExceptionParser;
import org.jclouds.rest.annotations.Fallback;
import org.jclouds.rest.annotations.FormParams;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.VirtualHost;
import org.jclouds.rest.annotations.XMLResponseParser;
import org.jclouds.rest.functions.ReturnEmptySetOnNotFoundOr404;
import com.google.common.util.concurrent.ListenableFuture;
@ -64,7 +64,7 @@ public interface AvailabilityZoneAndRegionAsyncClient {
@Path("/")
@FormParams(keys = ACTION, values = "DescribeAvailabilityZones")
@XMLResponseParser(DescribeAvailabilityZonesResponseHandler.class)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
@Fallback(EmptySetOnNotFoundOr404.class)
ListenableFuture<? extends Set<AvailabilityZoneInfo>> describeAvailabilityZonesInRegion(
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
DescribeAvailabilityZonesOptions... options);

View File

@ -27,7 +27,9 @@ import javax.ws.rs.FormParam;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
import org.jclouds.aws.filters.FormSigner;
import org.jclouds.ec2.EC2Fallbacks.VoidOnVolumeAvailable;
import org.jclouds.ec2.binders.BindUserGroupsToIndexedFormParams;
import org.jclouds.ec2.binders.BindUserIdsToIndexedFormParams;
import org.jclouds.ec2.binders.BindVolumeIdsToIndexedFormParams;
@ -35,7 +37,6 @@ import org.jclouds.ec2.domain.Attachment;
import org.jclouds.ec2.domain.Permission;
import org.jclouds.ec2.domain.Snapshot;
import org.jclouds.ec2.domain.Volume;
import org.jclouds.ec2.functions.ReturnVoidOnVolumeAvailable;
import org.jclouds.ec2.options.CreateSnapshotOptions;
import org.jclouds.ec2.options.DescribeSnapshotsOptions;
import org.jclouds.ec2.options.DetachVolumeOptions;
@ -50,12 +51,11 @@ import org.jclouds.location.functions.RegionToEndpointOrProviderIfNull;
import org.jclouds.location.functions.ZoneToEndpoint;
import org.jclouds.rest.annotations.BinderParam;
import org.jclouds.rest.annotations.EndpointParam;
import org.jclouds.rest.annotations.ExceptionParser;
import org.jclouds.rest.annotations.Fallback;
import org.jclouds.rest.annotations.FormParams;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.VirtualHost;
import org.jclouds.rest.annotations.XMLResponseParser;
import org.jclouds.rest.functions.ReturnEmptySetOnNotFoundOr404;
import com.google.common.util.concurrent.ListenableFuture;
@ -134,7 +134,7 @@ public interface ElasticBlockStoreAsyncClient {
@POST
@Path("/")
@FormParams(keys = ACTION, values = "DetachVolume")
@ExceptionParser(ReturnVoidOnVolumeAvailable.class)
@Fallback(VoidOnVolumeAvailable.class)
ListenableFuture<Void> detachVolumeInRegion(@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
@FormParam("VolumeId") String volumeId, @FormParam("Force") boolean force, DetachVolumeOptions... options);
@ -171,7 +171,7 @@ public interface ElasticBlockStoreAsyncClient {
@Path("/")
@FormParams(keys = ACTION, values = "DescribeSnapshots")
@XMLResponseParser(DescribeSnapshotsResponseHandler.class)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
@Fallback(EmptySetOnNotFoundOr404.class)
ListenableFuture<? extends Set<Snapshot>> describeSnapshotsInRegion(
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
DescribeSnapshotsOptions... options);

View File

@ -27,6 +27,7 @@ import javax.ws.rs.FormParam;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
import org.jclouds.aws.filters.FormSigner;
import org.jclouds.ec2.binders.BindPublicIpsToIndexedFormParams;
import org.jclouds.ec2.domain.PublicIpInstanceIdPair;
@ -36,12 +37,11 @@ import org.jclouds.javax.annotation.Nullable;
import org.jclouds.location.functions.RegionToEndpointOrProviderIfNull;
import org.jclouds.rest.annotations.BinderParam;
import org.jclouds.rest.annotations.EndpointParam;
import org.jclouds.rest.annotations.ExceptionParser;
import org.jclouds.rest.annotations.Fallback;
import org.jclouds.rest.annotations.FormParams;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.VirtualHost;
import org.jclouds.rest.annotations.XMLResponseParser;
import org.jclouds.rest.functions.ReturnEmptySetOnNotFoundOr404;
import com.google.common.util.concurrent.ListenableFuture;
@ -107,7 +107,7 @@ public interface ElasticIPAddressAsyncClient {
@Path("/")
@FormParams(keys = ACTION, values = "DescribeAddresses")
@XMLResponseParser(DescribeAddressesResponseHandler.class)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
@Fallback(EmptySetOnNotFoundOr404.class)
ListenableFuture<? extends Set<PublicIpInstanceIdPair>> describeAddressesInRegion(
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
@BinderParam(BindPublicIpsToIndexedFormParams.class) String... publicIps);

View File

@ -28,6 +28,7 @@ import javax.ws.rs.FormParam;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
import org.jclouds.aws.filters.FormSigner;
import org.jclouds.ec2.binders.BindBlockDeviceMappingToIndexedFormParams;
import org.jclouds.ec2.binders.BindInstanceIdsToIndexedFormParams;
@ -53,13 +54,12 @@ import org.jclouds.javax.annotation.Nullable;
import org.jclouds.location.functions.RegionToEndpointOrProviderIfNull;
import org.jclouds.rest.annotations.BinderParam;
import org.jclouds.rest.annotations.EndpointParam;
import org.jclouds.rest.annotations.ExceptionParser;
import org.jclouds.rest.annotations.Fallback;
import org.jclouds.rest.annotations.FormParams;
import org.jclouds.rest.annotations.ParamParser;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.VirtualHost;
import org.jclouds.rest.annotations.XMLResponseParser;
import org.jclouds.rest.functions.ReturnEmptySetOnNotFoundOr404;
import com.google.common.util.concurrent.ListenableFuture;
@ -81,7 +81,7 @@ public interface InstanceAsyncClient {
@Path("/")
@FormParams(keys = ACTION, values = "DescribeInstances")
@XMLResponseParser(DescribeInstancesResponseHandler.class)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
@Fallback(EmptySetOnNotFoundOr404.class)
ListenableFuture<? extends Set<? extends Reservation<? extends RunningInstance>>> describeInstancesInRegion(
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
@BinderParam(BindInstanceIdsToIndexedFormParams.class) String... instanceIds);
@ -119,7 +119,7 @@ public interface InstanceAsyncClient {
@Path("/")
@FormParams(keys = ACTION, values = "TerminateInstances")
@XMLResponseParser(InstanceStateChangeHandler.class)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
@Fallback(EmptySetOnNotFoundOr404.class)
ListenableFuture<Set<? extends InstanceStateChange>> terminateInstancesInRegion(
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
@BinderParam(BindInstanceIdsToIndexedFormParams.class) String... instanceIds);

View File

@ -27,6 +27,7 @@ import javax.ws.rs.FormParam;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
import org.jclouds.aws.filters.FormSigner;
import org.jclouds.ec2.binders.BindKeyNamesToIndexedFormParams;
import org.jclouds.ec2.domain.KeyPair;
@ -36,12 +37,11 @@ import org.jclouds.javax.annotation.Nullable;
import org.jclouds.location.functions.RegionToEndpointOrProviderIfNull;
import org.jclouds.rest.annotations.BinderParam;
import org.jclouds.rest.annotations.EndpointParam;
import org.jclouds.rest.annotations.ExceptionParser;
import org.jclouds.rest.annotations.Fallback;
import org.jclouds.rest.annotations.FormParams;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.VirtualHost;
import org.jclouds.rest.annotations.XMLResponseParser;
import org.jclouds.rest.functions.ReturnEmptySetOnNotFoundOr404;
import com.google.common.util.concurrent.ListenableFuture;
@ -75,7 +75,7 @@ public interface KeyPairAsyncClient {
@Path("/")
@FormParams(keys = ACTION, values = "DescribeKeyPairs")
@XMLResponseParser(DescribeKeyPairsResponseHandler.class)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
@Fallback(EmptySetOnNotFoundOr404.class)
ListenableFuture<? extends Set<KeyPair>> describeKeyPairsInRegion(
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
@BinderParam(BindKeyNamesToIndexedFormParams.class) String... keyPairNames);

View File

@ -27,6 +27,8 @@ import javax.ws.rs.FormParam;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
import org.jclouds.Fallbacks.VoidOnNotFoundOr404;
import org.jclouds.aws.filters.FormSigner;
import org.jclouds.ec2.binders.BindGroupNamesToIndexedFormParams;
import org.jclouds.ec2.binders.BindUserIdGroupPairToSourceSecurityGroupFormParams;
@ -38,13 +40,11 @@ import org.jclouds.javax.annotation.Nullable;
import org.jclouds.location.functions.RegionToEndpointOrProviderIfNull;
import org.jclouds.rest.annotations.BinderParam;
import org.jclouds.rest.annotations.EndpointParam;
import org.jclouds.rest.annotations.ExceptionParser;
import org.jclouds.rest.annotations.Fallback;
import org.jclouds.rest.annotations.FormParams;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.VirtualHost;
import org.jclouds.rest.annotations.XMLResponseParser;
import org.jclouds.rest.functions.ReturnEmptySetOnNotFoundOr404;
import org.jclouds.rest.functions.ReturnVoidOnNotFoundOr404;
import com.google.common.util.concurrent.ListenableFuture;
@ -76,7 +76,7 @@ public interface SecurityGroupAsyncClient {
@POST
@Path("/")
@FormParams(keys = ACTION, values = "DeleteSecurityGroup")
@ExceptionParser(ReturnVoidOnNotFoundOr404.class)
@Fallback(VoidOnNotFoundOr404.class)
ListenableFuture<Void> deleteSecurityGroupInRegion(
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region, @FormParam("GroupName") String name);
@ -88,7 +88,7 @@ public interface SecurityGroupAsyncClient {
@Path("/")
@FormParams(keys = ACTION, values = "DescribeSecurityGroups")
@XMLResponseParser(DescribeSecurityGroupsResponseHandler.class)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
@Fallback(EmptySetOnNotFoundOr404.class)
ListenableFuture<? extends Set<SecurityGroup>> describeSecurityGroupsInRegion(
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
@BinderParam(BindGroupNamesToIndexedFormParams.class) String... securityGroupNames);

View File

@ -27,6 +27,7 @@ import javax.ws.rs.FormParam;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
import org.jclouds.aws.filters.FormSigner;
import org.jclouds.ec2.binders.BindBundleIdsToIndexedFormParams;
import org.jclouds.ec2.binders.BindS3UploadPolicyAndSignature;
@ -40,12 +41,11 @@ import org.jclouds.javax.annotation.Nullable;
import org.jclouds.location.functions.RegionToEndpointOrProviderIfNull;
import org.jclouds.rest.annotations.BinderParam;
import org.jclouds.rest.annotations.EndpointParam;
import org.jclouds.rest.annotations.ExceptionParser;
import org.jclouds.rest.annotations.Fallback;
import org.jclouds.rest.annotations.FormParams;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.VirtualHost;
import org.jclouds.rest.annotations.XMLResponseParser;
import org.jclouds.rest.functions.ReturnEmptySetOnNotFoundOr404;
import com.google.common.util.concurrent.ListenableFuture;
@ -94,7 +94,7 @@ public interface WindowsAsyncClient {
@Path("/")
@FormParams(keys = ACTION, values = "DescribeBundleTasks")
@XMLResponseParser(DescribeBundleTasksResponseHandler.class)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
@Fallback(EmptySetOnNotFoundOr404.class)
ListenableFuture<? extends Set<BundleTask>> describeBundleTasksInRegion(
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
@BinderParam(BindBundleIdsToIndexedFormParams.class) String... bundleTaskIds);

View File

@ -24,6 +24,7 @@ import java.io.IOException;
import java.lang.reflect.Array;
import java.lang.reflect.Method;
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
import org.jclouds.ec2.options.CreateImageOptions;
import org.jclouds.ec2.options.DescribeImagesOptions;
import org.jclouds.ec2.options.RegisterImageBackedByEbsOptions;
@ -35,7 +36,6 @@ import org.jclouds.ec2.xml.PermissionHandler;
import org.jclouds.http.HttpRequest;
import org.jclouds.http.functions.ParseSax;
import org.jclouds.http.functions.ReleasePayloadAndReturn;
import org.jclouds.rest.functions.ReturnEmptySetOnNotFoundOr404;
import org.jclouds.rest.internal.RestAnnotationProcessor;
import org.testng.annotations.Test;
@ -62,7 +62,7 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest<AMIAsyncClient> {
"application/x-www-form-urlencoded", false);
assertResponseParserClassEquals(method, request, ParseSax.class);
assertSaxResponseParserClassEquals(method, ImageIdHandler.class);
assertExceptionParserClassEquals(method, null);
assertFallbackClassEquals(method, null);
checkFilters(request);
}
@ -82,7 +82,7 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest<AMIAsyncClient> {
assertResponseParserClassEquals(method, request, ParseSax.class);
assertSaxResponseParserClassEquals(method, ImageIdHandler.class);
assertExceptionParserClassEquals(method, null);
assertFallbackClassEquals(method, null);
checkFilters(request);
}
@ -104,7 +104,7 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest<AMIAsyncClient> {
assertResponseParserClassEquals(method, request, ParseSax.class);
assertSaxResponseParserClassEquals(method, DescribeImagesResponseHandler.class);
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class);
assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
checkFilters(request);
}
@ -124,7 +124,7 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest<AMIAsyncClient> {
assertResponseParserClassEquals(method, request, ParseSax.class);
assertSaxResponseParserClassEquals(method, DescribeImagesResponseHandler.class);
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class);
assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
checkFilters(request);
}
@ -140,7 +140,7 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest<AMIAsyncClient> {
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, null);
assertFallbackClassEquals(method, null);
checkFilters(request);
}
@ -156,7 +156,7 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest<AMIAsyncClient> {
"application/x-www-form-urlencoded", false);
assertResponseParserClassEquals(method, request, ParseSax.class);
assertSaxResponseParserClassEquals(method, ImageIdHandler.class);
assertExceptionParserClassEquals(method, null);
assertFallbackClassEquals(method, null);
checkFilters(request);
}
@ -176,7 +176,7 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest<AMIAsyncClient> {
assertResponseParserClassEquals(method, request, ParseSax.class);
assertSaxResponseParserClassEquals(method, ImageIdHandler.class);
assertExceptionParserClassEquals(method, null);
assertFallbackClassEquals(method, null);
checkFilters(request);
}
@ -194,7 +194,7 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest<AMIAsyncClient> {
"application/x-www-form-urlencoded", false);
assertResponseParserClassEquals(method, request, ParseSax.class);
assertSaxResponseParserClassEquals(method, ImageIdHandler.class);
assertExceptionParserClassEquals(method, null);
assertFallbackClassEquals(method, null);
checkFilters(request);
}
@ -215,7 +215,7 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest<AMIAsyncClient> {
assertResponseParserClassEquals(method, request, ParseSax.class);
assertSaxResponseParserClassEquals(method, ImageIdHandler.class);
assertExceptionParserClassEquals(method, null);
assertFallbackClassEquals(method, null);
checkFilters(request);
}
@ -233,7 +233,7 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest<AMIAsyncClient> {
assertResponseParserClassEquals(method, request, ParseSax.class);
assertSaxResponseParserClassEquals(method, BlockDeviceMappingHandler.class);
assertExceptionParserClassEquals(method, null);
assertFallbackClassEquals(method, null);
checkFilters(request);
}
@ -250,7 +250,7 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest<AMIAsyncClient> {
assertResponseParserClassEquals(method, request, ParseSax.class);
assertSaxResponseParserClassEquals(method, PermissionHandler.class);
assertExceptionParserClassEquals(method, null);
assertFallbackClassEquals(method, null);
checkFilters(request);
}
@ -275,7 +275,7 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest<AMIAsyncClient> {
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, null);
assertFallbackClassEquals(method, null);
checkFilters(request);
}
@ -294,7 +294,7 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest<AMIAsyncClient> {
"application/x-www-form-urlencoded", false);
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, null);
assertFallbackClassEquals(method, null);
checkFilters(request);
}
@ -311,7 +311,7 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest<AMIAsyncClient> {
"application/x-www-form-urlencoded", false);
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, null);
assertFallbackClassEquals(method, null);
checkFilters(request);
}

View File

@ -25,6 +25,7 @@ import java.io.IOException;
import java.lang.reflect.Array;
import java.lang.reflect.Method;
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
import org.jclouds.aws.domain.Region;
import org.jclouds.ec2.options.DescribeAvailabilityZonesOptions;
import org.jclouds.ec2.options.DescribeRegionsOptions;
@ -32,7 +33,6 @@ import org.jclouds.ec2.xml.DescribeAvailabilityZonesResponseHandler;
import org.jclouds.ec2.xml.DescribeRegionsResponseHandler;
import org.jclouds.http.HttpRequest;
import org.jclouds.http.functions.ParseSax;
import org.jclouds.rest.functions.ReturnEmptySetOnNotFoundOr404;
import org.jclouds.rest.internal.RestAnnotationProcessor;
import org.testng.annotations.Test;
@ -60,7 +60,7 @@ public class AvailabilityZoneAndRegionAsyncClientTest extends
assertResponseParserClassEquals(method, request, ParseSax.class);
assertSaxResponseParserClassEquals(method, DescribeAvailabilityZonesResponseHandler.class);
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class);
assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
checkFilters(request);
}
@ -78,7 +78,7 @@ public class AvailabilityZoneAndRegionAsyncClientTest extends
assertResponseParserClassEquals(method, request, ParseSax.class);
assertSaxResponseParserClassEquals(method, DescribeAvailabilityZonesResponseHandler.class);
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class);
assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
checkFilters(request);
}
@ -95,7 +95,7 @@ public class AvailabilityZoneAndRegionAsyncClientTest extends
assertResponseParserClassEquals(method, request, ParseSax.class);
assertSaxResponseParserClassEquals(method, DescribeRegionsResponseHandler.class);
assertExceptionParserClassEquals(method, null);
assertFallbackClassEquals(method, null);
checkFilters(request);
}
@ -113,7 +113,7 @@ public class AvailabilityZoneAndRegionAsyncClientTest extends
assertResponseParserClassEquals(method, request, ParseSax.class);
assertSaxResponseParserClassEquals(method, DescribeRegionsResponseHandler.class);
assertExceptionParserClassEquals(method, null);
assertFallbackClassEquals(method, null);
checkFilters(request);
}

Some files were not shown because too many files have changed in this diff Show More