Repository: jclouds
Updated Branches:
  refs/heads/master b04d2df66 -> f6d47b9c0


JCLOUDS-1333: Fix Java 8 and Guava 21 issues


Project: http://git-wip-us.apache.org/repos/asf/jclouds/repo
Commit: http://git-wip-us.apache.org/repos/asf/jclouds/commit/f6d47b9c
Tree: http://git-wip-us.apache.org/repos/asf/jclouds/tree/f6d47b9c
Diff: http://git-wip-us.apache.org/repos/asf/jclouds/diff/f6d47b9c

Branch: refs/heads/master
Commit: f6d47b9c0eed7f2fa43f458e2d913305a21938ad
Parents: b04d2df
Author: Andrew Gaul <g...@apache.org>
Authored: Sat Apr 7 19:49:24 2018 -0700
Committer: Andrew Gaul <g...@apache.org>
Committed: Tue Apr 10 08:17:35 2018 -0700

----------------------------------------------------------------------
 .../compute/predicates/AllNodesInGroupTerminated.java     |  3 +--
 .../org/jclouds/ec2/predicates/InstanceHasIpAddress.java  |  6 ++++--
 .../org/jclouds/ec2/predicates/InstanceStateRunning.java  |  6 ++++--
 .../org/jclouds/ec2/predicates/InstanceStateStopped.java  |  6 ++++--
 .../jclouds/ec2/predicates/InstanceStateTerminated.java   |  6 ++++--
 .../ec2/CloudApplicationArchitecturesEC2ApiLiveTest.java  |  7 +++----
 .../test/java/org/jclouds/ec2/EBSBootEC2ApiLiveTest.java  |  7 +++----
 .../jclouds/ec2/compute/EC2ComputeServiceLiveTest.java    |  6 ++++--
 .../org/jclouds/ec2/features/InstanceApiExpectTest.java   |  6 ++++--
 .../compute/predicates/AllNodesInGroupTerminated.java     |  3 +--
 .../integration/internal/BaseContainerLiveTest.java       |  5 +++--
 ...llEqualToIsParentOrIsGrandparentOfCurrentLocation.java |  4 ++--
 .../compute/domain/internal/TemplateBuilderImpl.java      |  5 ++---
 .../compute/internal/BaseComputeServiceLiveTest.java      | 10 +++++-----
 core/src/main/java/org/jclouds/predicates/Validator.java  |  5 +++++
 .../org/jclouds/rest/internal/TransformerForRequest.java  |  6 +++---
 .../functions/PresentSpotRequestsAndInstances.java        |  4 ++--
 .../aws/ec2/compute/AWSEC2ComputeServiceLiveTest.java     |  7 +++++--
 .../jclouds/aws/ec2/features/AWSKeyPairApiLiveTest.java   |  4 +++-
 .../aws/ec2/features/PlacementGroupApiLiveTest.java       |  7 +++++--
 .../jclouds/aws/ec2/features/SpotInstanceApiLiveTest.java |  6 ++++--
 .../arm/internal/BaseAzureComputeApiMockTest.java         |  4 ++--
 22 files changed, 73 insertions(+), 50 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jclouds/blob/f6d47b9c/apis/cloudstack/src/main/java/org/jclouds/cloudstack/compute/predicates/AllNodesInGroupTerminated.java
----------------------------------------------------------------------
diff --git 
a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/compute/predicates/AllNodesInGroupTerminated.java
 
b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/compute/predicates/AllNodesInGroupTerminated.java
index 6a4bd89..02cc846 100644
--- 
a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/compute/predicates/AllNodesInGroupTerminated.java
+++ 
b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/compute/predicates/AllNodesInGroupTerminated.java
@@ -17,7 +17,6 @@
 package org.jclouds.cloudstack.compute.predicates;
 
 import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.base.Predicates.and;
 import static com.google.common.collect.Iterables.all;
 import static org.jclouds.compute.predicates.NodePredicates.TERMINATED;
 import static org.jclouds.compute.predicates.NodePredicates.inGroup;
@@ -48,6 +47,6 @@ public class AllNodesInGroupTerminated implements 
Predicate<ZoneAndName> {
       // new nodes can have the zone as their location, existing nodes, the 
parent is the
       // location
       return 
all(computeService.listNodesDetailsMatching(Predicates.<ComputeMetadata> 
or(locationId(input.getZone()),
-               parentLocationId(input.getZone()))), 
and(inGroup(input.getName()), TERMINATED));
+               parentLocationId(input.getZone()))), 
Predicates.and(inGroup(input.getName()), TERMINATED));
    }
 }

http://git-wip-us.apache.org/repos/asf/jclouds/blob/f6d47b9c/apis/ec2/src/main/java/org/jclouds/ec2/predicates/InstanceHasIpAddress.java
----------------------------------------------------------------------
diff --git 
a/apis/ec2/src/main/java/org/jclouds/ec2/predicates/InstanceHasIpAddress.java 
b/apis/ec2/src/main/java/org/jclouds/ec2/predicates/InstanceHasIpAddress.java
index 2f0b47a..5cddf6b 100644
--- 
a/apis/ec2/src/main/java/org/jclouds/ec2/predicates/InstanceHasIpAddress.java
+++ 
b/apis/ec2/src/main/java/org/jclouds/ec2/predicates/InstanceHasIpAddress.java
@@ -21,6 +21,7 @@ import javax.inject.Singleton;
 
 import org.jclouds.aws.AWSResponseException;
 import org.jclouds.ec2.EC2Api;
