Skip to content

Commit

Permalink
fix: Functional Tests and access modifiers (#517)
Browse files Browse the repository at this point in the history
  • Loading branch information
BigUstad authored Mar 9, 2021
1 parent 54c2f66 commit 547486f
Show file tree
Hide file tree
Showing 57 changed files with 1,433 additions and 568 deletions.
4 changes: 2 additions & 2 deletions Docs/API.md
Original file line number Diff line number Diff line change
Expand Up @@ -828,7 +828,7 @@ try
// Set Tags for the bucket
SetBucketTagsArgs args = new SetBucketTagsArgs()
.WithBucket(bucketName)
.WithTagKeyValuePairs(tags);
.WithTagging(tags);
await minio.SetBucketTagsAsync(args);
Console.WriteLine($"Set Tags for bucket {bucketName}.");
}
Expand Down Expand Up @@ -2540,7 +2540,7 @@ try
SetObjectTagsArgs args = new new SetObjectTagsArgs()
.WithBucket(bucketName)
.WithObject(objectName)
.WithTagKeyValuePairs(tags);
.WithTagging(tags);
await minio.SetObjectTagsAsync(args);
Console.WriteLine($"Set tags for object {bucketName}/{objectName}.");
}
Expand Down
2 changes: 1 addition & 1 deletion Minio.Examples/Cases/BucketExists.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* MinIO .NET Library for Amazon S3 Compatible Cloud Storage, (C) 2017 MinIO, Inc.
* MinIO .NET Library for Amazon S3 Compatible Cloud Storage, (C) 2017-2021 MinIO, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
3 changes: 2 additions & 1 deletion Minio.Examples/Cases/CopyObjectReplaceTags.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
using System.Collections.Generic;
using System.Globalization;
using System.Threading.Tasks;
using Minio.DataModel;

