From d5dbcf917380febb7c80773c579dc42a9615efc5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magnus=20Spa=CC=8Angdal?= Date: Mon, 21 Nov 2016 23:43:21 +0100 Subject: [PATCH] Upgrade guava 16.0.1 -> 20.0 --- .../com/datastax/driver/core/Cluster.java | 15 ++--- .../com/datastax/driver/core/Connection.java | 18 +++--- .../driver/core/HostConnectionPool.java | 6 +- .../datastax/driver/core/PoolingOptions.java | 2 +- .../datastax/driver/core/SessionManager.java | 6 +- .../com/datastax/driver/core/TypeCodec.java | 5 +- .../driver/core/policies/Policies.java | 11 ++-- .../datastax/driver/core/AsyncQueryTest.java | 6 +- .../driver/core/AsyncResultSetTest.java | 4 +- .../driver/core/ConnectionReleaseTest.java | 2 +- .../LoadBalancingPolicyBootstrapTest.java | 3 +- .../policies/LimitingLoadBalancingPolicy.java | 4 +- .../com/datastax/driver/mapping/Mapper.java | 4 +- .../driver/mapping/MapperAsyncResultTest.java | 4 +- .../driver/mapping/MapperUDTTest.java | 5 +- .../datastax/driver/osgi/BundleOptions.java | 2 +- .../driver/osgi/MailboxServiceGuava18IT.java | 57 ------------------- ...17IT.java => MailboxServiceGuava20IT.java} | 12 ++-- .../driver/osgi/MailboxServiceTests.java | 7 +-- pom.xml | 4 +- 20 files changed, 60 insertions(+), 117 deletions(-) delete mode 100644 driver-tests/osgi/src/test/java/com/datastax/driver/osgi/MailboxServiceGuava18IT.java rename driver-tests/osgi/src/test/java/com/datastax/driver/osgi/{MailboxServiceGuava17IT.java => MailboxServiceGuava20IT.java} (87%) diff --git a/driver-core/src/main/java/com/datastax/driver/core/Cluster.java b/driver-core/src/main/java/com/datastax/driver/core/Cluster.java index 7b7d6a68e39..53f40a85035 100644 --- a/driver-core/src/main/java/com/datastax/driver/core/Cluster.java +++ b/driver-core/src/main/java/com/datastax/driver/core/Cluster.java @@ -19,10 +19,7 @@ import com.datastax.driver.core.policies.*; import com.datastax.driver.core.utils.MoreFutures; import com.google.common.annotations.VisibleForTesting; -import com.google.common.base.Functions; -import com.google.common.base.Predicates; -import com.google.common.base.Strings; -import com.google.common.base.Throwables; +import com.google.common.base.*; import com.google.common.collect.*; import com.google.common.util.concurrent.*; import org.slf4j.Logger; @@ -338,15 +335,15 @@ public ListenableFuture connectAsync(final String keyspace) { return sessionInitialized; } else { final String useQuery = "USE " + keyspace; - ListenableFuture keyspaceSet = Futures.transform(sessionInitialized, new AsyncFunction() { + ListenableFuture keyspaceSet = Futures.transformAsync(sessionInitialized, new AsyncFunction() { @Override - public ListenableFuture apply(Session session) throws Exception { + public ListenableFuture apply(Session session) { return session.executeAsync(useQuery); } }); - ListenableFuture withErrorHandling = Futures.withFallback(keyspaceSet, new FutureFallback() { + ListenableFuture withErrorHandling = Futures.catchingAsync(keyspaceSet, Throwable.class, new AsyncFunction() { @Override - public ListenableFuture create(Throwable t) throws Exception { + public ListenableFuture apply(Throwable t) throws Exception { session.closeAsync(); if (t instanceof SyntaxError) { // Give a more explicit message, because it's probably caused by a bad keyspace name @@ -2311,7 +2308,7 @@ public void run() { rs.getExecutionInfo().setSchemaInAgreement(finalSchemaInAgreement); future.setResult(rs); } - }, MoreExecutors.sameThreadExecutor()); + }, MoreExecutors.newDirectExecutorService()); } catch (Exception e) { logger.warn("Error while waiting for schema agreement", e); diff --git a/driver-core/src/main/java/com/datastax/driver/core/Connection.java b/driver-core/src/main/java/com/datastax/driver/core/Connection.java index 20259261444..8b9053a7b54 100644 --- a/driver-core/src/main/java/com/datastax/driver/core/Connection.java +++ b/driver-core/src/main/java/com/datastax/driver/core/Connection.java @@ -171,13 +171,13 @@ public void operationComplete(ChannelFuture future) throws Exception { Executor initExecutor = factory.manager.configuration.getPoolingOptions().getInitializationExecutor(); - ListenableFuture initializeTransportFuture = Futures.transform(channelReadyFuture, + ListenableFuture initializeTransportFuture = Futures.transformAsync(channelReadyFuture, onChannelReady(protocolVersion, initExecutor), initExecutor); // Fallback on initializeTransportFuture so we can properly propagate specific exceptions. - ListenableFuture initFuture = Futures.withFallback(initializeTransportFuture, new FutureFallback() { + ListenableFuture initFuture = Futures.catchingAsync(initializeTransportFuture, Throwable.class, new AsyncFunction() { @Override - public ListenableFuture create(Throwable t) throws Exception { + public ListenableFuture apply(Throwable t) throws Exception { SettableFuture future = SettableFuture.create(); // Make sure the connection gets properly closed. if (t instanceof ClusterNameMismatchException || t instanceof UnsupportedProtocolVersionException) { @@ -225,7 +225,7 @@ private AsyncFunction onChannelReady(final ProtocolVersion protocolV public ListenableFuture apply(Void input) throws Exception { ProtocolOptions.Compression compression = factory.configuration.getProtocolOptions().getCompression(); Future startupResponseFuture = write(new Requests.Startup(compression)); - return Futures.transform(startupResponseFuture, + return Futures.transformAsync(startupResponseFuture, onStartupResponse(protocolVersion, initExecutor), initExecutor); } }; @@ -285,7 +285,7 @@ private ListenableFuture checkClusterName(ProtocolVersion protocolVersion, DefaultResultSetFuture clusterNameFuture = new DefaultResultSetFuture(null, protocolVersion, new Requests.Query("select cluster_name from system.local")); try { write(clusterNameFuture); - return Futures.transform(clusterNameFuture, + return Futures.transformAsync(clusterNameFuture, new AsyncFunction() { @Override public ListenableFuture apply(ResultSet rs) throws Exception { @@ -311,7 +311,7 @@ private ListenableFuture authenticateV1(Authenticator authenticator, final Requests.Credentials creds = new Requests.Credentials(((ProtocolV1Authenticator) authenticator).getCredentials()); try { Future authResponseFuture = write(creds); - return Futures.transform(authResponseFuture, + return Futures.transformAsync(authResponseFuture, new AsyncFunction() { @Override public ListenableFuture apply(Message.Response authResponse) throws Exception { @@ -337,7 +337,7 @@ private ListenableFuture authenticateV2(final Authenticator authenticator, try { Future authResponseFuture = write(new Requests.AuthResponse(initialResponse)); - return Futures.transform(authResponseFuture, onV2AuthResponse(authenticator, protocolVersion, executor), executor); + return Futures.transformAsync(authResponseFuture, onV2AuthResponse(authenticator, protocolVersion, executor), executor); } catch (Exception e) { return Futures.immediateFailedFuture(e); } @@ -363,7 +363,7 @@ public ListenableFuture apply(Message.Response authResponse) throws Except // Otherwise, send the challenge response back to the server logger.trace("{} Sending Auth response to challenge", this); Future nextResponseFuture = write(new Requests.AuthResponse(responseToServer)); - return Futures.transform(nextResponseFuture, onV2AuthResponse(authenticator, protocolVersion, executor), executor); + return Futures.transformAsync(nextResponseFuture, onV2AuthResponse(authenticator, protocolVersion, executor), executor); } case ERROR: // This is not very nice, but we're trying to identify if we @@ -472,7 +472,7 @@ ListenableFuture setKeyspaceAsync(final String keyspace) throws Connection logger.trace("{} Setting keyspace {}", this, keyspace); // Note: we quote the keyspace below, because the name is the one coming from Cassandra, so it's in the right case already Future future = write(new Requests.Query("USE \"" + keyspace + '"')); - return Futures.transform(future, new AsyncFunction() { + return Futures.transformAsync(future, new AsyncFunction() { @Override public ListenableFuture apply(Message.Response response) throws Exception { if (response instanceof SetKeyspace) { diff --git a/driver-core/src/main/java/com/datastax/driver/core/HostConnectionPool.java b/driver-core/src/main/java/com/datastax/driver/core/HostConnectionPool.java index 6d3ba6fa7d3..74da3777385 100644 --- a/driver-core/src/main/java/com/datastax/driver/core/HostConnectionPool.java +++ b/driver-core/src/main/java/com/datastax/driver/core/HostConnectionPool.java @@ -168,9 +168,9 @@ public void onFailure(Throwable t) { } private ListenableFuture handleErrors(ListenableFuture connectionInitFuture, Executor executor) { - return Futures.withFallback(connectionInitFuture, new FutureFallback() { + return Futures.catchingAsync(connectionInitFuture, Throwable.class, new AsyncFunction() { @Override - public ListenableFuture create(Throwable t) throws Exception { + public ListenableFuture apply(Throwable t) throws Exception { // Propagate these exceptions because they mean no connection will ever succeed. They will be handled // accordingly in SessionManager#maybeAddPool. Throwables.propagateIfInstanceOf(t, ClusterNameMismatchException.class); @@ -644,7 +644,7 @@ public void run() { if (connection.state.compareAndSet(OPEN, GONE)) open.decrementAndGet(); } - }, MoreExecutors.sameThreadExecutor()); + }, MoreExecutors.newDirectExecutorService()); futures.add(future); } diff --git a/driver-core/src/main/java/com/datastax/driver/core/PoolingOptions.java b/driver-core/src/main/java/com/datastax/driver/core/PoolingOptions.java index e3c9589078a..e68d2d50979 100644 --- a/driver-core/src/main/java/com/datastax/driver/core/PoolingOptions.java +++ b/driver-core/src/main/java/com/datastax/driver/core/PoolingOptions.java @@ -137,7 +137,7 @@ public class PoolingOptions { */ public static final int DEFAULT_HEARTBEAT_INTERVAL_SECONDS = 30; - private static final Executor DEFAULT_INITIALIZATION_EXECUTOR = MoreExecutors.sameThreadExecutor(); + private static final Executor DEFAULT_INITIALIZATION_EXECUTOR = MoreExecutors.directExecutor(); private volatile Cluster.Manager manager; private volatile ProtocolVersion protocolVersion; diff --git a/driver-core/src/main/java/com/datastax/driver/core/SessionManager.java b/driver-core/src/main/java/com/datastax/driver/core/SessionManager.java index 332d87e143c..1a4577cfb28 100644 --- a/driver-core/src/main/java/com/datastax/driver/core/SessionManager.java +++ b/driver-core/src/main/java/com/datastax/driver/core/SessionManager.java @@ -91,7 +91,7 @@ public ListenableFuture initAsync() { Collection hosts = cluster.getMetadata().allHosts(); ListenableFuture allPoolsCreatedFuture = createPools(hosts); - ListenableFuture allPoolsUpdatedFuture = Futures.transform(allPoolsCreatedFuture, + ListenableFuture allPoolsUpdatedFuture = Futures.transformAsync(allPoolsCreatedFuture, new AsyncFunction() { @Override @SuppressWarnings("unchecked") @@ -197,7 +197,7 @@ public Session.State getState() { } private ListenableFuture toPreparedStatement(final String query, final Connection.Future future) { - return Futures.transform(future, new AsyncFunction() { + return Futures.transformAsync(future, new AsyncFunction() { @Override public ListenableFuture apply(Response response) { switch (response.type) { @@ -437,7 +437,7 @@ ListenableFuture updateCreatedPools() { // Wait pool creation before removing, so we don't lose connectivity ListenableFuture allPoolsCreatedFuture = Futures.successfulAsList(poolCreatedFutures); - return Futures.transform(allPoolsCreatedFuture, new AsyncFunction>() { + return Futures.transformAsync(allPoolsCreatedFuture, new AsyncFunction>() { @Override public ListenableFuture> apply(Object input) throws Exception { List> poolRemovedFuture = Lists.newArrayListWithCapacity(toRemove.size()); diff --git a/driver-core/src/main/java/com/datastax/driver/core/TypeCodec.java b/driver-core/src/main/java/com/datastax/driver/core/TypeCodec.java index c906bb49f9b..cb991d13269 100644 --- a/driver-core/src/main/java/com/datastax/driver/core/TypeCodec.java +++ b/driver-core/src/main/java/com/datastax/driver/core/TypeCodec.java @@ -19,6 +19,7 @@ import com.datastax.driver.core.utils.Bytes; import com.google.common.reflect.TypeToken; +import java.lang.reflect.Type; import java.math.BigDecimal; import java.math.BigInteger; import java.net.InetAddress; @@ -608,7 +609,7 @@ public boolean accepts(DataType cqlType) { * Implementation notes: *
    *
  1. The default implementation is covariant with respect to the passed - * argument (through the usage of {@link TypeToken#isAssignableFrom(TypeToken)} + * argument (through the usage of {@link TypeToken#isSupertypeOf(Type)} * and it's strongly recommended not to modify this behavior. * This means that, by default, a codec will accept * any subtype of the Java type that it has been created for.
  2. @@ -628,7 +629,7 @@ public boolean accepts(DataType cqlType) { */ public boolean accepts(Object value) { checkNotNull(value, "Parameter value cannot be null"); - return this.javaType.isAssignableFrom(TypeToken.of(value.getClass())); + return this.javaType.isSupertypeOf(TypeToken.of(value.getClass())); } @Override diff --git a/driver-core/src/main/java/com/datastax/driver/core/policies/Policies.java b/driver-core/src/main/java/com/datastax/driver/core/policies/Policies.java index 943eb454781..b95f0b749d7 100644 --- a/driver-core/src/main/java/com/datastax/driver/core/policies/Policies.java +++ b/driver-core/src/main/java/com/datastax/driver/core/policies/Policies.java @@ -17,6 +17,7 @@ import com.datastax.driver.core.AtomicMonotonicTimestampGenerator; import com.datastax.driver.core.TimestampGenerator; +import com.google.common.base.MoreObjects; import com.google.common.base.Objects; /** @@ -281,11 +282,11 @@ public Builder withSpeculativeExecutionPolicy(SpeculativeExecutionPolicy specula public Policies build() { return new Policies( loadBalancingPolicy == null ? Policies.defaultLoadBalancingPolicy() : loadBalancingPolicy, - Objects.firstNonNull(reconnectionPolicy, Policies.defaultReconnectionPolicy()), - Objects.firstNonNull(retryPolicy, Policies.defaultRetryPolicy()), - Objects.firstNonNull(addressTranslator, Policies.defaultAddressTranslator()), - Objects.firstNonNull(timestampGenerator, Policies.defaultTimestampGenerator()), - Objects.firstNonNull(speculativeExecutionPolicy, Policies.defaultSpeculativeExecutionPolicy())); + MoreObjects.firstNonNull(reconnectionPolicy, Policies.defaultReconnectionPolicy()), + MoreObjects.firstNonNull(retryPolicy, Policies.defaultRetryPolicy()), + MoreObjects.firstNonNull(addressTranslator, Policies.defaultAddressTranslator()), + MoreObjects.firstNonNull(timestampGenerator, Policies.defaultTimestampGenerator()), + MoreObjects.firstNonNull(speculativeExecutionPolicy, Policies.defaultSpeculativeExecutionPolicy())); } } } diff --git a/driver-core/src/test/java/com/datastax/driver/core/AsyncQueryTest.java b/driver-core/src/test/java/com/datastax/driver/core/AsyncQueryTest.java index 69f25ae5fb1..d72c5d6c16a 100644 --- a/driver-core/src/test/java/com/datastax/driver/core/AsyncQueryTest.java +++ b/driver-core/src/test/java/com/datastax/driver/core/AsyncQueryTest.java @@ -94,7 +94,7 @@ public void should_init_cluster_and_session_if_needed() throws Exception { @Test(groups = "short", dataProvider = "keyspace", enabled = false, description = "disabled because the blocking USE call in the current pool implementation makes it deadlock") public void should_chain_query_on_async_session_init_with_same_executor(String keyspace) throws Exception { - ListenableFuture resultFuture = connectAndQuery(keyspace, MoreExecutors.sameThreadExecutor()); + ListenableFuture resultFuture = connectAndQuery(keyspace, MoreExecutors.directExecutor()); Integer result = Uninterruptibles.getUninterruptibly(resultFuture); assertThat(result).isEqualTo(1); @@ -114,7 +114,7 @@ public void should_chain_query_on_async_session_init_with_different_executor(Str @Test(groups = "short") public void should_propagate_error_to_chained_query_if_session_init_fails() throws Exception { - ListenableFuture resultFuture = connectAndQuery("wrong_keyspace", MoreExecutors.sameThreadExecutor()); + ListenableFuture resultFuture = connectAndQuery("wrong_keyspace", MoreExecutors.directExecutor()); try { Uninterruptibles.getUninterruptibly(resultFuture); @@ -159,7 +159,7 @@ public Thread apply(ResultSet input) { private ListenableFuture connectAndQuery(String keyspace, Executor executor) { ListenableFuture sessionFuture = cluster().connectAsync(keyspace); - ListenableFuture queryFuture = Futures.transform(sessionFuture, new AsyncFunction() { + ListenableFuture queryFuture = Futures.transformAsync(sessionFuture, new AsyncFunction() { @Override public ListenableFuture apply(Session session) throws Exception { return session.executeAsync("select v from foo where k = 1"); diff --git a/driver-core/src/test/java/com/datastax/driver/core/AsyncResultSetTest.java b/driver-core/src/test/java/com/datastax/driver/core/AsyncResultSetTest.java index 9496e4ab860..fac8dd280d9 100644 --- a/driver-core/src/test/java/com/datastax/driver/core/AsyncResultSetTest.java +++ b/driver-core/src/test/java/com/datastax/driver/core/AsyncResultSetTest.java @@ -58,7 +58,7 @@ private void should_iterate_result_set_asynchronously(int totalCount, int fetchS Statement statement = new SimpleStatement("select * from ints").setFetchSize(fetchSize); ResultsAccumulator results = new ResultsAccumulator(); - ListenableFuture future = Futures.transform( + ListenableFuture future = Futures.transformAsync( session().executeAsync(statement), results); @@ -85,7 +85,7 @@ public ListenableFuture apply(ResultSet rs) throws Exception { if (wasLastPage) return Futures.immediateFuture(rs); else - return Futures.transform(rs.fetchMoreResults(), this); + return Futures.transformAsync(rs.fetchMoreResults(), this); } } } diff --git a/driver-core/src/test/java/com/datastax/driver/core/ConnectionReleaseTest.java b/driver-core/src/test/java/com/datastax/driver/core/ConnectionReleaseTest.java index 683ff80c8f9..8ff64aac7c4 100644 --- a/driver-core/src/test/java/com/datastax/driver/core/ConnectionReleaseTest.java +++ b/driver-core/src/test/java/com/datastax/driver/core/ConnectionReleaseTest.java @@ -98,7 +98,7 @@ public void should_release_connection_before_completing_future() throws Exceptio mockFutures.add(session.executeAsync("mock query")); - ListenableFuture future = Futures.transform(session.executeAsync("select c from test1 where k=1"), + ListenableFuture future = Futures.transformAsync(session.executeAsync("select c from test1 where k=1"), new AsyncFunction() { @Override public ListenableFuture apply(ResultSet result) { diff --git a/driver-core/src/test/java/com/datastax/driver/core/LoadBalancingPolicyBootstrapTest.java b/driver-core/src/test/java/com/datastax/driver/core/LoadBalancingPolicyBootstrapTest.java index fce2d68a19d..fa51d7b9e15 100644 --- a/driver-core/src/test/java/com/datastax/driver/core/LoadBalancingPolicyBootstrapTest.java +++ b/driver-core/src/test/java/com/datastax/driver/core/LoadBalancingPolicyBootstrapTest.java @@ -18,6 +18,7 @@ import com.datastax.driver.core.policies.DelegatingLoadBalancingPolicy; import com.datastax.driver.core.policies.LoadBalancingPolicy; import com.datastax.driver.core.policies.RoundRobinPolicy; +import com.google.common.base.MoreObjects; import com.google.common.base.Objects; import com.google.common.collect.Lists; import org.slf4j.Logger; @@ -153,7 +154,7 @@ public int hashCode() { @Override public String toString() { - return Objects.toStringHelper(this).add("action", action).add("host", host).toString(); + return MoreObjects.toStringHelper(this).add("action", action).add("host", host).toString(); } } diff --git a/driver-core/src/test/java/com/datastax/driver/core/policies/LimitingLoadBalancingPolicy.java b/driver-core/src/test/java/com/datastax/driver/core/policies/LimitingLoadBalancingPolicy.java index 8628257cfc7..ed81decf83e 100644 --- a/driver-core/src/test/java/com/datastax/driver/core/policies/LimitingLoadBalancingPolicy.java +++ b/driver-core/src/test/java/com/datastax/driver/core/policies/LimitingLoadBalancingPolicy.java @@ -40,8 +40,8 @@ public class LimitingLoadBalancingPolicy extends DelegatingLoadBalancingPolicy { private final int maxHosts; private final int threshold; - private final Set liveHosts = Sets.newSetFromMap(new ConcurrentHashMap()); - private final Set chosenHosts = Sets.newSetFromMap(new ConcurrentHashMap()); + private final Set liveHosts = Collections.newSetFromMap(new ConcurrentHashMap()); + private final Set chosenHosts = Collections.newSetFromMap(new ConcurrentHashMap()); private final Lock updateLock = new ReentrantLock(); private volatile Cluster cluster; diff --git a/driver-mapping/src/main/java/com/datastax/driver/mapping/Mapper.java b/driver-mapping/src/main/java/com/datastax/driver/mapping/Mapper.java index 372767f792f..dd8f804403b 100644 --- a/driver-mapping/src/main/java/com/datastax/driver/mapping/Mapper.java +++ b/driver-mapping/src/main/java/com/datastax/driver/mapping/Mapper.java @@ -321,7 +321,7 @@ public ListenableFuture saveAsync(T entity, Option... options) { } private ListenableFuture submitVoidQueryAsync(ListenableFuture bsFuture) { - ListenableFuture rsFuture = Futures.transform(bsFuture, new AsyncFunction() { + ListenableFuture rsFuture = Futures.transformAsync(bsFuture, new AsyncFunction() { @Override public ListenableFuture apply(BoundStatement bs) throws Exception { return session().executeAsync(bs); @@ -446,7 +446,7 @@ public T get(Object... objects) { */ public ListenableFuture getAsync(final Object... objects) { ListenableFuture bsFuture = getQueryAsync(objects); - ListenableFuture rsFuture = Futures.transform(bsFuture, new AsyncFunction() { + ListenableFuture rsFuture = Futures.transformAsync(bsFuture, new AsyncFunction() { @Override public ListenableFuture apply(BoundStatement bs) throws Exception { return session().executeAsync(bs); diff --git a/driver-mapping/src/test/java/com/datastax/driver/mapping/MapperAsyncResultTest.java b/driver-mapping/src/test/java/com/datastax/driver/mapping/MapperAsyncResultTest.java index feb197764a0..d3b995a6f0e 100644 --- a/driver-mapping/src/test/java/com/datastax/driver/mapping/MapperAsyncResultTest.java +++ b/driver-mapping/src/test/java/com/datastax/driver/mapping/MapperAsyncResultTest.java @@ -94,7 +94,7 @@ private void should_iterate_result_set_asynchronously(int totalCount, int fetchS Mapper mapper = new MappingManager(session()).mapper(User.class); ResultsAccumulator accumulator = new ResultsAccumulator(); ListenableFuture> results = mapper.mapAsync(session().executeAsync(statement)); - ListenableFuture> future = Futures.transform( + ListenableFuture> future = Futures.transformAsync( results, accumulator); Futures.getUnchecked(future); @@ -120,7 +120,7 @@ public ListenableFuture> apply(Result users) throws Exception if (wasLastPage) return Futures.immediateFuture(users); else - return Futures.transform(users.fetchMoreResults(), this); + return Futures.transformAsync(users.fetchMoreResults(), this); } } } diff --git a/driver-mapping/src/test/java/com/datastax/driver/mapping/MapperUDTTest.java b/driver-mapping/src/test/java/com/datastax/driver/mapping/MapperUDTTest.java index 487c0fa8076..c9b6b40bf61 100644 --- a/driver-mapping/src/test/java/com/datastax/driver/mapping/MapperUDTTest.java +++ b/driver-mapping/src/test/java/com/datastax/driver/mapping/MapperUDTTest.java @@ -21,6 +21,7 @@ import com.datastax.driver.core.utils.CassandraVersion; import com.datastax.driver.core.utils.UUIDs; import com.datastax.driver.mapping.annotations.*; +import com.google.common.base.MoreObjects; import com.google.common.base.Objects; import com.google.common.collect.Maps; import org.assertj.core.data.MapEntry; @@ -136,7 +137,7 @@ public int hashCode() { @Override public String toString() { - return Objects.toStringHelper(User.class) + return MoreObjects.toStringHelper(User.class) .add("userId", userId) .add("name", name) .add("mainAddress", mainAddress) @@ -226,7 +227,7 @@ public int hashCode() { @Override public String toString() { - return Objects.toStringHelper(Address.class) + return MoreObjects.toStringHelper(Address.class) .add("street", street) .add("city", city) .add("zip", zipCode) diff --git a/driver-tests/osgi/src/test/java/com/datastax/driver/osgi/BundleOptions.java b/driver-tests/osgi/src/test/java/com/datastax/driver/osgi/BundleOptions.java index 532b7a2cc53..4fce9aa69aa 100644 --- a/driver-tests/osgi/src/test/java/com/datastax/driver/osgi/BundleOptions.java +++ b/driver-tests/osgi/src/test/java/com/datastax/driver/osgi/BundleOptions.java @@ -50,7 +50,7 @@ public static UrlProvisionOption extrasBundle() { } public static MavenArtifactProvisionOption guavaBundle() { - return mavenBundle("com.google.guava", "guava", "16.0.1"); + return mavenBundle("com.google.guava", "guava", "20.0"); } public static CompositeOption lz4Bundle() { diff --git a/driver-tests/osgi/src/test/java/com/datastax/driver/osgi/MailboxServiceGuava18IT.java b/driver-tests/osgi/src/test/java/com/datastax/driver/osgi/MailboxServiceGuava18IT.java deleted file mode 100644 index 89deef732d1..00000000000 --- a/driver-tests/osgi/src/test/java/com/datastax/driver/osgi/MailboxServiceGuava18IT.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (C) 2012-2015 DataStax Inc. - * - * Licensed 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 com.datastax.driver.osgi; - -import com.datastax.driver.osgi.api.MailboxException; -import org.ops4j.pax.exam.Configuration; -import org.ops4j.pax.exam.Option; -import org.ops4j.pax.exam.testng.listener.PaxExam; -import org.testng.annotations.Listeners; -import org.testng.annotations.Test; - -import static com.datastax.driver.osgi.BundleOptions.*; -import static org.ops4j.pax.exam.CoreOptions.options; - -@Listeners({CCMBridgeListener.class, PaxExam.class}) -public class MailboxServiceGuava18IT extends MailboxServiceTests { - - @Configuration - public Option[] guava18Config() { - return options( - defaultOptions(), - nettyBundles(), - guavaBundle().version("18.0"), - driverBundle(), - extrasBundle(), - mappingBundle(), - mailboxBundle() - ); - } - - /** - * Exercises a 'mailbox' service provided by an OSGi bundle that depends on the driver with - * Guava 18 explicitly enforced. - * - * @test_category packaging - * @expected_result Can create, retrieve and delete data using the mailbox service. - * @jira_ticket JAVA-620 - * @since 2.0.10, 2.1.5 - */ - @Test(groups = "short") - public void test_guava_18() throws MailboxException { - checkService(); - } -} diff --git a/driver-tests/osgi/src/test/java/com/datastax/driver/osgi/MailboxServiceGuava17IT.java b/driver-tests/osgi/src/test/java/com/datastax/driver/osgi/MailboxServiceGuava20IT.java similarity index 87% rename from driver-tests/osgi/src/test/java/com/datastax/driver/osgi/MailboxServiceGuava17IT.java rename to driver-tests/osgi/src/test/java/com/datastax/driver/osgi/MailboxServiceGuava20IT.java index 78d8789e548..12b84159cc9 100644 --- a/driver-tests/osgi/src/test/java/com/datastax/driver/osgi/MailboxServiceGuava17IT.java +++ b/driver-tests/osgi/src/test/java/com/datastax/driver/osgi/MailboxServiceGuava20IT.java @@ -26,24 +26,24 @@ import static org.ops4j.pax.exam.CoreOptions.options; @Listeners({CCMBridgeListener.class, PaxExam.class}) -public class MailboxServiceGuava17IT extends MailboxServiceTests { +public class MailboxServiceGuava20IT extends MailboxServiceTests { @Configuration - public Option[] guava17Config() { + public Option[] guava19Config() { return options( defaultOptions(), nettyBundles(), - guavaBundle().version("17.0"), + guavaBundle().version("20.0"), driverBundle(), - mappingBundle(), extrasBundle(), + mappingBundle(), mailboxBundle() ); } /** * Exercises a 'mailbox' service provided by an OSGi bundle that depends on the driver with - * Guava 17 explicitly enforced. + * Guava 20 explicitly enforced. * * @test_category packaging * @expected_result Can create, retrieve and delete data using the mailbox service. @@ -51,7 +51,7 @@ public Option[] guava17Config() { * @since 2.0.10, 2.1.5 */ @Test(groups = "short") - public void test_guava_17() throws MailboxException { + public void test_guava_20() throws MailboxException { checkService(); } } diff --git a/driver-tests/osgi/src/test/java/com/datastax/driver/osgi/MailboxServiceTests.java b/driver-tests/osgi/src/test/java/com/datastax/driver/osgi/MailboxServiceTests.java index fea01f0ba3f..bb8beb6f2bf 100644 --- a/driver-tests/osgi/src/test/java/com/datastax/driver/osgi/MailboxServiceTests.java +++ b/driver-tests/osgi/src/test/java/com/datastax/driver/osgi/MailboxServiceTests.java @@ -48,11 +48,10 @@ public abstract class MailboxServiceTests { *

    * The following configurations are tried (defined via methods with the @Configuration annotation): *

      - *
    1. Default bundle (Driver with all of it's dependencies and Guava 16.0.1)
    2. - *
    3. Shaded bundle (Driver with netty shaded and Guava 16.0.1)
    4. - *
    5. With Guava 17
    6. - *
    7. With Guava 18
    8. + *
    9. Default bundle (Driver with all of it's dependencies and Guava 20.0)
    10. + *
    11. Shaded bundle (Driver with netty shaded and Guava 20.0)
    12. *
    13. With Guava 19
    14. + *
    15. With Guava 20
    16. *
    */ protected void checkService() throws MailboxException { diff --git a/pom.xml b/pom.xml index e060ff829ab..8961af897a7 100644 --- a/pom.xml +++ b/pom.xml @@ -50,7 +50,7 @@ 1.6 1.2.17 1.7.6 - 16.0.1 + 20.0 4.0.37.Final 3.1.2 1.1.2.6 @@ -242,7 +242,7 @@ https://docs.oracle.com/javase/8/docs/api/ - http://docs.guava-libraries.googlecode.com/git-history/v16.0.1/javadoc/ + http://docs.guava-libraries.googlecode.com/git-history/v20.0/javadoc/ http://netty.io/4.0/api/ http://www.joda.org/joda-time/apidocs/