diff --git a/.gitignore b/.gitignore index 069c306..670cc6b 100644 --- a/.gitignore +++ b/.gitignore @@ -123,3 +123,4 @@ BaseSpace.SDK/src/BaseSpace.SDK.MonoTouch/BaseSpace.SDK.MonoTouch.Tests/Settings *.plist *.DS_Store *.DS_Store +.vs/config/applicationhost.config diff --git a/BaseSpace.SDK.Tests/BaseSpace.SDK.Tests.csproj b/BaseSpace.SDK.Tests/BaseSpace.SDK.Tests.csproj index 221d723..8b179eb 100644 --- a/BaseSpace.SDK.Tests/BaseSpace.SDK.Tests.csproj +++ b/BaseSpace.SDK.Tests/BaseSpace.SDK.Tests.csproj @@ -46,17 +46,17 @@ $(SolutionDir)\packages\log4net.1.2.10\lib\2.0\log4net.dll - + False - $(SolutionDir)\packages\ServiceStack.Common.3.9.35\lib\net35\ServiceStack.Common.dll + ..\..\SpaceElevator\SignedBinaries\ServiceStack.Common.dll - + False - $(SolutionDir)\packages\ServiceStack.Common.3.9.35\lib\net35\ServiceStack.Interfaces.dll + ..\..\SpaceElevator\SignedBinaries\ServiceStack.Interfaces.dll - + False - $(SolutionDir)\packages\ServiceStack.Text.3.9.35\lib\net35\ServiceStack.Text.dll + ..\..\SpaceElevator\SignedBinaries\ServiceStack.Text.dll diff --git a/BaseSpace.SDK.Tests/Integration/BaseIntegrationTest.cs b/BaseSpace.SDK.Tests/Integration/BaseIntegrationTest.cs index e6d05cb..012a6e2 100644 --- a/BaseSpace.SDK.Tests/Integration/BaseIntegrationTest.cs +++ b/BaseSpace.SDK.Tests/Integration/BaseIntegrationTest.cs @@ -25,6 +25,11 @@ public BaseIntegrationTest() Debug.Listeners.Add(new DefaultTraceListener()); } + private IBaseSpaceClient CreateRealClient() + { + return CreateRealClient(false); + } + private readonly Lazy _lazy; public IBaseSpaceClient Client @@ -43,7 +48,7 @@ protected ILog Log } // Note: prefer access through the Client property! - protected virtual IBaseSpaceClient CreateRealClient() + protected virtual IBaseSpaceClient CreateRealClient(bool useS3Proxy= false) { //string apiKey = ConfigurationManager.AppSettings.Get("basespace:api-key"); //string apiSecret = ConfigurationManager.AppSettings.Get("basespace:api-secret"); @@ -56,8 +61,9 @@ protected virtual IBaseSpaceClient CreateRealClient() Authentication = GetAuthentication(), BaseSpaceApiUrl = apiUrl, BaseSpaceWebsiteUrl = webUrl, - Version = version - }; + Version = version, + UseS3Proxy = useS3Proxy + }; return new BaseSpaceClient(settings); } diff --git a/BaseSpace.SDK.Tests/Integration/FileDownloadTests.cs b/BaseSpace.SDK.Tests/Integration/FileDownloadTests.cs index 082b690..5f3edeb 100644 --- a/BaseSpace.SDK.Tests/Integration/FileDownloadTests.cs +++ b/BaseSpace.SDK.Tests/Integration/FileDownloadTests.cs @@ -13,6 +13,33 @@ namespace Illumina.BaseSpace.SDK.Tests.Integration { public class FileDownloadTests : BaseIntegrationTest { + [Fact] + public void CanDownloadSmallFile() + { + IBaseSpaceClient client = CreateRealClient(useS3Proxy:false); + var fs = new FileStream("DownloadedFile-" + StringHelpers.RandomAlphanumericString(5), FileMode.OpenOrCreate); + client.FileDownloadProgressChanged += delegate(object sender, FileDownloadProgressChangedEventArgs e) + { + Console.WriteLine($"FileId={e.FileId} BytesDownloaded={e.BytesDownloaded} Progress={e.ProgressPercentage}%"); + }; + + client.DownloadFile("145435603", fs); + Assert.Equal(fs.Length, 64596); + } + + [Fact] + public void CanDownloadSmallFileWithProxy() + { + IBaseSpaceClient client = CreateRealClient(useS3Proxy: true); + var fs = new FileStream("DownloadedFile-" + StringHelpers.RandomAlphanumericString(5), FileMode.OpenOrCreate); + + client.FileDownloadProgressChanged += delegate (object sender, FileDownloadProgressChangedEventArgs e) + { + Debug.WriteLine($"FileId={e.FileId} BytesDownloaded={e.BytesDownloaded} Progress={e.ProgressPercentage}%"); + }; + client.DownloadFile("145435603", fs); + Assert.Equal(fs.Length, 64596); + } [Fact] public void CanDownloadFile() { @@ -35,8 +62,7 @@ public void CanDownloadFile() Client.DownloadFile(response.Response.Id, fs); Assert.Equal(fs.Length, data.Length); } - - [Fact] + [Fact (Skip="takes too long - sujit")] public void CanDownloadLargerFile() { var project = TestHelpers.CreateRandomTestProject(Client); diff --git a/BaseSpace.SDK.sln b/BaseSpace.SDK.sln index 6983795..2481136 100644 --- a/BaseSpace.SDK.sln +++ b/BaseSpace.SDK.sln @@ -16,6 +16,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{E6DCBA EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TerminalVelocity.Sharp", "..\TerminalVelocity\src\TerminalVelocity.Sharp\TerminalVelocity.Sharp.csproj", "{9FE91B4B-5C87-4AC8-B15D-449987CAF4DA}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Starksoft.Aspen", "..\..\Users\Sujit\Downloads\starksoft-aspen-master\Starksoft.Aspen\Starksoft.Aspen.csproj", "{5F228FCD-54F1-491D-93CE-3D768655FADC}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -48,6 +50,14 @@ Global {9FE91B4B-5C87-4AC8-B15D-449987CAF4DA}.XamarinMacDebug|Any CPU.Build.0 = XamarinMacDebug|Any CPU {9FE91B4B-5C87-4AC8-B15D-449987CAF4DA}.XamarinMacRelease|Any CPU.ActiveCfg = XamarinMacRelease|Any CPU {9FE91B4B-5C87-4AC8-B15D-449987CAF4DA}.XamarinMacRelease|Any CPU.Build.0 = XamarinMacRelease|Any CPU + {5F228FCD-54F1-491D-93CE-3D768655FADC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5F228FCD-54F1-491D-93CE-3D768655FADC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5F228FCD-54F1-491D-93CE-3D768655FADC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5F228FCD-54F1-491D-93CE-3D768655FADC}.Release|Any CPU.Build.0 = Release|Any CPU + {5F228FCD-54F1-491D-93CE-3D768655FADC}.XamarinMacDebug|Any CPU.ActiveCfg = Debug|Any CPU + {5F228FCD-54F1-491D-93CE-3D768655FADC}.XamarinMacDebug|Any CPU.Build.0 = Debug|Any CPU + {5F228FCD-54F1-491D-93CE-3D768655FADC}.XamarinMacRelease|Any CPU.ActiveCfg = Release|Any CPU + {5F228FCD-54F1-491D-93CE-3D768655FADC}.XamarinMacRelease|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/BaseSpace.SDK/BaseSpace.SDK.csproj b/BaseSpace.SDK/BaseSpace.SDK.csproj index 8222856..4f096ec 100644 --- a/BaseSpace.SDK/BaseSpace.SDK.csproj +++ b/BaseSpace.SDK/BaseSpace.SDK.csproj @@ -48,13 +48,13 @@ ..\packages\Common.Logging.2.1.2\lib\net40\Common.Logging.dll - ..\..\..\SignedBinaries\ServiceStack.Common.dll + ..\..\SpaceElevator\SignedBinaries\ServiceStack.Common.dll - ..\..\..\SignedBinaries\ServiceStack.Interfaces.dll + ..\..\SpaceElevator\SignedBinaries\ServiceStack.Interfaces.dll - ..\..\..\SignedBinaries\ServiceStack.Text.dll + ..\..\SpaceElevator\SignedBinaries\ServiceStack.Text.dll diff --git a/BaseSpace.SDK/Infrastructure/BaseSpaceClientSettings.cs b/BaseSpace.SDK/Infrastructure/BaseSpaceClientSettings.cs index bfe7256..7af2d48 100644 --- a/BaseSpace.SDK/Infrastructure/BaseSpaceClientSettings.cs +++ b/BaseSpace.SDK/Infrastructure/BaseSpaceClientSettings.cs @@ -44,5 +44,7 @@ public BaseSpaceClientSettings() public IAuthentication Authentication { get; set; } public int TimeoutMin { get; set; } - } + + public bool UseS3Proxy { get; set; } + } } diff --git a/BaseSpace.SDK/Infrastructure/DownloadFileCommand.cs b/BaseSpace.SDK/Infrastructure/DownloadFileCommand.cs index 384c49f..a7075e0 100644 --- a/BaseSpace.SDK/Infrastructure/DownloadFileCommand.cs +++ b/BaseSpace.SDK/Infrastructure/DownloadFileCommand.cs @@ -28,9 +28,15 @@ internal class DownloadFileCommand : IAsyncProgress