From ad9eea740cc032e9e5765597fbd4f1dd539c06e3 Mon Sep 17 00:00:00 2001 From: matthchr Date: Thu, 27 Apr 2017 16:16:32 -0700 Subject: [PATCH 1/2] Port File Staging to VS17 --- Directory.Build.props | 2 +- .../FileStaging/AzureBatchFileStaging.sln | 41 +++--- .../Batch.FileStaging.Tests/App.config | 0 .../Batch.FileStaging.Tests.csproj | 66 ++++++++++ .../FileStagingIntegrationTests.cs | 5 - .../FileStagingUnitTests.cs | 12 +- .../Fixtures/PaasWindowsPoolFixture.cs | 2 +- .../Fixtures/PoolFixture.cs | 0 .../IntegrationTestUtilities/TestUtilities.cs | 3 - .../Batch.FileStaging.Tests/TestCommon.cs | 0 .../TestResources/Data.txt | 0 .../TestResources/Resources.cs | 0 .../TestResources/localWords.txt | 0 .../Batch.FileStaging.Tests/howto.txt | 0 .../AssemblyAttributes.cs | 8 +- .../Batch.FileStaging.csproj | 51 +++++++ .../ErrorMessages.Designer.cs | 7 +- .../ErrorMessages.resx | 0 .../FileStagingNamingHelpers.cs} | 24 +--- .../SequentialFileStaging.cs | 22 +--- .../SequentialFileStagingArtifact.cs | 9 +- .../StagingStorageAccount.cs | 0 .../app.config | 0 .../Azure.Batch.FileStaging.nuget.proj | 9 -- .../Azure.Batch.FileStaging.nuspec | 35 ----- .../Batch.FileStaging.csproj | 116 ---------------- .../Src/AzureBatchFileStaging/packages.config | 13 -- .../Batch.FileStaging.Tests.csproj | 124 ------------------ .../Batch.FileStaging.Tests/packages.config | 20 --- .../Batch/Support/FileStaging/nuget.config | 6 - 30 files changed, 166 insertions(+), 409 deletions(-) rename src/SDKs/Batch/Support/FileStaging/{Tests => }/Batch.FileStaging.Tests/App.config (100%) create mode 100644 src/SDKs/Batch/Support/FileStaging/Batch.FileStaging.Tests/Batch.FileStaging.Tests.csproj rename src/SDKs/Batch/Support/FileStaging/{Tests => }/Batch.FileStaging.Tests/FileStagingIntegrationTests.cs (96%) rename src/SDKs/Batch/Support/FileStaging/{Tests => }/Batch.FileStaging.Tests/FileStagingUnitTests.cs (79%) rename src/SDKs/Batch/Support/FileStaging/{Tests => }/Batch.FileStaging.Tests/Fixtures/PaasWindowsPoolFixture.cs (97%) rename src/SDKs/Batch/Support/FileStaging/{Tests => }/Batch.FileStaging.Tests/Fixtures/PoolFixture.cs (100%) rename src/SDKs/Batch/Support/FileStaging/{Tests => }/Batch.FileStaging.Tests/IntegrationTestUtilities/TestUtilities.cs (96%) rename src/SDKs/Batch/Support/FileStaging/{Tests => }/Batch.FileStaging.Tests/TestCommon.cs (100%) rename src/SDKs/Batch/Support/FileStaging/{Tests => }/Batch.FileStaging.Tests/TestResources/Data.txt (100%) rename src/SDKs/Batch/Support/FileStaging/{Tests => }/Batch.FileStaging.Tests/TestResources/Resources.cs (100%) rename src/SDKs/Batch/Support/FileStaging/{Tests => }/Batch.FileStaging.Tests/TestResources/localWords.txt (100%) rename src/SDKs/Batch/Support/FileStaging/{Tests => }/Batch.FileStaging.Tests/howto.txt (100%) rename src/SDKs/Batch/Support/FileStaging/{Src/AzureBatchFileStaging => Batch.FileStaging}/AssemblyAttributes.cs (69%) create mode 100644 src/SDKs/Batch/Support/FileStaging/Batch.FileStaging/Batch.FileStaging.csproj rename src/SDKs/Batch/Support/FileStaging/{Src/AzureBatchFileStaging => Batch.FileStaging}/ErrorMessages.Designer.cs (97%) rename src/SDKs/Batch/Support/FileStaging/{Src/AzureBatchFileStaging => Batch.FileStaging}/ErrorMessages.resx (100%) rename src/SDKs/Batch/Support/FileStaging/{Src/AzureBatchFileStaging/FileStagingLinkedSources.cs => Batch.FileStaging/FileStagingNamingHelpers.cs} (63%) rename src/SDKs/Batch/Support/FileStaging/{Src/AzureBatchFileStaging => Batch.FileStaging}/SequentialFileStaging.cs (95%) rename src/SDKs/Batch/Support/FileStaging/{Src/AzureBatchFileStaging => Batch.FileStaging}/SequentialFileStagingArtifact.cs (85%) rename src/SDKs/Batch/Support/FileStaging/{Src/AzureBatchFileStaging => Batch.FileStaging}/StagingStorageAccount.cs (100%) rename src/SDKs/Batch/Support/FileStaging/{Src/AzureBatchFileStaging => Batch.FileStaging}/app.config (100%) delete mode 100644 src/SDKs/Batch/Support/FileStaging/Src/AzureBatchFileStaging/Azure.Batch.FileStaging.nuget.proj delete mode 100644 src/SDKs/Batch/Support/FileStaging/Src/AzureBatchFileStaging/Azure.Batch.FileStaging.nuspec delete mode 100644 src/SDKs/Batch/Support/FileStaging/Src/AzureBatchFileStaging/Batch.FileStaging.csproj delete mode 100644 src/SDKs/Batch/Support/FileStaging/Src/AzureBatchFileStaging/packages.config delete mode 100644 src/SDKs/Batch/Support/FileStaging/Tests/Batch.FileStaging.Tests/Batch.FileStaging.Tests.csproj delete mode 100644 src/SDKs/Batch/Support/FileStaging/Tests/Batch.FileStaging.Tests/packages.config delete mode 100644 src/SDKs/Batch/Support/FileStaging/nuget.config diff --git a/Directory.Build.props b/Directory.Build.props index 5e0e7b5860b9..8ec4f1febf83 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -19,7 +19,7 @@ true true - $(IgnorePathTokens) Microsoft.Azure.KeyVault.Samples Gallery Intune FileConventions FileStaging ConfigureAwaitAnalyzer ObjectModelCodeGeneration Azure.Batch.IntegrationTests Azure.Batch.ProtocolTests IntegrationTestCommon + $(IgnorePathTokens) Microsoft.Azure.KeyVault.Samples Gallery Intune FileConventions Batch.FileStaging.Tests ConfigureAwaitAnalyzer ObjectModelCodeGeneration Azure.Batch.IntegrationTests Azure.Batch.ProtocolTests IntegrationTestCommon $(OnPremiseBuildTasks) diff --git a/src/SDKs/Batch/Support/FileStaging/AzureBatchFileStaging.sln b/src/SDKs/Batch/Support/FileStaging/AzureBatchFileStaging.sln index 4504d83adeb0..1a8f6bf33f66 100644 --- a/src/SDKs/Batch/Support/FileStaging/AzureBatchFileStaging.sln +++ b/src/SDKs/Batch/Support/FileStaging/AzureBatchFileStaging.sln @@ -1,38 +1,31 @@ Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 14 -VisualStudioVersion = 14.0.25420.1 +# Visual Studio 15 +VisualStudioVersion = 15.0.26403.7 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Batch.FileStaging", "Src\AzureBatchFileStaging\Batch.FileStaging.csproj", "{A7B9CD95-7EC3-4CCF-B20F-951FD2D028F1}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Batch.FileStaging", "Batch.FileStaging\Batch.FileStaging.csproj", "{A7B9CD95-7EC3-4CCF-B20F-951FD2D028F1}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Batch.FileStaging.Tests", "Tests\Batch.FileStaging.Tests\Batch.FileStaging.Tests.csproj", "{C809285A-784D-48E4-9D7A-F5685A19F595}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Batch.FileStaging.Tests", "Batch.FileStaging.Tests\Batch.FileStaging.Tests.csproj", "{C809285A-784D-48E4-9D7A-F5685A19F595}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConfigureAwaitAnalyzer", "..\ClientIntegrationTesting\Tools\ConfigureAwaitAnalyzer\ConfigureAwaitAnalyzer\ConfigureAwaitAnalyzer.csproj", "{48215D6D-DB21-48B8-AB03-1297A94DF696}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConfigureAwaitAnalyzer", "..\..\DataPlane\Tools\ConfigureAwaitAnalyzer\ConfigureAwaitAnalyzer\ConfigureAwaitAnalyzer.csproj", "{48215D6D-DB21-48B8-AB03-1297A94DF696}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Net45-Debug|Any CPU = Net45-Debug|Any CPU Net45-Release|Any CPU = Net45-Release|Any CPU - Portable-Debug|Any CPU = Portable-Debug|Any CPU - Portable-Release|Any CPU = Portable-Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {A7B9CD95-7EC3-4CCF-B20F-951FD2D028F1}.Net45-Debug|Any CPU.ActiveCfg = Net45-Debug|Any CPU - {A7B9CD95-7EC3-4CCF-B20F-951FD2D028F1}.Net45-Debug|Any CPU.Build.0 = Net45-Debug|Any CPU - {A7B9CD95-7EC3-4CCF-B20F-951FD2D028F1}.Net45-Release|Any CPU.ActiveCfg = Net45-Release|Any CPU - {A7B9CD95-7EC3-4CCF-B20F-951FD2D028F1}.Net45-Release|Any CPU.Build.0 = Net45-Release|Any CPU - {A7B9CD95-7EC3-4CCF-B20F-951FD2D028F1}.Portable-Debug|Any CPU.ActiveCfg = Portable-Debug|Any CPU - {A7B9CD95-7EC3-4CCF-B20F-951FD2D028F1}.Portable-Release|Any CPU.ActiveCfg = Portable-Release|Any CPU - {C809285A-784D-48E4-9D7A-F5685A19F595}.Net45-Debug|Any CPU.ActiveCfg = Net45-Debug|Any CPU - {C809285A-784D-48E4-9D7A-F5685A19F595}.Net45-Debug|Any CPU.Build.0 = Net45-Debug|Any CPU - {C809285A-784D-48E4-9D7A-F5685A19F595}.Net45-Release|Any CPU.ActiveCfg = Net45-Release|Any CPU - {C809285A-784D-48E4-9D7A-F5685A19F595}.Portable-Debug|Any CPU.ActiveCfg = Portable-Debug|Any CPU - {C809285A-784D-48E4-9D7A-F5685A19F595}.Portable-Release|Any CPU.ActiveCfg = Portable-Release|Any CPU - {48215D6D-DB21-48B8-AB03-1297A94DF696}.Net45-Debug|Any CPU.ActiveCfg = Net45-Debug|Any CPU - {48215D6D-DB21-48B8-AB03-1297A94DF696}.Net45-Debug|Any CPU.Build.0 = Net45-Debug|Any CPU - {48215D6D-DB21-48B8-AB03-1297A94DF696}.Net45-Release|Any CPU.ActiveCfg = Net45-Release|Any CPU - {48215D6D-DB21-48B8-AB03-1297A94DF696}.Net45-Release|Any CPU.Build.0 = Net45-Release|Any CPU - {48215D6D-DB21-48B8-AB03-1297A94DF696}.Portable-Debug|Any CPU.ActiveCfg = Portable-Debug|Any CPU - {48215D6D-DB21-48B8-AB03-1297A94DF696}.Portable-Release|Any CPU.ActiveCfg = Portable-Release|Any CPU + {A7B9CD95-7EC3-4CCF-B20F-951FD2D028F1}.Net45-Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A7B9CD95-7EC3-4CCF-B20F-951FD2D028F1}.Net45-Debug|Any CPU.Build.0 = Debug|Any CPU + {A7B9CD95-7EC3-4CCF-B20F-951FD2D028F1}.Net45-Release|Any CPU.ActiveCfg = Release|Any CPU + {A7B9CD95-7EC3-4CCF-B20F-951FD2D028F1}.Net45-Release|Any CPU.Build.0 = Release|Any CPU + {C809285A-784D-48E4-9D7A-F5685A19F595}.Net45-Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C809285A-784D-48E4-9D7A-F5685A19F595}.Net45-Debug|Any CPU.Build.0 = Debug|Any CPU + {C809285A-784D-48E4-9D7A-F5685A19F595}.Net45-Release|Any CPU.ActiveCfg = Release|Any CPU + {C809285A-784D-48E4-9D7A-F5685A19F595}.Net45-Release|Any CPU.Build.0 = Release|Any CPU + {48215D6D-DB21-48B8-AB03-1297A94DF696}.Net45-Debug|Any CPU.ActiveCfg = Debug|Any CPU + {48215D6D-DB21-48B8-AB03-1297A94DF696}.Net45-Debug|Any CPU.Build.0 = Debug|Any CPU + {48215D6D-DB21-48B8-AB03-1297A94DF696}.Net45-Release|Any CPU.ActiveCfg = Release|Any CPU + {48215D6D-DB21-48B8-AB03-1297A94DF696}.Net45-Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/SDKs/Batch/Support/FileStaging/Tests/Batch.FileStaging.Tests/App.config b/src/SDKs/Batch/Support/FileStaging/Batch.FileStaging.Tests/App.config similarity index 100% rename from src/SDKs/Batch/Support/FileStaging/Tests/Batch.FileStaging.Tests/App.config rename to src/SDKs/Batch/Support/FileStaging/Batch.FileStaging.Tests/App.config diff --git a/src/SDKs/Batch/Support/FileStaging/Batch.FileStaging.Tests/Batch.FileStaging.Tests.csproj b/src/SDKs/Batch/Support/FileStaging/Batch.FileStaging.Tests/Batch.FileStaging.Tests.csproj new file mode 100644 index 000000000000..0f520bf2c436 --- /dev/null +++ b/src/SDKs/Batch/Support/FileStaging/Batch.FileStaging.Tests/Batch.FileStaging.Tests.csproj @@ -0,0 +1,66 @@ + + + + Debug + $(LibraryNugetPackageFolder) + + $(BuiltPackageOutputDir) + false + true + false + + true + + + + FullNetFx + bin\$(Configuration)\ + bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml + + + + netcoreapp11 + bin\$(Configuration)\ + bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml + + + + + + + + + + + + + + BatchClientIntegrationsTests + Azure Batch File Staging integration tests + 1.0.0-preview + true + + + netcoreapp1.1 + + + + + + + + + + + + + + PreserveNewest + + + PreserveNewest + + + \ No newline at end of file diff --git a/src/SDKs/Batch/Support/FileStaging/Tests/Batch.FileStaging.Tests/FileStagingIntegrationTests.cs b/src/SDKs/Batch/Support/FileStaging/Batch.FileStaging.Tests/FileStagingIntegrationTests.cs similarity index 96% rename from src/SDKs/Batch/Support/FileStaging/Tests/Batch.FileStaging.Tests/FileStagingIntegrationTests.cs rename to src/SDKs/Batch/Support/FileStaging/Batch.FileStaging.Tests/FileStagingIntegrationTests.cs index 010101e75e0c..d95fce35620e 100644 --- a/src/SDKs/Batch/Support/FileStaging/Tests/Batch.FileStaging.Tests/FileStagingIntegrationTests.cs +++ b/src/SDKs/Batch/Support/FileStaging/Batch.FileStaging.Tests/FileStagingIntegrationTests.cs @@ -12,8 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -extern alias fs; // Temporary bridge until the Batch core NuGet without file staging is published - namespace Batch.FileStaging.Tests { using System; @@ -27,9 +25,6 @@ namespace Batch.FileStaging.Tests using Fixtures; using Microsoft.Azure.Batch; using Microsoft.Azure.Batch.FileStaging; - using StagingStorageAccount = fs::Microsoft.Azure.Batch.FileStaging.StagingStorageAccount; // Temporary bridge until the Batch core NuGet without file staging is published - using FileToStage = fs::Microsoft.Azure.Batch.FileStaging.FileToStage; // Temporary bridge until the Batch core NuGet without file staging is published - using SequentialFileStagingArtifact = fs::Microsoft.Azure.Batch.FileStaging.SequentialFileStagingArtifact; // Temporary bridge until the Batch core NuGet without file staging is published using TestResources; using IntegrationTestUtilities; using Xunit; diff --git a/src/SDKs/Batch/Support/FileStaging/Tests/Batch.FileStaging.Tests/FileStagingUnitTests.cs b/src/SDKs/Batch/Support/FileStaging/Batch.FileStaging.Tests/FileStagingUnitTests.cs similarity index 79% rename from src/SDKs/Batch/Support/FileStaging/Tests/Batch.FileStaging.Tests/FileStagingUnitTests.cs rename to src/SDKs/Batch/Support/FileStaging/Batch.FileStaging.Tests/FileStagingUnitTests.cs index c7c32f1d2a57..0dc0fb5d7c9b 100644 --- a/src/SDKs/Batch/Support/FileStaging/Tests/Batch.FileStaging.Tests/FileStagingUnitTests.cs +++ b/src/SDKs/Batch/Support/FileStaging/Batch.FileStaging.Tests/FileStagingUnitTests.cs @@ -12,13 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. -extern alias fs; - namespace Batch.FileStaging.Tests { using System; + using Microsoft.Azure.Batch.FileStaging; using Xunit; - using fs::Microsoft.Azure.Batch.FileStaging; public class FileStagingUnitTests { @@ -39,5 +37,13 @@ public void StagingStorageAccount_EmptyStorageAccountBlobEndpoint_ThrowsArgument { Assert.Throws(() => { new StagingStorageAccount(storageAccount: "account", storageAccountKey: "key", blobEndpoint: ""); }); } + + [Fact] + public void ContainerName_LargeNamingFragment_DoesNotExceedMaxContainerLength() + { + const string fragment = "thisisaquitelongnamingfragmentitmightnotfit"; + string name = FileStagingNamingHelpers.ConstructDefaultName(fragment); + Assert.True(name.Length <= FileStagingNamingHelpers.MaxContainerNameLength); + } } } diff --git a/src/SDKs/Batch/Support/FileStaging/Tests/Batch.FileStaging.Tests/Fixtures/PaasWindowsPoolFixture.cs b/src/SDKs/Batch/Support/FileStaging/Batch.FileStaging.Tests/Fixtures/PaasWindowsPoolFixture.cs similarity index 97% rename from src/SDKs/Batch/Support/FileStaging/Tests/Batch.FileStaging.Tests/Fixtures/PaasWindowsPoolFixture.cs rename to src/SDKs/Batch/Support/FileStaging/Batch.FileStaging.Tests/Fixtures/PaasWindowsPoolFixture.cs index d55df98860e2..67af3c660418 100644 --- a/src/SDKs/Batch/Support/FileStaging/Tests/Batch.FileStaging.Tests/Fixtures/PaasWindowsPoolFixture.cs +++ b/src/SDKs/Batch/Support/FileStaging/Batch.FileStaging.Tests/Fixtures/PaasWindowsPoolFixture.cs @@ -40,7 +40,7 @@ protected CloudPool CreatePool() this.PoolId, VMSize, passConfiguration, - targetDedicated: 1); + targetDedicatedComputeNodes: 1); StartTask st = new StartTask("cmd /c hostname"); diff --git a/src/SDKs/Batch/Support/FileStaging/Tests/Batch.FileStaging.Tests/Fixtures/PoolFixture.cs b/src/SDKs/Batch/Support/FileStaging/Batch.FileStaging.Tests/Fixtures/PoolFixture.cs similarity index 100% rename from src/SDKs/Batch/Support/FileStaging/Tests/Batch.FileStaging.Tests/Fixtures/PoolFixture.cs rename to src/SDKs/Batch/Support/FileStaging/Batch.FileStaging.Tests/Fixtures/PoolFixture.cs diff --git a/src/SDKs/Batch/Support/FileStaging/Tests/Batch.FileStaging.Tests/IntegrationTestUtilities/TestUtilities.cs b/src/SDKs/Batch/Support/FileStaging/Batch.FileStaging.Tests/IntegrationTestUtilities/TestUtilities.cs similarity index 96% rename from src/SDKs/Batch/Support/FileStaging/Tests/Batch.FileStaging.Tests/IntegrationTestUtilities/TestUtilities.cs rename to src/SDKs/Batch/Support/FileStaging/Batch.FileStaging.Tests/IntegrationTestUtilities/TestUtilities.cs index fb81d8ad3bd9..7814d378aa12 100644 --- a/src/SDKs/Batch/Support/FileStaging/Tests/Batch.FileStaging.Tests/IntegrationTestUtilities/TestUtilities.cs +++ b/src/SDKs/Batch/Support/FileStaging/Batch.FileStaging.Tests/IntegrationTestUtilities/TestUtilities.cs @@ -12,8 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -extern alias fs; // Temporary bridge until the Batch core NuGet without file staging is published - namespace Batch.FileStaging.Tests.IntegrationTestUtilities { using System; @@ -29,7 +27,6 @@ namespace Batch.FileStaging.Tests.IntegrationTestUtilities using Microsoft.Azure.Batch.Auth; using Microsoft.Azure.Batch.Common; using Microsoft.Azure.Batch.FileStaging; - using StagingStorageAccount = fs::Microsoft.Azure.Batch.FileStaging.StagingStorageAccount; // Temporary bridge until the Batch core NuGet without file staging is published using Newtonsoft.Json; using Xunit; using Xunit.Abstractions; diff --git a/src/SDKs/Batch/Support/FileStaging/Tests/Batch.FileStaging.Tests/TestCommon.cs b/src/SDKs/Batch/Support/FileStaging/Batch.FileStaging.Tests/TestCommon.cs similarity index 100% rename from src/SDKs/Batch/Support/FileStaging/Tests/Batch.FileStaging.Tests/TestCommon.cs rename to src/SDKs/Batch/Support/FileStaging/Batch.FileStaging.Tests/TestCommon.cs diff --git a/src/SDKs/Batch/Support/FileStaging/Tests/Batch.FileStaging.Tests/TestResources/Data.txt b/src/SDKs/Batch/Support/FileStaging/Batch.FileStaging.Tests/TestResources/Data.txt similarity index 100% rename from src/SDKs/Batch/Support/FileStaging/Tests/Batch.FileStaging.Tests/TestResources/Data.txt rename to src/SDKs/Batch/Support/FileStaging/Batch.FileStaging.Tests/TestResources/Data.txt diff --git a/src/SDKs/Batch/Support/FileStaging/Tests/Batch.FileStaging.Tests/TestResources/Resources.cs b/src/SDKs/Batch/Support/FileStaging/Batch.FileStaging.Tests/TestResources/Resources.cs similarity index 100% rename from src/SDKs/Batch/Support/FileStaging/Tests/Batch.FileStaging.Tests/TestResources/Resources.cs rename to src/SDKs/Batch/Support/FileStaging/Batch.FileStaging.Tests/TestResources/Resources.cs diff --git a/src/SDKs/Batch/Support/FileStaging/Tests/Batch.FileStaging.Tests/TestResources/localWords.txt b/src/SDKs/Batch/Support/FileStaging/Batch.FileStaging.Tests/TestResources/localWords.txt similarity index 100% rename from src/SDKs/Batch/Support/FileStaging/Tests/Batch.FileStaging.Tests/TestResources/localWords.txt rename to src/SDKs/Batch/Support/FileStaging/Batch.FileStaging.Tests/TestResources/localWords.txt diff --git a/src/SDKs/Batch/Support/FileStaging/Tests/Batch.FileStaging.Tests/howto.txt b/src/SDKs/Batch/Support/FileStaging/Batch.FileStaging.Tests/howto.txt similarity index 100% rename from src/SDKs/Batch/Support/FileStaging/Tests/Batch.FileStaging.Tests/howto.txt rename to src/SDKs/Batch/Support/FileStaging/Batch.FileStaging.Tests/howto.txt diff --git a/src/SDKs/Batch/Support/FileStaging/Src/AzureBatchFileStaging/AssemblyAttributes.cs b/src/SDKs/Batch/Support/FileStaging/Batch.FileStaging/AssemblyAttributes.cs similarity index 69% rename from src/SDKs/Batch/Support/FileStaging/Src/AzureBatchFileStaging/AssemblyAttributes.cs rename to src/SDKs/Batch/Support/FileStaging/Batch.FileStaging/AssemblyAttributes.cs index 6babd46cb978..526b650a44a7 100644 --- a/src/SDKs/Batch/Support/FileStaging/Src/AzureBatchFileStaging/AssemblyAttributes.cs +++ b/src/SDKs/Batch/Support/FileStaging/Batch.FileStaging/AssemblyAttributes.cs @@ -20,8 +20,8 @@ [assembly: AssemblyTitle("Microsoft.Azure.Batch.FileStaging")] [assembly: AssemblyDescription("Client library for uploading resource files for tasks in the Azure Batch service.")] -[assembly: AssemblyVersion("6.0.0.0")] -[assembly: AssemblyFileVersion("6.0.0.0")] +[assembly: AssemblyVersion("7.0.0.0")] +[assembly: AssemblyFileVersion("7.0.0.0")] [assembly: AssemblyCompany("Microsoft Corporation")] [assembly: AssemblyProduct("Microsoft Azure")] [assembly: AssemblyCopyright("Copyright (c) Microsoft Corporation. All rights reserved.")] @@ -30,7 +30,7 @@ #if CODESIGN -[assembly: InternalsVisibleTo("Azure.Batch.Unit.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] +[assembly: InternalsVisibleTo("Batch.FileStaging.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] #else -[assembly: InternalsVisibleTo("Azure.Batch.Unit.Tests")] +[assembly: InternalsVisibleTo("Batch.FileStaging.Tests")] #endif diff --git a/src/SDKs/Batch/Support/FileStaging/Batch.FileStaging/Batch.FileStaging.csproj b/src/SDKs/Batch/Support/FileStaging/Batch.FileStaging/Batch.FileStaging.csproj new file mode 100644 index 000000000000..d2f4ec0de2e9 --- /dev/null +++ b/src/SDKs/Batch/Support/FileStaging/Batch.FileStaging/Batch.FileStaging.csproj @@ -0,0 +1,51 @@ + + + Azure.Batch.FileStaging + This library simplifies uploading resource files for use by tasks in the Microsoft Azure Batch service. + +Visit our home page for more detail - http://azure.microsoft.com/services/batch/. + +For technical overview, see http://azure.microsoft.com/documentation/articles/batch-technical-overview/. + +API reference can be found at http://go.microsoft.com/fwlink/?LinkId=717949. + 7.0.0 + $(DefineConstants);CODESIGN + true + Microsoft.Azure.Batch.FileStaging + Microsoft;Azure;Batch;windowsazureofficial + bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml + true + true + $(LibraryToolsFolder)\MSSharedLibKey.snk + $(LibraryNugetPackageFolder) + + + net452;netstandard1.4 + True + + + + $(DefineConstants);FullNetFx + + + + $(DefineConstants);netstandard14 + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/SDKs/Batch/Support/FileStaging/Src/AzureBatchFileStaging/ErrorMessages.Designer.cs b/src/SDKs/Batch/Support/FileStaging/Batch.FileStaging/ErrorMessages.Designer.cs similarity index 97% rename from src/SDKs/Batch/Support/FileStaging/Src/AzureBatchFileStaging/ErrorMessages.Designer.cs rename to src/SDKs/Batch/Support/FileStaging/Batch.FileStaging/ErrorMessages.Designer.cs index 4f7c3c24ba1a..873dc0477373 100644 --- a/src/SDKs/Batch/Support/FileStaging/Src/AzureBatchFileStaging/ErrorMessages.Designer.cs +++ b/src/SDKs/Batch/Support/FileStaging/Batch.FileStaging/ErrorMessages.Designer.cs @@ -10,8 +10,9 @@ namespace Microsoft.Azure.Batch.FileStaging { using System; - - + using System.Reflection; + + /// /// A strongly-typed resource class, for looking up localized strings, etc. /// @@ -39,7 +40,7 @@ internal ErrorMessages() { internal static global::System.Resources.ResourceManager ResourceManager { get { if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Microsoft.Azure.Batch.FileStaging.ErrorMessages", typeof(ErrorMessages).Assembly); + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Microsoft.Azure.Batch.FileStaging.ErrorMessages", typeof(ErrorMessages).GetTypeInfo().Assembly); resourceMan = temp; } return resourceMan; diff --git a/src/SDKs/Batch/Support/FileStaging/Src/AzureBatchFileStaging/ErrorMessages.resx b/src/SDKs/Batch/Support/FileStaging/Batch.FileStaging/ErrorMessages.resx similarity index 100% rename from src/SDKs/Batch/Support/FileStaging/Src/AzureBatchFileStaging/ErrorMessages.resx rename to src/SDKs/Batch/Support/FileStaging/Batch.FileStaging/ErrorMessages.resx diff --git a/src/SDKs/Batch/Support/FileStaging/Src/AzureBatchFileStaging/FileStagingLinkedSources.cs b/src/SDKs/Batch/Support/FileStaging/Batch.FileStaging/FileStagingNamingHelpers.cs similarity index 63% rename from src/SDKs/Batch/Support/FileStaging/Src/AzureBatchFileStaging/FileStagingLinkedSources.cs rename to src/SDKs/Batch/Support/FileStaging/Batch.FileStaging/FileStagingNamingHelpers.cs index f9492d53b4d8..90898f67b9fe 100644 --- a/src/SDKs/Batch/Support/FileStaging/Src/AzureBatchFileStaging/FileStagingLinkedSources.cs +++ b/src/SDKs/Batch/Support/FileStaging/Batch.FileStaging/FileStagingNamingHelpers.cs @@ -13,19 +13,13 @@ // limitations under the License. using System; -using System.Collections.Generic; using System.Text; -using System.Threading.Tasks; -using System.Collections.Concurrent; -using System.Diagnostics; -using System.Threading; -using System.Security; -using System.Runtime.InteropServices; namespace Microsoft.Azure.Batch.FileStaging { - internal sealed class FileStagingLinkedSources + internal static class FileStagingNamingHelpers { + public const int MaxContainerNameLength = 63; private static string MakeDefaultNamePlusNamingFragment(string namingFragment) { @@ -44,20 +38,14 @@ private static string MakeDefaultNamePlusNamingFragment(string namingFragment) return newName; } - // lock used to ensure only one name is created at a time. - private static object _lockForContainerNaming = new object(); - internal static string ConstructDefaultName(string namingFragment) { - lock (_lockForContainerNaming) - { - Thread.Sleep(30); // make sure no two names are identical + string timeString = DateTime.UtcNow.ToString("yyyy-MM-dd-HH-mm-ss"); + string containerName = MakeDefaultNamePlusNamingFragment(namingFragment) + timeString + Guid.NewGuid().ToString("D"); - string uniqueLetsHope = DateTime.UtcNow.ToString("yyyy-MM-dd-HH-mm-ss-fff"); - string defContainerName = MakeDefaultNamePlusNamingFragment(namingFragment) + uniqueLetsHope; + containerName = containerName.Length > MaxContainerNameLength ? containerName.Substring(0, MaxContainerNameLength) : containerName; - return defContainerName; - } + return containerName; } } } diff --git a/src/SDKs/Batch/Support/FileStaging/Src/AzureBatchFileStaging/SequentialFileStaging.cs b/src/SDKs/Batch/Support/FileStaging/Batch.FileStaging/SequentialFileStaging.cs similarity index 95% rename from src/SDKs/Batch/Support/FileStaging/Src/AzureBatchFileStaging/SequentialFileStaging.cs rename to src/SDKs/Batch/Support/FileStaging/Batch.FileStaging/SequentialFileStaging.cs index 3c69492e903a..ab9fff826056 100644 --- a/src/SDKs/Batch/Support/FileStaging/Src/AzureBatchFileStaging/SequentialFileStaging.cs +++ b/src/SDKs/Batch/Support/FileStaging/Batch.FileStaging/SequentialFileStaging.cs @@ -12,22 +12,12 @@ // See the License for the specific language governing permissions and // limitations under the License. -#pragma warning disable 436 // Temporary bridge until the Batch core NuGet without file staging is published - using System; using System.Collections.Generic; -using System.Collections.Concurrent; -using System.Text; using System.IO; -using System.Threading; -using System.Diagnostics; -using System.Security; -using System.Runtime.InteropServices; - using Microsoft.WindowsAzure.Storage; using Microsoft.WindowsAzure.Storage.Blob; -using BatchFS=Microsoft.Azure.Batch.FileStaging; namespace Microsoft.Azure.Batch.FileStaging { @@ -144,7 +134,7 @@ public void Validate() { if (!File.Exists(this.LocalFileToStage)) { - throw new FileNotFoundException(string.Format(BatchFS.ErrorMessages.FileStagingLocalFileNotFound, this.LocalFileToStage)); + throw new FileNotFoundException(string.Format(ErrorMessages.FileStagingLocalFileNotFound, this.LocalFileToStage)); } } @@ -202,7 +192,7 @@ private static string CreateContainerWithPolicySASIfNotExist(string account, str // 2. create container if it doesn't exist CloudBlobContainer storagecontainer = client.GetContainerReference(container); - storagecontainer.CreateIfNotExists(); + storagecontainer.CreateIfNotExistsAsync().GetAwaiter().GetResult(); // 3. validate policy, create/overwrite if doesn't match bool policyFound = false; @@ -214,7 +204,7 @@ private static string CreateContainerWithPolicySASIfNotExist(string account, str Permissions = permissions }; - BlobContainerPermissions blobPermissions = storagecontainer.GetPermissions(); + BlobContainerPermissions blobPermissions = storagecontainer.GetPermissionsAsync().GetAwaiter().GetResult(); if (blobPermissions.SharedAccessPolicies.ContainsKey(policy)) { @@ -235,7 +225,7 @@ private static string CreateContainerWithPolicySASIfNotExist(string account, str if (!policyFound) { - storagecontainer.SetPermissions(blobPermissions); + storagecontainer.SetPermissionsAsync(blobPermissions).GetAwaiter().GetResult(); } // 4. genereate SAS and return @@ -250,7 +240,7 @@ private static void CreateDefaultBlobContainerAndSASIfNeededReturn(List 0)) { // construct the name of the new blob container. - seqArtifact.BlobContainerCreated = FileStagingLinkedSources.ConstructDefaultName(seqArtifact.NamingFragment).ToLowerInvariant(); + seqArtifact.BlobContainerCreated = FileStagingNamingHelpers.ConstructDefaultName(seqArtifact.NamingFragment).ToLowerInvariant(); // get any instance for the storage credentials FileToStage anyRealInstance = FindAtLeastOne(filesToStage); @@ -320,7 +310,7 @@ private static async System.Threading.Tasks.Task StageFilesInternalAsync(List - - - - 6.0.0 - $(MSBuildThisFileDirectory) - - - diff --git a/src/SDKs/Batch/Support/FileStaging/Src/AzureBatchFileStaging/Azure.Batch.FileStaging.nuspec b/src/SDKs/Batch/Support/FileStaging/Src/AzureBatchFileStaging/Azure.Batch.FileStaging.nuspec deleted file mode 100644 index 374e37a0ee14..000000000000 --- a/src/SDKs/Batch/Support/FileStaging/Src/AzureBatchFileStaging/Azure.Batch.FileStaging.nuspec +++ /dev/null @@ -1,35 +0,0 @@ - - - - Azure.Batch.FileStaging - $version$ - Microsoft Azure Batch File Staging - Microsoft - azure-sdk, Microsoft - http://aka.ms/windowsazureapache2 - https://github.com/Azure/azure-sdk-for-net - http://go.microsoft.com/fwlink/?LinkID=288890 - true - -This library simplifies uploading resource files for use by tasks in the Microsoft Azure Batch service. - -Visit our home page for more detail - http://azure.microsoft.com/services/batch/. - -For technical overview, see http://azure.microsoft.com/documentation/articles/batch-technical-overview/. - -API reference can be found at http://go.microsoft.com/fwlink/?LinkId=717949. - Resource file staging support for the Microsoft Azure Batch service. - Microsoft, Azure, Batch, windowsazureofficial - - - - - - - - - - - - - diff --git a/src/SDKs/Batch/Support/FileStaging/Src/AzureBatchFileStaging/Batch.FileStaging.csproj b/src/SDKs/Batch/Support/FileStaging/Src/AzureBatchFileStaging/Batch.FileStaging.csproj deleted file mode 100644 index 9c15ed6c8d8c..000000000000 --- a/src/SDKs/Batch/Support/FileStaging/Src/AzureBatchFileStaging/Batch.FileStaging.csproj +++ /dev/null @@ -1,116 +0,0 @@ - - - - - AnyCPU - {A7B9CD95-7EC3-4CCF-B20F-951FD2D028F1} - Library - Properties - Microsoft.Azure.Batch.FileStaging - Microsoft.Azure.Batch.FileStaging - $(ProjectDir)$(OutputPath)$(AssemblyName).xml - true - 4 - true - - - - - - - - - $(LibraryNugetPackageFolder)\Azure.Batch.6.0.0\lib\net45\Microsoft.Azure.Batch.dll - True - - - $(LibraryNugetPackageFolder)\Microsoft.Azure.KeyVault.Core.1.0.0\lib\net40\Microsoft.Azure.KeyVault.Core.dll - True - - - $(LibraryNugetPackageFolder)\Microsoft.Data.Edm.5.7.0\lib\net40\Microsoft.Data.Edm.dll - True - - - $(LibraryNugetPackageFolder)\Microsoft.Data.OData.5.7.0\lib\net40\Microsoft.Data.OData.dll - True - - - $(LibraryNugetPackageFolder)\Microsoft.Data.Services.Client.5.7.0\lib\net40\Microsoft.Data.Services.Client.dll - True - - - $(LibraryNugetPackageFolder)\Microsoft.Rest.ClientRuntime.2.3.5\lib\net45\Microsoft.Rest.ClientRuntime.dll - True - - - $(LibraryNugetPackageFolder)\Microsoft.Rest.ClientRuntime.Azure.3.3.5\lib\net45\Microsoft.Rest.ClientRuntime.Azure.dll - True - - - $(LibraryNugetPackageFolder)\WindowsAzure.Storage.8.0.1\lib\net45\Microsoft.WindowsAzure.Storage.dll - True - - - $(LibraryNugetPackageFolder)\Newtonsoft.Json.6.0.8\lib\net45\Newtonsoft.Json.dll - True - - - - - - - - $(LibraryNugetPackageFolder)\System.Spatial.5.7.0\lib\net40\System.Spatial.dll - True - - - - - - - - - - - - - - - True - True - ErrorMessages.resx - - - - - - - - - - - - - ResXFileCodeGenerator - ErrorMessages.Designer.cs - - - - - {48215d6d-db21-48b8-ab03-1297a94df696} - ConfigureAwaitAnalyzer - false - False - - - - - - \ No newline at end of file diff --git a/src/SDKs/Batch/Support/FileStaging/Src/AzureBatchFileStaging/packages.config b/src/SDKs/Batch/Support/FileStaging/Src/AzureBatchFileStaging/packages.config deleted file mode 100644 index cda3f57a9383..000000000000 --- a/src/SDKs/Batch/Support/FileStaging/Src/AzureBatchFileStaging/packages.config +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/SDKs/Batch/Support/FileStaging/Tests/Batch.FileStaging.Tests/Batch.FileStaging.Tests.csproj b/src/SDKs/Batch/Support/FileStaging/Tests/Batch.FileStaging.Tests/Batch.FileStaging.Tests.csproj deleted file mode 100644 index fe16444080d8..000000000000 --- a/src/SDKs/Batch/Support/FileStaging/Tests/Batch.FileStaging.Tests/Batch.FileStaging.Tests.csproj +++ /dev/null @@ -1,124 +0,0 @@ - - - - - {C809285A-784D-48E4-9D7A-F5685A19F595} - Library - Properties - BatchClientIntegrationTests - BatchClientIntegrationTests - - - 512 - ceeaaba5 - true - true - - - - - - - $(LibraryNugetPackageFolder)\Azure.Batch.6.0.0\lib\net45\Microsoft.Azure.Batch.dll - True - - - - $(LibraryNugetPackageFolder)\Microsoft.Data.Edm.5.7.0\lib\net40\Microsoft.Data.Edm.dll - True - - - $(LibraryNugetPackageFolder)\Microsoft.Data.OData.5.7.0\lib\net40\Microsoft.Data.OData.dll - True - - - $(LibraryNugetPackageFolder)\Microsoft.Data.Services.Client.5.7.0\lib\net40\Microsoft.Data.Services.Client.dll - True - - - $(LibraryNugetPackageFolder)\Microsoft.Rest.ClientRuntime.2.3.5\lib\net45\Microsoft.Rest.ClientRuntime.dll - True - - - $(LibraryNugetPackageFolder)\Microsoft.Rest.ClientRuntime.Azure.3.3.5\lib\net45\Microsoft.Rest.ClientRuntime.Azure.dll - True - - - $(LibraryNugetPackageFolder)\WindowsAzure.Storage.8.0.1\lib\net45\Microsoft.WindowsAzure.Storage.dll - True - - - $(LibraryNugetPackageFolder)\Newtonsoft.Json.6.0.8\lib\net45\Newtonsoft.Json.dll - True - - - - - - - - - - - - $(LibraryNugetPackageFolder)\System.Spatial.5.7.0\lib\net40\System.Spatial.dll - True - - - - - - $(LibraryNugetPackageFolder)\xunit.abstractions.2.0.0\lib\net35\xunit.abstractions.dll - True - - - False - $(LibraryNugetPackageFolder)\xunit.assert.2.0.0\lib\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.assert.dll - - - $(LibraryNugetPackageFolder)\xunit.extensibility.core.2.0.0\lib\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.core.dll - True - - - - - {a7b9cd95-7ec3-4ccf-b20f-951fd2d028f1} - Batch.FileStaging - fs - - - - - - - - - - - - - - - - - - - - - - PreserveNewest - - - Always - - - - - - - This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - - \ No newline at end of file diff --git a/src/SDKs/Batch/Support/FileStaging/Tests/Batch.FileStaging.Tests/packages.config b/src/SDKs/Batch/Support/FileStaging/Tests/Batch.FileStaging.Tests/packages.config deleted file mode 100644 index f7c8fb14da77..000000000000 --- a/src/SDKs/Batch/Support/FileStaging/Tests/Batch.FileStaging.Tests/packages.config +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/SDKs/Batch/Support/FileStaging/nuget.config b/src/SDKs/Batch/Support/FileStaging/nuget.config deleted file mode 100644 index 5a03cb00905d..000000000000 --- a/src/SDKs/Batch/Support/FileStaging/nuget.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file From c4abc893463621642678fa43b2cade0b68301a38 Mon Sep 17 00:00:00 2001 From: matthchr Date: Mon, 15 May 2017 14:48:05 -0700 Subject: [PATCH 2/2] Fix tabs in Directory.build.props --- Directory.Build.props | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index 8ec4f1febf83..f846c41eccf6 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,26 +1,26 @@  - - - $(MSBuildThisFileDirectory) - $(LibraryRoot)src - $(LibraryRoot)tools - $(LibraryRoot)\restoredPackages - Microsoft Azure Management Libraries - src\Authentication\Authentication.sln - AzureManagementLibraries.sln - $(LibraryRoot)binaries + + + $(MSBuildThisFileDirectory) + $(LibraryRoot)src + $(LibraryRoot)tools + $(LibraryRoot)\restoredPackages + Microsoft Azure Management Libraries + src\Authentication\Authentication.sln + AzureManagementLibraries.sln + $(LibraryRoot)binaries $(LibraryRoot)PolicheckOutput - $(BinariesFolder)\packages - false - false - All - "$(LibraryToolsFolder)\nuget.exe" + $(BinariesFolder)\packages + false + false + All + "$(LibraryToolsFolder)\nuget.exe" 1234 true true $(IgnorePathTokens) Microsoft.Azure.KeyVault.Samples Gallery Intune FileConventions Batch.FileStaging.Tests ConfigureAwaitAnalyzer ObjectModelCodeGeneration Azure.Batch.IntegrationTests Azure.Batch.ProtocolTests IntegrationTestCommon - + $(OnPremiseBuildTasks) true @@ -32,6 +32,6 @@ $(LibraryRoot)src\UpgradeVS17\SdkCommon\ClientRuntime - - + +