diff --git a/apis/sqs/src/main/java/org/jclouds/sqs/xml/MessageHandler.java b/apis/sqs/src/main/java/org/jclouds/sqs/xml/MessageHandler.java index e02dd497de..b5c2c390bf 100644 --- a/apis/sqs/src/main/java/org/jclouds/sqs/xml/MessageHandler.java +++ b/apis/sqs/src/main/java/org/jclouds/sqs/xml/MessageHandler.java @@ -22,7 +22,7 @@ import static org.jclouds.util.SaxUtils.currentOrNull; import org.jclouds.http.functions.ParseSax; import org.jclouds.sqs.domain.Message; -import com.google.common.hash.HashCodes; +import com.google.common.hash.HashCode; /** * @see = 98); + assertTrue(watch.stop().elapsed(TimeUnit.MILLISECONDS) >= 98); } @@ -78,7 +78,7 @@ public class SQSErrorRetryHandlerTest { Stopwatch watch = new Stopwatch().start(); assertFalse(retry.shouldRetryRequestOnError(command, response, error)); assertEquals(command.getFailureCount(), 61); - assertTrue(watch.stop().elapsedTime(TimeUnit.MILLISECONDS) < 100); + assertTrue(watch.stop().elapsed(TimeUnit.MILLISECONDS) < 100); } HttpCommand createHttpCommandForFailureCount(final int failureCount) { diff --git a/apis/sqs/src/test/java/org/jclouds/sqs/parse/ReceiveMessageResponseTest.java b/apis/sqs/src/test/java/org/jclouds/sqs/parse/ReceiveMessageResponseTest.java index 94513d8b77..d075564ddb 100644 --- a/apis/sqs/src/test/java/org/jclouds/sqs/parse/ReceiveMessageResponseTest.java +++ b/apis/sqs/src/test/java/org/jclouds/sqs/parse/ReceiveMessageResponseTest.java @@ -28,7 +28,7 @@ import org.testng.annotations.Test; import com.google.common.collect.FluentIterable; import com.google.common.collect.ImmutableList; -import com.google.common.hash.HashCodes; +import com.google.common.hash.HashCode; /** * @author Adrian Cole @@ -56,7 +56,7 @@ public class ReceiveMessageResponseTest extends BaseHandlerTest { .id("5fea7756-0ea4-451a-a703-a558b933e274") .receiptHandle( "+eXJYhj5rDr9cAe/9BuheT5fysi9BoqtEZSkO7IazVbNHg60eCCINxLqaSVv2pFHrWeWNpZwbleSkWRbCtZaQGgpOx/3cWJZiNSG1KKlJX4IOwISFvb3FwByMx4w0lnINeXzcw2VcKQXNrCatO9gdIiVPvJC3SCKatYM/7YTidtjqc8igrtYW2E2mHlCy3NXPCeXxP4tSvyEwIxpDAmMT7IF0mWvTHS6+JBUtFUsrmi61oIHlESNrD1OjdB1QQw+kdvJ6VbsntbJNNYKw+YqdqWNpZkiGQ8y1z9OdHsr1+4=") - .md5(HashCodes.fromBytes(base16().lowerCase().decode("fafb00f5732ab283681e124bf8747ed1"))) + .md5(HashCode.fromBytes(base16().lowerCase().decode("fafb00f5732ab283681e124bf8747ed1"))) .body("This is a test message") .addAttribute("SenderId", "195004372649") .addAttribute("SentTimestamp", "1238099229000") diff --git a/apis/sqs/src/test/java/org/jclouds/sqs/parse/SendMessageBatchResponseTest.java b/apis/sqs/src/test/java/org/jclouds/sqs/parse/SendMessageBatchResponseTest.java index 663b21b927..57cdf25313 100644 --- a/apis/sqs/src/test/java/org/jclouds/sqs/parse/SendMessageBatchResponseTest.java +++ b/apis/sqs/src/test/java/org/jclouds/sqs/parse/SendMessageBatchResponseTest.java @@ -27,7 +27,7 @@ import org.jclouds.sqs.domain.MessageIdAndMD5; import org.jclouds.sqs.xml.SendMessageBatchResponseHandler; import org.testng.annotations.Test; -import com.google.common.hash.HashCodes; +import com.google.common.hash.HashCode; /** * @author Adrian Cole @@ -54,10 +54,10 @@ public class SendMessageBatchResponseTest extends BaseHandlerTest { . builder() .put("test_msg_001", MessageIdAndMD5.builder().id("0a5231c7-8bff-4955-be2e-8dc7c50a25fa") - .md5(HashCodes.fromBytes(base16().lowerCase().decode("0e024d309850c78cba5eabbeff7cae71"))).build()) + .md5(HashCode.fromBytes(base16().lowerCase().decode("0e024d309850c78cba5eabbeff7cae71"))).build()) .put("test_msg_002", MessageIdAndMD5.builder().id("15ee1ed3-87e7-40c1-bdaa-2e49968ea7e9") - .md5(HashCodes.fromBytes(base16().lowerCase().decode("7fb8146a82f95e0af155278f406862c2"))).build()) + .md5(HashCode.fromBytes(base16().lowerCase().decode("7fb8146a82f95e0af155278f406862c2"))).build()) .build(); } } diff --git a/apis/sqs/src/test/java/org/jclouds/sqs/parse/SendMessageResponseTest.java b/apis/sqs/src/test/java/org/jclouds/sqs/parse/SendMessageResponseTest.java index 2123e257d6..f95d1b6c8a 100644 --- a/apis/sqs/src/test/java/org/jclouds/sqs/parse/SendMessageResponseTest.java +++ b/apis/sqs/src/test/java/org/jclouds/sqs/parse/SendMessageResponseTest.java @@ -27,7 +27,7 @@ import org.jclouds.sqs.domain.MessageIdAndMD5; import org.jclouds.sqs.xml.RegexMessageIdAndMD5Handler; import org.testng.annotations.Test; -import com.google.common.hash.HashCodes; +import com.google.common.hash.HashCode; /** * @author Adrian Cole @@ -51,6 +51,6 @@ public class SendMessageResponseTest { public MessageIdAndMD5 expected() { return MessageIdAndMD5.builder().id("c332b2b0-b61f-42d3-8832-d03ebd89f68d") - .md5(HashCodes.fromBytes(base16().lowerCase().decode("e32aedf2b2b25355d04b1507055532e6"))).build(); + .md5(HashCode.fromBytes(base16().lowerCase().decode("e32aedf2b2b25355d04b1507055532e6"))).build(); } } diff --git a/compute/src/main/java/org/jclouds/compute/functions/PollNodeRunning.java b/compute/src/main/java/org/jclouds/compute/functions/PollNodeRunning.java index 3657183d73..b360b9f396 100644 --- a/compute/src/main/java/org/jclouds/compute/functions/PollNodeRunning.java +++ b/compute/src/main/java/org/jclouds/compute/functions/PollNodeRunning.java @@ -23,6 +23,7 @@ import static org.jclouds.compute.config.ComputeServiceProperties.TIMEOUT_NODE_R import static org.jclouds.compute.util.ComputeServiceUtils.formatStatus; import java.util.concurrent.atomic.AtomicReference; +import java.util.concurrent.TimeUnit; import javax.inject.Inject; import javax.inject.Named; @@ -63,7 +64,7 @@ public class PollNodeRunning implements Function, try { Stopwatch stopwatch = new Stopwatch().start(); if (!nodeRunning.apply(node)) { - long timeWaited = stopwatch.elapsedMillis(); + long timeWaited = stopwatch.elapsed(TimeUnit.MILLISECONDS); if (node.get() == null) { node.set(originalNode); throw new IllegalStateException(format("api response for node(%s) was null", originalId)); 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 4e35e5c8f0..2400598b90 100644 --- a/compute/src/test/java/org/jclouds/compute/internal/BaseComputeServiceLiveTest.java +++ b/compute/src/test/java/org/jclouds/compute/internal/BaseComputeServiceLiveTest.java @@ -660,7 +660,7 @@ public abstract class BaseComputeServiceLiveTest extends BaseComputeServiceConte ServiceStats stats = new ServiceStats(); Stopwatch watch = new Stopwatch().start(); ExecResponse exec = client.runScriptOnNode(node.getId(), process, runAsRoot(false).wrapInInitScript(false)); - stats.backgroundProcessMilliseconds = watch.elapsedTime(TimeUnit.MILLISECONDS); + stats.backgroundProcessMilliseconds = watch.elapsed(TimeUnit.MILLISECONDS); watch.reset().start(); HostAndPort socket = null; @@ -670,7 +670,7 @@ public abstract class BaseComputeServiceLiveTest extends BaseComputeServiceConte throw new NoSuchElementException(format("%s%n%s%s", e.getMessage(), exec.getOutput(), exec.getError())); } - stats.socketOpenMilliseconds = watch.elapsedTime(TimeUnit.MILLISECONDS); + stats.socketOpenMilliseconds = watch.elapsed(TimeUnit.MILLISECONDS); getAnonymousLogger().info(format("<< %s on node(%s)[%s] %s", processName, node.getId(), socket, stats)); return stats; @@ -702,7 +702,7 @@ public abstract class BaseComputeServiceLiveTest extends BaseComputeServiceConte Stopwatch watch = new Stopwatch().start(); NodeMetadata node = getOnlyElement(client.createNodesInGroup(group, 1, inboundPorts(22, 8080).blockOnPort(22, 300).userMetadata(userMetadata).tags(tags))); - long createSeconds = watch.elapsedTime(TimeUnit.SECONDS); + long createSeconds = watch.elapsed(TimeUnit.SECONDS); final String nodeId = node.getId(); @@ -716,7 +716,7 @@ public abstract class BaseComputeServiceLiveTest extends BaseComputeServiceConte client.runScriptOnNode(nodeId, JettyStatements.install(), nameTask("configure-jetty")); - long configureSeconds = watch.elapsedTime(TimeUnit.SECONDS); + long configureSeconds = watch.elapsed(TimeUnit.SECONDS); getAnonymousLogger().info( format( diff --git a/core/src/main/java/org/jclouds/logging/internal/Wire.java b/core/src/main/java/org/jclouds/logging/internal/Wire.java index 593a50da3a..485cd9252a 100644 --- a/core/src/main/java/org/jclouds/logging/internal/Wire.java +++ b/core/src/main/java/org/jclouds/logging/internal/Wire.java @@ -93,9 +93,9 @@ public abstract class Wire { long bytesRead = ByteStreams.copy(instream, out); if (bytesRead >= limit) logger.debug("over limit %d/%d: wrote temp file", bytesRead, limit); - wire(header, out.getSupplier().getInput()); + wire(header, out.asByteSource().getInput()); // we must call FileBackedOutputStream.reset to remove temporary file - return new FilterInputStream(out.getSupplier().getInput()) { + return new FilterInputStream(out.asByteSource().getInput()) { @Override public void close() throws IOException { super.close(); diff --git a/core/src/main/java/org/jclouds/rest/binders/BindAsHostPrefix.java b/core/src/main/java/org/jclouds/rest/binders/BindAsHostPrefix.java index 5f4fbfc77a..e1223fbc20 100644 --- a/core/src/main/java/org/jclouds/rest/binders/BindAsHostPrefix.java +++ b/core/src/main/java/org/jclouds/rest/binders/BindAsHostPrefix.java @@ -42,6 +42,6 @@ public class BindAsHostPrefix implements Binder { checkNotNull(payload, "hostprefix"); checkArgument(isValid(request.getEndpoint().getHost()), "this is only valid for hostnames: " + request); InternetDomainName name = from(request.getEndpoint().getHost()).child(payload.toString()); - return (R) request.toBuilder().endpoint(uriBuilder(request.getEndpoint()).host(name.name()).build()).build(); + return (R) request.toBuilder().endpoint(uriBuilder(request.getEndpoint()).host(name.toString()).build()).build(); } }