diff --git a/Docs/API.md b/Docs/API.md
index f54999c18..d6ffc4e78 100644
--- a/Docs/API.md
+++ b/Docs/API.md
@@ -38,8 +38,8 @@ var s3Client = new MinioClient("s3.amazonaws.com",
| |
|---|
-|`public MinioClient(string endpoint, string accessKey = "", string secretKey = "", string region="", string sessionToken="")` |
-| Creates MinIO client object with given endpoint.AccessKey,secretKey, region and sessionToken are optional parameters,and can be omitted for anonymous access.
+|`public MinioClient(string endpoint, string accessKey = "", string secretKey = "", string region = "", string sessionToken="")` |
+| Creates MinIO client object with given endpoint.AccessKey, secretKey, region and sessionToken are optional parameters, and can be omitted for anonymous access.
The client object uses Http access by default. To use Https, chain method WithSSL() to client object to use secure transfer protocol |
@@ -86,11 +86,11 @@ MinioClient minioClient = new MinioClient("play.min.io:9000",
).WithSSL();
// 3. Initializing minio client with proxy
-IWebProxy proxy = new WebProxy("192.168.0.1",8000);
-MinioClient minioClient = new MinioClient("my-ip-address:9000","minio","minio123").WithSSL().WithProxy(proxy);
+IWebProxy proxy = new WebProxy("192.168.0.1", 8000);
+MinioClient minioClient = new MinioClient("my-ip-address:9000", "minio", "minio123").WithSSL().WithProxy(proxy);
// 4. Initializing minio client with temporary credentials
-MinioClient minioClient = new MinioClient("my-ip-address:9000","tempuserid","temppasswd",sessionToken:"sessionToken");
+MinioClient minioClient = new MinioClient("my-ip-address:9000", "tempuserid", "temppasswd", sessionToken:"sessionToken");
```
@@ -110,7 +110,7 @@ MinioClient s3Client = new MinioClient("s3.amazonaws.com:80",
## 2. Bucket operations
-### MakeBucketAsync(string bucketName, string location="us-east-1")
+### MakeBucketAsync(string bucketName, string location = "us-east-1")
`Task MakeBucketAsync(string bucketName, string location = "us-east-1", CancellationToken cancellationToken = default(CancellationToken))`
Creates a new bucket.
@@ -487,7 +487,7 @@ catch (MinioException e)
-### SetBucketNotificationAsync(string bucketName,BucketNotification notification)
+### SetBucketNotificationAsync(string bucketName, BucketNotification notification)
`Task SetBucketNotificationAsync(string bucketName, BucketNotification notification, CancellationToken cancellationToken = default(CancellationToken))`
Sets notification configuration for a given bucket
@@ -677,7 +677,7 @@ try
```
-### GetObjectAsync(string bucketName, string objectName, long offset,long length, Action callback, ServerSideEncryption sse)
+### GetObjectAsync(string bucketName, string objectName, long offset, long length, Action callback, ServerSideEncryption sse)
`Task GetObjectAsync(string bucketName, string objectName, long offset, long length, Action callback, ServerSideEncryption sse = null, CancellationToken cancellationToken = default(CancellationToken))`
@@ -779,9 +779,9 @@ catch (MinioException e)
}
```
-### PutObjectAsync(string bucketName, string objectName, Stream data, long size, string contentType,ServerSideEncryption sse)
+### PutObjectAsync(string bucketName, string objectName, Stream data, long size, string contentType, ServerSideEncryption sse)
-` Task PutObjectAsync(string bucketName, string objectName, Stream data, long size, string contentType,Dictionary metaData=null,ServerSideEncryption sse = null,CancellationToken cancellationToken = default(CancellationToken))`
+` Task PutObjectAsync(string bucketName, string objectName, Stream data, long size, string contentType, Dictionary metaData = null, ServerSideEncryption sse = null, CancellationToken cancellationToken = default(CancellationToken))`
Uploads contents from a stream to objectName.
@@ -833,7 +833,7 @@ try
"island.jpg",
filestream,
filestream.Length,
- "application/octet-stream",ssec);
+ "application/octet-stream", ssec);
Console.Out.WriteLine("island.jpg is uploaded successfully");
}
catch(MinioException e)
@@ -843,9 +843,9 @@ catch(MinioException e)
```
-### PutObjectAsync(string bucketName, string objectName, string filePath, string contentType=null,ServerSideEncryption sse)
+### PutObjectAsync(string bucketName, string objectName, string filePath, string contentType=null, ServerSideEncryption sse)
-` Task PutObjectAsync(string bucketName, string objectName, string filePath, string contentType=null,Dictionary metaData=null, ServerSideEncryption sse=null,CancellationToken cancellationToken = default(CancellationToken))`
+` Task PutObjectAsync(string bucketName, string objectName, string filePath, string contentType = null, Dictionary metaData = null, ServerSideEncryption sse = null, CancellationToken cancellationToken = default(CancellationToken))`
Uploads contents from a file to objectName.
@@ -883,7 +883,7 @@ The maximum size of a single object is limited to 5TB. putObject transparently u
```cs
try
{
- await minio.PutObjectAsync("mybucket", "island.jpg", "/mnt/photos/island.jpg",contentType: "application/octet-stream");
+ await minio.PutObjectAsync("mybucket", "island.jpg", "/mnt/photos/island.jpg", contentType: "application/octet-stream");
Console.Out.WriteLine("island.jpg is uploaded successfully");
}
catch(MinioException e)
@@ -892,9 +892,9 @@ catch(MinioException e)
}
```
-### StatObjectAsync(string bucketName, string objectName,ServerSideEncryption sse)
+### StatObjectAsync(string bucketName, string objectName, ServerSideEncryption sse)
-`Task StatObjectAsync(string bucketName, string objectName,ServerSideEncryption sse = null, CancellationToken cancellationToken = default(CancellationToken))`
+`Task StatObjectAsync(string bucketName, string objectName, ServerSideEncryption sse = null, CancellationToken cancellationToken = default(CancellationToken))`
Gets metadata of an object.
@@ -936,9 +936,9 @@ catch(MinioException e)
```
-### CopyObjectAsync(string bucketName, string objectName, string destBucketName, string destObjectName = null, CopyConditions copyConditions = null,Dictionary metadata = null, ServerSideEncryption sseSrc = null, ServerSideEncryption sseDest = null)
+### CopyObjectAsync(string bucketName, string objectName, string destBucketName, string destObjectName = null, CopyConditions copyConditions = null, Dictionary metadata = null, ServerSideEncryption sseSrc = null, ServerSideEncryption sseDest = null)
-*`Task CopyObjectAsync(string bucketName, string objectName, string destBucketName, string destObjectName = null, CopyConditions copyConditions = null, Dictionary metadata = null,ServerSideEncryption sseSrc = null, ServerSideEncryption sseDest = null,CancellationToken cancellationToken = default(CancellationToken))`*
+*`Task CopyObjectAsync(string bucketName, string objectName, string destBucketName, string destObjectName = null, CopyConditions copyConditions = null, Dictionary metadata = null, ServerSideEncryption sseSrc = null, ServerSideEncryption sseDest = null, CancellationToken cancellationToken = default(CancellationToken))`*
Copies content from objectName to destObjectName.
@@ -977,7 +977,7 @@ try
{
CopyConditions copyConditions = new CopyConditions();
copyConditions.setMatchETagNone("TestETag");
- ServerSideEncryption sseSrc,sseDst;
+ ServerSideEncryption sseSrc, sseDst;
// Uncomment to specify source and destination Server-side encryption options
/*
Aes aesEncryption = Aes.Create();
@@ -986,7 +986,7 @@ try
sseSrc = new SSEC(aesEncryption.Key);
sseDst = new SSES3();
*/
- await minioClient.CopyObjectAsync("mybucket", "island.jpg", "mydestbucket", "processed.png", copyConditions,sseSrc:sseSrc, sseDest:sseDst);
+ await minioClient.CopyObjectAsync("mybucket", "island.jpg", "mydestbucket", "processed.png", copyConditions, sseSrc:sseSrc, sseDest:sseDst);
Console.Out.WriteLine("island.jpg is uploaded successfully");
}
catch(MinioException e)
@@ -1130,8 +1130,8 @@ catch(MinioException e)
## 4. Presigned operations
-### PresignedGetObjectAsync(string bucketName, string objectName, int expiresInt, Dictionary reqParams = null, DateTime? reqDate = null);
-`Task PresignedGetObjectAsync(string bucketName, string objectName, int expiresInt, Dictionary reqParams = null, DateTime? reqDate = null)`
+### PresignedGetObjectAsync(string bucketName, string objectName, int expiresInt, Dictionary reqParams = null, DateTime? reqDate = null);
+`Task PresignedGetObjectAsync(string bucketName, string objectName, int expiresInt, Dictionary reqParams = null, DateTime? reqDate = null)`
Generates a presigned URL for HTTP GET operations. Browsers/Mobile clients may point to this URL to directly download objects even if the bucket is private. This presigned URL can have an associated expiration time in seconds after which it is no longer operational. The default expiry is set to 7 days.
@@ -1225,7 +1225,7 @@ __Parameters__
| Return Type | Exceptions |
|:--- |:--- |
-| ``Task>``: Map of strings to construct form-data. | Listed Exceptions: |
+| ``Task>``: Map of strings to construct form-data. | Listed Exceptions: |
| | ``InvalidBucketNameException`` : upon invalid bucket name |
| | ``ConnectionException`` : upon connection error |
| | ``NoSuchAlgorithmException`` : upon requested algorithm was not found during signature calculation. |
@@ -1262,7 +1262,7 @@ catch(MinioException e)
```
## Client Custom Settings
-### SetAppInfo(string appName, tring appVersion)
+### SetAppInfo(string appName, string appVersion)
Adds application details to User-Agent.
__Parameters__
diff --git a/FileUploader/FileUpload.cs b/FileUploader/FileUpload.cs
index 754b6268c..111b20d6e 100644
--- a/FileUploader/FileUpload.cs
+++ b/FileUploader/FileUpload.cs
@@ -38,7 +38,7 @@ static void Main(string[] args)
try
{
var minio = new MinioClient(endpoint, accessKey, secretKey).WithSSL();
- FileUpload.Run(minio).Wait();
+ Run(minio).Wait();
}
catch (Exception ex)
{
diff --git a/Minio.Examples/Cases/BucketExists.cs b/Minio.Examples/Cases/BucketExists.cs
index 69aa93515..6f5c43385 100644
--- a/Minio.Examples/Cases/BucketExists.cs
+++ b/Minio.Examples/Cases/BucketExists.cs
@@ -29,7 +29,7 @@ public async static Task Run(MinioClient minio,
{
Console.Out.WriteLine("Running example for API: BucketExistsAsync");
bool found = await minio.BucketExistsAsync(bucketName);
- Console.Out.WriteLine(((found == true) ? "Found" : "Couldn't find ") + "bucket " + bucketName);
+ Console.Out.WriteLine((found ? "Found" : "Couldn't find ") + "bucket " + bucketName);
Console.Out.WriteLine();
}
catch (Exception e)
diff --git a/Minio.Examples/Cases/CopyObject.cs b/Minio.Examples/Cases/CopyObject.cs
index 16d58bc4d..a54061873 100644
--- a/Minio.Examples/Cases/CopyObject.cs
+++ b/Minio.Examples/Cases/CopyObject.cs
@@ -25,10 +25,10 @@ class CopyObject
{
// Copy object from one bucket to another
public async static Task Run(Minio.MinioClient minio,
- string fromBucketName="from-bucket-name",
- string fromObjectName="from-object-name",
- string destBucketName="dest-bucket",
- string destObjectName="to-object-name",
+ string fromBucketName = "from-bucket-name",
+ string fromObjectName = "from-object-name",
+ string destBucketName = "dest-bucket",
+ string destObjectName =" to-object-name",
ServerSideEncryption sseSrc = null,
ServerSideEncryption sseDest = null)
{
diff --git a/Minio.Examples/Cases/CopyObjectMetadata.cs b/Minio.Examples/Cases/CopyObjectMetadata.cs
index 294e407db..36f711a68 100644
--- a/Minio.Examples/Cases/CopyObjectMetadata.cs
+++ b/Minio.Examples/Cases/CopyObjectMetadata.cs
@@ -24,10 +24,10 @@ class CopyObjectMetadata
{
// Copy object from one bucket to another
public async static Task Run(Minio.MinioClient minio,
- string fromBucketName="from-bucket-name",
- string fromObjectName="from-object-name",
- string destBucketName="dest-bucket",
- string destObjectName="to-object-name")
+ string fromBucketName = "from-bucket-name",
+ string fromObjectName = "from-object-name",
+ string destBucketName = "dest-bucket",
+ string destObjectName = "to-object-name")
{
try
{
@@ -38,10 +38,10 @@ public async static Task Run(Minio.MinioClient minio,
copyCond.SetReplaceMetadataDirective();
// set custom metadata
- Dictionary metadata = new Dictionary()
+ var metadata = new Dictionary
{
- { "Content-Type", "application/css"},
- {"X-Amz-Meta-Mynewkey","my-new-value"}
+ { "Content-Type", "application/css" },
+ { "X-Amz-Meta-Mynewkey", "my-new-value" }
};
await minio.CopyObjectAsync(fromBucketName,
fromObjectName,
diff --git a/Minio.Examples/Cases/FGetObject.cs b/Minio.Examples/Cases/FGetObject.cs
index 104a59ece..a5074af25 100644
--- a/Minio.Examples/Cases/FGetObject.cs
+++ b/Minio.Examples/Cases/FGetObject.cs
@@ -28,7 +28,7 @@ class FGetObject
public async static Task Run(Minio.MinioClient minio,
string bucketName = "my-bucket-name",
string objectName = "my-object-name",
- string fileName="local-filename",
+ string fileName = "local-filename",
ServerSideEncryption sse = null)
{
try
diff --git a/Minio.Examples/Cases/GetBucketNotification.cs b/Minio.Examples/Cases/GetBucketNotification.cs
index 5d68062cf..8f4021556 100644
--- a/Minio.Examples/Cases/GetBucketNotification.cs
+++ b/Minio.Examples/Cases/GetBucketNotification.cs
@@ -35,7 +35,7 @@ public async static Task Run(Minio.MinioClient minio,
}
catch (Exception e)
{
- Console.Out.WriteLine("Error parsing bucket notifications - make sure that you are running this call against AWS end point");
+ Console.Out.WriteLine("Error parsing bucket notifications - make sure that you are running this call against AWS end point: " + e.Message);
}
}
}
diff --git a/Minio.Examples/Cases/GetBucketPolicy.cs b/Minio.Examples/Cases/GetBucketPolicy.cs
index 47c50f3f6..590000a48 100644
--- a/Minio.Examples/Cases/GetBucketPolicy.cs
+++ b/Minio.Examples/Cases/GetBucketPolicy.cs
@@ -25,7 +25,7 @@ class GetBucketPolicy
// Get bucket policy
public async static Task Run(Minio.MinioClient minio,
string bucketName = "my-bucket-name",
- string prefix="")
+ string prefix = "")
{
try
{
diff --git a/Minio.Examples/Cases/GetObject.cs b/Minio.Examples/Cases/GetObject.cs
index 43f8d9f76..896e0dbb7 100644
--- a/Minio.Examples/Cases/GetObject.cs
+++ b/Minio.Examples/Cases/GetObject.cs
@@ -24,9 +24,9 @@ class GetObject
{
// Get object in a bucket
public async static Task Run(MinioClient minio,
- string bucketName="my-bucket-name",
- string objectName="my-object-name",
- string fileName="my-file-name")
+ string bucketName = "my-bucket-name",
+ string objectName = "my-object-name",
+ string fileName = "my-file-name")
{
try
{
@@ -34,7 +34,7 @@ public async static Task Run(MinioClient minio,
await minio.GetObjectAsync(bucketName, objectName,
(stream) =>
{
- // Uncommment to print the file on output console
+ // Uncomment to print the file on output console
// stream.CopyTo(Console.OpenStandardOutput());
});
Console.WriteLine("Downloaded the file " + fileName + " in bucket " + bucketName);
diff --git a/Minio.Examples/Cases/GetPartialObject.cs b/Minio.Examples/Cases/GetPartialObject.cs
index e26729138..8c207850a 100644
--- a/Minio.Examples/Cases/GetPartialObject.cs
+++ b/Minio.Examples/Cases/GetPartialObject.cs
@@ -25,9 +25,9 @@ class GetPartialObject
// Get object in a bucket for a particular offset range. Dotnet SDK currently
// requires both start offset and end
public async static Task Run(MinioClient minio,
- string bucketName="my-bucket-name",
- string objectName="my-object-name",
- string fileName="my-file-name")
+ string bucketName = "my-bucket-name",
+ string objectName = "my-object-name",
+ string fileName = "my-file-name")
{
try
{
@@ -45,9 +45,9 @@ await minio.GetObjectAsync(bucketName, objectName, 1024L, 4096L,
fileStream.Dispose();
FileInfo writtenInfo = new FileInfo(fileName);
long file_read_size = writtenInfo.Length;
- // Uncommment to print the file on output console
+ // Uncomment to print the file on output console
// stream.CopyTo(Console.OpenStandardOutput());
- Console.WriteLine("Successfully downloaded object with requested offset and length {0} into file",writtenInfo.Length);
+ Console.WriteLine("Successfully downloaded object with requested offset and length {0} into file", writtenInfo.Length);
stream.Dispose();
});
Console.Out.WriteLine();
diff --git a/Minio.Examples/Cases/MakeBucket.cs b/Minio.Examples/Cases/MakeBucket.cs
index e1c566a36..1faf2027d 100644
--- a/Minio.Examples/Cases/MakeBucket.cs
+++ b/Minio.Examples/Cases/MakeBucket.cs
@@ -23,7 +23,7 @@ public class MakeBucket
{
// Make a bucket
public async static Task Run(Minio.MinioClient minio,
- string bucketName="my-bucket-name")
+ string bucketName = "my-bucket-name")
{
try
{
diff --git a/Minio.Examples/Cases/PresignedGetObject.cs b/Minio.Examples/Cases/PresignedGetObject.cs
index bc0a08c04..e9b48d711 100644
--- a/Minio.Examples/Cases/PresignedGetObject.cs
+++ b/Minio.Examples/Cases/PresignedGetObject.cs
@@ -29,7 +29,7 @@ public async static Task Run(MinioClient client,
{
try
{
- Dictionary reqParams = new Dictionary(){{"response-content-type", "application/json"}};
+ var reqParams = new Dictionary { {"response-content-type", "application/json" } };
string presigned_url = await client.PresignedGetObjectAsync(bucketName, objectName, 1000, reqParams);
Console.Out.WriteLine(presigned_url);
}
diff --git a/Minio.Examples/Cases/PresignedPostPolicy.cs b/Minio.Examples/Cases/PresignedPostPolicy.cs
index 3f7fc223d..83bebb7dd 100644
--- a/Minio.Examples/Cases/PresignedPostPolicy.cs
+++ b/Minio.Examples/Cases/PresignedPostPolicy.cs
@@ -37,7 +37,7 @@ public async static Task Run(MinioClient client)
string curlCommand = "curl -X POST ";
foreach (KeyValuePair pair in tuple.Item2)
{
- curlCommand = curlCommand + String.Format(" -F {0}={1}", pair.Key, pair.Value);
+ curlCommand = curlCommand + string.Format(" -F {0}={1}", pair.Key, pair.Value);
}
curlCommand = curlCommand + " -F file=@/etc/bashrc " + tuple.Item1; // https://s3.amazonaws.com/my-bucketname";
Console.Out.WriteLine(curlCommand);
diff --git a/Minio.Examples/Cases/PutObject.cs b/Minio.Examples/Cases/PutObject.cs
index b0b741138..d88a74e34 100644
--- a/Minio.Examples/Cases/PutObject.cs
+++ b/Minio.Examples/Cases/PutObject.cs
@@ -26,13 +26,13 @@ namespace Minio.Examples.Cases
{
class PutObject
{
- private static int MB = 1024 * 1024;
+ private const int MB = 1024 * 1024;
// Put an object from a local stream into bucket
public async static Task Run(Minio.MinioClient minio,
string bucketName = "my-bucket-name",
string objectName = "my-object-name",
- string fileName="location-of-file",
+ string fileName = "location-of-file",
ServerSideEncryption sse = null)
{
try
@@ -48,10 +48,10 @@ public async static Task Run(Minio.MinioClient minio,
{
Console.Out.WriteLine("Running example for API: PutObjectAsync with Stream and MultiPartUpload");
}
- var metaData = new Dictionary()
- {
- {"X-Amz-Meta-Test", "Test Test"}
- };
+ var metaData = new Dictionary
+ {
+ { "X-Amz-Meta-Test", "Test Test" }
+ };
await minio.PutObjectAsync(bucketName,
objectName,
filestream,
diff --git a/Minio.Examples/Cases/RemoveIncompleteUpload.cs b/Minio.Examples/Cases/RemoveIncompleteUpload.cs
index e7c06ff37..9fc5224e4 100644
--- a/Minio.Examples/Cases/RemoveIncompleteUpload.cs
+++ b/Minio.Examples/Cases/RemoveIncompleteUpload.cs
@@ -31,7 +31,7 @@ public async static Task Run(MinioClient minio,
{
Console.Out.WriteLine("Running example for API: RemoveIncompleteUploadAsync");
await minio.RemoveIncompleteUploadAsync(bucketName, objectName);
- Console.Out.WriteLine("Removed object {0} from bucket {1} successfully",objectName, bucketName);
+ Console.Out.WriteLine("Removed object {0} from bucket {1} successfully", objectName, bucketName);
Console.Out.WriteLine();
}
catch (Exception e)
diff --git a/Minio.Examples/Cases/RemoveObject.cs b/Minio.Examples/Cases/RemoveObject.cs
index 7db12877b..3cde9308c 100644
--- a/Minio.Examples/Cases/RemoveObject.cs
+++ b/Minio.Examples/Cases/RemoveObject.cs
@@ -29,7 +29,7 @@ public async static Task Run(MinioClient minio,
try
{
Console.Out.WriteLine("Running example for API: RemoveObjectAsync");
- await minio.RemoveObjectAsync(bucketName,objectName);
+ await minio.RemoveObjectAsync(bucketName, objectName);
Console.Out.WriteLine("Removed object " + objectName + " from bucket " + bucketName + " successfully");
Console.Out.WriteLine();
}
diff --git a/Minio.Examples/Cases/RemoveObjects.cs b/Minio.Examples/Cases/RemoveObjects.cs
index bf3094bfa..e4db83d6f 100644
--- a/Minio.Examples/Cases/RemoveObjects.cs
+++ b/Minio.Examples/Cases/RemoveObjects.cs
@@ -26,7 +26,7 @@ class RemoveObjects
// Remove a list of objects from a bucket
public async static Task Run(MinioClient minio,
string bucketName = "my-bucket-name",
- List objectsList=null)
+ List objectsList = null)
{
try
{
diff --git a/Minio.Examples/Cases/StatObject.cs b/Minio.Examples/Cases/StatObject.cs
index 6da7be184..26d05930e 100644
--- a/Minio.Examples/Cases/StatObject.cs
+++ b/Minio.Examples/Cases/StatObject.cs
@@ -25,7 +25,7 @@ class StatObject
// Get stats on a object
public async static Task Run(Minio.MinioClient minio,
string bucketName = "my-bucket-name",
- string bucketObject="my-object-name")
+ string bucketObject = "my-object-name")
{
try
{
@@ -36,7 +36,7 @@ public async static Task Run(Minio.MinioClient minio,
}
catch (Exception e)
{
- Console.WriteLine("[StatObject] {0}-{1} Exception: {2}",bucketName, bucketObject, e);
+ Console.WriteLine("[StatObject] {0}-{1} Exception: {2}", bucketName, bucketObject, e);
}
}
}
diff --git a/Minio.Examples/Program.cs b/Minio.Examples/Program.cs
index d99741fd3..a76157060 100644
--- a/Minio.Examples/Program.cs
+++ b/Minio.Examples/Program.cs
@@ -29,7 +29,7 @@ namespace Minio.Examples
public class Program
{
private static Random rnd = new Random();
- private static int UNIT_MB = 1024 * 1024;
+ private const int UNIT_MB = 1024 * 1024;
// Create a file of given size from random byte array
private static String CreateFile(int size)
@@ -157,18 +157,18 @@ public static void Main(string[] args)
// Specify SSE-C source side encryption for Copy operations
var sseCpy = new SSECopy(aesEncryption.Key);
- // Uncommment to specify SSE-S3 encryption option
+ // Uncomment to specify SSE-S3 encryption option
// var sses3 = new SSES3();
- // Uncommment to specify SSE-KMS encryption option
- // var sseKms = new SSEKMS("kms-key",new Dictionary{{ "kms-context", "somevalue"}});
+ // Uncomment to specify SSE-KMS encryption option
+ // var sseKms = new SSEKMS("kms-key", new Dictionary{{ "kms-context", "somevalue"}});
// Upload encrypted object
- Cases.PutObject.Run(minioClient, bucketName, objectName, smallFileName,sse:ssec).Wait();
+ Cases.PutObject.Run(minioClient, bucketName, objectName, smallFileName, sse:ssec).Wait();
// Copy SSE-C encrypted object to unencrypted object
- Cases.CopyObject.Run(minioClient, bucketName, objectName, destBucketName, objectName,sseSrc:sseCpy,sseDest:ssec).Wait();
+ Cases.CopyObject.Run(minioClient, bucketName, objectName, destBucketName, objectName, sseSrc:sseCpy, sseDest:ssec).Wait();
// Download SSE-C encrypted object
- Cases.FGetObject.Run(minioClient, destBucketName, objectName, bigFileName,sse:ssec).Wait();
+ Cases.FGetObject.Run(minioClient, destBucketName, objectName, bigFileName, sse:ssec).Wait();
// List the incomplete uploads
Cases.ListIncompleteUploads.Run(minioClient, bucketName);
@@ -208,7 +208,7 @@ public static void Main(string[] args)
// Delete the object
Cases.RemoveObject.Run(minioClient, destBucketName, objectName).Wait();
- // Tacing request with custom logger
+ // Tracing request with custom logger
Cases.CustomRequestLogger.Run(minioClient).Wait();
// Remove the buckets
diff --git a/Minio.Functional.Tests/FunctionalTest.cs b/Minio.Functional.Tests/FunctionalTest.cs
index 2284dd997..0bab67f6f 100644
--- a/Minio.Functional.Tests/FunctionalTest.cs
+++ b/Minio.Functional.Tests/FunctionalTest.cs
@@ -32,40 +32,40 @@ namespace Minio.Functional.Tests
{
public class FunctionalTest
{
- private static Random rnd = new Random();
- private static int KB = 1024;
- private static int MB = 1024 * 1024;
+ private static readonly Random rnd = new Random();
+ private const int KB = 1024;
+ private const int MB = 1024 * 1024;
- private static string dataFile1B = "datafile-1-b";
+ private const string dataFile1B = "datafile-1-b";
- private static string dataFile10KB = "datafile-10-kB";
- private static string dataFile6MB = "datafile-6-MB";
+ private const string dataFile10KB = "datafile-10-kB";
+ private const string dataFile6MB = "datafile-6-MB";
private static RandomStreamGenerator rsg = new RandomStreamGenerator(100 * MB);
- private static string makeBucketSignature = "Task MakeBucketAsync(string bucketName, string location = 'us-east-1', CancellationToken cancellationToken = default(CancellationToken))";
- private static string listBucketsSignature = "Task ListBucketsAsync(CancellationToken cancellationToken = default(CancellationToken))";
- private static string bucketExistsSignature = "Task BucketExistsAsync(string bucketName, CancellationToken cancellationToken = default(CancellationToken))";
- private static string removeBucketSignature = "Task RemoveBucketAsync(string bucketName, CancellationToken cancellationToken = default(CancellationToken))";
- private static string listObjectsSignature = "IObservable- ListObjectsAsync(string bucketName, string prefix = null, bool recursive = false, CancellationToken cancellationToken = default(CancellationToken))";
- private static string listIncompleteUploadsSignature = "IObservable ListIncompleteUploads(string bucketName, string prefix, bool recursive, CancellationToken cancellationToken = default(CancellationToken))";
- private static string getObjectSignature1 = "Task GetObjectAsync(string bucketName, string objectName, Action callback, CancellationToken cancellationToken = default(CancellationToken))";
- private static string getObjectSignature2 = "Task GetObjectAsync(string bucketName, string objectName, Action callback, CancellationToken cancellationToken = default(CancellationToken))";
- private static string getObjectSignature3 = "Task GetObjectAsync(string bucketName, string objectName, string fileName, CancellationToken cancellationToken = default(CancellationToken))";
- private static string putObjectSignature1 = "Task PutObjectAsync(string bucketName, string objectName, Stream data, long size, string contentType,Dictionary metaData=null, CancellationToken cancellationToken = default(CancellationToken))";
- private static string putObjectSignature2 = "Task PutObjectAsync(string bucketName, string objectName, string filePath, string contentType=null,Dictionary metaData=null, CancellationToken cancellationToken = default(CancellationToken))";
- private static string statObjectSignature = "Task StatObjectAsync(string bucketName, string objectName, CancellationToken cancellationToken = default(CancellationToken))";
- private static string copyObjectSignature = "Task CopyObjectAsync(string bucketName, string objectName, string destBucketName, string destObjectName = null, CopyConditions copyConditions = null, CancellationToken cancellationToken = default(CancellationToken))";
- private static string removeObjectSignature1 = "Task RemoveObjectAsync(string bucketName, string objectName, CancellationToken cancellationToken = default(CancellationToken))";
- private static string removeObjectSignature2 = "Task> RemoveObjectAsync(string bucketName, IEnumerable objectsList, CancellationToken cancellationToken = default(CancellationToken))";
- private static string removeIncompleteUploadSignature = "Task RemoveIncompleteUploadAsync(string bucketName, string objectName, CancellationToken cancellationToken = default(CancellationToken))";
- private static string presignedGetObjectSignature = "Task PresignedGetObjectAsync(string bucketName, string objectName, int expiresInt, Dictionary reqParams = null)";
- private static string presignedPutObjectSignature = "Task PresignedPutObjectAsync(string bucketName, string objectName, int expiresInt)";
- private static string presignedPostPolicySignature = "Task> PresignedPostPolicyAsync(PostPolicy policy)";
- private static string getBucketPolicySignature = "Task GetPolicyAsync(string bucketName,CancellationToken cancellationToken = default(CancellationToken))";
- private static string setBucketPolicySignature = "Task SetPolicyAsync(string bucketName, string policyJson, CancellationToken cancellationToken = default(CancellationToken))";
- private static string getBucketNotificationSignature = "Task GetBucketNotificationAsync(string bucketName, CancellationToken cancellationToken = default(CancellationToken))";
- private static string setBucketNotificationSignature = "Task SetBucketNotificationAsync(string bucketName, BucketNotification notification, CancellationToken cancellationToken = default(CancellationToken))";
- private static string removeAllBucketsNotificationSignature = "Task RemoveAllBucketNotificationsAsync(string bucketName, CancellationToken cancellationToken = default(CancellationToken))";
+ private const string makeBucketSignature = "Task MakeBucketAsync(string bucketName, string location = 'us-east-1', CancellationToken cancellationToken = default(CancellationToken))";
+ private const string listBucketsSignature = "Task ListBucketsAsync(CancellationToken cancellationToken = default(CancellationToken))";
+ private const string bucketExistsSignature = "Task BucketExistsAsync(string bucketName, CancellationToken cancellationToken = default(CancellationToken))";
+ private const string removeBucketSignature = "Task RemoveBucketAsync(string bucketName, CancellationToken cancellationToken = default(CancellationToken))";
+ private const string listObjectsSignature = "IObservable
- ListObjectsAsync(string bucketName, string prefix = null, bool recursive = false, CancellationToken cancellationToken = default(CancellationToken))";
+ private const string listIncompleteUploadsSignature = "IObservable ListIncompleteUploads(string bucketName, string prefix, bool recursive, CancellationToken cancellationToken = default(CancellationToken))";
+ private const string getObjectSignature1 = "Task GetObjectAsync(string bucketName, string objectName, Action callback, CancellationToken cancellationToken = default(CancellationToken))";
+ private const string getObjectSignature2 = "Task GetObjectAsync(string bucketName, string objectName, Action callback, CancellationToken cancellationToken = default(CancellationToken))";
+ private const string getObjectSignature3 = "Task GetObjectAsync(string bucketName, string objectName, string fileName, CancellationToken cancellationToken = default(CancellationToken))";
+ private const string putObjectSignature1 = "Task PutObjectAsync(string bucketName, string objectName, Stream data, long size, string contentType, Dictionary metaData=null, CancellationToken cancellationToken = default(CancellationToken))";
+ private const string putObjectSignature2 = "Task PutObjectAsync(string bucketName, string objectName, string filePath, string contentType=null, Dictionary metaData=null, CancellationToken cancellationToken = default(CancellationToken))";
+ private const string statObjectSignature = "Task StatObjectAsync(string bucketName, string objectName, CancellationToken cancellationToken = default(CancellationToken))";
+ private const string copyObjectSignature = "Task CopyObjectAsync(string bucketName, string objectName, string destBucketName, string destObjectName = null, CopyConditions copyConditions = null, CancellationToken cancellationToken = default(CancellationToken))";
+ private const string removeObjectSignature1 = "Task RemoveObjectAsync(string bucketName, string objectName, CancellationToken cancellationToken = default(CancellationToken))";
+ private const string removeObjectSignature2 = "Task> RemoveObjectAsync(string bucketName, IEnumerable objectsList, CancellationToken cancellationToken = default(CancellationToken))";
+ private const string removeIncompleteUploadSignature = "Task RemoveIncompleteUploadAsync(string bucketName, string objectName, CancellationToken cancellationToken = default(CancellationToken))";
+ private const string presignedGetObjectSignature = "Task PresignedGetObjectAsync(string bucketName, string objectName, int expiresInt, Dictionary reqParams = null)";
+ private const string presignedPutObjectSignature = "Task PresignedPutObjectAsync(string bucketName, string objectName, int expiresInt)";
+ private const string presignedPostPolicySignature = "Task> PresignedPostPolicyAsync(PostPolicy policy)";
+ private const string getBucketPolicySignature = "Task GetPolicyAsync(string bucketName, CancellationToken cancellationToken = default(CancellationToken))";
+ private const string setBucketPolicySignature = "Task SetPolicyAsync(string bucketName, string policyJson, CancellationToken cancellationToken = default(CancellationToken))";
+ private const string getBucketNotificationSignature = "Task GetBucketNotificationAsync(string bucketName, CancellationToken cancellationToken = default(CancellationToken))";
+ private const string setBucketNotificationSignature = "Task SetBucketNotificationAsync(string bucketName, BucketNotification notification, CancellationToken cancellationToken = default(CancellationToken))";
+ private const string removeAllBucketsNotificationSignature = "Task RemoveAllBucketNotificationsAsync(string bucketName, CancellationToken cancellationToken = default(CancellationToken))";
// Create a file of given size from random byte array or optionally create a symbolic link
// to the dataFileName residing in MINT_DATA_DIR
@@ -99,16 +99,18 @@ public static String GetRandomName(int length = 5)
}
return "miniodotnet" + result.ToString();
}
+
// Return true if running in Mint mode
public static bool IsMintEnv()
{
- return !String.IsNullOrEmpty(Environment.GetEnvironmentVariable("MINT_DATA_DIR"));
+ return !string.IsNullOrEmpty(Environment.GetEnvironmentVariable("MINT_DATA_DIR"));
}
+
// Get full path of file
public static string GetFilePath(string fileName)
{
var dataDir = Environment.GetEnvironmentVariable("MINT_DATA_DIR");
- if (!String.IsNullOrEmpty(dataDir))
+ if (!string.IsNullOrEmpty(dataDir))
{
return dataDir + "/" + fileName;
}
@@ -118,6 +120,7 @@ public static string GetFilePath(string fileName)
return path + "/" + fileName;
}
}
+
public static void Main(string[] args)
{
String endPoint = null;
@@ -145,7 +148,7 @@ public static void Main(string[] args)
}
MinioClient minioClient = null;
- if (enableHttps.Equals("1"))
+ if (enableHttps == "1")
// WithSSL() enables SSL support in MinIO client
minioClient = new MinioClient(endPoint, accessKey, secretKey).WithSSL();
else
@@ -167,7 +170,7 @@ public static void Main(string[] args)
string runMode = Environment.GetEnvironmentVariable("MINT_MODE");
- if (!String.IsNullOrEmpty(runMode) && runMode.Equals("core"))
+ if (!string.IsNullOrEmpty(runMode) && runMode == "core")
{
runCoreTests(minioClient);
System.Environment.Exit(0);
@@ -254,7 +257,7 @@ public static void Main(string[] args)
GetBucketPolicy_Test1(minioClient).Wait();
// Test encryption
- if (enableHttps.Equals("1"))
+ if (enableHttps == "1")
{
ServicePointManager.ServerCertificateValidationCallback += (sender, certificate, chain, sslPolicyErrors) => true;
PutGetStatEncryptedObject_Test1(minioClient).Wait();
@@ -263,7 +266,7 @@ public static void Main(string[] args)
EncryptedCopyObject_Test1(minioClient).Wait();
EncryptedCopyObject_Test2(minioClient).Wait();
}
- if (kmsEnabled != null && kmsEnabled.Equals("1"))
+ if (kmsEnabled != null && kmsEnabled == "1")
{
PutGetStatEncryptedObject_Test3(minioClient).Wait();
EncryptedCopyObject_Test3(minioClient).Wait();
@@ -271,6 +274,7 @@ public static void Main(string[] args)
}
}
+
private static void runCoreTests(MinioClient minioClient)
{
// Check if bucket exists
@@ -299,13 +303,14 @@ private static void runCoreTests(MinioClient minioClient)
GetBucketPolicy_Test1(minioClient).Wait();
}
+
private async static Task BucketExists_Test(MinioClient minio)
{
DateTime startTime = DateTime.Now;
string bucketName = GetRandomName();
- Dictionary args = new Dictionary
+ var args = new Dictionary
{
- { "bucketName", bucketName},
+ { "bucketName", bucketName },
};
try
@@ -314,11 +319,11 @@ private async static Task BucketExists_Test(MinioClient minio)
bool found = await minio.BucketExistsAsync(bucketName);
Assert.IsTrue(found);
await minio.RemoveBucketAsync(bucketName);
- new MintLogger("BucketExists_Test",bucketExistsSignature,"Tests whether BucketExists passes",TestStatus.PASS,(DateTime.Now - startTime),args:args).Log();
+ new MintLogger("BucketExists_Test", bucketExistsSignature, "Tests whether BucketExists passes", TestStatus.PASS, (DateTime.Now - startTime), args:args).Log();
}
catch (MinioException ex)
{
- new MintLogger("BucketExists_Test",bucketExistsSignature,"Tests whether BucketExists passes",TestStatus.FAIL,(DateTime.Now - startTime),"",ex.Message, ex.ToString(),args).Log();
+ new MintLogger("BucketExists_Test", bucketExistsSignature, "Tests whether BucketExists passes", TestStatus.FAIL, (DateTime.Now - startTime), "", ex.Message, ex.ToString(), args).Log();
}
}
@@ -326,10 +331,10 @@ private async static Task MakeBucket_Test1(MinioClient minio)
{
DateTime startTime = DateTime.Now;
string bucketName = GetRandomName(length: 60);
- Dictionary args = new Dictionary
+ var args = new Dictionary
{
- { "bucketName", bucketName},
- {"region","us-east-1"},
+ { "bucketName", bucketName },
+ { "region", "us-east-1" },
};
try
@@ -338,11 +343,11 @@ private async static Task MakeBucket_Test1(MinioClient minio)
bool found = await minio.BucketExistsAsync(bucketName);
Assert.IsTrue(found);
await minio.RemoveBucketAsync(bucketName);
- new MintLogger("MakeBucket_Test1",makeBucketSignature,"Tests whether MakeBucket passes",TestStatus.PASS,(DateTime.Now - startTime),args:args).Log();
+ new MintLogger("MakeBucket_Test1", makeBucketSignature, "Tests whether MakeBucket passes", TestStatus.PASS, (DateTime.Now - startTime), args:args).Log();
}
catch (MinioException ex)
{
- new MintLogger("MakeBucket_Test1",makeBucketSignature,"Tests whether MakeBucket passes",TestStatus.FAIL,(DateTime.Now - startTime),"",ex.Message,ex.ToString(),args).Log();
+ new MintLogger("MakeBucket_Test1", makeBucketSignature, "Tests whether MakeBucket passes", TestStatus.FAIL, (DateTime.Now - startTime), "", ex.Message, ex.ToString(), args).Log();
}
}
@@ -350,10 +355,10 @@ private async static Task MakeBucket_Test2(MinioClient minio)
{
DateTime startTime = DateTime.Now;
string bucketName = GetRandomName(length: 10) + ".withperiod";
- Dictionary args = new Dictionary
+ var args = new Dictionary
{
- { "bucketName", bucketName},
- {"region","us-east-1"},
+ { "bucketName", bucketName },
+ { "region", "us-east-1" },
};
string testType = "Test whether make bucket passes when bucketname has a period.";
@@ -363,24 +368,25 @@ private async static Task MakeBucket_Test2(MinioClient minio)
bool found = await minio.BucketExistsAsync(bucketName);
Assert.IsTrue(found);
await minio.RemoveBucketAsync(bucketName);
- new MintLogger("MakeBucket_Test2",makeBucketSignature, testType,TestStatus.PASS,(DateTime.Now - startTime),args:args).Log();
+ new MintLogger("MakeBucket_Test2", makeBucketSignature, testType, TestStatus.PASS, (DateTime.Now - startTime), args:args).Log();
}
catch (MinioException ex)
{
- new MintLogger("MakeBucket_Test2",makeBucketSignature,testType,TestStatus.FAIL,(DateTime.Now - startTime),"",ex.Message, ex.ToString(),args).Log();
+ new MintLogger("MakeBucket_Test2", makeBucketSignature, testType, TestStatus.FAIL, (DateTime.Now - startTime), "", ex.Message, ex.ToString(), args).Log();
}
}
+
private async static Task MakeBucket_Test3(MinioClient minio, bool aws = false)
{
if (!aws)
return;
DateTime startTime = DateTime.Now;
string bucketName = GetRandomName(length: 60);
- Dictionary args = new Dictionary
+ var args = new Dictionary
{
- { "bucketName", bucketName},
- {"region","eu-central-1"},
+ { "bucketName", bucketName },
+ { "region", "eu-central-1" },
};
try
{
@@ -393,25 +399,26 @@ private async static Task MakeBucket_Test3(MinioClient minio, bool aws = false)
await minio.RemoveBucketAsync(bucketName);
}
- new MintLogger("MakeBucket_Test3",makeBucketSignature,"Tests whether MakeBucket with region passes",TestStatus.PASS,(DateTime.Now - startTime),args:args).Log();
+ new MintLogger("MakeBucket_Test3", makeBucketSignature, "Tests whether MakeBucket with region passes", TestStatus.PASS, (DateTime.Now - startTime), args:args).Log();
}
catch (MinioException ex)
{
// Assert.AreEqual(ex.message, "Your previous request to create the named bucket succeeded and you already own it.");
- new MintLogger("MakeBucket_Test3",makeBucketSignature,"Tests whether MakeBucket with region passes",TestStatus.FAIL,(DateTime.Now - startTime),"",ex.Message, ex.ToString(),args).Log();
+ new MintLogger("MakeBucket_Test3", makeBucketSignature, "Tests whether MakeBucket with region passes", TestStatus.FAIL, (DateTime.Now - startTime), "", ex.Message, ex.ToString(), args).Log();
}
}
+
private async static Task MakeBucket_Test4(MinioClient minio, bool aws = false)
{
if (!aws)
return;
DateTime startTime = DateTime.Now;
string bucketName = GetRandomName(length: 20) + ".withperiod";
- Dictionary args = new Dictionary
+ var args = new Dictionary
{
- { "bucketName", bucketName},
- {"region","us-west-2"},
+ { "bucketName", bucketName },
+ { "region", "us-west-2" },
};
try
{
@@ -423,11 +430,11 @@ private async static Task MakeBucket_Test4(MinioClient minio, bool aws = false)
await minio.RemoveBucketAsync(bucketName);
}
- new MintLogger("MakeBucket_Test4",makeBucketSignature,"Tests whether MakeBucket with region and bucketname with . passes",TestStatus.PASS,(DateTime.Now - startTime),args:args).Log();
+ new MintLogger("MakeBucket_Test4", makeBucketSignature, "Tests whether MakeBucket with region and bucketname with . passes", TestStatus.PASS, (DateTime.Now - startTime), args:args).Log();
}
catch (MinioException ex)
{
- new MintLogger("MakeBucket_Test4",makeBucketSignature,"Tests whether MakeBucket with region and bucketname with . passes",TestStatus.FAIL,(DateTime.Now - startTime),"",ex.Message, ex.ToString(),args).Log();
+ new MintLogger("MakeBucket_Test4", makeBucketSignature, "Tests whether MakeBucket with region and bucketname with . passes", TestStatus.FAIL, (DateTime.Now - startTime), "", ex.Message, ex.ToString(), args).Log();
}
}
@@ -435,9 +442,9 @@ private async static Task RemoveBucket_Test1(MinioClient minio)
{
DateTime startTime = DateTime.Now;
string bucketName = GetRandomName(length: 20);
- Dictionary args = new Dictionary
+ var args = new Dictionary
{
- { "bucketName", bucketName},
+ { "bucketName", bucketName },
};
try
{
@@ -447,17 +454,18 @@ private async static Task RemoveBucket_Test1(MinioClient minio)
await minio.RemoveBucketAsync(bucketName);
found = await minio.BucketExistsAsync(bucketName);
Assert.IsFalse(found);
- new MintLogger("RemoveBucket_Test1",removeBucketSignature,"Tests whether RemoveBucket passes",TestStatus.PASS,(DateTime.Now - startTime),args:args).Log();
+ new MintLogger("RemoveBucket_Test1", removeBucketSignature, "Tests whether RemoveBucket passes", TestStatus.PASS, (DateTime.Now - startTime), args:args).Log();
}
catch (MinioException ex)
{
- new MintLogger("RemoveBucket_Test1",removeBucketSignature,"Tests whether RemoveBucket passes",TestStatus.FAIL,(DateTime.Now - startTime),"",ex.Message, ex.ToString(),args).Log();
+ new MintLogger("RemoveBucket_Test1", removeBucketSignature, "Tests whether RemoveBucket passes", TestStatus.FAIL, (DateTime.Now - startTime), "", ex.Message, ex.ToString(), args).Log();
}
}
+
private async static Task ListBuckets_Test(MinioClient minio)
{
DateTime startTime = DateTime.Now;
- Dictionary args = new Dictionary{};
+ var args = new Dictionary();
try
{
var list = await minio.ListBucketsAsync();
@@ -466,13 +474,14 @@ private async static Task ListBuckets_Test(MinioClient minio)
// Ignore
continue;
}
- new MintLogger("ListBuckets_Test",listBucketsSignature,"Tests whether ListBucket passes",TestStatus.PASS,(DateTime.Now - startTime),args:args).Log();
+ new MintLogger("ListBuckets_Test", listBucketsSignature, "Tests whether ListBucket passes", TestStatus.PASS, (DateTime.Now - startTime), args:args).Log();
}
catch (Exception ex)
{
- new MintLogger("ListBuckets_Test",listBucketsSignature,"Tests whether ListBucket passes",TestStatus.FAIL,(DateTime.Now - startTime),"",ex.Message, ex.ToString(),args).Log();
+ new MintLogger("ListBuckets_Test", listBucketsSignature, "Tests whether ListBucket passes", TestStatus.FAIL, (DateTime.Now - startTime), "", ex.Message, ex.ToString(), args).Log();
}
}
+
private async static Task Setup_Test(MinioClient minio, string bucketName)
{
await minio.MakeBucketAsync(bucketName);
@@ -484,56 +493,56 @@ private async static Task TearDown(MinioClient minio, string bucketName)
{
await minio.RemoveBucketAsync(bucketName);
}
+
private async static Task PutObject_Test1(MinioClient minio)
{
DateTime startTime = DateTime.Now;
string bucketName = GetRandomName(15);
string objectName = GetRandomName(10);
string contentType = "application/octet-stream";
- Dictionary args = new Dictionary
+ var args = new Dictionary
{
- { "bucketName", bucketName},
- {"objectName",objectName},
- {"contentType", contentType},
- {"size","1MB"}
+ { "bucketName", bucketName },
+ { "objectName", objectName },
+ { "contentType", contentType },
+ { "size", "1MB" }
};
try
{
await Setup_Test(minio, bucketName);
await PutObject_Tester(minio, bucketName, objectName, null, contentType, 0, null, rsg.GenerateStreamFromSeed(1 * KB));
await TearDown(minio, bucketName);
- new MintLogger("PutObject_Test1",putObjectSignature1,"Tests whether PutObject passes for small object",TestStatus.PASS,(DateTime.Now - startTime),args:args).Log();
+ new MintLogger("PutObject_Test1", putObjectSignature1, "Tests whether PutObject passes for small object", TestStatus.PASS, (DateTime.Now - startTime), args:args).Log();
}
catch (Exception ex)
{
- new MintLogger("PutObject_Test1",putObjectSignature1,"Tests whether PutObject passes for small object",TestStatus.FAIL,(DateTime.Now - startTime),"",ex.Message, ex.ToString(),args).Log();
+ new MintLogger("PutObject_Test1", putObjectSignature1, "Tests whether PutObject passes for small object", TestStatus.FAIL, (DateTime.Now - startTime), "", ex.Message, ex.ToString(), args).Log();
}
}
-
private async static Task PutObject_Test2(MinioClient minio)
{
DateTime startTime = DateTime.Now;
string bucketName = GetRandomName(15);
string objectName = GetRandomName(10);
string contentType = "application/octet-stream";
- Dictionary args = new Dictionary
+ var args = new Dictionary
{
- { "bucketName", bucketName},
- {"objectName",objectName},
- {"contentType", contentType},
- {"size","6MB"}
+ { "bucketName", bucketName },
+ { "objectName", objectName },
+ { "contentType", contentType },
+ { "size", "6MB" }
};
try
{
await Setup_Test(minio, bucketName);
await PutObject_Tester(minio, bucketName, objectName, null, contentType, 0, null, rsg.GenerateStreamFromSeed(6 * MB));
await TearDown(minio, bucketName);
- new MintLogger("PutObject_Test2",putObjectSignature1,"Tests whether multipart PutObject passes",TestStatus.PASS,(DateTime.Now - startTime),args:args).Log();
+ new MintLogger("PutObject_Test2", putObjectSignature1, "Tests whether multipart PutObject passes", TestStatus.PASS, (DateTime.Now - startTime), args:args).Log();
}
catch (Exception ex)
{
- new MintLogger("PutObject_Test2",putObjectSignature1,"Tests whether multipart PutObject passes",TestStatus.FAIL,(DateTime.Now - startTime),"",ex.Message, ex.ToString(),args).Log();
+ new MintLogger("PutObject_Test2", putObjectSignature1, "Tests whether multipart PutObject passes", TestStatus.FAIL, (DateTime.Now - startTime), "", ex.Message, ex.ToString(), args).Log();
}
}
@@ -543,12 +552,12 @@ private async static Task PutObject_Test3(MinioClient minio)
string bucketName = GetRandomName(15);
string objectName = GetRandomName(10);
string contentType = "custom-contenttype";
- Dictionary args = new Dictionary
+ var args = new Dictionary
{
- { "bucketName", bucketName},
- {"objectName",objectName},
- {"contentType", contentType},
- {"size","1MB"}
+ { "bucketName", bucketName },
+ { "objectName", objectName },
+ { "contentType", contentType },
+ { "size", "1MB" }
};
try
@@ -556,13 +565,14 @@ private async static Task PutObject_Test3(MinioClient minio)
await Setup_Test(minio, bucketName);
await PutObject_Tester(minio, bucketName, objectName, null, contentType, 0, null, rsg.GenerateStreamFromSeed(1 * KB));
await TearDown(minio, bucketName);
- new MintLogger("PutObject_Test3",putObjectSignature1,"Tests whether PutObject with custom content-type passes",TestStatus.PASS,(DateTime.Now - startTime),args:args).Log();
+ new MintLogger("PutObject_Test3", putObjectSignature1, "Tests whether PutObject with custom content-type passes", TestStatus.PASS, (DateTime.Now - startTime), args:args).Log();
}
catch (Exception ex)
{
- new MintLogger("PutObject_Test3",putObjectSignature1,"Tests whether PutObject with custom content-type passes",TestStatus.FAIL,(DateTime.Now - startTime),"",ex.Message, ex.ToString(),args).Log();
+ new MintLogger("PutObject_Test3", putObjectSignature1, "Tests whether PutObject with custom content-type passes", TestStatus.FAIL, (DateTime.Now - startTime), "", ex.Message, ex.ToString(), args).Log();
}
}
+
private async static Task PutObject_Test4(MinioClient minio)
{
DateTime startTime = DateTime.Now;
@@ -570,17 +580,18 @@ private async static Task PutObject_Test4(MinioClient minio)
string objectName = GetRandomName(10);
string fileName = CreateFile(1, dataFile1B);
string contentType = "custom/contenttype";
- Dictionary metaData = new Dictionary(){
- { "x-amz-meta-customheader", "minio dotnet"}
+ var metaData = new Dictionary
+ {
+ { "x-amz-meta-customheader", "minio dotnet" }
};
- Dictionary args = new Dictionary
- {
- { "bucketName", bucketName},
- {"objectName",objectName},
- {"contentType", contentType},
- {"data","1B"},
- {"size","1B"},
- {"metaData","x-amz-meta-customheader:minio-dotnet"}
+ var args = new Dictionary
+ {
+ { "bucketName", bucketName },
+ { "objectName", objectName },
+ { "contentType", contentType },
+ { "data", "1B" },
+ { "size", "1B" },
+ { "metaData", "x-amz-meta-customheader:minio-dotnet" }
};
try
{
@@ -588,88 +599,91 @@ private async static Task PutObject_Test4(MinioClient minio)
ObjectStat statObject = await PutObject_Tester(minio, bucketName, objectName, fileName, contentType: contentType, metaData: metaData);
Assert.IsTrue(statObject != null);
Assert.IsTrue(statObject.metaData != null);
- Dictionary statMeta = new Dictionary(statObject.metaData, StringComparer.OrdinalIgnoreCase);
+ var statMeta = new Dictionary(statObject.metaData, StringComparer.OrdinalIgnoreCase);
Assert.IsTrue(statMeta.ContainsKey("x-amz-meta-customheader"));
Assert.IsTrue(statObject.metaData.ContainsKey("Content-Type") && statObject.metaData["Content-Type"].Equals("custom/contenttype"));
await TearDown(minio, bucketName);
- new MintLogger("PutObject_Test4",putObjectSignature1,"Tests whether PutObject with different content-type passes",TestStatus.PASS,(DateTime.Now - startTime), args:args).Log();
+ new MintLogger("PutObject_Test4", putObjectSignature1, "Tests whether PutObject with different content-type passes", TestStatus.PASS, (DateTime.Now - startTime), args:args).Log();
}
catch (MinioException ex)
{
- new MintLogger("PutObject_Test4",putObjectSignature1,"Tests whether PutObject with different content-type passes",TestStatus.FAIL,(DateTime.Now - startTime),"",ex.Message, ex.ToString(),args).Log();
+ new MintLogger("PutObject_Test4", putObjectSignature1, "Tests whether PutObject with different content-type passes", TestStatus.FAIL, (DateTime.Now - startTime), "", ex.Message, ex.ToString(), args).Log();
}
if (!IsMintEnv())
{
File.Delete(fileName);
}
}
+
private async static Task PutObject_Test5(MinioClient minio)
{
DateTime startTime = DateTime.Now;
string bucketName = GetRandomName(15);
string objectName = GetRandomName(10);
- Dictionary args = new Dictionary
+ var args = new Dictionary
{
- { "bucketName", bucketName},
- {"objectName",objectName},
- {"data","1B"},
- {"size","1B"},
+ { "bucketName", bucketName },
+ { "objectName", objectName },
+ { "data", "1B" },
+ { "size", "1B" },
};
try
{
await Setup_Test(minio, bucketName);
await PutObject_Tester(minio, bucketName, objectName, null, null, 0, null, rsg.GenerateStreamFromSeed(1));
await TearDown(minio, bucketName);
- new MintLogger("PutObject_Test5",putObjectSignature1,"Tests whether PutObject with no content-type passes for small object",TestStatus.PASS,(DateTime.Now - startTime),args:args).Log();
+ new MintLogger("PutObject_Test5", putObjectSignature1, "Tests whether PutObject with no content-type passes for small object", TestStatus.PASS, (DateTime.Now - startTime), args:args).Log();
}
catch (Exception ex)
{
- new MintLogger("PutObject_Test5",putObjectSignature1,"Tests whether PutObject with no content-type passes for small object",TestStatus.FAIL,(DateTime.Now - startTime),"",ex.Message, ex.ToString(), args).Log();
+ new MintLogger("PutObject_Test5", putObjectSignature1, "Tests whether PutObject with no content-type passes for small object", TestStatus.FAIL, (DateTime.Now - startTime), "", ex.Message, ex.ToString(), args).Log();
}
}
+
private async static Task PutObject_Test6(MinioClient minio)
{
DateTime startTime = DateTime.Now;
string bucketName = GetRandomName(15);
string objectName = "parallelput";
- Dictionary args = new Dictionary
+ var args = new Dictionary
{
- { "bucketName", bucketName},
- {"objectName",objectName},
- {"data","10KB"},
- {"size","10KB"},
+ { "bucketName", bucketName },
+ { "objectName", objectName },
+ { "data", "10KB" },
+ { "size", "10KB" },
};
try
{
await Setup_Test(minio, bucketName);
Task[] tasks = new Task[7];
for (int i = 0; i < 7; i++) {
- tasks[i]= PutObject_Task(minio, bucketName, objectName, null, null, 0, null, rsg.GenerateStreamFromSeed(10*KB));
+ tasks[i] = PutObject_Task(minio, bucketName, objectName, null, null, 0, null, rsg.GenerateStreamFromSeed(10*KB));
}
await Task.WhenAll(tasks);
await minio.RemoveObjectAsync(bucketName, objectName);
await TearDown(minio, bucketName);
- new MintLogger("PutObject_Test6",putObjectSignature1,"Tests thread safety of minioclient on a parallel put operation",TestStatus.PASS,(DateTime.Now - startTime), args:args).Log();
+ new MintLogger("PutObject_Test6", putObjectSignature1, "Tests thread safety of minioclient on a parallel put operation", TestStatus.PASS, (DateTime.Now - startTime), args:args).Log();
}
catch (Exception ex)
{
- new MintLogger("PutObject_Test6",putObjectSignature1,"Tests thread safety of minioclient on a parallel put operation",TestStatus.FAIL,(DateTime.Now - startTime),"",ex.Message, ex.ToString(), args).Log();
+ new MintLogger("PutObject_Test6", putObjectSignature1, "Tests thread safety of minioclient on a parallel put operation", TestStatus.FAIL, (DateTime.Now - startTime), "", ex.Message, ex.ToString(), args).Log();
}
}
+
private async static Task PutObject_Test7(MinioClient minio)
{
DateTime startTime = DateTime.Now;
string bucketName = GetRandomName(15);
string objectName = GetRandomName(10);
string contentType = "application/octet-stream";
- Dictionary args = new Dictionary
+ var args = new Dictionary
{
- { "bucketName", bucketName},
- {"objectName",objectName},
- {"contentType", contentType},
- {"data","10KB"},
- {"size","-1"},
+ { "bucketName", bucketName },
+ { "objectName", objectName },
+ { "contentType", contentType },
+ { "data", "10KB" },
+ { "size", "-1" },
};
try
{
@@ -689,26 +703,27 @@ await minio.PutObjectAsync(bucketName,
await minio.RemoveObjectAsync(bucketName, objectName);
await TearDown(minio, bucketName);
}
- new MintLogger("PutObject_Test7",putObjectSignature1,"Tests whether PutObject with unknown stream-size passes",TestStatus.PASS,(DateTime.Now - startTime), args:args).Log();
+ new MintLogger("PutObject_Test7", putObjectSignature1, "Tests whether PutObject with unknown stream-size passes", TestStatus.PASS, (DateTime.Now - startTime), args:args).Log();
}
catch (Exception ex)
{
- new MintLogger("PutObject_Test7",putObjectSignature1,"Tests whether PutObject with unknown stream-size passes",TestStatus.FAIL,(DateTime.Now - startTime),"",ex.Message, ex.ToString(), args).Log();
+ new MintLogger("PutObject_Test7", putObjectSignature1, "Tests whether PutObject with unknown stream-size passes", TestStatus.FAIL, (DateTime.Now - startTime), "", ex.Message, ex.ToString(), args).Log();
}
}
+
private async static Task PutObject_Test8(MinioClient minio)
{
DateTime startTime = DateTime.Now;
string bucketName = GetRandomName(15);
string objectName = GetRandomName(10);
string contentType = "application/octet-stream";
- Dictionary args = new Dictionary
+ var args = new Dictionary
{
- { "bucketName", bucketName},
- {"objectName",objectName},
- {"contentType", contentType},
- {"data","0B"},
- {"size","-1"},
+ { "bucketName", bucketName },
+ { "objectName", objectName },
+ { "contentType", contentType },
+ { "data", "0B" },
+ { "size", "-1" },
};
try
{
@@ -727,26 +742,27 @@ await minio.PutObjectAsync(bucketName,
await minio.RemoveObjectAsync(bucketName, objectName);
await TearDown(minio, bucketName);
}
- new MintLogger("PutObject_Test8",putObjectSignature1,"Tests PutObject where unknown stream sends 0 bytes",TestStatus.PASS,(DateTime.Now - startTime), args:args).Log();
+ new MintLogger("PutObject_Test8", putObjectSignature1, "Tests PutObject where unknown stream sends 0 bytes", TestStatus.PASS, (DateTime.Now - startTime), args:args).Log();
}
catch (Exception ex)
{
- new MintLogger("PutObject_Test8",putObjectSignature1,"Tests PutObject where unknown stream sends 0 bytes",TestStatus.FAIL,(DateTime.Now - startTime),"",ex.Message, ex.ToString(), args).Log();
+ new MintLogger("PutObject_Test8", putObjectSignature1, "Tests PutObject where unknown stream sends 0 bytes", TestStatus.FAIL, (DateTime.Now - startTime), "", ex.Message, ex.ToString(), args).Log();
}
}
+
private async static Task PutGetStatEncryptedObject_Test1(MinioClient minio)
{
DateTime startTime = DateTime.Now;
string bucketName = GetRandomName(15);
string objectName = GetRandomName(10);
string contentType = "application/octet-stream";
- Dictionary args = new Dictionary
+ var args = new Dictionary
{
- { "bucketName", bucketName},
- {"objectName",objectName},
- {"contentType", contentType},
- {"data","1KB"},
- {"size","1KB"},
+ { "bucketName", bucketName },
+ { "objectName", objectName },
+ { "contentType", contentType },
+ { "data", "1KB" },
+ { "size", "1KB" },
};
try
{
@@ -766,7 +782,7 @@ await minio.PutObjectAsync(bucketName,
objectName,
filestream,
filestream.Length,
- contentType,sse: ssec);
+ contentType, sse: ssec);
await minio.GetObjectAsync(bucketName, objectName,
(stream) =>
@@ -779,33 +795,33 @@ await minio.GetObjectAsync(bucketName, objectName,
Assert.AreEqual(file_read_size, file_write_size);
File.Delete(tempFileName);
- },sse:ssec);
- await minio.StatObjectAsync(bucketName, objectName,sse:ssec);
+ }, sse:ssec);
+ await minio.StatObjectAsync(bucketName, objectName, sse:ssec);
await minio.RemoveObjectAsync(bucketName, objectName);
}
await TearDown(minio, bucketName);
- new MintLogger("PutGetStatEncryptedObject_Test1",putObjectSignature1,"Tests whether Put/Get/Stat Object with encryption passes",TestStatus.PASS,(DateTime.Now - startTime), args:args).Log();
+ new MintLogger("PutGetStatEncryptedObject_Test1", putObjectSignature1, "Tests whether Put/Get/Stat Object with encryption passes", TestStatus.PASS, (DateTime.Now - startTime), args:args).Log();
}
catch (Exception ex)
{
- new MintLogger("PutGetStatEncryptedObject_Test1",putObjectSignature1,"Tests whether Put/Get/Stat Object with encryption passes",TestStatus.FAIL,(DateTime.Now - startTime),"",ex.Message, ex.ToString(), args).Log();
+ new MintLogger("PutGetStatEncryptedObject_Test1", putObjectSignature1, "Tests whether Put/Get/Stat Object with encryption passes", TestStatus.FAIL, (DateTime.Now - startTime), "", ex.Message, ex.ToString(), args).Log();
}
}
- private async static Task PutGetStatEncryptedObject_Test2(MinioClient minio)
+ private async static Task PutGetStatEncryptedObject_Test2(MinioClient minio)
{
DateTime startTime = DateTime.Now;
string bucketName = GetRandomName(15);
string objectName = GetRandomName(10);
string contentType = "application/octet-stream";
- Dictionary args = new Dictionary
+ var args = new Dictionary
{
- { "bucketName", bucketName},
- {"objectName",objectName},
- {"contentType", contentType},
- {"data","6MB"},
- {"size","6MB"},
+ { "bucketName", bucketName },
+ { "objectName", objectName },
+ { "contentType", contentType },
+ { "data", "6MB" },
+ { "size", "6MB" },
};
try
{
@@ -825,7 +841,7 @@ await minio.PutObjectAsync(bucketName,
objectName,
filestream,
filestream.Length,
- contentType,sse: ssec);
+ contentType, sse: ssec);
await minio.GetObjectAsync(bucketName, objectName,
(stream) =>
@@ -838,33 +854,33 @@ await minio.GetObjectAsync(bucketName, objectName,
Assert.AreEqual(file_read_size, file_write_size);
File.Delete(tempFileName);
- },sse:ssec);
- await minio.StatObjectAsync(bucketName, objectName,sse:ssec);
+ }, sse:ssec);
+ await minio.StatObjectAsync(bucketName, objectName, sse:ssec);
await minio.RemoveObjectAsync(bucketName, objectName);
}
await TearDown(minio, bucketName);
- new MintLogger("PutGetStatEncryptedObject_Test2",putObjectSignature1,"Tests whether Put/Get/Stat multipart upload with encryption passes",TestStatus.PASS,(DateTime.Now - startTime), args:args).Log();
+ new MintLogger("PutGetStatEncryptedObject_Test2", putObjectSignature1, "Tests whether Put/Get/Stat multipart upload with encryption passes", TestStatus.PASS, (DateTime.Now - startTime), args:args).Log();
}
catch (Exception ex)
{
- new MintLogger("PutGetStatEncryptedObject_Test2",putObjectSignature2,"Tests whether Put/Get/Stat multipart upload with encryption passes",TestStatus.FAIL,(DateTime.Now - startTime),"",ex.Message, ex.ToString(), args).Log();
+ new MintLogger("PutGetStatEncryptedObject_Test2", putObjectSignature2, "Tests whether Put/Get/Stat multipart upload with encryption passes", TestStatus.FAIL, (DateTime.Now - startTime), "", ex.Message, ex.ToString(), args).Log();
}
}
- private async static Task PutGetStatEncryptedObject_Test3(MinioClient minio)
+ private async static Task PutGetStatEncryptedObject_Test3(MinioClient minio)
{
DateTime startTime = DateTime.Now;
string bucketName = GetRandomName(15);
string objectName = GetRandomName(10);
string contentType = "application/octet-stream";
- Dictionary args = new Dictionary
+ var args = new Dictionary
{
- { "bucketName", bucketName},
- {"objectName",objectName},
- {"contentType", contentType},
- {"data","6MB"},
- {"size","6MB"},
+ { "bucketName", bucketName },
+ { "objectName", objectName },
+ { "contentType", contentType },
+ { "data", "6MB" },
+ { "size", "6MB" },
};
try
{
@@ -882,7 +898,7 @@ await minio.PutObjectAsync(bucketName,
objectName,
filestream,
filestream.Length,
- contentType,sse: sses3);
+ contentType, sse: sses3);
await minio.GetObjectAsync(bucketName, objectName,
(stream) =>
@@ -901,13 +917,14 @@ await minio.GetObjectAsync(bucketName, objectName,
}
await TearDown(minio, bucketName);
- new MintLogger("PutGetStatEncryptedObject_Test3",putObjectSignature1,"Tests whether Put/Get/Stat multipart upload with encryption passes",TestStatus.PASS,(DateTime.Now - startTime), args:args).Log();
+ new MintLogger("PutGetStatEncryptedObject_Test3", putObjectSignature1, "Tests whether Put/Get/Stat multipart upload with encryption passes", TestStatus.PASS, (DateTime.Now - startTime), args:args).Log();
}
catch (Exception ex)
{
- new MintLogger("PutGetStatEncryptedObject_Test3",putObjectSignature2,"Tests whether Put/Get/Stat multipart upload with encryption passes",TestStatus.FAIL,(DateTime.Now - startTime),"",ex.Message, ex.ToString(), args).Log();
+ new MintLogger("PutGetStatEncryptedObject_Test3", putObjectSignature2, "Tests whether Put/Get/Stat multipart upload with encryption passes", TestStatus.FAIL, (DateTime.Now - startTime), "", ex.Message, ex.ToString(), args).Log();
}
}
+
private async static Task PutObject_Task(MinioClient minio, string bucketName, string objectName, string fileName = null, string contentType = "application/octet-stream", long size = 0, Dictionary metaData = null, MemoryStream mstream = null)
{
DateTime startTime = DateTime.Now;
@@ -935,6 +952,7 @@ await minio.PutObjectAsync(bucketName,
File.Delete(tempFileName);
}
}
+
private async static Task PutObject_Tester(MinioClient minio, string bucketName, string objectName, string fileName = null, string contentType = "application/octet-stream", long size = 0, Dictionary metaData = null, MemoryStream mstream = null)
{
ObjectStat statObject = null;
@@ -984,19 +1002,20 @@ await minio.GetObjectAsync(bucketName, objectName,
}
return statObject;
}
+
private async static Task StatObject_Test1(MinioClient minio)
{
DateTime startTime = DateTime.Now;
string bucketName = GetRandomName(15);
string objectName = GetRandomName(10);
string contentType = "gzip";
- Dictionary args = new Dictionary
+ var args = new Dictionary
{
- { "bucketName", bucketName},
- {"objectName",objectName},
- {"contentType", contentType},
- {"data","1KB"},
- {"size","1KB"},
+ { "bucketName", bucketName },
+ { "objectName", objectName },
+ { "contentType", contentType },
+ { "data", "1KB" },
+ { "size", "1KB" },
};
try
{
@@ -1004,11 +1023,11 @@ private async static Task StatObject_Test1(MinioClient minio)
await PutObject_Tester(minio, bucketName, objectName, null, null, 0, null, rsg.GenerateStreamFromSeed(1 * KB));
await TearDown(minio, bucketName);
- new MintLogger("StatObject_Test1",statObjectSignature,"Tests whether StatObject passes",TestStatus.PASS,(DateTime.Now - startTime), args:args).Log();
+ new MintLogger("StatObject_Test1", statObjectSignature, "Tests whether StatObject passes", TestStatus.PASS, (DateTime.Now - startTime), args:args).Log();
}
catch (MinioException ex)
{
- new MintLogger("StatObject_Test1",statObjectSignature,"Tests whether StatObject passes",TestStatus.FAIL,(DateTime.Now - startTime),"",ex.Message, ex.ToString(), args).Log();
+ new MintLogger("StatObject_Test1", statObjectSignature, "Tests whether StatObject passes", TestStatus.FAIL, (DateTime.Now - startTime), "", ex.Message, ex.ToString(), args).Log();
}
}
@@ -1019,14 +1038,14 @@ private async static Task CopyObject_Test1(MinioClient minio)
string objectName = GetRandomName(10);
string destBucketName = GetRandomName(15);
string destObjectName = GetRandomName(10);
- Dictionary args = new Dictionary
- {
- {"bucketName", bucketName},
- {"objectName",objectName},
- {"destBucketName", destBucketName},
- {"destObjectName", destObjectName},
- {"data","1KB"},
- {"size","1KB"},
+ var args = new Dictionary
+ {
+ { "bucketName", bucketName },
+ { "objectName", objectName },
+ { "destBucketName", destBucketName },
+ { "destObjectName", destObjectName },
+ { "data", "1KB" },
+ { "size", "1KB" },
};
try
{
@@ -1051,11 +1070,11 @@ await minio.PutObjectAsync(bucketName,
await TearDown(minio, bucketName);
await TearDown(minio, destBucketName);
- new MintLogger("CopyObject_Test1",copyObjectSignature,"Tests whether CopyObject passes",TestStatus.PASS,(DateTime.Now - startTime), args:args).Log();
+ new MintLogger("CopyObject_Test1", copyObjectSignature, "Tests whether CopyObject passes", TestStatus.PASS, (DateTime.Now - startTime), args:args).Log();
}
catch (MinioException ex)
{
- new MintLogger("CopyObject_Test1",copyObjectSignature,"Tests whether CopyObject passes",TestStatus.FAIL,(DateTime.Now - startTime),"",ex.Message, ex.ToString(),args).Log();
+ new MintLogger("CopyObject_Test1", copyObjectSignature, "Tests whether CopyObject passes", TestStatus.FAIL, (DateTime.Now - startTime), "", ex.Message, ex.ToString(), args).Log();
}
}
@@ -1066,14 +1085,14 @@ private async static Task CopyObject_Test2(MinioClient minio)
string objectName = GetRandomName(10);
string destBucketName = GetRandomName(15);
string destObjectName = GetRandomName(10);
- Dictionary args = new Dictionary
- {
- {"bucketName", bucketName},
- {"objectName",objectName},
- {"destBucketName", destBucketName},
- {"destObjectName", destObjectName},
- {"data","1KB"},
- {"size","1KB"},
+ var args = new Dictionary
+ {
+ { "bucketName", bucketName },
+ { "objectName", objectName },
+ { "destBucketName", destBucketName },
+ { "destObjectName", destObjectName },
+ { "data", "1KB" },
+ { "size", "1KB" },
};
try
{
@@ -1104,13 +1123,14 @@ await minio.PutObjectAsync(bucketName,
await TearDown(minio, bucketName);
await TearDown(minio, destBucketName);
- new MintLogger("CopyObject_Test2",copyObjectSignature,"Tests whether CopyObject with Etag mismatch passes",TestStatus.PASS,(DateTime.Now - startTime), args:args).Log();
+ new MintLogger("CopyObject_Test2", copyObjectSignature, "Tests whether CopyObject with Etag mismatch passes", TestStatus.PASS, (DateTime.Now - startTime), args:args).Log();
}
catch (MinioException ex)
{
- new MintLogger("CopyObject_Test2",copyObjectSignature, "Tests whether CopyObject with Etag mismatch passes",TestStatus.FAIL,(DateTime.Now - startTime),"",ex.Message, ex.ToString(), args).Log();
+ new MintLogger("CopyObject_Test2", copyObjectSignature, "Tests whether CopyObject with Etag mismatch passes", TestStatus.FAIL, (DateTime.Now - startTime), "", ex.Message, ex.ToString(), args).Log();
}
}
+
private async static Task CopyObject_Test3(MinioClient minio)
{
DateTime startTime = DateTime.Now;
@@ -1118,14 +1138,14 @@ private async static Task CopyObject_Test3(MinioClient minio)
string objectName = GetRandomName(10);
string destBucketName = GetRandomName(15);
string destObjectName = GetRandomName(10);
- Dictionary args = new Dictionary
- {
- {"bucketName", bucketName},
- {"objectName",objectName},
- {"destBucketName", destBucketName},
- {"destObjectName", destObjectName},
- {"data","1KB"},
- {"size","1KB"},
+ var args = new Dictionary
+ {
+ { "bucketName", bucketName },
+ { "objectName", objectName },
+ { "destBucketName", destBucketName },
+ { "destObjectName", destObjectName },
+ { "data", "1KB" },
+ { "size", "1KB" },
};
try
{
@@ -1156,14 +1176,15 @@ await minio.PutObjectAsync(bucketName,
await TearDown(minio, bucketName);
await TearDown(minio, destBucketName);
- new MintLogger("CopyObject_Test3",copyObjectSignature,"Tests whether CopyObject with Etag match passes",TestStatus.PASS,(DateTime.Now - startTime),args:args).Log();
+ new MintLogger("CopyObject_Test3", copyObjectSignature, "Tests whether CopyObject with Etag match passes", TestStatus.PASS, (DateTime.Now - startTime), args:args).Log();
}
catch (MinioException ex)
{
- new MintLogger("CopyObject_Test3",copyObjectSignature,"Tests whether CopyObject with Etag match passes",TestStatus.FAIL,(DateTime.Now - startTime),"",ex.Message, ex.ToString(),args).Log();
+ new MintLogger("CopyObject_Test3", copyObjectSignature, "Tests whether CopyObject with Etag match passes", TestStatus.FAIL, (DateTime.Now - startTime), "", ex.Message, ex.ToString(), args).Log();
}
}
+
private async static Task CopyObject_Test4(MinioClient minio)
{
DateTime startTime = DateTime.Now;
@@ -1171,13 +1192,13 @@ private async static Task CopyObject_Test4(MinioClient minio)
string objectName = GetRandomName(10);
string destBucketName = GetRandomName(15);
string destObjectName = GetRandomName(10);
- Dictionary args = new Dictionary
+ var args = new Dictionary
{
- {"bucketName", bucketName},
- {"objectName",objectName},
- {"destBucketName", destBucketName},
- {"data","1KB"},
- {"size","1KB"},
+ { "bucketName", bucketName },
+ { "objectName", objectName },
+ { "destBucketName", destBucketName },
+ { "data", "1KB" },
+ { "size", "1KB" },
};
try
{
@@ -1206,29 +1227,30 @@ await minio.PutObjectAsync(bucketName,
await minio.RemoveObjectAsync(destBucketName, objectName);
await TearDown(minio, bucketName);
await TearDown(minio, destBucketName);
- new MintLogger("CopyObject_Test4",copyObjectSignature,"Tests whether CopyObject defaults targetName to objectName",TestStatus.PASS,(DateTime.Now - startTime),args:args).Log();
+ new MintLogger("CopyObject_Test4", copyObjectSignature, "Tests whether CopyObject defaults targetName to objectName", TestStatus.PASS, (DateTime.Now - startTime), args:args).Log();
}
catch (MinioException ex)
{
- new MintLogger("CopyObject_Test4",copyObjectSignature,"Tests whether CopyObject defaults targetName to objectName",TestStatus.FAIL,(DateTime.Now - startTime),"",ex.Message, ex.ToString(),args).Log();
+ new MintLogger("CopyObject_Test4", copyObjectSignature, "Tests whether CopyObject defaults targetName to objectName", TestStatus.FAIL, (DateTime.Now - startTime), "", ex.Message, ex.ToString(), args).Log();
}
}
+
private async static Task CopyObject_Test5(MinioClient minio)
{
DateTime startTime = DateTime.Now;
- string bucketName = GetRandomName(15);
+ string bucketName = GetRandomName(15);
string objectName = GetRandomName(10);
string destBucketName = GetRandomName(15);
string destObjectName = GetRandomName(10);
- Dictionary args = new Dictionary
- {
- {"bucketName", bucketName},
- {"objectName",objectName},
- {"destBucketName", destBucketName},
- {"destObjectName", destObjectName},
- {"data","6MB"},
- {"size","6MB"},
+ var args = new Dictionary
+ {
+ { "bucketName", bucketName },
+ { "objectName", objectName },
+ { "destBucketName", destBucketName },
+ { "destObjectName", destObjectName },
+ { "data", "6MB" },
+ { "size", "6MB" },
};
try
{
@@ -1261,17 +1283,17 @@ await minio.PutObjectAsync(bucketName,
await TearDown(minio, bucketName);
await TearDown(minio, destBucketName);
- new MintLogger("CopyObject_Test5",copyObjectSignature,"Tests whether CopyObject multi-part copy upload for large files works",TestStatus.PASS,(DateTime.Now - startTime),args:args).Log();
+ new MintLogger("CopyObject_Test5", copyObjectSignature, "Tests whether CopyObject multi-part copy upload for large files works", TestStatus.PASS, (DateTime.Now - startTime), args:args).Log();
}
catch (MinioException ex)
{
if (ex.message.Equals("A header you provided implies functionality that is not implemented"))
{
- new MintLogger("CopyObject_Test5",copyObjectSignature,"Tests whether CopyObject multi-part copy upload for large files works",TestStatus.NA,(DateTime.Now - startTime),args:args).Log();
+ new MintLogger("CopyObject_Test5", copyObjectSignature, "Tests whether CopyObject multi-part copy upload for large files works", TestStatus.NA, (DateTime.Now - startTime), args:args).Log();
}
else
{
- new MintLogger("CopyObject_Test5",copyObjectSignature,"Tests whether CopyObject multi-part copy upload for large files works",TestStatus.FAIL,(DateTime.Now - startTime),"",ex.Message, ex.ToString(),args).Log();
+ new MintLogger("CopyObject_Test5", copyObjectSignature, "Tests whether CopyObject multi-part copy upload for large files works", TestStatus.FAIL, (DateTime.Now - startTime), "", ex.Message, ex.ToString(), args).Log();
}
}
@@ -1284,14 +1306,14 @@ private async static Task CopyObject_Test6(MinioClient minio)
string objectName = GetRandomName(10);
string destBucketName = GetRandomName(15);
string destObjectName = GetRandomName(10);
- Dictionary args = new Dictionary
- {
- {"bucketName", bucketName},
- {"objectName",objectName},
- {"destBucketName", destBucketName},
- {"destObjectName", destObjectName},
- {"data","1KB"},
- {"size","1KB"},
+ var args = new Dictionary
+ {
+ { "bucketName", bucketName },
+ { "objectName", objectName },
+ { "destBucketName", destBucketName },
+ { "destObjectName", destObjectName },
+ { "data", "1KB" },
+ { "size", "1KB" },
};
try
{
@@ -1323,14 +1345,15 @@ await minio.PutObjectAsync(bucketName,
await TearDown(minio, bucketName);
await TearDown(minio, destBucketName);
- new MintLogger("CopyObject_Test6",copyObjectSignature,"Tests whether CopyObject with positive test for modified date passes",TestStatus.PASS,(DateTime.Now - startTime),args:args).Log();
+ new MintLogger("CopyObject_Test6", copyObjectSignature, "Tests whether CopyObject with positive test for modified date passes", TestStatus.PASS, (DateTime.Now - startTime), args:args).Log();
}
catch (MinioException ex)
{
- new MintLogger("CopyObject_Test6",copyObjectSignature,"Tests whether CopyObject with positive test for modified date passes",TestStatus.FAIL,(DateTime.Now - startTime),"",ex.Message, ex.ToString(),args).Log();
+ new MintLogger("CopyObject_Test6", copyObjectSignature, "Tests whether CopyObject with positive test for modified date passes", TestStatus.FAIL, (DateTime.Now - startTime), "", ex.Message, ex.ToString(), args).Log();
}
}
+
private async static Task CopyObject_Test7(MinioClient minio)
{
DateTime startTime = DateTime.Now;
@@ -1338,14 +1361,14 @@ private async static Task CopyObject_Test7(MinioClient minio)
string objectName = GetRandomName(10);
string destBucketName = GetRandomName(15);
string destObjectName = GetRandomName(10);
- Dictionary args = new Dictionary
- {
- {"bucketName", bucketName},
- {"objectName",objectName},
- {"destBucketName", destBucketName},
- {"destObjectName", destObjectName},
- {"data","1KB"},
- {"size","1KB"},
+ var args = new Dictionary
+ {
+ { "bucketName", bucketName },
+ { "objectName", objectName },
+ { "destBucketName", destBucketName },
+ { "destObjectName", destObjectName },
+ { "data", "1KB" },
+ { "size", "1KB" },
};
try
{
@@ -1372,7 +1395,7 @@ await minio.PutObjectAsync(bucketName,
}
catch (Exception ex)
{
- Assert.AreEqual("MinIO API responded with message=At least one of the pre-conditions you specified did not hold",ex.Message);
+ Assert.AreEqual("MinIO API responded with message=At least one of the pre-conditions you specified did not hold", ex.Message);
}
await minio.RemoveObjectAsync(bucketName, objectName);
@@ -1380,11 +1403,11 @@ await minio.PutObjectAsync(bucketName,
await TearDown(minio, bucketName);
await TearDown(minio, destBucketName);
- new MintLogger("CopyObject_Test7",copyObjectSignature,"Tests whether CopyObject with negative test for modified date passes",TestStatus.PASS,(DateTime.Now - startTime),args:args).Log();
+ new MintLogger("CopyObject_Test7", copyObjectSignature, "Tests whether CopyObject with negative test for modified date passes", TestStatus.PASS, (DateTime.Now - startTime), args:args).Log();
}
catch (MinioException ex)
{
- new MintLogger("CopyObject_Test7",copyObjectSignature,"Tests whether CopyObject with negative test for modified date passes",TestStatus.FAIL,(DateTime.Now - startTime),"",ex.Message, ex.ToString(),args).Log();
+ new MintLogger("CopyObject_Test7", copyObjectSignature, "Tests whether CopyObject with negative test for modified date passes", TestStatus.FAIL, (DateTime.Now - startTime), "", ex.Message, ex.ToString(), args).Log();
}
}
@@ -1396,15 +1419,15 @@ private async static Task CopyObject_Test8(MinioClient minio)
string objectName = GetRandomName(10);
string destBucketName = GetRandomName(15);
string destObjectName = GetRandomName(10);
- Dictionary args = new Dictionary
- {
- {"bucketName", bucketName},
- {"objectName",objectName},
- {"destBucketName", destBucketName},
- {"destObjectName", destObjectName},
- {"data","1KB"},
- {"size","1KB"},
- {"copyconditions","x-amz-metadata-directive:REPLACE"},
+ var args = new Dictionary
+ {
+ { "bucketName", bucketName },
+ { "objectName", objectName },
+ { "destBucketName", destBucketName },
+ { "destObjectName", destObjectName },
+ { "data", "1KB" },
+ { "size", "1KB" },
+ { "copyconditions", "x-amz-metadata-directive:REPLACE" },
};
try
{
@@ -1414,7 +1437,7 @@ private async static Task CopyObject_Test8(MinioClient minio)
{
await minio.PutObjectAsync(bucketName,
objectName,
- filestream, filestream.Length, metaData:new Dictionary{{"X-Amz-Meta-Orig", "orig-val with spaces"}});
+ filestream, filestream.Length, metaData:new Dictionary{{"X-Amz-Meta-Orig", "orig-val with spaces"}});
}
ObjectStat stats = await minio.StatObjectAsync(bucketName, objectName);
@@ -1424,12 +1447,12 @@ await minio.PutObjectAsync(bucketName,
copyCond.SetReplaceMetadataDirective();
// set custom metadata
- Dictionary metadata = new Dictionary()
+ var metadata = new Dictionary
{
- { "Content-Type", "application/css"},
- {"X-Amz-Meta-Mynewkey","test test"}
+ { "Content-Type", "application/css" },
+ { "X-Amz-Meta-Mynewkey", "test test" }
};
- await minio.CopyObjectAsync(bucketName, objectName, destBucketName, destObjectName,copyConditions:copyCond,metadata: metadata);
+ await minio.CopyObjectAsync(bucketName, objectName, destBucketName, destObjectName, copyConditions:copyCond, metadata: metadata);
ObjectStat dstats = await minio.StatObjectAsync(destBucketName, destObjectName);
Assert.IsTrue(dstats.metaData["X-Amz-Meta-Mynewkey"] != null);
@@ -1439,11 +1462,11 @@ await minio.PutObjectAsync(bucketName,
await TearDown(minio, bucketName);
await TearDown(minio, destBucketName);
- new MintLogger("CopyObject_Test8",copyObjectSignature,"Tests whether CopyObject with metadata replacement passes",TestStatus.PASS,(DateTime.Now - startTime), args:args).Log();
+ new MintLogger("CopyObject_Test8", copyObjectSignature, "Tests whether CopyObject with metadata replacement passes", TestStatus.PASS, (DateTime.Now - startTime), args:args).Log();
}
catch (MinioException ex)
{
- new MintLogger("CopyObject_Test8",copyObjectSignature,"Tests whether CopyObject with metadata replacement passes",TestStatus.FAIL,(DateTime.Now - startTime),"",ex.Message, ex.ToString(),args).Log();
+ new MintLogger("CopyObject_Test8", copyObjectSignature, "Tests whether CopyObject with metadata replacement passes", TestStatus.FAIL, (DateTime.Now - startTime), "", ex.Message, ex.ToString(), args).Log();
}
}
@@ -1454,14 +1477,14 @@ private async static Task EncryptedCopyObject_Test1(MinioClient minio)
string objectName = GetRandomName(10);
string destBucketName = GetRandomName(15);
string destObjectName = GetRandomName(10);
- Dictionary args = new Dictionary
- {
- {"bucketName", bucketName},
- {"objectName",objectName},
- {"destBucketName", destBucketName},
- {"destObjectName", destObjectName},
- {"data","1KB"},
- {"size","1KB"},
+ var args = new Dictionary
+ {
+ { "bucketName", bucketName },
+ { "objectName", objectName },
+ { "destBucketName", destBucketName },
+ { "destObjectName", destObjectName },
+ { "data", "1KB" },
+ { "size", "1KB" },
};
try
{
@@ -1484,10 +1507,10 @@ await minio.PutObjectAsync(bucketName,
filestream, filestream.Length, null, sse:ssec);
}
- await minio.CopyObjectAsync(bucketName, objectName, destBucketName, destObjectName,sseSrc:sseCpy,sseDest:ssecDst);
+ await minio.CopyObjectAsync(bucketName, objectName, destBucketName, destObjectName, sseSrc:sseCpy, sseDest:ssecDst);
string outFileName = "outFileName";
- await minio.GetObjectAsync(destBucketName, destObjectName, outFileName,sse:ssecDst);
+ await minio.GetObjectAsync(destBucketName, destObjectName, outFileName, sse:ssecDst);
File.Delete(outFileName);
await minio.RemoveObjectAsync(bucketName, objectName);
await minio.RemoveObjectAsync(destBucketName, destObjectName);
@@ -1495,11 +1518,11 @@ await minio.PutObjectAsync(bucketName,
await TearDown(minio, bucketName);
await TearDown(minio, destBucketName);
- new MintLogger("EncryptedCopyObject_Test1",copyObjectSignature,"Tests whether encrypted CopyObject passes",TestStatus.PASS,(DateTime.Now - startTime), args:args).Log();
+ new MintLogger("EncryptedCopyObject_Test1", copyObjectSignature, "Tests whether encrypted CopyObject passes", TestStatus.PASS, (DateTime.Now - startTime), args:args).Log();
}
catch (MinioException ex)
{
- new MintLogger("EncryptedCopyObject_Test1",copyObjectSignature,"Tests whether encrypted CopyObject passes",TestStatus.FAIL,(DateTime.Now - startTime),"",ex.Message, ex.ToString(),args).Log();
+ new MintLogger("EncryptedCopyObject_Test1", copyObjectSignature, "Tests whether encrypted CopyObject passes", TestStatus.FAIL, (DateTime.Now - startTime), "", ex.Message, ex.ToString(), args).Log();
}
}
@@ -1510,14 +1533,14 @@ private async static Task EncryptedCopyObject_Test2(MinioClient minio)
string objectName = GetRandomName(10);
string destBucketName = GetRandomName(15);
string destObjectName = GetRandomName(10);
- Dictionary args = new Dictionary
- {
- {"bucketName", bucketName},
- {"objectName",objectName},
- {"destBucketName", destBucketName},
- {"destObjectName", destObjectName},
- {"data","1KB"},
- {"size","1KB"},
+ var args = new Dictionary
+ {
+ { "bucketName", bucketName },
+ { "objectName", objectName },
+ { "destBucketName", destBucketName },
+ { "destObjectName", destObjectName },
+ { "data", "1KB" },
+ { "size", "1KB" },
};
try
{
@@ -1537,7 +1560,7 @@ await minio.PutObjectAsync(bucketName,
filestream, filestream.Length, null, sse:ssec);
}
- await minio.CopyObjectAsync(bucketName, objectName, destBucketName, destObjectName,sseSrc:sseCpy,sseDest:null);
+ await minio.CopyObjectAsync(bucketName, objectName, destBucketName, destObjectName, sseSrc:sseCpy, sseDest:null);
string outFileName = "outFileName";
await minio.GetObjectAsync(destBucketName, destObjectName, outFileName);
@@ -1548,11 +1571,11 @@ await minio.PutObjectAsync(bucketName,
await TearDown(minio, bucketName);
await TearDown(minio, destBucketName);
- new MintLogger("EncryptedCopyObject_Test2",copyObjectSignature,"Tests whether encrypted CopyObject passes",TestStatus.PASS,(DateTime.Now - startTime), args:args).Log();
+ new MintLogger("EncryptedCopyObject_Test2", copyObjectSignature, "Tests whether encrypted CopyObject passes", TestStatus.PASS, (DateTime.Now - startTime), args:args).Log();
}
catch (MinioException ex)
{
- new MintLogger("EncryptedCopyObject_Test2",copyObjectSignature,"Tests whether encrypted CopyObject passes",TestStatus.FAIL,(DateTime.Now - startTime),"",ex.Message, ex.ToString(),args).Log();
+ new MintLogger("EncryptedCopyObject_Test2", copyObjectSignature, "Tests whether encrypted CopyObject passes", TestStatus.FAIL, (DateTime.Now - startTime), "", ex.Message, ex.ToString(), args).Log();
}
}
@@ -1563,14 +1586,14 @@ private async static Task EncryptedCopyObject_Test3(MinioClient minio)
string objectName = GetRandomName(10);
string destBucketName = GetRandomName(15);
string destObjectName = GetRandomName(10);
- Dictionary args = new Dictionary
- {
- {"bucketName", bucketName},
- {"objectName",objectName},
- {"destBucketName", destBucketName},
- {"destObjectName", destObjectName},
- {"data","1KB"},
- {"size","1KB"},
+ var args = new Dictionary
+ {
+ { "bucketName", bucketName },
+ { "objectName", objectName },
+ { "destBucketName", destBucketName },
+ { "destObjectName", destObjectName },
+ { "data", "1KB" },
+ { "size", "1KB" },
};
try
{
@@ -1591,7 +1614,7 @@ await minio.PutObjectAsync(bucketName,
filestream, filestream.Length, null, sse:ssec);
}
- await minio.CopyObjectAsync(bucketName, objectName, destBucketName, destObjectName,sseSrc:sseCpy,sseDest:sses3);
+ await minio.CopyObjectAsync(bucketName, objectName, destBucketName, destObjectName, sseSrc:sseCpy, sseDest:sses3);
string outFileName = "outFileName";
await minio.GetObjectAsync(destBucketName, destObjectName, outFileName);
@@ -1602,11 +1625,11 @@ await minio.PutObjectAsync(bucketName,
await TearDown(minio, bucketName);
await TearDown(minio, destBucketName);
- new MintLogger("EncryptedCopyObject_Test3",copyObjectSignature,"Tests whether encrypted CopyObject passes",TestStatus.PASS,(DateTime.Now - startTime), args:args).Log();
+ new MintLogger("EncryptedCopyObject_Test3", copyObjectSignature, "Tests whether encrypted CopyObject passes", TestStatus.PASS, (DateTime.Now - startTime), args:args).Log();
}
catch (MinioException ex)
{
- new MintLogger("EncryptedCopyObject_Test3",copyObjectSignature,"Tests whether encrypted CopyObject passes",TestStatus.FAIL,(DateTime.Now - startTime),"",ex.Message, ex.ToString(),args).Log();
+ new MintLogger("EncryptedCopyObject_Test3", copyObjectSignature, "Tests whether encrypted CopyObject passes", TestStatus.FAIL, (DateTime.Now - startTime), "", ex.Message, ex.ToString(), args).Log();
}
}
@@ -1617,14 +1640,14 @@ private async static Task EncryptedCopyObject_Test4(MinioClient minio)
string objectName = GetRandomName(10);
string destBucketName = GetRandomName(15);
string destObjectName = GetRandomName(10);
- Dictionary args = new Dictionary
- {
- {"bucketName", bucketName},
- {"objectName",objectName},
- {"destBucketName", destBucketName},
- {"destObjectName", destObjectName},
- {"data","1KB"},
- {"size","1KB"},
+ var args = new Dictionary
+ {
+ { "bucketName", bucketName },
+ { "objectName", objectName },
+ { "destBucketName", destBucketName },
+ { "destObjectName", destObjectName },
+ { "data", "1KB" },
+ { "size", "1KB" },
};
try
{
@@ -1641,7 +1664,7 @@ await minio.PutObjectAsync(bucketName,
filestream, filestream.Length, null, sse:sses3);
}
- await minio.CopyObjectAsync(bucketName, objectName, destBucketName, destObjectName,sseSrc:null,sseDest:sses3);
+ await minio.CopyObjectAsync(bucketName, objectName, destBucketName, destObjectName, sseSrc:null, sseDest:sses3);
string outFileName = "outFileName";
await minio.GetObjectAsync(destBucketName, destObjectName, outFileName);
@@ -1652,24 +1675,25 @@ await minio.PutObjectAsync(bucketName,
await TearDown(minio, bucketName);
await TearDown(minio, destBucketName);
- new MintLogger("EncryptedCopyObject_Test4",copyObjectSignature,"Tests whether encrypted CopyObject passes",TestStatus.PASS,(DateTime.Now - startTime), args:args).Log();
+ new MintLogger("EncryptedCopyObject_Test4", copyObjectSignature, "Tests whether encrypted CopyObject passes", TestStatus.PASS, (DateTime.Now - startTime), args:args).Log();
}
catch (MinioException ex)
{
- new MintLogger("EncryptedCopyObject_Test4",copyObjectSignature,"Tests whether encrypted CopyObject passes",TestStatus.FAIL,(DateTime.Now - startTime),"",ex.Message, ex.ToString(),args).Log();
+ new MintLogger("EncryptedCopyObject_Test4", copyObjectSignature, "Tests whether encrypted CopyObject passes", TestStatus.FAIL, (DateTime.Now - startTime), "", ex.Message, ex.ToString(), args).Log();
}
}
+
private async static Task GetObject_Test1(MinioClient minio)
{
DateTime startTime = DateTime.Now;
string bucketName = GetRandomName(15);
string objectName = GetRandomName(10);
string contentType = null;
- Dictionary args = new Dictionary
+ var args = new Dictionary
{
- {"bucketName", bucketName},
- {"objectName",objectName},
- {"contentType", contentType},
+ { "bucketName", bucketName },
+ { "objectName", objectName },
+ { "contentType", contentType },
};
try
{
@@ -1703,25 +1727,26 @@ await minio.GetObjectAsync(bucketName, objectName,
}
await TearDown(minio, bucketName);
- new MintLogger("GetObject_Test1",getObjectSignature1,"Tests whether GetObject as stream works",TestStatus.PASS,(DateTime.Now - startTime),args:args).Log();
+ new MintLogger("GetObject_Test1", getObjectSignature1, "Tests whether GetObject as stream works", TestStatus.PASS, (DateTime.Now - startTime), args:args).Log();
}
catch (MinioException ex)
{
- new MintLogger("GetObject_Test1",getObjectSignature1,"Tests whether GetObject as stream works",TestStatus.FAIL,(DateTime.Now - startTime),"",ex.Message, ex.ToString(),args).Log();
+ new MintLogger("GetObject_Test1", getObjectSignature1, "Tests whether GetObject as stream works", TestStatus.FAIL, (DateTime.Now - startTime), "", ex.Message, ex.ToString(), args).Log();
}
}
+
private async static Task GetObject_Test2(MinioClient minio)
{
DateTime startTime = DateTime.Now;
string bucketName = GetRandomName(15);
string objectName = GetRandomName(10);
string fileName = GetRandomName(10);
- Dictionary args = new Dictionary
+ var args = new Dictionary
{
- {"bucketName", bucketName},
- {"objectName",objectName},
- {"fileName", fileName},
+ { "bucketName", bucketName },
+ { "objectName", objectName },
+ { "fileName", fileName },
};
try
{
@@ -1737,27 +1762,28 @@ private async static Task GetObject_Test2(MinioClient minio)
}
await TearDown(minio, bucketName);
- new MintLogger("GetObject_Test2",getObjectSignature1,"Tests for non-existent GetObject",TestStatus.PASS,(DateTime.Now - startTime),args:args).Log();
+ new MintLogger("GetObject_Test2", getObjectSignature1, "Tests for non-existent GetObject", TestStatus.PASS, (DateTime.Now - startTime), args:args).Log();
}
catch (MinioException ex)
{
- new MintLogger("GetObject_Test2",getObjectSignature1,"Tests for non-existent GetObject",TestStatus.FAIL,(DateTime.Now - startTime),"",ex.Message, ex.ToString(),args).Log();
+ new MintLogger("GetObject_Test2", getObjectSignature1, "Tests for non-existent GetObject", TestStatus.FAIL, (DateTime.Now - startTime), "", ex.Message, ex.ToString(), args).Log();
}
}
+
private async static Task GetObject_Test3(MinioClient minio)
{
DateTime startTime = DateTime.Now;
string bucketName = GetRandomName(15);
string objectName = GetRandomName(10);
string contentType = null;
- Dictionary args = new Dictionary
+ var args = new Dictionary
{
- {"bucketName", bucketName},
- {"objectName",objectName},
- {"contentType", contentType},
- {"size", "1024L"},
- {"length", "10L"},
+ { "bucketName", bucketName },
+ { "objectName", objectName },
+ { "contentType", contentType },
+ { "size", "1024L" },
+ { "length", "10L" },
};
try
{
@@ -1789,25 +1815,26 @@ await minio.GetObjectAsync(bucketName, objectName, 1024L, file_write_size,
await minio.RemoveObjectAsync(bucketName, objectName);
}
await TearDown(minio, bucketName);
- new MintLogger("GetObject_Test3",getObjectSignature2,"Tests whether GetObject returns all the data",TestStatus.PASS,(DateTime.Now - startTime), args:args).Log();
+ new MintLogger("GetObject_Test3", getObjectSignature2, "Tests whether GetObject returns all the data", TestStatus.PASS, (DateTime.Now - startTime), args:args).Log();
}
catch (MinioException ex)
{
- new MintLogger("GetObject_Test3",getObjectSignature2,"Tests whether GetObject returns all the data",TestStatus.FAIL,(DateTime.Now - startTime),"",ex.Message, ex.ToString(),args).Log();
+ new MintLogger("GetObject_Test3", getObjectSignature2, "Tests whether GetObject returns all the data", TestStatus.FAIL, (DateTime.Now - startTime), "", ex.Message, ex.ToString(), args).Log();
}
}
+
private async static Task FGetObject_Test1(MinioClient minio)
{
DateTime startTime = DateTime.Now;
string bucketName = GetRandomName(15);
string objectName = GetRandomName(10);
string outFileName = "outFileName";
- Dictionary args = new Dictionary
+ var args = new Dictionary
{
- {"bucketName", bucketName},
- {"objectName",objectName},
- {"fileName", outFileName},
+ { "bucketName", bucketName },
+ { "objectName", objectName },
+ { "fileName", outFileName },
};
try
{
@@ -1823,26 +1850,26 @@ await minio.PutObjectAsync(bucketName,
File.Delete(outFileName);
await minio.RemoveObjectAsync(bucketName, objectName);
await TearDown(minio, bucketName);
- new MintLogger("FGetObject_Test1",getObjectSignature3,"Tests whether FGetObject passes for small upload",TestStatus.PASS,(DateTime.Now - startTime), args:args).Log();
+ new MintLogger("FGetObject_Test1", getObjectSignature3, "Tests whether FGetObject passes for small upload", TestStatus.PASS, (DateTime.Now - startTime), args:args).Log();
}
catch (MinioException ex)
{
- new MintLogger("FGetObject_Test1",getObjectSignature3,"Tests whether FGetObject passes for small upload",TestStatus.FAIL,(DateTime.Now - startTime),"",ex.Message, ex.ToString(),args).Log();
+ new MintLogger("FGetObject_Test1", getObjectSignature3, "Tests whether FGetObject passes for small upload", TestStatus.FAIL, (DateTime.Now - startTime), "", ex.Message, ex.ToString(), args).Log();
}
}
private async static Task FPutObject_Test1(MinioClient minio)
{
- DateTime startTime = DateTime.Now;
- string bucketName = GetRandomName(15);
- string objectName = GetRandomName(10);
- string fileName = CreateFile(6 * MB, dataFile6MB);
- Dictionary args = new Dictionary
+ DateTime startTime = DateTime.Now;
+ string bucketName = GetRandomName(15);
+ string objectName = GetRandomName(10);
+ string fileName = CreateFile(6 * MB, dataFile6MB);
+ var args = new Dictionary
{
- {"bucketName", bucketName},
- {"objectName",objectName},
- {"fileName", fileName},
+ { "bucketName", bucketName },
+ { "objectName", objectName },
+ { "fileName", fileName },
};
try
{
@@ -1854,11 +1881,11 @@ await minio.PutObjectAsync(bucketName,
await minio.RemoveObjectAsync(bucketName, objectName);
await TearDown(minio, bucketName);
- new MintLogger("FPutObject_Test1",putObjectSignature2,"Tests whether FPutObject for multipart upload passes",TestStatus.PASS,(DateTime.Now - startTime), args:args).Log();
+ new MintLogger("FPutObject_Test1", putObjectSignature2, "Tests whether FPutObject for multipart upload passes", TestStatus.PASS, (DateTime.Now - startTime), args: args).Log();
}
catch (MinioException ex)
{
- new MintLogger("FPutObject_Test1",putObjectSignature2,"Tests whether FPutObject for multipart upload passes",TestStatus.FAIL,(DateTime.Now - startTime),"",ex.Message, ex.ToString(),args).Log();
+ new MintLogger("FPutObject_Test1", putObjectSignature2, "Tests whether FPutObject for multipart upload passes", TestStatus.FAIL, (DateTime.Now - startTime), "", ex.Message, ex.ToString(), args).Log();
}
if (!IsMintEnv())
{
@@ -1872,12 +1899,12 @@ private async static Task FPutObject_Test2(MinioClient minio)
string bucketName = GetRandomName(15);
string objectName = GetRandomName(10);
string fileName = CreateFile(10 * KB, dataFile10KB);
- Dictionary args = new Dictionary
- {
- {"bucketName", bucketName},
- {"objectName",objectName},
- {"fileName", fileName},
- };
+ var args = new Dictionary
+ {
+ { "bucketName", bucketName },
+ { "objectName", objectName },
+ { "fileName", fileName },
+ };
try
{
await Setup_Test(minio, bucketName);
@@ -1887,11 +1914,11 @@ await minio.PutObjectAsync(bucketName,
await minio.RemoveObjectAsync(bucketName, objectName);
await TearDown(minio, bucketName);
- new MintLogger("FPutObject_Test2",putObjectSignature2,"Tests whether FPutObject for small upload passes",TestStatus.PASS,(DateTime.Now - startTime),args:args).Log();
+ new MintLogger("FPutObject_Test2", putObjectSignature2, "Tests whether FPutObject for small upload passes", TestStatus.PASS, (DateTime.Now - startTime), args:args).Log();
}
catch (MinioException ex)
{
- new MintLogger("FPutObject_Test2",putObjectSignature2,"Tests whether FPutObject for small upload passes",TestStatus.FAIL,(DateTime.Now - startTime),"",ex.Message, ex.ToString(),args).Log();
+ new MintLogger("FPutObject_Test2", putObjectSignature2, "Tests whether FPutObject for small upload passes", TestStatus.FAIL, (DateTime.Now - startTime), "", ex.Message, ex.ToString(), args).Log();
}
if (!IsMintEnv())
{
@@ -1905,33 +1932,33 @@ private async static Task ListObjects_Test1(MinioClient minio)
string bucketName = GetRandomName(15);
string prefix = "minix";
string objectName = prefix + GetRandomName(10);
- Dictionary args = new Dictionary
+ var args = new Dictionary
{
- {"bucketName", bucketName},
- {"objectName",objectName},
- {"prefix", prefix},
- {"recursive","false"},
+ { "bucketName", bucketName },
+ { "objectName", objectName },
+ { "prefix", prefix },
+ { "recursive", "false" },
};
try
{
await Setup_Test(minio, bucketName);
Task[] tasks = new Task[2];
for (int i = 0; i < 2; i++) {
- tasks[i]= PutObject_Task(minio, bucketName, objectName + i.ToString(), null, null, 0, null, rsg.GenerateStreamFromSeed(1));
+ tasks[i] = PutObject_Task(minio, bucketName, objectName + i.ToString(), null, null, 0, null, rsg.GenerateStreamFromSeed(1));
}
await Task.WhenAll(tasks);
- ListObjects_Test(minio, bucketName, prefix, 2,false).Wait();
+ ListObjects_Test(minio, bucketName, prefix, 2, false).Wait();
System.Threading.Thread.Sleep(2000);
await minio.RemoveObjectAsync(bucketName, objectName + "0");
await minio.RemoveObjectAsync(bucketName, objectName + "1");
await TearDown(minio, bucketName);
- new MintLogger("ListObjects_Test1",listObjectsSignature,"Tests whether ListObjects lists all objects matching a prefix non-recursive",TestStatus.PASS,(DateTime.Now - startTime),args:args).Log();
+ new MintLogger("ListObjects_Test1", listObjectsSignature, "Tests whether ListObjects lists all objects matching a prefix non-recursive", TestStatus.PASS, (DateTime.Now - startTime), args:args).Log();
}
catch (MinioException ex)
{
- new MintLogger("ListObjects_Test1",listObjectsSignature,"Tests whether ListObjects lists all objects matching a prefix non-recursive",TestStatus.FAIL,(DateTime.Now - startTime),"",ex.Message, ex.ToString(), args).Log();
+ new MintLogger("ListObjects_Test1", listObjectsSignature, "Tests whether ListObjects lists all objects matching a prefix non-recursive", TestStatus.FAIL, (DateTime.Now - startTime), "", ex.Message, ex.ToString(), args).Log();
}
}
@@ -1939,9 +1966,9 @@ private async static Task ListObjects_Test2(MinioClient minio)
{
DateTime startTime = DateTime.Now;
string bucketName = GetRandomName(15);
- Dictionary args = new Dictionary
+ var args = new Dictionary
{
- {"bucketName", bucketName},
+ { "bucketName", bucketName },
};
try
{
@@ -1949,33 +1976,33 @@ private async static Task ListObjects_Test2(MinioClient minio)
ListObjects_Test(minio, bucketName, null, 0).Wait(1000);
await TearDown(minio, bucketName);
- new MintLogger("ListObjects_Test2",listObjectsSignature,"Tests whether ListObjects passes when bucket is empty",TestStatus.PASS,(DateTime.Now - startTime),args:args).Log();
+ new MintLogger("ListObjects_Test2", listObjectsSignature, "Tests whether ListObjects passes when bucket is empty", TestStatus.PASS, (DateTime.Now - startTime), args:args).Log();
}
catch (MinioException ex)
{
- new MintLogger("ListObjects_Test2",listObjectsSignature,"Tests whether ListObjects passes when bucket is empty",TestStatus.FAIL,(DateTime.Now - startTime),"",ex.Message, ex.ToString(), args).Log();
+ new MintLogger("ListObjects_Test2", listObjectsSignature, "Tests whether ListObjects passes when bucket is empty", TestStatus.FAIL, (DateTime.Now - startTime), "", ex.Message, ex.ToString(), args).Log();
}
}
- private async static Task ListObjects_Test3(MinioClient minio)
+ private async static Task ListObjects_Test3(MinioClient minio)
{
DateTime startTime = DateTime.Now;
string bucketName = GetRandomName(15);
string prefix = "minix";
string objectName = prefix + "/"+ GetRandomName(10) + "/suffix";
- Dictionary args = new Dictionary
+ var args = new Dictionary
{
- {"bucketName", bucketName},
- {"objectName",objectName},
- {"prefix", prefix},
- {"recursive", "true"}
+ { "bucketName", bucketName },
+ { "objectName", objectName },
+ { "prefix", prefix },
+ { "recursive", "true" }
};
try
{
await Setup_Test(minio, bucketName);
Task[] tasks = new Task[2];
for (int i = 0; i < 2; i++) {
- tasks[i]= PutObject_Task(minio, bucketName, objectName + i.ToString(), null, null, 0, null, rsg.GenerateStreamFromSeed(1*KB));
+ tasks[i] = PutObject_Task(minio, bucketName, objectName + i.ToString(), null, null, 0, null, rsg.GenerateStreamFromSeed(1*KB));
}
await Task.WhenAll(tasks);
@@ -1984,11 +2011,11 @@ private async static Task ListObjects_Test3(MinioClient minio)
await minio.RemoveObjectAsync(bucketName, objectName + "0");
await minio.RemoveObjectAsync(bucketName, objectName + "1");
await TearDown(minio, bucketName);
- new MintLogger("ListObjects_Test3",listObjectsSignature,"Tests whether ListObjects lists all objects matching a prefix and recursive",TestStatus.PASS,(DateTime.Now - startTime),args:args).Log();
+ new MintLogger("ListObjects_Test3", listObjectsSignature, "Tests whether ListObjects lists all objects matching a prefix and recursive", TestStatus.PASS, (DateTime.Now - startTime), args:args).Log();
}
catch (MinioException ex)
{
- new MintLogger("ListObjects_Test3",listObjectsSignature,"Tests whether ListObjects lists all objects matching a prefix and recursive",TestStatus.FAIL,(DateTime.Now - startTime),"",ex.Message, ex.ToString(), args).Log();
+ new MintLogger("ListObjects_Test3", listObjectsSignature, "Tests whether ListObjects lists all objects matching a prefix and recursive", TestStatus.FAIL, (DateTime.Now - startTime), "", ex.Message, ex.ToString(), args).Log();
}
}
@@ -1997,18 +2024,18 @@ private async static Task ListObjects_Test4(MinioClient minio)
DateTime startTime = DateTime.Now;
string bucketName = GetRandomName(15);
string objectName = GetRandomName(10);
- Dictionary args = new Dictionary
+ var args = new Dictionary
{
- {"bucketName", bucketName},
- {"objectName",objectName},
- {"recursive", "false"}
+ { "bucketName", bucketName },
+ { "objectName", objectName },
+ { "recursive", "false" }
};
try
{
await Setup_Test(minio, bucketName);
Task[] tasks = new Task[2];
for (int i = 0; i < 2; i++) {
- tasks[i]= PutObject_Task(minio, bucketName, objectName + i.ToString(), null, null, 0, null, rsg.GenerateStreamFromSeed(1*KB));
+ tasks[i] = PutObject_Task(minio, bucketName, objectName + i.ToString(), null, null, 0, null, rsg.GenerateStreamFromSeed(1*KB));
}
await Task.WhenAll(tasks);
@@ -2018,23 +2045,24 @@ private async static Task ListObjects_Test4(MinioClient minio)
await minio.RemoveObjectAsync(bucketName, objectName + "0");
await minio.RemoveObjectAsync(bucketName, objectName + "1");
await TearDown(minio, bucketName);
- new MintLogger("ListObjects_Test4",listObjectsSignature,"Tests whether ListObjects lists all objects when no prefix is specified",TestStatus.PASS,(DateTime.Now - startTime),args:args).Log();
+ new MintLogger("ListObjects_Test4", listObjectsSignature, "Tests whether ListObjects lists all objects when no prefix is specified", TestStatus.PASS, (DateTime.Now - startTime), args:args).Log();
}
catch (MinioException ex)
{
- new MintLogger("ListObjects_Test4",listObjectsSignature,"Tests whether ListObjects lists all objects when no prefix is specified",TestStatus.FAIL,(DateTime.Now - startTime),"",ex.Message, ex.ToString(),args).Log();
+ new MintLogger("ListObjects_Test4", listObjectsSignature, "Tests whether ListObjects lists all objects when no prefix is specified", TestStatus.FAIL, (DateTime.Now - startTime), "", ex.Message, ex.ToString(), args).Log();
}
}
- private async static Task ListObjects_Test5(MinioClient minio)
+
+ private async static Task ListObjects_Test5(MinioClient minio)
{
DateTime startTime = DateTime.Now;
string bucketName = GetRandomName(15);
string objectNamePrefix = GetRandomName(10);
- Dictionary args = new Dictionary
+ var args = new Dictionary
{
- {"bucketName", bucketName},
- {"objectName",objectNamePrefix},
- {"recursive", "false"}
+ { "bucketName", bucketName },
+ { "objectName", objectNamePrefix },
+ { "recursive", "false" }
};
try
{
@@ -2042,9 +2070,9 @@ private async static Task ListObjects_Test5(MinioClient minio)
await Setup_Test(minio, bucketName);
Task[] tasks = new Task[numObjects];
for (int i = 1; i <= numObjects; i++) {
- tasks[i - 1]= PutObject_Task(minio, bucketName, objectNamePrefix + i.ToString(), null, null, 0, null, rsg.GenerateStreamFromSeed(1));
+ tasks[i - 1] = PutObject_Task(minio, bucketName, objectNamePrefix + i.ToString(), null, null, 0, null, rsg.GenerateStreamFromSeed(1));
// Add sleep to avoid flooding server with concurrent requests
- if (i % 50 == 0){
+ if (i % 50 == 0) {
System.Threading.Thread.Sleep(2000);
}
}
@@ -2055,16 +2083,17 @@ private async static Task ListObjects_Test5(MinioClient minio)
for(int index=1; index <= numObjects; index++)
{
string objectName = objectNamePrefix + index.ToString();
- await minio.RemoveObjectAsync(bucketName,objectName);
+ await minio.RemoveObjectAsync(bucketName, objectName);
}
await TearDown(minio, bucketName);
- new MintLogger("ListObjects_Test5",listObjectsSignature,"Tests whether ListObjects lists all objects when number of objects == 100",TestStatus.PASS,(DateTime.Now - startTime),args:args).Log();
+ new MintLogger("ListObjects_Test5", listObjectsSignature, "Tests whether ListObjects lists all objects when number of objects == 100", TestStatus.PASS, (DateTime.Now - startTime), args:args).Log();
}
catch (MinioException ex)
{
- new MintLogger("ListObjects_Test5",listObjectsSignature,"Tests whether ListObjects lists all objects when number of objects == 100",TestStatus.FAIL,(DateTime.Now - startTime),"",ex.Message, ex.ToString(),args).Log();
+ new MintLogger("ListObjects_Test5", listObjectsSignature, "Tests whether ListObjects lists all objects when number of objects == 100", TestStatus.FAIL, (DateTime.Now - startTime), "", ex.Message, ex.ToString(), args).Log();
}
}
+
private async static Task ListObjects_Test(MinioClient minio, string bucketName, string prefix, int numObjects, bool recursive = true)
{
DateTime startTime = DateTime.Now;
@@ -2080,7 +2109,6 @@ private async static Task ListObjects_Test(MinioClient minio, string bucketName,
() =>
{
Assert.AreEqual(count, numObjects);
-
});
}
@@ -2089,10 +2117,10 @@ private async static Task RemoveObject_Test1(MinioClient minio)
DateTime startTime = DateTime.Now;
string bucketName = GetRandomName(15);
string objectName = GetRandomName(10);
- Dictionary args = new Dictionary
+ var args = new Dictionary
{
- {"bucketName", bucketName},
- {"objectName",objectName},
+ { "bucketName", bucketName },
+ { "objectName", objectName },
};
try
{
@@ -2105,13 +2133,12 @@ await minio.PutObjectAsync(bucketName,
filestream, filestream.Length, null);
await minio.RemoveObjectAsync(bucketName, objectName);
await TearDown(minio, bucketName);
-
}
- new MintLogger("RemoveObject_Test1",removeObjectSignature1,"Tests whether RemoveObjectAsync for existing object passes",TestStatus.PASS,(DateTime.Now - startTime),args:args).Log();
+ new MintLogger("RemoveObject_Test1", removeObjectSignature1, "Tests whether RemoveObjectAsync for existing object passes", TestStatus.PASS, (DateTime.Now - startTime), args:args).Log();
}
catch (MinioException ex)
{
- new MintLogger("RemoveObject_Test1",removeObjectSignature1,"Tests whether RemoveObjectAsync for existing object passes",TestStatus.FAIL,(DateTime.Now - startTime),"",ex.Message, ex.ToString(),args).Log();
+ new MintLogger("RemoveObject_Test1", removeObjectSignature1, "Tests whether RemoveObjectAsync for existing object passes", TestStatus.FAIL, (DateTime.Now - startTime), "", ex.Message, ex.ToString(), args).Log();
}
}
@@ -2120,10 +2147,10 @@ private async static Task RemoveObjects_Test2(MinioClient minio)
DateTime startTime = DateTime.Now;
string bucketName = GetRandomName(15);
string objectName = GetRandomName(6);
- Dictionary args = new Dictionary
+ var args = new Dictionary
{
- {"bucketName", bucketName},
- {"objectNames","[" + objectName + "0..." + objectName + "50]"},
+ { "bucketName", bucketName },
+ { "objectNames", "[" + objectName + "0..." + objectName + "50]" },
};
try
{
@@ -2141,20 +2168,19 @@ private async static Task RemoveObjects_Test2(MinioClient minio)
DeleteError de;
IObservable observable = await minio.RemoveObjectAsync(bucketName, objectsList);
IDisposable subscription = observable.Subscribe(
- deleteError => de= deleteError,
+ deleteError => de = deleteError,
() =>
{
TearDown(minio, bucketName).Wait();
});
- new MintLogger("RemoveObject_Test2",removeObjectSignature2,"Tests whether RemoveObjectAsync for multi objects delete passes",TestStatus.PASS,(DateTime.Now - startTime),args:args).Log();
+ new MintLogger("RemoveObject_Test2", removeObjectSignature2, "Tests whether RemoveObjectAsync for multi objects delete passes", TestStatus.PASS, (DateTime.Now - startTime), args:args).Log();
}
catch (MinioException ex)
{
- new MintLogger("RemoveObjects_Test2", removeObjectSignature2, "Tests whether RemoveObjectAsync for multi objects delete passes", TestStatus.FAIL,(DateTime.Now - startTime),"",ex.Message, ex.ToString(), args).Log();
+ new MintLogger("RemoveObjects_Test2", removeObjectSignature2, "Tests whether RemoveObjectAsync for multi objects delete passes", TestStatus.FAIL, (DateTime.Now - startTime), "", ex.Message, ex.ToString(), args).Log();
}
}
-
private async static Task PresignedGetObject_Test1(MinioClient minio)
{
DateTime startTime = DateTime.Now;
@@ -2163,11 +2189,11 @@ private async static Task PresignedGetObject_Test1(MinioClient minio)
int expiresInt = 1000;
string downloadFile = "downloadFileName";
- Dictionary args = new Dictionary
+ var args = new Dictionary
{
- {"bucketName", bucketName},
- {"objectName",objectName},
- {"expiresInt", expiresInt.ToString()}
+ { "bucketName", bucketName },
+ { "objectName", objectName },
+ { "expiresInt", expiresInt.ToString() }
};
try
{
@@ -2193,11 +2219,11 @@ await minio.PutObjectAsync(bucketName,
await TearDown(minio, bucketName);
File.Delete(downloadFile);
- new MintLogger("PresignedGetObject_Test1",presignedGetObjectSignature,"Tests whether PresignedGetObject url retrieves object from bucket",TestStatus.PASS,(DateTime.Now - startTime), args:args).Log();
+ new MintLogger("PresignedGetObject_Test1", presignedGetObjectSignature, "Tests whether PresignedGetObject url retrieves object from bucket", TestStatus.PASS, (DateTime.Now - startTime), args:args).Log();
}
catch (MinioException ex)
{
- new MintLogger("PresignedGetObject_Test1",presignedGetObjectSignature,"Tests whether PresignedGetObject url retrieves object from bucket",TestStatus.FAIL,(DateTime.Now - startTime),"",ex.Message, ex.ToString(),args).Log();
+ new MintLogger("PresignedGetObject_Test1", presignedGetObjectSignature, "Tests whether PresignedGetObject url retrieves object from bucket", TestStatus.FAIL, (DateTime.Now - startTime), "", ex.Message, ex.ToString(), args).Log();
}
}
@@ -2207,11 +2233,11 @@ private async static Task PresignedGetObject_Test2(MinioClient minio)
string bucketName = GetRandomName(15);
string objectName = GetRandomName(10);
int expiresInt = 0;
- Dictionary args = new Dictionary
+ var args = new Dictionary
{
- {"bucketName", bucketName},
- {"objectName",objectName},
- {"expiresInt", expiresInt.ToString()}
+ { "bucketName", bucketName },
+ { "objectName", objectName },
+ { "expiresInt", expiresInt.ToString() }
};
try
{
@@ -2227,16 +2253,17 @@ await minio.PutObjectAsync(bucketName,
}
catch (InvalidExpiryRangeException)
{
- new MintLogger("PresignedGetObject_Test2",presignedGetObjectSignature,"Tests whether PresignedGetObject url retrieves object from bucket when invalid expiry is set.",TestStatus.PASS,(DateTime.Now - startTime),args:args).Log();
+ new MintLogger("PresignedGetObject_Test2", presignedGetObjectSignature, "Tests whether PresignedGetObject url retrieves object from bucket when invalid expiry is set.", TestStatus.PASS, (DateTime.Now - startTime), args:args).Log();
}
await minio.RemoveObjectAsync(bucketName, objectName);
await TearDown(minio, bucketName);
}
catch (Exception ex)
{
- new MintLogger("PresignedGetObject_Test2",presignedGetObjectSignature,"Tests whether PresignedGetObject url retrieves object from bucket when invalid expiry is set.",TestStatus.FAIL,(DateTime.Now - startTime),"",ex.Message, ex.ToString(),args).Log();
+ new MintLogger("PresignedGetObject_Test2", presignedGetObjectSignature, "Tests whether PresignedGetObject url retrieves object from bucket when invalid expiry is set.", TestStatus.FAIL, (DateTime.Now - startTime), "", ex.Message, ex.ToString(), args).Log();
}
}
+
private async static Task PresignedGetObject_Test3(MinioClient minio)
{
DateTime startTime = DateTime.Now;
@@ -2244,13 +2271,13 @@ private async static Task PresignedGetObject_Test3(MinioClient minio)
string objectName = GetRandomName(10);
int expiresInt = 1000;
DateTime reqDate = DateTime.UtcNow.AddSeconds(-50);
- Dictionary args = new Dictionary
+ var args = new Dictionary
{
- {"bucketName", bucketName},
- {"objectName", objectName},
- {"expiresInt", expiresInt.ToString()},
- {"reqParams", "response-content-type:application/json,response-content-disposition:attachment;filename=MyDocument.json;"},
- {"reqDate", reqDate.ToString()},
+ { "bucketName", bucketName },
+ { "objectName", objectName },
+ { "expiresInt", expiresInt.ToString() },
+ { "reqParams", "response-content-type:application/json,response-content-disposition:attachment;filename=MyDocument.json;" },
+ { "reqDate", reqDate.ToString() },
};
try
{
@@ -2261,16 +2288,18 @@ await minio.PutObjectAsync(bucketName,
objectName,
filestream, filestream.Length, null);
ObjectStat stats = await minio.StatObjectAsync(bucketName, objectName);
- Dictionary reqParams = new Dictionary();
- reqParams["response-content-type"] = "application/json";
- reqParams["response-content-disposition"] = "attachment;filename=MyDocument.json;";
+ var reqParams = new Dictionary
+ {
+ ["response-content-type"] = "application/json",
+ ["response-content-disposition"] = "attachment;filename=MyDocument.json;"
+ };
string presigned_url = await minio.PresignedGetObjectAsync(bucketName, objectName, 1000, reqParams, reqDate);
WebRequest httpRequest = WebRequest.Create(presigned_url);
var response = (HttpWebResponse)(await Task.Factory.FromAsync(httpRequest.BeginGetResponse, httpRequest.EndGetResponse, null));
- Assert.AreEqual(response.ContentType,reqParams["response-content-type"]);
- Assert.AreEqual(response.Headers["Content-Disposition"],"attachment;filename=MyDocument.json;");
- Assert.AreEqual(response.Headers["Content-Type"],"application/json");
- Assert.AreEqual(response.Headers["Content-Length"],stats.Size.ToString());
+ Assert.AreEqual(response.ContentType, reqParams["response-content-type"]);
+ Assert.AreEqual(response.Headers["Content-Disposition"], "attachment;filename=MyDocument.json;");
+ Assert.AreEqual(response.Headers["Content-Type"], "application/json");
+ Assert.AreEqual(response.Headers["Content-Length"], stats.Size.ToString());
Stream stream = response.GetResponseStream();
var fileStream = File.Create(downloadFile);
stream.CopyTo(fileStream);
@@ -2285,13 +2314,14 @@ await minio.PutObjectAsync(bucketName,
await TearDown(minio, bucketName);
File.Delete(downloadFile);
- new MintLogger("PresignedGetObject_Test3",presignedGetObjectSignature,"Tests whether PresignedGetObject url retrieves object from bucket when override response headers sent",TestStatus.PASS,(DateTime.Now - startTime),args:args).Log();
+ new MintLogger("PresignedGetObject_Test3", presignedGetObjectSignature, "Tests whether PresignedGetObject url retrieves object from bucket when override response headers sent", TestStatus.PASS, (DateTime.Now - startTime), args:args).Log();
}
catch (MinioException ex)
{
- new MintLogger("PresignedGetObject_Test3",presignedGetObjectSignature,"Tests whether PresignedGetObject url retrieves object from bucket when override response headers sent",TestStatus.FAIL,(DateTime.Now - startTime),"",ex.Message, ex.ToString(),args).Log();
+ new MintLogger("PresignedGetObject_Test3", presignedGetObjectSignature, "Tests whether PresignedGetObject url retrieves object from bucket when override response headers sent", TestStatus.FAIL, (DateTime.Now - startTime), "", ex.Message, ex.ToString(), args).Log();
}
}
+
private async static Task PresignedPutObject_Test1(MinioClient minio)
{
DateTime startTime = DateTime.Now;
@@ -2300,11 +2330,11 @@ private async static Task PresignedPutObject_Test1(MinioClient minio)
int expiresInt = 1000;
string fileName = CreateFile(10 * KB, dataFile10KB);
- Dictionary args = new Dictionary
+ var args = new Dictionary
{
- {"bucketName", bucketName},
- {"objectName", objectName},
- {"expiresInt", expiresInt.ToString()},
+ { "bucketName", bucketName },
+ { "objectName", objectName },
+ { "expiresInt", expiresInt.ToString() },
};
try
{
@@ -2322,11 +2352,11 @@ private async static Task PresignedPutObject_Test1(MinioClient minio)
await minio.RemoveObjectAsync(bucketName, objectName);
await TearDown(minio, bucketName);
- new MintLogger("PresignedPutObject_Test1",presignedPutObjectSignature,"Tests whether PresignedPutObject url uploads object to bucket",TestStatus.PASS,(DateTime.Now - startTime),args:args).Log();
+ new MintLogger("PresignedPutObject_Test1", presignedPutObjectSignature, "Tests whether PresignedPutObject url uploads object to bucket", TestStatus.PASS, (DateTime.Now - startTime), args:args).Log();
}
catch (MinioException ex)
{
- new MintLogger("PresignedPutObject_Test1",presignedPutObjectSignature,"Tests whether PresignedPutObject url uploads object to bucket",TestStatus.FAIL,(DateTime.Now - startTime),"",ex.Message, ex.ToString(), args).Log();
+ new MintLogger("PresignedPutObject_Test1", presignedPutObjectSignature, "Tests whether PresignedPutObject url uploads object to bucket", TestStatus.FAIL, (DateTime.Now - startTime), "", ex.Message, ex.ToString(), args).Log();
}
if (!IsMintEnv())
{
@@ -2341,11 +2371,11 @@ private async static Task PresignedPutObject_Test2(MinioClient minio)
string objectName = GetRandomName(10);
int expiresInt = 0;
- Dictionary args = new Dictionary
+ var args = new Dictionary
{
- {"bucketName", bucketName},
- {"objectName", objectName},
- {"expiresInt", expiresInt.ToString()},
+ { "bucketName", bucketName },
+ { "objectName", objectName },
+ { "expiresInt", expiresInt.ToString() },
};
try
{
@@ -2361,14 +2391,14 @@ await minio.PutObjectAsync(bucketName,
}
catch (InvalidExpiryRangeException)
{
- new MintLogger("PresignedPutObject_Test2",presignedPutObjectSignature,"Tests whether PresignedPutObject url retrieves object from bucket when invalid expiry is set.",TestStatus.PASS,(DateTime.Now - startTime),args:args).Log();
+ new MintLogger("PresignedPutObject_Test2", presignedPutObjectSignature, "Tests whether PresignedPutObject url retrieves object from bucket when invalid expiry is set.", TestStatus.PASS, (DateTime.Now - startTime), args:args).Log();
}
await minio.RemoveObjectAsync(bucketName, objectName);
await TearDown(minio, bucketName);
}
catch (Exception ex)
{
- new MintLogger("PresignedPutObject_Test2",presignedPutObjectSignature,"Tests whether PresignedPutObject url retrieves object from bucket when invalid expiry is set.",TestStatus.FAIL,(DateTime.Now - startTime),"",ex.Message, ex.ToString(),args).Log();
+ new MintLogger("PresignedPutObject_Test2", presignedPutObjectSignature, "Tests whether PresignedPutObject url retrieves object from bucket when invalid expiry is set.", TestStatus.FAIL, (DateTime.Now - startTime), "", ex.Message, ex.ToString(), args).Log();
}
}
@@ -2402,9 +2432,9 @@ private async static Task PresignedPostPolicy_Test1(MinioClient minio)
form.SetKey(objectName);
form.SetBucket(bucketName);
form.SetUserMetadata(metadataKey, metadataValue);
- Dictionary args = new Dictionary
+ var args = new Dictionary
{
- {"form", form.Base64()},
+ { "form", form.Base64() },
};
string fileName = CreateFile(10 * KB, dataFile10KB);
@@ -2432,11 +2462,11 @@ await minio.PutObjectAsync(bucketName,
String policy = await minio.GetPolicyAsync(bucketName);
await minio.RemoveObjectAsync(bucketName, objectName);
await TearDown(minio, bucketName);
- new MintLogger("PresignedPostPolicy_Test1",presignedPostPolicySignature,"Tests whether PresignedPostPolicy url applies policy on server",TestStatus.PASS,(DateTime.Now - startTime), args:args).Log();
+ new MintLogger("PresignedPostPolicy_Test1", presignedPostPolicySignature, "Tests whether PresignedPostPolicy url applies policy on server", TestStatus.PASS, (DateTime.Now - startTime), args:args).Log();
}
catch (Exception ex)
{
- new MintLogger("PresignedPostPolicy_Test1",presignedPostPolicySignature,"Tests whether PresignedPostPolicy url applies policy on server",TestStatus.FAIL,(DateTime.Now - startTime),"",ex.Message, ex.ToString(), args).Log();
+ new MintLogger("PresignedPostPolicy_Test1", presignedPostPolicySignature, "Tests whether PresignedPostPolicy url applies policy on server", TestStatus.FAIL, (DateTime.Now - startTime), "", ex.Message, ex.ToString(), args).Log();
}
await minio.RemoveObjectAsync(bucketName, objectName);
@@ -2455,10 +2485,10 @@ private async static Task ListIncompleteUpload_Test1(MinioClient minio)
string bucketName = GetRandomName(15);
string objectName = GetRandomName(10);
string contentType = "gzip";
- Dictionary args = new Dictionary
+ var args = new Dictionary
{
- {"bucketName", bucketName},
- {"recursive","true"}
+ { "bucketName", bucketName },
+ { "recursive", "true" }
};
try
{
@@ -2475,7 +2505,7 @@ await minio.PutObjectAsync(bucketName,
objectName,
filestream,
filestream.Length,
- contentType, cancellationToken:cts.Token);
+ contentType, cancellationToken: cts.Token);
}
}
catch (OperationCanceledException)
@@ -2490,17 +2520,18 @@ await minio.PutObjectAsync(bucketName,
}
catch (Exception ex)
{
- new MintLogger("ListIncompleteUpload_Test1",listIncompleteUploadsSignature,"Tests whether ListIncompleteUpload passes",TestStatus.FAIL,(DateTime.Now - startTime),"",ex.Message, ex.ToString()).Log();
+ new MintLogger("ListIncompleteUpload_Test1", listIncompleteUploadsSignature, "Tests whether ListIncompleteUpload passes", TestStatus.FAIL, (DateTime.Now - startTime), "", ex.Message, ex.ToString()).Log();
return;
}
await TearDown(minio, bucketName);
- new MintLogger("ListIncompleteUpload_Test1",listIncompleteUploadsSignature, "Tests whether ListIncompleteUpload passes",TestStatus.PASS,(DateTime.Now - startTime)).Log();
+ new MintLogger("ListIncompleteUpload_Test1", listIncompleteUploadsSignature, "Tests whether ListIncompleteUpload passes", TestStatus.PASS, (DateTime.Now - startTime)).Log();
}
catch (MinioException ex)
{
- new MintLogger("ListIncompleteUpload_Test1",listIncompleteUploadsSignature,"Tests whether ListIncompleteUpload passes",TestStatus.FAIL,(DateTime.Now - startTime),"",ex.Message, ex.ToString()).Log();
+ new MintLogger("ListIncompleteUpload_Test1", listIncompleteUploadsSignature, "Tests whether ListIncompleteUpload passes", TestStatus.FAIL, (DateTime.Now - startTime), "", ex.Message, ex.ToString()).Log();
}
}
+
private async static Task ListIncompleteUpload_Test2(MinioClient minio)
{
DateTime startTime = DateTime.Now;
@@ -2508,11 +2539,11 @@ private async static Task ListIncompleteUpload_Test2(MinioClient minio)
string prefix = "minioprefix/";
string objectName = prefix + GetRandomName(10);
string contentType = "gzip";
- Dictionary args = new Dictionary
+ var args = new Dictionary
{
- {"bucketName", bucketName},
- {"prefix", prefix},
- {"recursive","false"}
+ { "bucketName", bucketName },
+ { "prefix", prefix },
+ { "recursive", "false" }
};
try
{
@@ -2529,7 +2560,7 @@ await minio.PutObjectAsync(bucketName,
objectName,
filestream,
filestream.Length,
- contentType, cancellationToken:cts.Token);
+ contentType, cancellationToken: cts.Token);
}
}
catch (OperationCanceledException)
@@ -2543,11 +2574,11 @@ await minio.PutObjectAsync(bucketName,
await minio.RemoveIncompleteUploadAsync(bucketName, objectName);
}
await TearDown(minio, bucketName);
- new MintLogger("ListIncompleteUpload_Test2",listIncompleteUploadsSignature,"Tests whether ListIncompleteUpload passes when qualified by prefix",TestStatus.PASS,(DateTime.Now - startTime), args:args).Log();
+ new MintLogger("ListIncompleteUpload_Test2", listIncompleteUploadsSignature, "Tests whether ListIncompleteUpload passes when qualified by prefix", TestStatus.PASS, (DateTime.Now - startTime), args:args).Log();
}
catch (MinioException ex)
{
- new MintLogger("ListIncompleteUpload_Test2",listIncompleteUploadsSignature,"Tests whether ListIncompleteUpload passes when qualified by prefix",TestStatus.FAIL,(DateTime.Now - startTime),"",ex.Message, ex.ToString(), args).Log();
+ new MintLogger("ListIncompleteUpload_Test2", listIncompleteUploadsSignature, "Tests whether ListIncompleteUpload passes when qualified by prefix", TestStatus.FAIL, (DateTime.Now - startTime), "", ex.Message, ex.ToString(), args).Log();
}
}
@@ -2558,11 +2589,11 @@ private async static Task ListIncompleteUpload_Test3(MinioClient minio)
string prefix = "minioprefix";
string objectName = prefix + "/" + GetRandomName(10) + "/suffix";
string contentType = "gzip";
- Dictionary args = new Dictionary
+ var args = new Dictionary
{
- {"bucketName", bucketName},
- {"prefix", prefix},
- {"recursive","true"}
+ { "bucketName", bucketName },
+ { "prefix", prefix },
+ { "recursive", "true" }
};
try
{
@@ -2579,7 +2610,7 @@ await minio.PutObjectAsync(bucketName,
objectName,
filestream,
filestream.Length,
- contentType, cancellationToken:cts.Token);
+ contentType, cancellationToken: cts.Token);
}
}
catch (OperationCanceledException)
@@ -2593,11 +2624,11 @@ await minio.PutObjectAsync(bucketName,
await minio.RemoveIncompleteUploadAsync(bucketName, objectName);
}
await TearDown(minio, bucketName);
- new MintLogger("ListIncompleteUpload_Test3",listIncompleteUploadsSignature,"Tests whether ListIncompleteUpload passes when qualified by prefix and recursive",TestStatus.PASS,(DateTime.Now - startTime), args:args).Log();
+ new MintLogger("ListIncompleteUpload_Test3", listIncompleteUploadsSignature, "Tests whether ListIncompleteUpload passes when qualified by prefix and recursive", TestStatus.PASS, (DateTime.Now - startTime), args:args).Log();
}
catch (MinioException ex)
{
- new MintLogger("ListIncompleteUpload_Test3",listIncompleteUploadsSignature,"Tests whether ListIncompleteUpload passes when qualified by prefix and recursive",TestStatus.FAIL,(DateTime.Now - startTime),"",ex.Message, ex.ToString(),args).Log();
+ new MintLogger("ListIncompleteUpload_Test3", listIncompleteUploadsSignature, "Tests whether ListIncompleteUpload passes when qualified by prefix and recursive", TestStatus.FAIL, (DateTime.Now - startTime), "", ex.Message, ex.ToString(), args).Log();
}
}
@@ -2607,10 +2638,10 @@ private async static Task RemoveIncompleteUpload_Test(MinioClient minio)
string bucketName = GetRandomName(15);
string objectName = GetRandomName(10);
string contentType = "csv";
- Dictionary args = new Dictionary
+ var args = new Dictionary
{
- {"bucketName", bucketName},
- {"objectName", objectName},
+ { "bucketName", bucketName },
+ { "objectName", objectName },
};
try
{
@@ -2627,7 +2658,7 @@ await minio.PutObjectAsync(bucketName,
objectName,
filestream,
filestream.Length,
- contentType, cancellationToken:cts.Token);
+ contentType, cancellationToken: cts.Token);
}
}
catch (OperationCanceledException)
@@ -2641,24 +2672,25 @@ await minio.PutObjectAsync(bucketName,
ex => Assert.Fail());
}
await TearDown(minio, bucketName);
- new MintLogger("RemoveIncompleteUpload_Test",removeIncompleteUploadSignature,"Tests whether RemoveIncompleteUpload passes.",TestStatus.PASS,(DateTime.Now - startTime), args:args).Log();
+ new MintLogger("RemoveIncompleteUpload_Test", removeIncompleteUploadSignature, "Tests whether RemoveIncompleteUpload passes.", TestStatus.PASS, (DateTime.Now - startTime), args:args).Log();
}
catch (MinioException ex)
{
- new MintLogger("RemoveIncompleteUpload_Test",removeIncompleteUploadSignature,"Tests whether RemoveIncompleteUpload passes.",TestStatus.FAIL,(DateTime.Now - startTime),"",ex.Message, ex.ToString(), args).Log();
+ new MintLogger("RemoveIncompleteUpload_Test", removeIncompleteUploadSignature, "Tests whether RemoveIncompleteUpload passes.", TestStatus.FAIL, (DateTime.Now - startTime), "", ex.Message, ex.ToString(), args).Log();
}
}
+
// Set a policy for given bucket
private async static Task SetBucketPolicy_Test1(MinioClient minio)
{
DateTime startTime = DateTime.Now;
string bucketName = GetRandomName(15);
string objectName = GetRandomName(10);
- Dictionary