You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jclouds.apache.org by ad...@apache.org on 2014/10/06 22:58:58 UTC
git commit: JCLOUDS-40 unasync Fallback.
Repository: jclouds-labs
Updated Branches:
refs/heads/master 77e31f3a9 -> e5a1507f6
JCLOUDS-40 unasync Fallback.
Project: http://git-wip-us.apache.org/repos/asf/jclouds-labs/repo
Commit: http://git-wip-us.apache.org/repos/asf/jclouds-labs/commit/e5a1507f
Tree: http://git-wip-us.apache.org/repos/asf/jclouds-labs/tree/e5a1507f
Diff: http://git-wip-us.apache.org/repos/asf/jclouds-labs/diff/e5a1507f
Branch: refs/heads/master
Commit: e5a1507f61e2ce49001ab063bf1625a2ced4bc5c
Parents: 77e31f3
Author: Adrian Cole <ac...@twitter.com>
Authored: Mon Oct 6 13:50:39 2014 -0700
Committer: Adrian Cole <ac...@twitter.com>
Committed: Mon Oct 6 13:58:13 2014 -0700
----------------------------------------------------------------------
.../org/jclouds/abiquo/AbiquoFallbacks.java | 22 --------------------
.../jclouds/abiquo/fallbacks/MovedVolume.java | 7 -------
.../abiquo/fallbacks/MovedVolumeTest.java | 4 ++--
...agateAbiquoExceptionOnNotFoundOr4xxTest.java | 6 +++---
4 files changed, 5 insertions(+), 34 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/e5a1507f/abiquo/src/main/java/org/jclouds/abiquo/AbiquoFallbacks.java
----------------------------------------------------------------------
diff --git a/abiquo/src/main/java/org/jclouds/abiquo/AbiquoFallbacks.java b/abiquo/src/main/java/org/jclouds/abiquo/AbiquoFallbacks.java
index 8beef2f..c4abdea 100644
--- a/abiquo/src/main/java/org/jclouds/abiquo/AbiquoFallbacks.java
+++ b/abiquo/src/main/java/org/jclouds/abiquo/AbiquoFallbacks.java
@@ -19,7 +19,6 @@ package org.jclouds.abiquo;
import static com.google.common.base.Throwables.getCausalChain;
import static com.google.common.base.Throwables.propagate;
import static com.google.common.collect.Iterables.find;
-import static com.google.common.util.concurrent.Futures.immediateFuture;
import javax.ws.rs.core.Response.Status;
@@ -30,7 +29,6 @@ import org.jclouds.http.HttpResponseException;
import org.jclouds.rest.ResourceNotFoundException;
import com.google.common.base.Predicate;
-import com.google.common.util.concurrent.ListenableFuture;
/**
* fallbacks common to abiquo
@@ -44,11 +42,6 @@ public final class AbiquoFallbacks {
*/
public static final class PropagateAbiquoExceptionOnNotFoundOr4xx implements Fallback<Object> {
@Override
- public ListenableFuture<Object> create(Throwable from) throws Exception {
- return immediateFuture(createOrPropagate(from));
- }
-
- @Override
public Object createOrPropagate(Throwable from) throws Exception {
Throwable exception = find(getCausalChain(from), isNotFoundAndHasAbiquoException(from), null);
throw propagate(exception == null ? from : exception.getCause());
@@ -60,11 +53,6 @@ public final class AbiquoFallbacks {
*/
public static final class NullOn303 implements Fallback<Object> {
@Override
- public ListenableFuture<Object> create(Throwable from) throws Exception {
- return immediateFuture(createOrPropagate(from));
- }
-
- @Override
public Object createOrPropagate(Throwable from) throws Exception {
Throwable exception = find(getCausalChain(from), hasResponse(from), null);
@@ -87,11 +75,6 @@ public final class AbiquoFallbacks {
*/
public static final class FalseOn5xx implements Fallback<Boolean> {
@Override
- public ListenableFuture<Boolean> create(Throwable from) throws Exception {
- return immediateFuture(createOrPropagate(from));
- }
-
- @Override
public Boolean createOrPropagate(Throwable from) throws Exception {
Throwable exception = find(getCausalChain(from), hasResponse(from), null);
@@ -114,11 +97,6 @@ public final class AbiquoFallbacks {
*/
public static final class FalseIfNotAvailable implements Fallback<Boolean> {
@Override
- public ListenableFuture<Boolean> create(Throwable from) throws Exception {
- return immediateFuture(createOrPropagate(from));
- }
-
- @Override
public Boolean createOrPropagate(Throwable from) throws Exception {
Throwable exception = find(getCausalChain(from), isNotAvailableException(from), null);
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/e5a1507f/abiquo/src/main/java/org/jclouds/abiquo/fallbacks/MovedVolume.java
----------------------------------------------------------------------
diff --git a/abiquo/src/main/java/org/jclouds/abiquo/fallbacks/MovedVolume.java b/abiquo/src/main/java/org/jclouds/abiquo/fallbacks/MovedVolume.java
index cc7984d..9d55d3e 100644
--- a/abiquo/src/main/java/org/jclouds/abiquo/fallbacks/MovedVolume.java
+++ b/abiquo/src/main/java/org/jclouds/abiquo/fallbacks/MovedVolume.java
@@ -19,7 +19,6 @@ package org.jclouds.abiquo.fallbacks;
import static com.google.common.base.Throwables.getCausalChain;
import static com.google.common.base.Throwables.propagate;
import static com.google.common.collect.Iterables.find;
-import static com.google.common.util.concurrent.Futures.immediateFuture;
import javax.inject.Inject;
import javax.inject.Singleton;
@@ -35,7 +34,6 @@ import com.abiquo.server.core.infrastructure.storage.MovedVolumeDto;
import com.abiquo.server.core.infrastructure.storage.VolumeManagementDto;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Predicate;
-import com.google.common.util.concurrent.ListenableFuture;
import com.google.inject.TypeLiteral;
/**
@@ -62,11 +60,6 @@ public class MovedVolume implements Fallback<VolumeManagementDto> {
}
@Override
- public ListenableFuture<VolumeManagementDto> create(Throwable from) throws Exception {
- return immediateFuture(createOrPropagate(from));
- }
-
- @Override
public VolumeManagementDto createOrPropagate(Throwable from) throws Exception {
Throwable exception = find(getCausalChain(from), isMovedException(from), null);
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/e5a1507f/abiquo/src/test/java/org/jclouds/abiquo/fallbacks/MovedVolumeTest.java
----------------------------------------------------------------------
diff --git a/abiquo/src/test/java/org/jclouds/abiquo/fallbacks/MovedVolumeTest.java b/abiquo/src/test/java/org/jclouds/abiquo/fallbacks/MovedVolumeTest.java
index 86ae006..8d372fa 100644
--- a/abiquo/src/test/java/org/jclouds/abiquo/fallbacks/MovedVolumeTest.java
+++ b/abiquo/src/test/java/org/jclouds/abiquo/fallbacks/MovedVolumeTest.java
@@ -49,7 +49,7 @@ public class MovedVolumeTest {
RuntimeException exception = new RuntimeException();
try {
- function.create(exception);
+ function.createOrPropagate(exception);
} catch (Exception ex) {
assertEquals(ex, exception);
}
@@ -85,7 +85,7 @@ public class MovedVolumeTest {
replay(response);
replay(exception);
- function.create(exception);
+ function.createOrPropagate(exception);
verify(response);
verify(exception);
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/e5a1507f/abiquo/src/test/java/org/jclouds/abiquo/fallbacks/PropagateAbiquoExceptionOnNotFoundOr4xxTest.java
----------------------------------------------------------------------
diff --git a/abiquo/src/test/java/org/jclouds/abiquo/fallbacks/PropagateAbiquoExceptionOnNotFoundOr4xxTest.java b/abiquo/src/test/java/org/jclouds/abiquo/fallbacks/PropagateAbiquoExceptionOnNotFoundOr4xxTest.java
index 3780d26..ecb472a 100644
--- a/abiquo/src/test/java/org/jclouds/abiquo/fallbacks/PropagateAbiquoExceptionOnNotFoundOr4xxTest.java
+++ b/abiquo/src/test/java/org/jclouds/abiquo/fallbacks/PropagateAbiquoExceptionOnNotFoundOr4xxTest.java
@@ -37,7 +37,7 @@ public class PropagateAbiquoExceptionOnNotFoundOr4xxTest {
RuntimeException exception = new RuntimeException();
try {
- function.create(exception);
+ function.createOrPropagate(exception);
} catch (Exception ex) {
assertEquals(ex, exception);
}
@@ -48,7 +48,7 @@ public class PropagateAbiquoExceptionOnNotFoundOr4xxTest {
ResourceNotFoundException exception = new ResourceNotFoundException();
try {
- function.create(exception);
+ function.createOrPropagate(exception);
} catch (Exception ex) {
assertEquals(ex, exception);
}
@@ -60,7 +60,7 @@ public class PropagateAbiquoExceptionOnNotFoundOr4xxTest {
ResourceNotFoundException exception = new ResourceNotFoundException(abiquoException);
try {
- function.create(exception);
+ function.createOrPropagate(exception);
} catch (Exception ex) {
assertEquals(ex, abiquoException);
}