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

View File

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

View File

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

View File

@ -16,9 +16,11 @@
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * 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.assertEquals;
import static org.testng.Assert.assertNull;
import java.net.URI; import java.net.URI;
@ -30,27 +32,27 @@ import org.testng.annotations.Test;
* @author Adrian Cole * @author Adrian Cole
*/ */
@Test(groups = "unit") @Test(groups = "unit")
public class ReturnEndpointIfAlreadyExistsTest { public class EndpointIfAlreadyExistsTest {
@Test @Test
public void testFoundIsNullWhenEndpointNotSet() { public void testFoundIsNullWhenEndpointNotSet() {
assertEquals(new ReturnEndpointIfAlreadyExists().apply(new KeyAlreadyExistsException()), null); assertNull(getUnchecked(new EndpointIfAlreadyExists().create(new KeyAlreadyExistsException())));
} }
@Test @Test
public void testFoundIsEndpointWhenSet() { public void testFoundIsEndpointWhenSet() {
assertEquals( assertEquals(
new ReturnEndpointIfAlreadyExists().setEndpoint(URI.create("foo")).apply(new KeyAlreadyExistsException()), getUnchecked(new EndpointIfAlreadyExists().setEndpoint(URI.create("foo")).create(
URI.create("foo")); new KeyAlreadyExistsException())), URI.create("foo"));
} }
@Test(expectedExceptions = RuntimeException.class) @Test(expectedExceptions = RuntimeException.class)
public void testNotFoundPropagates() { public void testNotFoundPropagates() {
new ReturnEndpointIfAlreadyExists().apply(new RuntimeException()); new EndpointIfAlreadyExists().create(new RuntimeException());
} }
@Test(expectedExceptions = NullPointerException.class) @Test(expectedExceptions = NullPointerException.class)
public void testNullIsBad() { 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.net.URI;
import java.util.Set; import java.util.Set;
import java.util.concurrent.ExecutionException;
import javax.ws.rs.Consumes; import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE; import javax.ws.rs.DELETE;
@ -32,7 +33,7 @@ import javax.ws.rs.Path;
import javax.ws.rs.PathParam; import javax.ws.rs.PathParam;
import javax.ws.rs.core.MediaType; 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.binders.BindIterableToHeadersWithPurgeCDNObjectEmail;
import org.jclouds.cloudfiles.domain.ContainerCDNMetadata; import org.jclouds.cloudfiles.domain.ContainerCDNMetadata;
import org.jclouds.cloudfiles.functions.ParseCdnUriFromHeaders; 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.openstack.swift.Storage;
import org.jclouds.rest.annotations.BinderParam; import org.jclouds.rest.annotations.BinderParam;
import org.jclouds.rest.annotations.Endpoint; 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.Headers;
import org.jclouds.rest.annotations.QueryParams; import org.jclouds.rest.annotations.QueryParams;
import org.jclouds.rest.annotations.RequestFilters; import org.jclouds.rest.annotations.RequestFilters;
@ -82,7 +83,7 @@ public interface CloudFilesAsyncClient extends CommonSwiftAsyncClient {
*/ */
@HEAD @HEAD
@ResponseParser(ParseContainerCDNMetadataFromHeaders.class) @ResponseParser(ParseContainerCDNMetadataFromHeaders.class)
@ExceptionParser(ReturnNullOnContainerNotFound.class) @Fallback(NullOnContainerNotFound.class)
@Path("/{container}") @Path("/{container}")
@Endpoint(CDNManagement.class) @Endpoint(CDNManagement.class)
ListenableFuture<ContainerCDNMetadata> getCDNMetadata(@PathParam("container") String container); ListenableFuture<ContainerCDNMetadata> getCDNMetadata(@PathParam("container") String container);
@ -161,7 +162,7 @@ public interface CloudFilesAsyncClient extends CommonSwiftAsyncClient {
ListenableFuture<Boolean> disableCDN(@PathParam("container") String container); ListenableFuture<Boolean> disableCDN(@PathParam("container") String container);
/** /**
* @see CloudFilesClient#purgeCDNObject(String, String, List) * @see CloudFilesClient#purgeCDNObject(String, String, Iterable)
*/ */
@DELETE @DELETE
@Path("/{container}/{object}") @Path("/{container}/{object}")

View File

@ -19,6 +19,7 @@
package org.jclouds.cloudservers; package org.jclouds.cloudservers;
import java.util.Set; import java.util.Set;
import java.util.concurrent.ExecutionException;
import javax.ws.rs.Consumes; import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE; import javax.ws.rs.DELETE;
@ -30,6 +31,10 @@ import javax.ws.rs.PathParam;
import javax.ws.rs.Produces; import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType; 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.binders.BindBackupScheduleToJsonPayload;
import org.jclouds.cloudservers.domain.Addresses; import org.jclouds.cloudservers.domain.Addresses;
import org.jclouds.cloudservers.domain.BackupSchedule; 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.CreateSharedIpGroupOptions;
import org.jclouds.cloudservers.options.ListOptions; import org.jclouds.cloudservers.options.ListOptions;
import org.jclouds.cloudservers.options.RebuildServerOptions; import org.jclouds.cloudservers.options.RebuildServerOptions;
import org.jclouds.http.functions.ReturnFalseOn404;
import org.jclouds.openstack.filters.AddTimestampQuery; import org.jclouds.openstack.filters.AddTimestampQuery;
import org.jclouds.openstack.filters.AuthenticateRequest; import org.jclouds.openstack.filters.AuthenticateRequest;
import org.jclouds.openstack.services.Compute; import org.jclouds.openstack.services.Compute;
import org.jclouds.rest.annotations.BinderParam; import org.jclouds.rest.annotations.BinderParam;
import org.jclouds.rest.annotations.Endpoint; 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.MapBinder;
import org.jclouds.rest.annotations.Payload; import org.jclouds.rest.annotations.Payload;
import org.jclouds.rest.annotations.PayloadParam; import org.jclouds.rest.annotations.PayloadParam;
import org.jclouds.rest.annotations.QueryParams; import org.jclouds.rest.annotations.QueryParams;
import org.jclouds.rest.annotations.RequestFilters; import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.Unwrap; 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; import com.google.common.util.concurrent.ListenableFuture;
@ -86,7 +86,7 @@ public interface CloudServersAsyncClient {
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@QueryParams(keys = "format", values = "json") @QueryParams(keys = "format", values = "json")
@Path("/limits") @Path("/limits")
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) @Fallback(EmptySetOnNotFoundOr404.class)
ListenableFuture<Limits> getLimits(); ListenableFuture<Limits> getLimits();
/** /**
@ -97,7 +97,7 @@ public interface CloudServersAsyncClient {
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@QueryParams(keys = "format", values = "json") @QueryParams(keys = "format", values = "json")
@Path("/servers") @Path("/servers")
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) @Fallback(EmptySetOnNotFoundOr404.class)
ListenableFuture<? extends Set<Server>> listServers(ListOptions... options); ListenableFuture<? extends Set<Server>> listServers(ListOptions... options);
/** /**
@ -107,7 +107,7 @@ public interface CloudServersAsyncClient {
@Unwrap @Unwrap
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@QueryParams(keys = "format", values = "json") @QueryParams(keys = "format", values = "json")
@ExceptionParser(ReturnNullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
@Path("/servers/{id}") @Path("/servers/{id}")
ListenableFuture<Server> getServer(@PathParam("id") int id); ListenableFuture<Server> getServer(@PathParam("id") int id);
@ -115,7 +115,7 @@ public interface CloudServersAsyncClient {
* @see CloudServersClient#deleteServer * @see CloudServersClient#deleteServer
*/ */
@DELETE @DELETE
@ExceptionParser(ReturnFalseOnNotFoundOr404.class) @Fallback(FalseOnNotFoundOr404.class)
@Path("/servers/{id}") @Path("/servers/{id}")
ListenableFuture<Boolean> deleteServer(@PathParam("id") int id); ListenableFuture<Boolean> deleteServer(@PathParam("id") int id);
@ -196,7 +196,7 @@ public interface CloudServersAsyncClient {
*/ */
@DELETE @DELETE
@Path("/servers/{id}/ips/public/{address}") @Path("/servers/{id}/ips/public/{address}")
@ExceptionParser(ReturnVoidOnNotFoundOr404.class) @Fallback(VoidOnNotFoundOr404.class)
ListenableFuture<Void> unshareIp(@PathParam("address") String addressToShare, ListenableFuture<Void> unshareIp(@PathParam("address") String addressToShare,
@PathParam("id") int serverToTosignBindressTo); @PathParam("id") int serverToTosignBindressTo);
@ -226,7 +226,7 @@ public interface CloudServersAsyncClient {
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@QueryParams(keys = "format", values = "json") @QueryParams(keys = "format", values = "json")
@Path("/flavors") @Path("/flavors")
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) @Fallback(EmptySetOnNotFoundOr404.class)
ListenableFuture<? extends Set<Flavor>> listFlavors(ListOptions... options); ListenableFuture<? extends Set<Flavor>> listFlavors(ListOptions... options);
/** /**
@ -237,7 +237,7 @@ public interface CloudServersAsyncClient {
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@QueryParams(keys = "format", values = "json") @QueryParams(keys = "format", values = "json")
@Path("/flavors/{id}") @Path("/flavors/{id}")
@ExceptionParser(ReturnNullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<Flavor> getFlavor(@PathParam("id") int id); ListenableFuture<Flavor> getFlavor(@PathParam("id") int id);
/** /**
@ -248,7 +248,7 @@ public interface CloudServersAsyncClient {
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@QueryParams(keys = "format", values = "json") @QueryParams(keys = "format", values = "json")
@Path("/images") @Path("/images")
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) @Fallback(EmptySetOnNotFoundOr404.class)
ListenableFuture<? extends Set<Image>> listImages(ListOptions... options); ListenableFuture<? extends Set<Image>> listImages(ListOptions... options);
/** /**
@ -257,7 +257,7 @@ public interface CloudServersAsyncClient {
@GET @GET
@Unwrap @Unwrap
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
@QueryParams(keys = "format", values = "json") @QueryParams(keys = "format", values = "json")
@Path("/images/{id}") @Path("/images/{id}")
ListenableFuture<Image> getImage(@PathParam("id") int id); ListenableFuture<Image> getImage(@PathParam("id") int id);
@ -266,7 +266,7 @@ public interface CloudServersAsyncClient {
* @see CloudServersClient#deleteImage * @see CloudServersClient#deleteImage
*/ */
@DELETE @DELETE
@ExceptionParser(ReturnFalseOnNotFoundOr404.class) @Fallback(FalseOnNotFoundOr404.class)
@Path("/images/{id}") @Path("/images/{id}")
ListenableFuture<Boolean> deleteImage(@PathParam("id") int id); ListenableFuture<Boolean> deleteImage(@PathParam("id") int id);
@ -291,7 +291,7 @@ public interface CloudServersAsyncClient {
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@QueryParams(keys = "format", values = "json") @QueryParams(keys = "format", values = "json")
@Path("/shared_ip_groups") @Path("/shared_ip_groups")
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) @Fallback(EmptySetOnNotFoundOr404.class)
ListenableFuture<? extends Set<SharedIpGroup>> listSharedIpGroups(ListOptions... options); ListenableFuture<? extends Set<SharedIpGroup>> listSharedIpGroups(ListOptions... options);
/** /**
@ -302,7 +302,7 @@ public interface CloudServersAsyncClient {
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@QueryParams(keys = "format", values = "json") @QueryParams(keys = "format", values = "json")
@Path("/shared_ip_groups/{id}") @Path("/shared_ip_groups/{id}")
@ExceptionParser(ReturnNullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<SharedIpGroup> getSharedIpGroup(@PathParam("id") int id); ListenableFuture<SharedIpGroup> getSharedIpGroup(@PathParam("id") int id);
/** /**
@ -321,7 +321,7 @@ public interface CloudServersAsyncClient {
* @see CloudServersClient#deleteSharedIpGroup * @see CloudServersClient#deleteSharedIpGroup
*/ */
@DELETE @DELETE
@ExceptionParser(ReturnFalseOnNotFoundOr404.class) @Fallback(FalseOnNotFoundOr404.class)
@Path("/shared_ip_groups/{id}") @Path("/shared_ip_groups/{id}")
ListenableFuture<Boolean> deleteSharedIpGroup(@PathParam("id") int id); ListenableFuture<Boolean> deleteSharedIpGroup(@PathParam("id") int id);
@ -339,7 +339,7 @@ public interface CloudServersAsyncClient {
* @see CloudServersClient#deleteBackupSchedule * @see CloudServersClient#deleteBackupSchedule
*/ */
@DELETE @DELETE
@ExceptionParser(ReturnFalseOnNotFoundOr404.class) @Fallback(FalseOnNotFoundOr404.class)
@Path("/servers/{id}/backup_schedule") @Path("/servers/{id}/backup_schedule")
ListenableFuture<Boolean> deleteBackupSchedule(@PathParam("id") int serverId); ListenableFuture<Boolean> deleteBackupSchedule(@PathParam("id") int serverId);
@ -347,7 +347,6 @@ public interface CloudServersAsyncClient {
* @see CloudServersClient#replaceBackupSchedule * @see CloudServersClient#replaceBackupSchedule
*/ */
@POST @POST
@ExceptionParser(ReturnFalseOn404.class)
@Path("/servers/{id}/backup_schedule") @Path("/servers/{id}/backup_schedule")
ListenableFuture<Void> replaceBackupSchedule(@PathParam("id") int id, ListenableFuture<Void> replaceBackupSchedule(@PathParam("id") int id,
@BinderParam(BindBackupScheduleToJsonPayload.class) BackupSchedule backupSchedule); @BinderParam(BindBackupScheduleToJsonPayload.class) BackupSchedule backupSchedule);
@ -370,7 +369,7 @@ public interface CloudServersAsyncClient {
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@QueryParams(keys = "format", values = "json") @QueryParams(keys = "format", values = "json")
@Path("/servers/{id}/ips/public") @Path("/servers/{id}/ips/public")
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) @Fallback(EmptySetOnNotFoundOr404.class)
ListenableFuture<? extends Set<String>> listPublicAddresses(@PathParam("id") int serverId); ListenableFuture<? extends Set<String>> listPublicAddresses(@PathParam("id") int serverId);
/** /**
@ -381,7 +380,7 @@ public interface CloudServersAsyncClient {
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@QueryParams(keys = "format", values = "json") @QueryParams(keys = "format", values = "json")
@Path("/servers/{id}/ips/private") @Path("/servers/{id}/ips/private")
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) @Fallback(EmptySetOnNotFoundOr404.class)
ListenableFuture<? extends Set<String>> listPrivateAddresses(@PathParam("id") int serverId); 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.inject.Singleton;
import javax.ws.rs.core.MediaType; 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.apis.ApiMetadata;
import org.jclouds.cloudservers.config.CloudServersRestClientModule; import org.jclouds.cloudservers.config.CloudServersRestClientModule;
import org.jclouds.cloudservers.domain.BackupSchedule; 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.ListOptions;
import org.jclouds.cloudservers.options.RebuildServerOptions; import org.jclouds.cloudservers.options.RebuildServerOptions;
import org.jclouds.domain.Credentials; import org.jclouds.domain.Credentials;
import org.jclouds.fallbacks.MapHttp4xxCodesToExceptions;
import org.jclouds.http.HttpRequest; import org.jclouds.http.HttpRequest;
import org.jclouds.http.functions.ReleasePayloadAndReturn; import org.jclouds.http.functions.ReleasePayloadAndReturn;
import org.jclouds.http.functions.ReturnFalseOn404;
import org.jclouds.http.functions.ReturnTrueIf2xx; import org.jclouds.http.functions.ReturnTrueIf2xx;
import org.jclouds.http.functions.UnwrapOnlyJsonValue; import org.jclouds.http.functions.UnwrapOnlyJsonValue;
import org.jclouds.openstack.filters.AddTimestampQuery; 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.domain.Auth;
import org.jclouds.openstack.keystone.v1_1.parse.ParseAuthTest; import org.jclouds.openstack.keystone.v1_1.parse.ParseAuthTest;
import org.jclouds.rest.ConfiguresRestClient; 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.BaseAsyncClientTest;
import org.jclouds.rest.internal.RestAnnotationProcessor; import org.jclouds.rest.internal.RestAnnotationProcessor;
import org.testng.annotations.Test; import org.testng.annotations.Test;
@ -99,7 +98,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class); assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
assertSaxResponseParserClassEquals(method, null); assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, null); assertFallbackClassEquals(method, null);
checkFilters(request); checkFilters(request);
@ -118,7 +117,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class); assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
assertSaxResponseParserClassEquals(method, null); assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, null); assertFallbackClassEquals(method, null);
checkFilters(request); checkFilters(request);
} }
@ -138,7 +137,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class); assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
assertSaxResponseParserClassEquals(method, null); assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, null); assertFallbackClassEquals(method, null);
checkFilters(request); checkFilters(request);
@ -158,7 +157,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class); assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
assertSaxResponseParserClassEquals(method, null); assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, null); assertFallbackClassEquals(method, null);
checkFilters(request); checkFilters(request);
@ -180,7 +179,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class); assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
assertSaxResponseParserClassEquals(method, null); assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, null); assertFallbackClassEquals(method, null);
checkFilters(request); checkFilters(request);
} }
@ -195,7 +194,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
assertResponseParserClassEquals(method, request, ReturnTrueIf2xx.class); assertResponseParserClassEquals(method, request, ReturnTrueIf2xx.class);
assertSaxResponseParserClassEquals(method, null); assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnFalseOnNotFoundOr404.class); assertFallbackClassEquals(method, FalseOnNotFoundOr404.class);
checkFilters(request); checkFilters(request);
} }
@ -210,7 +209,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class); assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
assertSaxResponseParserClassEquals(method, null); assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class); assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
checkFilters(request); checkFilters(request);
} }
@ -225,7 +224,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class); assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
assertSaxResponseParserClassEquals(method, null); assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class); assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
checkFilters(request); checkFilters(request);
} }
@ -243,7 +242,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class); assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
assertSaxResponseParserClassEquals(method, null); assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class); assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
checkFilters(request); checkFilters(request);
} }
@ -258,7 +257,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class); assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
assertSaxResponseParserClassEquals(method, null); assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class); assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
checkFilters(request); checkFilters(request);
} }
@ -273,7 +272,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class); assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
assertSaxResponseParserClassEquals(method, null); assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class); assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
checkFilters(request); checkFilters(request);
} }
@ -288,7 +287,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class); assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
assertSaxResponseParserClassEquals(method, null); assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class); assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
checkFilters(request); checkFilters(request);
} }
@ -304,7 +303,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class); assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
assertSaxResponseParserClassEquals(method, null); assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class); assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
checkFilters(request); checkFilters(request);
} }
@ -319,7 +318,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class); assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
assertSaxResponseParserClassEquals(method, null); assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class); assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
checkFilters(request); checkFilters(request);
} }
@ -335,7 +334,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class); assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
assertSaxResponseParserClassEquals(method, null); assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class); assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
checkFilters(request); checkFilters(request);
} }
@ -350,7 +349,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class); assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
assertSaxResponseParserClassEquals(method, null); assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class); assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
checkFilters(request); checkFilters(request);
} }
@ -365,7 +364,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class); assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
assertSaxResponseParserClassEquals(method, null); assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class); assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
checkFilters(request); checkFilters(request);
} }
@ -380,7 +379,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class); assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
assertSaxResponseParserClassEquals(method, null); assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class); assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
checkFilters(request); checkFilters(request);
} }
@ -396,7 +395,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class); assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
assertSaxResponseParserClassEquals(method, null); assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class); assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
checkFilters(request); checkFilters(request);
} }
@ -412,7 +411,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class); assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
assertSaxResponseParserClassEquals(method, null); assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class); assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
checkFilters(request); checkFilters(request);
} }
@ -427,7 +426,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class); assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
assertSaxResponseParserClassEquals(method, null); assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class); assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
checkFilters(request); checkFilters(request);
} }
@ -442,7 +441,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
assertResponseParserClassEquals(method, request, ReturnTrueIf2xx.class); assertResponseParserClassEquals(method, request, ReturnTrueIf2xx.class);
assertSaxResponseParserClassEquals(method, null); assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnFalseOnNotFoundOr404.class); assertFallbackClassEquals(method, FalseOnNotFoundOr404.class);
checkFilters(request); checkFilters(request);
} }
@ -459,7 +458,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class); assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
assertSaxResponseParserClassEquals(method, null); assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, null); assertFallbackClassEquals(method, null);
checkFilters(request); checkFilters(request);
@ -477,7 +476,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class); assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
assertSaxResponseParserClassEquals(method, null); assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, null); assertFallbackClassEquals(method, null);
checkFilters(request); checkFilters(request);
@ -494,7 +493,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class); assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
assertSaxResponseParserClassEquals(method, null); assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnVoidOnNotFoundOr404.class); assertFallbackClassEquals(method, VoidOnNotFoundOr404.class);
checkFilters(request); checkFilters(request);
@ -513,7 +512,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class); assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
assertSaxResponseParserClassEquals(method, null); assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnFalseOn404.class); assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
checkFilters(request); checkFilters(request);
@ -529,7 +528,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
assertResponseParserClassEquals(method, request, ReturnTrueIf2xx.class); assertResponseParserClassEquals(method, request, ReturnTrueIf2xx.class);
assertSaxResponseParserClassEquals(method, null); assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnFalseOnNotFoundOr404.class); assertFallbackClassEquals(method, FalseOnNotFoundOr404.class);
checkFilters(request); checkFilters(request);
@ -545,7 +544,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class); assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
assertSaxResponseParserClassEquals(method, null); assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, null); assertFallbackClassEquals(method, null);
checkFilters(request); checkFilters(request);
@ -561,7 +560,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class); assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
assertSaxResponseParserClassEquals(method, null); assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, null); assertFallbackClassEquals(method, null);
checkFilters(request); checkFilters(request);
@ -577,7 +576,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class); assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
assertSaxResponseParserClassEquals(method, null); assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class); assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
checkFilters(request); checkFilters(request);
} }
@ -593,7 +592,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class); assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
assertSaxResponseParserClassEquals(method, null); assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class); assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
checkFilters(request); checkFilters(request);
} }
@ -608,7 +607,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class); assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
assertSaxResponseParserClassEquals(method, null); assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class); assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
checkFilters(request); checkFilters(request);
} }
@ -624,7 +623,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class); assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
assertSaxResponseParserClassEquals(method, null); assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class); assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
checkFilters(request); checkFilters(request);
} }
@ -639,7 +638,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class); assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
assertSaxResponseParserClassEquals(method, null); assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class); assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
checkFilters(request); checkFilters(request);
} }
@ -658,7 +657,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class); assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
assertSaxResponseParserClassEquals(method, null); assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, null); assertFallbackClassEquals(method, null);
checkFilters(request); checkFilters(request);
@ -676,7 +675,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class); assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
assertSaxResponseParserClassEquals(method, null); assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, null); assertFallbackClassEquals(method, null);
checkFilters(request); checkFilters(request);
} }
@ -691,7 +690,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
assertResponseParserClassEquals(method, request, ReturnTrueIf2xx.class); assertResponseParserClassEquals(method, request, ReturnTrueIf2xx.class);
assertSaxResponseParserClassEquals(method, null); assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnFalseOnNotFoundOr404.class); assertFallbackClassEquals(method, FalseOnNotFoundOr404.class);
checkFilters(request); checkFilters(request);
} }
@ -706,7 +705,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class); assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
assertSaxResponseParserClassEquals(method, null); assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, null); assertFallbackClassEquals(method, null);
checkFilters(request); checkFilters(request);
} }
@ -721,7 +720,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class); assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
assertSaxResponseParserClassEquals(method, null); assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class); assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
checkFilters(request); checkFilters(request);
} }
@ -736,7 +735,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class); assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
assertSaxResponseParserClassEquals(method, null); assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class); assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
checkFilters(request); checkFilters(request);
} }
@ -751,7 +750,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class); assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
assertSaxResponseParserClassEquals(method, null); assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class); assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
checkFilters(request); checkFilters(request);
} }
@ -767,7 +766,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class); assertResponseParserClassEquals(method, request, UnwrapOnlyJsonValue.class);
assertSaxResponseParserClassEquals(method, null); assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, null); assertFallbackClassEquals(method, null);
checkFilters(request); checkFilters(request);
@ -787,7 +786,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class); assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
assertSaxResponseParserClassEquals(method, null); assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, null); assertFallbackClassEquals(method, null);
checkFilters(request); checkFilters(request);
} }
@ -803,7 +802,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class); assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
assertSaxResponseParserClassEquals(method, null); assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, null); assertFallbackClassEquals(method, null);
checkFilters(request); checkFilters(request);
} }
@ -818,7 +817,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class); assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
assertSaxResponseParserClassEquals(method, null); assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, null); assertFallbackClassEquals(method, null);
checkFilters(request); checkFilters(request);
} }
@ -833,7 +832,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class); assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
assertSaxResponseParserClassEquals(method, null); assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, null); assertFallbackClassEquals(method, null);
checkFilters(request); checkFilters(request);
@ -849,7 +848,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class); assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
assertSaxResponseParserClassEquals(method, null); assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, null); assertFallbackClassEquals(method, null);
checkFilters(request); checkFilters(request);
} }
@ -864,7 +863,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class); assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
assertSaxResponseParserClassEquals(method, null); assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, null); assertFallbackClassEquals(method, null);
checkFilters(request); checkFilters(request);
} }

View File

@ -28,6 +28,8 @@ import javax.ws.rs.PathParam;
import javax.ws.rs.Produces; import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType; 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.BindCloneDriveOptionsToPlainTextString;
import org.jclouds.cloudsigma.binders.BindDriveDataToPlainTextString; import org.jclouds.cloudsigma.binders.BindDriveDataToPlainTextString;
import org.jclouds.cloudsigma.binders.BindDriveToPlainTextString; 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.cloudsigma.options.CloneDriveOptions;
import org.jclouds.http.filters.BasicAuthentication; import org.jclouds.http.filters.BasicAuthentication;
import org.jclouds.rest.annotations.BinderParam; 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.MapBinder;
import org.jclouds.rest.annotations.Payload; import org.jclouds.rest.annotations.Payload;
import org.jclouds.rest.annotations.PayloadParam; import org.jclouds.rest.annotations.PayloadParam;
import org.jclouds.rest.annotations.RequestFilters; import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.ResponseParser; 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; import com.google.common.util.concurrent.ListenableFuture;
@ -116,7 +116,7 @@ public interface CloudSigmaAsyncClient {
*/ */
@GET @GET
@Path("/profile/info") @Path("/profile/info")
@ExceptionParser(ReturnNullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
@ResponseParser(KeyValuesDelimitedByBlankLinesToProfileInfo.class) @ResponseParser(KeyValuesDelimitedByBlankLinesToProfileInfo.class)
ListenableFuture<ProfileInfo> getProfileInfo(); ListenableFuture<ProfileInfo> getProfileInfo();
@ -132,7 +132,7 @@ public interface CloudSigmaAsyncClient {
* @see CloudSigmaClient#getDriveInfo * @see CloudSigmaClient#getDriveInfo
*/ */
@GET @GET
@ExceptionParser(ReturnNullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
@ResponseParser(KeyValuesDelimitedByBlankLinesToDriveInfo.class) @ResponseParser(KeyValuesDelimitedByBlankLinesToDriveInfo.class)
@Path("/drives/{uuid}/info") @Path("/drives/{uuid}/info")
ListenableFuture<DriveInfo> getDriveInfo(@PathParam("uuid") String uuid); ListenableFuture<DriveInfo> getDriveInfo(@PathParam("uuid") String uuid);
@ -141,7 +141,7 @@ public interface CloudSigmaAsyncClient {
* @see CloudSigmaClient#createDrive * @see CloudSigmaClient#createDrive
*/ */
@POST @POST
@ExceptionParser(ReturnNullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
@ResponseParser(KeyValuesDelimitedByBlankLinesToDriveInfo.class) @ResponseParser(KeyValuesDelimitedByBlankLinesToDriveInfo.class)
@Path("/drives/create") @Path("/drives/create")
ListenableFuture<DriveInfo> createDrive(@BinderParam(BindDriveToPlainTextString.class) Drive createDrive); ListenableFuture<DriveInfo> createDrive(@BinderParam(BindDriveToPlainTextString.class) Drive createDrive);
@ -159,7 +159,7 @@ public interface CloudSigmaAsyncClient {
* @see CloudSigmaClient#createServer * @see CloudSigmaClient#createServer
*/ */
@POST @POST
@ExceptionParser(ReturnNullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
@ResponseParser(KeyValuesDelimitedByBlankLinesToServerInfo.class) @ResponseParser(KeyValuesDelimitedByBlankLinesToServerInfo.class)
@Path("/servers/create") @Path("/servers/create")
ListenableFuture<ServerInfo> createServer(@BinderParam(BindServerToPlainTextString.class) Server createServer); ListenableFuture<ServerInfo> createServer(@BinderParam(BindServerToPlainTextString.class) Server createServer);
@ -176,7 +176,7 @@ public interface CloudSigmaAsyncClient {
* @see CloudSigmaClient#getServerInfo * @see CloudSigmaClient#getServerInfo
*/ */
@GET @GET
@ExceptionParser(ReturnNullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
@ResponseParser(KeyValuesDelimitedByBlankLinesToServerInfo.class) @ResponseParser(KeyValuesDelimitedByBlankLinesToServerInfo.class)
@Path("/servers/{uuid}/info") @Path("/servers/{uuid}/info")
ListenableFuture<ServerInfo> getServerInfo(@PathParam("uuid") String uuid); ListenableFuture<ServerInfo> getServerInfo(@PathParam("uuid") String uuid);
@ -185,7 +185,7 @@ public interface CloudSigmaAsyncClient {
* @see CloudSigmaClient#setServerConfiguration * @see CloudSigmaClient#setServerConfiguration
*/ */
@POST @POST
@ExceptionParser(ReturnNullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
@ResponseParser(KeyValuesDelimitedByBlankLinesToServerInfo.class) @ResponseParser(KeyValuesDelimitedByBlankLinesToServerInfo.class)
@Path("/servers/{uuid}/set") @Path("/servers/{uuid}/set")
ListenableFuture<ServerInfo> setServerConfiguration(@PathParam("uuid") String uuid, ListenableFuture<ServerInfo> setServerConfiguration(@PathParam("uuid") String uuid,
@ -204,7 +204,7 @@ public interface CloudSigmaAsyncClient {
*/ */
@GET @GET
@Path("/servers/{uuid}/destroy") @Path("/servers/{uuid}/destroy")
@ExceptionParser(ReturnVoidOnNotFoundOr404.class) @Fallback(VoidOnNotFoundOr404.class)
ListenableFuture<Void> destroyServer(@PathParam("uuid") String uuid); ListenableFuture<Void> destroyServer(@PathParam("uuid") String uuid);
/** /**
@ -248,14 +248,14 @@ public interface CloudSigmaAsyncClient {
*/ */
@GET @GET
@Path("/drives/{uuid}/destroy") @Path("/drives/{uuid}/destroy")
@ExceptionParser(ReturnVoidOnNotFoundOr404.class) @Fallback(VoidOnNotFoundOr404.class)
ListenableFuture<Void> destroyDrive(@PathParam("uuid") String uuid); ListenableFuture<Void> destroyDrive(@PathParam("uuid") String uuid);
/** /**
* @see CloudSigmaClient#createVLAN * @see CloudSigmaClient#createVLAN
*/ */
@POST @POST
@ExceptionParser(ReturnNullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
@ResponseParser(KeyValuesDelimitedByBlankLinesToVLANInfo.class) @ResponseParser(KeyValuesDelimitedByBlankLinesToVLANInfo.class)
@Path("/resources/vlan/create") @Path("/resources/vlan/create")
@Payload("name {name}\n") @Payload("name {name}\n")
@ -274,7 +274,7 @@ public interface CloudSigmaAsyncClient {
* @see CloudSigmaClient#getVLANInfo * @see CloudSigmaClient#getVLANInfo
*/ */
@GET @GET
@ExceptionParser(ReturnNullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
@ResponseParser(KeyValuesDelimitedByBlankLinesToVLANInfo.class) @ResponseParser(KeyValuesDelimitedByBlankLinesToVLANInfo.class)
@Path("/resources/vlan/{uuid}/info") @Path("/resources/vlan/{uuid}/info")
ListenableFuture<VLANInfo> getVLANInfo(@PathParam("uuid") String uuid); ListenableFuture<VLANInfo> getVLANInfo(@PathParam("uuid") String uuid);
@ -302,14 +302,14 @@ public interface CloudSigmaAsyncClient {
*/ */
@GET @GET
@Path("/resources/vlan/{uuid}/destroy") @Path("/resources/vlan/{uuid}/destroy")
@ExceptionParser(ReturnVoidOnNotFoundOr404.class) @Fallback(VoidOnNotFoundOr404.class)
ListenableFuture<Void> destroyVLAN(@PathParam("uuid") String uuid); ListenableFuture<Void> destroyVLAN(@PathParam("uuid") String uuid);
/** /**
* @see CloudSigmaClient#createStaticIP * @see CloudSigmaClient#createStaticIP
*/ */
@POST @POST
@ExceptionParser(ReturnNullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
@ResponseParser(KeyValuesDelimitedByBlankLinesToStaticIPInfo.class) @ResponseParser(KeyValuesDelimitedByBlankLinesToStaticIPInfo.class)
@Path("/resources/ip/create") @Path("/resources/ip/create")
ListenableFuture<StaticIPInfo> createStaticIP(); ListenableFuture<StaticIPInfo> createStaticIP();
@ -326,7 +326,7 @@ public interface CloudSigmaAsyncClient {
* @see CloudSigmaClient#getStaticIPInfo * @see CloudSigmaClient#getStaticIPInfo
*/ */
@GET @GET
@ExceptionParser(ReturnNullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
@ResponseParser(KeyValuesDelimitedByBlankLinesToStaticIPInfo.class) @ResponseParser(KeyValuesDelimitedByBlankLinesToStaticIPInfo.class)
@Path("/resources/ip/{uuid}/info") @Path("/resources/ip/{uuid}/info")
ListenableFuture<StaticIPInfo> getStaticIPInfo(@PathParam("uuid") String uuid); ListenableFuture<StaticIPInfo> getStaticIPInfo(@PathParam("uuid") String uuid);
@ -344,7 +344,7 @@ public interface CloudSigmaAsyncClient {
*/ */
@GET @GET
@Path("/resources/ip/{uuid}/destroy") @Path("/resources/ip/{uuid}/destroy")
@ExceptionParser(ReturnVoidOnNotFoundOr404.class) @Fallback(VoidOnNotFoundOr404.class)
ListenableFuture<Void> destroyStaticIP(@PathParam("uuid") String uuid); 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.io.IOException;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.Fallbacks.VoidOnNotFoundOr404;
import org.jclouds.apis.ApiMetadata; import org.jclouds.apis.ApiMetadata;
import org.jclouds.cloudsigma.binders.BindServerToPlainTextStringTest; import org.jclouds.cloudsigma.binders.BindServerToPlainTextStringTest;
import org.jclouds.cloudsigma.domain.CreateDriveRequest; 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.SplitNewlines;
import org.jclouds.cloudsigma.functions.SplitNewlinesAndReturnSecondField; import org.jclouds.cloudsigma.functions.SplitNewlinesAndReturnSecondField;
import org.jclouds.cloudsigma.options.CloneDriveOptions; import org.jclouds.cloudsigma.options.CloneDriveOptions;
import org.jclouds.fallbacks.MapHttp4xxCodesToExceptions;
import org.jclouds.http.HttpRequest; import org.jclouds.http.HttpRequest;
import org.jclouds.http.filters.BasicAuthentication; import org.jclouds.http.filters.BasicAuthentication;
import org.jclouds.http.functions.ReleasePayloadAndReturn; 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.BaseAsyncClientTest;
import org.jclouds.rest.internal.RestAnnotationProcessor; import org.jclouds.rest.internal.RestAnnotationProcessor;
import org.testng.annotations.Test; import org.testng.annotations.Test;
@ -74,7 +74,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
assertResponseParserClassEquals(method, httpRequest, KeyValuesDelimitedByBlankLinesToProfileInfo.class); assertResponseParserClassEquals(method, httpRequest, KeyValuesDelimitedByBlankLinesToProfileInfo.class);
assertSaxResponseParserClassEquals(method, null); assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class); assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
checkFilters(httpRequest); checkFilters(httpRequest);
@ -90,7 +90,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
assertResponseParserClassEquals(method, httpRequest, SplitNewlines.class); assertResponseParserClassEquals(method, httpRequest, SplitNewlines.class);
assertSaxResponseParserClassEquals(method, null); assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, null); assertFallbackClassEquals(method, null);
checkFilters(httpRequest); checkFilters(httpRequest);
} }
@ -105,7 +105,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
assertResponseParserClassEquals(method, httpRequest, SplitNewlines.class); assertResponseParserClassEquals(method, httpRequest, SplitNewlines.class);
assertSaxResponseParserClassEquals(method, null); assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, null); assertFallbackClassEquals(method, null);
checkFilters(httpRequest); checkFilters(httpRequest);
} }
@ -120,7 +120,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
assertResponseParserClassEquals(method, httpRequest, SplitNewlines.class); assertResponseParserClassEquals(method, httpRequest, SplitNewlines.class);
assertSaxResponseParserClassEquals(method, null); assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, null); assertFallbackClassEquals(method, null);
checkFilters(httpRequest); checkFilters(httpRequest);
} }
@ -135,7 +135,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
assertResponseParserClassEquals(method, httpRequest, ListOfKeyValuesDelimitedByBlankLinesToDriveInfoSet.class); assertResponseParserClassEquals(method, httpRequest, ListOfKeyValuesDelimitedByBlankLinesToDriveInfoSet.class);
assertSaxResponseParserClassEquals(method, null); assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, null); assertFallbackClassEquals(method, null);
checkFilters(httpRequest); checkFilters(httpRequest);
} }
@ -150,7 +150,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
assertResponseParserClassEquals(method, httpRequest, KeyValuesDelimitedByBlankLinesToDriveInfo.class); assertResponseParserClassEquals(method, httpRequest, KeyValuesDelimitedByBlankLinesToDriveInfo.class);
assertSaxResponseParserClassEquals(method, null); assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class); assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
checkFilters(httpRequest); checkFilters(httpRequest);
@ -168,7 +168,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
assertResponseParserClassEquals(method, httpRequest, KeyValuesDelimitedByBlankLinesToDriveInfo.class); assertResponseParserClassEquals(method, httpRequest, KeyValuesDelimitedByBlankLinesToDriveInfo.class);
assertSaxResponseParserClassEquals(method, null); assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class); assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
checkFilters(httpRequest); checkFilters(httpRequest);
@ -185,7 +185,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
assertResponseParserClassEquals(method, httpRequest, KeyValuesDelimitedByBlankLinesToDriveInfo.class); assertResponseParserClassEquals(method, httpRequest, KeyValuesDelimitedByBlankLinesToDriveInfo.class);
assertSaxResponseParserClassEquals(method, null); assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class); assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
checkFilters(httpRequest); checkFilters(httpRequest);
@ -203,7 +203,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
assertResponseParserClassEquals(method, httpRequest, KeyValuesDelimitedByBlankLinesToDriveInfo.class); assertResponseParserClassEquals(method, httpRequest, KeyValuesDelimitedByBlankLinesToDriveInfo.class);
assertSaxResponseParserClassEquals(method, null); assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class); assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
checkFilters(httpRequest); checkFilters(httpRequest);
@ -220,7 +220,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
assertResponseParserClassEquals(method, httpRequest, KeyValuesDelimitedByBlankLinesToDriveInfo.class); assertResponseParserClassEquals(method, httpRequest, KeyValuesDelimitedByBlankLinesToDriveInfo.class);
assertSaxResponseParserClassEquals(method, null); assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class); assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
checkFilters(httpRequest); checkFilters(httpRequest);
@ -247,7 +247,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
// TODO: insert expected response class, which probably extends ParseJson // TODO: insert expected response class, which probably extends ParseJson
assertResponseParserClassEquals(method, httpRequest, SplitNewlines.class); assertResponseParserClassEquals(method, httpRequest, SplitNewlines.class);
assertSaxResponseParserClassEquals(method, null); assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, null); assertFallbackClassEquals(method, null);
checkFilters(httpRequest); checkFilters(httpRequest);
@ -263,7 +263,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
assertResponseParserClassEquals(method, httpRequest, ListOfKeyValuesDelimitedByBlankLinesToServerInfoSet.class); assertResponseParserClassEquals(method, httpRequest, ListOfKeyValuesDelimitedByBlankLinesToServerInfoSet.class);
assertSaxResponseParserClassEquals(method, null); assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, null); assertFallbackClassEquals(method, null);
checkFilters(httpRequest); checkFilters(httpRequest);
} }
@ -278,7 +278,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
assertResponseParserClassEquals(method, httpRequest, KeyValuesDelimitedByBlankLinesToServerInfo.class); assertResponseParserClassEquals(method, httpRequest, KeyValuesDelimitedByBlankLinesToServerInfo.class);
assertSaxResponseParserClassEquals(method, null); assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class); assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
checkFilters(httpRequest); checkFilters(httpRequest);
@ -294,7 +294,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
assertResponseParserClassEquals(method, httpRequest, KeyValuesDelimitedByBlankLinesToServerInfo.class); assertResponseParserClassEquals(method, httpRequest, KeyValuesDelimitedByBlankLinesToServerInfo.class);
assertSaxResponseParserClassEquals(method, null); assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class); assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
checkFilters(httpRequest); checkFilters(httpRequest);
@ -310,7 +310,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
assertResponseParserClassEquals(method, httpRequest, KeyValuesDelimitedByBlankLinesToServerInfo.class); assertResponseParserClassEquals(method, httpRequest, KeyValuesDelimitedByBlankLinesToServerInfo.class);
assertSaxResponseParserClassEquals(method, null); assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class); assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
checkFilters(httpRequest); checkFilters(httpRequest);
@ -326,7 +326,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
assertResponseParserClassEquals(method, httpRequest, ReleasePayloadAndReturn.class); assertResponseParserClassEquals(method, httpRequest, ReleasePayloadAndReturn.class);
assertSaxResponseParserClassEquals(method, null); assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnVoidOnNotFoundOr404.class); assertFallbackClassEquals(method, VoidOnNotFoundOr404.class);
checkFilters(httpRequest); checkFilters(httpRequest);
@ -342,7 +342,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
assertResponseParserClassEquals(method, httpRequest, ReleasePayloadAndReturn.class); assertResponseParserClassEquals(method, httpRequest, ReleasePayloadAndReturn.class);
assertSaxResponseParserClassEquals(method, null); assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class); assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
checkFilters(httpRequest); checkFilters(httpRequest);
@ -358,7 +358,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
assertResponseParserClassEquals(method, httpRequest, ReleasePayloadAndReturn.class); assertResponseParserClassEquals(method, httpRequest, ReleasePayloadAndReturn.class);
assertSaxResponseParserClassEquals(method, null); assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class); assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
checkFilters(httpRequest); checkFilters(httpRequest);
@ -374,7 +374,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
assertResponseParserClassEquals(method, httpRequest, ReleasePayloadAndReturn.class); assertResponseParserClassEquals(method, httpRequest, ReleasePayloadAndReturn.class);
assertSaxResponseParserClassEquals(method, null); assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class); assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
checkFilters(httpRequest); checkFilters(httpRequest);
@ -390,7 +390,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
assertResponseParserClassEquals(method, httpRequest, ReleasePayloadAndReturn.class); assertResponseParserClassEquals(method, httpRequest, ReleasePayloadAndReturn.class);
assertSaxResponseParserClassEquals(method, null); assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class); assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
checkFilters(httpRequest); checkFilters(httpRequest);
@ -417,7 +417,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
// TODO: insert expected response class, which probably extends ParseJson // TODO: insert expected response class, which probably extends ParseJson
assertResponseParserClassEquals(method, httpRequest, SplitNewlines.class); assertResponseParserClassEquals(method, httpRequest, SplitNewlines.class);
assertSaxResponseParserClassEquals(method, null); assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, null); assertFallbackClassEquals(method, null);
checkFilters(httpRequest); checkFilters(httpRequest);
@ -433,7 +433,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
assertResponseParserClassEquals(method, httpRequest, ReleasePayloadAndReturn.class); assertResponseParserClassEquals(method, httpRequest, ReleasePayloadAndReturn.class);
assertSaxResponseParserClassEquals(method, null); assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnVoidOnNotFoundOr404.class); assertFallbackClassEquals(method, VoidOnNotFoundOr404.class);
checkFilters(httpRequest); checkFilters(httpRequest);
@ -460,7 +460,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
// TODO: insert expected response class, which probably extends ParseJson // TODO: insert expected response class, which probably extends ParseJson
assertResponseParserClassEquals(method, httpRequest, SplitNewlinesAndReturnSecondField.class); assertResponseParserClassEquals(method, httpRequest, SplitNewlinesAndReturnSecondField.class);
assertSaxResponseParserClassEquals(method, null); assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, null); assertFallbackClassEquals(method, null);
checkFilters(httpRequest); checkFilters(httpRequest);
@ -476,7 +476,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
assertResponseParserClassEquals(method, httpRequest, ListOfKeyValuesDelimitedByBlankLinesToVLANInfoSet.class); assertResponseParserClassEquals(method, httpRequest, ListOfKeyValuesDelimitedByBlankLinesToVLANInfoSet.class);
assertSaxResponseParserClassEquals(method, null); assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, null); assertFallbackClassEquals(method, null);
checkFilters(httpRequest); checkFilters(httpRequest);
} }
@ -491,7 +491,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
assertResponseParserClassEquals(method, httpRequest, KeyValuesDelimitedByBlankLinesToVLANInfo.class); assertResponseParserClassEquals(method, httpRequest, KeyValuesDelimitedByBlankLinesToVLANInfo.class);
assertSaxResponseParserClassEquals(method, null); assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class); assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
checkFilters(httpRequest); checkFilters(httpRequest);
@ -507,7 +507,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
assertResponseParserClassEquals(method, httpRequest, KeyValuesDelimitedByBlankLinesToVLANInfo.class); assertResponseParserClassEquals(method, httpRequest, KeyValuesDelimitedByBlankLinesToVLANInfo.class);
assertSaxResponseParserClassEquals(method, null); assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class); assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
checkFilters(httpRequest); checkFilters(httpRequest);
@ -523,7 +523,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
assertResponseParserClassEquals(method, httpRequest, KeyValuesDelimitedByBlankLinesToVLANInfo.class); assertResponseParserClassEquals(method, httpRequest, KeyValuesDelimitedByBlankLinesToVLANInfo.class);
assertSaxResponseParserClassEquals(method, null); assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class); assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
checkFilters(httpRequest); checkFilters(httpRequest);
@ -539,7 +539,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
assertResponseParserClassEquals(method, httpRequest, ReleasePayloadAndReturn.class); assertResponseParserClassEquals(method, httpRequest, ReleasePayloadAndReturn.class);
assertSaxResponseParserClassEquals(method, null); assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnVoidOnNotFoundOr404.class); assertFallbackClassEquals(method, VoidOnNotFoundOr404.class);
checkFilters(httpRequest); checkFilters(httpRequest);
@ -566,7 +566,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
// TODO: insert expected response class, which probably extends ParseJson // TODO: insert expected response class, which probably extends ParseJson
assertResponseParserClassEquals(method, httpRequest, SplitNewlinesAndReturnSecondField.class); assertResponseParserClassEquals(method, httpRequest, SplitNewlinesAndReturnSecondField.class);
assertSaxResponseParserClassEquals(method, null); assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, null); assertFallbackClassEquals(method, null);
checkFilters(httpRequest); checkFilters(httpRequest);
@ -582,7 +582,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
assertResponseParserClassEquals(method, httpRequest, ListOfKeyValuesDelimitedByBlankLinesToStaticIPInfoSet.class); assertResponseParserClassEquals(method, httpRequest, ListOfKeyValuesDelimitedByBlankLinesToStaticIPInfoSet.class);
assertSaxResponseParserClassEquals(method, null); assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, null); assertFallbackClassEquals(method, null);
checkFilters(httpRequest); checkFilters(httpRequest);
} }
@ -597,7 +597,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
assertResponseParserClassEquals(method, httpRequest, KeyValuesDelimitedByBlankLinesToStaticIPInfo.class); assertResponseParserClassEquals(method, httpRequest, KeyValuesDelimitedByBlankLinesToStaticIPInfo.class);
assertSaxResponseParserClassEquals(method, null); assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class); assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
checkFilters(httpRequest); checkFilters(httpRequest);
@ -613,7 +613,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
assertResponseParserClassEquals(method, httpRequest, KeyValuesDelimitedByBlankLinesToStaticIPInfo.class); assertResponseParserClassEquals(method, httpRequest, KeyValuesDelimitedByBlankLinesToStaticIPInfo.class);
assertSaxResponseParserClassEquals(method, null); assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class); assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
checkFilters(httpRequest); checkFilters(httpRequest);
@ -629,7 +629,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
assertResponseParserClassEquals(method, httpRequest, ReleasePayloadAndReturn.class); assertResponseParserClassEquals(method, httpRequest, ReleasePayloadAndReturn.class);
assertSaxResponseParserClassEquals(method, null); assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnVoidOnNotFoundOr404.class); assertFallbackClassEquals(method, VoidOnNotFoundOr404.class);
checkFilters(httpRequest); checkFilters(httpRequest);

