diff --git a/src/main/java/synapticloop/b2/B2ApiClient.java b/src/main/java/synapticloop/b2/B2ApiClient.java index dd2692f..82e7925 100644 --- a/src/main/java/synapticloop/b2/B2ApiClient.java +++ b/src/main/java/synapticloop/b2/B2ApiClient.java @@ -54,7 +54,7 @@ import synapticloop.b2.response.B2GetUploadUrlResponse; import synapticloop.b2.response.B2HideFileResponse; import synapticloop.b2.response.B2ListFilesResponse; -import synapticloop.b2.util.Helper; +import synapticloop.b2.util.ChecksumHelper; /** * This is a wrapper class for the underlying calls to the request/response @@ -327,7 +327,7 @@ public B2FileResponse uploadFile(String bucketId, String fileName, HttpEntity en public B2FileResponse uploadFile(String bucketId, String fileName, File file, String mimeType, Map fileInfo) throws B2ApiException { B2GetUploadUrlResponse b2GetUploadUrlResponse = new B2GetUploadUrlRequest(client, b2AuthorizeAccountResponse, bucketId).getResponse(); return new B2UploadFileRequest(client, b2AuthorizeAccountResponse, b2GetUploadUrlResponse, fileName, file, - Helper.calculateSha1(file), mimeType, fileInfo).getResponse(); + ChecksumHelper.calculateSha1(file), mimeType, fileInfo).getResponse(); } /** @@ -347,7 +347,7 @@ public B2FileResponse uploadFile(String bucketId, String fileName, File file, St public B2FileResponse uploadFile(String bucketId, String fileName, File file, Map fileInfo) throws B2ApiException { B2GetUploadUrlResponse b2GetUploadUrlResponse = new B2GetUploadUrlRequest(client, b2AuthorizeAccountResponse, bucketId).getResponse(); return new B2UploadFileRequest(client, b2AuthorizeAccountResponse, b2GetUploadUrlResponse, fileName, file, - Helper.calculateSha1(file), fileInfo).getResponse(); + ChecksumHelper.calculateSha1(file), fileInfo).getResponse(); } /** @@ -369,7 +369,7 @@ public B2FileResponse uploadFile(String bucketId, String fileName, File file, Ma public B2FileResponse uploadFile(String bucketId, String fileName, File file, String mimeType) throws B2ApiException { B2GetUploadUrlResponse b2GetUploadUrlResponse = new B2GetUploadUrlRequest(client, b2AuthorizeAccountResponse, bucketId).getResponse(); return new B2UploadFileRequest(client, b2AuthorizeAccountResponse, b2GetUploadUrlResponse, fileName, file, - Helper.calculateSha1(file), mimeType).getResponse(); + ChecksumHelper.calculateSha1(file), mimeType).getResponse(); } /** @@ -388,7 +388,7 @@ public B2FileResponse uploadFile(String bucketId, String fileName, File file, St public B2FileResponse uploadFile(String bucketId, String fileName, File file) throws B2ApiException { B2GetUploadUrlResponse b2GetUploadUrlResponse = new B2GetUploadUrlRequest(client, b2AuthorizeAccountResponse, bucketId).getResponse(); return new B2UploadFileRequest(client, b2AuthorizeAccountResponse, b2GetUploadUrlResponse, fileName, - file, Helper.calculateSha1(file)).getResponse(); + file, ChecksumHelper.calculateSha1(file)).getResponse(); } diff --git a/src/test/java/synapticloop/b2/helper/B2TestHelper.java b/src/test/java/synapticloop/b2/helper/B2TestHelper.java index 4d0b1fc..5ed1fcd 100644 --- a/src/test/java/synapticloop/b2/helper/B2TestHelper.java +++ b/src/test/java/synapticloop/b2/helper/B2TestHelper.java @@ -1,28 +1,18 @@ package synapticloop.b2.helper; +import org.apache.http.impl.client.HttpClients; +import synapticloop.b2.BucketType; +import synapticloop.b2.exception.B2ApiException; +import synapticloop.b2.request.*; +import synapticloop.b2.response.*; +import synapticloop.b2.util.ChecksumHelper; + import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.util.Map; import java.util.UUID; -import org.apache.http.impl.client.HttpClients; - -import synapticloop.b2.BucketType; -import synapticloop.b2.exception.B2ApiException; -import synapticloop.b2.request.B2AuthorizeAccountRequest; -import synapticloop.b2.request.B2CreateBucketRequest; -import synapticloop.b2.request.B2DeleteBucketRequest; -import synapticloop.b2.request.B2DeleteFileVersionRequest; -import synapticloop.b2.request.B2GetUploadUrlRequest; -import synapticloop.b2.request.B2UploadFileRequest; -import synapticloop.b2.response.B2AuthorizeAccountResponse; -import synapticloop.b2.response.B2BucketResponse; -import synapticloop.b2.response.B2DeleteFileVersionResponse; -import synapticloop.b2.response.B2FileResponse; -import synapticloop.b2.response.B2GetUploadUrlResponse; -import synapticloop.b2.util.Helper; - public class B2TestHelper { public static final String B2_BUCKET_PREFIX = "b2api-test-"; public static final String B2_ACCOUNT_ID = "B2_ACCOUNT_ID"; @@ -131,7 +121,7 @@ public static B2FileResponse uploadTemporaryFileToBucket(String bucketId) throws throw new B2ApiException("Could not create temporary file", ioex); } return(new B2UploadFileRequest(HttpClients.createDefault(), getB2AuthorizeAccountResponse(), - b2GetUploadUrlResponse, file.getName(), file, Helper.calculateSha1(file)).getResponse()); + b2GetUploadUrlResponse, file.getName(), file, ChecksumHelper.calculateSha1(file)).getResponse()); } // public static B2FileResponse uploadTemporaryFileToBucketWithPath(String bucketId) throws B2Exception { @@ -173,7 +163,7 @@ public static B2FileResponse uploadTemporaryFileToBucket(String bucketId, Map