+import org.jclouds.ec2.domain.Reservation;
 import org.jclouds.ec2.domain.RunningInstance;
 import org.jclouds.logging.Logger;
 
@@ -58,7 +59,8 @@ public class InstanceHasIpAddress implements 
Predicate<RunningInstance> {
    }
 
    private RunningInstance refresh(RunningInstance instance) {
-      return 
Iterables.getOnlyElement(Iterables.getOnlyElement(client.getInstanceApi().get()
-               .describeInstancesInRegion(instance.getRegion(), 
instance.getId())));
+      Reservation<? extends RunningInstance> reservation = 
Iterables.getOnlyElement(client.getInstanceApi().get()
+               .describeInstancesInRegion(instance.getRegion(), 
instance.getId()));
+      return Iterables.getOnlyElement(reservation);
    }
 }

http://git-wip-us.apache.org/repos/asf/jclouds/blob/f6d47b9c/apis/ec2/src/main/java/org/jclouds/ec2/predicates/InstanceStateRunning.java
----------------------------------------------------------------------
diff --git 
a/apis/ec2/src/main/java/org/jclouds/ec2/predicates/InstanceStateRunning.java 
b/apis/ec2/src/main/java/org/jclouds/ec2/predicates/InstanceStateRunning.java
index 28fe078..e1f5f18 100644
--- 
a/apis/ec2/src/main/java/org/jclouds/ec2/predicates/InstanceStateRunning.java
+++ 
b/apis/ec2/src/main/java/org/jclouds/ec2/predicates/InstanceStateRunning.java
@@ -21,6 +21,7 @@ import javax.inject.Singleton;
 
 import org.jclouds.ec2.EC2Api;
 import org.jclouds.ec2.domain.InstanceState;
+import org.jclouds.ec2.domain.Reservation;
 import org.jclouds.ec2.domain.RunningInstance;
 import org.jclouds.logging.Logger;
 import org.jclouds.rest.ResourceNotFoundException;
@@ -60,8 +61,9 @@ public class InstanceStateRunning implements 
Predicate<RunningInstance> {
    }
 
    private RunningInstance refresh(RunningInstance instance) {
-      return Iterables.getOnlyElement(Iterables.getOnlyElement(client
+      Reservation<? extends RunningInstance> reservation = 
Iterables.getOnlyElement(client
             .getInstanceApi().get().describeInstancesInRegion(
-                  instance.getRegion(), instance.getId())));
+                  instance.getRegion(), instance.getId()));
+      return Iterables.getOnlyElement(reservation);
    }
 }

http://git-wip-us.apache.org/repos/asf/jclouds/blob/f6d47b9c/apis/ec2/src/main/java/org/jclouds/ec2/predicates/InstanceStateStopped.java
----------------------------------------------------------------------
diff --git 
a/apis/ec2/src/main/java/org/jclouds/ec2/predicates/InstanceStateStopped.java 
b/apis/ec2/src/main/java/org/jclouds/ec2/predicates/InstanceStateStopped.java
index 1d8be7b..16c8d54f 100644
--- 
a/apis/ec2/src/main/java/org/jclouds/ec2/predicates/InstanceStateStopped.java
+++ 
b/apis/ec2/src/main/java/org/jclouds/ec2/predicates/InstanceStateStopped.java
@@ -20,6 +20,7 @@ import javax.annotation.Resource;
 import javax.inject.Singleton;
 
 import org.jclouds.ec2.domain.InstanceState;
+import org.jclouds.ec2.domain.Reservation;
 import org.jclouds.ec2.domain.RunningInstance;
 import org.jclouds.ec2.features.InstanceApi;
 import org.jclouds.logging.Logger;
@@ -54,7 +55,8 @@ public class InstanceStateStopped implements 
Predicate<RunningInstance> {
    }
 
    private RunningInstance refresh(RunningInstance instance) {
-      return 
Iterables.getOnlyElement(Iterables.getOnlyElement(client.describeInstancesInRegion(
-               instance.getRegion(), instance.getId())));
+      Reservation<? extends RunningInstance> reservation = 
Iterables.getOnlyElement(client.describeInstancesInRegion(
+               instance.getRegion(), instance.getId()));
+      return Iterables.getOnlyElement(reservation);
    }
 }

http://git-wip-us.apache.org/repos/asf/jclouds/blob/f6d47b9c/apis/ec2/src/main/java/org/jclouds/ec2/predicates/InstanceStateTerminated.java
----------------------------------------------------------------------
diff --git 
a/apis/ec2/src/main/java/org/jclouds/ec2/predicates/InstanceStateTerminated.java
 
b/apis/ec2/src/main/java/org/jclouds/ec2/predicates/InstanceStateTerminated.java
index 102b3e8..20195fd 100644
--- 
a/apis/ec2/src/main/java/org/jclouds/ec2/predicates/InstanceStateTerminated.java
+++ 
b/apis/ec2/src/main/java/org/jclouds/ec2/predicates/InstanceStateTerminated.java
@@ -23,6 +23,7 @@ import javax.inject.Singleton;
 
 import org.jclouds.ec2.EC2Api;
 import org.jclouds.ec2.domain.InstanceState;
+import org.jclouds.ec2.domain.Reservation;
 import org.jclouds.ec2.domain.RunningInstance;
 import org.jclouds.logging.Logger;
 
