Repository: jclouds Updated Branches: refs/heads/master 22a602833 -> 644fbf205
Prefer ByteStreams over ByteArrayOutputStream Project: http://git-wip-us.apache.org/repos/asf/jclouds/repo Commit: http://git-wip-us.apache.org/repos/asf/jclouds/commit/644fbf20 Tree: http://git-wip-us.apache.org/repos/asf/jclouds/tree/644fbf20 Diff: http://git-wip-us.apache.org/repos/asf/jclouds/diff/644fbf20 Branch: refs/heads/master Commit: 644fbf2052c267f8d1b231493aa3eaf28a83a495 Parents: 22a6028 Author: Andrew Gaul <[email protected]> Authored: Thu May 22 00:38:36 2014 -0700 Committer: Andrew Gaul <[email protected]> Committed: Thu May 22 00:40:21 2014 -0700 ---------------------------------------------------------------------- .../test/java/org/jclouds/http/internal/WireLiveTest.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/jclouds/blob/644fbf20/core/src/test/java/org/jclouds/http/internal/WireLiveTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/jclouds/http/internal/WireLiveTest.java b/core/src/test/java/org/jclouds/http/internal/WireLiveTest.java index b03daa2..8415378 100644 --- a/core/src/test/java/org/jclouds/http/internal/WireLiveTest.java +++ b/core/src/test/java/org/jclouds/http/internal/WireLiveTest.java @@ -19,12 +19,10 @@ package org.jclouds.http.internal; import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.hash.Hashing.md5; import static com.google.common.io.BaseEncoding.base16; -import static com.google.common.io.ByteStreams.copy; import static java.util.concurrent.Executors.newCachedThreadPool; import static org.jclouds.io.ByteSources.asByteSource; import static org.testng.Assert.assertEquals; -import java.io.ByteArrayOutputStream; import java.io.InputStream; import java.net.URL; import java.net.URLConnection; @@ -33,6 +31,8 @@ import java.util.concurrent.Callable; import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; +import com.google.common.io.ByteStreams; + import org.jclouds.logging.Logger; import org.testng.annotations.Test; @@ -56,9 +56,7 @@ public class WireLiveTest { public Void call() throws Exception { HttpWire wire = setUp(); InputStream in = wire.input(fromServer); - ByteArrayOutputStream out = new ByteArrayOutputStream();// TODO - copy(in, out); - byte[] compare = md5().hashBytes(out.toByteArray()).asBytes(); + byte[] compare = md5().hashBytes(ByteStreams.toByteArray(in)).asBytes(); Thread.sleep(100); assertEquals(base16().lowerCase().encode(compare), checkNotNull(sysHttpStreamMd5, sysHttpStreamMd5)); assertEquals(((BufferLogger) wire.getWireLog()).buff.toString().getBytes().length, 3331484);
