|
1 | | -using NUnit.Framework; |
2 | | -using Minio; |
3 | | -using Rdmp.Core.ReusableLibraryCode.AWS; |
4 | | -using Tests.Common.Scenarios; |
5 | | -using Rdmp.Core.DataFlowPipeline; |
6 | | -using Rdmp.Core.ReusableLibraryCode.Progress; |
7 | | -using System; |
8 | | -using Rdmp.Core.Curation.Data.Pipelines; |
9 | | -using Rdmp.Core.DataExport.DataRelease; |
| 1 | +using Minio; |
| 2 | +using Minio.ApiEndpoints; |
| 3 | +using Minio.DataModel.Args; |
| 4 | +using NUnit.Framework; |
| 5 | +using Rdmp.Core.CommandExecution; |
10 | 6 | using Rdmp.Core.CommandLine.Options; |
11 | 7 | using Rdmp.Core.CommandLine.Runners; |
12 | | -using Rdmp.Core.CommandExecution; |
| 8 | +using Rdmp.Core.Curation.Data.DataLoad; |
| 9 | +using Rdmp.Core.Curation.Data.Pipelines; |
| 10 | +using Rdmp.Core.DataExport.DataRelease; |
| 11 | +using Rdmp.Core.DataFlowPipeline; |
| 12 | +using Rdmp.Core.ReusableLibraryCode.AWS; |
13 | 13 | using Rdmp.Core.ReusableLibraryCode.Checks; |
14 | | -using System.Linq; |
15 | | -using Minio.DataModel.Args; |
| 14 | +using Rdmp.Core.ReusableLibraryCode.Progress; |
| 15 | +using System; |
16 | 16 | using System.Collections.Generic; |
17 | | -using Rdmp.Core.Curation.Data.DataLoad; |
| 17 | +using System.Linq; |
| 18 | +using System.Reactive.Linq; |
| 19 | +using System.Threading; |
| 20 | +using System.Threading.Tasks; |
| 21 | +using Tests.Common.Scenarios; |
18 | 22 | namespace Rdmp.Core.Tests.DataExport.DataRelease; |
19 | 23 |
|
20 | 24 | public sealed class S3BucketReleaseDestinationTests : TestsRequiringAnExtractionConfiguration |
@@ -63,10 +67,20 @@ private static void DeleteBucket(string name) |
63 | 67 |
|
64 | 68 | private static List<Minio.DataModel.Item> GetObjects(string bucketName) |
65 | 69 | { |
66 | | - throw new Exception("This needs to be fixed by minio"); |
67 | | - //var loArgs = new ListObjectsArgs().WithBucket(bucketName); |
68 | | - //var x = _minioClient.ListObjectsEnumAsync(loArgs).ToListAsync<Item>(); |
69 | | - //return x.IsCompleted ? x.Result : x.AsTask().Result; |
| 70 | + var loArgs = new ListObjectsArgs().WithBucket(bucketName); |
| 71 | + var x = _minioClient.ListObjectsEnumAsync(loArgs); |
| 72 | + var results = ToListAsync(x).Result; |
| 73 | + return results; |
| 74 | + } |
| 75 | + |
| 76 | + public static async Task<List<T>> ToListAsync<T>(this IAsyncEnumerable<T> items, |
| 77 | + CancellationToken cancellationToken = default) |
| 78 | + { |
| 79 | + var results = new List<T>(); |
| 80 | + await foreach (var item in items.WithCancellation(cancellationToken) |
| 81 | + .ConfigureAwait(false)) |
| 82 | + results.Add(item); |
| 83 | + return results; |
70 | 84 | } |
71 | 85 |
|
72 | 86 | private static void SetArgs(IArgument[] args, Dictionary<string, object> values) |
|
0 commit comments