@@ -60,7 +61,8 @@ public class InstanceStateTerminated implements 
Predicate<RunningInstance> {
    }
 
    private RunningInstance refresh(RunningInstance instance) {
-      return 
Iterables.getOnlyElement(Iterables.getOnlyElement(client.getInstanceApi().get()
-               .describeInstancesInRegion(instance.getRegion(), 
instance.getId())));
+      Reservation<? extends RunningInstance> reservation = 
Iterables.getOnlyElement(client.getInstanceApi().get()
+               .describeInstancesInRegion(instance.getRegion(), 
instance.getId()));
+      return Iterables.getOnlyElement(reservation);
    }
 }

http://git-wip-us.apache.org/repos/asf/jclouds/blob/f6d47b9c/apis/ec2/src/test/java/org/jclouds/ec2/CloudApplicationArchitecturesEC2ApiLiveTest.java
----------------------------------------------------------------------
diff --git 
a/apis/ec2/src/test/java/org/jclouds/ec2/CloudApplicationArchitecturesEC2ApiLiveTest.java
 
b/apis/ec2/src/test/java/org/jclouds/ec2/CloudApplicationArchitecturesEC2ApiLiveTest.java
index efeaf96..beca661 100644
--- 
a/apis/ec2/src/test/java/org/jclouds/ec2/CloudApplicationArchitecturesEC2ApiLiveTest.java
+++ 
b/apis/ec2/src/test/java/org/jclouds/ec2/CloudApplicationArchitecturesEC2ApiLiveTest.java
@@ -28,7 +28,6 @@ import static org.testng.Assert.fail;
 import java.io.IOException;
 import java.net.UnknownHostException;
 import java.util.Map;
-import java.util.Set;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.TimeoutException;
 
@@ -368,12 +367,12 @@ public class CloudApplicationArchitecturesEC2ApiLiveTest 
extends BaseComputeServ
 
    private RunningInstance getInstance(String instanceId) {
       // search my identity for the instance I just created
-      Set<? extends Reservation<? extends RunningInstance>> reservations = 
client.getInstanceApi().get()
-            .describeInstancesInRegion(null, instanceId); // last parameter
+      Reservation<? extends RunningInstance> reservation = 
Iterables.getOnlyElement(client.getInstanceApi().get()
+            .describeInstancesInRegion(null, instanceId)); // last parameter
       // (ids) narrows the
       // search
 
-      return Iterables.getOnlyElement(Iterables.getOnlyElement(reservations));
+      return Iterables.getOnlyElement(reservation);
    }
 
    /**

http://git-wip-us.apache.org/repos/asf/jclouds/blob/f6d47b9c/apis/ec2/src/test/java/org/jclouds/ec2/EBSBootEC2ApiLiveTest.java
----------------------------------------------------------------------
diff --git a/apis/ec2/src/test/java/org/jclouds/ec2/EBSBootEC2ApiLiveTest.java 
b/apis/ec2/src/test/java/org/jclouds/ec2/EBSBootEC2ApiLiveTest.java
index 6bc0b02..4c5c1c1 100644
--- a/apis/ec2/src/test/java/org/jclouds/ec2/EBSBootEC2ApiLiveTest.java
+++ b/apis/ec2/src/test/java/org/jclouds/ec2/EBSBootEC2ApiLiveTest.java
@@ -27,7 +27,6 @@ import static org.testng.Assert.assertNotNull;
 
 import java.net.UnknownHostException;
 import java.util.Map;
-import java.util.Set;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.TimeoutException;
 
@@ -511,15 +510,15 @@ public class EBSBootEC2ApiLiveTest extends 
BaseComputeServiceContextLiveTest {
       assert runningTester.apply(instance);
 
       // search my identity for the instance I just created
-      Set<? extends Reservation<? extends RunningInstance>> reservations = 
client.getInstanceApi().get()
-            .describeInstancesInRegion(instance.getRegion(), 
instance.getId()); // last
+      Reservation<? extends RunningInstance> reservation = 
Iterables.getOnlyElement(client.getInstanceApi().get()
+            .describeInstancesInRegion(instance.getRegion(), 
instance.getId())); // last
       // parameter
       // (ids)
       // narrows
       // the
       // search
 
-      instance = 
Iterables.getOnlyElement(Iterables.getOnlyElement(reservations));
+      instance = Iterables.getOnlyElement(reservation);
 
       System.out.printf("%d: %s awaiting ssh service to start%n", 
System.currentTimeMillis(), instance.getIpAddress());
       assert socketTester.apply(HostAndPort.fromParts(instance.getIpAddress(), 
22));

http://git-wip-us.apache.org/repos/asf/jclouds/blob/f6d47b9c/apis/ec2/src/test/java/org/jclouds/ec2/compute/EC2ComputeServiceLiveTest.java
----------------------------------------------------------------------
diff --git 
a/apis/ec2/src/test/java/org/jclouds/ec2/compute/EC2ComputeServiceLiveTest.java 
b/apis/ec2/src/test/java/org/jclouds/ec2/compute/EC2ComputeServiceLiveTest.java
index 1fa7e4b..f41f8e5 100644
--- 
a/apis/ec2/src/test/java/org/jclouds/ec2/compute/EC2ComputeServiceLiveTest.java
+++ 
b/apis/ec2/src/test/java/org/jclouds/ec2/compute/EC2ComputeServiceLiveTest.java
@@ -40,6 +40,7 @@ import org.jclouds.ec2.compute.options.EC2TemplateOptions;
 import org.jclouds.ec2.domain.BlockDevice;
 import org.jclouds.ec2.domain.KeyPair;
 import org.jclouds.ec2.domain.PublicIpInstanceIdPair;
+import org.jclouds.ec2.domain.Reservation;
 import org.jclouds.ec2.domain.RunningInstance;
 import org.jclouds.ec2.domain.SecurityGroup;
 import org.jclouds.ec2.domain.Snapshot;
@@ -336,8 +337,9 @@ public class EC2ComputeServiceLiveTest extends 
BaseComputeServiceLiveTest {
     * @throws NoSuchElementException If no instance with that id exists, or 
the instance is in a different region
     */
    public static RunningInstance getInstance(InstanceApi instanceClient, 
String id) {
-      RunningInstance instance = 
Iterables.getOnlyElement(Iterables.getOnlyElement(instanceClient
-               .describeInstancesInRegion(null, id)));
+      Reservation<? extends RunningInstance> reservation = 
Iterables.getOnlyElement(instanceClient
+               .describeInstancesInRegion(null, id));
+      RunningInstance instance = Iterables.getOnlyElement(reservation);
       return instance;
    }
 

