From bb8e58179a6f8e0fac8a8651ef8a69a5afcbab8f Mon Sep 17 00:00:00 2001 From: vineeth Hanumanthu Date: Tue, 17 Sep 2019 14:57:37 +0530 Subject: [PATCH 1/8] Removed friendly name null check --- .../DataCollection/DataCollectionManager.cs | 6 +++++- .../DataCollection/DataCollectionLauncherFactory.cs | 6 +++++- .../DataCollector/DataCollectorSettings.cs | 6 ------ 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/Microsoft.TestPlatform.Common/DataCollection/DataCollectionManager.cs b/src/Microsoft.TestPlatform.Common/DataCollection/DataCollectionManager.cs index 09f6710837..2ee7e930bb 100644 --- a/src/Microsoft.TestPlatform.Common/DataCollection/DataCollectionManager.cs +++ b/src/Microsoft.TestPlatform.Common/DataCollection/DataCollectionManager.cs @@ -422,7 +422,11 @@ private void LoadAndInitialize(DataCollectorSettings dataCollectorSettings, stri // Look up the extension and initialize it if one is found. var extensionManager = this.DataCollectorExtensionManager; var dataCollectorUri = string.Empty; - this.TryGetUriFromFriendlyName(dataCollectorSettings.FriendlyName, out dataCollectorUri); + + if (!this.TryGetUriFromFriendlyName(dataCollectorSettings.FriendlyName, out dataCollectorUri)) + { + dataCollectorUri = dataCollectorSettings.Uri.ToString(); + } DataCollector dataCollector = null; if (!string.IsNullOrWhiteSpace(dataCollectorUri)) diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/DataCollectionLauncherFactory.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/DataCollectionLauncherFactory.cs index 6c78d15066..879ce8c25b 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/DataCollectionLauncherFactory.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/DataCollectionLauncherFactory.cs @@ -28,7 +28,11 @@ internal static IDataCollectionLauncher GetDataCollectorLauncher(IProcessHelper var dataCollectionRunSettings = XmlRunSettingsUtilities.GetDataCollectionRunSettings(settingsXml); foreach (var dataCollectorSettings in dataCollectionRunSettings.DataCollectorSettingsList) { - if (dataCollectorSettings.FriendlyName.ToLower().Equals("event log")) + if (dataCollectorSettings.FriendlyName!=null && dataCollectorSettings.FriendlyName.ToLower().Equals("event log")) + { + return new DefaultDataCollectionLauncher(); + } + if(dataCollectorSettings.Uri!=null && dataCollectorSettings.Uri.ToString().ToLower().Equals(@"datacollector://Microsoft/EventLog/2.0")) { return new DefaultDataCollectionLauncher(); } diff --git a/src/Microsoft.TestPlatform.ObjectModel/DataCollector/DataCollectorSettings.cs b/src/Microsoft.TestPlatform.ObjectModel/DataCollector/DataCollectorSettings.cs index df50008fc7..b9f754bffd 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/DataCollector/DataCollectorSettings.cs +++ b/src/Microsoft.TestPlatform.ObjectModel/DataCollector/DataCollectorSettings.cs @@ -201,12 +201,6 @@ internal static DataCollectorSettings FromXml(XmlReader reader) } - if (string.IsNullOrWhiteSpace(settings.FriendlyName)) - { - throw new SettingsException( - String.Format(CultureInfo.CurrentCulture, Resources.Resources.MissingDataCollectorAttributes, "FriendlyName")); - } - reader.Read(); if (!empty) { From f663737e61f8bdb48497e057cb71e3ff47b2d77c Mon Sep 17 00:00:00 2001 From: vineeth Hanumanthu Date: Wed, 18 Sep 2019 11:38:57 +0530 Subject: [PATCH 2/8] removed redundant code and added tests for the datacollection manager --- .../DataCollectionLauncherFactory.cs | 6 +---- .../DataCollectionManagerTests.cs | 23 +++++++++++-------- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/DataCollectionLauncherFactory.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/DataCollectionLauncherFactory.cs index 879ce8c25b..b8f96dd1ec 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/DataCollectionLauncherFactory.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/DataCollectionLauncherFactory.cs @@ -28,11 +28,7 @@ internal static IDataCollectionLauncher GetDataCollectorLauncher(IProcessHelper var dataCollectionRunSettings = XmlRunSettingsUtilities.GetDataCollectionRunSettings(settingsXml); foreach (var dataCollectorSettings in dataCollectionRunSettings.DataCollectorSettingsList) { - if (dataCollectorSettings.FriendlyName!=null && dataCollectorSettings.FriendlyName.ToLower().Equals("event log")) - { - return new DefaultDataCollectionLauncher(); - } - if(dataCollectorSettings.Uri!=null && dataCollectorSettings.Uri.ToString().ToLower().Equals(@"datacollector://Microsoft/EventLog/2.0")) + if (string.Equals(dataCollectorSettings.FriendlyName, "event Log", StringComparison.OrdinalIgnoreCase) || string.Equals(dataCollectorSettings.Uri?.ToString(), @"datacollector://Microsoft/EventLog/2.0", StringComparison.OrdinalIgnoreCase)) { return new DefaultDataCollectionLauncher(); } diff --git a/test/datacollector.UnitTests/DataCollectionManagerTests.cs b/test/datacollector.UnitTests/DataCollectionManagerTests.cs index 51c419aceb..7146fe08cb 100644 --- a/test/datacollector.UnitTests/DataCollectionManagerTests.cs +++ b/test/datacollector.UnitTests/DataCollectionManagerTests.cs @@ -25,7 +25,7 @@ public class DataCollectionManagerTests private string defaultDataCollectionSettings = ""; private string dataCollectorSettings; - private string dataCollectorSettingsWithWrongFriendlyName, dataCollectorSettingsWithoutFriendlyName, dataCollectorSettingsEnabled, dataCollectorSettingsDisabled; + private string dataCollectorSettingsWithWrongFriendlyName, dataCollectorSettingsWithWrongFriendlyNameAndWrongUri, dataCollectorSettingsWithoutFriendlyName, dataCollectorSettingsEnabled, dataCollectorSettingsDisabled; private Mock mockMessageSink; private Mock mockDataCollector; @@ -43,6 +43,7 @@ public DataCollectionManagerTests() this.dataCollectorSettings = string.Format(this.defaultRunSettings, string.Format(this.defaultDataCollectionSettings, friendlyName, uri, this.mockDataCollector.Object.GetType().AssemblyQualifiedName, typeof(DataCollectionManagerTests).GetTypeInfo().Assembly.Location, string.Empty)); this.dataCollectorSettingsWithWrongFriendlyName = string.Format(this.defaultRunSettings, string.Format(this.defaultDataCollectionSettings, "anyFriendlyName", uri, this.mockDataCollector.Object.GetType().AssemblyQualifiedName, typeof(DataCollectionManagerTests).GetTypeInfo().Assembly.Location, string.Empty)); + this.dataCollectorSettingsWithWrongFriendlyNameAndWrongUri = string.Format(this.defaultRunSettings, string.Format(this.defaultDataCollectionSettings, "anyFriendlyName", "datacollector://data", this.mockDataCollector.Object.GetType().AssemblyQualifiedName, typeof(DataCollectionManagerTests).GetTypeInfo().Assembly.Location, string.Empty)); this.dataCollectorSettingsWithoutFriendlyName = string.Format(this.defaultRunSettings, string.Format(this.defaultDataCollectionSettings, string.Empty, uri, this.mockDataCollector.Object.GetType().AssemblyQualifiedName, typeof(DataCollectionManagerTests).GetTypeInfo().Assembly.Location, string.Empty).Replace("friendlyName=\"\"", string.Empty)); this.dataCollectorSettingsEnabled = string.Format(this.defaultRunSettings, string.Format(this.defaultDataCollectionSettings, friendlyName, uri, this.mockDataCollector.Object.GetType().AssemblyQualifiedName, typeof(DataCollectionManagerTests).GetTypeInfo().Assembly.Location, "enabled=\"true\"")); this.dataCollectorSettingsDisabled = string.Format(this.defaultRunSettings, string.Format(this.defaultDataCollectionSettings, friendlyName, uri, this.mockDataCollector.Object.GetType().AssemblyQualifiedName, typeof(DataCollectionManagerTests).GetTypeInfo().Assembly.Location, "enabled=\"false\"")); @@ -100,14 +101,24 @@ public void InitializeShouldAddDataCollectorIfItIsEnabled() [TestMethod] - public void InitializeDataCollectorsShouldNotLoadDataCollectorIfFriendlyNameIsNotCorrect() + public void InitializeDataCollectorsShouldLoadDataCollectorIfFriendlyNameIsNotCorrectAndURiIsCorrect() { this.dataCollectionManager.InitializeDataCollectors(this.dataCollectorSettingsWithWrongFriendlyName); + Assert.AreEqual(1, this.dataCollectionManager.RunDataCollectors.Count); + this.mockDataCollector.Verify(x => x.Initialize(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny()), Times.Once); + } + + [TestMethod] + public void InitializeDataCollectorsShouldLoadDataCollectorIfFriendlyNameIsNotCorrectAndURiIsNotCorrect() + { + this.dataCollectionManager.InitializeDataCollectors(this.dataCollectorSettingsWithWrongFriendlyNameAndWrongUri); + Assert.AreEqual(0, this.dataCollectionManager.RunDataCollectors.Count); this.mockDataCollector.Verify(x => x.Initialize(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny()), Times.Never); } + [TestMethod] public void InitializeDataCollectorsShouldNotAddSameDataCollectorMoreThanOnce() { @@ -120,14 +131,6 @@ public void InitializeDataCollectorsShouldNotAddSameDataCollectorMoreThanOnce() this.mockDataCollector.Verify(x => x.Initialize(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny()), Times.Once); } - [TestMethod] - public void InitializeDataCollectorsShouldNotAddDataCollectorIfFriendlyNameIsNotSpecifiedByDataCollector() - { - Assert.ThrowsException(() => - { - this.dataCollectionManager.InitializeDataCollectors(this.dataCollectorSettingsWithoutFriendlyName); - }); - } [TestMethod] public void InitializeDataCollectorsShouldLoadDataCollectorAndReturnEnvironmentVariables() From 91e2ea1efec48675d7af6f5d440e912aa651a143 Mon Sep 17 00:00:00 2001 From: vineeth Hanumanthu Date: Wed, 18 Sep 2019 18:39:58 +0530 Subject: [PATCH 3/8] added warning message if friendlyname is incorrect --- .../DataCollection/DataCollectionManager.cs | 3 ++- .../Resources/Resources.Designer.cs | 14 +++++++++++--- .../Resources/Resources.resx | 3 +++ .../Resources/xlf/Resources.cs.xlf | 5 +++++ .../Resources/xlf/Resources.de.xlf | 5 +++++ .../Resources/xlf/Resources.es.xlf | 5 +++++ .../Resources/xlf/Resources.fr.xlf | 5 +++++ .../Resources/xlf/Resources.it.xlf | 5 +++++ .../Resources/xlf/Resources.ja.xlf | 5 +++++ .../Resources/xlf/Resources.ko.xlf | 5 +++++ .../Resources/xlf/Resources.pl.xlf | 5 +++++ .../Resources/xlf/Resources.pt-BR.xlf | 5 +++++ .../Resources/xlf/Resources.ru.xlf | 5 +++++ .../Resources/xlf/Resources.tr.xlf | 5 +++++ .../Resources/xlf/Resources.xlf | 5 +++++ .../Resources/xlf/Resources.zh-Hans.xlf | 5 +++++ .../Resources/xlf/Resources.zh-Hant.xlf | 5 +++++ 17 files changed, 86 insertions(+), 4 deletions(-) diff --git a/src/Microsoft.TestPlatform.Common/DataCollection/DataCollectionManager.cs b/src/Microsoft.TestPlatform.Common/DataCollection/DataCollectionManager.cs index 2ee7e930bb..c187653ce9 100644 --- a/src/Microsoft.TestPlatform.Common/DataCollection/DataCollectionManager.cs +++ b/src/Microsoft.TestPlatform.Common/DataCollection/DataCollectionManager.cs @@ -425,7 +425,8 @@ private void LoadAndInitialize(DataCollectorSettings dataCollectorSettings, stri if (!this.TryGetUriFromFriendlyName(dataCollectorSettings.FriendlyName, out dataCollectorUri)) { - dataCollectorUri = dataCollectorSettings.Uri.ToString(); + this.LogWarning(string.Format(CultureInfo.CurrentUICulture, Resources.Resources.CannotFetchByFriendlyName, dataCollectorSettings.FriendlyName)); + dataCollectorUri = dataCollectorSettings.Uri?.ToString(); } DataCollector dataCollector = null; diff --git a/src/Microsoft.TestPlatform.Common/Resources/Resources.Designer.cs b/src/Microsoft.TestPlatform.Common/Resources/Resources.Designer.cs index 8dfb3feae7..5f444c3c50 100644 --- a/src/Microsoft.TestPlatform.Common/Resources/Resources.Designer.cs +++ b/src/Microsoft.TestPlatform.Common/Resources/Resources.Designer.cs @@ -10,7 +10,6 @@ namespace Microsoft.VisualStudio.TestPlatform.Common.Resources { using System; - using System.Reflection; /// @@ -20,7 +19,7 @@ namespace Microsoft.VisualStudio.TestPlatform.Common.Resources { // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class Resources { @@ -40,7 +39,7 @@ internal class Resources { internal static global::System.Resources.ResourceManager ResourceManager { get { if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Microsoft.VisualStudio.TestPlatform.Common.Resources.Resources", typeof(Resources).GetTypeInfo().Assembly); + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Microsoft.VisualStudio.TestPlatform.Common.Resources.Resources", typeof(Resources).Assembly); resourceMan = temp; } return resourceMan; @@ -70,6 +69,15 @@ internal class Resources { } } + /// + /// Looks up a localized string similar to Cannot Fetch Uri with {0}.. + /// + internal static string CannotFetchByFriendlyName { + get { + return ResourceManager.GetString("CannotFetchByFriendlyName", resourceCulture); + } + } + /// /// Looks up a localized string similar to Data collection : {0}. /// diff --git a/src/Microsoft.TestPlatform.Common/Resources/Resources.resx b/src/Microsoft.TestPlatform.Common/Resources/Resources.resx index 450bf809c0..78179a3ae4 100644 --- a/src/Microsoft.TestPlatform.Common/Resources/Resources.resx +++ b/src/Microsoft.TestPlatform.Common/Resources/Resources.resx @@ -120,6 +120,9 @@ Cancelling the operation as requested. + + Cannot Fetch Uri with {0}. + Data collection : {0} diff --git a/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.cs.xlf b/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.cs.xlf index 66ef328d0b..35edd4cf29 100644 --- a/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.cs.xlf +++ b/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.cs.xlf @@ -269,6 +269,11 @@ Operace se ruší na základě žádosti. + + Cannot Fetch Uri with {0}. + Cannot Fetch Uri with {0}. + + \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.de.xlf b/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.de.xlf index 0a849def77..cac3551de7 100644 --- a/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.de.xlf +++ b/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.de.xlf @@ -269,6 +269,11 @@ Der Vorgang wird gemäß Anforderung abgebrochen. + + Cannot Fetch Uri with {0}. + Cannot Fetch Uri with {0}. + + \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.es.xlf b/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.es.xlf index 37a25b277e..efd8c98c0e 100644 --- a/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.es.xlf +++ b/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.es.xlf @@ -269,6 +269,11 @@ La operación se cancelará como se ha solicitado. + + Cannot Fetch Uri with {0}. + Cannot Fetch Uri with {0}. + + \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.fr.xlf b/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.fr.xlf index 223b1eb528..b8f396c235 100644 --- a/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.fr.xlf +++ b/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.fr.xlf @@ -269,6 +269,11 @@ Annulation de l'opération, comme demandé. + + Cannot Fetch Uri with {0}. + Cannot Fetch Uri with {0}. + + \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.it.xlf b/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.it.xlf index 538357807d..377ee4c3c5 100644 --- a/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.it.xlf +++ b/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.it.xlf @@ -269,6 +269,11 @@ L'operazione verrà annullata come richiesto. + + Cannot Fetch Uri with {0}. + Cannot Fetch Uri with {0}. + + \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.ja.xlf b/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.ja.xlf index ff37a71693..0db8260baa 100644 --- a/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.ja.xlf +++ b/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.ja.xlf @@ -269,6 +269,11 @@ 操作のキャンセルが要求されたため、キャンセルしています。 + + Cannot Fetch Uri with {0}. + Cannot Fetch Uri with {0}. + + \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.ko.xlf b/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.ko.xlf index 31ebab2400..6ac3d7e154 100644 --- a/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.ko.xlf +++ b/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.ko.xlf @@ -269,6 +269,11 @@ 요청한 대로 작업을 취소하는 중입니다. + + Cannot Fetch Uri with {0}. + Cannot Fetch Uri with {0}. + + \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.pl.xlf b/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.pl.xlf index 2ed8d83aac..c37e5e2695 100644 --- a/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.pl.xlf +++ b/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.pl.xlf @@ -269,6 +269,11 @@ Anulowanie operacji zgodnie z żądaniem. + + Cannot Fetch Uri with {0}. + Cannot Fetch Uri with {0}. + + \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.pt-BR.xlf b/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.pt-BR.xlf index 1f57678b09..98b22c97d0 100644 --- a/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.pt-BR.xlf +++ b/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.pt-BR.xlf @@ -269,6 +269,11 @@ Cancelando a operação conforme solicitado. + + Cannot Fetch Uri with {0}. + Cannot Fetch Uri with {0}. + + \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.ru.xlf b/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.ru.xlf index 56ec3f06e3..ff1ae3e520 100644 --- a/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.ru.xlf +++ b/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.ru.xlf @@ -269,6 +269,11 @@ Операция отменяется в соответствии с запросом. + + Cannot Fetch Uri with {0}. + Cannot Fetch Uri with {0}. + + \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.tr.xlf b/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.tr.xlf index 36aa10339c..fd53feceac 100644 --- a/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.tr.xlf +++ b/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.tr.xlf @@ -269,6 +269,11 @@ İşlem istek üzerine iptal ediliyor. + + Cannot Fetch Uri with {0}. + Cannot Fetch Uri with {0}. + + \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.xlf b/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.xlf index a89f0855a0..1a7dbc96e9 100644 --- a/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.xlf +++ b/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.xlf @@ -146,6 +146,11 @@ Cancelling the operation as requested. + + Cannot Fetch Uri with {0}. + Cannot Fetch Uri with {0}. + + \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.zh-Hans.xlf b/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.zh-Hans.xlf index b0c5218f28..05ce6b68de 100644 --- a/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.zh-Hans.xlf +++ b/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.zh-Hans.xlf @@ -269,6 +269,11 @@ 按要求取消该操作。 + + Cannot Fetch Uri with {0}. + Cannot Fetch Uri with {0}. + + \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.zh-Hant.xlf b/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.zh-Hant.xlf index 5c3231c90d..ea64fa059a 100644 --- a/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.zh-Hant.xlf +++ b/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.zh-Hant.xlf @@ -269,6 +269,11 @@ 正在應要求取消作業。 + + Cannot Fetch Uri with {0}. + Cannot Fetch Uri with {0}. + + \ No newline at end of file From ac485d563215c3a93df18dd2fa021f528dae5bfc Mon Sep 17 00:00:00 2001 From: vineeth Hanumanthu Date: Wed, 25 Sep 2019 15:32:01 +0530 Subject: [PATCH 4/8] Given prority to Uri --- .../DataCollection/DataCollectionManager.cs | 20 ++++++++++--- .../DataCollectionManagerTests.cs | 28 +++++++++++++++++-- 2 files changed, 41 insertions(+), 7 deletions(-) diff --git a/src/Microsoft.TestPlatform.Common/DataCollection/DataCollectionManager.cs b/src/Microsoft.TestPlatform.Common/DataCollection/DataCollectionManager.cs index c187653ce9..a86b3d2757 100644 --- a/src/Microsoft.TestPlatform.Common/DataCollection/DataCollectionManager.cs +++ b/src/Microsoft.TestPlatform.Common/DataCollection/DataCollectionManager.cs @@ -391,6 +391,19 @@ protected virtual bool TryGetUriFromFriendlyName(string friendlyName, out string return false; } + protected virtual bool IsUriValid(string uri) + { + var extensionManager = this.dataCollectorExtensionManager; + foreach (var extension in extensionManager.TestExtensions) + { + if (string.Compare(uri, extension.Metadata.ExtensionUri, StringComparison.OrdinalIgnoreCase) == 0) + { + return true; + } + } + return false; + } + /// /// Gets the extension using uri. /// @@ -421,12 +434,11 @@ private void LoadAndInitialize(DataCollectorSettings dataCollectorSettings, stri { // Look up the extension and initialize it if one is found. var extensionManager = this.DataCollectorExtensionManager; - var dataCollectorUri = string.Empty; + var dataCollectorUri = dataCollectorSettings.Uri?.ToString(); - if (!this.TryGetUriFromFriendlyName(dataCollectorSettings.FriendlyName, out dataCollectorUri)) + if (!IsUriValid(dataCollectorUri) && !this.TryGetUriFromFriendlyName(dataCollectorSettings.FriendlyName, out dataCollectorUri)) { this.LogWarning(string.Format(CultureInfo.CurrentUICulture, Resources.Resources.CannotFetchByFriendlyName, dataCollectorSettings.FriendlyName)); - dataCollectorUri = dataCollectorSettings.Uri?.ToString(); } DataCollector dataCollector = null; @@ -704,4 +716,4 @@ private void LogAttachments(List attachmentSets) } } } -} +} \ No newline at end of file diff --git a/test/datacollector.UnitTests/DataCollectionManagerTests.cs b/test/datacollector.UnitTests/DataCollectionManagerTests.cs index 7146fe08cb..f127e3907a 100644 --- a/test/datacollector.UnitTests/DataCollectionManagerTests.cs +++ b/test/datacollector.UnitTests/DataCollectionManagerTests.cs @@ -25,7 +25,7 @@ public class DataCollectionManagerTests private string defaultDataCollectionSettings = ""; private string dataCollectorSettings; - private string dataCollectorSettingsWithWrongFriendlyName, dataCollectorSettingsWithWrongFriendlyNameAndWrongUri, dataCollectorSettingsWithoutFriendlyName, dataCollectorSettingsEnabled, dataCollectorSettingsDisabled; + private string dataCollectorSettingsWithWrongFriendlyName, dataCollectorSettingsWithWrongFriendlyNameAndWrongUri, dataCollectorSettingsWithoutFriendlyName, dataCollectorSettingsEnabled, dataCollectorSettingsDisabled, dataCollectorSettingsWithWrongUri; private Mock mockMessageSink; private Mock mockDataCollector; @@ -43,6 +43,7 @@ public DataCollectionManagerTests() this.dataCollectorSettings = string.Format(this.defaultRunSettings, string.Format(this.defaultDataCollectionSettings, friendlyName, uri, this.mockDataCollector.Object.GetType().AssemblyQualifiedName, typeof(DataCollectionManagerTests).GetTypeInfo().Assembly.Location, string.Empty)); this.dataCollectorSettingsWithWrongFriendlyName = string.Format(this.defaultRunSettings, string.Format(this.defaultDataCollectionSettings, "anyFriendlyName", uri, this.mockDataCollector.Object.GetType().AssemblyQualifiedName, typeof(DataCollectionManagerTests).GetTypeInfo().Assembly.Location, string.Empty)); + this.dataCollectorSettingsWithWrongUri = string.Format(this.defaultRunSettings, string.Format(this.defaultDataCollectionSettings, friendlyName, "my://custom/WrongDatacollector", this.mockDataCollector.Object.GetType().AssemblyQualifiedName, typeof(DataCollectionManagerTests).GetTypeInfo().Assembly.Location, string.Empty)); this.dataCollectorSettingsWithWrongFriendlyNameAndWrongUri = string.Format(this.defaultRunSettings, string.Format(this.defaultDataCollectionSettings, "anyFriendlyName", "datacollector://data", this.mockDataCollector.Object.GetType().AssemblyQualifiedName, typeof(DataCollectionManagerTests).GetTypeInfo().Assembly.Location, string.Empty)); this.dataCollectorSettingsWithoutFriendlyName = string.Format(this.defaultRunSettings, string.Format(this.defaultDataCollectionSettings, string.Empty, uri, this.mockDataCollector.Object.GetType().AssemblyQualifiedName, typeof(DataCollectionManagerTests).GetTypeInfo().Assembly.Location, string.Empty).Replace("friendlyName=\"\"", string.Empty)); this.dataCollectorSettingsEnabled = string.Format(this.defaultRunSettings, string.Format(this.defaultDataCollectionSettings, friendlyName, uri, this.mockDataCollector.Object.GetType().AssemblyQualifiedName, typeof(DataCollectionManagerTests).GetTypeInfo().Assembly.Location, "enabled=\"true\"")); @@ -101,7 +102,7 @@ public void InitializeShouldAddDataCollectorIfItIsEnabled() [TestMethod] - public void InitializeDataCollectorsShouldLoadDataCollectorIfFriendlyNameIsNotCorrectAndURiIsCorrect() + public void InitializeDataCollectorsShouldLoadDataCollectorIfFriendlyNameIsNotCorrectAndUriIsCorrect() { this.dataCollectionManager.InitializeDataCollectors(this.dataCollectorSettingsWithWrongFriendlyName); @@ -110,7 +111,16 @@ public void InitializeDataCollectorsShouldLoadDataCollectorIfFriendlyNameIsNotCo } [TestMethod] - public void InitializeDataCollectorsShouldLoadDataCollectorIfFriendlyNameIsNotCorrectAndURiIsNotCorrect() + public void InitializeDataCollectorsShouldLoadDataCollectorIfFriendlyNameIsCorrectAndUriIsNotCorrect() + { + this.dataCollectionManager.InitializeDataCollectors(this.dataCollectorSettingsWithWrongUri); + + Assert.AreEqual(1, this.dataCollectionManager.RunDataCollectors.Count); + this.mockDataCollector.Verify(x => x.Initialize(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny()), Times.Once); + } + + [TestMethod] + public void InitializeDataCollectorsShouldNotLoadDataCollectorIfFriendlyNameIsNotCorrectAndUriIsNotCorrect() { this.dataCollectionManager.InitializeDataCollectors(this.dataCollectorSettingsWithWrongFriendlyNameAndWrongUri); @@ -444,6 +454,18 @@ protected override bool TryGetUriFromFriendlyName(string friendlyName, out strin } } + protected override bool IsUriValid(string uri) + { + if (uri.Equals("my://custom/datacollector")) + { + return true; + } + else + { + return false; + } + } + protected override DataCollector TryGetTestExtension(string extensionUri) { if (extensionUri.Equals("my://custom/datacollector")) From dc7ed899db9b8aa2ae7b4bc85b7c9564841712da Mon Sep 17 00:00:00 2001 From: vineeth Hanumanthu Date: Thu, 26 Sep 2019 16:53:19 +0530 Subject: [PATCH 5/8] changed naming in resources --- .../DataCollection/DataCollectionManager.cs | 2 +- .../Resources/Resources.Designer.cs | 18 +++++++++--------- .../Resources/Resources.resx | 6 +++--- .../Resources/xlf/Resources.cs.xlf | 6 +++--- .../Resources/xlf/Resources.de.xlf | 6 +++--- .../Resources/xlf/Resources.es.xlf | 6 +++--- .../Resources/xlf/Resources.fr.xlf | 6 +++--- .../Resources/xlf/Resources.it.xlf | 6 +++--- .../Resources/xlf/Resources.ja.xlf | 6 +++--- .../Resources/xlf/Resources.ko.xlf | 6 +++--- .../Resources/xlf/Resources.pl.xlf | 6 +++--- .../Resources/xlf/Resources.pt-BR.xlf | 6 +++--- .../Resources/xlf/Resources.ru.xlf | 6 +++--- .../Resources/xlf/Resources.tr.xlf | 6 +++--- .../Resources/xlf/Resources.xlf | 6 +++--- .../Resources/xlf/Resources.zh-Hans.xlf | 6 +++--- .../Resources/xlf/Resources.zh-Hant.xlf | 6 +++--- 17 files changed, 55 insertions(+), 55 deletions(-) diff --git a/src/Microsoft.TestPlatform.Common/DataCollection/DataCollectionManager.cs b/src/Microsoft.TestPlatform.Common/DataCollection/DataCollectionManager.cs index a86b3d2757..aa0ad4c8fe 100644 --- a/src/Microsoft.TestPlatform.Common/DataCollection/DataCollectionManager.cs +++ b/src/Microsoft.TestPlatform.Common/DataCollection/DataCollectionManager.cs @@ -438,7 +438,7 @@ private void LoadAndInitialize(DataCollectorSettings dataCollectorSettings, stri if (!IsUriValid(dataCollectorUri) && !this.TryGetUriFromFriendlyName(dataCollectorSettings.FriendlyName, out dataCollectorUri)) { - this.LogWarning(string.Format(CultureInfo.CurrentUICulture, Resources.Resources.CannotFetchByFriendlyName, dataCollectorSettings.FriendlyName)); + this.LogWarning(string.Format(CultureInfo.CurrentUICulture, Resources.Resources.UnableToFetchUriString, dataCollectorSettings.FriendlyName)); } DataCollector dataCollector = null; diff --git a/src/Microsoft.TestPlatform.Common/Resources/Resources.Designer.cs b/src/Microsoft.TestPlatform.Common/Resources/Resources.Designer.cs index 5f444c3c50..ea68a5173c 100644 --- a/src/Microsoft.TestPlatform.Common/Resources/Resources.Designer.cs +++ b/src/Microsoft.TestPlatform.Common/Resources/Resources.Designer.cs @@ -69,15 +69,6 @@ internal class Resources { } } - /// - /// Looks up a localized string similar to Cannot Fetch Uri with {0}.. - /// - internal static string CannotFetchByFriendlyName { - get { - return ResourceManager.GetString("CannotFetchByFriendlyName", resourceCulture); - } - } - /// /// Looks up a localized string similar to Data collection : {0}. /// @@ -348,6 +339,15 @@ internal class Resources { } } + /// + /// Looks up a localized string similar to Unable to find a datacollector with friendly name '[0}'.. + /// + internal static string UnableToFetchUriString { + get { + return ResourceManager.GetString("UnableToFetchUriString", resourceCulture); + } + } + /// /// Looks up a localized string similar to This option works only with vstest.console.exe installed as part of Visual Studio.. /// diff --git a/src/Microsoft.TestPlatform.Common/Resources/Resources.resx b/src/Microsoft.TestPlatform.Common/Resources/Resources.resx index 78179a3ae4..815b99eddd 100644 --- a/src/Microsoft.TestPlatform.Common/Resources/Resources.resx +++ b/src/Microsoft.TestPlatform.Common/Resources/Resources.resx @@ -120,9 +120,6 @@ Cancelling the operation as requested. - - Cannot Fetch Uri with {0}. - Data collection : {0} @@ -213,6 +210,9 @@ Incorrect format for TestCaseFilter {0}. Specify the correct format and try again. Note that the incorrect format can lead to no test getting executed. + + Unable to find a datacollector with friendly name '[0}'. + This option works only with vstest.console.exe installed as part of Visual Studio. diff --git a/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.cs.xlf b/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.cs.xlf index 35edd4cf29..5877443562 100644 --- a/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.cs.xlf +++ b/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.cs.xlf @@ -269,9 +269,9 @@ Operace se ruší na základě žádosti. - - Cannot Fetch Uri with {0}. - Cannot Fetch Uri with {0}. + + Unable to find a datacollector with friendly name '[0}'. + Unable to find a datacollector with friendly name '[0}'. diff --git a/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.de.xlf b/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.de.xlf index cac3551de7..7b6de61326 100644 --- a/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.de.xlf +++ b/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.de.xlf @@ -269,9 +269,9 @@ Der Vorgang wird gemäß Anforderung abgebrochen. - - Cannot Fetch Uri with {0}. - Cannot Fetch Uri with {0}. + + Unable to find a datacollector with friendly name '[0}'. + Unable to find a datacollector with friendly name '[0}'. diff --git a/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.es.xlf b/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.es.xlf index efd8c98c0e..1b3395c31f 100644 --- a/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.es.xlf +++ b/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.es.xlf @@ -269,9 +269,9 @@ La operación se cancelará como se ha solicitado. - - Cannot Fetch Uri with {0}. - Cannot Fetch Uri with {0}. + + Unable to find a datacollector with friendly name '[0}'. + Unable to find a datacollector with friendly name '[0}'. diff --git a/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.fr.xlf b/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.fr.xlf index b8f396c235..0863d82823 100644 --- a/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.fr.xlf +++ b/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.fr.xlf @@ -269,9 +269,9 @@ Annulation de l'opération, comme demandé. - - Cannot Fetch Uri with {0}. - Cannot Fetch Uri with {0}. + + Unable to find a datacollector with friendly name '[0}'. + Unable to find a datacollector with friendly name '[0}'. diff --git a/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.it.xlf b/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.it.xlf index 377ee4c3c5..7a7c488ded 100644 --- a/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.it.xlf +++ b/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.it.xlf @@ -269,9 +269,9 @@ L'operazione verrà annullata come richiesto. - - Cannot Fetch Uri with {0}. - Cannot Fetch Uri with {0}. + + Unable to find a datacollector with friendly name '[0}'. + Unable to find a datacollector with friendly name '[0}'. diff --git a/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.ja.xlf b/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.ja.xlf index 0db8260baa..abccaf3845 100644 --- a/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.ja.xlf +++ b/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.ja.xlf @@ -269,9 +269,9 @@ 操作のキャンセルが要求されたため、キャンセルしています。 - - Cannot Fetch Uri with {0}. - Cannot Fetch Uri with {0}. + + Unable to find a datacollector with friendly name '[0}'. + Unable to find a datacollector with friendly name '[0}'. diff --git a/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.ko.xlf b/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.ko.xlf index 6ac3d7e154..03ea1e5512 100644 --- a/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.ko.xlf +++ b/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.ko.xlf @@ -269,9 +269,9 @@ 요청한 대로 작업을 취소하는 중입니다. - - Cannot Fetch Uri with {0}. - Cannot Fetch Uri with {0}. + + Unable to find a datacollector with friendly name '[0}'. + Unable to find a datacollector with friendly name '[0}'. diff --git a/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.pl.xlf b/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.pl.xlf index c37e5e2695..b5c02d6ab6 100644 --- a/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.pl.xlf +++ b/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.pl.xlf @@ -269,9 +269,9 @@ Anulowanie operacji zgodnie z żądaniem. - - Cannot Fetch Uri with {0}. - Cannot Fetch Uri with {0}. + + Unable to find a datacollector with friendly name '[0}'. + Unable to find a datacollector with friendly name '[0}'. diff --git a/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.pt-BR.xlf b/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.pt-BR.xlf index 98b22c97d0..6c2ee59377 100644 --- a/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.pt-BR.xlf +++ b/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.pt-BR.xlf @@ -269,9 +269,9 @@ Cancelando a operação conforme solicitado. - - Cannot Fetch Uri with {0}. - Cannot Fetch Uri with {0}. + + Unable to find a datacollector with friendly name '[0}'. + Unable to find a datacollector with friendly name '[0}'. diff --git a/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.ru.xlf b/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.ru.xlf index ff1ae3e520..3c5337f3cb 100644 --- a/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.ru.xlf +++ b/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.ru.xlf @@ -269,9 +269,9 @@ Операция отменяется в соответствии с запросом. - - Cannot Fetch Uri with {0}. - Cannot Fetch Uri with {0}. + + Unable to find a datacollector with friendly name '[0}'. + Unable to find a datacollector with friendly name '[0}'. diff --git a/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.tr.xlf b/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.tr.xlf index fd53feceac..d12f56cf71 100644 --- a/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.tr.xlf +++ b/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.tr.xlf @@ -269,9 +269,9 @@ İşlem istek üzerine iptal ediliyor. - - Cannot Fetch Uri with {0}. - Cannot Fetch Uri with {0}. + + Unable to find a datacollector with friendly name '[0}'. + Unable to find a datacollector with friendly name '[0}'. diff --git a/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.xlf b/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.xlf index 1a7dbc96e9..4a527f20ae 100644 --- a/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.xlf +++ b/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.xlf @@ -146,9 +146,9 @@ Cancelling the operation as requested. - - Cannot Fetch Uri with {0}. - Cannot Fetch Uri with {0}. + + Unable to find a datacollector with friendly name '[0}'. + Unable to find a datacollector with friendly name '[0}'. diff --git a/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.zh-Hans.xlf b/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.zh-Hans.xlf index 05ce6b68de..634e379d6d 100644 --- a/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.zh-Hans.xlf +++ b/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.zh-Hans.xlf @@ -269,9 +269,9 @@ 按要求取消该操作。 - - Cannot Fetch Uri with {0}. - Cannot Fetch Uri with {0}. + + Unable to find a datacollector with friendly name '[0}'. + Unable to find a datacollector with friendly name '[0}'. diff --git a/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.zh-Hant.xlf b/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.zh-Hant.xlf index ea64fa059a..a800e3a17f 100644 --- a/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.zh-Hant.xlf +++ b/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.zh-Hant.xlf @@ -269,9 +269,9 @@ 正在應要求取消作業。 - - Cannot Fetch Uri with {0}. - Cannot Fetch Uri with {0}. + + Unable to find a datacollector with friendly name '[0}'. + Unable to find a datacollector with friendly name '[0}'. From 6d6cd6e392654642bee1da9f1a8f9db23b5d043d Mon Sep 17 00:00:00 2001 From: vineeth Hanumanthu Date: Mon, 30 Sep 2019 15:33:30 +0530 Subject: [PATCH 6/8] added tests and verified behavior --- .../DataCollection/DataCollectionManager.cs | 5 +++ .../DataCollectionManagerTests.cs | 40 +++++++++++++++++-- 2 files changed, 42 insertions(+), 3 deletions(-) diff --git a/src/Microsoft.TestPlatform.Common/DataCollection/DataCollectionManager.cs b/src/Microsoft.TestPlatform.Common/DataCollection/DataCollectionManager.cs index aa0ad4c8fe..d5e61e98a4 100644 --- a/src/Microsoft.TestPlatform.Common/DataCollection/DataCollectionManager.cs +++ b/src/Microsoft.TestPlatform.Common/DataCollection/DataCollectionManager.cs @@ -393,6 +393,11 @@ protected virtual bool TryGetUriFromFriendlyName(string friendlyName, out string protected virtual bool IsUriValid(string uri) { + if (string.IsNullOrEmpty(uri)) + { + return false; + } + var extensionManager = this.dataCollectorExtensionManager; foreach (var extension in extensionManager.TestExtensions) { diff --git a/test/datacollector.UnitTests/DataCollectionManagerTests.cs b/test/datacollector.UnitTests/DataCollectionManagerTests.cs index f127e3907a..c20d765305 100644 --- a/test/datacollector.UnitTests/DataCollectionManagerTests.cs +++ b/test/datacollector.UnitTests/DataCollectionManagerTests.cs @@ -24,8 +24,8 @@ public class DataCollectionManagerTests private string defaultRunSettings = "\r\n\r\n \r\n {0}\r\n \r\n"; private string defaultDataCollectionSettings = ""; private string dataCollectorSettings; - - private string dataCollectorSettingsWithWrongFriendlyName, dataCollectorSettingsWithWrongFriendlyNameAndWrongUri, dataCollectorSettingsWithoutFriendlyName, dataCollectorSettingsEnabled, dataCollectorSettingsDisabled, dataCollectorSettingsWithWrongUri; + private string dataCollectorSettingsWithWrongFriendlyName, dataCollectorSettingsWithWrongFriendlyNameAndWrongUri, dataCollectorSettingsWithNullFriendlyName, dataCollectorSettingsWithEmptyFriendlyName, + dataCollectorSettingsEnabled, dataCollectorSettingsDisabled, dataCollectorSettingsWithWrongUri, dataCollectorSettingsWithNullUri, dataCollectorSettingsWithEmptyUri; private Mock mockMessageSink; private Mock mockDataCollector; @@ -44,8 +44,11 @@ public DataCollectionManagerTests() this.dataCollectorSettings = string.Format(this.defaultRunSettings, string.Format(this.defaultDataCollectionSettings, friendlyName, uri, this.mockDataCollector.Object.GetType().AssemblyQualifiedName, typeof(DataCollectionManagerTests).GetTypeInfo().Assembly.Location, string.Empty)); this.dataCollectorSettingsWithWrongFriendlyName = string.Format(this.defaultRunSettings, string.Format(this.defaultDataCollectionSettings, "anyFriendlyName", uri, this.mockDataCollector.Object.GetType().AssemblyQualifiedName, typeof(DataCollectionManagerTests).GetTypeInfo().Assembly.Location, string.Empty)); this.dataCollectorSettingsWithWrongUri = string.Format(this.defaultRunSettings, string.Format(this.defaultDataCollectionSettings, friendlyName, "my://custom/WrongDatacollector", this.mockDataCollector.Object.GetType().AssemblyQualifiedName, typeof(DataCollectionManagerTests).GetTypeInfo().Assembly.Location, string.Empty)); + this.dataCollectorSettingsWithEmptyFriendlyName = string.Format(this.defaultRunSettings, string.Format(this.defaultDataCollectionSettings, friendlyName, string.Empty, this.mockDataCollector.Object.GetType().AssemblyQualifiedName, typeof(DataCollectionManagerTests).GetTypeInfo().Assembly.Location, string.Empty)); + this.dataCollectorSettingsWithEmptyUri = string.Format(this.defaultRunSettings, string.Format(this.defaultDataCollectionSettings, friendlyName, string.Empty, this.mockDataCollector.Object.GetType().AssemblyQualifiedName, typeof(DataCollectionManagerTests).GetTypeInfo().Assembly.Location, string.Empty)); this.dataCollectorSettingsWithWrongFriendlyNameAndWrongUri = string.Format(this.defaultRunSettings, string.Format(this.defaultDataCollectionSettings, "anyFriendlyName", "datacollector://data", this.mockDataCollector.Object.GetType().AssemblyQualifiedName, typeof(DataCollectionManagerTests).GetTypeInfo().Assembly.Location, string.Empty)); - this.dataCollectorSettingsWithoutFriendlyName = string.Format(this.defaultRunSettings, string.Format(this.defaultDataCollectionSettings, string.Empty, uri, this.mockDataCollector.Object.GetType().AssemblyQualifiedName, typeof(DataCollectionManagerTests).GetTypeInfo().Assembly.Location, string.Empty).Replace("friendlyName=\"\"", string.Empty)); + this.dataCollectorSettingsWithNullFriendlyName = string.Format(this.defaultRunSettings, string.Format(this.defaultDataCollectionSettings, string.Empty, uri, this.mockDataCollector.Object.GetType().AssemblyQualifiedName, typeof(DataCollectionManagerTests).GetTypeInfo().Assembly.Location, string.Empty).Replace("friendlyName=\"\"", string.Empty)); + this.dataCollectorSettingsWithNullUri = string.Format(this.defaultRunSettings, string.Format(this.defaultDataCollectionSettings, friendlyName, string.Empty, this.mockDataCollector.Object.GetType().AssemblyQualifiedName, typeof(DataCollectionManagerTests).GetTypeInfo().Assembly.Location, string.Empty).Replace("uri=\"\"", string.Empty)); this.dataCollectorSettingsEnabled = string.Format(this.defaultRunSettings, string.Format(this.defaultDataCollectionSettings, friendlyName, uri, this.mockDataCollector.Object.GetType().AssemblyQualifiedName, typeof(DataCollectionManagerTests).GetTypeInfo().Assembly.Location, "enabled=\"true\"")); this.dataCollectorSettingsDisabled = string.Format(this.defaultRunSettings, string.Format(this.defaultDataCollectionSettings, friendlyName, uri, this.mockDataCollector.Object.GetType().AssemblyQualifiedName, typeof(DataCollectionManagerTests).GetTypeInfo().Assembly.Location, "enabled=\"false\"")); this.mockMessageSink = new Mock(); @@ -110,6 +113,7 @@ public void InitializeDataCollectorsShouldLoadDataCollectorIfFriendlyNameIsNotCo this.mockDataCollector.Verify(x => x.Initialize(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny()), Times.Once); } + [TestMethod] public void InitializeDataCollectorsShouldLoadDataCollectorIfFriendlyNameIsCorrectAndUriIsNotCorrect() { @@ -119,6 +123,36 @@ public void InitializeDataCollectorsShouldLoadDataCollectorIfFriendlyNameIsCorre this.mockDataCollector.Verify(x => x.Initialize(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny()), Times.Once); } + [TestMethod] + public void InitializeDataCollectorsShouldLoadDataCollectorIfFriendlyNameIsCorrectAndUriIsNull() + { + this.dataCollectionManager.InitializeDataCollectors(this.dataCollectorSettingsWithNullUri); + + Assert.AreEqual(0, this.dataCollectionManager.RunDataCollectors.Count); + this.mockDataCollector.Verify(x => x.Initialize(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny()), Times.Never); + } + + [TestMethod] + public void InitializeDataCollectorsShouldLoadDataCollectorIfFriendlyNameIsNullAndUriIsCorrect() + { + this.dataCollectionManager.InitializeDataCollectors(this.dataCollectorSettingsWithNullFriendlyName); + + Assert.AreEqual(1, this.dataCollectionManager.RunDataCollectors.Count); + this.mockDataCollector.Verify(x => x.Initialize(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny()), Times.Once); + } + + [TestMethod] + public void InitializeDataCollectorsShouldLoadDataCollectorIfFriendlyNameIsCorrectAndUriIsEmpty() + { + Assert.ThrowsException(() => this.dataCollectionManager.InitializeDataCollectors(this.dataCollectorSettingsWithEmptyUri)); + } + + [TestMethod] + public void InitializeDataCollectorsShouldLoadDataCollectorIfFriendlyNameIsEmptyAndUriIsCorrect() + { + Assert.ThrowsException(() => this.dataCollectionManager.InitializeDataCollectors(this.dataCollectorSettingsWithEmptyFriendlyName)); + } + [TestMethod] public void InitializeDataCollectorsShouldNotLoadDataCollectorIfFriendlyNameIsNotCorrectAndUriIsNotCorrect() { From 58a0a419c9c544fa8217407d69793b11523174d6 Mon Sep 17 00:00:00 2001 From: vineeth Hanumanthu Date: Tue, 1 Oct 2019 17:02:55 +0530 Subject: [PATCH 7/8] changed member variables to functional variables --- .../DataCollectionManagerTests.cs | 51 +++++++++---------- 1 file changed, 24 insertions(+), 27 deletions(-) diff --git a/test/datacollector.UnitTests/DataCollectionManagerTests.cs b/test/datacollector.UnitTests/DataCollectionManagerTests.cs index c20d765305..ae776ea366 100644 --- a/test/datacollector.UnitTests/DataCollectionManagerTests.cs +++ b/test/datacollector.UnitTests/DataCollectionManagerTests.cs @@ -24,9 +24,8 @@ public class DataCollectionManagerTests private string defaultRunSettings = "\r\n\r\n \r\n {0}\r\n \r\n"; private string defaultDataCollectionSettings = ""; private string dataCollectorSettings; - private string dataCollectorSettingsWithWrongFriendlyName, dataCollectorSettingsWithWrongFriendlyNameAndWrongUri, dataCollectorSettingsWithNullFriendlyName, dataCollectorSettingsWithEmptyFriendlyName, - dataCollectorSettingsEnabled, dataCollectorSettingsDisabled, dataCollectorSettingsWithWrongUri, dataCollectorSettingsWithNullUri, dataCollectorSettingsWithEmptyUri; - + private string friendlyName; + private string uri; private Mock mockMessageSink; private Mock mockDataCollector; private List> envVarList; @@ -34,23 +33,11 @@ public class DataCollectionManagerTests public DataCollectionManagerTests() { - var friendlyName = "CustomDataCollector"; - var uri = "my://custom/datacollector"; - + this.friendlyName = "CustomDataCollector"; + this.uri = "my://custom/datacollector"; this.envVarList = new List>(); this.mockDataCollector = new Mock(); this.mockDataCollector.As().Setup(x => x.GetTestExecutionEnvironmentVariables()).Returns(this.envVarList); - - this.dataCollectorSettings = string.Format(this.defaultRunSettings, string.Format(this.defaultDataCollectionSettings, friendlyName, uri, this.mockDataCollector.Object.GetType().AssemblyQualifiedName, typeof(DataCollectionManagerTests).GetTypeInfo().Assembly.Location, string.Empty)); - this.dataCollectorSettingsWithWrongFriendlyName = string.Format(this.defaultRunSettings, string.Format(this.defaultDataCollectionSettings, "anyFriendlyName", uri, this.mockDataCollector.Object.GetType().AssemblyQualifiedName, typeof(DataCollectionManagerTests).GetTypeInfo().Assembly.Location, string.Empty)); - this.dataCollectorSettingsWithWrongUri = string.Format(this.defaultRunSettings, string.Format(this.defaultDataCollectionSettings, friendlyName, "my://custom/WrongDatacollector", this.mockDataCollector.Object.GetType().AssemblyQualifiedName, typeof(DataCollectionManagerTests).GetTypeInfo().Assembly.Location, string.Empty)); - this.dataCollectorSettingsWithEmptyFriendlyName = string.Format(this.defaultRunSettings, string.Format(this.defaultDataCollectionSettings, friendlyName, string.Empty, this.mockDataCollector.Object.GetType().AssemblyQualifiedName, typeof(DataCollectionManagerTests).GetTypeInfo().Assembly.Location, string.Empty)); - this.dataCollectorSettingsWithEmptyUri = string.Format(this.defaultRunSettings, string.Format(this.defaultDataCollectionSettings, friendlyName, string.Empty, this.mockDataCollector.Object.GetType().AssemblyQualifiedName, typeof(DataCollectionManagerTests).GetTypeInfo().Assembly.Location, string.Empty)); - this.dataCollectorSettingsWithWrongFriendlyNameAndWrongUri = string.Format(this.defaultRunSettings, string.Format(this.defaultDataCollectionSettings, "anyFriendlyName", "datacollector://data", this.mockDataCollector.Object.GetType().AssemblyQualifiedName, typeof(DataCollectionManagerTests).GetTypeInfo().Assembly.Location, string.Empty)); - this.dataCollectorSettingsWithNullFriendlyName = string.Format(this.defaultRunSettings, string.Format(this.defaultDataCollectionSettings, string.Empty, uri, this.mockDataCollector.Object.GetType().AssemblyQualifiedName, typeof(DataCollectionManagerTests).GetTypeInfo().Assembly.Location, string.Empty).Replace("friendlyName=\"\"", string.Empty)); - this.dataCollectorSettingsWithNullUri = string.Format(this.defaultRunSettings, string.Format(this.defaultDataCollectionSettings, friendlyName, string.Empty, this.mockDataCollector.Object.GetType().AssemblyQualifiedName, typeof(DataCollectionManagerTests).GetTypeInfo().Assembly.Location, string.Empty).Replace("uri=\"\"", string.Empty)); - this.dataCollectorSettingsEnabled = string.Format(this.defaultRunSettings, string.Format(this.defaultDataCollectionSettings, friendlyName, uri, this.mockDataCollector.Object.GetType().AssemblyQualifiedName, typeof(DataCollectionManagerTests).GetTypeInfo().Assembly.Location, "enabled=\"true\"")); - this.dataCollectorSettingsDisabled = string.Format(this.defaultRunSettings, string.Format(this.defaultDataCollectionSettings, friendlyName, uri, this.mockDataCollector.Object.GetType().AssemblyQualifiedName, typeof(DataCollectionManagerTests).GetTypeInfo().Assembly.Location, "enabled=\"false\"")); this.mockMessageSink = new Mock(); this.mockDataCollectionAttachmentManager = new Mock(); this.mockDataCollectionAttachmentManager.SetReturnsDefault>(new List()); @@ -79,7 +66,8 @@ public void InitializeDataCollectorsShouldReturnEmptyDictionaryIfDataCollectorsA [TestMethod] public void InitializeDataCollectorsShouldLoadDataCollector() { - this.dataCollectionManager.InitializeDataCollectors(this.dataCollectorSettings); + var dataCollectorSettings = string.Format(this.defaultRunSettings, string.Format(this.defaultDataCollectionSettings, friendlyName, uri, this.mockDataCollector.Object.GetType().AssemblyQualifiedName, typeof(DataCollectionManagerTests).GetTypeInfo().Assembly.Location, string.Empty)); + this.dataCollectionManager.InitializeDataCollectors(dataCollectorSettings); Assert.IsTrue(this.dataCollectionManager.RunDataCollectors.ContainsKey(this.mockDataCollector.Object.GetType())); this.mockDataCollector.Verify(x => x.Initialize(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny()), Times.Once); @@ -88,7 +76,8 @@ public void InitializeDataCollectorsShouldLoadDataCollector() [TestMethod] public void InitializeShouldNotAddDataCollectorIfItIsDisabled() { - this.dataCollectionManager.InitializeDataCollectors(this.dataCollectorSettingsDisabled); + var dataCollectorSettingsDisabled = string.Format(this.defaultRunSettings, string.Format(this.defaultDataCollectionSettings, friendlyName, uri, this.mockDataCollector.Object.GetType().AssemblyQualifiedName, typeof(DataCollectionManagerTests).GetTypeInfo().Assembly.Location, "enabled=\"false\"")); + this.dataCollectionManager.InitializeDataCollectors(dataCollectorSettingsDisabled); Assert.AreEqual(0, this.dataCollectionManager.RunDataCollectors.Count); this.mockDataCollector.Verify(x => x.Initialize(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny()), Times.Never); @@ -97,7 +86,8 @@ public void InitializeShouldNotAddDataCollectorIfItIsDisabled() [TestMethod] public void InitializeShouldAddDataCollectorIfItIsEnabled() { - this.dataCollectionManager.InitializeDataCollectors(this.dataCollectorSettingsEnabled); + var dataCollectorSettingsEnabled = string.Format(this.defaultRunSettings, string.Format(this.defaultDataCollectionSettings, friendlyName, uri, this.mockDataCollector.Object.GetType().AssemblyQualifiedName, typeof(DataCollectionManagerTests).GetTypeInfo().Assembly.Location, "enabled=\"true\"")); + this.dataCollectionManager.InitializeDataCollectors(dataCollectorSettingsEnabled); Assert.IsTrue(this.dataCollectionManager.RunDataCollectors.ContainsKey(this.mockDataCollector.Object.GetType())); this.mockDataCollector.Verify(x => x.Initialize(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny()), Times.Once); @@ -107,7 +97,8 @@ public void InitializeShouldAddDataCollectorIfItIsEnabled() [TestMethod] public void InitializeDataCollectorsShouldLoadDataCollectorIfFriendlyNameIsNotCorrectAndUriIsCorrect() { - this.dataCollectionManager.InitializeDataCollectors(this.dataCollectorSettingsWithWrongFriendlyName); + var dataCollectorSettingsWithWrongFriendlyName = string.Format(this.defaultRunSettings, string.Format(this.defaultDataCollectionSettings, "anyFriendlyName", uri, this.mockDataCollector.Object.GetType().AssemblyQualifiedName, typeof(DataCollectionManagerTests).GetTypeInfo().Assembly.Location, string.Empty)); + this.dataCollectionManager.InitializeDataCollectors(dataCollectorSettingsWithWrongFriendlyName); Assert.AreEqual(1, this.dataCollectionManager.RunDataCollectors.Count); this.mockDataCollector.Verify(x => x.Initialize(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny()), Times.Once); @@ -117,7 +108,8 @@ public void InitializeDataCollectorsShouldLoadDataCollectorIfFriendlyNameIsNotCo [TestMethod] public void InitializeDataCollectorsShouldLoadDataCollectorIfFriendlyNameIsCorrectAndUriIsNotCorrect() { - this.dataCollectionManager.InitializeDataCollectors(this.dataCollectorSettingsWithWrongUri); + var dataCollectorSettingsWithWrongUri = string.Format(this.defaultRunSettings, string.Format(this.defaultDataCollectionSettings, friendlyName, "my://custom/WrongDatacollector", this.mockDataCollector.Object.GetType().AssemblyQualifiedName, typeof(DataCollectionManagerTests).GetTypeInfo().Assembly.Location, string.Empty)); + this.dataCollectionManager.InitializeDataCollectors(dataCollectorSettingsWithWrongUri); Assert.AreEqual(1, this.dataCollectionManager.RunDataCollectors.Count); this.mockDataCollector.Verify(x => x.Initialize(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny()), Times.Once); @@ -126,7 +118,8 @@ public void InitializeDataCollectorsShouldLoadDataCollectorIfFriendlyNameIsCorre [TestMethod] public void InitializeDataCollectorsShouldLoadDataCollectorIfFriendlyNameIsCorrectAndUriIsNull() { - this.dataCollectionManager.InitializeDataCollectors(this.dataCollectorSettingsWithNullUri); + var dataCollectorSettingsWithNullUri = string.Format(this.defaultRunSettings, string.Format(this.defaultDataCollectionSettings, friendlyName, string.Empty, this.mockDataCollector.Object.GetType().AssemblyQualifiedName, typeof(DataCollectionManagerTests).GetTypeInfo().Assembly.Location, string.Empty).Replace("uri=\"\"", string.Empty)); + this.dataCollectionManager.InitializeDataCollectors(dataCollectorSettingsWithNullUri); Assert.AreEqual(0, this.dataCollectionManager.RunDataCollectors.Count); this.mockDataCollector.Verify(x => x.Initialize(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny()), Times.Never); @@ -135,7 +128,8 @@ public void InitializeDataCollectorsShouldLoadDataCollectorIfFriendlyNameIsCorre [TestMethod] public void InitializeDataCollectorsShouldLoadDataCollectorIfFriendlyNameIsNullAndUriIsCorrect() { - this.dataCollectionManager.InitializeDataCollectors(this.dataCollectorSettingsWithNullFriendlyName); + var dataCollectorSettingsWithNullFriendlyName = string.Format(this.defaultRunSettings, string.Format(this.defaultDataCollectionSettings, string.Empty, uri, this.mockDataCollector.Object.GetType().AssemblyQualifiedName, typeof(DataCollectionManagerTests).GetTypeInfo().Assembly.Location, string.Empty).Replace("friendlyName=\"\"", string.Empty)); + this.dataCollectionManager.InitializeDataCollectors(dataCollectorSettingsWithNullFriendlyName); Assert.AreEqual(1, this.dataCollectionManager.RunDataCollectors.Count); this.mockDataCollector.Verify(x => x.Initialize(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny()), Times.Once); @@ -144,19 +138,22 @@ public void InitializeDataCollectorsShouldLoadDataCollectorIfFriendlyNameIsNullA [TestMethod] public void InitializeDataCollectorsShouldLoadDataCollectorIfFriendlyNameIsCorrectAndUriIsEmpty() { - Assert.ThrowsException(() => this.dataCollectionManager.InitializeDataCollectors(this.dataCollectorSettingsWithEmptyUri)); + var dataCollectorSettingsWithEmptyUri = string.Format(this.defaultRunSettings, string.Format(this.defaultDataCollectionSettings, friendlyName, string.Empty, this.mockDataCollector.Object.GetType().AssemblyQualifiedName, typeof(DataCollectionManagerTests).GetTypeInfo().Assembly.Location, string.Empty)); + Assert.ThrowsException(() => this.dataCollectionManager.InitializeDataCollectors(dataCollectorSettingsWithEmptyUri)); } [TestMethod] public void InitializeDataCollectorsShouldLoadDataCollectorIfFriendlyNameIsEmptyAndUriIsCorrect() { - Assert.ThrowsException(() => this.dataCollectionManager.InitializeDataCollectors(this.dataCollectorSettingsWithEmptyFriendlyName)); + var dataCollectorSettingsWithEmptyFriendlyName = string.Format(this.defaultRunSettings, string.Format(this.defaultDataCollectionSettings, friendlyName, string.Empty, this.mockDataCollector.Object.GetType().AssemblyQualifiedName, typeof(DataCollectionManagerTests).GetTypeInfo().Assembly.Location, string.Empty)); + Assert.ThrowsException(() => this.dataCollectionManager.InitializeDataCollectors(dataCollectorSettingsWithEmptyFriendlyName)); } [TestMethod] public void InitializeDataCollectorsShouldNotLoadDataCollectorIfFriendlyNameIsNotCorrectAndUriIsNotCorrect() { - this.dataCollectionManager.InitializeDataCollectors(this.dataCollectorSettingsWithWrongFriendlyNameAndWrongUri); + var dataCollectorSettingsWithWrongFriendlyNameAndWrongUri = string.Format(this.defaultRunSettings, string.Format(this.defaultDataCollectionSettings, "anyFriendlyName", "datacollector://data", this.mockDataCollector.Object.GetType().AssemblyQualifiedName, typeof(DataCollectionManagerTests).GetTypeInfo().Assembly.Location, string.Empty)); + this.dataCollectionManager.InitializeDataCollectors(dataCollectorSettingsWithWrongFriendlyNameAndWrongUri); Assert.AreEqual(0, this.dataCollectionManager.RunDataCollectors.Count); this.mockDataCollector.Verify(x => x.Initialize(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny()), Times.Never); From 046321948e6cbb79e0acf2ba69f2b2c5b43c4892 Mon Sep 17 00:00:00 2001 From: vineeth Hanumanthu Date: Tue, 1 Oct 2019 19:46:32 +0530 Subject: [PATCH 8/8] added datacollectorsettings as member varaible again --- .../Resources/xlf/Resources.cs.xlf | 2 ++ .../Resources/xlf/Resources.de.xlf | 2 ++ .../Resources/xlf/Resources.es.xlf | 2 ++ .../Resources/xlf/Resources.fr.xlf | 2 ++ .../Resources/xlf/Resources.it.xlf | 2 ++ .../Resources/xlf/Resources.ja.xlf | 2 ++ .../Resources/xlf/Resources.ko.xlf | 2 ++ .../Resources/xlf/Resources.pl.xlf | 2 ++ .../Resources/xlf/Resources.pt-BR.xlf | 2 ++ .../Resources/xlf/Resources.ru.xlf | 2 ++ .../Resources/xlf/Resources.tr.xlf | 2 ++ .../Resources/xlf/Resources.xlf | 2 ++ .../Resources/xlf/Resources.zh-Hans.xlf | 2 ++ .../Resources/xlf/Resources.zh-Hant.xlf | 2 ++ test/datacollector.UnitTests/DataCollectionManagerTests.cs | 5 +---- 15 files changed, 29 insertions(+), 4 deletions(-) diff --git a/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.cs.xlf b/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.cs.xlf index f6d3be670f..3fd8021863 100644 --- a/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.cs.xlf +++ b/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.cs.xlf @@ -272,6 +272,8 @@ Unable to find a datacollector with friendly name '[0}'. Unable to find a datacollector with friendly name '[0}'. + + Failed to load extensions from file '{0}'. Please use /diag for more information. TestPluginDiscoverer: Failed to load extensions from file '{0}'. Please use /diag for more information. diff --git a/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.de.xlf b/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.de.xlf index 52feea15e5..be44debddc 100644 --- a/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.de.xlf +++ b/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.de.xlf @@ -272,6 +272,8 @@ Unable to find a datacollector with friendly name '[0}'. Unable to find a datacollector with friendly name '[0}'. + + Failed to load extensions from file '{0}'. Please use /diag for more information. TestPluginDiscoverer: Failed to load extensions from file '{0}'. Please use /diag for more information. diff --git a/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.es.xlf b/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.es.xlf index d88ab9c94c..0c50da5700 100644 --- a/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.es.xlf +++ b/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.es.xlf @@ -272,6 +272,8 @@ Unable to find a datacollector with friendly name '[0}'. Unable to find a datacollector with friendly name '[0}'. + + Failed to load extensions from file '{0}'. Please use /diag for more information. TestPluginDiscoverer: Failed to load extensions from file '{0}'. Please use /diag for more information. diff --git a/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.fr.xlf b/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.fr.xlf index f021bd165c..e18e8cf35b 100644 --- a/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.fr.xlf +++ b/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.fr.xlf @@ -272,6 +272,8 @@ Unable to find a datacollector with friendly name '[0}'. Unable to find a datacollector with friendly name '[0}'. + + Failed to load extensions from file '{0}'. Please use /diag for more information. TestPluginDiscoverer: Failed to load extensions from file '{0}'. Please use /diag for more information. diff --git a/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.it.xlf b/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.it.xlf index 6616f6dafe..edb47cc110 100644 --- a/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.it.xlf +++ b/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.it.xlf @@ -272,6 +272,8 @@ Unable to find a datacollector with friendly name '[0}'. Unable to find a datacollector with friendly name '[0}'. + + Failed to load extensions from file '{0}'. Please use /diag for more information. TestPluginDiscoverer: Failed to load extensions from file '{0}'. Please use /diag for more information. diff --git a/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.ja.xlf b/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.ja.xlf index 82b2484126..ebcae6109e 100644 --- a/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.ja.xlf +++ b/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.ja.xlf @@ -272,6 +272,8 @@ Unable to find a datacollector with friendly name '[0}'. Unable to find a datacollector with friendly name '[0}'. + + Failed to load extensions from file '{0}'. Please use /diag for more information. TestPluginDiscoverer: Failed to load extensions from file '{0}'. Please use /diag for more information. diff --git a/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.ko.xlf b/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.ko.xlf index 314d27d8ad..efb912c67c 100644 --- a/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.ko.xlf +++ b/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.ko.xlf @@ -272,6 +272,8 @@ Unable to find a datacollector with friendly name '[0}'. Unable to find a datacollector with friendly name '[0}'. + + Failed to load extensions from file '{0}'. Please use /diag for more information. TestPluginDiscoverer: Failed to load extensions from file '{0}'. Please use /diag for more information. diff --git a/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.pl.xlf b/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.pl.xlf index 47669a2f3f..32ec4e8912 100644 --- a/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.pl.xlf +++ b/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.pl.xlf @@ -272,6 +272,8 @@ Unable to find a datacollector with friendly name '[0}'. Unable to find a datacollector with friendly name '[0}'. + + Failed to load extensions from file '{0}'. Please use /diag for more information. TestPluginDiscoverer: Failed to load extensions from file '{0}'. Please use /diag for more information. diff --git a/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.pt-BR.xlf b/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.pt-BR.xlf index 3cb87b40f0..9347c7b730 100644 --- a/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.pt-BR.xlf +++ b/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.pt-BR.xlf @@ -272,6 +272,8 @@ Unable to find a datacollector with friendly name '[0}'. Unable to find a datacollector with friendly name '[0}'. + + Failed to load extensions from file '{0}'. Please use /diag for more information. TestPluginDiscoverer: Failed to load extensions from file '{0}'. Please use /diag for more information. diff --git a/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.ru.xlf b/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.ru.xlf index 02069f546e..1b4ad0e227 100644 --- a/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.ru.xlf +++ b/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.ru.xlf @@ -272,6 +272,8 @@ Unable to find a datacollector with friendly name '[0}'. Unable to find a datacollector with friendly name '[0}'. + + Failed to load extensions from file '{0}'. Please use /diag for more information. TestPluginDiscoverer: Failed to load extensions from file '{0}'. Please use /diag for more information. diff --git a/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.tr.xlf b/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.tr.xlf index 847f792482..9c52e64f1e 100644 --- a/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.tr.xlf +++ b/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.tr.xlf @@ -272,6 +272,8 @@ Unable to find a datacollector with friendly name '[0}'. Unable to find a datacollector with friendly name '[0}'. + + Failed to load extensions from file '{0}'. Please use /diag for more information. TestPluginDiscoverer: Failed to load extensions from file '{0}'. Please use /diag for more information. diff --git a/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.xlf b/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.xlf index 4d2089be48..0fb8c3f172 100644 --- a/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.xlf +++ b/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.xlf @@ -149,6 +149,8 @@ Unable to find a datacollector with friendly name '[0}'. Unable to find a datacollector with friendly name '[0}'. + + Failed to load extensions from file '{0}'. Please use /diag for more information. TestPluginDiscoverer: Failed to load extensions from file '{0}'. Please use /diag for more information. diff --git a/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.zh-Hans.xlf b/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.zh-Hans.xlf index a399374da9..01eae8fd53 100644 --- a/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.zh-Hans.xlf +++ b/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.zh-Hans.xlf @@ -272,6 +272,8 @@ Unable to find a datacollector with friendly name '[0}'. Unable to find a datacollector with friendly name '[0}'. + + Failed to load extensions from file '{0}'. Please use /diag for more information. TestPluginDiscoverer: Failed to load extensions from file '{0}'. Please use /diag for more information. diff --git a/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.zh-Hant.xlf b/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.zh-Hant.xlf index 0b735b85b4..2fa9fe9255 100644 --- a/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.zh-Hant.xlf +++ b/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.zh-Hant.xlf @@ -272,6 +272,8 @@ Unable to find a datacollector with friendly name '[0}'. Unable to find a datacollector with friendly name '[0}'. + + Failed to load extensions from file '{0}'. Please use /diag for more information. TestPluginDiscoverer: Failed to load extensions from file '{0}'. Please use /diag for more information. diff --git a/test/datacollector.UnitTests/DataCollectionManagerTests.cs b/test/datacollector.UnitTests/DataCollectionManagerTests.cs index ae776ea366..be2971f7e2 100644 --- a/test/datacollector.UnitTests/DataCollectionManagerTests.cs +++ b/test/datacollector.UnitTests/DataCollectionManagerTests.cs @@ -38,6 +38,7 @@ public DataCollectionManagerTests() this.envVarList = new List>(); this.mockDataCollector = new Mock(); this.mockDataCollector.As().Setup(x => x.GetTestExecutionEnvironmentVariables()).Returns(this.envVarList); + this.dataCollectorSettings = string.Format(this.defaultRunSettings, string.Format(this.defaultDataCollectionSettings, this.friendlyName, this.uri, this.mockDataCollector.Object.GetType().AssemblyQualifiedName, typeof(DataCollectionManagerTests).GetTypeInfo().Assembly.Location, string.Empty)); this.mockMessageSink = new Mock(); this.mockDataCollectionAttachmentManager = new Mock(); this.mockDataCollectionAttachmentManager.SetReturnsDefault>(new List()); @@ -93,7 +94,6 @@ public void InitializeShouldAddDataCollectorIfItIsEnabled() this.mockDataCollector.Verify(x => x.Initialize(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny()), Times.Once); } - [TestMethod] public void InitializeDataCollectorsShouldLoadDataCollectorIfFriendlyNameIsNotCorrectAndUriIsCorrect() { @@ -104,7 +104,6 @@ public void InitializeDataCollectorsShouldLoadDataCollectorIfFriendlyNameIsNotCo this.mockDataCollector.Verify(x => x.Initialize(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny()), Times.Once); } - [TestMethod] public void InitializeDataCollectorsShouldLoadDataCollectorIfFriendlyNameIsCorrectAndUriIsNotCorrect() { @@ -159,7 +158,6 @@ public void InitializeDataCollectorsShouldNotLoadDataCollectorIfFriendlyNameIsNo this.mockDataCollector.Verify(x => x.Initialize(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny()), Times.Never); } - [TestMethod] public void InitializeDataCollectorsShouldNotAddSameDataCollectorMoreThanOnce() { @@ -172,7 +170,6 @@ public void InitializeDataCollectorsShouldNotAddSameDataCollectorMoreThanOnce() this.mockDataCollector.Verify(x => x.Initialize(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny()), Times.Once); } - [TestMethod] public void InitializeDataCollectorsShouldLoadDataCollectorAndReturnEnvironmentVariables() {