View File

@ -25,16 +25,16 @@ import javax.ws.rs.GET;
import javax.ws.rs.QueryParam; import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType; 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.domain.Account;
import org.jclouds.cloudstack.filters.AuthenticationFilter; import org.jclouds.cloudstack.filters.AuthenticationFilter;
import org.jclouds.cloudstack.options.ListAccountsOptions; 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.OnlyElement;
import org.jclouds.rest.annotations.QueryParams; import org.jclouds.rest.annotations.QueryParams;
import org.jclouds.rest.annotations.RequestFilters; import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.SelectJson; 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; import com.google.common.util.concurrent.ListenableFuture;
@ -56,7 +56,7 @@ public interface AccountAsyncClient {
@QueryParams(keys = { "command", "listAll" }, values = { "listAccounts", "true" }) @QueryParams(keys = { "command", "listAll" }, values = { "listAccounts", "true" })
@SelectJson("account") @SelectJson("account")
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) @Fallback(EmptySetOnNotFoundOr404.class)
ListenableFuture<Set<Account>> listAccounts(ListAccountsOptions... options); ListenableFuture<Set<Account>> listAccounts(ListAccountsOptions... options);
/** /**
@ -67,7 +67,7 @@ public interface AccountAsyncClient {
@SelectJson("account") @SelectJson("account")
@OnlyElement @OnlyElement
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<Account> getAccount(@QueryParam("id") String id); 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.QueryParam;
import javax.ws.rs.core.MediaType; 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.AsyncCreateResponse;
import org.jclouds.cloudstack.domain.PublicIPAddress; import org.jclouds.cloudstack.domain.PublicIPAddress;
import org.jclouds.cloudstack.filters.AuthenticationFilter; 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.AssociateIPAddressOptions;
import org.jclouds.cloudstack.options.ListPublicIPAddressesOptions; 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.OnlyElement;
import org.jclouds.rest.annotations.QueryParams; import org.jclouds.rest.annotations.QueryParams;
import org.jclouds.rest.annotations.RequestFilters; import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.SelectJson; import org.jclouds.rest.annotations.SelectJson;
import org.jclouds.rest.annotations.Unwrap; 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; import com.google.common.util.concurrent.ListenableFuture;
@ -61,7 +61,7 @@ public interface AddressAsyncClient {
@QueryParams(keys = { "command", "listAll" }, values = { "listPublicIpAddresses", "true" }) @QueryParams(keys = { "command", "listAll" }, values = { "listPublicIpAddresses", "true" })
@SelectJson("publicipaddress") @SelectJson("publicipaddress")
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) @Fallback(EmptySetOnNotFoundOr404.class)
ListenableFuture<Set<PublicIPAddress>> listPublicIPAddresses(ListPublicIPAddressesOptions... options); ListenableFuture<Set<PublicIPAddress>> listPublicIPAddresses(ListPublicIPAddressesOptions... options);
/** /**
@ -72,7 +72,7 @@ public interface AddressAsyncClient {
@SelectJson("publicipaddress") @SelectJson("publicipaddress")
@OnlyElement @OnlyElement
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<PublicIPAddress> getPublicIPAddress(@QueryParam("id") String id); ListenableFuture<PublicIPAddress> getPublicIPAddress(@QueryParam("id") String id);
/** /**
@ -90,7 +90,7 @@ public interface AddressAsyncClient {
*/ */
@GET @GET
@QueryParams(keys = "command", values = "disassociateIpAddress") @QueryParams(keys = "command", values = "disassociateIpAddress")
@ExceptionParser(ReturnVoidOnNotFoundOr404OrUnableToFindAccountOwner.class) @Fallback(VoidOnNotFoundOr404OrUnableToFindAccountOwner.class)
ListenableFuture<Void> disassociateIPAddress(@QueryParam("id") String id); 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.QueryParam;
import javax.ws.rs.core.MediaType; 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.domain.AsyncJob;
import org.jclouds.cloudstack.filters.AuthenticationFilter; import org.jclouds.cloudstack.filters.AuthenticationFilter;
import org.jclouds.cloudstack.functions.ParseAsyncJobFromHttpResponse; import org.jclouds.cloudstack.functions.ParseAsyncJobFromHttpResponse;
import org.jclouds.cloudstack.functions.ParseAsyncJobsFromHttpResponse; import org.jclouds.cloudstack.functions.ParseAsyncJobsFromHttpResponse;
import org.jclouds.cloudstack.options.ListAsyncJobsOptions; 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.QueryParams;
import org.jclouds.rest.annotations.RequestFilters; import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.ResponseParser; 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; import com.google.common.util.concurrent.ListenableFuture;
@ -57,7 +57,7 @@ public interface AsyncJobAsyncClient {
@GET @GET
@QueryParams(keys = { "command", "listAll" }, values = { "listAsyncJobs", "true" }) @QueryParams(keys = { "command", "listAll" }, values = { "listAsyncJobs", "true" })
@ResponseParser(ParseAsyncJobsFromHttpResponse.class) @ResponseParser(ParseAsyncJobsFromHttpResponse.class)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) @Fallback(EmptySetOnNotFoundOr404.class)
ListenableFuture<Set<AsyncJob<?>>> listAsyncJobs(ListAsyncJobsOptions... options); ListenableFuture<Set<AsyncJob<?>>> listAsyncJobs(ListAsyncJobsOptions... options);
/** /**
@ -67,7 +67,7 @@ public interface AsyncJobAsyncClient {
@QueryParams(keys = "command", values = "queryAsyncJobResult") @QueryParams(keys = "command", values = "queryAsyncJobResult")
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@ResponseParser(ParseAsyncJobFromHttpResponse.class) @ResponseParser(ParseAsyncJobFromHttpResponse.class)
@ExceptionParser(ReturnNullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
<T> ListenableFuture<AsyncJob<T>> getAsyncJob(@QueryParam("jobid") String id); <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.QueryParam;
import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MediaType;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.cloudstack.domain.Account; import org.jclouds.cloudstack.domain.Account;
import org.jclouds.cloudstack.domain.AsyncCreateResponse; import org.jclouds.cloudstack.domain.AsyncCreateResponse;
import org.jclouds.cloudstack.filters.AuthenticationFilter; 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.QueryParams;
import org.jclouds.rest.annotations.RequestFilters; import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.SelectJson; import org.jclouds.rest.annotations.SelectJson;
import org.jclouds.rest.annotations.Unwrap; import org.jclouds.rest.annotations.Unwrap;
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.ListenableFuture;
@ -55,7 +55,7 @@ public interface DomainAccountAsyncClient extends AccountAsyncClient {
@QueryParams(keys = "command", values = "enableAccount") @QueryParams(keys = "command", values = "enableAccount")
@SelectJson("account") @SelectJson("account")
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<Account> enableAccount(@QueryParam("account") String accountName, @QueryParam("domainid") String domainId); 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") @QueryParams(keys = "command", values = "disableAccount")
@Unwrap @Unwrap
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<AsyncCreateResponse> disableAccount(@QueryParam("account") String accountName, ListenableFuture<AsyncCreateResponse> disableAccount(@QueryParam("account") String accountName,
@QueryParam("domainid") String domainId, @QueryParam("lock") boolean onlyLock); @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.QueryParam;
import javax.ws.rs.core.MediaType; 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.domain.Domain;
import org.jclouds.cloudstack.filters.AuthenticationFilter; import org.jclouds.cloudstack.filters.AuthenticationFilter;
import org.jclouds.cloudstack.options.ListDomainChildrenOptions; import org.jclouds.cloudstack.options.ListDomainChildrenOptions;
import org.jclouds.cloudstack.options.ListDomainsOptions; 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.OnlyElement;
import org.jclouds.rest.annotations.QueryParams; import org.jclouds.rest.annotations.QueryParams;
import org.jclouds.rest.annotations.RequestFilters; import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.SelectJson; 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; import com.google.common.util.concurrent.ListenableFuture;
@ -59,7 +59,7 @@ public interface DomainDomainAsyncClient {
@QueryParams(keys = { "command", "listAll" }, values = { "listDomains", "true" }) @QueryParams(keys = { "command", "listAll" }, values = { "listDomains", "true" })
@SelectJson("domain") @SelectJson("domain")
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) @Fallback(EmptySetOnNotFoundOr404.class)
ListenableFuture<Set<Domain>> listDomains(ListDomainsOptions... options); ListenableFuture<Set<Domain>> listDomains(ListDomainsOptions... options);
/** /**
@ -70,7 +70,7 @@ public interface DomainDomainAsyncClient {
@SelectJson("domain") @SelectJson("domain")
@OnlyElement @OnlyElement
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<Domain> getDomainById(@QueryParam("id") String domainId); ListenableFuture<Domain> getDomainById(@QueryParam("id") String domainId);
/** /**
@ -80,6 +80,6 @@ public interface DomainDomainAsyncClient {
@QueryParams(keys = { "command", "listAll" }, values = { "listDomainChildren", "true" }) @QueryParams(keys = { "command", "listAll" }, values = { "listDomainChildren", "true" })
@SelectJson("domain") @SelectJson("domain")
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) @Fallback(EmptySetOnNotFoundOr404.class)
ListenableFuture<Set<Domain>> listDomainChildren(ListDomainChildrenOptions... options); 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.QueryParam;
import javax.ws.rs.core.MediaType; 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.AsyncCreateResponse;
import org.jclouds.cloudstack.domain.User; import org.jclouds.cloudstack.domain.User;
import org.jclouds.cloudstack.filters.AuthenticationFilter; import org.jclouds.cloudstack.filters.AuthenticationFilter;
import org.jclouds.cloudstack.options.ListUsersOptions; 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.QueryParams;
import org.jclouds.rest.annotations.RequestFilters; import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.SelectJson; import org.jclouds.rest.annotations.SelectJson;
import org.jclouds.rest.annotations.Unwrap; 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; import com.google.common.util.concurrent.ListenableFuture;
@ -59,7 +59,7 @@ public interface DomainUserAsyncClient {
@QueryParams(keys = "command", values = "listUsers") @QueryParams(keys = "command", values = "listUsers")
@SelectJson("user") @SelectJson("user")
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) @Fallback(EmptySetOnNotFoundOr404.class)
ListenableFuture<Set<User>> listUsers(ListUsersOptions... options); ListenableFuture<Set<User>> listUsers(ListUsersOptions... options);
/** /**
@ -69,7 +69,7 @@ public interface DomainUserAsyncClient {
@QueryParams(keys = "command", values = "enableUser") @QueryParams(keys = "command", values = "enableUser")
@SelectJson("user") @SelectJson("user")
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<User> enableUser(@QueryParam("id") String userId); ListenableFuture<User> enableUser(@QueryParam("id") String userId);
/** /**
@ -79,7 +79,7 @@ public interface DomainUserAsyncClient {
@QueryParams(keys = "command", values = "disableUser") @QueryParams(keys = "command", values = "disableUser")
@Unwrap @Unwrap
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<AsyncCreateResponse> disableUser(@QueryParam("id") String userId); 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.GET;
import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MediaType;
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
import org.jclouds.cloudstack.domain.Event; import org.jclouds.cloudstack.domain.Event;
import org.jclouds.cloudstack.filters.AuthenticationFilter; import org.jclouds.cloudstack.filters.AuthenticationFilter;
import org.jclouds.cloudstack.functions.ParseEventTypesFromHttpResponse; import org.jclouds.cloudstack.functions.ParseEventTypesFromHttpResponse;
import org.jclouds.cloudstack.options.ListEventsOptions; 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.QueryParams;
import org.jclouds.rest.annotations.RequestFilters; import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.ResponseParser; import org.jclouds.rest.annotations.ResponseParser;
import org.jclouds.rest.annotations.SelectJson; import org.jclouds.rest.annotations.SelectJson;
import org.jclouds.rest.functions.ReturnEmptySetOnNotFoundOr404;
import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.ListenableFuture;
@ -55,7 +55,7 @@ public interface EventAsyncClient {
@QueryParams(keys = "command", values = "listEventTypes") @QueryParams(keys = "command", values = "listEventTypes")
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@ResponseParser(ParseEventTypesFromHttpResponse.class) @ResponseParser(ParseEventTypesFromHttpResponse.class)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) @Fallback(EmptySetOnNotFoundOr404.class)
ListenableFuture<Set<String>> listEventTypes(); ListenableFuture<Set<String>> listEventTypes();
/** /**
@ -65,7 +65,7 @@ public interface EventAsyncClient {
@QueryParams(keys = "command", values = "listEvents") @QueryParams(keys = "command", values = "listEvents")
@SelectJson("event") @SelectJson("event")
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) @Fallback(EmptySetOnNotFoundOr404.class)
ListenableFuture<Set<Event>> listEvents(ListEventsOptions...options); 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.QueryParam;
import javax.ws.rs.core.MediaType; 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.AsyncCreateResponse;
import org.jclouds.cloudstack.domain.FirewallRule; import org.jclouds.cloudstack.domain.FirewallRule;
import org.jclouds.cloudstack.domain.PortForwardingRule; 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.CreateFirewallRuleOptions;
import org.jclouds.cloudstack.options.ListFirewallRulesOptions; import org.jclouds.cloudstack.options.ListFirewallRulesOptions;
import org.jclouds.cloudstack.options.ListPortForwardingRulesOptions; 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.OnlyElement;
import org.jclouds.rest.annotations.QueryParams; import org.jclouds.rest.annotations.QueryParams;
import org.jclouds.rest.annotations.RequestFilters; import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.SelectJson; import org.jclouds.rest.annotations.SelectJson;
import org.jclouds.rest.annotations.Unwrap; 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; import com.google.common.util.concurrent.ListenableFuture;
@ -63,7 +63,7 @@ public interface FirewallAsyncClient {
@QueryParams(keys = { "command", "listAll" }, values = { "listFirewallRules", "true" }) @QueryParams(keys = { "command", "listAll" }, values = { "listFirewallRules", "true" })
@SelectJson("firewallrule") @SelectJson("firewallrule")
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) @Fallback(EmptySetOnNotFoundOr404.class)
ListenableFuture<Set<FirewallRule>> listFirewallRules(ListFirewallRulesOptions... options); ListenableFuture<Set<FirewallRule>> listFirewallRules(ListFirewallRulesOptions... options);
/** /**
@ -74,7 +74,7 @@ public interface FirewallAsyncClient {
@SelectJson("firewallrule") @SelectJson("firewallrule")
@OnlyElement @OnlyElement
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<FirewallRule> getFirewallRule(@QueryParam("id") String id); ListenableFuture<FirewallRule> getFirewallRule(@QueryParam("id") String id);
/** /**
@ -105,7 +105,7 @@ public interface FirewallAsyncClient {
*/ */
@GET @GET
@QueryParams(keys = "command", values = "deleteFirewallRule") @QueryParams(keys = "command", values = "deleteFirewallRule")
@ExceptionParser(ReturnVoidOnNotFoundOr404.class) @Fallback(VoidOnNotFoundOr404.class)
ListenableFuture<Void> deleteFirewallRule(@QueryParam("id") String id); ListenableFuture<Void> deleteFirewallRule(@QueryParam("id") String id);
/** /**
@ -115,7 +115,7 @@ public interface FirewallAsyncClient {
@QueryParams(keys = { "command", "listAll" }, values = { "listPortForwardingRules", "true" }) @QueryParams(keys = { "command", "listAll" }, values = { "listPortForwardingRules", "true" })
@SelectJson("portforwardingrule") @SelectJson("portforwardingrule")
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) @Fallback(EmptySetOnNotFoundOr404.class)
ListenableFuture<Set<PortForwardingRule>> listPortForwardingRules(ListPortForwardingRulesOptions... options); ListenableFuture<Set<PortForwardingRule>> listPortForwardingRules(ListPortForwardingRulesOptions... options);
/** /**
@ -126,7 +126,7 @@ public interface FirewallAsyncClient {
@SelectJson("portforwardingrule") @SelectJson("portforwardingrule")
@OnlyElement @OnlyElement
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<PortForwardingRule> getPortForwardingRule(@QueryParam("id") String id); ListenableFuture<PortForwardingRule> getPortForwardingRule(@QueryParam("id") String id);
/** /**
@ -146,7 +146,7 @@ public interface FirewallAsyncClient {
*/ */
@GET @GET
@QueryParams(keys = "command", values = "deletePortForwardingRule") @QueryParams(keys = "command", values = "deletePortForwardingRule")
@ExceptionParser(ReturnVoidOnNotFoundOr404.class) @Fallback(VoidOnNotFoundOr404.class)
ListenableFuture<Void> deletePortForwardingRule(@QueryParam("id") String id); 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.QueryParam;
import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MediaType;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.cloudstack.domain.Account; import org.jclouds.cloudstack.domain.Account;
import org.jclouds.cloudstack.filters.AuthenticationFilter; import org.jclouds.cloudstack.filters.AuthenticationFilter;
import org.jclouds.cloudstack.options.CreateAccountOptions; import org.jclouds.cloudstack.options.CreateAccountOptions;
import org.jclouds.cloudstack.options.UpdateAccountOptions; 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.QueryParams;
import org.jclouds.rest.annotations.RequestFilters; import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.SelectJson; import org.jclouds.rest.annotations.SelectJson;
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.ListenableFuture;
@ -55,7 +55,7 @@ public interface GlobalAccountAsyncClient extends DomainAccountAsyncClient {
@QueryParams(keys = "command", values = "createAccount") @QueryParams(keys = "command", values = "createAccount")
@SelectJson("account") @SelectJson("account")
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<Account> createAccount(@QueryParam("username") String userName, ListenableFuture<Account> createAccount(@QueryParam("username") String userName,
@QueryParam("accounttype") Account.Type accountType, @QueryParam("email") String email, @QueryParam("accounttype") Account.Type accountType, @QueryParam("email") String email,
@QueryParam("firstname") String firstName, @QueryParam("lastname") String lastName, @QueryParam("firstname") String firstName, @QueryParam("lastname") String lastName,
@ -68,7 +68,7 @@ public interface GlobalAccountAsyncClient extends DomainAccountAsyncClient {
@QueryParams(keys = "command", values = "updateAccount") @QueryParams(keys = "command", values = "updateAccount")
@SelectJson("account") @SelectJson("account")
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<Account> updateAccount(@QueryParam("account") String accountName, ListenableFuture<Account> updateAccount(@QueryParam("account") String accountName,
@QueryParam("domainid") String domainId, @QueryParam("newname") String newName, UpdateAccountOptions... options); @QueryParam("domainid") String domainId, @QueryParam("newname") String newName, UpdateAccountOptions... options);
@ -78,6 +78,6 @@ public interface GlobalAccountAsyncClient extends DomainAccountAsyncClient {
@GET @GET
@QueryParams(keys = "command", values = "deleteAccount") @QueryParams(keys = "command", values = "deleteAccount")
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<Void> deleteAccount(@QueryParam("id") String id); 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.GET;
import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MediaType;
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
import org.jclouds.cloudstack.domain.Alert; import org.jclouds.cloudstack.domain.Alert;
import org.jclouds.cloudstack.filters.AuthenticationFilter; import org.jclouds.cloudstack.filters.AuthenticationFilter;
import org.jclouds.cloudstack.options.ListAlertsOptions; 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.QueryParams;
import org.jclouds.rest.annotations.RequestFilters; import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.SelectJson; import org.jclouds.rest.annotations.SelectJson;
import org.jclouds.rest.functions.ReturnEmptySetOnNotFoundOr404;
import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.ListenableFuture;
@ -55,7 +55,7 @@ public interface GlobalAlertAsyncClient {
@QueryParams(keys = { "command", "listAll" }, values = { "listAlerts", "true" }) @QueryParams(keys = { "command", "listAll" }, values = { "listAlerts", "true" })
@SelectJson("alert") @SelectJson("alert")
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) @Fallback(EmptySetOnNotFoundOr404.class)
ListenableFuture<Set<Alert>> listAlerts(ListAlertsOptions...options); 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.GET;
import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MediaType;
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
import org.jclouds.cloudstack.domain.Capacity; import org.jclouds.cloudstack.domain.Capacity;
import org.jclouds.cloudstack.filters.AuthenticationFilter; import org.jclouds.cloudstack.filters.AuthenticationFilter;
import org.jclouds.cloudstack.options.ListCapacityOptions; 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.QueryParams;
import org.jclouds.rest.annotations.RequestFilters; import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.SelectJson; import org.jclouds.rest.annotations.SelectJson;
import org.jclouds.rest.functions.ReturnEmptySetOnNotFoundOr404;
import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.ListenableFuture;
@ -55,7 +55,7 @@ public interface GlobalCapacityAsyncClient {
@QueryParams(keys = { "command", "listAll" }, values = { "listCapacity", "true" }) @QueryParams(keys = { "command", "listAll" }, values = { "listCapacity", "true" })
@SelectJson("capacity") @SelectJson("capacity")
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) @Fallback(EmptySetOnNotFoundOr404.class)
ListenableFuture<Set<Capacity>> listCapacity(ListCapacityOptions...options); 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.QueryParam;
import javax.ws.rs.core.MediaType; 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.domain.ConfigurationEntry;
import org.jclouds.cloudstack.filters.AuthenticationFilter; import org.jclouds.cloudstack.filters.AuthenticationFilter;
import org.jclouds.cloudstack.options.ListConfigurationEntriesOptions; 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.QueryParams;
import org.jclouds.rest.annotations.RequestFilters; import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.SelectJson; 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; import com.google.common.util.concurrent.ListenableFuture;
@ -57,7 +57,7 @@ public interface GlobalConfigurationAsyncClient extends ConfigurationAsyncClient
@QueryParams(keys = { "command", "listAll" }, values = { "listConfigurations", "true" }) @QueryParams(keys = { "command", "listAll" }, values = { "listConfigurations", "true" })
@SelectJson("configuration") @SelectJson("configuration")
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) @Fallback(EmptySetOnNotFoundOr404.class)
ListenableFuture<Set<ConfigurationEntry>> listConfigurationEntries(ListConfigurationEntriesOptions... options); ListenableFuture<Set<ConfigurationEntry>> listConfigurationEntries(ListConfigurationEntriesOptions... options);
/** /**
@ -67,7 +67,7 @@ public interface GlobalConfigurationAsyncClient extends ConfigurationAsyncClient
@QueryParams(keys = "command", values = "updateConfiguration") @QueryParams(keys = "command", values = "updateConfiguration")
@SelectJson("configuration") @SelectJson("configuration")
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<ConfigurationEntry> updateConfigurationEntry( ListenableFuture<ConfigurationEntry> updateConfigurationEntry(
@QueryParam("name") String name, @QueryParam("value") String value); @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.QueryParam;
import javax.ws.rs.core.MediaType; 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.domain.Domain;
import org.jclouds.cloudstack.filters.AuthenticationFilter; import org.jclouds.cloudstack.filters.AuthenticationFilter;
import org.jclouds.cloudstack.options.CreateDomainOptions; import org.jclouds.cloudstack.options.CreateDomainOptions;
import org.jclouds.cloudstack.options.UpdateDomainOptions; 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.QueryParams;
import org.jclouds.rest.annotations.RequestFilters; import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.SelectJson; 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; import com.google.common.util.concurrent.ListenableFuture;
@ -56,7 +56,7 @@ public interface GlobalDomainAsyncClient extends DomainDomainAsyncClient {
@QueryParams(keys = "command", values = "createDomain") @QueryParams(keys = "command", values = "createDomain")
@SelectJson("domain") @SelectJson("domain")
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<Domain> createDomain(@QueryParam("name") String name, CreateDomainOptions... options); ListenableFuture<Domain> createDomain(@QueryParam("name") String name, CreateDomainOptions... options);
/** /**
@ -66,7 +66,7 @@ public interface GlobalDomainAsyncClient extends DomainDomainAsyncClient {
@QueryParams(keys = "command", values = "updateDomain") @QueryParams(keys = "command", values = "updateDomain")
@SelectJson("domain") @SelectJson("domain")
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<Domain> updateDomain(@QueryParam("id") String domainId, UpdateDomainOptions... options); ListenableFuture<Domain> updateDomain(@QueryParam("id") String domainId, UpdateDomainOptions... options);
/** /**
@ -74,7 +74,7 @@ public interface GlobalDomainAsyncClient extends DomainDomainAsyncClient {
*/ */
@GET @GET
@QueryParams(keys = {"command", "cleanup"}, values = {"deleteDomain", "false"}) @QueryParams(keys = {"command", "cleanup"}, values = {"deleteDomain", "false"})
@ExceptionParser(ReturnVoidOnNotFoundOr404.class) @Fallback(VoidOnNotFoundOr404.class)
ListenableFuture<Void> deleteOnlyDomain(@QueryParam("id") String id); ListenableFuture<Void> deleteOnlyDomain(@QueryParam("id") String id);
/** /**
@ -82,7 +82,7 @@ public interface GlobalDomainAsyncClient extends DomainDomainAsyncClient {
*/ */
@GET @GET
@QueryParams(keys = {"command", "cleanup"}, values = {"deleteDomain", "true"}) @QueryParams(keys = {"command", "cleanup"}, values = {"deleteDomain", "true"})
@ExceptionParser(ReturnVoidOnNotFoundOr404.class) @Fallback(VoidOnNotFoundOr404.class)
ListenableFuture<Void> deleteDomainAndAttachedResources(@QueryParam("id") String id); 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.QueryParam;
import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MediaType;
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
import org.jclouds.cloudstack.domain.Cluster; import org.jclouds.cloudstack.domain.Cluster;
import org.jclouds.cloudstack.domain.Host; import org.jclouds.cloudstack.domain.Host;
import org.jclouds.cloudstack.filters.AuthenticationFilter; 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.ListHostsOptions;
import org.jclouds.cloudstack.options.UpdateClusterOptions; import org.jclouds.cloudstack.options.UpdateClusterOptions;
import org.jclouds.cloudstack.options.UpdateHostOptions; 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.QueryParams;
import org.jclouds.rest.annotations.RequestFilters; import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.SelectJson; import org.jclouds.rest.annotations.SelectJson;
import org.jclouds.rest.functions.ReturnEmptySetOnNotFoundOr404;
import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.ListenableFuture;
@ -63,7 +63,7 @@ public interface GlobalHostAsyncClient {
@QueryParams(keys = { "command", "listAll" }, values = { "listHosts", "true" }) @QueryParams(keys = { "command", "listAll" }, values = { "listHosts", "true" })
@SelectJson("host") @SelectJson("host")
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) @Fallback(EmptySetOnNotFoundOr404.class)
ListenableFuture<Set<Host>> listHosts(ListHostsOptions... options); ListenableFuture<Set<Host>> listHosts(ListHostsOptions... options);
/** /**
@ -175,7 +175,7 @@ public interface GlobalHostAsyncClient {
@QueryParams(keys = { "command", "listAll" }, values = { "listClusters", "true" }) @QueryParams(keys = { "command", "listAll" }, values = { "listClusters", "true" })
@SelectJson("cluster") @SelectJson("cluster")
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) @Fallback(EmptySetOnNotFoundOr404.class)
ListenableFuture<Set<Cluster>> listClusters(ListClustersOptions... options); 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.QueryParam;
import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MediaType;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.cloudstack.domain.DiskOffering; import org.jclouds.cloudstack.domain.DiskOffering;
import org.jclouds.cloudstack.domain.NetworkOffering; import org.jclouds.cloudstack.domain.NetworkOffering;
import org.jclouds.cloudstack.domain.ServiceOffering; 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.UpdateDiskOfferingOptions;
import org.jclouds.cloudstack.options.UpdateNetworkOfferingOptions; import org.jclouds.cloudstack.options.UpdateNetworkOfferingOptions;
import org.jclouds.cloudstack.options.UpdateServiceOfferingOptions; 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.QueryParams;
import org.jclouds.rest.annotations.RequestFilters; import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.SelectJson; import org.jclouds.rest.annotations.SelectJson;
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.ListenableFuture;
@ -59,7 +59,7 @@ public interface GlobalOfferingAsyncClient extends OfferingAsyncClient {
@QueryParams(keys = "command", values = "createServiceOffering") @QueryParams(keys = "command", values = "createServiceOffering")
@SelectJson("serviceoffering") @SelectJson("serviceoffering")
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<ServiceOffering> createServiceOffering(@QueryParam("name") String name, @QueryParam("displaytext") String displayText, 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); @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") @QueryParams(keys = "command", values = "updateServiceOffering")
@SelectJson("serviceoffering") @SelectJson("serviceoffering")
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<ServiceOffering> updateServiceOffering(@QueryParam("id") String id, UpdateServiceOfferingOptions... options); ListenableFuture<ServiceOffering> updateServiceOffering(@QueryParam("id") String id, UpdateServiceOfferingOptions... options);
/** /**
@ -80,7 +80,7 @@ public interface GlobalOfferingAsyncClient extends OfferingAsyncClient {
@GET @GET
@QueryParams(keys = "command", values = "deleteServiceOffering") @QueryParams(keys = "command", values = "deleteServiceOffering")
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<Void> deleteServiceOffering(@QueryParam("id") String id); ListenableFuture<Void> deleteServiceOffering(@QueryParam("id") String id);
/** /**
@ -90,7 +90,7 @@ public interface GlobalOfferingAsyncClient extends OfferingAsyncClient {
@QueryParams(keys = "command", values = "createDiskOffering") @QueryParams(keys = "command", values = "createDiskOffering")
@SelectJson("diskoffering") @SelectJson("diskoffering")
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<DiskOffering> createDiskOffering(@QueryParam("name") String name, ListenableFuture<DiskOffering> createDiskOffering(@QueryParam("name") String name,
@QueryParam("displaytext") String displayText, CreateDiskOfferingOptions... options); @QueryParam("displaytext") String displayText, CreateDiskOfferingOptions... options);
@ -101,7 +101,7 @@ public interface GlobalOfferingAsyncClient extends OfferingAsyncClient {
@QueryParams(keys = "command", values = "updateDiskOffering") @QueryParams(keys = "command", values = "updateDiskOffering")
@SelectJson("diskoffering") @SelectJson("diskoffering")
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<DiskOffering> updateDiskOffering(@QueryParam("id") String id, UpdateDiskOfferingOptions... options); ListenableFuture<DiskOffering> updateDiskOffering(@QueryParam("id") String id, UpdateDiskOfferingOptions... options);
/** /**
@ -110,7 +110,7 @@ public interface GlobalOfferingAsyncClient extends OfferingAsyncClient {
@GET @GET
@QueryParams(keys = "command", values = "deleteDiskOffering") @QueryParams(keys = "command", values = "deleteDiskOffering")
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<Void> deleteDiskOffering(@QueryParam("id") String id); ListenableFuture<Void> deleteDiskOffering(@QueryParam("id") String id);
/** /**
@ -120,6 +120,6 @@ public interface GlobalOfferingAsyncClient extends OfferingAsyncClient {
@QueryParams(keys = "command", values ="updateNetworkOffering") @QueryParams(keys = "command", values ="updateNetworkOffering")
@SelectJson("networkoffering") @SelectJson("networkoffering")
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<NetworkOffering> updateNetworkOffering(@QueryParam("id") String id, UpdateNetworkOfferingOptions... options); 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.QueryParam;
import javax.ws.rs.core.MediaType; 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.domain.Pod;
import org.jclouds.cloudstack.filters.AuthenticationFilter; import org.jclouds.cloudstack.filters.AuthenticationFilter;
import org.jclouds.cloudstack.options.CreatePodOptions; import org.jclouds.cloudstack.options.CreatePodOptions;
import org.jclouds.cloudstack.options.ListPodsOptions; import org.jclouds.cloudstack.options.ListPodsOptions;
import org.jclouds.cloudstack.options.UpdatePodOptions; 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.OnlyElement;
import org.jclouds.rest.annotations.QueryParams; import org.jclouds.rest.annotations.QueryParams;
import org.jclouds.rest.annotations.RequestFilters; import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.SelectJson; 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; import com.google.common.util.concurrent.ListenableFuture;
@ -61,7 +61,7 @@ public interface GlobalPodAsyncClient {
@QueryParams(keys = { "command", "listAll" }, values = { "listPods", "true" }) @QueryParams(keys = { "command", "listAll" }, values = { "listPods", "true" })
@SelectJson("pod") @SelectJson("pod")
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) @Fallback(EmptySetOnNotFoundOr404.class)
ListenableFuture<Set<Pod>> listPods(ListPodsOptions... options); ListenableFuture<Set<Pod>> listPods(ListPodsOptions... options);
/** /**
@ -72,7 +72,7 @@ public interface GlobalPodAsyncClient {
@SelectJson("pod") @SelectJson("pod")
@OnlyElement @OnlyElement
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<Pod> getPod(@QueryParam("id") String id); ListenableFuture<Pod> getPod(@QueryParam("id") String id);
/** /**
@ -91,7 +91,7 @@ public interface GlobalPodAsyncClient {
@QueryParams(keys = "command", values = "createPod") @QueryParams(keys = "command", values = "createPod")
@SelectJson("pod") @SelectJson("pod")
@Consumes(MediaType.APPLICATION_JSON) @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); 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") @QueryParams(keys = "command", values = "createPod")
@SelectJson("pod") @SelectJson("pod")
@Consumes(MediaType.APPLICATION_JSON) @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); 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 @GET
@QueryParams(keys = "command", values = "deletePod") @QueryParams(keys = "command", values = "deletePod")
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnVoidOnNotFoundOr404.class) @Fallback(VoidOnNotFoundOr404.class)
ListenableFuture<Void> deletePod(@QueryParam("id") String id); ListenableFuture<Void> deletePod(@QueryParam("id") String id);
/** /**
@ -132,7 +132,7 @@ public interface GlobalPodAsyncClient {
@QueryParams(keys = "command", values = "updatePod") @QueryParams(keys = "command", values = "updatePod")
@SelectJson("pod") @SelectJson("pod")
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<Pod> updatePod(@QueryParam("id") String id, UpdatePodOptions... updatePodOptions); 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.QueryParam;
import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MediaType;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.cloudstack.domain.ApiKeyPair; import org.jclouds.cloudstack.domain.ApiKeyPair;
import org.jclouds.cloudstack.domain.User; import org.jclouds.cloudstack.domain.User;
import org.jclouds.cloudstack.filters.AuthenticationFilter; import org.jclouds.cloudstack.filters.AuthenticationFilter;
import org.jclouds.cloudstack.options.CreateUserOptions; import org.jclouds.cloudstack.options.CreateUserOptions;
import org.jclouds.cloudstack.options.UpdateUserOptions; 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.QueryParams;
import org.jclouds.rest.annotations.RequestFilters; import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.SelectJson; import org.jclouds.rest.annotations.SelectJson;
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.ListenableFuture;
@ -56,7 +56,7 @@ public interface GlobalUserAsyncClient extends DomainUserAsyncClient {
@QueryParams(keys = "command", values = "createUser") @QueryParams(keys = "command", values = "createUser")
@SelectJson("user") @SelectJson("user")
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<User>createUser(@QueryParam("username") String userName, @QueryParam("account") String accountName, ListenableFuture<User>createUser(@QueryParam("username") String userName, @QueryParam("account") String accountName,
@QueryParam("email") String email, @QueryParam("password") String hashedPassword, @QueryParam("email") String email, @QueryParam("password") String hashedPassword,
@QueryParam("firstname") String firstName, @QueryParam("lastname") String lastName, CreateUserOptions... options); @QueryParam("firstname") String firstName, @QueryParam("lastname") String lastName, CreateUserOptions... options);
@ -68,7 +68,7 @@ public interface GlobalUserAsyncClient extends DomainUserAsyncClient {
@QueryParams(keys = "command", values = "registerUserKeys") @QueryParams(keys = "command", values = "registerUserKeys")
@SelectJson("userkeys") @SelectJson("userkeys")
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<ApiKeyPair> registerUserKeys(@QueryParam("id") String userId); ListenableFuture<ApiKeyPair> registerUserKeys(@QueryParam("id") String userId);
/** /**
@ -78,7 +78,7 @@ public interface GlobalUserAsyncClient extends DomainUserAsyncClient {
@QueryParams(keys = "command", values = "updateUser") @QueryParams(keys = "command", values = "updateUser")
@SelectJson("user") @SelectJson("user")
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<User> updateUser(@QueryParam("id") String id, UpdateUserOptions... options); ListenableFuture<User> updateUser(@QueryParam("id") String id, UpdateUserOptions... options);
/** /**
@ -87,6 +87,6 @@ public interface GlobalUserAsyncClient extends DomainUserAsyncClient {
@GET @GET
@QueryParams(keys = "command", values = "deleteUser") @QueryParams(keys = "command", values = "deleteUser")
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<Void> deleteUser(@QueryParam("id") String id); 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.QueryParam;
import javax.ws.rs.core.MediaType; 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.domain.VlanIPRange;
import org.jclouds.cloudstack.filters.AuthenticationFilter; import org.jclouds.cloudstack.filters.AuthenticationFilter;
import org.jclouds.cloudstack.options.CreateVlanIPRangeOptions; import org.jclouds.cloudstack.options.CreateVlanIPRangeOptions;
import org.jclouds.cloudstack.options.ListVlanIPRangesOptions; 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.OnlyElement;
import org.jclouds.rest.annotations.QueryParams; import org.jclouds.rest.annotations.QueryParams;
import org.jclouds.rest.annotations.RequestFilters; import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.SelectJson; 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; import com.google.common.util.concurrent.ListenableFuture;
@ -62,7 +62,7 @@ public interface GlobalVlanAsyncClient {
@SelectJson("vlaniprange") @SelectJson("vlaniprange")
@OnlyElement @OnlyElement
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<VlanIPRange> getVlanIPRange(@QueryParam("id") String id); ListenableFuture<VlanIPRange> getVlanIPRange(@QueryParam("id") String id);
/** /**
@ -75,7 +75,7 @@ public interface GlobalVlanAsyncClient {
@QueryParams(keys = { "command", "listAll" }, values = { "listVlanIpRanges", "true" }) @QueryParams(keys = { "command", "listAll" }, values = { "listVlanIpRanges", "true" })
@SelectJson("vlaniprange") @SelectJson("vlaniprange")
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) @Fallback(EmptySetOnNotFoundOr404.class)
ListenableFuture<Set<VlanIPRange>> listVlanIPRanges(ListVlanIPRangesOptions... options); ListenableFuture<Set<VlanIPRange>> listVlanIPRanges(ListVlanIPRangesOptions... options);
/** /**
@ -90,7 +90,7 @@ public interface GlobalVlanAsyncClient {
@QueryParams(keys = "command", values = "createVlanIpRange") @QueryParams(keys = "command", values = "createVlanIpRange")
@SelectJson("vlaniprange") @SelectJson("vlaniprange")
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<VlanIPRange> createVlanIPRange(@QueryParam("startip") String startIP, @QueryParam("endip") String endIP, CreateVlanIPRangeOptions... options); ListenableFuture<VlanIPRange> createVlanIPRange(@QueryParam("startip") String startIP, @QueryParam("endip") String endIP, CreateVlanIPRangeOptions... options);
/** /**
@ -101,6 +101,6 @@ public interface GlobalVlanAsyncClient {
@GET @GET
@QueryParams(keys = "command", values = "deleteVlanIpRange") @QueryParams(keys = "command", values = "deleteVlanIpRange")
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnVoidOnNotFoundOr404.class) @Fallback(VoidOnNotFoundOr404.class)
ListenableFuture<Void> deleteVlanIPRange(@QueryParam("id") String rangeId); 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.QueryParam;
import javax.ws.rs.core.MediaType; 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.NetworkType;
import org.jclouds.cloudstack.domain.Zone; import org.jclouds.cloudstack.domain.Zone;
import org.jclouds.cloudstack.filters.AuthenticationFilter; import org.jclouds.cloudstack.filters.AuthenticationFilter;
import org.jclouds.cloudstack.options.CreateZoneOptions; import org.jclouds.cloudstack.options.CreateZoneOptions;
import org.jclouds.cloudstack.options.UpdateZoneOptions; 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.QueryParams;
import org.jclouds.rest.annotations.RequestFilters; import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.SelectJson; 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; import com.google.common.util.concurrent.ListenableFuture;
@ -57,7 +57,7 @@ public interface GlobalZoneAsyncClient extends ZoneAsyncClient {
@QueryParams(keys = "command", values = "createZone") @QueryParams(keys = "command", values = "createZone")
@SelectJson("zone") @SelectJson("zone")
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<Zone> createZone(@QueryParam("name") String name, @QueryParam("networktype") NetworkType networkType, ListenableFuture<Zone> createZone(@QueryParam("name") String name, @QueryParam("networktype") NetworkType networkType,
@QueryParam("dns1") String externalDns1, @QueryParam("internaldns1") String internalDns1, CreateZoneOptions... options); @QueryParam("dns1") String externalDns1, @QueryParam("internaldns1") String internalDns1, CreateZoneOptions... options);
@ -68,7 +68,7 @@ public interface GlobalZoneAsyncClient extends ZoneAsyncClient {
@QueryParams(keys = "command", values = "updateZone") @QueryParams(keys = "command", values = "updateZone")
@SelectJson("zone") @SelectJson("zone")
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<Zone> updateZone(@QueryParam("id") String id, UpdateZoneOptions... options); ListenableFuture<Zone> updateZone(@QueryParam("id") String id, UpdateZoneOptions... options);
/** /**
@ -77,6 +77,6 @@ public interface GlobalZoneAsyncClient extends ZoneAsyncClient {
@GET @GET
@QueryParams(keys = "command", values = "deleteZone") @QueryParams(keys = "command", values = "deleteZone")
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnVoidOnNotFoundOr404.class) @Fallback(VoidOnNotFoundOr404.class)
ListenableFuture<Void> deleteZone(@QueryParam("id") String id); 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.QueryParam;
import javax.ws.rs.core.MediaType; 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.domain.OSType;
import org.jclouds.cloudstack.filters.AuthenticationFilter; import org.jclouds.cloudstack.filters.AuthenticationFilter;
import org.jclouds.cloudstack.functions.ParseIdToNameEntryFromHttpResponse; import org.jclouds.cloudstack.functions.ParseIdToNameEntryFromHttpResponse;
import org.jclouds.cloudstack.functions.ParseIdToNameFromHttpResponse; import org.jclouds.cloudstack.functions.ParseIdToNameFromHttpResponse;
import org.jclouds.cloudstack.options.ListOSTypesOptions; 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.OnlyElement;
import org.jclouds.rest.annotations.QueryParams; import org.jclouds.rest.annotations.QueryParams;
import org.jclouds.rest.annotations.RequestFilters; import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.ResponseParser; import org.jclouds.rest.annotations.ResponseParser;
import org.jclouds.rest.annotations.SelectJson; 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; import com.google.common.util.concurrent.ListenableFuture;
@ -61,7 +61,7 @@ public interface GuestOSAsyncClient {
@QueryParams(keys = { "command", "listAll" }, values = { "listOsTypes", "true" }) @QueryParams(keys = { "command", "listAll" }, values = { "listOsTypes", "true" })
@SelectJson("ostype") @SelectJson("ostype")
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) @Fallback(EmptySetOnNotFoundOr404.class)
ListenableFuture<Set<OSType>> listOSTypes(ListOSTypesOptions... options); ListenableFuture<Set<OSType>> listOSTypes(ListOSTypesOptions... options);
/** /**
@ -72,7 +72,7 @@ public interface GuestOSAsyncClient {
@SelectJson("ostype") @SelectJson("ostype")
@OnlyElement @OnlyElement
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<OSType> getOSType(@QueryParam("id") String id); ListenableFuture<OSType> getOSType(@QueryParam("id") String id);
/** /**
@ -81,7 +81,7 @@ public interface GuestOSAsyncClient {
@GET @GET
@QueryParams(keys = { "command", "listAll" }, values = { "listOsCategories", "true" }) @QueryParams(keys = { "command", "listAll" }, values = { "listOsCategories", "true" })
@ResponseParser(ParseIdToNameFromHttpResponse.class) @ResponseParser(ParseIdToNameFromHttpResponse.class)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) @Fallback(EmptySetOnNotFoundOr404.class)
ListenableFuture<Map<String, String>> listOSCategories(); ListenableFuture<Map<String, String>> listOSCategories();
/** /**
@ -90,7 +90,7 @@ public interface GuestOSAsyncClient {
@GET @GET
@QueryParams(keys = { "command", "listAll" }, values = { "listOsCategories", "true" }) @QueryParams(keys = { "command", "listAll" }, values = { "listOsCategories", "true" })
@ResponseParser(ParseIdToNameEntryFromHttpResponse.class) @ResponseParser(ParseIdToNameEntryFromHttpResponse.class)
@ExceptionParser(ReturnNullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<Map.Entry<String, String>> getOSCategory(@QueryParam("id") String id); 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.GET;
import javax.ws.rs.QueryParam; import javax.ws.rs.QueryParam;
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
import org.jclouds.cloudstack.filters.AuthenticationFilter; import org.jclouds.cloudstack.filters.AuthenticationFilter;
import org.jclouds.cloudstack.functions.ParseNamesFromHttpResponse; 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.QueryParams;
import org.jclouds.rest.annotations.RequestFilters; import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.ResponseParser; import org.jclouds.rest.annotations.ResponseParser;
import org.jclouds.rest.functions.ReturnEmptySetOnNotFoundOr404;
import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.ListenableFuture;
@ -51,7 +51,7 @@ public interface HypervisorAsyncClient {
@GET @GET
@QueryParams(keys = { "command", "listAll" }, values = { "listHypervisors", "true" }) @QueryParams(keys = { "command", "listAll" }, values = { "listHypervisors", "true" })
@ResponseParser(ParseNamesFromHttpResponse.class) @ResponseParser(ParseNamesFromHttpResponse.class)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) @Fallback(EmptySetOnNotFoundOr404.class)
ListenableFuture<Set<String>> listHypervisors(); ListenableFuture<Set<String>> listHypervisors();
/** /**
@ -60,6 +60,6 @@ public interface HypervisorAsyncClient {
@GET @GET
@QueryParams(keys = { "command", "listAll" }, values = { "listHypervisors", "true" }) @QueryParams(keys = { "command", "listAll" }, values = { "listHypervisors", "true" })
@ResponseParser(ParseNamesFromHttpResponse.class) @ResponseParser(ParseNamesFromHttpResponse.class)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) @Fallback(EmptySetOnNotFoundOr404.class)
ListenableFuture<Set<String>> listHypervisorsInZone(@QueryParam("zoneid") String zoneId); 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.QueryParam;
import javax.ws.rs.core.MediaType; 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.AsyncCreateResponse;
import org.jclouds.cloudstack.domain.ExtractMode; import org.jclouds.cloudstack.domain.ExtractMode;
import org.jclouds.cloudstack.domain.ISO; 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.RegisterISOOptions;
import org.jclouds.cloudstack.options.UpdateISOOptions; import org.jclouds.cloudstack.options.UpdateISOOptions;
import org.jclouds.cloudstack.options.UpdateISOPermissionsOptions; 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.OnlyElement;
import org.jclouds.rest.annotations.QueryParams; import org.jclouds.rest.annotations.QueryParams;
import org.jclouds.rest.annotations.RequestFilters; import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.SelectJson; import org.jclouds.rest.annotations.SelectJson;
import org.jclouds.rest.annotations.Unwrap; 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; import com.google.common.util.concurrent.ListenableFuture;
@ -96,7 +96,7 @@ public interface ISOAsyncClient {
@QueryParams(keys = { "command", "listAll" }, values = { "listIsos", "true" }) @QueryParams(keys = { "command", "listAll" }, values = { "listIsos", "true" })
@SelectJson("iso") @SelectJson("iso")
@OnlyElement @OnlyElement
@ExceptionParser(ReturnNullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<ISO> getISO(@QueryParam("id") String id); ListenableFuture<ISO> getISO(@QueryParam("id") String id);
/** /**
@ -109,7 +109,7 @@ public interface ISOAsyncClient {
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@QueryParams(keys = { "command", "listAll" }, values = { "listIsos", "true" }) @QueryParams(keys = { "command", "listAll" }, values = { "listIsos", "true" })
@SelectJson("iso") @SelectJson("iso")
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) @Fallback(EmptySetOnNotFoundOr404.class)
ListenableFuture<Set<ISO>> listISOs(ListISOsOptions... options); 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.GET;
import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MediaType;
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
import org.jclouds.cloudstack.domain.ResourceLimit; import org.jclouds.cloudstack.domain.ResourceLimit;
import org.jclouds.cloudstack.filters.AuthenticationFilter; import org.jclouds.cloudstack.filters.AuthenticationFilter;
import org.jclouds.cloudstack.options.ListResourceLimitsOptions; 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.QueryParams;
import org.jclouds.rest.annotations.RequestFilters; import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.SelectJson; import org.jclouds.rest.annotations.SelectJson;
import org.jclouds.rest.functions.ReturnEmptySetOnNotFoundOr404;
import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.ListenableFuture;
@ -53,7 +53,7 @@ public interface LimitAsyncClient {
@QueryParams(keys = { "command", "listAll" }, values = { "listResourceLimits", "true" }) @QueryParams(keys = { "command", "listAll" }, values = { "listResourceLimits", "true" })
@SelectJson("resourcelimit") @SelectJson("resourcelimit")
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) @Fallback(EmptySetOnNotFoundOr404.class)
ListenableFuture<Set<ResourceLimit>> listResourceLimits(ListResourceLimitsOptions... options); 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.QueryParam;
import javax.ws.rs.core.MediaType; 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.LoadBalancerRule;
import org.jclouds.cloudstack.domain.VirtualMachine;
import org.jclouds.cloudstack.domain.LoadBalancerRule.Algorithm; import org.jclouds.cloudstack.domain.LoadBalancerRule.Algorithm;
import org.jclouds.cloudstack.domain.VirtualMachine;
import org.jclouds.cloudstack.filters.AuthenticationFilter; import org.jclouds.cloudstack.filters.AuthenticationFilter;
import org.jclouds.cloudstack.options.CreateLoadBalancerRuleOptions; import org.jclouds.cloudstack.options.CreateLoadBalancerRuleOptions;
import org.jclouds.cloudstack.options.ListLoadBalancerRulesOptions; import org.jclouds.cloudstack.options.ListLoadBalancerRulesOptions;
import org.jclouds.cloudstack.options.UpdateLoadBalancerRuleOptions; import org.jclouds.cloudstack.options.UpdateLoadBalancerRuleOptions;
import org.jclouds.functions.JoinOnComma; 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.OnlyElement;
import org.jclouds.rest.annotations.ParamParser; import org.jclouds.rest.annotations.ParamParser;
import org.jclouds.rest.annotations.QueryParams; import org.jclouds.rest.annotations.QueryParams;
import org.jclouds.rest.annotations.RequestFilters; import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.SelectJson; 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; import com.google.common.util.concurrent.ListenableFuture;
@ -63,7 +63,7 @@ public interface LoadBalancerAsyncClient {
@QueryParams(keys = { "command", "listAll" }, values = { "listLoadBalancerRules", "true" }) @QueryParams(keys = { "command", "listAll" }, values = { "listLoadBalancerRules", "true" })
@SelectJson("loadbalancerrule") @SelectJson("loadbalancerrule")
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) @Fallback(EmptySetOnNotFoundOr404.class)
ListenableFuture<Set<LoadBalancerRule>> listLoadBalancerRules(ListLoadBalancerRulesOptions... options); ListenableFuture<Set<LoadBalancerRule>> listLoadBalancerRules(ListLoadBalancerRulesOptions... options);
/** /**
@ -74,7 +74,7 @@ public interface LoadBalancerAsyncClient {
@SelectJson("loadbalancerrule") @SelectJson("loadbalancerrule")
@OnlyElement @OnlyElement
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<LoadBalancerRule> getLoadBalancerRule(@QueryParam("id") String id); ListenableFuture<LoadBalancerRule> getLoadBalancerRule(@QueryParam("id") String id);
/** /**
@ -97,7 +97,7 @@ public interface LoadBalancerAsyncClient {
@SelectJson("loadbalancerrule") @SelectJson("loadbalancerrule")
@OnlyElement @OnlyElement
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<LoadBalancerRule> updateLoadBalancerRule(@QueryParam("id") String id, UpdateLoadBalancerRuleOptions... options); ListenableFuture<LoadBalancerRule> updateLoadBalancerRule(@QueryParam("id") String id, UpdateLoadBalancerRuleOptions... options);
/** /**
@ -107,7 +107,7 @@ public interface LoadBalancerAsyncClient {
@QueryParams(keys = "command", values = "deleteLoadBalancerRule") @QueryParams(keys = "command", values = "deleteLoadBalancerRule")
@SelectJson("jobid") @SelectJson("jobid")
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<String> deleteLoadBalancerRule(@QueryParam("id") String id); ListenableFuture<String> deleteLoadBalancerRule(@QueryParam("id") String id);
/** /**
@ -115,7 +115,7 @@ public interface LoadBalancerAsyncClient {
*/ */
@GET @GET
@QueryParams(keys = "command", values = "assignToLoadBalancerRule") @QueryParams(keys = "command", values = "assignToLoadBalancerRule")
@ExceptionParser(ReturnNullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
@SelectJson("jobid") @SelectJson("jobid")
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
ListenableFuture<String> assignVirtualMachinesToLoadBalancerRule(@QueryParam("id") String id, ListenableFuture<String> assignVirtualMachinesToLoadBalancerRule(@QueryParam("id") String id,
@ -126,7 +126,7 @@ public interface LoadBalancerAsyncClient {
*/ */
@GET @GET
@QueryParams(keys = "command", values = "assignToLoadBalancerRule") @QueryParams(keys = "command", values = "assignToLoadBalancerRule")
@ExceptionParser(ReturnNullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
@SelectJson("jobid") @SelectJson("jobid")
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
ListenableFuture<String> assignVirtualMachinesToLoadBalancerRule(@QueryParam("id") String id, ListenableFuture<String> assignVirtualMachinesToLoadBalancerRule(@QueryParam("id") String id,
@ -137,7 +137,7 @@ public interface LoadBalancerAsyncClient {
*/ */
@GET @GET
@QueryParams(keys = "command", values = "removeFromLoadBalancerRule") @QueryParams(keys = "command", values = "removeFromLoadBalancerRule")
@ExceptionParser(ReturnNullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
@SelectJson("jobid") @SelectJson("jobid")
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
ListenableFuture<String> removeVirtualMachinesFromLoadBalancerRule(@QueryParam("id") String id, ListenableFuture<String> removeVirtualMachinesFromLoadBalancerRule(@QueryParam("id") String id,
@ -148,7 +148,7 @@ public interface LoadBalancerAsyncClient {
*/ */
@GET @GET
@QueryParams(keys = "command", values = "removeFromLoadBalancerRule") @QueryParams(keys = "command", values = "removeFromLoadBalancerRule")
@ExceptionParser(ReturnNullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
@SelectJson("jobid") @SelectJson("jobid")
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
ListenableFuture<String> removeVirtualMachinesFromLoadBalancerRule(@QueryParam("id") String id, ListenableFuture<String> removeVirtualMachinesFromLoadBalancerRule(@QueryParam("id") String id,
@ -161,7 +161,7 @@ public interface LoadBalancerAsyncClient {
@QueryParams(keys = { "command", "listAll" }, values = { "listLoadBalancerRuleInstances", "true" }) @QueryParams(keys = { "command", "listAll" }, values = { "listLoadBalancerRuleInstances", "true" })
@SelectJson("loadbalancerruleinstance") @SelectJson("loadbalancerruleinstance")
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) @Fallback(EmptySetOnNotFoundOr404.class)
ListenableFuture<Set<VirtualMachine>> listVirtualMachinesAssignedToLoadBalancerRule(@QueryParam("id") String id); 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.QueryParam;
import javax.ws.rs.core.MediaType; 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.AsyncCreateResponse;
import org.jclouds.cloudstack.domain.IPForwardingRule; import org.jclouds.cloudstack.domain.IPForwardingRule;
import org.jclouds.cloudstack.filters.AuthenticationFilter; import org.jclouds.cloudstack.filters.AuthenticationFilter;
import org.jclouds.cloudstack.options.CreateIPForwardingRuleOptions; import org.jclouds.cloudstack.options.CreateIPForwardingRuleOptions;
import org.jclouds.cloudstack.options.ListIPForwardingRulesOptions; 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.OnlyElement;
import org.jclouds.rest.annotations.QueryParams; import org.jclouds.rest.annotations.QueryParams;
import org.jclouds.rest.annotations.RequestFilters; import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.SelectJson; import org.jclouds.rest.annotations.SelectJson;
import org.jclouds.rest.annotations.Unwrap; 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; import com.google.common.util.concurrent.ListenableFuture;
@ -62,7 +62,7 @@ public interface NATAsyncClient {
@QueryParams(keys = { "command", "listAll" }, values = { "listIpForwardingRules", "true" }) @QueryParams(keys = { "command", "listAll" }, values = { "listIpForwardingRules", "true" })
@SelectJson("ipforwardingrule") @SelectJson("ipforwardingrule")
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) @Fallback(EmptySetOnNotFoundOr404.class)
ListenableFuture<Set<IPForwardingRule>> listIPForwardingRules(ListIPForwardingRulesOptions... options); ListenableFuture<Set<IPForwardingRule>> listIPForwardingRules(ListIPForwardingRulesOptions... options);
/** /**
@ -73,7 +73,7 @@ public interface NATAsyncClient {
@SelectJson("ipforwardingrule") @SelectJson("ipforwardingrule")
@OnlyElement @OnlyElement
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<IPForwardingRule> getIPForwardingRule(@QueryParam("id") String id); ListenableFuture<IPForwardingRule> getIPForwardingRule(@QueryParam("id") String id);
/** /**
@ -121,7 +121,7 @@ public interface NATAsyncClient {
@QueryParams(keys = "command", values = "deleteIpForwardingRule") @QueryParams(keys = "command", values = "deleteIpForwardingRule")
@SelectJson("jobid") @SelectJson("jobid")
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<String> deleteIPForwardingRule(@QueryParam("id") String id); 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.QueryParam;
import javax.ws.rs.core.MediaType; 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.domain.Network;
import org.jclouds.cloudstack.filters.AuthenticationFilter; import org.jclouds.cloudstack.filters.AuthenticationFilter;
import org.jclouds.cloudstack.options.CreateNetworkOptions; import org.jclouds.cloudstack.options.CreateNetworkOptions;
import org.jclouds.cloudstack.options.ListNetworksOptions; 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.OnlyElement;
import org.jclouds.rest.annotations.QueryParams; import org.jclouds.rest.annotations.QueryParams;
import org.jclouds.rest.annotations.RequestFilters; import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.SelectJson; 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; import com.google.common.util.concurrent.ListenableFuture;
@ -58,7 +58,7 @@ public interface NetworkAsyncClient {
@QueryParams(keys = { "command", "listAll" }, values = { "listNetworks", "true" }) @QueryParams(keys = { "command", "listAll" }, values = { "listNetworks", "true" })
@SelectJson("network") @SelectJson("network")
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) @Fallback(EmptySetOnNotFoundOr404.class)
ListenableFuture<Set<Network>> listNetworks(ListNetworksOptions... options); ListenableFuture<Set<Network>> listNetworks(ListNetworksOptions... options);
/** /**
@ -69,7 +69,7 @@ public interface NetworkAsyncClient {
@SelectJson("network") @SelectJson("network")
@OnlyElement @OnlyElement
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<Network> getNetwork(@QueryParam("id") String id); ListenableFuture<Network> getNetwork(@QueryParam("id") String id);
/** /**
@ -90,6 +90,6 @@ public interface NetworkAsyncClient {
@QueryParams(keys = "command", values = "deleteNetwork") @QueryParams(keys = "command", values = "deleteNetwork")
@SelectJson("jobid") @SelectJson("jobid")
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<String> deleteNetwork(@QueryParam("id") String id); 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.QueryParam;
import javax.ws.rs.core.MediaType; 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.DiskOffering;
import org.jclouds.cloudstack.domain.NetworkOffering; import org.jclouds.cloudstack.domain.NetworkOffering;
import org.jclouds.cloudstack.domain.ServiceOffering; 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.ListDiskOfferingsOptions;
import org.jclouds.cloudstack.options.ListNetworkOfferingsOptions; import org.jclouds.cloudstack.options.ListNetworkOfferingsOptions;
import org.jclouds.cloudstack.options.ListServiceOfferingsOptions; 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.OnlyElement;
import org.jclouds.rest.annotations.QueryParams; import org.jclouds.rest.annotations.QueryParams;
import org.jclouds.rest.annotations.RequestFilters; import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.SelectJson; 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; import com.google.common.util.concurrent.ListenableFuture;
@ -61,7 +61,7 @@ public interface OfferingAsyncClient {
@QueryParams(keys = { "command", "listAll" }, values = { "listServiceOfferings", "true" }) @QueryParams(keys = { "command", "listAll" }, values = { "listServiceOfferings", "true" })
@SelectJson("serviceoffering") @SelectJson("serviceoffering")
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) @Fallback(EmptySetOnNotFoundOr404.class)
ListenableFuture<Set<ServiceOffering>> listServiceOfferings(ListServiceOfferingsOptions... options); ListenableFuture<Set<ServiceOffering>> listServiceOfferings(ListServiceOfferingsOptions... options);
/** /**
@ -72,7 +72,7 @@ public interface OfferingAsyncClient {
@SelectJson("serviceoffering") @SelectJson("serviceoffering")
@OnlyElement @OnlyElement
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<ServiceOffering> getServiceOffering(@QueryParam("id") String id); ListenableFuture<ServiceOffering> getServiceOffering(@QueryParam("id") String id);
/** /**
@ -82,7 +82,7 @@ public interface OfferingAsyncClient {
@QueryParams(keys = { "command", "listAll" }, values = { "listDiskOfferings", "true" }) @QueryParams(keys = { "command", "listAll" }, values = { "listDiskOfferings", "true" })
@SelectJson("diskoffering") @SelectJson("diskoffering")
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) @Fallback(EmptySetOnNotFoundOr404.class)
ListenableFuture<Set<DiskOffering>> listDiskOfferings(ListDiskOfferingsOptions... options); ListenableFuture<Set<DiskOffering>> listDiskOfferings(ListDiskOfferingsOptions... options);
/** /**
@ -93,7 +93,7 @@ public interface OfferingAsyncClient {
@SelectJson("diskoffering") @SelectJson("diskoffering")
@OnlyElement @OnlyElement
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<DiskOffering> getDiskOffering(@QueryParam("id") String id); ListenableFuture<DiskOffering> getDiskOffering(@QueryParam("id") String id);
/** /**
@ -103,7 +103,7 @@ public interface OfferingAsyncClient {
@QueryParams(keys = { "command", "listAll" }, values = { "listNetworkOfferings", "true" }) @QueryParams(keys = { "command", "listAll" }, values = { "listNetworkOfferings", "true" })
@SelectJson("networkoffering") @SelectJson("networkoffering")
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) @Fallback(EmptySetOnNotFoundOr404.class)
ListenableFuture<Set<NetworkOffering>> listNetworkOfferings(ListNetworkOfferingsOptions... options); ListenableFuture<Set<NetworkOffering>> listNetworkOfferings(ListNetworkOfferingsOptions... options);
/** /**
@ -114,7 +114,7 @@ public interface OfferingAsyncClient {
@SelectJson("networkoffering") @SelectJson("networkoffering")
@OnlyElement @OnlyElement
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<NetworkOffering> getNetworkOffering(@QueryParam("id") String id); 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.QueryParam;
import javax.ws.rs.core.MediaType; 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.domain.SshKeyPair;
import org.jclouds.cloudstack.filters.AuthenticationFilter; import org.jclouds.cloudstack.filters.AuthenticationFilter;
import org.jclouds.cloudstack.options.ListSSHKeyPairsOptions; 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.OnlyElement;
import org.jclouds.rest.annotations.QueryParams; import org.jclouds.rest.annotations.QueryParams;
import org.jclouds.rest.annotations.RequestFilters; import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.SelectJson; 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; import com.google.common.util.concurrent.ListenableFuture;
@ -57,7 +57,7 @@ public interface SSHKeyPairAsyncClient {
@QueryParams(keys = { "command", "listAll" }, values = { "listSSHKeyPairs", "true" }) @QueryParams(keys = { "command", "listAll" }, values = { "listSSHKeyPairs", "true" })
@SelectJson("sshkeypair") @SelectJson("sshkeypair")
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) @Fallback(EmptySetOnNotFoundOr404.class)
ListenableFuture<Set<SshKeyPair>> listSSHKeyPairs(ListSSHKeyPairsOptions... options); ListenableFuture<Set<SshKeyPair>> listSSHKeyPairs(ListSSHKeyPairsOptions... options);
/** /**
@ -86,7 +86,7 @@ public interface SSHKeyPairAsyncClient {
@SelectJson("sshkeypair") @SelectJson("sshkeypair")
@OnlyElement() @OnlyElement()
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<SshKeyPair> getSSHKeyPair(@QueryParam("name") String name); ListenableFuture<SshKeyPair> getSSHKeyPair(@QueryParam("name") String name);
/** /**
@ -94,7 +94,7 @@ public interface SSHKeyPairAsyncClient {
*/ */
@GET @GET
@QueryParams(keys = "command", values = "deleteSSHKeyPair") @QueryParams(keys = "command", values = "deleteSSHKeyPair")
@ExceptionParser(ReturnVoidOnNotFoundOr404.class) @Fallback(VoidOnNotFoundOr404.class)
ListenableFuture<Void> deleteSSHKeyPair(@QueryParam("name") String name); 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.QueryParam;
import javax.ws.rs.core.MediaType; 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.BindAccountSecurityGroupPairsToIndexedQueryParams;
import org.jclouds.cloudstack.binders.BindCIDRsToCommaDelimitedQueryParam; import org.jclouds.cloudstack.binders.BindCIDRsToCommaDelimitedQueryParam;
import org.jclouds.cloudstack.domain.SecurityGroup; 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.AccountInDomainOptions;
import org.jclouds.cloudstack.options.ListSecurityGroupsOptions; import org.jclouds.cloudstack.options.ListSecurityGroupsOptions;
import org.jclouds.rest.annotations.BinderParam; 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.OnlyElement;
import org.jclouds.rest.annotations.QueryParams; import org.jclouds.rest.annotations.QueryParams;
import org.jclouds.rest.annotations.RequestFilters; import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.SelectJson; 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.collect.Multimap;
import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.ListenableFuture;
@ -63,7 +63,7 @@ public interface SecurityGroupAsyncClient {
@QueryParams(keys = { "command", "listAll" }, values = { "listSecurityGroups", "true" }) @QueryParams(keys = { "command", "listAll" }, values = { "listSecurityGroups", "true" })
@SelectJson("securitygroup") @SelectJson("securitygroup")
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) @Fallback(EmptySetOnNotFoundOr404.class)
ListenableFuture<Set<SecurityGroup>> listSecurityGroups(ListSecurityGroupsOptions... options); ListenableFuture<Set<SecurityGroup>> listSecurityGroups(ListSecurityGroupsOptions... options);
/** /**
@ -74,7 +74,7 @@ public interface SecurityGroupAsyncClient {
@SelectJson("securitygroup") @SelectJson("securitygroup")
@OnlyElement @OnlyElement
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<SecurityGroup> getSecurityGroup(@QueryParam("id") String id); ListenableFuture<SecurityGroup> getSecurityGroup(@QueryParam("id") String id);
/** /**
@ -141,7 +141,7 @@ public interface SecurityGroupAsyncClient {
*/ */
@GET @GET
@QueryParams(keys = "command", values = "revokeSecurityGroupIngress") @QueryParams(keys = "command", values = "revokeSecurityGroupIngress")
@ExceptionParser(ReturnVoidOnNotFoundOr404.class) @Fallback(VoidOnNotFoundOr404.class)
@SelectJson("jobid") @SelectJson("jobid")
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
ListenableFuture<String> revokeIngressRule(@QueryParam("id") String id, AccountInDomainOptions... options); ListenableFuture<String> revokeIngressRule(@QueryParam("id") String id, AccountInDomainOptions... options);
@ -151,7 +151,7 @@ public interface SecurityGroupAsyncClient {
*/ */
@GET @GET
@QueryParams(keys = "command", values = "deleteSecurityGroup") @QueryParams(keys = "command", values = "deleteSecurityGroup")
@ExceptionParser(ReturnVoidOnNotFoundOr404.class) @Fallback(VoidOnNotFoundOr404.class)
ListenableFuture<Void> deleteSecurityGroup(@QueryParam("id") String id); 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.QueryParam;
import javax.ws.rs.core.MediaType; 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.domain.LoginResponse;
import org.jclouds.cloudstack.functions.ParseLoginResponseFromHttpResponse; 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.QueryParams;
import org.jclouds.rest.annotations.ResponseParser; 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; import com.google.common.util.concurrent.ListenableFuture;
@ -51,7 +51,7 @@ public interface SessionAsyncClient {
@QueryParams(keys = "command", values = "login") @QueryParams(keys = "command", values = "login")
@ResponseParser(ParseLoginResponseFromHttpResponse.class) @ResponseParser(ParseLoginResponseFromHttpResponse.class)
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<LoginResponse> loginUserInDomainWithHashOfPassword(@QueryParam("username") String userName, ListenableFuture<LoginResponse> loginUserInDomainWithHashOfPassword(@QueryParam("username") String userName,
@QueryParam("domain") String domain, @QueryParam("password") String hashedPassword); @QueryParam("domain") String domain, @QueryParam("password") String hashedPassword);
@ -60,6 +60,6 @@ public interface SessionAsyncClient {
*/ */
@GET @GET
@QueryParams(keys = "command", values = "logout") @QueryParams(keys = "command", values = "logout")
@ExceptionParser(ReturnVoidOnNotFoundOr404.class) @Fallback(VoidOnNotFoundOr404.class)
ListenableFuture<Void> logoutUser(@QueryParam("sessionkey") String sessionKey); 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.QueryParam;
import javax.ws.rs.core.MediaType; 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.BindIdListToCommaDelimitedQueryParam;
import org.jclouds.cloudstack.binders.BindSnapshotPolicyScheduleToQueryParam; import org.jclouds.cloudstack.binders.BindSnapshotPolicyScheduleToQueryParam;
import org.jclouds.cloudstack.domain.AsyncCreateResponse; 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.ListSnapshotPoliciesOptions;
import org.jclouds.cloudstack.options.ListSnapshotsOptions; import org.jclouds.cloudstack.options.ListSnapshotsOptions;
import org.jclouds.rest.annotations.BinderParam; 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.OnlyElement;
import org.jclouds.rest.annotations.QueryParams; import org.jclouds.rest.annotations.QueryParams;
import org.jclouds.rest.annotations.RequestFilters; import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.SelectJson; import org.jclouds.rest.annotations.SelectJson;
import org.jclouds.rest.annotations.Unwrap; 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; import com.google.common.util.concurrent.ListenableFuture;
@ -84,7 +84,7 @@ public interface SnapshotAsyncClient {
@QueryParams(keys = { "command", "listAll" }, values = { "listSnapshots", "true" }) @QueryParams(keys = { "command", "listAll" }, values = { "listSnapshots", "true" })
@SelectJson("snapshot") @SelectJson("snapshot")
@Unwrap @Unwrap
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) @Fallback(EmptySetOnNotFoundOr404.class)
ListenableFuture<Set<Snapshot>> listSnapshots(ListSnapshotsOptions... options); ListenableFuture<Set<Snapshot>> listSnapshots(ListSnapshotsOptions... options);
/** /**
@ -98,7 +98,7 @@ public interface SnapshotAsyncClient {
@QueryParams(keys = { "command", "listAll" }, values = { "listSnapshots", "true" }) @QueryParams(keys = { "command", "listAll" }, values = { "listSnapshots", "true" })
@SelectJson("snapshot") @SelectJson("snapshot")
@OnlyElement @OnlyElement
@ExceptionParser(ReturnNullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<Snapshot> getSnapshot(@QueryParam("id") String id); ListenableFuture<Snapshot> getSnapshot(@QueryParam("id") String id);
/** /**
@ -110,7 +110,7 @@ public interface SnapshotAsyncClient {
@GET @GET
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@QueryParams(keys = "command", values = "deleteSnapshot") @QueryParams(keys = "command", values = "deleteSnapshot")
@ExceptionParser(ReturnVoidOnNotFoundOr404.class) @Fallback(VoidOnNotFoundOr404.class)
ListenableFuture<Void> deleteSnapshot(@QueryParam("id") String id); ListenableFuture<Void> deleteSnapshot(@QueryParam("id") String id);
/** /**
@ -137,7 +137,7 @@ public interface SnapshotAsyncClient {
@GET @GET
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@QueryParams(keys = "command", values = "deleteSnapshotPolicies") @QueryParams(keys = "command", values = "deleteSnapshotPolicies")
@ExceptionParser(ReturnVoidOnNotFoundOr404.class) @Fallback(VoidOnNotFoundOr404.class)
ListenableFuture<Void> deleteSnapshotPolicy(@QueryParam("id") String id); ListenableFuture<Void> deleteSnapshotPolicy(@QueryParam("id") String id);
/** /**
@ -149,7 +149,7 @@ public interface SnapshotAsyncClient {
@GET @GET
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@QueryParams(keys = "command", values = "deleteSnapshotPolicies") @QueryParams(keys = "command", values = "deleteSnapshotPolicies")
@ExceptionParser(ReturnVoidOnNotFoundOr404.class) @Fallback(VoidOnNotFoundOr404.class)
ListenableFuture<Void> deleteSnapshotPolicies(@BinderParam(BindIdListToCommaDelimitedQueryParam.class) Iterable<String> id); ListenableFuture<Void> deleteSnapshotPolicies(@BinderParam(BindIdListToCommaDelimitedQueryParam.class) Iterable<String> id);
/** /**
@ -163,6 +163,6 @@ public interface SnapshotAsyncClient {
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@QueryParams(keys = { "command", "listAll" }, values = { "listSnapshotPolicies", "true" }) @QueryParams(keys = { "command", "listAll" }, values = { "listSnapshotPolicies", "true" })
@Unwrap @Unwrap
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) @Fallback(EmptySetOnNotFoundOr404.class)
ListenableFuture<Set<SnapshotPolicy>> listSnapshotPolicies(@QueryParam("volumeid") String volumeId, ListSnapshotPoliciesOptions... options); 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.QueryParam;
import javax.ws.rs.core.MediaType; 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.binders.BindTemplateMetadataToQueryParams;
import org.jclouds.cloudstack.domain.AsyncCreateResponse; import org.jclouds.cloudstack.domain.AsyncCreateResponse;
import org.jclouds.cloudstack.domain.ExtractMode; 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.UpdateTemplateOptions;
import org.jclouds.cloudstack.options.UpdateTemplatePermissionsOptions; import org.jclouds.cloudstack.options.UpdateTemplatePermissionsOptions;
import org.jclouds.rest.annotations.BinderParam; 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.OnlyElement;
import org.jclouds.rest.annotations.QueryParams; import org.jclouds.rest.annotations.QueryParams;
import org.jclouds.rest.annotations.RequestFilters; import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.SelectJson; import org.jclouds.rest.annotations.SelectJson;
import org.jclouds.rest.annotations.Unwrap; 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; import com.google.common.util.concurrent.ListenableFuture;
@ -124,7 +124,7 @@ public interface TemplateAsyncClient {
@QueryParams(keys = { "command", "listAll", "templatefilter" }, values = { "listTemplates", "true", "executable" }) @QueryParams(keys = { "command", "listAll", "templatefilter" }, values = { "listTemplates", "true", "executable" })
@SelectJson("template") @SelectJson("template")
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) @Fallback(EmptySetOnNotFoundOr404.class)
ListenableFuture<Set<Template>> listTemplates(); ListenableFuture<Set<Template>> listTemplates();
/** /**
@ -134,7 +134,7 @@ public interface TemplateAsyncClient {
@QueryParams(keys = { "command", "listAll" }, values = { "listTemplates", "true" }) @QueryParams(keys = { "command", "listAll" }, values = { "listTemplates", "true" })
@SelectJson("template") @SelectJson("template")
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) @Fallback(EmptySetOnNotFoundOr404.class)
ListenableFuture<Set<Template>> listTemplates(ListTemplatesOptions options); ListenableFuture<Set<Template>> listTemplates(ListTemplatesOptions options);
/** /**
@ -146,7 +146,7 @@ public interface TemplateAsyncClient {
@SelectJson("template") @SelectJson("template")
@OnlyElement @OnlyElement
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<Template> getTemplateInZone(@QueryParam("id") String templateId, @QueryParam("zoneid") String zoneId); 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.QueryParam;
import javax.ws.rs.core.MediaType; 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.domain.VMGroup;
import org.jclouds.cloudstack.filters.AuthenticationFilter; import org.jclouds.cloudstack.filters.AuthenticationFilter;
import org.jclouds.cloudstack.options.CreateVMGroupOptions; import org.jclouds.cloudstack.options.CreateVMGroupOptions;
import org.jclouds.cloudstack.options.ListVMGroupsOptions; import org.jclouds.cloudstack.options.ListVMGroupsOptions;
import org.jclouds.cloudstack.options.UpdateVMGroupOptions; 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.OnlyElement;
import org.jclouds.rest.annotations.QueryParams; import org.jclouds.rest.annotations.QueryParams;
import org.jclouds.rest.annotations.RequestFilters; import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.SelectJson; 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; import com.google.common.util.concurrent.ListenableFuture;
@ -62,7 +62,7 @@ public interface VMGroupAsyncClient {
@QueryParams(keys = { "command", "listAll" }, values = { "listInstanceGroups", "true" }) @QueryParams(keys = { "command", "listAll" }, values = { "listInstanceGroups", "true" })
@SelectJson("instancegroup") @SelectJson("instancegroup")
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) @Fallback(EmptySetOnNotFoundOr404.class)
ListenableFuture<Set<VMGroup>> listInstanceGroups(ListVMGroupsOptions... options); ListenableFuture<Set<VMGroup>> listInstanceGroups(ListVMGroupsOptions... options);
/** /**
@ -73,7 +73,7 @@ public interface VMGroupAsyncClient {
@SelectJson("instancegroup") @SelectJson("instancegroup")
@OnlyElement @OnlyElement
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<VMGroup> getInstanceGroup(@QueryParam("id") String id); ListenableFuture<VMGroup> getInstanceGroup(@QueryParam("id") String id);
/** /**
@ -109,6 +109,6 @@ public interface VMGroupAsyncClient {
*/ */
@GET @GET
@QueryParams(keys = "command", values = "deleteInstanceGroup") @QueryParams(keys = "command", values = "deleteInstanceGroup")
@ExceptionParser(ReturnVoidOnNotFoundOr404.class) @Fallback(VoidOnNotFoundOr404.class)
ListenableFuture<Void> deleteInstanceGroup(@QueryParam("id") String id); 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.QueryParam;
import javax.ws.rs.core.MediaType; 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.AsyncCreateResponse;
import org.jclouds.cloudstack.domain.VirtualMachine; import org.jclouds.cloudstack.domain.VirtualMachine;
import org.jclouds.cloudstack.filters.AuthenticationFilter; import org.jclouds.cloudstack.filters.AuthenticationFilter;
import org.jclouds.cloudstack.options.AssignVirtualMachineOptions; import org.jclouds.cloudstack.options.AssignVirtualMachineOptions;
import org.jclouds.cloudstack.options.DeployVirtualMachineOptions; import org.jclouds.cloudstack.options.DeployVirtualMachineOptions;
import org.jclouds.cloudstack.options.ListVirtualMachinesOptions; 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.OnlyElement;
import org.jclouds.rest.annotations.QueryParams; import org.jclouds.rest.annotations.QueryParams;
import org.jclouds.rest.annotations.RequestFilters; import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.SelectJson; import org.jclouds.rest.annotations.SelectJson;
import org.jclouds.rest.annotations.Unwrap; 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; import com.google.common.util.concurrent.ListenableFuture;
@ -61,7 +61,7 @@ public interface VirtualMachineAsyncClient {
@QueryParams(keys = { "command", "listAll" }, values = { "listVirtualMachines", "true" }) @QueryParams(keys = { "command", "listAll" }, values = { "listVirtualMachines", "true" })
@SelectJson("virtualmachine") @SelectJson("virtualmachine")
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) @Fallback(EmptySetOnNotFoundOr404.class)
ListenableFuture<Set<VirtualMachine>> listVirtualMachines(ListVirtualMachinesOptions... options); ListenableFuture<Set<VirtualMachine>> listVirtualMachines(ListVirtualMachinesOptions... options);
/** /**
@ -72,7 +72,7 @@ public interface VirtualMachineAsyncClient {
@SelectJson("virtualmachine") @SelectJson("virtualmachine")
@OnlyElement @OnlyElement
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<VirtualMachine> getVirtualMachine(@QueryParam("id") String id); ListenableFuture<VirtualMachine> getVirtualMachine(@QueryParam("id") String id);
/** /**
@ -156,7 +156,7 @@ public interface VirtualMachineAsyncClient {
@QueryParams(keys = "command", values = "destroyVirtualMachine") @QueryParams(keys = "command", values = "destroyVirtualMachine")
@SelectJson("jobid") @SelectJson("jobid")
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<String> destroyVirtualMachine(@QueryParam("id") String id); 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.QueryParam;
import javax.ws.rs.core.MediaType; 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.AsyncCreateResponse;
import org.jclouds.cloudstack.domain.Volume; import org.jclouds.cloudstack.domain.Volume;
import org.jclouds.cloudstack.filters.AuthenticationFilter; import org.jclouds.cloudstack.filters.AuthenticationFilter;
import org.jclouds.cloudstack.options.ListVolumesOptions; 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.OnlyElement;
import org.jclouds.rest.annotations.QueryParams; import org.jclouds.rest.annotations.QueryParams;
import org.jclouds.rest.annotations.RequestFilters; import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.SelectJson; import org.jclouds.rest.annotations.SelectJson;
import org.jclouds.rest.annotations.Unwrap; 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; import com.google.common.util.concurrent.ListenableFuture;
@ -59,7 +59,7 @@ public interface VolumeAsyncClient {
@QueryParams(keys = { "command", "listAll" }, values = { "listVolumes", "true" }) @QueryParams(keys = { "command", "listAll" }, values = { "listVolumes", "true" })
@SelectJson("volume") @SelectJson("volume")
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) @Fallback(EmptySetOnNotFoundOr404.class)
ListenableFuture<Set<Volume>> listVolumes(ListVolumesOptions... options); ListenableFuture<Set<Volume>> listVolumes(ListVolumesOptions... options);
/** /**
@ -70,7 +70,7 @@ public interface VolumeAsyncClient {
@QueryParams(keys = { "command", "listAll" }, values = { "listVolumes", "true" }) @QueryParams(keys = { "command", "listAll" }, values = { "listVolumes", "true" })
@SelectJson("volume") @SelectJson("volume")
@OnlyElement @OnlyElement
@ExceptionParser(ReturnNullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<Volume> getVolume(@QueryParam("id") String id); ListenableFuture<Volume> getVolume(@QueryParam("id") String id);
@ -120,7 +120,7 @@ public interface VolumeAsyncClient {
*/ */
@GET @GET
@QueryParams(keys = "command", values = "deleteVolume") @QueryParams(keys = "command", values = "deleteVolume")
@ExceptionParser(ReturnVoidOnNotFoundOr404.class) @Fallback(VoidOnNotFoundOr404.class)
ListenableFuture<Void> deleteVolume(@QueryParam("id") String id); 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.QueryParam;
import javax.ws.rs.core.MediaType; 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.domain.Zone;
import org.jclouds.cloudstack.filters.AuthenticationFilter; import org.jclouds.cloudstack.filters.AuthenticationFilter;
import org.jclouds.cloudstack.options.ListZonesOptions; 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.OnlyElement;
import org.jclouds.rest.annotations.QueryParams; import org.jclouds.rest.annotations.QueryParams;
import org.jclouds.rest.annotations.RequestFilters; import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.SelectJson; 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; import com.google.common.util.concurrent.ListenableFuture;
@ -57,7 +57,7 @@ public interface ZoneAsyncClient {
@QueryParams(keys = { "command", "listAll" }, values = { "listZones", "true" }) @QueryParams(keys = { "command", "listAll" }, values = { "listZones", "true" })
@SelectJson("zone") @SelectJson("zone")
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) @Fallback(EmptySetOnNotFoundOr404.class)
ListenableFuture<Set<Zone>> listZones(ListZonesOptions... options); ListenableFuture<Set<Zone>> listZones(ListZonesOptions... options);
/** /**
@ -68,7 +68,7 @@ public interface ZoneAsyncClient {
@SelectJson("zone") @SelectJson("zone")
@OnlyElement @OnlyElement
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<Zone> getZone(@QueryParam("id") String id); 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.io.IOException;
import java.lang.reflect.Method; 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.internal.BaseCloudStackAsyncClientTest;
import org.jclouds.cloudstack.options.ListAccountsOptions; import org.jclouds.cloudstack.options.ListAccountsOptions;
import org.jclouds.functions.IdentityFunction; import org.jclouds.functions.IdentityFunction;
import org.jclouds.http.HttpRequest; import org.jclouds.http.HttpRequest;
import org.jclouds.http.functions.ParseFirstJsonValueNamed; 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.jclouds.rest.internal.RestAnnotationProcessor;
import org.testng.annotations.Test; import org.testng.annotations.Test;
@ -55,7 +55,7 @@ public class AccountAsyncClientTest extends BaseCloudStackAsyncClientTest<Accoun
assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class); assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
assertSaxResponseParserClassEquals(method, null); assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class); assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
checkFilters(httpRequest); checkFilters(httpRequest);
@ -73,7 +73,7 @@ public class AccountAsyncClientTest extends BaseCloudStackAsyncClientTest<Accoun
assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class); assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
assertSaxResponseParserClassEquals(method, null); assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class); assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
checkFilters(httpRequest); checkFilters(httpRequest);
@ -91,7 +91,7 @@ public class AccountAsyncClientTest extends BaseCloudStackAsyncClientTest<Accoun
assertResponseParserClassEquals(method, httpRequest, assertResponseParserClassEquals(method, httpRequest,
Functions.compose(IdentityFunction.INSTANCE, IdentityFunction.INSTANCE).getClass()); Functions.compose(IdentityFunction.INSTANCE, IdentityFunction.INSTANCE).getClass());
assertSaxResponseParserClassEquals(method, null); assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class); assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
checkFilters(httpRequest); checkFilters(httpRequest);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -21,10 +21,10 @@ package org.jclouds.cloudstack.features;
import java.io.IOException; import java.io.IOException;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
import org.jclouds.cloudstack.functions.ParseNamesFromHttpResponse; import org.jclouds.cloudstack.functions.ParseNamesFromHttpResponse;
import org.jclouds.cloudstack.internal.BaseCloudStackAsyncClientTest; import org.jclouds.cloudstack.internal.BaseCloudStackAsyncClientTest;
import org.jclouds.http.HttpRequest; import org.jclouds.http.HttpRequest;
import org.jclouds.rest.functions.ReturnEmptySetOnNotFoundOr404;
import org.jclouds.rest.internal.RestAnnotationProcessor; import org.jclouds.rest.internal.RestAnnotationProcessor;
import org.testng.annotations.Test; import org.testng.annotations.Test;
@ -51,7 +51,7 @@ public class HypervisorAsyncClientTest extends BaseCloudStackAsyncClientTest<Hyp
assertResponseParserClassEquals(method, httpRequest, ParseNamesFromHttpResponse.class); assertResponseParserClassEquals(method, httpRequest, ParseNamesFromHttpResponse.class);
assertSaxResponseParserClassEquals(method, null); assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class); assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
checkFilters(httpRequest); checkFilters(httpRequest);
@ -68,7 +68,7 @@ public class HypervisorAsyncClientTest extends BaseCloudStackAsyncClientTest<Hyp
assertResponseParserClassEquals(method, httpRequest, ParseNamesFromHttpResponse.class); assertResponseParserClassEquals(method, httpRequest, ParseNamesFromHttpResponse.class);
assertSaxResponseParserClassEquals(method, null); assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class); assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
checkFilters(httpRequest); 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.ExtractISOOptions;
import org.jclouds.cloudstack.options.UpdateISOOptions; import org.jclouds.cloudstack.options.UpdateISOOptions;
import org.jclouds.cloudstack.options.UpdateISOPermissionsOptions; import org.jclouds.cloudstack.options.UpdateISOPermissionsOptions;
import org.jclouds.fallbacks.MapHttp4xxCodesToExceptions;
import org.jclouds.http.HttpRequest; import org.jclouds.http.HttpRequest;
import org.jclouds.http.functions.ParseFirstJsonValueNamed; import org.jclouds.http.functions.ParseFirstJsonValueNamed;
import org.jclouds.http.functions.ReleasePayloadAndReturn; import org.jclouds.http.functions.ReleasePayloadAndReturn;
import org.jclouds.http.functions.UnwrapOnlyJsonValue; import org.jclouds.http.functions.UnwrapOnlyJsonValue;
import org.jclouds.rest.functions.MapHttp4xxCodesToExceptions;
import org.jclouds.rest.internal.RestAnnotationProcessor; import org.jclouds.rest.internal.RestAnnotationProcessor;
import org.testng.annotations.Test; import org.testng.annotations.Test;
@ -59,7 +59,7 @@ public class ISOAsyncClientTest extends BaseCloudStackAsyncClientTest<ISOAsyncCl
assertResponseParserClassEquals(method, httpRequest, UnwrapOnlyJsonValue.class); assertResponseParserClassEquals(method, httpRequest, UnwrapOnlyJsonValue.class);
assertSaxResponseParserClassEquals(method, null); assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class); assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
checkFilters(httpRequest); checkFilters(httpRequest);
} }
@ -75,7 +75,7 @@ public class ISOAsyncClientTest extends BaseCloudStackAsyncClientTest<ISOAsyncCl
assertResponseParserClassEquals(method, httpRequest, UnwrapOnlyJsonValue.class); assertResponseParserClassEquals(method, httpRequest, UnwrapOnlyJsonValue.class);
assertSaxResponseParserClassEquals(method, null); assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class); assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
checkFilters(httpRequest); checkFilters(httpRequest);
} }
@ -91,7 +91,7 @@ public class ISOAsyncClientTest extends BaseCloudStackAsyncClientTest<ISOAsyncCl
assertResponseParserClassEquals(method, httpRequest, UnwrapOnlyJsonValue.class); assertResponseParserClassEquals(method, httpRequest, UnwrapOnlyJsonValue.class);
assertSaxResponseParserClassEquals(method, null); assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class); assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
checkFilters(httpRequest); checkFilters(httpRequest);
} }
@ -107,7 +107,7 @@ public class ISOAsyncClientTest extends BaseCloudStackAsyncClientTest<ISOAsyncCl
assertResponseParserClassEquals(method, httpRequest, UnwrapOnlyJsonValue.class); assertResponseParserClassEquals(method, httpRequest, UnwrapOnlyJsonValue.class);
assertSaxResponseParserClassEquals(method, null); assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class); assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
checkFilters(httpRequest); checkFilters(httpRequest);
} }
@ -123,7 +123,7 @@ public class ISOAsyncClientTest extends BaseCloudStackAsyncClientTest<ISOAsyncCl
assertResponseParserClassEquals(method, httpRequest, UnwrapOnlyJsonValue.class); assertResponseParserClassEquals(method, httpRequest, UnwrapOnlyJsonValue.class);
assertSaxResponseParserClassEquals(method, null); assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class); assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
checkFilters(httpRequest); checkFilters(httpRequest);
} }
@ -139,7 +139,7 @@ public class ISOAsyncClientTest extends BaseCloudStackAsyncClientTest<ISOAsyncCl
assertResponseParserClassEquals(method, httpRequest, UnwrapOnlyJsonValue.class); assertResponseParserClassEquals(method, httpRequest, UnwrapOnlyJsonValue.class);
assertSaxResponseParserClassEquals(method, null); assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class); assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
checkFilters(httpRequest); checkFilters(httpRequest);
} }
@ -155,7 +155,7 @@ public class ISOAsyncClientTest extends BaseCloudStackAsyncClientTest<ISOAsyncCl
assertResponseParserClassEquals(method, httpRequest, UnwrapOnlyJsonValue.class); assertResponseParserClassEquals(method, httpRequest, UnwrapOnlyJsonValue.class);
assertSaxResponseParserClassEquals(method, null); assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class); assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
checkFilters(httpRequest); checkFilters(httpRequest);
} }
@ -171,7 +171,7 @@ public class ISOAsyncClientTest extends BaseCloudStackAsyncClientTest<ISOAsyncCl
assertResponseParserClassEquals(method, httpRequest, ReleasePayloadAndReturn.class); assertResponseParserClassEquals(method, httpRequest, ReleasePayloadAndReturn.class);
assertSaxResponseParserClassEquals(method, null); assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class); assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
checkFilters(httpRequest); checkFilters(httpRequest);
} }
@ -187,7 +187,7 @@ public class ISOAsyncClientTest extends BaseCloudStackAsyncClientTest<ISOAsyncCl
assertResponseParserClassEquals(method, httpRequest, ReleasePayloadAndReturn.class); assertResponseParserClassEquals(method, httpRequest, ReleasePayloadAndReturn.class);
assertSaxResponseParserClassEquals(method, null); assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class); assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
checkFilters(httpRequest); checkFilters(httpRequest);
} }
@ -203,7 +203,7 @@ public class ISOAsyncClientTest extends BaseCloudStackAsyncClientTest<ISOAsyncCl
assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class); assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
assertSaxResponseParserClassEquals(method, null); assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class); assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
checkFilters(httpRequest); checkFilters(httpRequest);
} }
@ -219,7 +219,7 @@ public class ISOAsyncClientTest extends BaseCloudStackAsyncClientTest<ISOAsyncCl
assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class); assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
assertSaxResponseParserClassEquals(method, null); assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class); assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
checkFilters(httpRequest); checkFilters(httpRequest);
} }
@ -235,7 +235,7 @@ public class ISOAsyncClientTest extends BaseCloudStackAsyncClientTest<ISOAsyncCl
assertResponseParserClassEquals(method, httpRequest, UnwrapOnlyJsonValue.class); assertResponseParserClassEquals(method, httpRequest, UnwrapOnlyJsonValue.class);
assertSaxResponseParserClassEquals(method, null); assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class); assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
checkFilters(httpRequest); checkFilters(httpRequest);
} }
@ -251,7 +251,7 @@ public class ISOAsyncClientTest extends BaseCloudStackAsyncClientTest<ISOAsyncCl
assertResponseParserClassEquals(method, httpRequest, UnwrapOnlyJsonValue.class); assertResponseParserClassEquals(method, httpRequest, UnwrapOnlyJsonValue.class);
assertSaxResponseParserClassEquals(method, null); assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class); assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
checkFilters(httpRequest); checkFilters(httpRequest);
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -33,12 +33,13 @@ import org.jclouds.cloudwatch.domain.Unit;
import org.jclouds.cloudwatch.internal.BaseCloudWatchApiExpectTest; import org.jclouds.cloudwatch.internal.BaseCloudWatchApiExpectTest;
import org.jclouds.cloudwatch.options.GetMetricStatisticsOptions; import org.jclouds.cloudwatch.options.GetMetricStatisticsOptions;
import org.jclouds.cloudwatch.options.ListMetricsOptions; import org.jclouds.cloudwatch.options.ListMetricsOptions;
import org.jclouds.collect.IterableWithMarkers;
import org.jclouds.http.HttpRequest; import org.jclouds.http.HttpRequest;
import org.jclouds.http.HttpResponse; import org.jclouds.http.HttpResponse;
import org.jclouds.rest.ResourceNotFoundException; import org.jclouds.rest.ResourceNotFoundException;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import com.google.common.collect.ImmutableSet;
/** /**
* @author Jeremy Whitlock, Adrian Cole * @author Jeremy Whitlock, Adrian Cole
*/ */
@ -84,7 +85,7 @@ public class MetricApiExpectTest extends BaseCloudWatchApiExpectTest {
CloudWatchApi apiWhenMetricsDontExist = requestSendsResponse( CloudWatchApi apiWhenMetricsDontExist = requestSendsResponse(
listMetrics, listMetricsResponse); 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 { 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.POST;
import javax.ws.rs.core.MediaType; 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.HardwareProfiles;
import org.jclouds.deltacloud.collections.Images; import org.jclouds.deltacloud.collections.Images;
import org.jclouds.deltacloud.collections.InstanceStates; 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.HardwareProfile;
import org.jclouds.deltacloud.domain.Image; import org.jclouds.deltacloud.domain.Image;
import org.jclouds.deltacloud.domain.Instance; import org.jclouds.deltacloud.domain.Instance;
import org.jclouds.deltacloud.domain.Instance.State;
import org.jclouds.deltacloud.domain.Realm; import org.jclouds.deltacloud.domain.Realm;
import org.jclouds.deltacloud.domain.Transition; 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.options.CreateInstanceOptions;
import org.jclouds.deltacloud.xml.DeltacloudCollectionsHandler; import org.jclouds.deltacloud.xml.DeltacloudCollectionsHandler;
import org.jclouds.deltacloud.xml.HardwareProfileHandler; import org.jclouds.deltacloud.xml.HardwareProfileHandler;
@ -55,12 +58,9 @@ import org.jclouds.http.HttpRequest;
import org.jclouds.http.filters.BasicAuthentication; import org.jclouds.http.filters.BasicAuthentication;
import org.jclouds.rest.annotations.Endpoint; import org.jclouds.rest.annotations.Endpoint;
import org.jclouds.rest.annotations.EndpointParam; 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.RequestFilters;
import org.jclouds.rest.annotations.XMLResponseParser; 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.collect.Multimap;
import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.ListenableFuture;
@ -81,7 +81,7 @@ public interface DeltacloudAsyncClient {
* @see DeltacloudClient#getCollections * @see DeltacloudClient#getCollections
*/ */
@GET @GET
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) @Fallback(EmptySetOnNotFoundOr404.class)
@XMLResponseParser(DeltacloudCollectionsHandler.class) @XMLResponseParser(DeltacloudCollectionsHandler.class)
ListenableFuture<Set<DeltacloudCollection>> getCollections(); ListenableFuture<Set<DeltacloudCollection>> getCollections();
@ -90,7 +90,7 @@ public interface DeltacloudAsyncClient {
*/ */
@GET @GET
@Endpoint(InstanceStates.class) @Endpoint(InstanceStates.class)
@ExceptionParser(ReturnEmptyMultimapOnNotFoundOr404.class) @Fallback(EmptyMultimapOnNotFoundOr404.class)
@XMLResponseParser(InstanceStatesHandler.class) @XMLResponseParser(InstanceStatesHandler.class)
ListenableFuture<Multimap<State, Transition>> getInstanceStates(); ListenableFuture<Multimap<State, Transition>> getInstanceStates();
@ -99,7 +99,7 @@ public interface DeltacloudAsyncClient {
*/ */
@GET @GET
@Endpoint(Realms.class) @Endpoint(Realms.class)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) @Fallback(EmptySetOnNotFoundOr404.class)
@XMLResponseParser(RealmsHandler.class) @XMLResponseParser(RealmsHandler.class)
ListenableFuture<Set<Realm>> listRealms(); ListenableFuture<Set<Realm>> listRealms();
@ -107,7 +107,7 @@ public interface DeltacloudAsyncClient {
* @see DeltacloudClient#getRealm * @see DeltacloudClient#getRealm
*/ */
@GET @GET
@ExceptionParser(ReturnNullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
@XMLResponseParser(RealmHandler.class) @XMLResponseParser(RealmHandler.class)
ListenableFuture<Realm> getRealm(@EndpointParam URI realmHref); ListenableFuture<Realm> getRealm(@EndpointParam URI realmHref);
@ -116,7 +116,7 @@ public interface DeltacloudAsyncClient {
*/ */
@GET @GET
@Endpoint(Images.class) @Endpoint(Images.class)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) @Fallback(EmptySetOnNotFoundOr404.class)
@XMLResponseParser(ImagesHandler.class) @XMLResponseParser(ImagesHandler.class)
ListenableFuture<Set<Image>> listImages(); ListenableFuture<Set<Image>> listImages();
@ -124,7 +124,7 @@ public interface DeltacloudAsyncClient {
* @see DeltacloudClient#getImage * @see DeltacloudClient#getImage
*/ */
@GET @GET
@ExceptionParser(ReturnNullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
@XMLResponseParser(ImageHandler.class) @XMLResponseParser(ImageHandler.class)
ListenableFuture<Image> getImage(@EndpointParam URI imageHref); ListenableFuture<Image> getImage(@EndpointParam URI imageHref);
@ -133,7 +133,7 @@ public interface DeltacloudAsyncClient {
*/ */
@GET @GET
@Endpoint(HardwareProfiles.class) @Endpoint(HardwareProfiles.class)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) @Fallback(EmptySetOnNotFoundOr404.class)
@XMLResponseParser(HardwareProfilesHandler.class) @XMLResponseParser(HardwareProfilesHandler.class)
ListenableFuture<Set<HardwareProfile>> listHardwareProfiles(); ListenableFuture<Set<HardwareProfile>> listHardwareProfiles();
@ -141,7 +141,7 @@ public interface DeltacloudAsyncClient {
* @see DeltacloudClient#getHardwareProfile * @see DeltacloudClient#getHardwareProfile
*/ */
@GET @GET
@ExceptionParser(ReturnNullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
@XMLResponseParser(HardwareProfileHandler.class) @XMLResponseParser(HardwareProfileHandler.class)
ListenableFuture<HardwareProfile> getHardwareProfile(@EndpointParam URI profileHref); ListenableFuture<HardwareProfile> getHardwareProfile(@EndpointParam URI profileHref);
@ -150,7 +150,7 @@ public interface DeltacloudAsyncClient {
*/ */
@GET @GET
@Endpoint(Instances.class) @Endpoint(Instances.class)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) @Fallback(EmptySetOnNotFoundOr404.class)
@XMLResponseParser(InstancesHandler.class) @XMLResponseParser(InstancesHandler.class)
ListenableFuture<Set<Instance>> listInstances(); ListenableFuture<Set<Instance>> listInstances();
@ -158,7 +158,7 @@ public interface DeltacloudAsyncClient {
* @see DeltacloudClient#getInstance * @see DeltacloudClient#getInstance
*/ */
@GET @GET
@ExceptionParser(ReturnNullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
@XMLResponseParser(InstanceHandler.class) @XMLResponseParser(InstanceHandler.class)
ListenableFuture<Instance> getInstance(@EndpointParam URI instanceHref); ListenableFuture<Instance> getInstance(@EndpointParam URI instanceHref);
@ -173,7 +173,7 @@ public interface DeltacloudAsyncClient {
/** /**
* @see DeltacloudClient#performInstanceAction * @see DeltacloudClient#performInstanceAction
*/ */
@ExceptionParser(ReturnVoidOnRedirectedDelete.class) @Fallback(VoidOnRedirectedDelete.class)
ListenableFuture<Void> performAction(HttpRequest action); 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.net.URI;
import java.util.Set; 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.apis.ApiMetadata;
import org.jclouds.deltacloud.DeltacloudFallbacks.VoidOnRedirectedDelete;
import org.jclouds.deltacloud.config.DeltacloudRestClientModule; import org.jclouds.deltacloud.config.DeltacloudRestClientModule;
import org.jclouds.deltacloud.domain.DeltacloudCollection; import org.jclouds.deltacloud.domain.DeltacloudCollection;
import org.jclouds.deltacloud.functions.ReturnVoidOnRedirectedDelete;
import org.jclouds.deltacloud.options.CreateInstanceOptions; import org.jclouds.deltacloud.options.CreateInstanceOptions;
import org.jclouds.deltacloud.xml.DeltacloudCollectionsHandler; import org.jclouds.deltacloud.xml.DeltacloudCollectionsHandler;
import org.jclouds.deltacloud.xml.HardwareProfileHandler; 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.ParseSax;
import org.jclouds.http.functions.ReleasePayloadAndReturn; import org.jclouds.http.functions.ReleasePayloadAndReturn;
import org.jclouds.rest.ConfiguresRestClient; 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.BaseAsyncClientTest;
import org.jclouds.rest.internal.GeneratedHttpRequest; import org.jclouds.rest.internal.GeneratedHttpRequest;
import org.jclouds.rest.internal.RestAnnotationProcessor; import org.jclouds.rest.internal.RestAnnotationProcessor;
@ -88,7 +88,7 @@ public class DeltacloudAsyncClientTest extends BaseAsyncClientTest<DeltacloudAsy
assertResponseParserClassEquals(method, httpRequest, ParseSax.class); assertResponseParserClassEquals(method, httpRequest, ParseSax.class);
assertSaxResponseParserClassEquals(method, DeltacloudCollectionsHandler.class); assertSaxResponseParserClassEquals(method, DeltacloudCollectionsHandler.class);
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class); assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
checkFilters(httpRequest); checkFilters(httpRequest);
@ -104,7 +104,7 @@ public class DeltacloudAsyncClientTest extends BaseAsyncClientTest<DeltacloudAsy
assertResponseParserClassEquals(method, request, ParseSax.class); assertResponseParserClassEquals(method, request, ParseSax.class);
assertSaxResponseParserClassEquals(method, InstanceStatesHandler.class); assertSaxResponseParserClassEquals(method, InstanceStatesHandler.class);
assertExceptionParserClassEquals(method, ReturnEmptyMultimapOnNotFoundOr404.class); assertFallbackClassEquals(method, EmptyMultimapOnNotFoundOr404.class);
checkFilters(request); checkFilters(request);
} }
@ -119,7 +119,7 @@ public class DeltacloudAsyncClientTest extends BaseAsyncClientTest<DeltacloudAsy
assertResponseParserClassEquals(method, request, ParseSax.class); assertResponseParserClassEquals(method, request, ParseSax.class);
assertSaxResponseParserClassEquals(method, RealmsHandler.class); assertSaxResponseParserClassEquals(method, RealmsHandler.class);
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class); assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
checkFilters(request); checkFilters(request);
} }
@ -134,7 +134,7 @@ public class DeltacloudAsyncClientTest extends BaseAsyncClientTest<DeltacloudAsy
assertResponseParserClassEquals(method, request, ParseSax.class); assertResponseParserClassEquals(method, request, ParseSax.class);
assertSaxResponseParserClassEquals(method, RealmHandler.class); assertSaxResponseParserClassEquals(method, RealmHandler.class);
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class); assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
checkFilters(request); checkFilters(request);
} }
@ -149,7 +149,7 @@ public class DeltacloudAsyncClientTest extends BaseAsyncClientTest<DeltacloudAsy
assertResponseParserClassEquals(method, request, ParseSax.class); assertResponseParserClassEquals(method, request, ParseSax.class);
assertSaxResponseParserClassEquals(method, ImagesHandler.class); assertSaxResponseParserClassEquals(method, ImagesHandler.class);
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class); assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
checkFilters(request); checkFilters(request);
} }
@ -164,7 +164,7 @@ public class DeltacloudAsyncClientTest extends BaseAsyncClientTest<DeltacloudAsy
assertResponseParserClassEquals(method, request, ParseSax.class); assertResponseParserClassEquals(method, request, ParseSax.class);
assertSaxResponseParserClassEquals(method, ImageHandler.class); assertSaxResponseParserClassEquals(method, ImageHandler.class);
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class); assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
checkFilters(request); checkFilters(request);
} }
@ -179,7 +179,7 @@ public class DeltacloudAsyncClientTest extends BaseAsyncClientTest<DeltacloudAsy
assertResponseParserClassEquals(method, request, ParseSax.class); assertResponseParserClassEquals(method, request, ParseSax.class);
assertSaxResponseParserClassEquals(method, HardwareProfilesHandler.class); assertSaxResponseParserClassEquals(method, HardwareProfilesHandler.class);
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class); assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
checkFilters(request); checkFilters(request);
} }
@ -194,7 +194,7 @@ public class DeltacloudAsyncClientTest extends BaseAsyncClientTest<DeltacloudAsy
assertResponseParserClassEquals(method, request, ParseSax.class); assertResponseParserClassEquals(method, request, ParseSax.class);
assertSaxResponseParserClassEquals(method, HardwareProfileHandler.class); assertSaxResponseParserClassEquals(method, HardwareProfileHandler.class);
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class); assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
checkFilters(request); checkFilters(request);
} }
@ -209,7 +209,7 @@ public class DeltacloudAsyncClientTest extends BaseAsyncClientTest<DeltacloudAsy
assertResponseParserClassEquals(method, request, ParseSax.class); assertResponseParserClassEquals(method, request, ParseSax.class);
assertSaxResponseParserClassEquals(method, InstancesHandler.class); assertSaxResponseParserClassEquals(method, InstancesHandler.class);
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class); assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
checkFilters(request); checkFilters(request);
} }
@ -224,7 +224,7 @@ public class DeltacloudAsyncClientTest extends BaseAsyncClientTest<DeltacloudAsy
assertResponseParserClassEquals(method, request, ParseSax.class); assertResponseParserClassEquals(method, request, ParseSax.class);
assertSaxResponseParserClassEquals(method, InstanceHandler.class); assertSaxResponseParserClassEquals(method, InstanceHandler.class);
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class); assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
checkFilters(request); checkFilters(request);
} }
@ -240,7 +240,7 @@ public class DeltacloudAsyncClientTest extends BaseAsyncClientTest<DeltacloudAsy
assertResponseParserClassEquals(method, httpRequest, ParseSax.class); assertResponseParserClassEquals(method, httpRequest, ParseSax.class);
assertSaxResponseParserClassEquals(method, InstanceHandler.class); assertSaxResponseParserClassEquals(method, InstanceHandler.class);
assertExceptionParserClassEquals(method, null); assertFallbackClassEquals(method, null);
checkFilters(httpRequest); checkFilters(httpRequest);
@ -258,7 +258,7 @@ public class DeltacloudAsyncClientTest extends BaseAsyncClientTest<DeltacloudAsy
assertResponseParserClassEquals(method, httpRequest, ParseSax.class); assertResponseParserClassEquals(method, httpRequest, ParseSax.class);
assertSaxResponseParserClassEquals(method, InstanceHandler.class); assertSaxResponseParserClassEquals(method, InstanceHandler.class);
assertExceptionParserClassEquals(method, null); assertFallbackClassEquals(method, null);
checkFilters(httpRequest); checkFilters(httpRequest);
@ -275,7 +275,7 @@ public class DeltacloudAsyncClientTest extends BaseAsyncClientTest<DeltacloudAsy
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class); assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
assertSaxResponseParserClassEquals(method, null); assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnVoidOnRedirectedDelete.class); assertFallbackClassEquals(method, VoidOnRedirectedDelete.class);
checkFilters(request); 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.POST;
import javax.ws.rs.Path; import javax.ws.rs.Path;
import org.jclouds.Fallbacks.EmptyFluentIterableOnNotFoundOr404;
import org.jclouds.aws.filters.FormSigner; import org.jclouds.aws.filters.FormSigner;
import org.jclouds.ec2.binders.BindFiltersToIndexedFormParams; import org.jclouds.ec2.binders.BindFiltersToIndexedFormParams;
import org.jclouds.ec2.binders.BindResourceIdsToIndexedFormParams; 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.domain.Tag;
import org.jclouds.ec2.xml.DescribeTagsResponseHandler; import org.jclouds.ec2.xml.DescribeTagsResponseHandler;
import org.jclouds.rest.annotations.BinderParam; 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.FormParams;
import org.jclouds.rest.annotations.RequestFilters; import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.SinceApiVersion; import org.jclouds.rest.annotations.SinceApiVersion;
import org.jclouds.rest.annotations.VirtualHost; import org.jclouds.rest.annotations.VirtualHost;
import org.jclouds.rest.annotations.XMLResponseParser; import org.jclouds.rest.annotations.XMLResponseParser;
import org.jclouds.rest.functions.ReturnEmptyFluentIterableOnNotFoundOr404;
import com.google.common.collect.FluentIterable; import com.google.common.collect.FluentIterable;
import com.google.common.collect.Multimap; import com.google.common.collect.Multimap;
@ -94,7 +94,7 @@ public interface TagAsyncApi {
@Path("/") @Path("/")
@FormParams(keys = ACTION, values = "DescribeTags") @FormParams(keys = ACTION, values = "DescribeTags")
@XMLResponseParser(DescribeTagsResponseHandler.class) @XMLResponseParser(DescribeTagsResponseHandler.class)
@ExceptionParser(ReturnEmptyFluentIterableOnNotFoundOr404.class) @Fallback(EmptyFluentIterableOnNotFoundOr404.class)
ListenableFuture<FluentIterable<Tag>> list(); ListenableFuture<FluentIterable<Tag>> list();
/** /**
@ -107,7 +107,7 @@ public interface TagAsyncApi {
@Path("/") @Path("/")
@FormParams(keys = ACTION, values = "DescribeTags") @FormParams(keys = ACTION, values = "DescribeTags")
@XMLResponseParser(DescribeTagsResponseHandler.class) @XMLResponseParser(DescribeTagsResponseHandler.class)
@ExceptionParser(ReturnEmptyFluentIterableOnNotFoundOr404.class) @Fallback(EmptyFluentIterableOnNotFoundOr404.class)
ListenableFuture<FluentIterable<Tag>> filter( ListenableFuture<FluentIterable<Tag>> filter(
@BinderParam(BindFiltersToIndexedFormParams.class) Multimap<String, String> 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.POST;
import javax.ws.rs.Path; import javax.ws.rs.Path;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.aws.filters.FormSigner; import org.jclouds.aws.filters.FormSigner;
import org.jclouds.ec2.domain.PasswordData; import org.jclouds.ec2.domain.PasswordData;
import org.jclouds.ec2.xml.GetPasswordDataResponseHandler; 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.FormParams;
import org.jclouds.rest.annotations.RequestFilters; import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.SinceApiVersion; import org.jclouds.rest.annotations.SinceApiVersion;
import org.jclouds.rest.annotations.VirtualHost; import org.jclouds.rest.annotations.VirtualHost;
import org.jclouds.rest.annotations.XMLResponseParser; import org.jclouds.rest.annotations.XMLResponseParser;
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
import com.google.common.annotations.Beta; import com.google.common.annotations.Beta;
import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.ListenableFuture;
@ -61,7 +61,7 @@ public interface WindowsAsyncApi {
@Path("/") @Path("/")
@FormParams(keys = ACTION, values = "GetPasswordData") @FormParams(keys = ACTION, values = "GetPasswordData")
@XMLResponseParser(GetPasswordDataResponseHandler.class) @XMLResponseParser(GetPasswordDataResponseHandler.class)
@ExceptionParser(ReturnNullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
ListenableFuture<PasswordData> getPasswordDataForInstance(@FormParam("InstanceId") String instanceId); 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.POST;
import javax.ws.rs.Path; import javax.ws.rs.Path;
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
import org.jclouds.aws.filters.FormSigner; import org.jclouds.aws.filters.FormSigner;
import org.jclouds.ec2.binders.BindUserGroupsToIndexedFormParams; import org.jclouds.ec2.binders.BindUserGroupsToIndexedFormParams;
import org.jclouds.ec2.binders.BindUserIdsToIndexedFormParams; import org.jclouds.ec2.binders.BindUserIdsToIndexedFormParams;
import org.jclouds.ec2.domain.Image; import org.jclouds.ec2.domain.Image;
import org.jclouds.ec2.domain.Permission;
import org.jclouds.ec2.domain.Image.EbsBlockDevice; import org.jclouds.ec2.domain.Image.EbsBlockDevice;
import org.jclouds.ec2.domain.Permission;
import org.jclouds.ec2.options.CreateImageOptions; import org.jclouds.ec2.options.CreateImageOptions;
import org.jclouds.ec2.options.DescribeImagesOptions; import org.jclouds.ec2.options.DescribeImagesOptions;
import org.jclouds.ec2.options.RegisterImageBackedByEbsOptions; 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.location.functions.RegionToEndpointOrProviderIfNull;
import org.jclouds.rest.annotations.BinderParam; import org.jclouds.rest.annotations.BinderParam;
import org.jclouds.rest.annotations.EndpointParam; 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.FormParams;
import org.jclouds.rest.annotations.RequestFilters; import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.VirtualHost; import org.jclouds.rest.annotations.VirtualHost;
import org.jclouds.rest.annotations.XMLResponseParser; import org.jclouds.rest.annotations.XMLResponseParser;
import org.jclouds.rest.functions.ReturnEmptySetOnNotFoundOr404;
import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.ListenableFuture;
@ -73,7 +73,7 @@ public interface AMIAsyncClient {
@Path("/") @Path("/")
@FormParams(keys = ACTION, values = "DescribeImages") @FormParams(keys = ACTION, values = "DescribeImages")
@XMLResponseParser(DescribeImagesResponseHandler.class) @XMLResponseParser(DescribeImagesResponseHandler.class)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) @Fallback(EmptySetOnNotFoundOr404.class)
ListenableFuture<Set<? extends Image>> describeImagesInRegion( ListenableFuture<Set<? extends Image>> describeImagesInRegion(
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region, @EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
DescribeImagesOptions... options); DescribeImagesOptions... options);

View File

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

View File

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

View File

@ -27,6 +27,7 @@ import javax.ws.rs.FormParam;
import javax.ws.rs.POST; import javax.ws.rs.POST;
import javax.ws.rs.Path; import javax.ws.rs.Path;
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
import org.jclouds.aws.filters.FormSigner; import org.jclouds.aws.filters.FormSigner;
import org.jclouds.ec2.binders.BindPublicIpsToIndexedFormParams; import org.jclouds.ec2.binders.BindPublicIpsToIndexedFormParams;
import org.jclouds.ec2.domain.PublicIpInstanceIdPair; 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.location.functions.RegionToEndpointOrProviderIfNull;
import org.jclouds.rest.annotations.BinderParam; import org.jclouds.rest.annotations.BinderParam;
import org.jclouds.rest.annotations.EndpointParam; 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.FormParams;
import org.jclouds.rest.annotations.RequestFilters; import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.VirtualHost; import org.jclouds.rest.annotations.VirtualHost;
import org.jclouds.rest.annotations.XMLResponseParser; import org.jclouds.rest.annotations.XMLResponseParser;
import org.jclouds.rest.functions.ReturnEmptySetOnNotFoundOr404;
import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.ListenableFuture;
@ -107,7 +107,7 @@ public interface ElasticIPAddressAsyncClient {
@Path("/") @Path("/")
@FormParams(keys = ACTION, values = "DescribeAddresses") @FormParams(keys = ACTION, values = "DescribeAddresses")
@XMLResponseParser(DescribeAddressesResponseHandler.class) @XMLResponseParser(DescribeAddressesResponseHandler.class)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) @Fallback(EmptySetOnNotFoundOr404.class)
ListenableFuture<? extends Set<PublicIpInstanceIdPair>> describeAddressesInRegion( ListenableFuture<? extends Set<PublicIpInstanceIdPair>> describeAddressesInRegion(
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region, @EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
@BinderParam(BindPublicIpsToIndexedFormParams.class) String... publicIps); @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.POST;
import javax.ws.rs.Path; import javax.ws.rs.Path;
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
import org.jclouds.aws.filters.FormSigner; import org.jclouds.aws.filters.FormSigner;
import org.jclouds.ec2.binders.BindBlockDeviceMappingToIndexedFormParams; import org.jclouds.ec2.binders.BindBlockDeviceMappingToIndexedFormParams;
import org.jclouds.ec2.binders.BindInstanceIdsToIndexedFormParams; 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.location.functions.RegionToEndpointOrProviderIfNull;
import org.jclouds.rest.annotations.BinderParam; import org.jclouds.rest.annotations.BinderParam;
import org.jclouds.rest.annotations.EndpointParam; 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.FormParams;
import org.jclouds.rest.annotations.ParamParser; import org.jclouds.rest.annotations.ParamParser;
import org.jclouds.rest.annotations.RequestFilters; import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.VirtualHost; import org.jclouds.rest.annotations.VirtualHost;
import org.jclouds.rest.annotations.XMLResponseParser; import org.jclouds.rest.annotations.XMLResponseParser;
import org.jclouds.rest.functions.ReturnEmptySetOnNotFoundOr404;
import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.ListenableFuture;
@ -81,7 +81,7 @@ public interface InstanceAsyncClient {
@Path("/") @Path("/")
@FormParams(keys = ACTION, values = "DescribeInstances") @FormParams(keys = ACTION, values = "DescribeInstances")
@XMLResponseParser(DescribeInstancesResponseHandler.class) @XMLResponseParser(DescribeInstancesResponseHandler.class)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) @Fallback(EmptySetOnNotFoundOr404.class)
ListenableFuture<? extends Set<? extends Reservation<? extends RunningInstance>>> describeInstancesInRegion( ListenableFuture<? extends Set<? extends Reservation<? extends RunningInstance>>> describeInstancesInRegion(
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region, @EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
@BinderParam(BindInstanceIdsToIndexedFormParams.class) String... instanceIds); @BinderParam(BindInstanceIdsToIndexedFormParams.class) String... instanceIds);
@ -119,7 +119,7 @@ public interface InstanceAsyncClient {
@Path("/") @Path("/")
@FormParams(keys = ACTION, values = "TerminateInstances") @FormParams(keys = ACTION, values = "TerminateInstances")
@XMLResponseParser(InstanceStateChangeHandler.class) @XMLResponseParser(InstanceStateChangeHandler.class)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) @Fallback(EmptySetOnNotFoundOr404.class)
ListenableFuture<Set<? extends InstanceStateChange>> terminateInstancesInRegion( ListenableFuture<Set<? extends InstanceStateChange>> terminateInstancesInRegion(
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region, @EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
@BinderParam(BindInstanceIdsToIndexedFormParams.class) String... instanceIds); @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.POST;
import javax.ws.rs.Path; import javax.ws.rs.Path;
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
import org.jclouds.aws.filters.FormSigner; import org.jclouds.aws.filters.FormSigner;
import org.jclouds.ec2.binders.BindKeyNamesToIndexedFormParams; import org.jclouds.ec2.binders.BindKeyNamesToIndexedFormParams;
import org.jclouds.ec2.domain.KeyPair; 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.location.functions.RegionToEndpointOrProviderIfNull;
import org.jclouds.rest.annotations.BinderParam; import org.jclouds.rest.annotations.BinderParam;
import org.jclouds.rest.annotations.EndpointParam; 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.FormParams;
import org.jclouds.rest.annotations.RequestFilters; import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.VirtualHost; import org.jclouds.rest.annotations.VirtualHost;
import org.jclouds.rest.annotations.XMLResponseParser; import org.jclouds.rest.annotations.XMLResponseParser;
import org.jclouds.rest.functions.ReturnEmptySetOnNotFoundOr404;
import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.ListenableFuture;
@ -75,7 +75,7 @@ public interface KeyPairAsyncClient {
@Path("/") @Path("/")
@FormParams(keys = ACTION, values = "DescribeKeyPairs") @FormParams(keys = ACTION, values = "DescribeKeyPairs")
@XMLResponseParser(DescribeKeyPairsResponseHandler.class) @XMLResponseParser(DescribeKeyPairsResponseHandler.class)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) @Fallback(EmptySetOnNotFoundOr404.class)
ListenableFuture<? extends Set<KeyPair>> describeKeyPairsInRegion( ListenableFuture<? extends Set<KeyPair>> describeKeyPairsInRegion(
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region, @EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
@BinderParam(BindKeyNamesToIndexedFormParams.class) String... keyPairNames); @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.POST;
import javax.ws.rs.Path; import javax.ws.rs.Path;
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
import org.jclouds.Fallbacks.VoidOnNotFoundOr404;
import org.jclouds.aws.filters.FormSigner; import org.jclouds.aws.filters.FormSigner;
import org.jclouds.ec2.binders.BindGroupNamesToIndexedFormParams; import org.jclouds.ec2.binders.BindGroupNamesToIndexedFormParams;
import org.jclouds.ec2.binders.BindUserIdGroupPairToSourceSecurityGroupFormParams; 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.location.functions.RegionToEndpointOrProviderIfNull;
import org.jclouds.rest.annotations.BinderParam; import org.jclouds.rest.annotations.BinderParam;
import org.jclouds.rest.annotations.EndpointParam; 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.FormParams;
import org.jclouds.rest.annotations.RequestFilters; import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.VirtualHost; import org.jclouds.rest.annotations.VirtualHost;
import org.jclouds.rest.annotations.XMLResponseParser; 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; import com.google.common.util.concurrent.ListenableFuture;
@ -76,7 +76,7 @@ public interface SecurityGroupAsyncClient {
@POST @POST
@Path("/") @Path("/")
@FormParams(keys = ACTION, values = "DeleteSecurityGroup") @FormParams(keys = ACTION, values = "DeleteSecurityGroup")
@ExceptionParser(ReturnVoidOnNotFoundOr404.class) @Fallback(VoidOnNotFoundOr404.class)
ListenableFuture<Void> deleteSecurityGroupInRegion( ListenableFuture<Void> deleteSecurityGroupInRegion(
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region, @FormParam("GroupName") String name); @EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region, @FormParam("GroupName") String name);
@ -88,7 +88,7 @@ public interface SecurityGroupAsyncClient {
@Path("/") @Path("/")
@FormParams(keys = ACTION, values = "DescribeSecurityGroups") @FormParams(keys = ACTION, values = "DescribeSecurityGroups")
@XMLResponseParser(DescribeSecurityGroupsResponseHandler.class) @XMLResponseParser(DescribeSecurityGroupsResponseHandler.class)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) @Fallback(EmptySetOnNotFoundOr404.class)
ListenableFuture<? extends Set<SecurityGroup>> describeSecurityGroupsInRegion( ListenableFuture<? extends Set<SecurityGroup>> describeSecurityGroupsInRegion(
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region, @EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
@BinderParam(BindGroupNamesToIndexedFormParams.class) String... securityGroupNames); @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.POST;
import javax.ws.rs.Path; import javax.ws.rs.Path;
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
import org.jclouds.aws.filters.FormSigner; import org.jclouds.aws.filters.FormSigner;
import org.jclouds.ec2.binders.BindBundleIdsToIndexedFormParams; import org.jclouds.ec2.binders.BindBundleIdsToIndexedFormParams;
import org.jclouds.ec2.binders.BindS3UploadPolicyAndSignature; 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.location.functions.RegionToEndpointOrProviderIfNull;
import org.jclouds.rest.annotations.BinderParam; import org.jclouds.rest.annotations.BinderParam;
import org.jclouds.rest.annotations.EndpointParam; 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.FormParams;
import org.jclouds.rest.annotations.RequestFilters; import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.VirtualHost; import org.jclouds.rest.annotations.VirtualHost;
import org.jclouds.rest.annotations.XMLResponseParser; import org.jclouds.rest.annotations.XMLResponseParser;
import org.jclouds.rest.functions.ReturnEmptySetOnNotFoundOr404;
import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.ListenableFuture;
@ -94,7 +94,7 @@ public interface WindowsAsyncClient {
@Path("/") @Path("/")
@FormParams(keys = ACTION, values = "DescribeBundleTasks") @FormParams(keys = ACTION, values = "DescribeBundleTasks")
@XMLResponseParser(DescribeBundleTasksResponseHandler.class) @XMLResponseParser(DescribeBundleTasksResponseHandler.class)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) @Fallback(EmptySetOnNotFoundOr404.class)
ListenableFuture<? extends Set<BundleTask>> describeBundleTasksInRegion( ListenableFuture<? extends Set<BundleTask>> describeBundleTasksInRegion(
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region, @EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
@BinderParam(BindBundleIdsToIndexedFormParams.class) String... bundleTaskIds); @BinderParam(BindBundleIdsToIndexedFormParams.class) String... bundleTaskIds);

View File

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

View File

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

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