http://git-wip-us.apache.org/repos/asf/jclouds/blob/f6d47b9c/apis/ec2/src/test/java/org/jclouds/ec2/features/InstanceApiExpectTest.java
----------------------------------------------------------------------
diff --git 
a/apis/ec2/src/test/java/org/jclouds/ec2/features/InstanceApiExpectTest.java 
b/apis/ec2/src/test/java/org/jclouds/ec2/features/InstanceApiExpectTest.java
index a862e30..7d7631e 100644
--- a/apis/ec2/src/test/java/org/jclouds/ec2/features/InstanceApiExpectTest.java
+++ b/apis/ec2/src/test/java/org/jclouds/ec2/features/InstanceApiExpectTest.java
@@ -23,6 +23,7 @@ import java.util.Properties;
 
 import org.jclouds.Constants;
 import org.jclouds.ec2.EC2Api;
+import org.jclouds.ec2.domain.Reservation;
 import org.jclouds.ec2.domain.RunningInstance;
 import org.jclouds.ec2.internal.BaseEC2ApiExpectTest;
 import org.jclouds.http.HttpRequest;
@@ -75,10 +76,11 @@ public class InstanceApiExpectTest extends 
BaseEC2ApiExpectTest<EC2Api> {
       EC2Api apiWhenExist = requestsSendResponses(describeRegionsRequest, 
describeRegionsResponse,
               filter, filterResponse);
 
-      RunningInstance instance = 
getOnlyElement(getOnlyElement(apiWhenExist.getInstanceApi().get().describeInstancesInRegionWithFilter("us-east-1",
+      Reservation<? extends RunningInstance> reservation = 
getOnlyElement(apiWhenExist.getInstanceApi().get().describeInstancesInRegionWithFilter("us-east-1",
               ImmutableMultimap.<String, String>builder()
                       .put("key-name", "adriancole.ec21")
-                      .build())));
+                      .build()));
+      RunningInstance instance = getOnlyElement(reservation);
       assertNotNull(instance, "Instance should not be null");
 
       Assert.assertEquals(instance.getId(), "i-0799056f");

http://git-wip-us.apache.org/repos/asf/jclouds/blob/f6d47b9c/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/compute/predicates/AllNodesInGroupTerminated.java
----------------------------------------------------------------------
diff --git 
a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/compute/predicates/AllNodesInGroupTerminated.java
 
b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/compute/predicates/AllNodesInGroupTerminated.java
index 6fb1d58..0d6812f 100644
--- 
a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/compute/predicates/AllNodesInGroupTerminated.java
+++ 
b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/compute/predicates/AllNodesInGroupTerminated.java
@@ -17,7 +17,6 @@
 package org.jclouds.openstack.nova.v2_0.compute.predicates;
 
 import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.base.Predicates.and;
 import static com.google.common.collect.Iterables.all;
 import static org.jclouds.compute.predicates.NodePredicates.TERMINATED;
 import static org.jclouds.compute.predicates.NodePredicates.inGroup;
@@ -48,6 +47,6 @@ public class AllNodesInGroupTerminated implements 
Predicate<RegionAndName> {
       // new nodes can have the region as their location, existing nodes, the 
parent is the
       // location
       return 
all(computeService.listNodesDetailsMatching(Predicates.<ComputeMetadata> 
or(locationId(input.getRegion()),
-               parentLocationId(input.getRegion()))), 
and(inGroup(input.getName()), TERMINATED));
+               parentLocationId(input.getRegion()))), 
Predicates.and(inGroup(input.getName()), TERMINATED));
    }
 }

http://git-wip-us.apache.org/repos/asf/jclouds/blob/f6d47b9c/blobstore/src/test/java/org/jclouds/blobstore/integration/internal/BaseContainerLiveTest.java
----------------------------------------------------------------------
diff --git 
a/blobstore/src/test/java/org/jclouds/blobstore/integration/internal/BaseContainerLiveTest.java
 