namespace Minio.Examples.Cases
{
Expand All @@ -43,7 +44,7 @@ public async static Task Run(MinioClient minio,
CopyObjectArgs args = new CopyObjectArgs()
.WithBucket(destBucketName)
.WithObject(destObjectName)
.WithTagKeyValuePairs(tags)
.WithTagging(Tagging.GetObjectTags(tags))
.WithReplaceTagsDirective(true)
.WithCopyObjectSource(cpSrcArgs);
await minio.CopyObjectAsync(args).ConfigureAwait(false);
Expand Down
9 changes: 7 additions & 2 deletions Minio.Examples/Cases/FGetObject.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* MinIO .NET Library for Amazon S3 Compatible Cloud Storage, (C) 2017 MinIO, Inc.
* MinIO .NET Library for Amazon S3 Compatible Cloud Storage, (C) 2017-2021 MinIO, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -34,7 +34,12 @@ public async static Task Run(MinioClient minio,
{
Console.WriteLine("Running example for API: GetObjectAsync");
File.Delete(fileName);
await minio.GetObjectAsync(bucketName, objectName, fileName, sse: sse);
GetObjectArgs args = new GetObjectArgs()
.WithBucket(bucketName)
.WithObject(objectName)
.WithFile(fileName)
.WithServerSideEncryption(sse);
await minio.GetObjectAsync(args).ConfigureAwait(false);
Console.WriteLine($"Downloaded the file {fileName} from bucket {bucketName}");
Console.WriteLine();
}
Expand Down
2 changes: 1 addition & 1 deletion Minio.Examples/Cases/GetBucketNotification.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* MinIO .NET Library for Amazon S3 Compatible Cloud Storage, (C) 2017 MinIO, Inc.
* MinIO .NET Library for Amazon S3 Compatible Cloud Storage, (C) 2017-2021 MinIO, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
34 changes: 19 additions & 15 deletions Minio.Examples/Cases/GetPartialObject.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* MinIO .NET Library for Amazon S3 Compatible Cloud Storage, (C) 2017 MinIO, Inc.
* MinIO .NET Library for Amazon S3 Compatible Cloud Storage, (C) 2017-2021 MinIO, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -40,19 +40,23 @@ public async static Task Run(MinioClient minio,
await minio.StatObjectAsync(statObjectArgs);

// Get object content starting at byte position 1024 and length of 4096
await minio.GetObjectAsync(bucketName, objectName, 1024L, 4096L,
(stream) =>
{
var fileStream = File.Create(fileName);
stream.CopyTo(fileStream);
fileStream.Dispose();
var writtenInfo = new FileInfo(fileName);
long file_read_size = writtenInfo.Length;
// Uncomment to print the file on output console
// stream.CopyTo(Console.OpenStandardOutput());
Console.WriteLine($"Successfully downloaded object with requested offset and length {writtenInfo.Length} into file");
stream.Dispose();
});
GetObjectArgs getObjectArgs = new GetObjectArgs()
.WithBucket(bucketName)
.WithObject(objectName)
.WithOffsetAndLength(1024L, 4096L)
.WithCallbackStream((stream) =>
{
var fileStream = File.Create(fileName);
stream.CopyTo(fileStream);
fileStream.Dispose();
var writtenInfo = new FileInfo(fileName);
long file_read_size = writtenInfo.Length;
// Uncomment to print the file on output console
// stream.CopyTo(Console.OpenStandardOutput());
Console.WriteLine($"Successfully downloaded object with requested offset and length {writtenInfo.Length} into file");
stream.Dispose();
});
await minio.GetObjectAsync(getObjectArgs).ConfigureAwait(false);
Console.WriteLine();
}
catch (Exception e)
Expand All @@ -61,4 +65,4 @@ await minio.GetObjectAsync(bucketName, objectName, 1024L, 4096L,
}
}
}
}
}
2 changes: 1 addition & 1 deletion Minio.Examples/Cases/ListObjects.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* MinIO .NET Library for Amazon S3 Compatible Cloud Storage, (C) 2017 MinIO, Inc.
* MinIO .NET Library for Amazon S3 Compatible Cloud Storage, (C) 2017-2021 MinIO, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
8 changes: 6 additions & 2 deletions Minio.Examples/Cases/RetryPolicyObject.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* MinIO .NET Library for Amazon S3 Compatible Cloud Storage, (C) 2020 MinIO, Inc.
* MinIO .NET Library for Amazon S3 Compatible Cloud Storage, (C) 2020, 2021 MinIO, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -94,7 +94,11 @@ public async static Task Run(MinioClient minio,

try
{
await minio.GetObjectAsync("bad-bucket", "bad-file", s => { });
GetObjectArgs getObjectArgs = new GetObjectArgs()
.WithBucket("bad-bucket")
.WithObject("bad-file")
.WithCallbackStream(s => { });
await minio.GetObjectAsync(getObjectArgs);
}
catch (BucketNotFoundException ex)
{
Expand Down
2 changes: 1 addition & 1 deletion Minio.Examples/Cases/SetBucketLifecycle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
using System;
using System.Threading.Tasks;

using Minio.DataModel;
using Minio.DataModel.ILM;

namespace Minio.Examples.Cases
{
Expand Down
3 changes: 2 additions & 1 deletion Minio.Examples/Cases/SetBucketTags.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Minio.DataModel;

namespace Minio.Examples.Cases
{
Expand All @@ -32,7 +33,7 @@ public async static Task Run(MinioClient minio,
await minio.SetBucketTagsAsync(
new SetBucketTagsArgs()
.WithBucket(bucketName)
.WithTagKeyValuePairs(tags)
.WithTagging(Tagging.GetBucketTags(tags))
);
Console.WriteLine($"Bucket Tags set for bucket {bucketName}.");
Console.WriteLine();
Expand Down
3 changes: 2 additions & 1 deletion Minio.Examples/Cases/SetObjectTags.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Minio.DataModel;

namespace Minio.Examples.Cases
{
Expand All @@ -35,7 +36,7 @@ public async static Task Run(MinioClient minio,
.WithBucket(bucketName)
.WithObject(objectName)
.WithVersionId(versionId)
.WithTagKeyValuePairs(tags);
.WithTagging(Tagging.GetObjectTags(tags));
await minio.SetObjectTagsAsync(args);
Console.WriteLine($"Tags set for object {bucketName}/{objectName}.");
Console.WriteLine();
Expand Down
Loading

0 comments on commit 547486f

Please sign in to comment.