Skip to content

Commit

Permalink
Merge with master. NotImplemented added.
Browse files Browse the repository at this point in the history
Signed-off-by: Priyank Raj <[email protected]>
  • Loading branch information
BigUstad committed May 14, 2021
2 parents f1a9406 + 41354ee commit a525432
Show file tree
Hide file tree
Showing 8 changed files with 1,159 additions and 969 deletions.
32 changes: 18 additions & 14 deletions Minio.Examples/Cases/ListObjects.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,29 +30,33 @@ public static void Run(MinioClient minio,
{
try
{
Console.WriteLine("Running example for API: ListObjectsAsync");
ListObjectsArgs listArgs = new ListObjectsArgs()
.WithBucket(bucketName)
.WithPrefix(prefix)
.WithRecursive(recursive);
IObservable<Item> observable = minio.ListObjectsAsync(listArgs);

IDisposable subscription = observable.Subscribe(
item => Console.WriteLine($"Object: {item.Key}"),
ex => Console.WriteLine($"OnError: {ex}"),
() => Console.WriteLine($"Listed all objects in bucket {bucketName}\n"));

if (versions)
{
listArgs.WithVersions(true);
ListObjectsArgs listArgs = new ListObjectsArgs()
.WithBucket(bucketName)
.WithPrefix(prefix)
.WithVersions(true)
.WithRecursive(recursive);
IObservable<VersionItem> observableVer = minio.ListObjectVersionsAsync(listArgs);

IDisposable subscriptionVer = observableVer.Subscribe(
item => Console.WriteLine($"Object: {item.Key} Version: {item.VersionId}"),
ex => Console.WriteLine($"OnError: {ex}"),
() => Console.WriteLine($"Listed all objects in bucket {bucketName}\n"));
}
// subscription.Dispose();
else
{
Console.WriteLine("Running example for API: ListObjectsAsync");
ListObjectsArgs listArgs = new ListObjectsArgs()
.WithBucket(bucketName)
.WithPrefix(prefix)
.WithRecursive(recursive);
IObservable<Item> observable = minio.ListObjectsAsync(listArgs);
IDisposable subscription = observable.Subscribe(
item => Console.WriteLine($"Object: {item.Key}"),
ex => Console.WriteLine($"OnError: {ex}"),
() => Console.WriteLine($"Listed all objects in bucket {bucketName}\n"));
}
}
catch (Exception e)
{
Expand Down
1,709 changes: 913 additions & 796 deletions Minio.Functional.Tests/FunctionalTest.cs

Large diffs are not rendered by default.

234 changes: 120 additions & 114 deletions Minio.Functional.Tests/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,124 +84,130 @@ public static void Main(string[] args)
Environment.Exit(0);
}

FunctionalTest.ListenBucketNotificationsAsync_Test1(minioClient).Wait();

// Check if bucket exists
FunctionalTest.BucketExists_Test(minioClient).Wait();

// Create a new bucket
FunctionalTest.MakeBucket_Test1(minioClient).Wait();
FunctionalTest.MakeBucket_Test5(minioClient).Wait();

if (useAWS)
{
FunctionalTest.MakeBucket_Test2(minioClient, useAWS).Wait();
FunctionalTest.MakeBucket_Test3(minioClient, useAWS).Wait();
FunctionalTest.MakeBucket_Test4(minioClient, useAWS).Wait();
}

// Test removal of bucket
FunctionalTest.RemoveBucket_Test1(minioClient).Wait();

// Test ListBuckets function
FunctionalTest.ListBuckets_Test(minioClient).Wait();

// Test Putobject function
FunctionalTest.PutObject_Test1(minioClient).Wait();
FunctionalTest.PutObject_Test2(minioClient).Wait();
FunctionalTest.PutObject_Test3(minioClient).Wait();
FunctionalTest.PutObject_Test4(minioClient).Wait();
FunctionalTest.PutObject_Test5(minioClient).Wait();
FunctionalTest.PutObject_Test7(minioClient).Wait();
FunctionalTest.PutObject_Test8(minioClient).Wait();

// Test StatObject function
FunctionalTest.StatObject_Test1(minioClient).Wait();

// Test GetObjectAsync function
FunctionalTest.GetObject_Test1(minioClient).Wait();
FunctionalTest.GetObject_Test2(minioClient).Wait();
FunctionalTest.GetObject_Test3(minioClient).Wait();

// Test File GetObject and PutObject functions

FunctionalTest.FGetObject_Test1(minioClient).Wait();
// FIX=> FPutObject_Test1(minioClient).Wait();
FunctionalTest.FPutObject_Test2(minioClient).Wait();

// Test SelectObjectContentAsync function
FunctionalTest.SelectObjectContent_Test(minioClient).Wait();

// Test ListObjectAsync function
FunctionalTest.ListObjects_Test1(minioClient).Wait();
FunctionalTest.ListObjects_Test2(minioClient).Wait();
FunctionalTest.ListObjects_Test3(minioClient).Wait();
FunctionalTest.ListObjects_Test4(minioClient).Wait();
FunctionalTest.ListObjects_Test5(minioClient).Wait();
FunctionalTest.ListObjects_Test6(minioClient).Wait();

// Test RemoveObjectAsync function
FunctionalTest.RemoveObject_Test1(minioClient).Wait();
FunctionalTest.RemoveObjects_Test2(minioClient).Wait();
FunctionalTest.RemoveObjects_Test3(minioClient).Wait();

// Test CopyObjectAsync function
FunctionalTest.CopyObject_Test1(minioClient).Wait();
FunctionalTest.CopyObject_Test2(minioClient).Wait();
FunctionalTest.CopyObject_Test3(minioClient).Wait();
FunctionalTest.CopyObject_Test4(minioClient).Wait();
FunctionalTest.CopyObject_Test5(minioClient).Wait();
FunctionalTest.CopyObject_Test6(minioClient).Wait();
FunctionalTest.CopyObject_Test7(minioClient).Wait();
FunctionalTest.CopyObject_Test8(minioClient).Wait();

// Test SetPolicyAsync function
FunctionalTest.SetBucketPolicy_Test1(minioClient).Wait();

// Test Presigned Get/Put operations
FunctionalTest.PresignedGetObject_Test1(minioClient).Wait();
FunctionalTest.PresignedGetObject_Test2(minioClient).Wait();
FunctionalTest.PresignedGetObject_Test3(minioClient).Wait();
FunctionalTest.PresignedPutObject_Test1(minioClient).Wait();
FunctionalTest.PresignedPutObject_Test2(minioClient).Wait();

// Test incomplete uploads
FunctionalTest.ListIncompleteUpload_Test1(minioClient).Wait();
FunctionalTest.ListIncompleteUpload_Test2(minioClient).Wait();
FunctionalTest.ListIncompleteUpload_Test3(minioClient).Wait();
FunctionalTest.RemoveIncompleteUpload_Test(minioClient).Wait();

// Test GetBucket policy
FunctionalTest.GetBucketPolicy_Test1(minioClient).Wait();

// Test Object Lock Configuration
FunctionalTest.ObjectLockConfigurationAsync_Test1(minioClient).Wait();

// Test Bucket, Object Tags
FunctionalTest.BucketTagsAsync_Test1(minioClient).Wait();
FunctionalTest.ObjectTagsAsync_Test1(minioClient).Wait();

//Test Bucket Lifecycle configuration
FunctionalTest.BucketLifecycleAsync_Test1(minioClient).Wait();

// Test encryption
if (enableHttps == "1")
// Try catch as 'finally' section needs to run in the Functional Tests
try
{
ServicePointManager.ServerCertificateValidationCallback += (sender, certificate, chain, sslPolicyErrors) => true;
FunctionalTest.PutGetStatEncryptedObject_Test1(minioClient).Wait();
FunctionalTest.PutGetStatEncryptedObject_Test2(minioClient).Wait();

FunctionalTest.EncryptedCopyObject_Test1(minioClient).Wait();
FunctionalTest.EncryptedCopyObject_Test2(minioClient).Wait();
FunctionalTest.ListenBucketNotificationsAsync_Test1(minioClient).Wait();

// Check if bucket exists
FunctionalTest.BucketExists_Test(minioClient).Wait();

// Create a new bucket
FunctionalTest.MakeBucket_Test1(minioClient).Wait();
FunctionalTest.MakeBucket_Test5(minioClient).Wait();

if (useAWS)
{
FunctionalTest.MakeBucket_Test2(minioClient, useAWS).Wait();
FunctionalTest.MakeBucket_Test3(minioClient, useAWS).Wait();
FunctionalTest.MakeBucket_Test4(minioClient, useAWS).Wait();
}

// Test removal of bucket
FunctionalTest.RemoveBucket_Test1(minioClient).Wait();

// Test ListBuckets function
FunctionalTest.ListBuckets_Test(minioClient).Wait();

// Test Putobject function
FunctionalTest.PutObject_Test1(minioClient).Wait();
FunctionalTest.PutObject_Test2(minioClient).Wait();
FunctionalTest.PutObject_Test3(minioClient).Wait();
FunctionalTest.PutObject_Test4(minioClient).Wait();
FunctionalTest.PutObject_Test5(minioClient).Wait();
FunctionalTest.PutObject_Test7(minioClient).Wait();
FunctionalTest.PutObject_Test8(minioClient).Wait();

// Test StatObject function
FunctionalTest.StatObject_Test1(minioClient).Wait();

// Test GetObjectAsync function
FunctionalTest.GetObject_Test1(minioClient).Wait();
FunctionalTest.GetObject_Test2(minioClient).Wait();
FunctionalTest.GetObject_Test3(minioClient).Wait();

// Test File GetObject and PutObject functions
FunctionalTest.FGetObject_Test1(minioClient).Wait();
// FIX=> FPutObject_Test1(minioClient).Wait();
FunctionalTest.FPutObject_Test2(minioClient).Wait();

// Test SelectObjectContentAsync function
FunctionalTest.SelectObjectContent_Test(minioClient).Wait();

// Test ListObjectAsync function
FunctionalTest.ListObjects_Test1(minioClient).Wait();
FunctionalTest.ListObjects_Test2(minioClient).Wait();
FunctionalTest.ListObjects_Test3(minioClient).Wait();
FunctionalTest.ListObjects_Test4(minioClient).Wait();
FunctionalTest.ListObjects_Test5(minioClient).Wait();
FunctionalTest.ListObjects_Test6(minioClient).Wait();

// Test RemoveObjectAsync function
FunctionalTest.RemoveObject_Test1(minioClient).Wait();
FunctionalTest.RemoveObjects_Test2(minioClient).Wait();
FunctionalTest.RemoveObjects_Test3(minioClient).Wait();

// Test CopyObjectAsync function
FunctionalTest.CopyObject_Test1(minioClient).Wait();
FunctionalTest.CopyObject_Test2(minioClient).Wait();
FunctionalTest.CopyObject_Test3(minioClient).Wait();
FunctionalTest.CopyObject_Test4(minioClient).Wait();
FunctionalTest.CopyObject_Test5(minioClient).Wait();
FunctionalTest.CopyObject_Test6(minioClient).Wait();
FunctionalTest.CopyObject_Test7(minioClient).Wait();
FunctionalTest.CopyObject_Test8(minioClient).Wait();

// Test SetPolicyAsync function
FunctionalTest.SetBucketPolicy_Test1(minioClient).Wait();

// Test Presigned Get/Put operations
FunctionalTest.PresignedGetObject_Test1(minioClient).Wait();
FunctionalTest.PresignedGetObject_Test2(minioClient).Wait();
FunctionalTest.PresignedGetObject_Test3(minioClient).Wait();
FunctionalTest.PresignedPutObject_Test1(minioClient).Wait();
FunctionalTest.PresignedPutObject_Test2(minioClient).Wait();

// Test incomplete uploads
FunctionalTest.ListIncompleteUpload_Test1(minioClient).Wait();
FunctionalTest.ListIncompleteUpload_Test2(minioClient).Wait();
FunctionalTest.ListIncompleteUpload_Test3(minioClient).Wait();
FunctionalTest.RemoveIncompleteUpload_Test(minioClient).Wait();

// Test GetBucket policy
FunctionalTest.GetBucketPolicy_Test1(minioClient).Wait();

// Test Object Lock Configuration
FunctionalTest.ObjectLockConfigurationAsync_Test1(minioClient).Wait();

// Test Bucket, Object Tags
FunctionalTest.BucketTagsAsync_Test1(minioClient).Wait();
FunctionalTest.ObjectTagsAsync_Test1(minioClient).Wait();

//Test Bucket Lifecycle configuration
FunctionalTest.BucketLifecycleAsync_Test1(minioClient).Wait();

// Test encryption
if (enableHttps == "1")
{
ServicePointManager.ServerCertificateValidationCallback += (sender, certificate, chain, sslPolicyErrors) => true;
FunctionalTest.PutGetStatEncryptedObject_Test1(minioClient).Wait();
FunctionalTest.PutGetStatEncryptedObject_Test2(minioClient).Wait();

FunctionalTest.EncryptedCopyObject_Test1(minioClient).Wait();
FunctionalTest.EncryptedCopyObject_Test2(minioClient).Wait();
}

if (kmsEnabled != null && kmsEnabled == "1")
{
FunctionalTest.PutGetStatEncryptedObject_Test3(minioClient).Wait();
FunctionalTest.EncryptedCopyObject_Test3(minioClient).Wait();
FunctionalTest.EncryptedCopyObject_Test4(minioClient).Wait();
}
}

if (kmsEnabled != null && kmsEnabled == "1")
catch (System.Exception)
{
FunctionalTest.PutGetStatEncryptedObject_Test3(minioClient).Wait();
FunctionalTest.EncryptedCopyObject_Test3(minioClient).Wait();
FunctionalTest.EncryptedCopyObject_Test4(minioClient).Wait();
throw;
}

}
}
}
Loading

0 comments on commit a525432

Please sign in to comment.