You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jclouds.apache.org by na...@apache.org on 2014/11/23 23:01:08 UTC

[27/50] [abbrv] jclouds git commit: Address removal of calculateMD5

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/1fe6bca6
Tree: http://git-wip-us.apache.org/repos/asf/jclouds/tree/1fe6bca6
Diff: http://git-wip-us.apache.org/repos/asf/jclouds/diff/1fe6bca6

Branch: refs/heads/1.8.x
Commit: 1fe6bca62da0c582d3dfea4e3ddf9a4139b082bc
Parents: 2982d99
Author: Andrew Gaul <ga...@apache.org>
Authored: Sat Jun 7 21:39:21 2014 -0700
Committer: Andrew Gaul <ga...@apache.org>
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/1fe6bca6/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/1fe6bca6/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.