b/blobstore/src/test/java/org/jclouds/blobstore/integration/internal/BaseContainerLiveTest.java
index cd234cd..f40a096 100644
--- 
a/blobstore/src/test/java/org/jclouds/blobstore/integration/internal/BaseContainerLiveTest.java
+++ 
b/blobstore/src/test/java/org/jclouds/blobstore/integration/internal/BaseContainerLiveTest.java
@@ -90,8 +90,9 @@ public class BaseContainerLiveTest extends 
BaseBlobStoreIntegrationTest {
    }
 
    static Location findNonDefaultLocationOrSkip(BlobStore blobStore, Location 
defaultLocation) {
-      List<? extends Location> locs = 
Lists.newArrayList(Iterables.filter(blobStore.listAssignableLocations(),
-               Predicates.not(Predicates.equalTo(defaultLocation))));
+      Iterable<? extends Location> iterable = 
Iterables.filter(blobStore.listAssignableLocations(),
+               Predicates.not(Predicates.equalTo(defaultLocation)));
+      List<? extends Location> locs = Lists.newArrayList(iterable);
       if (locs.size() == 0)
          throw new SkipException("No non-default location found in " + locs);
       // try to use a diverse location

http://git-wip-us.apache.org/repos/asf/jclouds/blob/f6d47b9c/compute/src/main/java/org/jclouds/compute/domain/internal/NullEqualToIsParentOrIsGrandparentOfCurrentLocation.java
----------------------------------------------------------------------
diff --git 
a/compute/src/main/java/org/jclouds/compute/domain/internal/NullEqualToIsParentOrIsGrandparentOfCurrentLocation.java
 
b/compute/src/main/java/org/jclouds/compute/domain/internal/NullEqualToIsParentOrIsGrandparentOfCurrentLocation.java
index 6dc41d0..cfe1c3d 100644
--- 
a/compute/src/main/java/org/jclouds/compute/domain/internal/NullEqualToIsParentOrIsGrandparentOfCurrentLocation.java
+++ 
b/compute/src/main/java/org/jclouds/compute/domain/internal/NullEqualToIsParentOrIsGrandparentOfCurrentLocation.java
@@ -18,13 +18,13 @@ package org.jclouds.compute.domain.internal;
 import static com.google.common.base.Preconditions.checkArgument;
 import static com.google.common.base.Preconditions.checkState;
 import static com.google.common.base.Predicates.equalTo;
-import static com.google.common.base.Predicates.or;
 
 import org.jclouds.compute.domain.ComputeMetadata;
 import org.jclouds.domain.Location;
 import org.jclouds.domain.LocationScope;
 
 import com.google.common.base.Predicate;
+import com.google.common.base.Predicates;
 import com.google.common.base.Supplier;
 import com.google.common.collect.ImmutableSet;
 import com.google.common.collect.ImmutableSet.Builder;
@@ -75,7 +75,7 @@ public class 
NullEqualToIsParentOrIsGrandparentOfCurrentLocation implements Pred
             predicates.add(equalTo(grandparent));
       }
       
-      return or(predicates.build()).apply(input.getLocation());
+      return Predicates.or(predicates.build()).apply(input.getLocation());
 
    }
 

http://git-wip-us.apache.org/repos/asf/jclouds/blob/f6d47b9c/compute/src/main/java/org/jclouds/compute/domain/internal/TemplateBuilderImpl.java
----------------------------------------------------------------------
diff --git 
a/compute/src/main/java/org/jclouds/compute/domain/internal/TemplateBuilderImpl.java
 
b/compute/src/main/java/org/jclouds/compute/domain/internal/TemplateBuilderImpl.java
index 293d81b..6099c1f 100644
--- 
a/compute/src/main/java/org/jclouds/compute/domain/internal/TemplateBuilderImpl.java
+++ 
b/compute/src/main/java/org/jclouds/compute/domain/internal/TemplateBuilderImpl.java
@@ -60,7 +60,6 @@ import java.util.regex.Pattern;
 import static com.google.common.base.Preconditions.checkArgument;
 import static com.google.common.base.Preconditions.checkNotNull;
 import static com.google.common.base.Preconditions.checkState;
-import static com.google.common.base.Predicates.and;
 import static com.google.common.collect.Iterables.filter;
 import static com.google.common.collect.Iterables.find;
 import static com.google.common.collect.Iterables.size;
@@ -888,12 +887,12 @@ public class TemplateBuilderImpl implements 
TemplateBuilder {
 
             @Override
             public boolean apply(Image input) {
-               return and(osPredicates).apply(input.getOperatingSystem());
+               return 
Predicates.and(osPredicates).apply(input.getOperatingSystem());
             }
 
             @Override
             public String toString() {
-               return and(osPredicates).toString();
+               return Predicates.and(osPredicates).toString();
             }
 
          });

http://git-wip-us.apache.org/repos/asf/jclouds/blob/f6d47b9c/compute/src/test/java/org/jclouds/compute/internal/BaseComputeServiceLiveTest.java
----------------------------------------------------------------------
diff --git 
a/compute/src/test/java/org/jclouds/compute/internal/BaseComputeServiceLiveTest.java
 
b/compute/src/test/java/org/jclouds/compute/internal/BaseComputeServiceLiveTest.java
index 5308c6d..31d5448 100644
--- 
a/compute/src/test/java/org/jclouds/compute/internal/BaseComputeServiceLiveTest.java
+++ 
b/compute/src/test/java/org/jclouds/compute/internal/BaseComputeServiceLiveTest.java
@@ -17,7 +17,6 @@
 package org.jclouds.compute.internal;
 
 import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.base.Predicates.and;
 import static com.google.common.base.Predicates.in;
 import static com.google.common.base.Predicates.not;
 import static com.google.common.collect.ImmutableSet.copyOf;
