Address removal of calculateMD5
Project: http://git-wip-us.apache.org/repos/asf/jclouds/repo Commit: http://git-wip-us.apache.org/repos/asf/jclouds/commit/c0d16e79 Tree: http://git-wip-us.apache.org/repos/asf/jclouds/tree/c0d16e79 Diff: http://git-wip-us.apache.org/repos/asf/jclouds/diff/c0d16e79 Branch: refs/heads/master Commit: c0d16e79f091efdb6c23d4e90a38013a6eddb7c3 Parents: 88a6a26 Author: Andrew Gaul <[email protected]> Authored: Sat Jun 7 21:39:21 2014 -0700 Committer: Andrew Gaul <[email protected]> Committed: Sat Jun 7 21:39:21 2014 -0700 ---------------------------------------------------------------------- .../java/org/jclouds/chef/internal/BaseChefApiLiveTest.java | 7 +++++-- .../ListCookbookVersionsInEnvironmentImplLiveTest.java | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/jclouds/blob/c0d16e79/apis/chef/src/test/java/org/jclouds/chef/internal/BaseChefApiLiveTest.java ---------------------------------------------------------------------- diff --git a/apis/chef/src/test/java/org/jclouds/chef/internal/BaseChefApiLiveTest.java b/apis/chef/src/test/java/org/jclouds/chef/internal/BaseChefApiLiveTest.java index bbc1473..2d04dcd 100644 --- a/apis/chef/src/test/java/org/jclouds/chef/internal/BaseChefApiLiveTest.java +++ b/apis/chef/src/test/java/org/jclouds/chef/internal/BaseChefApiLiveTest.java @@ -64,7 +64,9 @@ import org.testng.annotations.Test; import com.google.common.base.Predicate; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableSet; +import com.google.common.hash.Hashing; import com.google.common.io.Closeables; +import com.google.common.io.Files; import com.google.common.primitives.Bytes; /** @@ -84,11 +86,12 @@ public abstract class BaseChefApiLiveTest<A extends ChefApi> extends BaseChefLiv public void testCreateNewCookbook() throws Exception { // Define the file you want in the cookbook - FilePayload content = Payloads.newFilePayload(new File(System.getProperty("user.dir"), "pom.xml")); + File file = new File(System.getProperty("user.dir"), "pom.xml"); + FilePayload content = Payloads.newFilePayload(file); content.getContentMetadata().setContentType("application/x-binary"); // Get an md5 so that you can see if the server already has it or not - Payloads.calculateMD5(content); + content.getContentMetadata().setContentMD5(Files.asByteSource(file).hash(Hashing.md5()).asBytes()); // Note that java collections cannot effectively do equals or hashcodes on // byte arrays, so let's convert to a list of bytes. http://git-wip-us.apache.org/repos/asf/jclouds/blob/c0d16e79/apis/chef/src/test/java/org/jclouds/chef/strategy/internal/ListCookbookVersionsInEnvironmentImplLiveTest.java ---------------------------------------------------------------------- diff --git a/apis/chef/src/test/java/org/jclouds/chef/strategy/internal/ListCookbookVersionsInEnvironmentImplLiveTest.java b/apis/chef/src/test/java/org/jclouds/chef/strategy/internal/ListCookbookVersionsInEnvironmentImplLiveTest.java index d1786aa..76ecee8 100644 --- a/apis/chef/src/test/java/org/jclouds/chef/strategy/internal/ListCookbookVersionsInEnvironmentImplLiveTest.java +++ b/apis/chef/src/test/java/org/jclouds/chef/strategy/internal/ListCookbookVersionsInEnvironmentImplLiveTest.java @@ -41,6 +41,8 @@ import java.util.List; import com.google.common.base.Predicate; import com.google.common.collect.ImmutableSet; +import com.google.common.hash.Hashing; +import com.google.common.io.Files; import com.google.common.primitives.Bytes; /** @@ -94,11 +96,12 @@ public class ListCookbookVersionsInEnvironmentImplLiveTest extends BaseChefLiveT private FilePayload uploadContent(String fileName) throws Exception { // Define the file you want in the cookbook - FilePayload content = Payloads.newFilePayload(new File(System.getProperty("user.dir"), fileName)); + File file = new File(System.getProperty("user.dir"), fileName); + FilePayload content = Payloads.newFilePayload(file); content.getContentMetadata().setContentType("application/x-binary"); // Get an md5 so that you can see if the server already has it or not - Payloads.calculateMD5(content); + content.getContentMetadata().setContentMD5(Files.asByteSource(file).hash(Hashing.md5()).asBytes()); // Note that java collections cannot effectively do equals or hashcodes on // byte arrays, so let's convert to a list of bytes.
