diff --git a/src/VirtualClient/VirtualClient.Contracts.UnitTests/ComponentTypeCacheExtensionsTests.cs b/src/VirtualClient/VirtualClient.Contracts.UnitTests/ComponentTypeCacheExtensionsTests.cs index cd25875079..a57a6d69d1 100644 --- a/src/VirtualClient/VirtualClient.Contracts.UnitTests/ComponentTypeCacheExtensionsTests.cs +++ b/src/VirtualClient/VirtualClient.Contracts.UnitTests/ComponentTypeCacheExtensionsTests.cs @@ -158,7 +158,7 @@ public FileUploadDescriptor CreateDescriptor(VirtualClientComponent component, I return null; } - public FileUploadDescriptor CreateDescriptor(FileContext fileContext, string contentStorePathTemplate, IDictionary parameters = null, IDictionary manifest = null, bool timestamped = true) + public FileUploadDescriptor CreateDescriptor(FileContext fileContext, string contentPathPattern, IDictionary parameters = null, IDictionary manifest = null, bool timestamped = true) { throw new NotImplementedException(); } @@ -172,7 +172,7 @@ public FileUploadDescriptor CreateDescriptor(VirtualClientComponent component, I return null; } - public FileUploadDescriptor CreateDescriptor(FileContext fileContext, string contentStorePathTemplate, IDictionary parameters = null, IDictionary manifest = null, bool timestamped = true) + public FileUploadDescriptor CreateDescriptor(FileContext fileContext, string contentPathPattern, IDictionary parameters = null, IDictionary manifest = null, bool timestamped = true) { throw new NotImplementedException(); } diff --git a/src/VirtualClient/VirtualClient.Contracts.UnitTests/FileUploadDescriptorFactoryTests.cs b/src/VirtualClient/VirtualClient.Contracts.UnitTests/FileUploadDescriptorFactoryTests.cs index 548578e3f1..ccfa513d38 100644 --- a/src/VirtualClient/VirtualClient.Contracts.UnitTests/FileUploadDescriptorFactoryTests.cs +++ b/src/VirtualClient/VirtualClient.Contracts.UnitTests/FileUploadDescriptorFactoryTests.cs @@ -68,8 +68,8 @@ public void FileUploadDescriptorFactoryCreatesTheExpectedDescriptor_When_Not_Tim null, expectedRole); - string contentStorePathTemplate = "{experimentId}/{agentId}/{toolName}/{role}/{scenario}"; - FileUploadDescriptor descriptor = this.descriptorFactory.CreateDescriptor(context, contentStorePathTemplate, timestamped: false); + string contentPathPattern = "{experimentId}/{agentId}/{toolName}/{role}/{scenario}"; + FileUploadDescriptor descriptor = this.descriptorFactory.CreateDescriptor(context, contentPathPattern, timestamped: false); Assert.AreEqual(expectedExperimentId.ToLowerInvariant(), descriptor.ContainerName); Assert.AreEqual(expectedFileName, descriptor.BlobName); @@ -115,8 +115,8 @@ public void FileUploadDescriptorFactoryCreatesTheExpectedDescriptor_When_Timesta null, expectedRole); - string contentStorePathTemplate = "{experimentId}/{agentId}/{toolName}/{role}/{scenario}"; - FileUploadDescriptor descriptor = this.descriptorFactory.CreateDescriptor(context, contentStorePathTemplate, timestamped: true); + string contentPathPattern = "{experimentId}/{agentId}/{toolName}/{role}/{scenario}"; + FileUploadDescriptor descriptor = this.descriptorFactory.CreateDescriptor(context, contentPathPattern, timestamped: true); Assert.AreEqual(expectedExperimentId.ToLowerInvariant(), descriptor.ContainerName); Assert.AreEqual(expectedFileName, descriptor.BlobName); @@ -132,7 +132,7 @@ public void FileUploadDescriptorFactoryCreatesTheExpectedDescriptor_When_Timesta [TestCase("customContainer/{parameter1}/{experimentId}/{agentId}/{parameter2}/fixedFolder/{toolName}/{role}/{scenario}", "value1", null)] [TestCase("customContainer/{parameter1}/{experimentId}/{agentId}/{parameter2}/fixedFolder/{toolName}/{role}/{scenario}", "valueA", "valueB")] [TestCase("customContainer/{parameter1},stringValue1/{experimentId}/{agentId}/{parameter2}/fixedFolder,stringValue2/{toolName}/{role}/{scenario}", "valueA", "valueB")] - public void FileUploadDescriptorFactoryCreatesTheExpectedDescriptorWithCustomTemplate(string contentStorePathTemplate, string parameter1, string parameter2) + public void FileUploadDescriptorFactoryCreatesTheExpectedDescriptorWithCustomTemplate(string contentPathPattern, string parameter1, string parameter2) { this.SetupDefaults(); @@ -150,7 +150,7 @@ public void FileUploadDescriptorFactoryCreatesTheExpectedDescriptorWithCustomTem string expectedFileName = $"{this.mockFile.Object.CreationTimeUtc.ToString("yyyy-MM-ddTHH-mm-ss-fffffZ")}-{this.mockFile.Object.Name}"; string expectedBlobPath; - if (contentStorePathTemplate.Contains(",")) + if (contentPathPattern.Contains(",")) { expectedBlobPath = string.Join('/', (new string[] { $"{parameter1},stringValue1", expectedExperimentId, "AgentIdA", parameter2, "fixedFolder,stringValue2", "ToolA", "RoleA", "ScenarioA" }) .Where(i => i != null)) @@ -183,7 +183,7 @@ public void FileUploadDescriptorFactoryCreatesTheExpectedDescriptorWithCustomTem null, "RoleA"); - FileUploadDescriptor descriptor = this.descriptorFactory.CreateDescriptor(context, contentStorePathTemplate, parameters: parameters, timestamped: true); + FileUploadDescriptor descriptor = this.descriptorFactory.CreateDescriptor(context, contentPathPattern, parameters: parameters, timestamped: true); Assert.AreEqual("customContainer", descriptor.ContainerName); Assert.AreEqual(expectedFileName, descriptor.BlobName); diff --git a/src/VirtualClient/VirtualClient.Contracts/FileUploadDescriptorFactory.cs b/src/VirtualClient/VirtualClient.Contracts/FileUploadDescriptorFactory.cs index a1a7959eed..0bac29b175 100644 --- a/src/VirtualClient/VirtualClient.Contracts/FileUploadDescriptorFactory.cs +++ b/src/VirtualClient/VirtualClient.Contracts/FileUploadDescriptorFactory.cs @@ -47,17 +47,17 @@ public class FileUploadDescriptorFactory : IFileUploadDescriptorFactory /// /// /// Provides context about a file to be uploaded. - /// Content path template to use when uploading content to target storage resources. + /// Content path template to use when uploading content to target storage resources. /// Parameters related to the component that produced the file (e.g. the parameters from the component). /// Additional information and metadata related to the blob/file to include in the descriptor alongside the default manifest information. /// /// True to to include the file creation time in the file name (e.g. 2023-05-21t09-23-30-23813z-file.log). This is explicit to allow for cases where modification of the /// file name is not desirable. Default = true (timestamped file names). /// - public FileUploadDescriptor CreateDescriptor(FileContext fileContext, string contentStorePathTemplate, IDictionary parameters = null, IDictionary manifest = null, bool timestamped = true) + public FileUploadDescriptor CreateDescriptor(FileContext fileContext, string contentPathPattern, IDictionary parameters = null, IDictionary manifest = null, bool timestamped = true) { fileContext.ThrowIfNull(nameof(fileContext)); - contentStorePathTemplate.ThrowIfNullOrWhiteSpace(nameof(contentStorePathTemplate)); + contentPathPattern.ThrowIfNullOrWhiteSpace(nameof(contentPathPattern)); string blobName = Path.GetFileName(fileContext.File.Name); @@ -66,13 +66,13 @@ public FileUploadDescriptor CreateDescriptor(FileContext fileContext, string con blobName = FileUploadDescriptor.GetFileName(blobName, fileContext.File.CreationTimeUtc); } - string blobContainer = GetInlinedContentArgumentValue(fileContext, contentStorePathTemplate.Split('/')[0], parameters); + string blobContainer = GetInlinedContentArgumentValue(fileContext, contentPathPattern.Split('/')[0], parameters); if (string.IsNullOrWhiteSpace(blobContainer)) { - throw new ArgumentException("The containerName in blob cannot be empty string.", contentStorePathTemplate); + throw new ArgumentException("The containerName in blob cannot be empty string.", contentPathPattern); } - string blobPath = FileUploadDescriptorFactory.CreateBlobPath(fileContext, contentStorePathTemplate, parameters, blobName); + string blobPath = FileUploadDescriptorFactory.CreateBlobPath(fileContext, contentPathPattern, parameters, blobName); // Create the default manifest information. IDictionary fileManifest = FileUploadDescriptor.CreateManifest(fileContext, blobContainer, blobPath, parameters, manifest); @@ -88,13 +88,13 @@ public FileUploadDescriptor CreateDescriptor(FileContext fileContext, string con return descriptor; } - private static string CreateBlobPath(FileContext fileContext, string contentStorePathTemplate, IDictionary parameters, string blobName) + private static string CreateBlobPath(FileContext fileContext, string contentPathPattern, IDictionary parameters, string blobName) { string blobPath = null; List pathSegments = new List(); int i = 0; - foreach (string element in contentStorePathTemplate.Split('/')) + foreach (string element in contentPathPattern.Split('/')) { if (i == 0) { diff --git a/src/VirtualClient/VirtualClient.Contracts/IFileUploadDescriptorFactory.cs b/src/VirtualClient/VirtualClient.Contracts/IFileUploadDescriptorFactory.cs index 8283a656b1..852fe61e96 100644 --- a/src/VirtualClient/VirtualClient.Contracts/IFileUploadDescriptorFactory.cs +++ b/src/VirtualClient/VirtualClient.Contracts/IFileUploadDescriptorFactory.cs @@ -27,13 +27,13 @@ public interface IFileUploadDescriptorFactory /// to upload to a blob store. /// /// Provides context about a file to be uploaded. - /// Content path template to use when uploading content to target storage resources. + /// Content path template to use when uploading content to target storage resources. /// Parameters related to the component that produced the file (e.g. the parameters from the component). /// Additional information and metadata related to the blob/file to include in the descriptor alongside the default manifest information. /// /// True to to include the file creation time in the file name (e.g. 2023-05-21t09-23-30-23813z-file.log). This is explicit to allow for cases where modification of the /// file name is not desirable. Default = true (timestamped file names). /// - FileUploadDescriptor CreateDescriptor(FileContext fileContext, string contentStorePathTemplate, IDictionary parameters = null, IDictionary manifest = null, bool timestamped = true); + FileUploadDescriptor CreateDescriptor(FileContext fileContext, string contentPathPattern, IDictionary parameters = null, IDictionary manifest = null, bool timestamped = true); } } \ No newline at end of file diff --git a/src/VirtualClient/VirtualClient.Contracts/VirtualClientComponent.cs b/src/VirtualClient/VirtualClient.Contracts/VirtualClientComponent.cs index a68883406f..f2a4b57d19 100644 --- a/src/VirtualClient/VirtualClient.Contracts/VirtualClientComponent.cs +++ b/src/VirtualClient/VirtualClient.Contracts/VirtualClientComponent.cs @@ -121,7 +121,7 @@ public string ContentPathFormat /// Parameter defines the content path format/structure using a template to use when uploading content /// to target storage resources. When not defined the 'Default' structure is used. /// - public static string ContentStorePathTemplate { get; set; } + public static string ContentPathPattern { get; set; } /// /// The CPU/processor architecture (e.g. amd64, arm). diff --git a/src/VirtualClient/VirtualClient.Contracts/VirtualClientComponentExtensions.cs b/src/VirtualClient/VirtualClient.Contracts/VirtualClientComponentExtensions.cs index a9440bd927..42c0d39f1a 100644 --- a/src/VirtualClient/VirtualClient.Contracts/VirtualClientComponentExtensions.cs +++ b/src/VirtualClient/VirtualClient.Contracts/VirtualClientComponentExtensions.cs @@ -126,7 +126,7 @@ public static FileUploadDescriptor CreateFileUploadDescriptor(this VirtualClient IFileUploadDescriptorFactory factory = ComponentTypeCache.Instance.GetFileUploadDescriptorFactory(identifier); FileUploadDescriptor descriptor = factory.CreateDescriptor( fileContext, - VirtualClientComponent.ContentStorePathTemplate, + VirtualClientComponent.ContentPathPattern, parameters, appendedMetaData, timestamped); diff --git a/src/VirtualClient/VirtualClient.Core.UnitTests/VirtualClientComponentExtensionsTests.cs b/src/VirtualClient/VirtualClient.Core.UnitTests/VirtualClientComponentExtensionsTests.cs index e1f2e6fa62..82bc04236b 100644 --- a/src/VirtualClient/VirtualClient.Core.UnitTests/VirtualClientComponentExtensionsTests.cs +++ b/src/VirtualClient/VirtualClient.Core.UnitTests/VirtualClientComponentExtensionsTests.cs @@ -240,7 +240,7 @@ public void ExecuteCommandAsyncExtensionDoesNotSupportAUsernameSuppliedUnlessRun [ComponentDescription(Id = "Format1234")] private class TestFileUploadDescriptorFactory_A : IFileUploadDescriptorFactory { - public FileUploadDescriptor CreateDescriptor(FileContext fileContext, string contentStorePathTemplate, IDictionary parameters = null, IDictionary manifest = null, bool timestamped = true) + public FileUploadDescriptor CreateDescriptor(FileContext fileContext, string contentPathPattern, IDictionary parameters = null, IDictionary manifest = null, bool timestamped = true) { return new FileUploadDescriptor( $"/any/path/to/blob/{fileContext.File.Name}", diff --git a/src/VirtualClient/VirtualClient.Main/CommandBase.cs b/src/VirtualClient/VirtualClient.Main/CommandBase.cs index 3a4b3950f0..3a902b7f76 100644 --- a/src/VirtualClient/VirtualClient.Main/CommandBase.cs +++ b/src/VirtualClient/VirtualClient.Main/CommandBase.cs @@ -66,7 +66,7 @@ protected CommandBase() /// Parameter defines the content path format/structure using a template to use when uploading content /// to target storage resources. When not defined the 'Default' structure is used. /// - public string ContentStorePathTemplate { get; set; } + public string ContentPathPattern { get; set; } /// s /// True to have debug/verbose output emitted to standard output on diff --git a/src/VirtualClient/VirtualClient.Main/OptionFactory.cs b/src/VirtualClient/VirtualClient.Main/OptionFactory.cs index 81e8df8bd7..adf6e22416 100644 --- a/src/VirtualClient/VirtualClient.Main/OptionFactory.cs +++ b/src/VirtualClient/VirtualClient.Main/OptionFactory.cs @@ -127,11 +127,11 @@ public static Option CreateContentStoreOption(bool required = true, object defau /// /// Sets this option as required. /// Sets the default value when none is provided. - public static Option CreateContentStorePathTemplateOption(bool required = true, object defaultValue = null) + public static Option CreateContentPathPatternOption(bool required = true, object defaultValue = null) { - Option option = new Option(new string[] { "--contentStorePathTemplate", "--contentstorepathtemplate", "--contentPath", "--cspt" }) + Option option = new Option(new string[] { "--contentPathPattern", "--contentpathpattern", "--contentPath", "--cspt" }) { - Name = "ContentStorePathTemplate", + Name = "ContentPathPattern", Description = "A template for virtual folder structure to be followed in contentStore.", ArgumentHelpName = "pathTemplate", AllowMultipleArgumentsPerToken = false diff --git a/src/VirtualClient/VirtualClient.Main/Program.cs b/src/VirtualClient/VirtualClient.Main/Program.cs index e8f76c51e3..0f6acba923 100644 --- a/src/VirtualClient/VirtualClient.Main/Program.cs +++ b/src/VirtualClient/VirtualClient.Main/Program.cs @@ -192,8 +192,8 @@ internal static CommandLineBuilder SetupCommandLine(string[] args, CancellationT // --contentStore OptionFactory.CreateContentStoreOption(required: false), - // --contentStorePathTemplate - OptionFactory.CreateContentStorePathTemplateOption(required: false, "{experimentId}/{agentId}/{toolName}/{role}/{scenario}"), + // --contentPathPattern + OptionFactory.CreateContentPathPatternOption(required: false, "{experimentId}/{agentId}/{toolName}/{role}/{scenario}"), // --debug OptionFactory.CreateDebugFlag(required: false, false), diff --git a/src/VirtualClient/VirtualClient.Main/RunProfileCommand.cs b/src/VirtualClient/VirtualClient.Main/RunProfileCommand.cs index 2659796125..3f5d2074ac 100644 --- a/src/VirtualClient/VirtualClient.Main/RunProfileCommand.cs +++ b/src/VirtualClient/VirtualClient.Main/RunProfileCommand.cs @@ -111,7 +111,7 @@ public override async Task ExecuteAsync(string[] args, CancellationTokenSou dependencies = this.InitializeDependencies(args); logger = dependencies.GetService(); packageManager = dependencies.GetService(); - VirtualClientComponent.ContentStorePathTemplate = this.ContentStorePathTemplate; + VirtualClientComponent.ContentPathPattern = this.ContentPathPattern; IEnumerable profileNames = this.GetProfilePaths(dependencies); this.SetGlobalTelemetryProperties(profileNames, dependencies); diff --git a/src/VirtualClient/VirtualClient.TestFramework/DependencyFixture.cs b/src/VirtualClient/VirtualClient.TestFramework/DependencyFixture.cs index 9474607d76..fa0fd02d80 100644 --- a/src/VirtualClient/VirtualClient.TestFramework/DependencyFixture.cs +++ b/src/VirtualClient/VirtualClient.TestFramework/DependencyFixture.cs @@ -43,7 +43,7 @@ public class DependencyFixture : Fixture static DependencyFixture() { VirtualClientComponent.LogToFile = true; - VirtualClientComponent.ContentStorePathTemplate = "{experimentId}/{agentId}/{toolName}/{role}/{scenario}"; + VirtualClientComponent.ContentPathPattern = "{experimentId}/{agentId}/{toolName}/{role}/{scenario}"; } /// diff --git a/src/VirtualClient/VirtualClient.TestFramework/MockFixture.cs b/src/VirtualClient/VirtualClient.TestFramework/MockFixture.cs index 11e51bf551..6bc854ba87 100644 --- a/src/VirtualClient/VirtualClient.TestFramework/MockFixture.cs +++ b/src/VirtualClient/VirtualClient.TestFramework/MockFixture.cs @@ -53,7 +53,7 @@ public class MockFixture : Fixture static MockFixture() { VirtualClientComponent.LogToFile = true; - VirtualClientComponent.ContentStorePathTemplate = "{experimentId}/{agentId}/{toolName}/{role}/{scenario}"; + VirtualClientComponent.ContentPathPattern = "{experimentId}/{agentId}/{toolName}/{role}/{scenario}"; } /// diff --git a/src/VirtualClient/VirtualClient.UnitTests/CommandLineOptionTests.cs b/src/VirtualClient/VirtualClient.UnitTests/CommandLineOptionTests.cs index 4841e75b92..70600cfa09 100644 --- a/src/VirtualClient/VirtualClient.UnitTests/CommandLineOptionTests.cs +++ b/src/VirtualClient/VirtualClient.UnitTests/CommandLineOptionTests.cs @@ -60,8 +60,8 @@ public void VirtualClientDefaultCommandRequiresTheProfileOptionBeSupplied() [TestCase("--contentstore", "https://anystorageaccount.blob.core.windows.net/;SharedAccessSignature=123")] [TestCase("--content", "https://anystorageaccount.blob.core.windows.net/;SharedAccessSignature=123")] [TestCase("--cs", "https://anystorageaccount.blob.core.windows.net/;SharedAccessSignature=123")] - [TestCase("--contentStorePathTemplate", "anyname1/anyname2/{experimentId}/{agentId}/anyname3/{toolName}/{role}/{scenario}")] - [TestCase("--contentstorepathtemplate", "anyname1/anyname2/{experimentId}/{agentId}/anyname3/{toolName}/{role}/{scenario}")] + [TestCase("--contentPathPattern", "anyname1/anyname2/{experimentId}/{agentId}/anyname3/{toolName}/{role}/{scenario}")] + [TestCase("--contentpathpattern", "anyname1/anyname2/{experimentId}/{agentId}/anyname3/{toolName}/{role}/{scenario}")] [TestCase("--contentPath", "anyname1/anyname2/{experimentId}/{agentId}/anyname3/{toolName}/{role}/{scenario}")] [TestCase("--cspt", "anyname1/anyname2/{experimentId}/{agentId}/anyname3/{toolName}/{role}/{scenario}")] [TestCase("--debug", null)] diff --git a/src/VirtualClient/VirtualClient.UnitTests/OptionFactoryTests.cs b/src/VirtualClient/VirtualClient.UnitTests/OptionFactoryTests.cs index 2247a50644..103c5b4d49 100644 --- a/src/VirtualClient/VirtualClient.UnitTests/OptionFactoryTests.cs +++ b/src/VirtualClient/VirtualClient.UnitTests/OptionFactoryTests.cs @@ -178,13 +178,13 @@ public void ContentStoreOptionValidatesTheConnectionTokenProvided() } [Test] - [TestCase("--contentStorePathTemplate")] - [TestCase("--contentstorepathtemplate")] + [TestCase("--contentPathPattern")] + [TestCase("--contentpathpattern")] [TestCase("--contentPath")] [TestCase("--cspt")] - public void ContentStorePathTemplateOptionSupportsExpectedAliases(string alias) + public void ContentPathPatternOptionSupportsExpectedAliases(string alias) { - Option option = OptionFactory.CreateContentStorePathTemplateOption(); + Option option = OptionFactory.CreateContentPathPatternOption(); ParseResult result = option.Parse($"{alias}=\"anyname1/anyname2/{{experimentId}}/{{agentId}}/anyname3/{{toolName}}/{{role}}/{{scenario}}\""); Assert.IsFalse(result.Errors.Any()); }