@@ -557,8 +556,8 @@ public abstract class BaseComputeServiceLiveTest extends 
BaseComputeServiceConte
          throw e;
       }
 
-      Map<String, ? extends NodeMetadata> metadataMap = 
newLinkedHashMap(uniqueIndex(
-            filter(client.listNodesDetailsMatching(all()), and(inGroup(group), 
not(TERMINATED))),
+      Map<String, ? extends NodeMetadata> uniqueMap = uniqueIndex(
+            filter(client.listNodesDetailsMatching(all()), 
Predicates.and(inGroup(group), not(TERMINATED))),
             new Function<NodeMetadata, String>() {
 
                @Override
@@ -566,7 +565,8 @@ public abstract class BaseComputeServiceLiveTest extends 
BaseComputeServiceConte
                   return from.getId();
                }
 
-            }));
+            });
+      Map<String, ? extends NodeMetadata> metadataMap = 
newLinkedHashMap(uniqueMap);
       for (NodeMetadata node : nodes) {
          metadataMap.remove(node.getId());
          NodeMetadata metadata = client.getNodeMetadata(node.getId());
@@ -697,7 +697,7 @@ public abstract class BaseComputeServiceLiveTest extends 
BaseComputeServiceConte
    }
 
    private Set<? extends NodeMetadata> refreshNodes() {
-      return filter(client.listNodesDetailsMatching(all()), 
and(inGroup(group), not(TERMINATED)));
+      return filter(client.listNodesDetailsMatching(all()), 
Predicates.and(inGroup(group), not(TERMINATED)));
    }
 
    static class ServiceStats {

http://git-wip-us.apache.org/repos/asf/jclouds/blob/f6d47b9c/core/src/main/java/org/jclouds/predicates/Validator.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/jclouds/predicates/Validator.java 
b/core/src/main/java/org/jclouds/predicates/Validator.java
index 8d111eb..8dad5ae 100644
--- a/core/src/main/java/org/jclouds/predicates/Validator.java
+++ b/core/src/main/java/org/jclouds/predicates/Validator.java
@@ -38,6 +38,11 @@ public abstract class Validator<T> implements Predicate<T> {
         return true; // by contract, if no exception thrown
     }
 
+    // TODO: add @Override after upgrading to Java 8
+    public boolean test(@Nullable T t) {
+        return apply(t);
+    }
+
     /**
      * Validates the parameter
      * @param t parameter to be validated

http://git-wip-us.apache.org/repos/asf/jclouds/blob/f6d47b9c/core/src/main/java/org/jclouds/rest/internal/TransformerForRequest.java
----------------------------------------------------------------------
diff --git 
a/core/src/main/java/org/jclouds/rest/internal/TransformerForRequest.java 
b/core/src/main/java/org/jclouds/rest/internal/TransformerForRequest.java
index fee964b..6337a66 100644
--- a/core/src/main/java/org/jclouds/rest/internal/TransformerForRequest.java
+++ b/core/src/main/java/org/jclouds/rest/internal/TransformerForRequest.java
@@ -16,7 +16,6 @@
  */
 package org.jclouds.rest.internal;
 
-import static com.google.common.base.Functions.compose;
 import static com.google.inject.util.Types.newParameterizedType;
 import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
 import static javax.ws.rs.core.MediaType.APPLICATION_XML;
@@ -59,6 +58,7 @@ import org.jclouds.rest.annotations.XMLResponseParser;
 
 import com.google.common.annotations.VisibleForTesting;
 import com.google.common.base.Function;
+import com.google.common.base.Functions;
 import com.google.common.base.Optional;
 import com.google.common.reflect.Invokable;
 import com.google.common.reflect.TypeToken;
@@ -99,7 +99,7 @@ public class TransformerForRequest implements 
Function<HttpRequest, Function<Htt
          if (wrappingTransformer instanceof InvocationContext<?>) {
             ((InvocationContext<?>) wrappingTransformer).setContext(request);
          }
-         transformer = compose(Function.class.cast(wrappingTransformer), 
transformer);
+         transformer = 
Functions.compose(Function.class.cast(wrappingTransformer), transformer);
       }
       return transformer;
    }
@@ -186,7 +186,7 @@ public class TransformerForRequest implements 
Function<HttpRequest, Function<Htt
          transformer = new 
ParseFirstJsonValueNamed(injector.getInstance(GsonWrapper.class),
                TypeLiteral.get(returnVal), 
invoked.getAnnotation(SelectJson.class).value());
          if (invoked.isAnnotationPresent(OnlyElement.class))
-            transformer = compose(new OnlyElementOrNull(), transformer);
+            transformer = Functions.compose(new OnlyElementOrNull(), 
transformer);
       } else {
          transformer = 
injector.getInstance(getParserOrThrowException(invocation));
       }

http://git-wip-us.apache.org/repos/asf/jclouds/blob/f6d47b9c/providers/aws-ec2/src/main/java/org/jclouds/aws/ec2/compute/functions/PresentSpotRequestsAndInstances.java
----------------------------------------------------------------------
diff --git 
a/providers/aws-ec2/src/main/java/org/jclouds/aws/ec2/compute/functions/PresentSpotRequestsAndInstances.java
 
b/providers/aws-ec2/src/main/java/org/jclouds/aws/ec2/compute/functions/PresentSpotRequestsAndInstances.java
index 9b7a4e9..65275a9 100644
--- 
a/providers/aws-ec2/src/main/java/org/jclouds/aws/ec2/compute/functions/PresentSpotRequestsAndInstances.java
+++ 
b/providers/aws-ec2/src/main/java/org/jclouds/aws/ec2/compute/functions/PresentSpotRequestsAndInstances.java
@@ -17,7 +17,6 @@
 package org.jclouds.aws.ec2.compute.functions;
 
 import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.base.Predicates.compose;
 import static com.google.common.base.Predicates.containsPattern;
 import static com.google.common.collect.Iterables.any;
 import static com.google.common.collect.Iterables.toArray;
@@ -41,6 +40,7 @@ import org.jclouds.ec2.compute.functions.PresentInstances;
 import org.jclouds.ec2.domain.RunningInstance;
 
 import com.google.common.base.Function;
+import com.google.common.base.Predicates;
 import com.google.common.collect.ImmutableSet;
 import com.google.common.collect.ImmutableSet.Builder;
 import com.google.common.collect.Multimap;
@@ -67,7 +67,7 @@ public class PresentSpotRequestsAndInstances extends 
PresentInstances {
    public Set<RunningInstance> apply(Set<RegionAndName> regionAndIds) {
       if (checkNotNull(regionAndIds, "regionAndIds").isEmpty())
          return ImmutableSet.of();
-      if (any(regionAndIds, compose(containsPattern("sir-"), nameFunction())))
+      if (any(regionAndIds, Predicates.compose(containsPattern("sir-"), 
nameFunction())))
          return getSpots(regionAndIds);
       return super.apply(regionAndIds);
    }

http://git-wip-us.apache.org/repos/asf/jclouds/blob/f6d47b9c/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/compute/AWSEC2ComputeServiceLiveTest.java
----------------------------------------------------------------------
diff --git 
a/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/compute/AWSEC2ComputeServiceLiveTest.java
 
b/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/compute/AWSEC2ComputeServiceLiveTest.java
index 3ac06b7..c5dd4d0 100644
--- 
a/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/compute/AWSEC2ComputeServiceLiveTest.java
+++ 
b/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/compute/AWSEC2ComputeServiceLiveTest.java
@@ -48,6 +48,8 @@ import org.jclouds.compute.predicates.NodePredicates;
 import org.jclouds.domain.LoginCredentials;
 import org.jclouds.ec2.compute.EC2ComputeServiceLiveTest;
 import org.jclouds.ec2.domain.KeyPair;
+import org.jclouds.ec2.domain.Reservation;
+import org.jclouds.ec2.domain.RunningInstance;
 import org.jclouds.ec2.features.InstanceApi;
 import org.jclouds.ec2.features.KeyPairApi;
 import org.jclouds.net.domain.IpProtocol;
@@ -131,8 +133,9 @@ public class AWSEC2ComputeServiceLiveTest extends 
EC2ComputeServiceLiveTest {
 
          startedId = first.getProviderId();
 
-         AWSRunningInstance instance = 
AWSRunningInstance.class.cast(getOnlyElement(getOnlyElement(instanceApi
-                  .describeInstancesInRegion(region, startedId))));
+         Reservation<? extends RunningInstance> reservation = 
getOnlyElement(instanceApi
+                  .describeInstancesInRegion(region, startedId));
+         AWSRunningInstance instance = 
AWSRunningInstance.class.cast(getOnlyElement(reservation));
 
          assertEquals(instance.getKeyName(), group);
          assert instance.getSpotInstanceRequestId() != null;

http://git-wip-us.apache.org/repos/asf/jclouds/blob/f6d47b9c/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/features/AWSKeyPairApiLiveTest.java
----------------------------------------------------------------------
diff --git 
a/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/features/AWSKeyPairApiLiveTest.java
 
b/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/features/AWSKeyPairApiLiveTest.java
index f11730e..31a4961 100644
--- 
a/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/features/AWSKeyPairApiLiveTest.java
+++ 
b/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/features/AWSKeyPairApiLiveTest.java
@@ -45,6 +45,7 @@ import 
org.jclouds.compute.internal.BaseComputeServiceContextLiveTest;
 import org.jclouds.compute.options.TemplateOptions;
 import org.jclouds.domain.LoginCredentials;
 import org.jclouds.ec2.domain.KeyPair;
+import org.jclouds.ec2.domain.Reservation;
 import org.jclouds.logging.log4j.config.Log4JLoggingModule;
 import org.jclouds.sshj.config.SshjSshClientModule;
 import org.testng.annotations.BeforeClass;
@@ -196,7 +197,8 @@ public class AWSKeyPairApiLiveTest extends 
BaseComputeServiceContextLiveTest {
    }
 
    protected AWSRunningInstance getInstance(AWSInstanceApi instanceApi, String 
id) {
-      return 
getOnlyElement(getOnlyElement(instanceApi.describeInstancesInRegion(null, id)));
+      Reservation<? extends AWSRunningInstance> reservation = 
getOnlyElement(instanceApi.describeInstancesInRegion(null, id));
+      return getOnlyElement(reservation);
    }
    
    @Override

http://git-wip-us.apache.org/repos/asf/jclouds/blob/f6d47b9c/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/features/PlacementGroupApiLiveTest.java
----------------------------------------------------------------------
diff --git 
a/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/features/PlacementGroupApiLiveTest.java
 
b/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/features/PlacementGroupApiLiveTest.java
index 816e7a9..1c886a8 100644
--- 
a/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/features/PlacementGroupApiLiveTest.java
+++ 
b/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/features/PlacementGroupApiLiveTest.java
@@ -42,6 +42,8 @@ import 
org.jclouds.compute.internal.BaseComputeServiceContextLiveTest;
 import org.jclouds.compute.predicates.NodePredicates;
 import org.jclouds.ec2.compute.domain.EC2HardwareBuilder;
 import org.jclouds.ec2.domain.InstanceType;
+import org.jclouds.ec2.domain.Reservation;
+import org.jclouds.ec2.domain.RunningInstance;
 import org.jclouds.scriptbuilder.domain.Statements;
 import org.jclouds.scriptbuilder.statements.java.InstallJDK;
 import org.jclouds.scriptbuilder.statements.login.AdminAccess;
@@ -186,8 +188,9 @@ public class PlacementGroupApiLiveTest extends 
BaseComputeServiceContextLiveTest
          Set<? extends NodeMetadata> nodes = 
view.getComputeService().createNodesInGroup(group, 1, template);
          NodeMetadata node = getOnlyElement(nodes);
 
-         
getOnlyElement(getOnlyElement(client.getInstanceApi().get().describeInstancesInRegion(null,
-                  node.getProviderId())));
+         Reservation<? extends RunningInstance> reservation = 
getOnlyElement(client.getInstanceApi().get().describeInstancesInRegion(null,
+                  node.getProviderId()));
+         getOnlyElement(reservation);
 
       } catch (RunNodesException e) {
          System.err.println(e.getNodeErrors().keySet());

http://git-wip-us.apache.org/repos/asf/jclouds/blob/f6d47b9c/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/features/SpotInstanceApiLiveTest.java
----------------------------------------------------------------------
diff --git 
a/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/features/SpotInstanceApiLiveTest.java
 
b/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/features/SpotInstanceApiLiveTest.java
index 2bdecfc..acefee0 100644
--- 
a/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/features/SpotInstanceApiLiveTest.java
+++ 
b/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/features/SpotInstanceApiLiveTest.java
@@ -40,6 +40,7 @@ import org.jclouds.aws.ec2.domain.SpotInstanceRequest;
 import org.jclouds.aws.ec2.predicates.SpotInstanceRequestActive;
 import org.jclouds.compute.internal.BaseComputeServiceContextLiveTest;
 import org.jclouds.ec2.domain.InstanceType;
+import org.jclouds.ec2.domain.Reservation;
 import org.testng.annotations.AfterClass;
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.Test;
@@ -185,8 +186,9 @@ public class SpotInstanceApiLiveTest  extends 
BaseComputeServiceContextLiveTest
       System.out.println(System.currentTimeMillis() - start);
       spot = refresh(request);
       assert spot.getInstanceId() != null : spot;
-      instance = 
getOnlyElement(getOnlyElement(client.getInstanceApi().get().describeInstancesInRegion(spot.getRegion(),
-               spot.getInstanceId())));
+      Reservation<? extends AWSRunningInstance> reservation = 
getOnlyElement(client.getInstanceApi().get().describeInstancesInRegion(spot.getRegion(),
+               spot.getInstanceId()));
+      instance = getOnlyElement(reservation);
       assertEquals(instance.getSpotInstanceRequestId(), spot.getId());
    }
 

http://git-wip-us.apache.org/repos/asf/jclouds/blob/f6d47b9c/providers/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/internal/BaseAzureComputeApiMockTest.java
----------------------------------------------------------------------
diff --git 
a/providers/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/internal/BaseAzureComputeApiMockTest.java
 
b/providers/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/internal/BaseAzureComputeApiMockTest.java
index 8a0efd4..20a1ab7 100644
--- 
a/providers/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/internal/BaseAzureComputeApiMockTest.java
+++ 
b/providers/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/internal/BaseAzureComputeApiMockTest.java
@@ -18,7 +18,7 @@ package org.jclouds.azurecompute.arm.internal;
 
 import static com.google.common.base.Predicates.not;
 import static com.google.common.collect.Iterables.filter;
-import static 
com.google.common.util.concurrent.MoreExecutors.sameThreadExecutor;
+import static 
com.google.common.util.concurrent.MoreExecutors.newDirectExecutorService;
 import static org.assertj.core.util.Sets.newHashSet;
 import static 
org.jclouds.oauth.v2.config.CredentialType.BEARER_TOKEN_CREDENTIALS;
 import static org.jclouds.oauth.v2.config.OAuthProperties.CREDENTIAL_TYPE;
@@ -104,7 +104,7 @@ public class BaseAzureComputeApiMockTest {
 
    protected Set<Module> setupModules() {
       ImmutableSet.Builder<Module> modules = ImmutableSet.builder();
-      modules.add(new ExecutorServiceModule(sameThreadExecutor()));
+      modules.add(new ExecutorServiceModule(newDirectExecutorService()));
       // Override the default HTTP module to accomodate custom bindings for the
       // hardcoded endpoints such as the Graph RBAC API one.
       modules.add(new TestAzureComputeHttpApiModule(server));

Reply via email to