diff --git a/TestPlatform.sln b/TestPlatform.sln index 3d1e2b6080..1ec85c83de 100644 --- a/TestPlatform.sln +++ b/TestPlatform.sln @@ -124,6 +124,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SimpleTestProject3", "test\ EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "datacollector.UnitTests", "test\datacollector.UnitTests\datacollector.UnitTests.csproj", "{0C6EFAF9-CE3E-4C11-8DD8-D7DABB206E5C}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "datacollector.PlatformTests", "test\datacollector.PlatformTests\datacollector.PlatformTests.csproj", "{FF80D706-8309-4E02-BAC0-D28B4CBCF600}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OutOfProcDataCollector", "test\TestAssets\OutOfProcDataCollector\OutOfProcDataCollector.csproj", "{CB6FA3C6-38E2-4DD1-AAB7-A705EFE114BC}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -686,6 +690,30 @@ Global {0C6EFAF9-CE3E-4C11-8DD8-D7DABB206E5C}.Release|x64.Build.0 = Release|x64 {0C6EFAF9-CE3E-4C11-8DD8-D7DABB206E5C}.Release|x86.ActiveCfg = Release|x86 {0C6EFAF9-CE3E-4C11-8DD8-D7DABB206E5C}.Release|x86.Build.0 = Release|x86 + {FF80D706-8309-4E02-BAC0-D28B4CBCF600}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FF80D706-8309-4E02-BAC0-D28B4CBCF600}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FF80D706-8309-4E02-BAC0-D28B4CBCF600}.Debug|x64.ActiveCfg = Debug|Any CPU + {FF80D706-8309-4E02-BAC0-D28B4CBCF600}.Debug|x64.Build.0 = Debug|Any CPU + {FF80D706-8309-4E02-BAC0-D28B4CBCF600}.Debug|x86.ActiveCfg = Debug|Any CPU + {FF80D706-8309-4E02-BAC0-D28B4CBCF600}.Debug|x86.Build.0 = Debug|Any CPU + {FF80D706-8309-4E02-BAC0-D28B4CBCF600}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FF80D706-8309-4E02-BAC0-D28B4CBCF600}.Release|Any CPU.Build.0 = Release|Any CPU + {FF80D706-8309-4E02-BAC0-D28B4CBCF600}.Release|x64.ActiveCfg = Release|Any CPU + {FF80D706-8309-4E02-BAC0-D28B4CBCF600}.Release|x64.Build.0 = Release|Any CPU + {FF80D706-8309-4E02-BAC0-D28B4CBCF600}.Release|x86.ActiveCfg = Release|Any CPU + {FF80D706-8309-4E02-BAC0-D28B4CBCF600}.Release|x86.Build.0 = Release|Any CPU + {CB6FA3C6-38E2-4DD1-AAB7-A705EFE114BC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CB6FA3C6-38E2-4DD1-AAB7-A705EFE114BC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CB6FA3C6-38E2-4DD1-AAB7-A705EFE114BC}.Debug|x64.ActiveCfg = Debug|x64 + {CB6FA3C6-38E2-4DD1-AAB7-A705EFE114BC}.Debug|x64.Build.0 = Debug|x64 + {CB6FA3C6-38E2-4DD1-AAB7-A705EFE114BC}.Debug|x86.ActiveCfg = Debug|x86 + {CB6FA3C6-38E2-4DD1-AAB7-A705EFE114BC}.Debug|x86.Build.0 = Debug|x86 + {CB6FA3C6-38E2-4DD1-AAB7-A705EFE114BC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {CB6FA3C6-38E2-4DD1-AAB7-A705EFE114BC}.Release|Any CPU.Build.0 = Release|Any CPU + {CB6FA3C6-38E2-4DD1-AAB7-A705EFE114BC}.Release|x64.ActiveCfg = Release|x64 + {CB6FA3C6-38E2-4DD1-AAB7-A705EFE114BC}.Release|x64.Build.0 = Release|x64 + {CB6FA3C6-38E2-4DD1-AAB7-A705EFE114BC}.Release|x86.ActiveCfg = Release|x86 + {CB6FA3C6-38E2-4DD1-AAB7-A705EFE114BC}.Release|x86.Build.0 = Release|x86 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -743,5 +771,7 @@ Global {0D85D957-6FF2-4620-B766-B708801D97F3} = {8DA7CBD9-F17E-41B6-90C4-CFF55848A25A} {9549C1A4-CB57-4689-B3EB-F752F65F863F} = {8DA7CBD9-F17E-41B6-90C4-CFF55848A25A} {0C6EFAF9-CE3E-4C11-8DD8-D7DABB206E5C} = {B27FAFDF-2DBA-4AB0-BA85-FD5F21D359D6} + {FF80D706-8309-4E02-BAC0-D28B4CBCF600} = {B27FAFDF-2DBA-4AB0-BA85-FD5F21D359D6} + {CB6FA3C6-38E2-4DD1-AAB7-A705EFE114BC} = {8DA7CBD9-F17E-41B6-90C4-CFF55848A25A} EndGlobalSection EndGlobal diff --git a/src/Microsoft.TestPlatform.Client/Execution/TestRunRequest.cs b/src/Microsoft.TestPlatform.Client/Execution/TestRunRequest.cs index 1704c1a66b..3a903b2802 100644 --- a/src/Microsoft.TestPlatform.Client/Execution/TestRunRequest.cs +++ b/src/Microsoft.TestPlatform.Client/Execution/TestRunRequest.cs @@ -15,6 +15,7 @@ namespace Microsoft.VisualStudio.TestPlatform.Client.Execution using Microsoft.VisualStudio.TestPlatform.Utilities; using ClientResources = Microsoft.VisualStudio.TestPlatform.Client.Resources.Resources; + using System.Collections.ObjectModel; public class TestRunRequest : ITestRunRequest, ITestRunEventsHandler { @@ -26,7 +27,7 @@ internal TestRunRequest(TestRunCriteria testRunCriteria, IProxyExecutionManager EqtTrace.Verbose("TestRunRequest.ExecuteAsync: Creating test run request."); this.testRunCriteria = testRunCriteria; this.ExecutionManager = executionManager; - + this.State = TestRunState.Pending; } @@ -39,7 +40,7 @@ internal TestRunRequest(TestRunCriteria testRunCriteria, IProxyExecutionManager public int ExecuteAsync() { EqtTrace.Verbose("TestRunRequest.ExecuteAsync: Starting."); - + lock (this.syncObject) { if (this.disposed) @@ -53,17 +54,17 @@ public int ExecuteAsync() } EqtTrace.Info("TestRunRequest.ExecuteAsync: Starting run with settings:{0}", this.testRunCriteria); - + // Waiting for warm up to be over. EqtTrace.Verbose("TestRunRequest.ExecuteAsync: Wait for the first run request is over."); - + this.State = TestRunState.InProgress; // Reset the run completion event // (This needs to be done before queuing the test run because if the test run finishes fast then runCompletion event can // remain in non-signaled state even though run is actually complete. this.runCompletionEvent.Reset(); - + try { this.runRequestTimeTracker = new Stopwatch(); @@ -72,7 +73,7 @@ public int ExecuteAsync() this.runRequestTimeTracker.Start(); int processId = this.ExecutionManager.StartTestRun(this.testRunCriteria, this); EqtTrace.Info("TestRunRequest.ExecuteAsync: Started."); - + return processId; } catch @@ -88,8 +89,8 @@ public int ExecuteAsync() /// public bool WaitForCompletion(int timeout) { - EqtTrace.Verbose("TestRunRequest.WaitForCompletion: Waiting with timeout {0}.", timeout); - + EqtTrace.Verbose("TestRunRequest.WaitForCompletion: Waiting with timeout {0}.", timeout); + if (this.disposed) { throw new ObjectDisposedException("testRunRequest"); @@ -122,7 +123,7 @@ public bool WaitForCompletion(int timeout) public void CancelAsync() { EqtTrace.Verbose("TestRunRequest.CancelAsync: Canceling."); - + lock (this.syncObject) { if (this.disposed) @@ -132,7 +133,7 @@ public void CancelAsync() if (this.State != TestRunState.InProgress) { - EqtTrace.Info("Ignoring TestRunRequest.CancelAsync(). No test run in progress."); + EqtTrace.Info("Ignoring TestRunRequest.CancelAsync(). No test run in progress."); } else { @@ -170,7 +171,7 @@ public void Abort() EqtTrace.Info("TestRunRequest.Abort: Aborted."); } - + /// /// Specifies the test run criteria @@ -194,13 +195,13 @@ public ITestRunConfiguration TestRunConfiguration /// Raised when the test message is received. /// public event EventHandler TestRunMessage; - + /// /// Raised when the test run completes. /// public event EventHandler OnRunCompletion; - + /// /// Raised when data collection message is received. @@ -291,7 +292,7 @@ public void HandleTestRunComplete(TestRunCompleteEventArgs runCompleteArgs, Test runCompleteArgs.IsCanceled, runCompleteArgs.IsAborted, runCompleteArgs.Error, - null, + runContextAttachments as Collection, this.runRequestTimeTracker.Elapsed); // Ignore the time sent (runCompleteArgs.ElapsedTimeInRunningTests) @@ -363,7 +364,6 @@ public virtual void HandleTestRunStatsChange(TestRunChangedEventArgs testRunChan EqtTrace.Info("TestRunRequest:SendTestRunStatsChange: Completed."); } } - /// /// Invoked when log messages are received @@ -410,7 +410,7 @@ public int LaunchProcessWithDebuggerAttached(TestProcessStartInfo testProcessSta { processId = this.testRunCriteria.TestHostLauncher.LaunchTestHost(testProcessStartInfo); } - + return processId; } @@ -459,7 +459,7 @@ protected virtual void Dispose(bool disposing) /// The run completion event which will be signalled on completion of test run. /// private ManualResetEvent runCompletionEvent = new ManualResetEvent(true); - + /// /// Tracks the time taken by each run request diff --git a/src/datacollector/DataCollectionAttachmentManager.cs b/src/Microsoft.TestPlatform.Common/DataCollection/DataCollectionAttachmentManager.cs similarity index 64% rename from src/datacollector/DataCollectionAttachmentManager.cs rename to src/Microsoft.TestPlatform.Common/DataCollection/DataCollectionAttachmentManager.cs index 7126c79815..2ea8b772cf 100644 --- a/src/datacollector/DataCollectionAttachmentManager.cs +++ b/src/Microsoft.TestPlatform.Common/DataCollection/DataCollectionAttachmentManager.cs @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -namespace Microsoft.VisualStudio.TestPlatform.DataCollector +namespace Microsoft.VisualStudio.TestPlatform.Common.DataCollector { using System; using System.Collections.Generic; @@ -10,9 +10,10 @@ namespace Microsoft.VisualStudio.TestPlatform.DataCollector using System.Globalization; using System.IO; using System.Linq; + using System.Threading; using System.Threading.Tasks; - using Microsoft.VisualStudio.TestPlatform.DataCollector.Interfaces; + using Microsoft.VisualStudio.TestPlatform.Common.DataCollector.Interfaces; using Microsoft.VisualStudio.TestPlatform.ObjectModel; using Microsoft.VisualStudio.TestPlatform.ObjectModel.DataCollection; using Microsoft.VisualStudio.TestPlatform.ObjectModel.Logging; @@ -39,6 +40,11 @@ internal class DataCollectionAttachmentManager : IDataCollectionAttachmentManage /// private List attachmentTasks; + /// + /// Use to cancel data collection if test run is cancelled. + /// + private CancellationTokenSource cancellationTokenSource; + #endregion #region Constructor @@ -48,6 +54,7 @@ internal class DataCollectionAttachmentManager : IDataCollectionAttachmentManage /// public DataCollectionAttachmentManager() { + this.cancellationTokenSource = new CancellationTokenSource(); this.attachmentTasks = new List(); this.AttachmentSets = new Dictionary(); } @@ -102,7 +109,15 @@ public void Initialize(SessionId id, string outputDirectory, IMessageSink messag /// public List GetAttachments(DataCollectionContext dataCollectionContext) { - Task.WhenAll(this.attachmentTasks.ToArray()).Wait(); + try + { + Task.WhenAll(this.attachmentTasks.ToArray()).Wait(); + } + catch (Exception ex) + { + EqtTrace.Error(ex.Message); + } + return this.AttachmentSets.Values.ToList(); } @@ -140,6 +155,12 @@ public void AddAttachment(FileTransferInformation fileTransferInfo, AsyncComplet } } + /// + public void Cancel() + { + this.cancellationTokenSource.Cancel(); + } + #endregion #region private methods @@ -207,80 +228,89 @@ private void AddNewFileTransfer(FileTransferInformation fileTransferInfo, AsyncC testCaseId); var localFilePath = Path.Combine(directoryPath, Path.GetFileName(fileTransferInfo.FileName)); - // todo : add cancellation token for cancelling file operations test run is cancelled or there is a crash. - var task = new Task(() => - { - Validate(fileTransferInfo, localFilePath); - - try - { - if (fileTransferInfo.PerformCleanup) - { - if (EqtTrace.IsInfoEnabled) - { - EqtTrace.Info("DataCollectionAttachmentManager.AddNewFileTransfer : Moving file {0} to {1}", fileTransferInfo.FileName, localFilePath); - } - - File.Move(fileTransferInfo.FileName, localFilePath); - - if (EqtTrace.IsInfoEnabled) - { - EqtTrace.Info("DataCollectionAttachmentManager.AddNewFileTransfer : Moved file {0} to {1}", fileTransferInfo.FileName, localFilePath); - } - } - else - { - if (EqtTrace.IsInfoEnabled) - { - EqtTrace.Info("DataCollectionAttachmentManager.AddNewFileTransfer : Copying file {0} to {1}", fileTransferInfo.FileName, localFilePath); - } - - File.Copy(fileTransferInfo.FileName, localFilePath); - - if (EqtTrace.IsInfoEnabled) - { - EqtTrace.Info("DataCollectionAttachmentManager.AddNewFileTransfer : Copied file {0} to {1}", fileTransferInfo.FileName, localFilePath); - } - } - } - catch (Exception ex) - { - this.LogError( - ex.Message, - uri, - friendlyName, - Guid.Parse(testCaseId)); - - throw; - } - }); - - var continuationTask = task.ContinueWith((t) => - { - try - { - if (t.Exception == null) - { - this.AttachmentSets[uri].Attachments.Add(new UriDataAttachment(new Uri(localFilePath), fileTransferInfo.Description)); - } - - sendFileCompletedCallback(this, new AsyncCompletedEventArgs(t.Exception, false, fileTransferInfo.UserToken)); - } - catch (Exception e) - { - if (EqtTrace.IsErrorEnabled) - { - EqtTrace.Error( - "DataCollectionAttachmentManager.TriggerCallBack: Error occurred while raising the file transfer completed callback for {0}. Error: {1}", - localFilePath, - e.ToString()); - } - } - }); - - this.attachmentTasks.Add(task); + var task = Task.Factory.StartNew( + () => + { + Validate(fileTransferInfo, localFilePath); + + if (this.cancellationTokenSource.Token.IsCancellationRequested) + { + this.cancellationTokenSource.Token.ThrowIfCancellationRequested(); + } + + try + { + if (fileTransferInfo.PerformCleanup) + { + if (EqtTrace.IsInfoEnabled) + { + EqtTrace.Info("DataCollectionAttachmentManager.AddNewFileTransfer : Moving file {0} to {1}", fileTransferInfo.FileName, localFilePath); + } + + File.Move(fileTransferInfo.FileName, localFilePath); + + if (EqtTrace.IsInfoEnabled) + { + EqtTrace.Info("DataCollectionAttachmentManager.AddNewFileTransfer : Moved file {0} to {1}", fileTransferInfo.FileName, localFilePath); + } + } + else + { + if (EqtTrace.IsInfoEnabled) + { + EqtTrace.Info("DataCollectionAttachmentManager.AddNewFileTransfer : Copying file {0} to {1}", fileTransferInfo.FileName, localFilePath); + } + + File.Copy(fileTransferInfo.FileName, localFilePath); + + if (EqtTrace.IsInfoEnabled) + { + EqtTrace.Info("DataCollectionAttachmentManager.AddNewFileTransfer : Copied file {0} to {1}", fileTransferInfo.FileName, localFilePath); + } + } + } + catch (Exception ex) + { + this.LogError( + ex.Message, + uri, + friendlyName, + Guid.Parse(testCaseId)); + + throw; + } + }, + this.cancellationTokenSource.Token); + + var continuationTask = task.ContinueWith( + (t) => + { + try + { + if (t.Exception == null) + { + this.AttachmentSets[uri].Attachments.Add(new UriDataAttachment(new Uri(localFilePath), fileTransferInfo.Description)); + } + + if (sendFileCompletedCallback != null) + { + sendFileCompletedCallback(this, new AsyncCompletedEventArgs(t.Exception, false, fileTransferInfo.UserToken)); + } + } + catch (Exception e) + { + if (EqtTrace.IsErrorEnabled) + { + EqtTrace.Error( + "DataCollectionAttachmentManager.TriggerCallBack: Error occurred while raising the file transfer completed callback for {0}. Error: {1}", + localFilePath, + e.ToString()); + } + } + }, + this.cancellationTokenSource.Token); + this.attachmentTasks.Add(continuationTask); - task.Start(); } /// diff --git a/src/datacollector/DataCollectionEnvironmentVariable.cs b/src/Microsoft.TestPlatform.Common/DataCollection/DataCollectionEnvironmentVariable.cs similarity index 98% rename from src/datacollector/DataCollectionEnvironmentVariable.cs rename to src/Microsoft.TestPlatform.Common/DataCollection/DataCollectionEnvironmentVariable.cs index 92cbde0a5b..309f5d95c9 100644 --- a/src/datacollector/DataCollectionEnvironmentVariable.cs +++ b/src/Microsoft.TestPlatform.Common/DataCollection/DataCollectionEnvironmentVariable.cs @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -namespace Microsoft.VisualStudio.TestPlatform.DataCollector +namespace Microsoft.VisualStudio.TestPlatform.Common.DataCollector { using System.Collections.Generic; diff --git a/src/datacollector/DataCollectionManager.cs b/src/Microsoft.TestPlatform.Common/DataCollection/DataCollectionManager.cs similarity index 97% rename from src/datacollector/DataCollectionManager.cs rename to src/Microsoft.TestPlatform.Common/DataCollection/DataCollectionManager.cs index 660bc284e2..ff7d1d2c05 100644 --- a/src/datacollector/DataCollectionManager.cs +++ b/src/Microsoft.TestPlatform.Common/DataCollection/DataCollectionManager.cs @@ -1,19 +1,16 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -namespace Microsoft.VisualStudio.TestPlatform.DataCollector +namespace Microsoft.VisualStudio.TestPlatform.Common.DataCollector { using System; using System.Collections.Generic; using System.Collections.ObjectModel; - using System.Diagnostics; using System.Globalization; - using System.IO; using System.Linq; - using System.Reflection; + using Microsoft.VisualStudio.TestPlatform.Common.DataCollector.Interfaces; using Microsoft.VisualStudio.TestPlatform.Common.Utilities; - using Microsoft.VisualStudio.TestPlatform.DataCollector.Interfaces; using Microsoft.VisualStudio.TestPlatform.ObjectModel; using Microsoft.VisualStudio.TestPlatform.ObjectModel.DataCollection; using Microsoft.VisualStudio.TestPlatform.ObjectModel.Logging; @@ -67,7 +64,10 @@ internal class DataCollectionManager : IDataCollectionManager /// /// Initializes a new instance of the class. /// - internal DataCollectionManager() : this(new DataCollectionAttachmentManager(), new MessageSink(), new DataCollectorLoader()) + /// + /// The message Sink. + /// + internal DataCollectionManager(IMessageSink messageSink) : this(new DataCollectionAttachmentManager(), messageSink, new DataCollectorLoader()) { } @@ -166,7 +166,7 @@ public void Dispose() } /// - public Collection SessionEnded() + public Collection SessionEnded(bool isCancelled = false) { // Return null if datacollection is not enabled. if (!this.isDataCollectionEnabled) @@ -174,6 +174,12 @@ public Collection SessionEnded() return new Collection(); } + if (isCancelled) + { + this.attachmentManager.Cancel(); + return new Collection(); + } + var endEvent = new SessionEndEventArgs(this.dataCollectionEnvironmentContext.SessionDataCollectionContext); this.SendEvent(endEvent); diff --git a/src/datacollector/DataCollectorConfig.cs b/src/Microsoft.TestPlatform.Common/DataCollection/DataCollectorConfig.cs similarity index 98% rename from src/datacollector/DataCollectorConfig.cs rename to src/Microsoft.TestPlatform.Common/DataCollection/DataCollectorConfig.cs index 6af3e824ff..309d75e177 100644 --- a/src/datacollector/DataCollectorConfig.cs +++ b/src/Microsoft.TestPlatform.Common/DataCollection/DataCollectorConfig.cs @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -namespace Microsoft.VisualStudio.TestPlatform.DataCollector +namespace Microsoft.VisualStudio.TestPlatform.Common.DataCollector { using System; using System.Diagnostics; @@ -10,7 +10,7 @@ namespace Microsoft.VisualStudio.TestPlatform.DataCollector using System.Reflection; using Microsoft.VisualStudio.TestPlatform.ObjectModel; - using Microsoft.VisualStudio.TestPlatform.ObjectModel.DataCollector; + using Microsoft.VisualStudio.TestPlatform.ObjectModel.DataCollection; /// /// The data collector config. diff --git a/src/datacollector/DataCollectorInformation.cs b/src/Microsoft.TestPlatform.Common/DataCollection/DataCollectorInformation.cs similarity index 97% rename from src/datacollector/DataCollectorInformation.cs rename to src/Microsoft.TestPlatform.Common/DataCollection/DataCollectorInformation.cs index b44bb2d039..5fe3f010c9 100644 --- a/src/datacollector/DataCollectorInformation.cs +++ b/src/Microsoft.TestPlatform.Common/DataCollection/DataCollectorInformation.cs @@ -1,13 +1,13 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -namespace Microsoft.VisualStudio.TestPlatform.DataCollector +namespace Microsoft.VisualStudio.TestPlatform.Common.DataCollector { using System; using System.Collections.Generic; using System.Xml; - using Microsoft.VisualStudio.TestPlatform.DataCollector.Interfaces; + using Microsoft.VisualStudio.TestPlatform.Common.DataCollector.Interfaces; using Microsoft.VisualStudio.TestPlatform.ObjectModel; using Microsoft.VisualStudio.TestPlatform.ObjectModel.DataCollection; using Microsoft.VisualStudio.TestPlatform.ObjectModel.DataCollector; diff --git a/src/datacollector/DataCollectorLoader.cs b/src/Microsoft.TestPlatform.Common/DataCollection/DataCollectorLoader.cs similarity index 76% rename from src/datacollector/DataCollectorLoader.cs rename to src/Microsoft.TestPlatform.Common/DataCollection/DataCollectorLoader.cs index 207a8829e1..0266c52782 100644 --- a/src/datacollector/DataCollectorLoader.cs +++ b/src/Microsoft.TestPlatform.Common/DataCollection/DataCollectorLoader.cs @@ -1,25 +1,24 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -namespace Microsoft.VisualStudio.TestPlatform.DataCollector +namespace Microsoft.VisualStudio.TestPlatform.Common.DataCollector { using System; using System.Reflection; #if !NET46 using System.Runtime.Loader; #endif - using Microsoft.VisualStudio.TestPlatform.DataCollector.Interfaces; + using Microsoft.VisualStudio.TestPlatform.Common.DataCollector.Interfaces; using Microsoft.VisualStudio.TestPlatform.ObjectModel; using Microsoft.VisualStudio.TestPlatform.ObjectModel.DataCollection; + using System.Linq; /// internal class DataCollectorLoader : IDataCollectorLoader { /// - public DataCollector Load(string location, - string assemblyQualifiedName) + public DataCollector Load(string location, string assemblyQualifiedName) { - var dataCollectorType = Type.GetType(assemblyQualifiedName); DataCollector dataCollectorInstance = null; Assembly assembly = null; @@ -30,6 +29,7 @@ public DataCollector Load(string location, #else assembly = AssemblyLoadContext.Default.LoadFromAssemblyPath(location); #endif + var dataCollectorType = assembly.GetTypes().Where(t => t.AssemblyQualifiedName.Equals(assemblyQualifiedName)).FirstOrDefault(); dataCollectorInstance = Activator.CreateInstance(dataCollectorType) as DataCollector; } catch (Exception ex) diff --git a/src/datacollector/Interfaces/IDataCollectionAttachmentManager.cs b/src/Microsoft.TestPlatform.Common/DataCollection/Interfaces/IDataCollectionAttachmentManager.cs similarity index 82% rename from src/datacollector/Interfaces/IDataCollectionAttachmentManager.cs rename to src/Microsoft.TestPlatform.Common/DataCollection/Interfaces/IDataCollectionAttachmentManager.cs index e24f60ba65..64bc10f69b 100644 --- a/src/datacollector/Interfaces/IDataCollectionAttachmentManager.cs +++ b/src/Microsoft.TestPlatform.Common/DataCollection/Interfaces/IDataCollectionAttachmentManager.cs @@ -1,6 +1,7 @@ - +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. -namespace Microsoft.VisualStudio.TestPlatform.DataCollector.Interfaces +namespace Microsoft.VisualStudio.TestPlatform.Common.DataCollector.Interfaces { using System; using System.Collections.Generic; @@ -55,5 +56,10 @@ internal interface IDataCollectionAttachmentManager /// The friendly Name. /// void AddAttachment(FileTransferInformation fileTransferInfo, AsyncCompletedEventHandler sendFileCompletedCallback, Uri typeUri, string friendlyName); + + /// + /// Stops processing further transfer requests as test run is cancelled. + /// + void Cancel(); } } \ No newline at end of file diff --git a/src/datacollector/Interfaces/IDataCollectionManager.cs b/src/Microsoft.TestPlatform.Common/DataCollection/Interfaces/IDataCollectionManager.cs similarity index 84% rename from src/datacollector/Interfaces/IDataCollectionManager.cs rename to src/Microsoft.TestPlatform.Common/DataCollection/Interfaces/IDataCollectionManager.cs index 47e8fc6d7e..bb95cddb71 100644 --- a/src/datacollector/Interfaces/IDataCollectionManager.cs +++ b/src/Microsoft.TestPlatform.Common/DataCollection/Interfaces/IDataCollectionManager.cs @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -namespace Microsoft.VisualStudio.TestPlatform.DataCollector.Interfaces +namespace Microsoft.VisualStudio.TestPlatform.Common.DataCollector.Interfaces { using System; using System.Collections.Generic; @@ -45,7 +45,12 @@ internal interface IDataCollectionManager : IDisposable /// /// Raises SessionEnd event to all data collectors configured for run. /// - /// Collection of session attachmentSet. - Collection SessionEnded(); + /// + /// Boolean to specify is the test ruun is cancelled or not. + /// + /// + /// Collection of session attachmentSet. + /// + Collection SessionEnded(bool isCancelled); } } \ No newline at end of file diff --git a/src/datacollector/Interfaces/IDataCollectorLoader.cs b/src/Microsoft.TestPlatform.Common/DataCollection/Interfaces/IDataCollectorLoader.cs similarity index 92% rename from src/datacollector/Interfaces/IDataCollectorLoader.cs rename to src/Microsoft.TestPlatform.Common/DataCollection/Interfaces/IDataCollectorLoader.cs index 0040750cf0..e310f0bfbd 100644 --- a/src/datacollector/Interfaces/IDataCollectorLoader.cs +++ b/src/Microsoft.TestPlatform.Common/DataCollection/Interfaces/IDataCollectorLoader.cs @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -namespace Microsoft.VisualStudio.TestPlatform.DataCollector.Interfaces +namespace Microsoft.VisualStudio.TestPlatform.Common.DataCollector.Interfaces { using Microsoft.VisualStudio.TestPlatform.ObjectModel.DataCollection; diff --git a/src/datacollector/Interfaces/IMessageSink.cs b/src/Microsoft.TestPlatform.Common/DataCollection/Interfaces/IMessageSink.cs similarity index 89% rename from src/datacollector/Interfaces/IMessageSink.cs rename to src/Microsoft.TestPlatform.Common/DataCollection/Interfaces/IMessageSink.cs index 56c6ab703b..b5b6e492a9 100644 --- a/src/datacollector/Interfaces/IMessageSink.cs +++ b/src/Microsoft.TestPlatform.Common/DataCollection/Interfaces/IMessageSink.cs @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -namespace Microsoft.VisualStudio.TestPlatform.DataCollector.Interfaces +namespace Microsoft.VisualStudio.TestPlatform.Common.DataCollector.Interfaces { using Microsoft.VisualStudio.TestPlatform.ObjectModel.Logging; diff --git a/src/datacollector/TestPlatformDataCollectionEvents.cs b/src/Microsoft.TestPlatform.Common/DataCollection/TestPlatformDataCollectionEvents.cs similarity index 98% rename from src/datacollector/TestPlatformDataCollectionEvents.cs rename to src/Microsoft.TestPlatform.Common/DataCollection/TestPlatformDataCollectionEvents.cs index d111418d12..0f25ef5ba0 100644 --- a/src/datacollector/TestPlatformDataCollectionEvents.cs +++ b/src/Microsoft.TestPlatform.Common/DataCollection/TestPlatformDataCollectionEvents.cs @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -namespace Microsoft.VisualStudio.TestPlatform.DataCollector +namespace Microsoft.VisualStudio.TestPlatform.Common.DataCollector { using System; using System.Collections.Generic; diff --git a/src/datacollector/TestPlatformDataCollectionLogger.cs b/src/Microsoft.TestPlatform.Common/DataCollection/TestPlatformDataCollectionLogger.cs similarity index 97% rename from src/datacollector/TestPlatformDataCollectionLogger.cs rename to src/Microsoft.TestPlatform.Common/DataCollection/TestPlatformDataCollectionLogger.cs index 7c9ccd755f..c86d9ed87c 100644 --- a/src/datacollector/TestPlatformDataCollectionLogger.cs +++ b/src/Microsoft.TestPlatform.Common/DataCollection/TestPlatformDataCollectionLogger.cs @@ -1,13 +1,13 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -namespace Microsoft.VisualStudio.TestPlatform.DataCollector +namespace Microsoft.VisualStudio.TestPlatform.Common.DataCollector { using System; using System.Diagnostics; using System.Globalization; - using Microsoft.VisualStudio.TestPlatform.DataCollector.Interfaces; + using Microsoft.VisualStudio.TestPlatform.Common.DataCollector.Interfaces; using Microsoft.VisualStudio.TestPlatform.ObjectModel; using Microsoft.VisualStudio.TestPlatform.ObjectModel.DataCollection; using Microsoft.VisualStudio.TestPlatform.ObjectModel.Logging; diff --git a/src/datacollector/TestPlatformDataCollectionSink.cs b/src/Microsoft.TestPlatform.Common/DataCollection/TestPlatformDataCollectionSink.cs similarity index 94% rename from src/datacollector/TestPlatformDataCollectionSink.cs rename to src/Microsoft.TestPlatform.Common/DataCollection/TestPlatformDataCollectionSink.cs index 023b4c88ed..dea3529ccf 100644 --- a/src/datacollector/TestPlatformDataCollectionSink.cs +++ b/src/Microsoft.TestPlatform.Common/DataCollection/TestPlatformDataCollectionSink.cs @@ -1,12 +1,12 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -namespace Microsoft.VisualStudio.TestPlatform.DataCollector +namespace Microsoft.VisualStudio.TestPlatform.Common.DataCollector { using System.ComponentModel; using System.Diagnostics; - using Microsoft.VisualStudio.TestPlatform.DataCollector.Interfaces; + using Microsoft.VisualStudio.TestPlatform.Common.DataCollector.Interfaces; using Microsoft.VisualStudio.TestPlatform.ObjectModel; using Microsoft.VisualStudio.TestPlatform.ObjectModel.DataCollection; diff --git a/src/Microsoft.TestPlatform.Common/Friends.cs b/src/Microsoft.TestPlatform.Common/Friends.cs index 1335438e0c..316c23e6b8 100644 --- a/src/Microsoft.TestPlatform.Common/Friends.cs +++ b/src/Microsoft.TestPlatform.Common/Friends.cs @@ -6,6 +6,8 @@ #region Product Assemblies [assembly: InternalsVisibleTo("Microsoft.TestPlatform.CrossPlatEngine, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")] [assembly: InternalsVisibleTo("vstest.console, PublicKey =002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")] +[assembly: InternalsVisibleTo("datacollector, PublicKey =002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")] +[assembly: InternalsVisibleTo("Microsoft.TestPlatform.CommunicationUtilities, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")] #endregion #region Test Assemblies @@ -13,4 +15,7 @@ [assembly: InternalsVisibleTo("Microsoft.TestPlatform.CrossPlatEngine.UnitTests, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")] [assembly: InternalsVisibleTo("vstest.console.UnitTests, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")] [assembly: InternalsVisibleTo("Microsoft.TestPlatform.Extensions.TrxLogger.UnitTests, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")] +[assembly: InternalsVisibleTo("datacollector.UnitTests, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")] +[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7")] + #endregion \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.Common/Resources/Resources.Designer.cs b/src/Microsoft.TestPlatform.Common/Resources/Resources.Designer.cs index e25d14267a..7b7fe7a30a 100644 --- a/src/Microsoft.TestPlatform.Common/Resources/Resources.Designer.cs +++ b/src/Microsoft.TestPlatform.Common/Resources/Resources.Designer.cs @@ -61,6 +61,15 @@ internal Resources() { } } + /// + /// Looks up a localized string similar to An error occurred while retrieving the attributes for the diagnostic data adapter of type '{0}'.. + /// + internal static string AttributeRetrievalError { + get { + return ResourceManager.GetString("AttributeRetrievalError", resourceCulture); + } + } + /// /// Looks up a localized string similar to Diagnostic data adapter message: {0}. /// @@ -70,6 +79,42 @@ internal static string DataCollectionMessageFormat { } } + /// + /// Looks up a localized string similar to Diagnostic data adapter type URI cannot be null or empty. The type URI for the diagnostic data adapter of type '{0}' is null or empty.. + /// + internal static string DataCollector_TypeIsNull { + get { + return ResourceManager.GetString("DataCollector_TypeIsNull", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Could not find diagnostic data adapter '{0}'. Make sure diagnostic data adapter is installed and try again.. + /// + internal static string DataCollectorAssemblyNotFound { + get { + return ResourceManager.GetString("DataCollectorAssemblyNotFound", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Diagnostic data adapter '{0}' failed to provide intialization information. Error: {1}. + /// + internal static string DataCollectorErrorOnGetVariable { + get { + return ResourceManager.GetString("DataCollectorErrorOnGetVariable", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The diagnostic data adapter '{0}' threw an exception during type loading, construction, or initialization: {1}.. + /// + internal static string DataCollectorInitializationError { + get { + return ResourceManager.GetString("DataCollectorInitializationError", resourceCulture); + } + } + /// /// Looks up a localized string similar to Diagnostic data adapter ('{0}') message: {1}.. /// @@ -79,6 +124,60 @@ internal static string DataCollectorMessageFormat { } } + /// + /// Looks up a localized string similar to Could not find diagnostic data adapter of type '{0}' and Uri '{1}'. + /// + internal static string DataCollectorNotFound { + get { + return ResourceManager.GetString("DataCollectorNotFound", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The diagnostic data adapter '{0}' requested environment variable '{1}' with value '{2}' to be set in test execution environment, but another diagnostic data adapter '{3}' has already requested same environment variable with different value '{4}'.. + /// + internal static string DataCollectorRequestedDuplicateEnvironmentVariable { + get { + return ResourceManager.GetString("DataCollectorRequestedDuplicateEnvironmentVariable", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The required diagnostic data adapter attribute '{0}' is missing for the diagnostic data adapter of type '{1}'.. + /// + internal static string DataCollectorRequiredAttributeMissing { + get { + return ResourceManager.GetString("DataCollectorRequiredAttributeMissing", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Failed to get type for diagnostic data adapter '{0}'. Error: {1}.. + /// + internal static string DataCollectorTypeNotFound { + get { + return ResourceManager.GetString("DataCollectorTypeNotFound", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Invalid URI format. The URI '{0}' provided for the diagnostic data adapter of type '{1}' is not a valid URI.. + /// + internal static string DataCollectorTypeUriFormatInvalid { + get { + return ResourceManager.GetString("DataCollectorTypeUriFormatInvalid", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Sending message of Message Type '{0}' is not supported.. + /// + internal static string DataCollectorUnsupportedMessageType { + get { + return ResourceManager.GetString("DataCollectorUnsupportedMessageType", resourceCulture); + } + } + /// /// Looks up a localized string similar to Duplicate test extension URI '{0}'. Ignoring the duplicate extension.. /// @@ -115,6 +214,24 @@ internal static string EmptyParenthesis { } } + /// + /// Looks up a localized string similar to Diagnostic data adapter friendly names cannot be null or empty. The friendly name for the diagnostic data adapter of type '{0}' is null or empty.. + /// + internal static string FriendlyNameIsNullOrEmpty { + get { + return ResourceManager.GetString("FriendlyNameIsNullOrEmpty", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to There are multiple configurations that have diagnostic data adapter type '{0}' or Uri '{1}'. Duplicate configurations will be ignored in the test run.. + /// + internal static string IgnoredDuplicateConfiguration { + get { + return ResourceManager.GetString("IgnoredDuplicateConfiguration", resourceCulture); + } + } + /// /// Looks up a localized string similar to Error: Invalid Condition '{0}'. /// @@ -196,6 +313,15 @@ internal static string MissingOperator { } } + /// + /// Looks up a localized string similar to Diagnostic data adapter caught an exception of type '{0}': '{1}'. More details: {2}.. + /// + internal static string ReportDataCollectorException { + get { + return ResourceManager.GetString("ReportDataCollectorException", resourceCulture); + } + } + /// /// Looks up a localized string similar to The Run Settings have already been loaded.. /// @@ -249,5 +375,14 @@ internal static string TestCaseFilterFormatException { return ResourceManager.GetString("TestCaseFilterFormatException", resourceCulture); } } + + /// + /// Looks up a localized string similar to Types deriving from the data collection context cannot be used for sending data and messages. The DataCollectionContext used for sending data and messages must come from one of the events raised to the data collector.. + /// + internal static string WrongDataCollectionContextType { + get { + return ResourceManager.GetString("WrongDataCollectionContextType", resourceCulture); + } + } } } diff --git a/src/Microsoft.TestPlatform.Common/Resources/Resources.resx b/src/Microsoft.TestPlatform.Common/Resources/Resources.resx index fff7c2610d..ae3101168c 100644 --- a/src/Microsoft.TestPlatform.Common/Resources/Resources.resx +++ b/src/Microsoft.TestPlatform.Common/Resources/Resources.resx @@ -117,12 +117,45 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + An error occurred while retrieving the attributes for the diagnostic data adapter of type '{0}'. + Diagnostic data adapter message: {0} + + Could not find diagnostic data adapter '{0}'. Make sure diagnostic data adapter is installed and try again. + + + Diagnostic data adapter '{0}' failed to provide intialization information. Error: {1} + + + The diagnostic data adapter '{0}' threw an exception during type loading, construction, or initialization: {1}. + Diagnostic data adapter ('{0}') message: {1}. + + Could not find diagnostic data adapter of type '{0}' and Uri '{1}' + + + The diagnostic data adapter '{0}' requested environment variable '{1}' with value '{2}' to be set in test execution environment, but another diagnostic data adapter '{3}' has already requested same environment variable with different value '{4}'. + + + The required diagnostic data adapter attribute '{0}' is missing for the diagnostic data adapter of type '{1}'. + + + Failed to get type for diagnostic data adapter '{0}'. Error: {1}. + + + Invalid URI format. The URI '{0}' provided for the diagnostic data adapter of type '{1}' is not a valid URI. + + + Sending message of Message Type '{0}' is not supported. + + + Diagnostic data adapter type URI cannot be null or empty. The type URI for the diagnostic data adapter of type '{0}' is null or empty. + Duplicate test extension URI '{0}'. Ignoring the duplicate extension. @@ -135,6 +168,12 @@ Error: Empty parenthesis ( ) + + Diagnostic data adapter friendly names cannot be null or empty. The friendly name for the diagnostic data adapter of type '{0}' is null or empty. + + + There are multiple configurations that have diagnostic data adapter type '{0}' or Uri '{1}'. Duplicate configurations will be ignored in the test run. + Error: Invalid Condition '{0}' @@ -162,6 +201,9 @@ Missing Operator '|' or '&' + + Diagnostic data adapter caught an exception of type '{0}': '{1}'. More details: {2}. + The Run Settings have already been loaded. @@ -180,4 +222,7 @@ Incorrect format for TestCaseFilter {0}. Specify the correct format and try again. Note that the incorrect format can lead to no test getting executed. + + Types deriving from the data collection context cannot be used for sending data and messages. The DataCollectionContext used for sending data and messages must come from one of the events raised to the data collector. + \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.cs.xlf b/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.cs.xlf index a6678ad27f..a529508c40 100644 --- a/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.cs.xlf +++ b/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.cs.xlf @@ -209,6 +209,81 @@ fuzzyMatch="15" wordcount="24" adjWordcount="20.4" curWordcount="20.4" + + An error occurred while retrieving the attributes for the diagnostic data adapter of type '{0}'. + An error occurred while retrieving the attributes for the diagnostic data adapter of type '{0}'. + + + + Could not find diagnostic data adapter '{0}'. Make sure diagnostic data adapter is installed and try again. + Could not find diagnostic data adapter '{0}'. Make sure diagnostic data adapter is installed and try again. + + + + Diagnostic data adapter '{0}' failed to provide intialization information. Error: {1} + Diagnostic data adapter '{0}' failed to provide intialization information. Error: {1} + + + + The diagnostic data adapter '{0}' threw an exception during type loading, construction, or initialization: {1}. + The diagnostic data adapter '{0}' threw an exception during type loading, construction, or initialization: {1}. + + + + Could not find diagnostic data adapter of type '{0}' and Uri '{1}' + Could not find diagnostic data adapter of type '{0}' and Uri '{1}' + + + + The diagnostic data adapter '{0}' requested environment variable '{1}' with value '{2}' to be set in test execution environment, but another diagnostic data adapter '{3}' has already requested same environment variable with different value '{4}'. + The diagnostic data adapter '{0}' requested environment variable '{1}' with value '{2}' to be set in test execution environment, but another diagnostic data adapter '{3}' has already requested same environment variable with different value '{4}'. + + + + The required diagnostic data adapter attribute '{0}' is missing for the diagnostic data adapter of type '{1}'. + The required diagnostic data adapter attribute '{0}' is missing for the diagnostic data adapter of type '{1}'. + + + + Failed to get type for diagnostic data adapter '{0}'. Error: {1}. + Failed to get type for diagnostic data adapter '{0}'. Error: {1}. + + + + Invalid URI format. The URI '{0}' provided for the diagnostic data adapter of type '{1}' is not a valid URI. + Invalid URI format. The URI '{0}' provided for the diagnostic data adapter of type '{1}' is not a valid URI. + + + + Sending message of Message Type '{0}' is not supported. + Sending message of Message Type '{0}' is not supported. + + + + Diagnostic data adapter type URI cannot be null or empty. The type URI for the diagnostic data adapter of type '{0}' is null or empty. + Diagnostic data adapter type URI cannot be null or empty. The type URI for the diagnostic data adapter of type '{0}' is null or empty. + + + + Diagnostic data adapter friendly names cannot be null or empty. The friendly name for the diagnostic data adapter of type '{0}' is null or empty. + Diagnostic data adapter friendly names cannot be null or empty. The friendly name for the diagnostic data adapter of type '{0}' is null or empty. + + + + There are multiple configurations that have diagnostic data adapter type '{0}' or Uri '{1}'. Duplicate configurations will be ignored in the test run. + There are multiple configurations that have diagnostic data adapter type '{0}' or Uri '{1}'. Duplicate configurations will be ignored in the test run. + + + + Diagnostic data adapter caught an exception of type '{0}': '{1}'. More details: {2}. + Diagnostic data adapter caught an exception of type '{0}': '{1}'. More details: {2}. + + + + Types deriving from the data collection context cannot be used for sending data and messages. The DataCollectionContext used for sending data and messages must come from one of the events raised to the data collector. + Types deriving from the data collection context cannot be used for sending data and messages. The DataCollectionContext used for sending data and messages must come from one of the events raised to the data collector. + + \ 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 bb96d54e30..438e978ae0 100644 --- a/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.de.xlf +++ b/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.de.xlf @@ -209,6 +209,81 @@ fuzzyMatch="15" wordcount="24" adjWordcount="20.4" curWordcount="20.4" + + An error occurred while retrieving the attributes for the diagnostic data adapter of type '{0}'. + An error occurred while retrieving the attributes for the diagnostic data adapter of type '{0}'. + + + + Could not find diagnostic data adapter '{0}'. Make sure diagnostic data adapter is installed and try again. + Could not find diagnostic data adapter '{0}'. Make sure diagnostic data adapter is installed and try again. + + + + Diagnostic data adapter '{0}' failed to provide intialization information. Error: {1} + Diagnostic data adapter '{0}' failed to provide intialization information. Error: {1} + + + + The diagnostic data adapter '{0}' threw an exception during type loading, construction, or initialization: {1}. + The diagnostic data adapter '{0}' threw an exception during type loading, construction, or initialization: {1}. + + + + Could not find diagnostic data adapter of type '{0}' and Uri '{1}' + Could not find diagnostic data adapter of type '{0}' and Uri '{1}' + + + + The diagnostic data adapter '{0}' requested environment variable '{1}' with value '{2}' to be set in test execution environment, but another diagnostic data adapter '{3}' has already requested same environment variable with different value '{4}'. + The diagnostic data adapter '{0}' requested environment variable '{1}' with value '{2}' to be set in test execution environment, but another diagnostic data adapter '{3}' has already requested same environment variable with different value '{4}'. + + + + The required diagnostic data adapter attribute '{0}' is missing for the diagnostic data adapter of type '{1}'. + The required diagnostic data adapter attribute '{0}' is missing for the diagnostic data adapter of type '{1}'. + + + + Failed to get type for diagnostic data adapter '{0}'. Error: {1}. + Failed to get type for diagnostic data adapter '{0}'. Error: {1}. + + + + Invalid URI format. The URI '{0}' provided for the diagnostic data adapter of type '{1}' is not a valid URI. + Invalid URI format. The URI '{0}' provided for the diagnostic data adapter of type '{1}' is not a valid URI. + + + + Sending message of Message Type '{0}' is not supported. + Sending message of Message Type '{0}' is not supported. + + + + Diagnostic data adapter type URI cannot be null or empty. The type URI for the diagnostic data adapter of type '{0}' is null or empty. + Diagnostic data adapter type URI cannot be null or empty. The type URI for the diagnostic data adapter of type '{0}' is null or empty. + + + + Diagnostic data adapter friendly names cannot be null or empty. The friendly name for the diagnostic data adapter of type '{0}' is null or empty. + Diagnostic data adapter friendly names cannot be null or empty. The friendly name for the diagnostic data adapter of type '{0}' is null or empty. + + + + There are multiple configurations that have diagnostic data adapter type '{0}' or Uri '{1}'. Duplicate configurations will be ignored in the test run. + There are multiple configurations that have diagnostic data adapter type '{0}' or Uri '{1}'. Duplicate configurations will be ignored in the test run. + + + + Diagnostic data adapter caught an exception of type '{0}': '{1}'. More details: {2}. + Diagnostic data adapter caught an exception of type '{0}': '{1}'. More details: {2}. + + + + Types deriving from the data collection context cannot be used for sending data and messages. The DataCollectionContext used for sending data and messages must come from one of the events raised to the data collector. + Types deriving from the data collection context cannot be used for sending data and messages. The DataCollectionContext used for sending data and messages must come from one of the events raised to the data collector. + + \ 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 165e319bf8..a0108bd322 100644 --- a/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.es.xlf +++ b/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.es.xlf @@ -209,6 +209,81 @@ fuzzyMatch="15" wordcount="24" adjWordcount="20.4" curWordcount="20.4" + + An error occurred while retrieving the attributes for the diagnostic data adapter of type '{0}'. + An error occurred while retrieving the attributes for the diagnostic data adapter of type '{0}'. + + + + Could not find diagnostic data adapter '{0}'. Make sure diagnostic data adapter is installed and try again. + Could not find diagnostic data adapter '{0}'. Make sure diagnostic data adapter is installed and try again. + + + + Diagnostic data adapter '{0}' failed to provide intialization information. Error: {1} + Diagnostic data adapter '{0}' failed to provide intialization information. Error: {1} + + + + The diagnostic data adapter '{0}' threw an exception during type loading, construction, or initialization: {1}. + The diagnostic data adapter '{0}' threw an exception during type loading, construction, or initialization: {1}. + + + + Could not find diagnostic data adapter of type '{0}' and Uri '{1}' + Could not find diagnostic data adapter of type '{0}' and Uri '{1}' + + + + The diagnostic data adapter '{0}' requested environment variable '{1}' with value '{2}' to be set in test execution environment, but another diagnostic data adapter '{3}' has already requested same environment variable with different value '{4}'. + The diagnostic data adapter '{0}' requested environment variable '{1}' with value '{2}' to be set in test execution environment, but another diagnostic data adapter '{3}' has already requested same environment variable with different value '{4}'. + + + + The required diagnostic data adapter attribute '{0}' is missing for the diagnostic data adapter of type '{1}'. + The required diagnostic data adapter attribute '{0}' is missing for the diagnostic data adapter of type '{1}'. + + + + Failed to get type for diagnostic data adapter '{0}'. Error: {1}. + Failed to get type for diagnostic data adapter '{0}'. Error: {1}. + + + + Invalid URI format. The URI '{0}' provided for the diagnostic data adapter of type '{1}' is not a valid URI. + Invalid URI format. The URI '{0}' provided for the diagnostic data adapter of type '{1}' is not a valid URI. + + + + Sending message of Message Type '{0}' is not supported. + Sending message of Message Type '{0}' is not supported. + + + + Diagnostic data adapter type URI cannot be null or empty. The type URI for the diagnostic data adapter of type '{0}' is null or empty. + Diagnostic data adapter type URI cannot be null or empty. The type URI for the diagnostic data adapter of type '{0}' is null or empty. + + + + Diagnostic data adapter friendly names cannot be null or empty. The friendly name for the diagnostic data adapter of type '{0}' is null or empty. + Diagnostic data adapter friendly names cannot be null or empty. The friendly name for the diagnostic data adapter of type '{0}' is null or empty. + + + + There are multiple configurations that have diagnostic data adapter type '{0}' or Uri '{1}'. Duplicate configurations will be ignored in the test run. + There are multiple configurations that have diagnostic data adapter type '{0}' or Uri '{1}'. Duplicate configurations will be ignored in the test run. + + + + Diagnostic data adapter caught an exception of type '{0}': '{1}'. More details: {2}. + Diagnostic data adapter caught an exception of type '{0}': '{1}'. More details: {2}. + + + + Types deriving from the data collection context cannot be used for sending data and messages. The DataCollectionContext used for sending data and messages must come from one of the events raised to the data collector. + Types deriving from the data collection context cannot be used for sending data and messages. The DataCollectionContext used for sending data and messages must come from one of the events raised to the data collector. + + \ 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 5fc0a7c60d..8f1e213f22 100644 --- a/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.fr.xlf +++ b/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.fr.xlf @@ -209,6 +209,81 @@ fuzzyMatch="15" wordcount="24" adjWordcount="20.4" curWordcount="20.4" + + An error occurred while retrieving the attributes for the diagnostic data adapter of type '{0}'. + An error occurred while retrieving the attributes for the diagnostic data adapter of type '{0}'. + + + + Could not find diagnostic data adapter '{0}'. Make sure diagnostic data adapter is installed and try again. + Could not find diagnostic data adapter '{0}'. Make sure diagnostic data adapter is installed and try again. + + + + Diagnostic data adapter '{0}' failed to provide intialization information. Error: {1} + Diagnostic data adapter '{0}' failed to provide intialization information. Error: {1} + + + + The diagnostic data adapter '{0}' threw an exception during type loading, construction, or initialization: {1}. + The diagnostic data adapter '{0}' threw an exception during type loading, construction, or initialization: {1}. + + + + Could not find diagnostic data adapter of type '{0}' and Uri '{1}' + Could not find diagnostic data adapter of type '{0}' and Uri '{1}' + + + + The diagnostic data adapter '{0}' requested environment variable '{1}' with value '{2}' to be set in test execution environment, but another diagnostic data adapter '{3}' has already requested same environment variable with different value '{4}'. + The diagnostic data adapter '{0}' requested environment variable '{1}' with value '{2}' to be set in test execution environment, but another diagnostic data adapter '{3}' has already requested same environment variable with different value '{4}'. + + + + The required diagnostic data adapter attribute '{0}' is missing for the diagnostic data adapter of type '{1}'. + The required diagnostic data adapter attribute '{0}' is missing for the diagnostic data adapter of type '{1}'. + + + + Failed to get type for diagnostic data adapter '{0}'. Error: {1}. + Failed to get type for diagnostic data adapter '{0}'. Error: {1}. + + + + Invalid URI format. The URI '{0}' provided for the diagnostic data adapter of type '{1}' is not a valid URI. + Invalid URI format. The URI '{0}' provided for the diagnostic data adapter of type '{1}' is not a valid URI. + + + + Sending message of Message Type '{0}' is not supported. + Sending message of Message Type '{0}' is not supported. + + + + Diagnostic data adapter type URI cannot be null or empty. The type URI for the diagnostic data adapter of type '{0}' is null or empty. + Diagnostic data adapter type URI cannot be null or empty. The type URI for the diagnostic data adapter of type '{0}' is null or empty. + + + + Diagnostic data adapter friendly names cannot be null or empty. The friendly name for the diagnostic data adapter of type '{0}' is null or empty. + Diagnostic data adapter friendly names cannot be null or empty. The friendly name for the diagnostic data adapter of type '{0}' is null or empty. + + + + There are multiple configurations that have diagnostic data adapter type '{0}' or Uri '{1}'. Duplicate configurations will be ignored in the test run. + There are multiple configurations that have diagnostic data adapter type '{0}' or Uri '{1}'. Duplicate configurations will be ignored in the test run. + + + + Diagnostic data adapter caught an exception of type '{0}': '{1}'. More details: {2}. + Diagnostic data adapter caught an exception of type '{0}': '{1}'. More details: {2}. + + + + Types deriving from the data collection context cannot be used for sending data and messages. The DataCollectionContext used for sending data and messages must come from one of the events raised to the data collector. + Types deriving from the data collection context cannot be used for sending data and messages. The DataCollectionContext used for sending data and messages must come from one of the events raised to the data collector. + + \ 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 e145ca20d2..1395da7c27 100644 --- a/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.it.xlf +++ b/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.it.xlf @@ -209,6 +209,81 @@ fuzzyMatch="15" wordcount="24" adjWordcount="20.4" curWordcount="20.4" + + An error occurred while retrieving the attributes for the diagnostic data adapter of type '{0}'. + An error occurred while retrieving the attributes for the diagnostic data adapter of type '{0}'. + + + + Could not find diagnostic data adapter '{0}'. Make sure diagnostic data adapter is installed and try again. + Could not find diagnostic data adapter '{0}'. Make sure diagnostic data adapter is installed and try again. + + + + Diagnostic data adapter '{0}' failed to provide intialization information. Error: {1} + Diagnostic data adapter '{0}' failed to provide intialization information. Error: {1} + + + + The diagnostic data adapter '{0}' threw an exception during type loading, construction, or initialization: {1}. + The diagnostic data adapter '{0}' threw an exception during type loading, construction, or initialization: {1}. + + + + Could not find diagnostic data adapter of type '{0}' and Uri '{1}' + Could not find diagnostic data adapter of type '{0}' and Uri '{1}' + + + + The diagnostic data adapter '{0}' requested environment variable '{1}' with value '{2}' to be set in test execution environment, but another diagnostic data adapter '{3}' has already requested same environment variable with different value '{4}'. + The diagnostic data adapter '{0}' requested environment variable '{1}' with value '{2}' to be set in test execution environment, but another diagnostic data adapter '{3}' has already requested same environment variable with different value '{4}'. + + + + The required diagnostic data adapter attribute '{0}' is missing for the diagnostic data adapter of type '{1}'. + The required diagnostic data adapter attribute '{0}' is missing for the diagnostic data adapter of type '{1}'. + + + + Failed to get type for diagnostic data adapter '{0}'. Error: {1}. + Failed to get type for diagnostic data adapter '{0}'. Error: {1}. + + + + Invalid URI format. The URI '{0}' provided for the diagnostic data adapter of type '{1}' is not a valid URI. + Invalid URI format. The URI '{0}' provided for the diagnostic data adapter of type '{1}' is not a valid URI. + + + + Sending message of Message Type '{0}' is not supported. + Sending message of Message Type '{0}' is not supported. + + + + Diagnostic data adapter type URI cannot be null or empty. The type URI for the diagnostic data adapter of type '{0}' is null or empty. + Diagnostic data adapter type URI cannot be null or empty. The type URI for the diagnostic data adapter of type '{0}' is null or empty. + + + + Diagnostic data adapter friendly names cannot be null or empty. The friendly name for the diagnostic data adapter of type '{0}' is null or empty. + Diagnostic data adapter friendly names cannot be null or empty. The friendly name for the diagnostic data adapter of type '{0}' is null or empty. + + + + There are multiple configurations that have diagnostic data adapter type '{0}' or Uri '{1}'. Duplicate configurations will be ignored in the test run. + There are multiple configurations that have diagnostic data adapter type '{0}' or Uri '{1}'. Duplicate configurations will be ignored in the test run. + + + + Diagnostic data adapter caught an exception of type '{0}': '{1}'. More details: {2}. + Diagnostic data adapter caught an exception of type '{0}': '{1}'. More details: {2}. + + + + Types deriving from the data collection context cannot be used for sending data and messages. The DataCollectionContext used for sending data and messages must come from one of the events raised to the data collector. + Types deriving from the data collection context cannot be used for sending data and messages. The DataCollectionContext used for sending data and messages must come from one of the events raised to the data collector. + + \ 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 f18c6e790d..91552a1b6f 100644 --- a/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.ja.xlf +++ b/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.ja.xlf @@ -209,6 +209,81 @@ fuzzyMatch="15" wordcount="24" adjWordcount="20.4" curWordcount="20.4" + + An error occurred while retrieving the attributes for the diagnostic data adapter of type '{0}'. + An error occurred while retrieving the attributes for the diagnostic data adapter of type '{0}'. + + + + Could not find diagnostic data adapter '{0}'. Make sure diagnostic data adapter is installed and try again. + Could not find diagnostic data adapter '{0}'. Make sure diagnostic data adapter is installed and try again. + + + + Diagnostic data adapter '{0}' failed to provide intialization information. Error: {1} + Diagnostic data adapter '{0}' failed to provide intialization information. Error: {1} + + + + The diagnostic data adapter '{0}' threw an exception during type loading, construction, or initialization: {1}. + The diagnostic data adapter '{0}' threw an exception during type loading, construction, or initialization: {1}. + + + + Could not find diagnostic data adapter of type '{0}' and Uri '{1}' + Could not find diagnostic data adapter of type '{0}' and Uri '{1}' + + + + The diagnostic data adapter '{0}' requested environment variable '{1}' with value '{2}' to be set in test execution environment, but another diagnostic data adapter '{3}' has already requested same environment variable with different value '{4}'. + The diagnostic data adapter '{0}' requested environment variable '{1}' with value '{2}' to be set in test execution environment, but another diagnostic data adapter '{3}' has already requested same environment variable with different value '{4}'. + + + + The required diagnostic data adapter attribute '{0}' is missing for the diagnostic data adapter of type '{1}'. + The required diagnostic data adapter attribute '{0}' is missing for the diagnostic data adapter of type '{1}'. + + + + Failed to get type for diagnostic data adapter '{0}'. Error: {1}. + Failed to get type for diagnostic data adapter '{0}'. Error: {1}. + + + + Invalid URI format. The URI '{0}' provided for the diagnostic data adapter of type '{1}' is not a valid URI. + Invalid URI format. The URI '{0}' provided for the diagnostic data adapter of type '{1}' is not a valid URI. + + + + Sending message of Message Type '{0}' is not supported. + Sending message of Message Type '{0}' is not supported. + + + + Diagnostic data adapter type URI cannot be null or empty. The type URI for the diagnostic data adapter of type '{0}' is null or empty. + Diagnostic data adapter type URI cannot be null or empty. The type URI for the diagnostic data adapter of type '{0}' is null or empty. + + + + Diagnostic data adapter friendly names cannot be null or empty. The friendly name for the diagnostic data adapter of type '{0}' is null or empty. + Diagnostic data adapter friendly names cannot be null or empty. The friendly name for the diagnostic data adapter of type '{0}' is null or empty. + + + + There are multiple configurations that have diagnostic data adapter type '{0}' or Uri '{1}'. Duplicate configurations will be ignored in the test run. + There are multiple configurations that have diagnostic data adapter type '{0}' or Uri '{1}'. Duplicate configurations will be ignored in the test run. + + + + Diagnostic data adapter caught an exception of type '{0}': '{1}'. More details: {2}. + Diagnostic data adapter caught an exception of type '{0}': '{1}'. More details: {2}. + + + + Types deriving from the data collection context cannot be used for sending data and messages. The DataCollectionContext used for sending data and messages must come from one of the events raised to the data collector. + Types deriving from the data collection context cannot be used for sending data and messages. The DataCollectionContext used for sending data and messages must come from one of the events raised to the data collector. + + \ 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 33906d5c84..0519a9916c 100644 --- a/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.ko.xlf +++ b/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.ko.xlf @@ -209,6 +209,81 @@ fuzzyMatch="15" wordcount="24" adjWordcount="20.4" curWordcount="20.4" + + An error occurred while retrieving the attributes for the diagnostic data adapter of type '{0}'. + An error occurred while retrieving the attributes for the diagnostic data adapter of type '{0}'. + + + + Could not find diagnostic data adapter '{0}'. Make sure diagnostic data adapter is installed and try again. + Could not find diagnostic data adapter '{0}'. Make sure diagnostic data adapter is installed and try again. + + + + Diagnostic data adapter '{0}' failed to provide intialization information. Error: {1} + Diagnostic data adapter '{0}' failed to provide intialization information. Error: {1} + + + + The diagnostic data adapter '{0}' threw an exception during type loading, construction, or initialization: {1}. + The diagnostic data adapter '{0}' threw an exception during type loading, construction, or initialization: {1}. + + + + Could not find diagnostic data adapter of type '{0}' and Uri '{1}' + Could not find diagnostic data adapter of type '{0}' and Uri '{1}' + + + + The diagnostic data adapter '{0}' requested environment variable '{1}' with value '{2}' to be set in test execution environment, but another diagnostic data adapter '{3}' has already requested same environment variable with different value '{4}'. + The diagnostic data adapter '{0}' requested environment variable '{1}' with value '{2}' to be set in test execution environment, but another diagnostic data adapter '{3}' has already requested same environment variable with different value '{4}'. + + + + The required diagnostic data adapter attribute '{0}' is missing for the diagnostic data adapter of type '{1}'. + The required diagnostic data adapter attribute '{0}' is missing for the diagnostic data adapter of type '{1}'. + + + + Failed to get type for diagnostic data adapter '{0}'. Error: {1}. + Failed to get type for diagnostic data adapter '{0}'. Error: {1}. + + + + Invalid URI format. The URI '{0}' provided for the diagnostic data adapter of type '{1}' is not a valid URI. + Invalid URI format. The URI '{0}' provided for the diagnostic data adapter of type '{1}' is not a valid URI. + + + + Sending message of Message Type '{0}' is not supported. + Sending message of Message Type '{0}' is not supported. + + + + Diagnostic data adapter type URI cannot be null or empty. The type URI for the diagnostic data adapter of type '{0}' is null or empty. + Diagnostic data adapter type URI cannot be null or empty. The type URI for the diagnostic data adapter of type '{0}' is null or empty. + + + + Diagnostic data adapter friendly names cannot be null or empty. The friendly name for the diagnostic data adapter of type '{0}' is null or empty. + Diagnostic data adapter friendly names cannot be null or empty. The friendly name for the diagnostic data adapter of type '{0}' is null or empty. + + + + There are multiple configurations that have diagnostic data adapter type '{0}' or Uri '{1}'. Duplicate configurations will be ignored in the test run. + There are multiple configurations that have diagnostic data adapter type '{0}' or Uri '{1}'. Duplicate configurations will be ignored in the test run. + + + + Diagnostic data adapter caught an exception of type '{0}': '{1}'. More details: {2}. + Diagnostic data adapter caught an exception of type '{0}': '{1}'. More details: {2}. + + + + Types deriving from the data collection context cannot be used for sending data and messages. The DataCollectionContext used for sending data and messages must come from one of the events raised to the data collector. + Types deriving from the data collection context cannot be used for sending data and messages. The DataCollectionContext used for sending data and messages must come from one of the events raised to the data collector. + + \ 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 d58efb4dfb..1c2a671e76 100644 --- a/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.pl.xlf +++ b/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.pl.xlf @@ -209,6 +209,81 @@ fuzzyMatch="15" wordcount="24" adjWordcount="20.4" curWordcount="20.4" + + An error occurred while retrieving the attributes for the diagnostic data adapter of type '{0}'. + An error occurred while retrieving the attributes for the diagnostic data adapter of type '{0}'. + + + + Could not find diagnostic data adapter '{0}'. Make sure diagnostic data adapter is installed and try again. + Could not find diagnostic data adapter '{0}'. Make sure diagnostic data adapter is installed and try again. + + + + Diagnostic data adapter '{0}' failed to provide intialization information. Error: {1} + Diagnostic data adapter '{0}' failed to provide intialization information. Error: {1} + + + + The diagnostic data adapter '{0}' threw an exception during type loading, construction, or initialization: {1}. + The diagnostic data adapter '{0}' threw an exception during type loading, construction, or initialization: {1}. + + + + Could not find diagnostic data adapter of type '{0}' and Uri '{1}' + Could not find diagnostic data adapter of type '{0}' and Uri '{1}' + + + + The diagnostic data adapter '{0}' requested environment variable '{1}' with value '{2}' to be set in test execution environment, but another diagnostic data adapter '{3}' has already requested same environment variable with different value '{4}'. + The diagnostic data adapter '{0}' requested environment variable '{1}' with value '{2}' to be set in test execution environment, but another diagnostic data adapter '{3}' has already requested same environment variable with different value '{4}'. + + + + The required diagnostic data adapter attribute '{0}' is missing for the diagnostic data adapter of type '{1}'. + The required diagnostic data adapter attribute '{0}' is missing for the diagnostic data adapter of type '{1}'. + + + + Failed to get type for diagnostic data adapter '{0}'. Error: {1}. + Failed to get type for diagnostic data adapter '{0}'. Error: {1}. + + + + Invalid URI format. The URI '{0}' provided for the diagnostic data adapter of type '{1}' is not a valid URI. + Invalid URI format. The URI '{0}' provided for the diagnostic data adapter of type '{1}' is not a valid URI. + + + + Sending message of Message Type '{0}' is not supported. + Sending message of Message Type '{0}' is not supported. + + + + Diagnostic data adapter type URI cannot be null or empty. The type URI for the diagnostic data adapter of type '{0}' is null or empty. + Diagnostic data adapter type URI cannot be null or empty. The type URI for the diagnostic data adapter of type '{0}' is null or empty. + + + + Diagnostic data adapter friendly names cannot be null or empty. The friendly name for the diagnostic data adapter of type '{0}' is null or empty. + Diagnostic data adapter friendly names cannot be null or empty. The friendly name for the diagnostic data adapter of type '{0}' is null or empty. + + + + There are multiple configurations that have diagnostic data adapter type '{0}' or Uri '{1}'. Duplicate configurations will be ignored in the test run. + There are multiple configurations that have diagnostic data adapter type '{0}' or Uri '{1}'. Duplicate configurations will be ignored in the test run. + + + + Diagnostic data adapter caught an exception of type '{0}': '{1}'. More details: {2}. + Diagnostic data adapter caught an exception of type '{0}': '{1}'. More details: {2}. + + + + Types deriving from the data collection context cannot be used for sending data and messages. The DataCollectionContext used for sending data and messages must come from one of the events raised to the data collector. + Types deriving from the data collection context cannot be used for sending data and messages. The DataCollectionContext used for sending data and messages must come from one of the events raised to the data collector. + + \ 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 4cce9884ab..874a0e6b03 100644 --- a/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.pt-BR.xlf +++ b/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.pt-BR.xlf @@ -209,6 +209,81 @@ fuzzyMatch="15" wordcount="24" adjWordcount="20.4" curWordcount="20.4" + + An error occurred while retrieving the attributes for the diagnostic data adapter of type '{0}'. + An error occurred while retrieving the attributes for the diagnostic data adapter of type '{0}'. + + + + Could not find diagnostic data adapter '{0}'. Make sure diagnostic data adapter is installed and try again. + Could not find diagnostic data adapter '{0}'. Make sure diagnostic data adapter is installed and try again. + + + + Diagnostic data adapter '{0}' failed to provide intialization information. Error: {1} + Diagnostic data adapter '{0}' failed to provide intialization information. Error: {1} + + + + The diagnostic data adapter '{0}' threw an exception during type loading, construction, or initialization: {1}. + The diagnostic data adapter '{0}' threw an exception during type loading, construction, or initialization: {1}. + + + + Could not find diagnostic data adapter of type '{0}' and Uri '{1}' + Could not find diagnostic data adapter of type '{0}' and Uri '{1}' + + + + The diagnostic data adapter '{0}' requested environment variable '{1}' with value '{2}' to be set in test execution environment, but another diagnostic data adapter '{3}' has already requested same environment variable with different value '{4}'. + The diagnostic data adapter '{0}' requested environment variable '{1}' with value '{2}' to be set in test execution environment, but another diagnostic data adapter '{3}' has already requested same environment variable with different value '{4}'. + + + + The required diagnostic data adapter attribute '{0}' is missing for the diagnostic data adapter of type '{1}'. + The required diagnostic data adapter attribute '{0}' is missing for the diagnostic data adapter of type '{1}'. + + + + Failed to get type for diagnostic data adapter '{0}'. Error: {1}. + Failed to get type for diagnostic data adapter '{0}'. Error: {1}. + + + + Invalid URI format. The URI '{0}' provided for the diagnostic data adapter of type '{1}' is not a valid URI. + Invalid URI format. The URI '{0}' provided for the diagnostic data adapter of type '{1}' is not a valid URI. + + + + Sending message of Message Type '{0}' is not supported. + Sending message of Message Type '{0}' is not supported. + + + + Diagnostic data adapter type URI cannot be null or empty. The type URI for the diagnostic data adapter of type '{0}' is null or empty. + Diagnostic data adapter type URI cannot be null or empty. The type URI for the diagnostic data adapter of type '{0}' is null or empty. + + + + Diagnostic data adapter friendly names cannot be null or empty. The friendly name for the diagnostic data adapter of type '{0}' is null or empty. + Diagnostic data adapter friendly names cannot be null or empty. The friendly name for the diagnostic data adapter of type '{0}' is null or empty. + + + + There are multiple configurations that have diagnostic data adapter type '{0}' or Uri '{1}'. Duplicate configurations will be ignored in the test run. + There are multiple configurations that have diagnostic data adapter type '{0}' or Uri '{1}'. Duplicate configurations will be ignored in the test run. + + + + Diagnostic data adapter caught an exception of type '{0}': '{1}'. More details: {2}. + Diagnostic data adapter caught an exception of type '{0}': '{1}'. More details: {2}. + + + + Types deriving from the data collection context cannot be used for sending data and messages. The DataCollectionContext used for sending data and messages must come from one of the events raised to the data collector. + Types deriving from the data collection context cannot be used for sending data and messages. The DataCollectionContext used for sending data and messages must come from one of the events raised to the data collector. + + \ 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 45d5f5733b..b8cf623fd9 100644 --- a/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.ru.xlf +++ b/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.ru.xlf @@ -209,6 +209,81 @@ fuzzyMatch="15" wordcount="24" adjWordcount="20.4" curWordcount="20.4" + + An error occurred while retrieving the attributes for the diagnostic data adapter of type '{0}'. + An error occurred while retrieving the attributes for the diagnostic data adapter of type '{0}'. + + + + Could not find diagnostic data adapter '{0}'. Make sure diagnostic data adapter is installed and try again. + Could not find diagnostic data adapter '{0}'. Make sure diagnostic data adapter is installed and try again. + + + + Diagnostic data adapter '{0}' failed to provide intialization information. Error: {1} + Diagnostic data adapter '{0}' failed to provide intialization information. Error: {1} + + + + The diagnostic data adapter '{0}' threw an exception during type loading, construction, or initialization: {1}. + The diagnostic data adapter '{0}' threw an exception during type loading, construction, or initialization: {1}. + + + + Could not find diagnostic data adapter of type '{0}' and Uri '{1}' + Could not find diagnostic data adapter of type '{0}' and Uri '{1}' + + + + The diagnostic data adapter '{0}' requested environment variable '{1}' with value '{2}' to be set in test execution environment, but another diagnostic data adapter '{3}' has already requested same environment variable with different value '{4}'. + The diagnostic data adapter '{0}' requested environment variable '{1}' with value '{2}' to be set in test execution environment, but another diagnostic data adapter '{3}' has already requested same environment variable with different value '{4}'. + + + + The required diagnostic data adapter attribute '{0}' is missing for the diagnostic data adapter of type '{1}'. + The required diagnostic data adapter attribute '{0}' is missing for the diagnostic data adapter of type '{1}'. + + + + Failed to get type for diagnostic data adapter '{0}'. Error: {1}. + Failed to get type for diagnostic data adapter '{0}'. Error: {1}. + + + + Invalid URI format. The URI '{0}' provided for the diagnostic data adapter of type '{1}' is not a valid URI. + Invalid URI format. The URI '{0}' provided for the diagnostic data adapter of type '{1}' is not a valid URI. + + + + Sending message of Message Type '{0}' is not supported. + Sending message of Message Type '{0}' is not supported. + + + + Diagnostic data adapter type URI cannot be null or empty. The type URI for the diagnostic data adapter of type '{0}' is null or empty. + Diagnostic data adapter type URI cannot be null or empty. The type URI for the diagnostic data adapter of type '{0}' is null or empty. + + + + Diagnostic data adapter friendly names cannot be null or empty. The friendly name for the diagnostic data adapter of type '{0}' is null or empty. + Diagnostic data adapter friendly names cannot be null or empty. The friendly name for the diagnostic data adapter of type '{0}' is null or empty. + + + + There are multiple configurations that have diagnostic data adapter type '{0}' or Uri '{1}'. Duplicate configurations will be ignored in the test run. + There are multiple configurations that have diagnostic data adapter type '{0}' or Uri '{1}'. Duplicate configurations will be ignored in the test run. + + + + Diagnostic data adapter caught an exception of type '{0}': '{1}'. More details: {2}. + Diagnostic data adapter caught an exception of type '{0}': '{1}'. More details: {2}. + + + + Types deriving from the data collection context cannot be used for sending data and messages. The DataCollectionContext used for sending data and messages must come from one of the events raised to the data collector. + Types deriving from the data collection context cannot be used for sending data and messages. The DataCollectionContext used for sending data and messages must come from one of the events raised to the data collector. + + \ 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 d00cb385d5..d5ccb7d104 100644 --- a/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.tr.xlf +++ b/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.tr.xlf @@ -209,6 +209,81 @@ fuzzyMatch="15" wordcount="24" adjWordcount="20.4" curWordcount="20.4" + + An error occurred while retrieving the attributes for the diagnostic data adapter of type '{0}'. + An error occurred while retrieving the attributes for the diagnostic data adapter of type '{0}'. + + + + Could not find diagnostic data adapter '{0}'. Make sure diagnostic data adapter is installed and try again. + Could not find diagnostic data adapter '{0}'. Make sure diagnostic data adapter is installed and try again. + + + + Diagnostic data adapter '{0}' failed to provide intialization information. Error: {1} + Diagnostic data adapter '{0}' failed to provide intialization information. Error: {1} + + + + The diagnostic data adapter '{0}' threw an exception during type loading, construction, or initialization: {1}. + The diagnostic data adapter '{0}' threw an exception during type loading, construction, or initialization: {1}. + + + + Could not find diagnostic data adapter of type '{0}' and Uri '{1}' + Could not find diagnostic data adapter of type '{0}' and Uri '{1}' + + + + The diagnostic data adapter '{0}' requested environment variable '{1}' with value '{2}' to be set in test execution environment, but another diagnostic data adapter '{3}' has already requested same environment variable with different value '{4}'. + The diagnostic data adapter '{0}' requested environment variable '{1}' with value '{2}' to be set in test execution environment, but another diagnostic data adapter '{3}' has already requested same environment variable with different value '{4}'. + + + + The required diagnostic data adapter attribute '{0}' is missing for the diagnostic data adapter of type '{1}'. + The required diagnostic data adapter attribute '{0}' is missing for the diagnostic data adapter of type '{1}'. + + + + Failed to get type for diagnostic data adapter '{0}'. Error: {1}. + Failed to get type for diagnostic data adapter '{0}'. Error: {1}. + + + + Invalid URI format. The URI '{0}' provided for the diagnostic data adapter of type '{1}' is not a valid URI. + Invalid URI format. The URI '{0}' provided for the diagnostic data adapter of type '{1}' is not a valid URI. + + + + Sending message of Message Type '{0}' is not supported. + Sending message of Message Type '{0}' is not supported. + + + + Diagnostic data adapter type URI cannot be null or empty. The type URI for the diagnostic data adapter of type '{0}' is null or empty. + Diagnostic data adapter type URI cannot be null or empty. The type URI for the diagnostic data adapter of type '{0}' is null or empty. + + + + Diagnostic data adapter friendly names cannot be null or empty. The friendly name for the diagnostic data adapter of type '{0}' is null or empty. + Diagnostic data adapter friendly names cannot be null or empty. The friendly name for the diagnostic data adapter of type '{0}' is null or empty. + + + + There are multiple configurations that have diagnostic data adapter type '{0}' or Uri '{1}'. Duplicate configurations will be ignored in the test run. + There are multiple configurations that have diagnostic data adapter type '{0}' or Uri '{1}'. Duplicate configurations will be ignored in the test run. + + + + Diagnostic data adapter caught an exception of type '{0}': '{1}'. More details: {2}. + Diagnostic data adapter caught an exception of type '{0}': '{1}'. More details: {2}. + + + + Types deriving from the data collection context cannot be used for sending data and messages. The DataCollectionContext used for sending data and messages must come from one of the events raised to the data collector. + Types deriving from the data collection context cannot be used for sending data and messages. The DataCollectionContext used for sending data and messages must come from one of the events raised to the data collector. + + \ 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 adf97bae70..4e2e771513 100644 --- a/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.zh-Hans.xlf +++ b/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.zh-Hans.xlf @@ -209,6 +209,81 @@ fuzzyMatch="15" wordcount="24" adjWordcount="20.4" curWordcount="20.4" + + An error occurred while retrieving the attributes for the diagnostic data adapter of type '{0}'. + An error occurred while retrieving the attributes for the diagnostic data adapter of type '{0}'. + + + + Could not find diagnostic data adapter '{0}'. Make sure diagnostic data adapter is installed and try again. + Could not find diagnostic data adapter '{0}'. Make sure diagnostic data adapter is installed and try again. + + + + Diagnostic data adapter '{0}' failed to provide intialization information. Error: {1} + Diagnostic data adapter '{0}' failed to provide intialization information. Error: {1} + + + + The diagnostic data adapter '{0}' threw an exception during type loading, construction, or initialization: {1}. + The diagnostic data adapter '{0}' threw an exception during type loading, construction, or initialization: {1}. + + + + Could not find diagnostic data adapter of type '{0}' and Uri '{1}' + Could not find diagnostic data adapter of type '{0}' and Uri '{1}' + + + + The diagnostic data adapter '{0}' requested environment variable '{1}' with value '{2}' to be set in test execution environment, but another diagnostic data adapter '{3}' has already requested same environment variable with different value '{4}'. + The diagnostic data adapter '{0}' requested environment variable '{1}' with value '{2}' to be set in test execution environment, but another diagnostic data adapter '{3}' has already requested same environment variable with different value '{4}'. + + + + The required diagnostic data adapter attribute '{0}' is missing for the diagnostic data adapter of type '{1}'. + The required diagnostic data adapter attribute '{0}' is missing for the diagnostic data adapter of type '{1}'. + + + + Failed to get type for diagnostic data adapter '{0}'. Error: {1}. + Failed to get type for diagnostic data adapter '{0}'. Error: {1}. + + + + Invalid URI format. The URI '{0}' provided for the diagnostic data adapter of type '{1}' is not a valid URI. + Invalid URI format. The URI '{0}' provided for the diagnostic data adapter of type '{1}' is not a valid URI. + + + + Sending message of Message Type '{0}' is not supported. + Sending message of Message Type '{0}' is not supported. + + + + Diagnostic data adapter type URI cannot be null or empty. The type URI for the diagnostic data adapter of type '{0}' is null or empty. + Diagnostic data adapter type URI cannot be null or empty. The type URI for the diagnostic data adapter of type '{0}' is null or empty. + + + + Diagnostic data adapter friendly names cannot be null or empty. The friendly name for the diagnostic data adapter of type '{0}' is null or empty. + Diagnostic data adapter friendly names cannot be null or empty. The friendly name for the diagnostic data adapter of type '{0}' is null or empty. + + + + There are multiple configurations that have diagnostic data adapter type '{0}' or Uri '{1}'. Duplicate configurations will be ignored in the test run. + There are multiple configurations that have diagnostic data adapter type '{0}' or Uri '{1}'. Duplicate configurations will be ignored in the test run. + + + + Diagnostic data adapter caught an exception of type '{0}': '{1}'. More details: {2}. + Diagnostic data adapter caught an exception of type '{0}': '{1}'. More details: {2}. + + + + Types deriving from the data collection context cannot be used for sending data and messages. The DataCollectionContext used for sending data and messages must come from one of the events raised to the data collector. + Types deriving from the data collection context cannot be used for sending data and messages. The DataCollectionContext used for sending data and messages must come from one of the events raised to the data collector. + + \ 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 67869cf24c..2513a009d8 100644 --- a/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.zh-Hant.xlf +++ b/src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.zh-Hant.xlf @@ -209,6 +209,81 @@ fuzzyMatch="15" wordcount="24" adjWordcount="20.4" curWordcount="20.4" + + An error occurred while retrieving the attributes for the diagnostic data adapter of type '{0}'. + An error occurred while retrieving the attributes for the diagnostic data adapter of type '{0}'. + + + + Could not find diagnostic data adapter '{0}'. Make sure diagnostic data adapter is installed and try again. + Could not find diagnostic data adapter '{0}'. Make sure diagnostic data adapter is installed and try again. + + + + Diagnostic data adapter '{0}' failed to provide intialization information. Error: {1} + Diagnostic data adapter '{0}' failed to provide intialization information. Error: {1} + + + + The diagnostic data adapter '{0}' threw an exception during type loading, construction, or initialization: {1}. + The diagnostic data adapter '{0}' threw an exception during type loading, construction, or initialization: {1}. + + + + Could not find diagnostic data adapter of type '{0}' and Uri '{1}' + Could not find diagnostic data adapter of type '{0}' and Uri '{1}' + + + + The diagnostic data adapter '{0}' requested environment variable '{1}' with value '{2}' to be set in test execution environment, but another diagnostic data adapter '{3}' has already requested same environment variable with different value '{4}'. + The diagnostic data adapter '{0}' requested environment variable '{1}' with value '{2}' to be set in test execution environment, but another diagnostic data adapter '{3}' has already requested same environment variable with different value '{4}'. + + + + The required diagnostic data adapter attribute '{0}' is missing for the diagnostic data adapter of type '{1}'. + The required diagnostic data adapter attribute '{0}' is missing for the diagnostic data adapter of type '{1}'. + + + + Failed to get type for diagnostic data adapter '{0}'. Error: {1}. + Failed to get type for diagnostic data adapter '{0}'. Error: {1}. + + + + Invalid URI format. The URI '{0}' provided for the diagnostic data adapter of type '{1}' is not a valid URI. + Invalid URI format. The URI '{0}' provided for the diagnostic data adapter of type '{1}' is not a valid URI. + + + + Sending message of Message Type '{0}' is not supported. + Sending message of Message Type '{0}' is not supported. + + + + Diagnostic data adapter type URI cannot be null or empty. The type URI for the diagnostic data adapter of type '{0}' is null or empty. + Diagnostic data adapter type URI cannot be null or empty. The type URI for the diagnostic data adapter of type '{0}' is null or empty. + + + + Diagnostic data adapter friendly names cannot be null or empty. The friendly name for the diagnostic data adapter of type '{0}' is null or empty. + Diagnostic data adapter friendly names cannot be null or empty. The friendly name for the diagnostic data adapter of type '{0}' is null or empty. + + + + There are multiple configurations that have diagnostic data adapter type '{0}' or Uri '{1}'. Duplicate configurations will be ignored in the test run. + There are multiple configurations that have diagnostic data adapter type '{0}' or Uri '{1}'. Duplicate configurations will be ignored in the test run. + + + + Diagnostic data adapter caught an exception of type '{0}': '{1}'. More details: {2}. + Diagnostic data adapter caught an exception of type '{0}': '{1}'. More details: {2}. + + + + Types deriving from the data collection context cannot be used for sending data and messages. The DataCollectionContext used for sending data and messages must come from one of the events raised to the data collector. + Types deriving from the data collection context cannot be used for sending data and messages. The DataCollectionContext used for sending data and messages must come from one of the events raised to the data collector. + + \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.CommunicationUtilities/DataCollectionRequestHandler.cs b/src/Microsoft.TestPlatform.CommunicationUtilities/DataCollectionRequestHandler.cs index 0fbbade8e1..c110b4e9fc 100644 --- a/src/Microsoft.TestPlatform.CommunicationUtilities/DataCollectionRequestHandler.cs +++ b/src/Microsoft.TestPlatform.CommunicationUtilities/DataCollectionRequestHandler.cs @@ -4,9 +4,10 @@ namespace Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.DataCollection { using System; - using System.Collections.ObjectModel; using Microsoft.VisualStudio.TestPlatform.Common.DataCollection; + using Microsoft.VisualStudio.TestPlatform.Common.DataCollector; + using Microsoft.VisualStudio.TestPlatform.Common.DataCollector.Interfaces; using Microsoft.VisualStudio.TestPlatform.CommunicationUtilities; using Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.DataCollection.Interfaces; using Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.Interfaces; @@ -20,14 +21,16 @@ namespace Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.DataCollect internal class DataCollectionRequestHandler : IDataCollectionRequestHandler, IDisposable { private readonly ICommunicationManager communicationManager; - private IDataSerializer dataSerializer; - - private static DataCollectionRequestHandler RequestHandler; + private IMessageSink messageSink; + private IDataCollectionManager dataCollectionManager; private static readonly object obj = new object(); - internal DataCollectionRequestHandler() - : this(new SocketCommunicationManager(), JsonDataSerializer.Instance) + internal static DataCollectionRequestHandler RequestHandler; + + internal DataCollectionRequestHandler(IMessageSink messageSink) + : this(new SocketCommunicationManager()) { + this.messageSink = messageSink; } /// @@ -35,12 +38,9 @@ internal DataCollectionRequestHandler() /// /// /// - /// - /// - internal DataCollectionRequestHandler(ICommunicationManager communicationManager, IDataSerializer dataSerializer) + internal DataCollectionRequestHandler(ICommunicationManager communicationManager) { this.communicationManager = communicationManager; - this.dataSerializer = dataSerializer; } /// @@ -54,8 +54,9 @@ public static DataCollectionRequestHandler Instance { if (RequestHandler == null) { - RequestHandler = new DataCollectionRequestHandler(); + RequestHandler = new DataCollectionRequestHandler(default(IMessageSink)); } + return RequestHandler; } } @@ -67,6 +68,7 @@ public static DataCollectionRequestHandler Instance public void Dispose() { this.communicationManager?.StopClient(); + this.dataCollectionManager?.Dispose(); } /// @@ -103,22 +105,34 @@ public void ProcessRequests() switch (message.MessageType) { case MessageType.BeforeTestRunStart: - // TODO: Send actual BeforeTestRunStartResult - // string settingXml = message.Payload.ToObject(); - this.communicationManager.SendMessage(MessageType.BeforeTestRunStartResult, new BeforeTestRunStartResult(null, true, 0)); + EqtTrace.Info("DataCollection starting."); + + var settingXml = message.Payload.ToObject(); + this.dataCollectionManager = new DataCollectionManager(this.messageSink); + var envVariables = this.dataCollectionManager.InitializeDataCollectors(settingXml); + this.dataCollectionManager.SessionStarted(); + + this.communicationManager.SendMessage(MessageType.BeforeTestRunStartResult, new BeforeTestRunStartResult(envVariables, true, 0)); + + EqtTrace.Info("DataCollection started."); break; case MessageType.AfterTestRunEnd: - // TODO: Send actual collection of AttachmentSet - this.communicationManager.SendMessage(MessageType.AfterTestRunEndResult, new Collection()); + EqtTrace.Info("DataCollection completing."); + var isCancelled = message.Payload.ToObject(); + + var attachments = this.dataCollectionManager.SessionEnded(isCancelled); + + this.communicationManager.SendMessage(MessageType.AfterTestRunEndResult, attachments); EqtTrace.Info("Session End message received from server. Closing the connection."); - // TODO: Check if we need a separate message for closing the session. isSessionEnd = true; this.Close(); + + EqtTrace.Info("DataCollection completed"); break; default: - EqtTrace.Info("Invalid Message types"); + EqtTrace.Info("DataCollection : Invalid Message types"); break; } } @@ -126,9 +140,11 @@ public void ProcessRequests() } /// - /// + /// Sends datacollection message. /// - /// + /// + /// The args. + /// public void SendDataCollectionMessage(DataCollectionMessageEventArgs args) { this.communicationManager.SendMessage(MessageType.DataCollectionMessage, args); diff --git a/src/Microsoft.TestPlatform.CommunicationUtilities/DataCollectionRequestSender.cs b/src/Microsoft.TestPlatform.CommunicationUtilities/DataCollectionRequestSender.cs index cea54b58c3..94ce778782 100644 --- a/src/Microsoft.TestPlatform.CommunicationUtilities/DataCollectionRequestSender.cs +++ b/src/Microsoft.TestPlatform.CommunicationUtilities/DataCollectionRequestSender.cs @@ -4,35 +4,41 @@ namespace Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.DataCollection { using System; - using Microsoft.VisualStudio.TestPlatform.ObjectModel; - using Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.Interfaces; using System.Collections.ObjectModel; + + using Microsoft.VisualStudio.TestPlatform.Common.DataCollection; using Microsoft.VisualStudio.TestPlatform.CommunicationUtilities; - using Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.ObjectModel; using Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.DataCollection.Interfaces; - using Microsoft.VisualStudio.TestPlatform.Common.DataCollection; + using Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.Interfaces; + using Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.ObjectModel; + using Microsoft.VisualStudio.TestPlatform.ObjectModel; + using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client; + using Microsoft.VisualStudio.TestPlatform.ObjectModel.Logging; /// - /// Utility class that facilitates the IPC comunication. Acts as server. + /// Utility class that facilitates the IPC communication. Acts as server. /// public sealed class DataCollectionRequestSender : IDataCollectionRequestSender, IDisposable { private ICommunicationManager communicationManager; - private IDataSerializer dataSerializer; /// - /// Creates new instance of DataCollectionRequestSender. + /// Initializes a new instance of the class. /// public DataCollectionRequestSender() : this(new SocketCommunicationManager(), JsonDataSerializer.Instance) { } /// - /// Creates new instance of DataCollectionRequestSender. + /// Initializes a new instance of the class. /// - /// - /// + /// + /// The communication manager. + /// + /// + /// The data serializer. + /// internal DataCollectionRequestSender(ICommunicationManager communicationManager, IDataSerializer dataSerializer) { this.communicationManager = communicationManager; @@ -42,7 +48,7 @@ internal DataCollectionRequestSender(ICommunicationManager communicationManager, /// /// Creates an endpoint and listens for client connection asynchronously /// - /// + /// Port number public int InitializeCommunication() { var port = this.communicationManager.HostServer(); @@ -77,36 +83,60 @@ public void Close() EqtTrace.Info("Closing the connection"); } - /// - /// Sends the BeforeTestRunStart event and waits for result - /// - /// BeforeTestRunStartResult containing environment variables - public BeforeTestRunStartResult SendBeforeTestRunStartAndGetResult(string settingsXml) + /// + public BeforeTestRunStartResult SendBeforeTestRunStartAndGetResult(string settingsXml, ITestMessageEventHandler runEventsHandler) { + var isDataCollectionStarted = false; + BeforeTestRunStartResult result = null; + this.communicationManager.SendMessage(MessageType.BeforeTestRunStart, settingsXml); - var message = this.communicationManager.ReceiveMessage(); - if (message.MessageType == MessageType.BeforeTestRunStartResult) + + while (!isDataCollectionStarted) { - return dataSerializer.DeserializePayload(message); + var message = this.communicationManager.ReceiveMessage(); + + if (message.MessageType == MessageType.DataCollectionMessage) + { + var msg = this.dataSerializer.DeserializePayload(message); + runEventsHandler.HandleLogMessage(msg.Level, msg.Message); + } + else if (message.MessageType == MessageType.BeforeTestRunStartResult) + { + isDataCollectionStarted = true; + result = this.dataSerializer.DeserializePayload(message); + } } - return null; + return result; } - /// - /// Sends the AfterTestRunStart event and waits for result - /// - /// DataCollector attachments - public Collection SendAfterTestRunStartAndGetResult() + /// + public Collection SendAfterTestRunStartAndGetResult(ITestMessageEventHandler runEventsHandler, bool isCancelled) { - this.communicationManager.SendMessage(MessageType.BeforeTestRunStart); - var message = this.communicationManager.ReceiveMessage(); - if (message.MessageType == MessageType.BeforeTestRunStartResult) + var isDataCollectionComplete = false; + Collection attachmentSets = null; + + this.communicationManager.SendMessage(MessageType.AfterTestRunEnd, isCancelled); + + // Cycle through the messages that the datacollector sends. + // Currently each of the operations are not separate tasks since they should not each take much time. This is just a notification. + while (!isDataCollectionComplete) { - return dataSerializer.DeserializePayload>(message); + var message = this.communicationManager.ReceiveMessage(); + + if (message.MessageType == MessageType.DataCollectionMessage) + { + var msg = this.dataSerializer.DeserializePayload(message); + runEventsHandler.HandleLogMessage(msg.Level, msg.Message); + } + else if (message.MessageType == MessageType.AfterTestRunEndResult) + { + attachmentSets = this.dataSerializer.DeserializePayload>(message); + isDataCollectionComplete = true; + } } - return null; + return attachmentSets; } } } \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.CommunicationUtilities/Friends.cs b/src/Microsoft.TestPlatform.CommunicationUtilities/Friends.cs index d9a1f24944..a5c99e381e 100644 --- a/src/Microsoft.TestPlatform.CommunicationUtilities/Friends.cs +++ b/src/Microsoft.TestPlatform.CommunicationUtilities/Friends.cs @@ -8,3 +8,5 @@ [assembly: InternalsVisibleTo("Microsoft.TestPlatform.CrossPlatEngine, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")] [assembly: InternalsVisibleTo("Microsoft.TestPlatform.CrossPlatEngine.UnitTests, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")] [assembly: InternalsVisibleTo("datacollector, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")] + +[assembly: InternalsVisibleTo("Microsoft.VisualStudio.TestPlatform.DataCollector.PlatformTests, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")] diff --git a/src/Microsoft.TestPlatform.CommunicationUtilities/Interfaces/IDataCollectionRequestSender.cs b/src/Microsoft.TestPlatform.CommunicationUtilities/Interfaces/IDataCollectionRequestSender.cs index 19f021b2b8..42c7c46359 100644 --- a/src/Microsoft.TestPlatform.CommunicationUtilities/Interfaces/IDataCollectionRequestSender.cs +++ b/src/Microsoft.TestPlatform.CommunicationUtilities/Interfaces/IDataCollectionRequestSender.cs @@ -5,8 +5,9 @@ namespace Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.DataCollect { using System.Collections.ObjectModel; - using Microsoft.VisualStudio.TestPlatform.ObjectModel; using Microsoft.VisualStudio.TestPlatform.Common.DataCollection; + using Microsoft.VisualStudio.TestPlatform.ObjectModel; + using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client; /// /// Defines contract to send test platform requests to test host @@ -33,15 +34,30 @@ internal interface IDataCollectionRequestSender /// /// Sends the BeforeTestRunStart event and waits for result - /// - /// - /// BeforeTestRunStartResult containing environment variables - BeforeTestRunStartResult SendBeforeTestRunStartAndGetResult(string settingXml); + /// + /// + /// Run settings for test run. + /// + /// + /// Test message event handler for handling messages. + /// + /// + /// BeforeTestRunStartResult containing environment variables + /// + BeforeTestRunStartResult SendBeforeTestRunStartAndGetResult(string settingXml, ITestMessageEventHandler runEventsHandler); /// /// Sends the AfterTestRunStart event and waits for result /// - /// DataCollector attachments - Collection SendAfterTestRunStartAndGetResult(); + /// + /// Test message event handler for handling messages. + /// + /// + /// The value to specify whether the test run is cancelled or not. + /// + /// + /// DataCollector attachments + /// + Collection SendAfterTestRunStartAndGetResult(ITestMessageEventHandler runEventsHandler, bool isCancelled); } } \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.CommunicationUtilities/Microsoft.TestPlatform.CommunicationUtilities.csproj b/src/Microsoft.TestPlatform.CommunicationUtilities/Microsoft.TestPlatform.CommunicationUtilities.csproj index 780585ee7b..09a01153d6 100644 --- a/src/Microsoft.TestPlatform.CommunicationUtilities/Microsoft.TestPlatform.CommunicationUtilities.csproj +++ b/src/Microsoft.TestPlatform.CommunicationUtilities/Microsoft.TestPlatform.CommunicationUtilities.csproj @@ -1,4 +1,4 @@ - + ..\..\ @@ -11,7 +11,7 @@ $(PackageTargetFallback);dnxcore50;portable-net45+win8 - + @@ -52,4 +52,4 @@ Microsoft.VisualStudio.TestPlatform.CommunicationUtilities - + \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.CoreUtilities/Helpers/FileHelper.cs b/src/Microsoft.TestPlatform.CoreUtilities/Helpers/FileHelper.cs index 0132d13167..7ae54b482f 100644 --- a/src/Microsoft.TestPlatform.CoreUtilities/Helpers/FileHelper.cs +++ b/src/Microsoft.TestPlatform.CoreUtilities/Helpers/FileHelper.cs @@ -58,7 +58,5 @@ public FileAttributes GetFileAttributes(string path) { return new FileInfo(path).Attributes; } - - } } diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyExecutionManagerWithDataCollection.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyExecutionManagerWithDataCollection.cs index 9f0c59ddb4..2a8557d7b8 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyExecutionManagerWithDataCollection.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyExecutionManagerWithDataCollection.cs @@ -122,6 +122,7 @@ public override int StartTestRun(TestRunCriteria testRunCriteria, ITestRunEvents /// public override void Cancel() { + this.ProxyDataCollectionManager?.AfterTestRunEnd(isCanceled: true, runEventsHandler: this.DataCollectionRunEventsHandler); base.Cancel(); } diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/DataCollectionLauncher.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/DataCollectionLauncher.cs deleted file mode 100644 index 42c45d172b..0000000000 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/DataCollectionLauncher.cs +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. - -namespace Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.DataCollection -{ - using System.Collections.Generic; - using System.Diagnostics; - using System.IO; - using System.Reflection; - - using Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.DataCollection.Interfaces; - using Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Helpers; - using Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Helpers.Interfaces; - using Microsoft.VisualStudio.TestPlatform.ObjectModel; - - /// - /// The datacollection launcher. - /// This works for Desktop local scenarios - /// - internal class DataCollectionLauncher : IDataCollectionLauncher - { - private const string DataCollectorProcessName = "datacollector.exe"; - private const string DotnetProcessName = "dotnet.exe"; - private const string DotnetProcessNameXPlat = "dotnet"; - - private string dataCollectorProcessName; - private Process dataCollectorProcess; - private IProcessHelper processHelper; - - /// - /// The constructor. - /// - public DataCollectionLauncher() - : this(new ProcessHelper()) - { - } - - /// - /// Initializes a new instance of the class. - /// - /// - /// The process helper. - /// - internal DataCollectionLauncher(IProcessHelper processHelper) - { - this.processHelper = processHelper; - this.dataCollectorProcess = null; - } - - /// - /// Initialize with desired architecture for the host - /// - /// architecture for the host - public void Initialize(Architecture architecture) - { - this.dataCollectorProcessName = DataCollectorProcessName; - } - - /// - /// Launches the test host for discovery/execution. - /// - /// Environment variables for the process. - /// The command line arguments to pass to the process. - /// ProcessId of launched Process. 0 means not launched. - public virtual int LaunchDataCollector(IDictionary environmentVariables, IList commandLineArguments) - { - var currentWorkingDirectory = Path.GetDirectoryName(typeof(DataCollectionLauncher).GetTypeInfo().Assembly.Location); - string dataCollectorProcessPath, processWorkingDirectory = null; - - // TODO: DRY: Move this code to a common place - // If we are running in the dotnet.exe context we do not want to launch dataCollector.exe but dotnet.exe with the dataCollector assembly. - // Since dotnet.exe is already built for multiple platforms this would avoid building dataCollector.exe also in multiple platforms. - var currentProcessFileName = this.processHelper.GetCurrentProcessFileName(); - if (currentProcessFileName.EndsWith(DotnetProcessName) || currentProcessFileName.EndsWith(DotnetProcessNameXPlat)) - { - dataCollectorProcessPath = currentProcessFileName; - var dataCollectorAssemblyPath = Path.Combine(currentWorkingDirectory, this.dataCollectorProcessName.Replace("exe", "dll")); - commandLineArguments.Insert(0, dataCollectorAssemblyPath); - processWorkingDirectory = Path.GetDirectoryName(currentProcessFileName); - } - else - { - dataCollectorProcessPath = Path.Combine(currentWorkingDirectory, this.dataCollectorProcessName); - // For IDEs and other scenario - Current directory should be the working directory - not the vstest.console.exe location - // For VS - this becomes the solution directory for example - // "TestResults" directory will be created at "current directory" of test host - processWorkingDirectory = Directory.GetCurrentDirectory(); - } - - var argumentsString = string.Join(" ", commandLineArguments); - - this.dataCollectorProcess = this.processHelper.LaunchProcess(dataCollectorProcessPath, argumentsString, processWorkingDirectory, null); - return this.dataCollectorProcess.Id; - } - - } -} \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/DataCollectionLauncherFactory.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/DataCollectionLauncherFactory.cs new file mode 100644 index 0000000000..98cf3a96af --- /dev/null +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/DataCollectionLauncherFactory.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +namespace Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.DataCollection +{ + using System; + + using Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.DataCollection.Interfaces; + + /// + /// Factory for creating DataCollectionLauncher + /// + internal static class DataCollectionLauncherFactory + { + /// + /// The get data collector launcher. + /// + /// + /// .NET framework version. + /// + /// + /// The . + /// + internal static IDataCollectionLauncher GetDataCollectorLauncher(string frameworkVersion) + { + if (frameworkVersion.IndexOf("netstandard", StringComparison.OrdinalIgnoreCase) >= 0 + || frameworkVersion.IndexOf("netcoreapp", StringComparison.OrdinalIgnoreCase) >= 0) + { + return new DotnetDataCollectionLauncher(); + } + + return new DefaultDataCollectionLauncher(); + } + } +} diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/DefaultDataCollectionLauncher.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/DefaultDataCollectionLauncher.cs new file mode 100644 index 0000000000..008f78089a --- /dev/null +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/DefaultDataCollectionLauncher.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +namespace Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.DataCollection +{ + using System.Collections.Generic; + using System.Diagnostics; + using System.IO; + using System.Reflection; + + using Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.DataCollection.Interfaces; + using Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Helpers; + using Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Helpers.Interfaces; + + /// + /// The datacollection launcher. + /// This works for Desktop local scenarios + /// + internal class DefaultDataCollectionLauncher : IDataCollectionLauncher + { + private const string DataCollectorProcessName = "datacollector.exe"; + private IProcessHelper processHelper; + + /// + /// The constructor. + /// + public DefaultDataCollectionLauncher() + : this(new ProcessHelper()) + { + } + + /// + /// Gets the data collector process info. + /// + internal Process DataCollectorProcess + { + get; private set; + } + + /// + /// Initializes a new instance of the class. + /// + /// + /// The process helper. + /// + internal DefaultDataCollectionLauncher(IProcessHelper processHelper) + { + this.processHelper = processHelper; + this.DataCollectorProcess = null; + } + + /// + /// Launches the test host for discovery/execution. + /// + /// Environment variables for the process. + /// The command line arguments to pass to the process. + /// ProcessId of launched Process. 0 means not launched. + public virtual int LaunchDataCollector(IDictionary environmentVariables, IList commandLineArguments) + { + var currentWorkingDirectory = Path.GetDirectoryName(typeof(DefaultDataCollectionLauncher).GetTypeInfo().Assembly.Location); + string dataCollectorProcessPath = null, processWorkingDirectory = null; + + dataCollectorProcessPath = Path.Combine(currentWorkingDirectory, DataCollectorProcessName); + // For IDEs and other scenario - Current directory should be the working directory - not the vstest.console.exe location + // For VS - this becomes the solution directory for example + // "TestResults" directory will be created at "current directory" of test host + processWorkingDirectory = Directory.GetCurrentDirectory(); + + var argumentsString = string.Join(" ", commandLineArguments); + + this.DataCollectorProcess = this.processHelper.LaunchProcess(dataCollectorProcessPath, argumentsString, processWorkingDirectory, null); + return this.DataCollectorProcess.Id; + } + } +} \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/DotnetDataCollectionLauncher.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/DotnetDataCollectionLauncher.cs new file mode 100644 index 0000000000..4c97a7a77a --- /dev/null +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/DotnetDataCollectionLauncher.cs @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +namespace Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.DataCollection +{ + using System; + using System.Collections.Generic; + using System.Diagnostics; + using System.IO; + using System.Reflection; + using System.Runtime.InteropServices; + + using Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.DataCollection.Interfaces; + using Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Helpers; + using Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Helpers.Interfaces; + using Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Resources; + using Microsoft.VisualStudio.TestPlatform.ObjectModel; + using Microsoft.VisualStudio.TestPlatform.Utilities.Helpers; + using Microsoft.VisualStudio.TestPlatform.Utilities.Helpers.Interfaces; + + /// + /// The datacollection launcher. + /// This works for Desktop local scenarios + /// + internal class DotnetDataCollectionLauncher : IDataCollectionLauncher + { + private const string DataCollectorProcessName = "datacollector.dll"; + private const string DotnetProcessName = "dotnet.exe"; + private const string DotnetProcessNameXPlat = "dotnet"; + + private IProcessHelper processHelper; + + private IFileHelper fileHelper; + + private IDotnetHostHelper dotnetHostHelper; + + /// + /// Initializes a new instance of the class. + /// + public DotnetDataCollectionLauncher() + : this(new ProcessHelper(), new FileHelper(), new DotnetHostHelper()) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// + /// The process helper. + /// + internal DotnetDataCollectionLauncher(IProcessHelper processHelper, IFileHelper fileHelper, IDotnetHostHelper dotnetHostHelper) + { + this.processHelper = processHelper; + this.DataCollectorProcess = null; + this.fileHelper = fileHelper; + this.dotnetHostHelper = dotnetHostHelper; + } + + /// + /// Gets the data collector process. + /// + internal Process DataCollectorProcess + { + get; private set; + } + + /// + /// Launches the test host for discovery/execution. + /// + /// Environment variables for the process. + /// The command line arguments to pass to the process. + /// ProcessId of launched Process. 0 means not launched. + public virtual int LaunchDataCollector(IDictionary environmentVariables, IList commandLineArguments) + { + string dataCollectorFileName = null; + var currentWorkingDirectory = Path.GetDirectoryName(typeof(DefaultDataCollectionLauncher).GetTypeInfo().Assembly.Location); + var currentProcessPath = this.processHelper.GetCurrentProcessFileName(); + + // TODO: DRY: Move this code to a common place + // If we are running in the dotnet.exe context we do not want to launch dataCollector.exe but dotnet.exe with the dataCollector assembly. + // Since dotnet.exe is already built for multiple platforms this would avoid building dataCollector.exe also in multiple platforms. + var currentProcessFileName = this.processHelper.GetCurrentProcessFileName(); + + // This host manager can create process start info for dotnet core targets only. + // If already running with the dotnet executable, use it; otherwise pick up the dotnet available on path. + // Wrap the paths with quotes in case dotnet executable is installed on a path with whitespace. + if (currentProcessPath.EndsWith(DotnetProcessNameXPlat, StringComparison.OrdinalIgnoreCase) + || currentProcessPath.EndsWith(DotnetProcessName, StringComparison.OrdinalIgnoreCase)) + { + currentProcessFileName = currentProcessPath; + } + else + { + currentProcessFileName = this.dotnetHostHelper.GetDotnetHostFullPath(); + } + + if (EqtTrace.IsVerboseEnabled) + { + EqtTrace.Verbose("DotnetDataCollectionLauncher: Full path of dotnet.exe is {0}", currentProcessFileName); + } + + var dataCollectorAssemblyPath = Path.Combine(currentWorkingDirectory, DataCollectorProcessName); + + dataCollectorFileName = Path.GetFileNameWithoutExtension(dataCollectorAssemblyPath); + + var args = "exec"; + + // Probe for runtimeconfig and deps file for the test source + var runtimeConfigPath = Path.Combine(currentWorkingDirectory, string.Concat(dataCollectorFileName, ".runtimeconfig.json")); + + if (this.fileHelper.Exists(runtimeConfigPath)) + { + var argsToAdd = " --runtimeconfig \"" + runtimeConfigPath + "\""; + args += argsToAdd; + if (EqtTrace.IsVerboseEnabled) + { + EqtTrace.Verbose("DotnetDataCollectionLauncher: Adding {0} in args", argsToAdd); + } + } + else + { + if (EqtTrace.IsVerboseEnabled) + { + EqtTrace.Verbose("DotnetDataCollectionLauncher: File {0}, doesnot exist", runtimeConfigPath); + } + } + + // Use the deps.json for test source + var depsFilePath = Path.Combine(currentWorkingDirectory, string.Concat(dataCollectorFileName, ".deps.json")); + if (this.fileHelper.Exists(depsFilePath)) + { + var argsToAdd = " --depsfile \"" + depsFilePath + "\""; + args += argsToAdd; + if (EqtTrace.IsVerboseEnabled) + { + EqtTrace.Verbose("DotnetDataCollectionLauncher: Adding {0} in args", argsToAdd); + } + } + else + { + if (EqtTrace.IsVerboseEnabled) + { + EqtTrace.Verbose("DotnetDataCollectionLauncher: File {0}, doesnot exist", depsFilePath); + } + } + + var cliArgs = string.Join(" ", commandLineArguments); + var argumentsString = string.Format("{0} {1} {2} ", args, dataCollectorAssemblyPath, cliArgs); + + this.DataCollectorProcess = this.processHelper.LaunchProcess(currentProcessFileName, argumentsString, currentWorkingDirectory, null); + return this.DataCollectorProcess.Id; + } + } +} \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/Interfaces/IDataCollectionLauncher.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/Interfaces/IDataCollectionLauncher.cs index df7443e94e..00b090d3a6 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/Interfaces/IDataCollectionLauncher.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/Interfaces/IDataCollectionLauncher.cs @@ -5,8 +5,6 @@ namespace Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.DataCollection.Int { using System.Collections.Generic; - using Microsoft.VisualStudio.TestPlatform.ObjectModel; - /// /// The DataCollectionLauncher interface. /// @@ -25,13 +23,5 @@ internal interface IDataCollectionLauncher /// The . /// int LaunchDataCollector(IDictionary environmentVariables, IList commandLineArguments); - - /// - /// The initialize. - /// - /// - /// The architecture. - /// - void Initialize(Architecture architecture); } } \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/ProxyDataCollectionManager.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/ProxyDataCollectionManager.cs index 09ef155634..fbb86b9319 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/ProxyDataCollectionManager.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/ProxyDataCollectionManager.cs @@ -7,14 +7,14 @@ namespace Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.DataCollection using System.Collections.Generic; using System.Collections.ObjectModel; + using Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.DataCollection; + using Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.DataCollection.Interfaces; using Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.DataCollection.Interfaces; using Microsoft.VisualStudio.TestPlatform.ObjectModel; using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client; - using Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.DataCollection.Interfaces; - using Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.DataCollection; /// - /// The test data collection client. + /// Managed datacollector interaction from runner process. /// internal class ProxyDataCollectionManager : IProxyDataCollectionManager { @@ -28,24 +28,30 @@ internal class ProxyDataCollectionManager : IProxyDataCollectionManager /// Initializes a new instance of the class. /// /// - /// The arch. + /// Architecture for datacollection process. /// /// - /// The settings Xml. + /// Runsettings that contains the datacollector related configuration. /// - public ProxyDataCollectionManager(Architecture arch, string settingsXml) - : this(arch, settingsXml, new DataCollectionRequestSender(), new DataCollectionLauncher()) + public ProxyDataCollectionManager(Architecture arch, string settingsXml, string targetFramework) + : this(arch, settingsXml, new DataCollectionRequestSender(), DataCollectionLauncherFactory.GetDataCollectorLauncher(targetFramework)) { } /// /// Initializes a new instance of the class. /// + /// + /// Architecture for datacollection process. + /// + /// + /// Runsettings that contains the datacollector related configuration. + /// /// - /// The data collection request sender. + /// Handles communication with datacollector process. /// /// - /// The data collection launcher. + /// Launches datacollector process. /// internal ProxyDataCollectionManager(Architecture arch, string settingsXml, IDataCollectionRequestSender dataCollectionRequestSender, IDataCollectionLauncher dataCollectionLauncher) { @@ -55,7 +61,6 @@ internal ProxyDataCollectionManager(Architecture arch, string settingsXml, IData this.InitializeSocketCommunication(arch); } - /// /// Invoked after ending of test run /// @@ -74,7 +79,7 @@ public Collection AfterTestRunEnd(bool isCanceled, ITestMessageEv this.InvokeDataCollectionServiceAction( () => { - attachmentSet = this.dataCollectionRequestSender.SendAfterTestRunStartAndGetResult(); + attachmentSet = this.dataCollectionRequestSender.SendAfterTestRunStartAndGetResult(runEventsHandler, isCanceled); }, runEventsHandler); return attachmentSet; @@ -100,15 +105,15 @@ public DataCollectionParameters BeforeTestRunStart( bool isRunStartingNow, ITestMessageEventHandler runEventsHandler) { - bool areTestCaseLevelEventsRequired = false; - bool isDataCollectionStarted = false; + var areTestCaseLevelEventsRequired = false; + var isDataCollectionStarted = false; IDictionary environmentVariables = null; var dataCollectionEventsPort = 0; this.InvokeDataCollectionServiceAction( () => { - var result = this.dataCollectionRequestSender.SendBeforeTestRunStartAndGetResult(settingsXml); + var result = this.dataCollectionRequestSender.SendBeforeTestRunStartAndGetResult(this.settingsXml, runEventsHandler); areTestCaseLevelEventsRequired = result.AreTestCaseLevelEventsRequired; environmentVariables = result.EnvironmentVariables; dataCollectionEventsPort = result.DataCollectionEventsPort; @@ -139,7 +144,6 @@ internal void InitializeSocketCommunication(Architecture arch) { var port = this.dataCollectionRequestSender.InitializeCommunication(); - this.dataCollectionLauncher.Initialize(arch); this.dataCollectionLauncher.LaunchDataCollector(null, this.GetCommandLineArguments(port)); this.dataCollectionRequestSender.WaitForRequestHandlerConnection(connectionTimeout: 5000); } diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Friends.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/Friends.cs index 56385a4fe9..1f150c35e9 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Friends.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Friends.cs @@ -6,4 +6,6 @@ [assembly: InternalsVisibleTo("Microsoft.TestPlatform.CrossPlatEngine.UnitTests, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")] [assembly: InternalsVisibleTo("vstest.console.UnitTests, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")] [assembly: InternalsVisibleTo("datacollector, PublicKey = 002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")] -[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7")] \ No newline at end of file +[assembly: InternalsVisibleTo("Microsoft.VisualStudio.TestPlatform.DataCollector.PlatformTests, PublicKey = 002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")] + +[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7")] diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Helpers/DotnetHostHelper.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/Helpers/DotnetHostHelper.cs new file mode 100644 index 0000000000..a16828ba8e --- /dev/null +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Helpers/DotnetHostHelper.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +namespace Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Helpers +{ + using Microsoft.VisualStudio.TestPlatform.ObjectModel; + using System; + using System.IO; + using System.Runtime.InteropServices; + using Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Resources; + using Microsoft.VisualStudio.TestPlatform.Utilities.Helpers.Interfaces; + using Microsoft.VisualStudio.TestPlatform.Utilities.Helpers; + using Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Helpers.Interfaces; + + internal class DotnetHostHelper : IDotnetHostHelper + { + private readonly IFileHelper fileHelper; + + /// + /// Initializes a new instance of the class. + /// + public DotnetHostHelper() : this(new FileHelper()) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// File Helper + public DotnetHostHelper(IFileHelper fileHelper) + { + this.fileHelper = fileHelper; + } + + /// + public string GetDotnetHostFullPath() + { + char separator = ';'; + var dotnetExeName = "dotnet.exe"; + +#if !NET46 + // Use semicolon(;) as path separator for windows + // colon(:) for Linux and OSX + if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + { + separator = ':'; + dotnetExeName = "dotnet"; + } +#endif + + var pathString = Environment.GetEnvironmentVariable("PATH"); + foreach (string path in pathString.Split(separator)) + { + string exeFullPath = Path.Combine(path.Trim(), dotnetExeName); + if (this.fileHelper.Exists(exeFullPath)) + { + return exeFullPath; + } + } + + string errorMessage = String.Format(Resources.NoDotnetExeFound, dotnetExeName); + EqtTrace.Error(errorMessage); + throw new FileNotFoundException(errorMessage); + } + } +} diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Helpers/Interfaces/IDotnetHostHelper.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/Helpers/Interfaces/IDotnetHostHelper.cs new file mode 100644 index 0000000000..b70dfb9c7c --- /dev/null +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Helpers/Interfaces/IDotnetHostHelper.cs @@ -0,0 +1,18 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +namespace Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Helpers.Interfaces +{ + /// + /// Helper class for getting info about dotnet host. + /// + internal interface IDotnetHostHelper + { + /// + /// Get full path for the .net host + /// + /// Full path to dotnet executable + /// Debuggers require the full path of executable to launch it. + string GetDotnetHostFullPath(); + } +} diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Hosting/DotnetTestHostManager.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/Hosting/DotnetTestHostManager.cs index 502e968379..e52bcadb23 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Hosting/DotnetTestHostManager.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Hosting/DotnetTestHostManager.cs @@ -8,8 +8,9 @@ namespace Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Hosting using System.Diagnostics; using System.IO; using System.Linq; - using System.Runtime.InteropServices; + using Microsoft.Extensions.DependencyModel; + using Microsoft.VisualStudio.TestPlatform.Common.Logging; using Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Resources; using Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Helpers; using Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Helpers.Interfaces; @@ -18,11 +19,9 @@ namespace Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Hosting using Microsoft.VisualStudio.TestPlatform.ObjectModel.Engine; using Microsoft.VisualStudio.TestPlatform.Utilities.Helpers; using Microsoft.VisualStudio.TestPlatform.Utilities.Helpers.Interfaces; + using Newtonsoft.Json; using Newtonsoft.Json.Linq; - using Microsoft.Extensions.DependencyModel; - using Common.Logging; - using ObjectModel.Logging; /// /// A host manager for dotnet core runtime. @@ -43,13 +42,15 @@ public class DotnetTestHostManager : ITestHostManager private EventHandler registeredExitHandler; + private IDotnetHostHelper dotnetHostHelper; + private TestSessionMessageLogger logger = TestSessionMessageLogger.Instance; /// /// Initializes a new instance of the class. /// public DotnetTestHostManager() - : this(new DefaultTestHostLauncher(), new ProcessHelper(), new FileHelper()) + : this(new DefaultTestHostLauncher(), new ProcessHelper(), new FileHelper(), new DotnetHostHelper()) { } @@ -62,11 +63,12 @@ public DotnetTestHostManager() internal DotnetTestHostManager( ITestHostLauncher testHostLauncher, IProcessHelper processHelper, - IFileHelper fileHelper) + IFileHelper fileHelper, IDotnetHostHelper dotnetHostHelper) { this.testHostLauncher = testHostLauncher; this.processHelper = processHelper; this.fileHelper = fileHelper; + this.dotnetHostHelper = dotnetHostHelper; } /// @@ -112,7 +114,7 @@ public virtual TestProcessStartInfo GetTestHostProcessStartInfo( } else { - startInfo.FileName = this.GetDotnetHostFullPath(); + startInfo.FileName = this.dotnetHostHelper.GetDotnetHostFullPath(); } EqtTrace.Verbose("DotnetTestHostmanager: Full path of dotnet.exe is {0}", startInfo.FileName); @@ -214,41 +216,6 @@ public void DeregisterForExitNotification() } } - /// - /// Get full path for the .net host - /// - /// Full path to dotnet executable - /// Debuggers require the full path of executable to launch it. - private string GetDotnetHostFullPath() - { - char separator = ';'; - var dotnetExeName = "dotnet.exe"; - -#if !NET46 - // Use semicolon(;) as path separator for windows - // colon(:) for Linux and OSX - if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) - { - separator = ':'; - dotnetExeName = "dotnet"; - } -#endif - - var pathString = Environment.GetEnvironmentVariable("PATH"); - foreach (string path in pathString.Split(separator)) - { - string exeFullPath = Path.Combine(path.Trim(), dotnetExeName); - if (this.fileHelper.Exists(exeFullPath)) - { - return exeFullPath; - } - } - - string errorMessage = String.Format(Resources.NoDotnetExeFound, dotnetExeName); - EqtTrace.Error(errorMessage); - throw new FileNotFoundException(errorMessage); - } - private string GetTestHostPath(string runtimeConfigDevPath, string depsFilePath, string sourceDirectory) { string testHostPackageName = "microsoft.testplatform.testhost"; diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/TestEngine.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/TestEngine.cs index c2cf3498b5..b03b898d2f 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/TestEngine.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/TestEngine.cs @@ -23,7 +23,7 @@ namespace Microsoft.VisualStudio.TestPlatform.CrossPlatEngine public class TestEngine : ITestEngine { #region Private Fields - + private ITestExtensionManager testExtensionManager; #endregion @@ -71,7 +71,7 @@ public IProxyExecutionManager GetExecutionManager(ITestHostManager testHostManag Func proxyExecutionManagerCreator = () => isDataCollectorEnabled - ? new ProxyExecutionManagerWithDataCollection(testHostManager, this.GetDataCollectionManager(architecture, testRunCriteria.TestRunSettings)) + ? new ProxyExecutionManagerWithDataCollection(testHostManager, this.GetDataCollectionManager(architecture, testRunCriteria.TestRunSettings, runconfiguration.TargetFrameworkVersion.Name)) : new ProxyExecutionManager(testHostManager); // parallelLevel = 1 for desktop should go via else route. @@ -117,7 +117,7 @@ public ITestHostManager GetDefaultTestHostManager(RunConfiguration runConfigurat } #endregion - + private static int GetDistinctNumberOfSources(TestRunCriteria testRunCriteria) { // No point in creating more processes if number of sources is less than what user configured for @@ -179,11 +179,11 @@ private int VerifyParallelSettingAndCalculateParallelLevel(int sourceCount, stri return parallelLevelToUse; } - private IProxyDataCollectionManager GetDataCollectionManager(Architecture architecture, string settingsXml) + private IProxyDataCollectionManager GetDataCollectionManager(Architecture architecture, string settingsXml, string targetFramework) { try { - return new ProxyDataCollectionManager(architecture, settingsXml); + return new ProxyDataCollectionManager(architecture, settingsXml, targetFramework); } catch (Exception ex) { diff --git a/src/Microsoft.TestPlatform.ObjectModel/DataCollector/Attributes/DataCollectorFriendlyNameAttribute.cs b/src/Microsoft.TestPlatform.ObjectModel/DataCollector/Attributes/DataCollectorFriendlyNameAttribute.cs index c9ff1cd1db..90617e7a48 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/DataCollector/Attributes/DataCollectorFriendlyNameAttribute.cs +++ b/src/Microsoft.TestPlatform.ObjectModel/DataCollector/Attributes/DataCollectorFriendlyNameAttribute.cs @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -namespace Microsoft.VisualStudio.TestPlatform.ObjectModel.DataCollector +namespace Microsoft.VisualStudio.TestPlatform.ObjectModel.DataCollection { using System; diff --git a/src/Microsoft.TestPlatform.ObjectModel/DataCollector/Attributes/DataCollectorTypeUriAttribute.cs b/src/Microsoft.TestPlatform.ObjectModel/DataCollector/Attributes/DataCollectorTypeUriAttribute.cs index 902c22f63d..02571871a3 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/DataCollector/Attributes/DataCollectorTypeUriAttribute.cs +++ b/src/Microsoft.TestPlatform.ObjectModel/DataCollector/Attributes/DataCollectorTypeUriAttribute.cs @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -namespace Microsoft.VisualStudio.TestPlatform.ObjectModel.DataCollector +namespace Microsoft.VisualStudio.TestPlatform.ObjectModel.DataCollection { using System; diff --git a/src/Microsoft.TestPlatform.ObjectModel/DataCollector/ITestExecutionEnvironmentSpecifier.cs b/src/Microsoft.TestPlatform.ObjectModel/DataCollector/ITestExecutionEnvironmentSpecifier.cs index c840a2b0c7..462a15d078 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/DataCollector/ITestExecutionEnvironmentSpecifier.cs +++ b/src/Microsoft.TestPlatform.ObjectModel/DataCollector/ITestExecutionEnvironmentSpecifier.cs @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -namespace Microsoft.VisualStudio.TestPlatform.ObjectModel.DataCollector +namespace Microsoft.VisualStudio.TestPlatform.ObjectModel.DataCollection { using System.Collections.Generic; diff --git a/src/Microsoft.TestPlatform.ObjectModel/Friends.cs b/src/Microsoft.TestPlatform.ObjectModel/Friends.cs index 8988fc37e9..9bcec7aca2 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/Friends.cs +++ b/src/Microsoft.TestPlatform.ObjectModel/Friends.cs @@ -7,6 +7,7 @@ [assembly: InternalsVisibleTo("Microsoft.VisualStudio.TestPlatform.Extensions.MSAppContainerAdapter, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")] [assembly: InternalsVisibleTo("Microsoft.VisualStudio.TestPlatform.Extensions.MSPhoneAdapter, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")] [assembly: InternalsVisibleTo("datacollector, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")] +[assembly: InternalsVisibleTo("Microsoft.VisualStudio.TestPlatform.Common, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")] [assembly: InternalsVisibleTo("Microsoft.TestPlatform.ObjectModel.UnitTests, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")] [assembly: InternalsVisibleTo("datacollector.UnitTests, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")] diff --git a/src/datacollector/MessageSink.cs b/src/datacollector/MessageSink.cs index 03ec0ef8dc..e6499dd201 100644 --- a/src/datacollector/MessageSink.cs +++ b/src/datacollector/MessageSink.cs @@ -4,7 +4,7 @@ namespace Microsoft.VisualStudio.TestPlatform.DataCollector { using Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.DataCollection; - using Microsoft.VisualStudio.TestPlatform.DataCollector.Interfaces; + using Microsoft.VisualStudio.TestPlatform.Common.DataCollector.Interfaces; using Microsoft.VisualStudio.TestPlatform.ObjectModel.Logging; /// diff --git a/src/datacollector/Program.cs b/src/datacollector/Program.cs index e1abf1e82d..31236512d6 100644 --- a/src/datacollector/Program.cs +++ b/src/datacollector/Program.cs @@ -6,7 +6,6 @@ namespace Microsoft.VisualStudio.TestPlatform.DataCollector using System; using Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.DataCollection; - using Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.DataCollection; using Microsoft.VisualStudio.TestPlatform.ObjectModel; /// @@ -72,7 +71,9 @@ private static void ParseArgs(string[] args) private static void Run() { - var requestHandler = new DataCollectionRequestHandler(); + var requestHandler = new DataCollectionRequestHandler(new MessageSink()); + DataCollectionRequestHandler.RequestHandler = requestHandler; + requestHandler.InitializeCommunication(port); // Wait for the connection to the sender and start processing requests from sender diff --git a/src/datacollector/Resources/Resources.Designer.cs b/src/datacollector/Resources/Resources.Designer.cs deleted file mode 100644 index 0e6684ddce..0000000000 --- a/src/datacollector/Resources/Resources.Designer.cs +++ /dev/null @@ -1,199 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace Microsoft.VisualStudio.TestPlatform.DataCollector.Resources { - using System; - using System.Reflection; - - - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // This class was auto-generated by the StronglyTypedResourceBuilder - // 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", "4.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() { - } - - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - 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.DataCollector.Resources.Resources", typeof(Resources).GetTypeInfo().Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } - } - - /// - /// Looks up a localized string similar to An error occurred while retrieving the attributes for the diagnostic data adapter of type '{0}'.. - /// - internal static string AttributeRetrievalError { - get { - return ResourceManager.GetString("AttributeRetrievalError", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Diagnostic data adapter type URI cannot be null or empty. The type URI for the diagnostic data adapter of type '{0}' is null or empty.. - /// - internal static string DataCollector_TypeIsNull { - get { - return ResourceManager.GetString("DataCollector_TypeIsNull", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Could not find diagnostic data adapter '{0}'. Make sure diagnostic data adapter is installed and try again.. - /// - internal static string DataCollectorAssemblyNotFound { - get { - return ResourceManager.GetString("DataCollectorAssemblyNotFound", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Diagnostic data adapter '{0}' failed to provide intialization information. Error: {1}. - /// - internal static string DataCollectorErrorOnGetVariable { - get { - return ResourceManager.GetString("DataCollectorErrorOnGetVariable", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to The diagnostic data adapter '{0}' threw an exception during type loading, construction, or initialization: {1}.. - /// - internal static string DataCollectorInitializationError { - get { - return ResourceManager.GetString("DataCollectorInitializationError", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Could not find diagnostic data adapter of type '{0}' and Uri '{1}'. - /// - internal static string DataCollectorNotFound { - get { - return ResourceManager.GetString("DataCollectorNotFound", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to The diagnostic data adapter '{0}' requested environment variable '{1}' with value '{2}' to be set in test execution environment, but another diagnostic data adapter '{3}' has already requested same environment variable with different value '{4}'.. - /// - internal static string DataCollectorRequestedDuplicateEnvironmentVariable { - get { - return ResourceManager.GetString("DataCollectorRequestedDuplicateEnvironmentVariable", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to The required diagnostic data adapter attribute '{0}' is missing for the diagnostic data adapter of type '{1}'.. - /// - internal static string DataCollectorRequiredAttributeMissing { - get { - return ResourceManager.GetString("DataCollectorRequiredAttributeMissing", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Failed to get type for diagnostic data adapter '{0}'. Error: {1}.. - /// - internal static string DataCollectorTypeNotFound { - get { - return ResourceManager.GetString("DataCollectorTypeNotFound", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Invalid URI format. The URI '{0}' provided for the diagnostic data adapter of type '{1}' is not a valid URI.. - /// - internal static string DataCollectorTypeUriFormatInvalid { - get { - return ResourceManager.GetString("DataCollectorTypeUriFormatInvalid", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Sending message of Message Type '{0}' is not supported.. - /// - internal static string DataCollectorUnsupportedMessageType { - get { - return ResourceManager.GetString("DataCollectorUnsupportedMessageType", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Diagnostic data adapter friendly names cannot be null or empty. The friendly name for the diagnostic data adapter of type '{0}' is null or empty.. - /// - internal static string FriendlyNameIsNullOrEmpty { - get { - return ResourceManager.GetString("FriendlyNameIsNullOrEmpty", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to There are multiple configurations that have diagnostic data adapter type '{0}' or Uri '{1}'. Duplicate configurations will be ignored in the test run.. - /// - internal static string IgnoredDuplicateConfiguration { - get { - return ResourceManager.GetString("IgnoredDuplicateConfiguration", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Diagnostic data adapter caught an exception of type '{0}': '{1}'. More details: {2}.. - /// - internal static string ReportDataCollectorException { - get { - return ResourceManager.GetString("ReportDataCollectorException", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Types deriving from the data collection context cannot be used for sending data and messages. The DataCollectionContext used for sending data and messages must come from one of the events raised to the data collector.. - /// - internal static string WrongDataCollectionContextType { - get { - return ResourceManager.GetString("WrongDataCollectionContextType", resourceCulture); - } - } - } -} diff --git a/src/datacollector/Resources/Resources.resx b/src/datacollector/Resources/Resources.resx deleted file mode 100644 index 69f7c7248f..0000000000 --- a/src/datacollector/Resources/Resources.resx +++ /dev/null @@ -1,165 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - An error occurred while retrieving the attributes for the diagnostic data adapter of type '{0}'. - - - Could not find diagnostic data adapter '{0}'. Make sure diagnostic data adapter is installed and try again. - - - The diagnostic data adapter '{0}' threw an exception during type loading, construction, or initialization: {1}. - - - Could not find diagnostic data adapter of type '{0}' and Uri '{1}' - - - The required diagnostic data adapter attribute '{0}' is missing for the diagnostic data adapter of type '{1}'. - - - Failed to get type for diagnostic data adapter '{0}'. Error: {1}. - - - Invalid URI format. The URI '{0}' provided for the diagnostic data adapter of type '{1}' is not a valid URI. - - - Sending message of Message Type '{0}' is not supported. - - - Diagnostic data adapter type URI cannot be null or empty. The type URI for the diagnostic data adapter of type '{0}' is null or empty. - - - There are multiple configurations that have diagnostic data adapter type '{0}' or Uri '{1}'. Duplicate configurations will be ignored in the test run. - - - Diagnostic data adapter caught an exception of type '{0}': '{1}'. More details: {2}. - - - Types deriving from the data collection context cannot be used for sending data and messages. The DataCollectionContext used for sending data and messages must come from one of the events raised to the data collector. - - - Diagnostic data adapter friendly names cannot be null or empty. The friendly name for the diagnostic data adapter of type '{0}' is null or empty. - - - Diagnostic data adapter '{0}' failed to provide intialization information. Error: {1} - - - The diagnostic data adapter '{0}' requested environment variable '{1}' with value '{2}' to be set in test execution environment, but another diagnostic data adapter '{3}' has already requested same environment variable with different value '{4}'. - - \ No newline at end of file diff --git a/src/datacollector/Resources/xlf/Resources.cs.xlf b/src/datacollector/Resources/xlf/Resources.cs.xlf deleted file mode 100644 index d5b50f8278..0000000000 --- a/src/datacollector/Resources/xlf/Resources.cs.xlf +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - The test run could not be executed because the initial state was invalid. - The test run could not be executed because the initial state was invalid. - - - - Wait for completion operation is not allowed when there is no active test run. - Wait for completion operation is not allowed when there is no active test run. - - - - - \ No newline at end of file diff --git a/src/datacollector/Resources/xlf/Resources.de.xlf b/src/datacollector/Resources/xlf/Resources.de.xlf deleted file mode 100644 index 499162759f..0000000000 --- a/src/datacollector/Resources/xlf/Resources.de.xlf +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - The test run could not be executed because the initial state was invalid. - The test run could not be executed because the initial state was invalid. - - - - Wait for completion operation is not allowed when there is no active test run. - Wait for completion operation is not allowed when there is no active test run. - - - - - \ No newline at end of file diff --git a/src/datacollector/Resources/xlf/Resources.es.xlf b/src/datacollector/Resources/xlf/Resources.es.xlf deleted file mode 100644 index d5b50f8278..0000000000 --- a/src/datacollector/Resources/xlf/Resources.es.xlf +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - The test run could not be executed because the initial state was invalid. - The test run could not be executed because the initial state was invalid. - - - - Wait for completion operation is not allowed when there is no active test run. - Wait for completion operation is not allowed when there is no active test run. - - - - - \ No newline at end of file diff --git a/src/datacollector/Resources/xlf/Resources.fr.xlf b/src/datacollector/Resources/xlf/Resources.fr.xlf deleted file mode 100644 index 605666ca79..0000000000 --- a/src/datacollector/Resources/xlf/Resources.fr.xlf +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - The test run could not be executed because the initial state was invalid. - The test run could not be executed because the initial state was invalid. - - - - Wait for completion operation is not allowed when there is no active test run. - Wait for completion operation is not allowed when there is no active test run. - - - - - \ No newline at end of file diff --git a/src/datacollector/Resources/xlf/Resources.it.xlf b/src/datacollector/Resources/xlf/Resources.it.xlf deleted file mode 100644 index ec1d98950c..0000000000 --- a/src/datacollector/Resources/xlf/Resources.it.xlf +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - The test run could not be executed because the initial state was invalid. - The test run could not be executed because the initial state was invalid. - - - - Wait for completion operation is not allowed when there is no active test run. - Wait for completion operation is not allowed when there is no active test run. - - - - - \ No newline at end of file diff --git a/src/datacollector/Resources/xlf/Resources.ja.xlf b/src/datacollector/Resources/xlf/Resources.ja.xlf deleted file mode 100644 index 458f62285c..0000000000 --- a/src/datacollector/Resources/xlf/Resources.ja.xlf +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - The test run could not be executed because the initial state was invalid. - The test run could not be executed because the initial state was invalid. - - - - Wait for completion operation is not allowed when there is no active test run. - Wait for completion operation is not allowed when there is no active test run. - - - - - \ No newline at end of file diff --git a/src/datacollector/Resources/xlf/Resources.ko.xlf b/src/datacollector/Resources/xlf/Resources.ko.xlf deleted file mode 100644 index a01458d86b..0000000000 --- a/src/datacollector/Resources/xlf/Resources.ko.xlf +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - The test run could not be executed because the initial state was invalid. - The test run could not be executed because the initial state was invalid. - - - - Wait for completion operation is not allowed when there is no active test run. - Wait for completion operation is not allowed when there is no active test run. - - - - - \ No newline at end of file diff --git a/src/datacollector/Resources/xlf/Resources.pl.xlf b/src/datacollector/Resources/xlf/Resources.pl.xlf deleted file mode 100644 index 56a4238785..0000000000 --- a/src/datacollector/Resources/xlf/Resources.pl.xlf +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - The test run could not be executed because the initial state was invalid. - The test run could not be executed because the initial state was invalid. - - - - Wait for completion operation is not allowed when there is no active test run. - Wait for completion operation is not allowed when there is no active test run. - - - - - \ No newline at end of file diff --git a/src/datacollector/Resources/xlf/Resources.pt-BR.xlf b/src/datacollector/Resources/xlf/Resources.pt-BR.xlf deleted file mode 100644 index b86ed4d5f4..0000000000 --- a/src/datacollector/Resources/xlf/Resources.pt-BR.xlf +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - The test run could not be executed because the initial state was invalid. - The test run could not be executed because the initial state was invalid. - - - - Wait for completion operation is not allowed when there is no active test run. - Wait for completion operation is not allowed when there is no active test run. - - - - - \ No newline at end of file diff --git a/src/datacollector/Resources/xlf/Resources.ru.xlf b/src/datacollector/Resources/xlf/Resources.ru.xlf deleted file mode 100644 index d433d1be53..0000000000 --- a/src/datacollector/Resources/xlf/Resources.ru.xlf +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - The test run could not be executed because the initial state was invalid. - The test run could not be executed because the initial state was invalid. - - - - Wait for completion operation is not allowed when there is no active test run. - Wait for completion operation is not allowed when there is no active test run. - - - - - \ No newline at end of file diff --git a/src/datacollector/Resources/xlf/Resources.tr.xlf b/src/datacollector/Resources/xlf/Resources.tr.xlf deleted file mode 100644 index 0008b20fa6..0000000000 --- a/src/datacollector/Resources/xlf/Resources.tr.xlf +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - The test run could not be executed because the initial state was invalid. - The test run could not be executed because the initial state was invalid. - - - - Wait for completion operation is not allowed when there is no active test run. - Wait for completion operation is not allowed when there is no active test run. - - - - - \ No newline at end of file diff --git a/src/datacollector/Resources/xlf/Resources.xlf b/src/datacollector/Resources/xlf/Resources.xlf deleted file mode 100644 index c72b0209b2..0000000000 --- a/src/datacollector/Resources/xlf/Resources.xlf +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - The test run could not be executed because the initial state was invalid. - - - - Wait for completion operation is not allowed when there is no active test run. - - - - - \ No newline at end of file diff --git a/src/datacollector/Resources/xlf/Resources.zh-Hans.xlf b/src/datacollector/Resources/xlf/Resources.zh-Hans.xlf deleted file mode 100644 index 4d6d84d4dc..0000000000 --- a/src/datacollector/Resources/xlf/Resources.zh-Hans.xlf +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - The test run could not be executed because the initial state was invalid. - The test run could not be executed because the initial state was invalid. - - - - Wait for completion operation is not allowed when there is no active test run. - Wait for completion operation is not allowed when there is no active test run. - - - - - \ No newline at end of file diff --git a/src/datacollector/Resources/xlf/Resources.zh-Hant.xlf b/src/datacollector/Resources/xlf/Resources.zh-Hant.xlf deleted file mode 100644 index 975d46faac..0000000000 --- a/src/datacollector/Resources/xlf/Resources.zh-Hant.xlf +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - The test run could not be executed because the initial state was invalid. - The test run could not be executed because the initial state was invalid. - - - - Wait for completion operation is not allowed when there is no active test run. - Wait for completion operation is not allowed when there is no active test run. - - - - - \ No newline at end of file diff --git a/src/datacollector/datacollector.csproj b/src/datacollector/datacollector.csproj index 29fbc35f33..f588ffc52f 100644 --- a/src/datacollector/datacollector.csproj +++ b/src/datacollector/datacollector.csproj @@ -18,12 +18,6 @@ win7-x64 - - - ResXFileCodeGenerator - Resources.Designer.cs - - @@ -56,15 +50,5 @@ - - - True - True - Resources.resx - - - - - \ No newline at end of file diff --git a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/DataCollection/ProxyDataCollectionManagerTests.cs b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/DataCollection/ProxyDataCollectionManagerTests.cs index 09db08b4a0..9b8fc13a06 100644 --- a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/DataCollection/ProxyDataCollectionManagerTests.cs +++ b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/DataCollection/ProxyDataCollectionManagerTests.cs @@ -38,7 +38,6 @@ public void InitializeSocketCommunicationShouldInitializeCommunication() { this.proxyDataCollectionManager.InitializeSocketCommunication(Architecture.X86); - Assert.IsTrue(this.mockDataCollectionLauncher.isInitialized); Assert.IsTrue(this.mockDataCollectionLauncher.dataCollectorLaunched); Assert.IsTrue(this.mockDataCollectionRequestSender.waitForRequestHandlerConnection); Assert.AreEqual(5000, this.mockDataCollectionRequestSender.connectionTimeout); @@ -133,7 +132,7 @@ public int InitializeCommunication() return 1; } - public Collection SendAfterTestRunStartAndGetResult() + public Collection SendAfterTestRunStartAndGetResult(ITestMessageEventHandler handler, bool isCancelled) { if (sendAfterTestRunStartAndGetResultThrowException) { @@ -144,7 +143,7 @@ public Collection SendAfterTestRunStartAndGetResult() return Attachments; } - public BeforeTestRunStartResult SendBeforeTestRunStartAndGetResult(string settingXml) + public BeforeTestRunStartResult SendBeforeTestRunStartAndGetResult(string settingXml, ITestMessageEventHandler handler) { if (this.sendBeforeTestRunStartAndGetResultThrowException) { @@ -166,12 +165,7 @@ public bool WaitForRequestHandlerConnection(int connectionTimeout) internal class DummyDataCollectionLauncher : IDataCollectionLauncher { - public bool isInitialized; public bool dataCollectorLaunched; - public void Initialize(Architecture architecture) - { - this.isInitialized = true; - } public int LaunchDataCollector(IDictionary environmentVariables, IList commandLineArguments) { diff --git a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Hosting/DotnetTestHostManagerTests.cs b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Hosting/DotnetTestHostManagerTests.cs index 1ba568eccb..9678b92144 100644 --- a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Hosting/DotnetTestHostManagerTests.cs +++ b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Hosting/DotnetTestHostManagerTests.cs @@ -11,6 +11,7 @@ namespace TestPlatform.CrossPlatEngine.UnitTests.Hosting using System.Runtime.InteropServices; using System.Text; + using Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Helpers; using Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Helpers.Interfaces; using Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Hosting; using Microsoft.VisualStudio.TestPlatform.ObjectModel; @@ -47,7 +48,8 @@ public DotnetTestHostManagerTests() this.dotnetHostManager = new TestableDotnetTestHostManager( this.mockTestHostLauncher.Object, this.mockProcessHelper.Object, - this.mockFileHelper.Object); + this.mockFileHelper.Object, + new DotnetHostHelper(this.mockFileHelper.Object)); // Setup a dummy current process for tests this.mockProcessHelper.Setup(ph => ph.GetCurrentProcessFileName()).Returns(DefaultDotnetPath); @@ -419,8 +421,8 @@ private TestProcessStartInfo GetDefaultStartInfo() internal class TestableDotnetTestHostManager : DotnetTestHostManager { - public TestableDotnetTestHostManager(ITestHostLauncher testHostLauncher, IProcessHelper processHelper, IFileHelper fileHelper) - : base(testHostLauncher, processHelper, fileHelper) + public TestableDotnetTestHostManager(ITestHostLauncher testHostLauncher, IProcessHelper processHelper, IFileHelper fileHelper, IDotnetHostHelper dotnetTestHostHelper) + : base(testHostLauncher, processHelper, fileHelper, dotnetTestHostHelper) { } } diff --git a/test/Microsoft.TestPlatform.ObjectModel.PlatformTests/Program.cs b/test/Microsoft.TestPlatform.ObjectModel.PlatformTests/Program.cs index 2b0a2502e7..b60b16a4a8 100644 --- a/test/Microsoft.TestPlatform.ObjectModel.PlatformTests/Program.cs +++ b/test/Microsoft.TestPlatform.ObjectModel.PlatformTests/Program.cs @@ -1,6 +1,6 @@ // Copyright (c) Microsoft. All rights reserved. -namespace Microsoft.VisualStudio.TestPlatform.DataCollector.UnitTests +namespace Microsoft.VisualStudio.TestPlatform.Common.DataCollector.UnitTests { /// /// Main entry point for the command line runner. diff --git a/test/TestAssets/OutOfProcDataCollector/OutOfProcDataCollector.csproj b/test/TestAssets/OutOfProcDataCollector/OutOfProcDataCollector.csproj new file mode 100644 index 0000000000..a98091174c --- /dev/null +++ b/test/TestAssets/OutOfProcDataCollector/OutOfProcDataCollector.csproj @@ -0,0 +1,8 @@ + + + netcoreapp1.0;net46 + + + + + \ No newline at end of file diff --git a/test/TestAssets/OutOfProcDataCollector/SampleDataCollector.cs b/test/TestAssets/OutOfProcDataCollector/SampleDataCollector.cs new file mode 100644 index 0000000000..d79e737f8b --- /dev/null +++ b/test/TestAssets/OutOfProcDataCollector/SampleDataCollector.cs @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +namespace OutOfProcDataCollector +{ + using System; + using System.Collections.Generic; + using Microsoft.VisualStudio.TestPlatform.ObjectModel.DataCollection; + using System.IO; + + [DataCollectorFriendlyName("SampleDataCollector")] + [DataCollectorTypeUri("my://sample/datacollector")] + public class SampleDataCollector : DataCollector, ITestExecutionEnvironmentSpecifier + { + private DataCollectionSink dataCollectionSink; + private DataCollectionEnvironmentContext context; + private DataCollectionLogger logger; + + public override void Initialize( + System.Xml.XmlElement configurationElement, + DataCollectionEvents events, + DataCollectionSink dataSink, + DataCollectionLogger logger, + DataCollectionEnvironmentContext environmentContext) + { + events.SessionStart += new EventHandler(this.SessionStarted_Handler); + events.SessionEnd += new EventHandler(this.SessionEnded_Handler); + this.dataCollectionSink = dataSink; + this.context = environmentContext; + this.logger = logger; + } + + private void SessionStarted_Handler(object sender, SessionStartEventArgs args) + { + var filename = Path.Combine(AppContext.BaseDirectory, "filename.txt"); + File.WriteAllText(filename, string.Empty); + this.dataCollectionSink.SendFileAsync(context.SessionDataCollectionContext, filename, true); + this.logger.LogWarning(this.context.SessionDataCollectionContext, "SessionEnded"); + } + + private void SessionEnded_Handler(object sender, SessionEndEventArgs args) + { + //logger.LogError(this.context.SessionDataCollectionContext, new Exception("my exception")); + //logger.LogWarning(this.context.SessionDataCollectionContext, "my arning"); + //logger.LogException(context.SessionDataCollectionContext, new Exception("abc"), DataCollectorMessageLevel.Error); + + this.logger.LogWarning(this.context.SessionDataCollectionContext, "SessionEnded"); + } + + public IEnumerable> GetTestExecutionEnvironmentVariables() + { + return new List> { new KeyValuePair("key", "value") }; + } + } +} \ No newline at end of file diff --git a/test/datacollector.PlatformTests/CommunicationLayerIntegrationTests.cs b/test/datacollector.PlatformTests/CommunicationLayerIntegrationTests.cs new file mode 100644 index 0000000000..6348dee6b2 --- /dev/null +++ b/test/datacollector.PlatformTests/CommunicationLayerIntegrationTests.cs @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +namespace Microsoft.VisualStudio.TestPlatform.DataCollector.PlatformTests +{ + using System.Diagnostics; + using System.Reflection; + + using Microsoft.VisualStudio.TestPlatform.CommunicationUtilities; + using Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.DataCollection; + using Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.DataCollection; + using Microsoft.VisualStudio.TestTools.UnitTesting; + + using Moq; + using System; + using Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.DataCollection.Interfaces; + + [TestClass] + public class CommunicationLayerIntegrationTests + { + private string defaultRunSettings = "\r\n\r\n \r\n {0}\r\n \r\n"; + private Mock mockTestMessageEventHandler; + private string dataCollectorSettings, runSettings; + private IDataCollectionLauncher dataCollectionLauncher; + + public CommunicationLayerIntegrationTests() + { + this.mockTestMessageEventHandler = new Mock(); + this.dataCollectorSettings = string.Format("", typeof(CustomDataCollector).AssemblyQualifiedName, typeof(CustomDataCollector).GetTypeInfo().Assembly.Location); + this.runSettings = string.Format(this.defaultRunSettings, this.dataCollectorSettings); +#if NET46 + this.dataCollectionLauncher = new DefaultDataCollectionLauncher(); +#else + this.dataCollectionLauncher = new DotnetDataCollectionLauncher(); +#endif + } + + [TestMethod] + public void BeforeTestRunStartShouldGetEnviornmentVariables() + { + var dataCollectionRequestSender = new DataCollectionRequestSender(); + + using (var proxyDataCollectionManager = new ProxyDataCollectionManager(ObjectModel.Architecture.AnyCPU, this.runSettings, dataCollectionRequestSender, this.dataCollectionLauncher)) + { + var result = proxyDataCollectionManager.BeforeTestRunStart(true, true, this.mockTestMessageEventHandler.Object); + + Assert.AreEqual(1, result.EnvironmentVariables.Count); + } + } + + [TestMethod] + public void AfterTestRunShouldSendGetAttachments() + { + var dataCollectionRequestSender = new DataCollectionRequestSender(); + + using (var proxyDataCollectionManager = new ProxyDataCollectionManager(ObjectModel.Architecture.AnyCPU, this.runSettings, dataCollectionRequestSender, this.dataCollectionLauncher)) + { + proxyDataCollectionManager.BeforeTestRunStart(true, true, this.mockTestMessageEventHandler.Object); + + var attachments = proxyDataCollectionManager.AfterTestRunEnd(false, this.mockTestMessageEventHandler.Object); + + Assert.AreEqual("CustomDataCollector", attachments[0].DisplayName); + Assert.AreEqual("my://custom/datacollector", attachments[0].Uri.ToString()); + Assert.IsTrue(attachments[0].Attachments[0].Uri.ToString().Contains("filename.txt")); + } + } + + [TestMethod] + public void AfterTestRunShouldHandleSocketFailureGracefully() + { + var socketCommManager = new SocketCommunicationManager(); + var dataCollectionRequestSender = new DataCollectionRequestSender(socketCommManager, JsonDataSerializer.Instance); +#if NET46 + var dataCollectionLauncher = new DefaultDataCollectionLauncher(); +#else + var dataCollectionLauncher = new DotnetDataCollectionLauncher(); +#endif + using (var proxyDataCollectionManager = new ProxyDataCollectionManager(ObjectModel.Architecture.AnyCPU, this.runSettings, dataCollectionRequestSender, dataCollectionLauncher)) + { + proxyDataCollectionManager.BeforeTestRunStart(true, true, this.mockTestMessageEventHandler.Object); + + var result = Process.GetProcessById(dataCollectionLauncher.DataCollectorProcess.Id); + Assert.IsNotNull(result); + + socketCommManager.StopClient(); + + var attachments = proxyDataCollectionManager.AfterTestRunEnd(false, this.mockTestMessageEventHandler.Object); + + Assert.IsNull(attachments); + + // Give time to datacollector process to exit. + Assert.IsTrue(result.WaitForExit(500)); + } + } + } +} diff --git a/test/datacollector.PlatformTests/CutomDataCollector.cs b/test/datacollector.PlatformTests/CutomDataCollector.cs new file mode 100644 index 0000000000..c276e48bae --- /dev/null +++ b/test/datacollector.PlatformTests/CutomDataCollector.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +namespace Microsoft.VisualStudio.TestPlatform.DataCollector.PlatformTests +{ + using System; + using System.Collections.Generic; + using System.IO; + using System.Xml; + + using Microsoft.VisualStudio.TestPlatform.ObjectModel.DataCollection; + + [DataCollectorFriendlyName("CustomDataCollector")] + [DataCollectorTypeUri("my://custom/datacollector")] + public class CustomDataCollector : DataCollector, ITestExecutionEnvironmentSpecifier + { + private DataCollectionSink dataCollectionSink; + private DataCollectionEnvironmentContext context; + private DataCollectionLogger logger; + + public override void Initialize( + System.Xml.XmlElement configurationElement, + DataCollectionEvents events, + DataCollectionSink dataSink, + DataCollectionLogger logger, + DataCollectionEnvironmentContext environmentContext) + { + events.SessionStart += new EventHandler(this.SessionStarted_Handler); + events.SessionEnd += new EventHandler(this.SessionEnded_Handler); + this.dataCollectionSink = dataSink; + this.context = environmentContext; + this.logger = logger; + } + + private void SessionStarted_Handler(object sender, SessionStartEventArgs args) + { + var filename = Path.Combine(AppContext.BaseDirectory, "filename.txt"); + File.WriteAllText(filename, string.Empty); + this.dataCollectionSink.SendFileAsync(context.SessionDataCollectionContext, filename, true); + this.logger.LogWarning(this.context.SessionDataCollectionContext, "SessionEnded"); + } + + private void SessionEnded_Handler(object sender, SessionEndEventArgs args) + { + //logger.LogError(this.context.SessionDataCollectionContext, new Exception("my exception")); + //logger.LogWarning(this.context.SessionDataCollectionContext, "my arning"); + //logger.LogException(context.SessionDataCollectionContext, new Exception("abc"), DataCollectorMessageLevel.Error); + + this.logger.LogWarning(this.context.SessionDataCollectionContext, "SessionEnded"); + } + + public IEnumerable> GetTestExecutionEnvironmentVariables() + { + return new List> { new KeyValuePair("key", "value") }; + } + } +} diff --git a/test/datacollector.PlatformTests/Program.cs b/test/datacollector.PlatformTests/Program.cs new file mode 100644 index 0000000000..2ff9995413 --- /dev/null +++ b/test/datacollector.PlatformTests/Program.cs @@ -0,0 +1,15 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +namespace Microsoft.VisualStudio.TestPlatform.DataCollector.ComponentTests +{ + /// + /// Main entry point for the command line runner. + /// + public static class Program + { + public static void Main(string[] args) + { + } + } +} diff --git a/test/datacollector.PlatformTests/datacollector.PlatformTests.csproj b/test/datacollector.PlatformTests/datacollector.PlatformTests.csproj new file mode 100644 index 0000000000..c44701929d --- /dev/null +++ b/test/datacollector.PlatformTests/datacollector.PlatformTests.csproj @@ -0,0 +1,64 @@ + + + ..\..\ + true + + + + Microsoft.VisualStudio.TestPlatform.DataCollector.PlatformTests + + + netcoreapp1.0;net46 + Exe + Microsoft.VisualStudio.TestPlatform.DataCollector.PlatformTests + $(PackageTargetFallback);dnxcore50;portable-net45+win8 + + + + + true + + + true + + + true + + + true + + + true + + + + + + + + + + + 4.0.1 + + + + + + + + + + + + + \ No newline at end of file diff --git a/test/datacollector.UnitTests/DataCollectionAttachmentManagerTests.cs b/test/datacollector.UnitTests/DataCollectionAttachmentManagerTests.cs index df7a69bd43..b8d6832a2f 100644 --- a/test/datacollector.UnitTests/DataCollectionAttachmentManagerTests.cs +++ b/test/datacollector.UnitTests/DataCollectionAttachmentManagerTests.cs @@ -1,15 +1,15 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -namespace Microsoft.VisualStudio.TestPlatform.DataCollector.UnitTests +namespace Microsoft.VisualStudio.TestPlatform.Common.DataCollector.UnitTests { using System; using System.ComponentModel; using System.IO; using System.Threading; - using Microsoft.VisualStudio.TestPlatform.DataCollector; - using Microsoft.VisualStudio.TestPlatform.DataCollector.Interfaces; + using Microsoft.VisualStudio.TestPlatform.Common.DataCollector; + using Microsoft.VisualStudio.TestPlatform.Common.DataCollector.Interfaces; using Microsoft.VisualStudio.TestPlatform.ObjectModel.DataCollection; using Microsoft.VisualStudio.TestTools.UnitTesting; @@ -188,5 +188,40 @@ public void GetAttachmentsShouldNotReutrnAnyDataWhenActiveFileTransferAreNotPres var result = this.attachmentManager.GetAttachments(datacollectioncontext); Assert.AreEqual(0, result.Count); } + + [TestMethod] + public void GetAttachmentsShouldReturnTheAlreadyCompletedAttachmentsAfterCancelled() + { + var filename = "filename1.txt"; + File.WriteAllText(Path.Combine(AppContext.BaseDirectory, filename), string.Empty); + + this.attachmentManager.Initialize(this.sessionId, AppContext.BaseDirectory, this.messageSink.Object); + + var datacollectioncontext = new DataCollectionContext(this.sessionId); + var friendlyName = "TestDataCollector"; + var uri = new Uri("datacollector://Company/Product/Version"); + + var dataCollectorDataMessage = new FileTransferInformation(datacollectioncontext, Path.Combine(AppContext.BaseDirectory, filename), true); + + this.attachmentManager.AddAttachment(dataCollectorDataMessage, null, uri, friendlyName); + + Assert.AreEqual(1, this.attachmentManager.AttachmentSets.Count); + var result = this.attachmentManager.GetAttachments(datacollectioncontext); + + Assert.AreEqual(friendlyName, result[0].DisplayName); + Assert.AreEqual(uri, result[0].Uri); + Assert.AreEqual(1, result[0].Attachments.Count); + + File.WriteAllText(Path.Combine(AppContext.BaseDirectory, "filename2.txt"), string.Empty); + dataCollectorDataMessage = new FileTransferInformation(datacollectioncontext, Path.Combine(AppContext.BaseDirectory, "filename2.txt"), true); + + this.attachmentManager.Cancel(); + + this.attachmentManager.AddAttachment(dataCollectorDataMessage, null, uri, friendlyName); + + result = this.attachmentManager.GetAttachments(datacollectioncontext); + + Assert.AreEqual(1, this.attachmentManager.AttachmentSets.Count); + } } } diff --git a/test/datacollector.UnitTests/DataCollectionEnvironmentVariableTests.cs b/test/datacollector.UnitTests/DataCollectionEnvironmentVariableTests.cs index d65381b643..9c4ab7ba15 100644 --- a/test/datacollector.UnitTests/DataCollectionEnvironmentVariableTests.cs +++ b/test/datacollector.UnitTests/DataCollectionEnvironmentVariableTests.cs @@ -1,11 +1,11 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -namespace Microsoft.VisualStudio.TestPlatform.DataCollector.UnitTests +namespace Microsoft.VisualStudio.TestPlatform.Common.DataCollector.UnitTests { using System; using System.Collections.Generic; - using Microsoft.VisualStudio.TestPlatform.DataCollector; + using Microsoft.VisualStudio.TestPlatform.Common.DataCollector; using Microsoft.VisualStudio.TestTools.UnitTesting; diff --git a/test/datacollector.UnitTests/DataCollectionManagerTests.cs b/test/datacollector.UnitTests/DataCollectionManagerTests.cs index 5155ca3c0c..5478a68399 100644 --- a/test/datacollector.UnitTests/DataCollectionManagerTests.cs +++ b/test/datacollector.UnitTests/DataCollectionManagerTests.cs @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -namespace Microsoft.VisualStudio.TestPlatform.DataCollector.UnitTests +namespace Microsoft.VisualStudio.TestPlatform.Common.DataCollector.UnitTests { using System; using System.Collections.Generic; @@ -10,8 +10,8 @@ namespace Microsoft.VisualStudio.TestPlatform.DataCollector.UnitTests using System.Xml; - using Microsoft.VisualStudio.TestPlatform.DataCollector; - using Microsoft.VisualStudio.TestPlatform.DataCollector.Interfaces; + using Microsoft.VisualStudio.TestPlatform.Common.DataCollector; + using Microsoft.VisualStudio.TestPlatform.Common.DataCollector.Interfaces; using Microsoft.VisualStudio.TestPlatform.ObjectModel; using Microsoft.VisualStudio.TestPlatform.ObjectModel.DataCollection; using Microsoft.VisualStudio.TestPlatform.ObjectModel.DataCollector; @@ -319,7 +319,12 @@ public void SessionEndedShouldContinueDataCollectionIfExceptionIsThrownWhileSend (a, b, c, d, e) => { b.SessionEnd += (sender, ev) => - { throw new Exception(); }; + { + var filename = Path.Combine(AppContext.BaseDirectory, "filename.txt"); + File.WriteAllText(filename, string.Empty); + c.SendFileAsync(e.SessionDataCollectionContext, filename, true); + throw new Exception(); + }; }); this.dataCollectionManager.InitializeDataCollectors(runSettings); @@ -327,7 +332,22 @@ public void SessionEndedShouldContinueDataCollectionIfExceptionIsThrownWhileSend var result = this.dataCollectionManager.SessionEnded(); - Assert.AreEqual(0, result.Count); + Assert.AreEqual(1, result.Count); + } + + [TestMethod] + public void SessionEndedShouldCancelProcessingAttachmentRequestsIfSessionIsCancelled() + { + var runSettings = string.Format(this.defaultRunSettings, this.dataCollectorSettings); + var mockAttachmentManager = new Mock(); + this.dataCollectionManager = new DataCollectionManager(mockAttachmentManager.Object, this.mockMessageSink.Object, this.dataCollectorLoader.Object); + + this.dataCollectionManager.InitializeDataCollectors(runSettings); + this.dataCollectionManager.SessionStarted(); + + var result = this.dataCollectionManager.SessionEnded(true); + + mockAttachmentManager.Verify(x => x.Cancel(), Times.Once); } } diff --git a/test/datacollector.UnitTests/DataCollectorConfigTests.cs b/test/datacollector.UnitTests/DataCollectorConfigTests.cs index 0e482d19e8..40f5da11a9 100644 --- a/test/datacollector.UnitTests/DataCollectorConfigTests.cs +++ b/test/datacollector.UnitTests/DataCollectorConfigTests.cs @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -namespace Microsoft.VisualStudio.TestPlatform.DataCollector.UnitTests +namespace Microsoft.VisualStudio.TestPlatform.Common.DataCollector.UnitTests { using System; using System.Globalization; diff --git a/test/datacollector.UnitTests/DataCollectorInformationTests.cs b/test/datacollector.UnitTests/DataCollectorInformationTests.cs index 4ba3389d65..2f95b51ff3 100644 --- a/test/datacollector.UnitTests/DataCollectorInformationTests.cs +++ b/test/datacollector.UnitTests/DataCollectorInformationTests.cs @@ -1,18 +1,18 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -namespace Microsoft.VisualStudio.TestPlatform.DataCollector.UnitTests +namespace Microsoft.VisualStudio.TestPlatform.Common.DataCollector.UnitTests { using System; using System.Collections.Generic; using System.Linq; - using Microsoft.VisualStudio.TestPlatform.DataCollector.Interfaces; - using Microsoft.VisualStudio.TestPlatform.ObjectModel.DataCollector; + using Microsoft.VisualStudio.TestPlatform.Common.DataCollector.Interfaces; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; using Moq.Protected; + using Microsoft.VisualStudio.TestPlatform.ObjectModel.DataCollection; [TestClass] public class DataCollectorInformationTests diff --git a/test/datacollector.UnitTests/DataCollectorLoaderTests.cs b/test/datacollector.UnitTests/DataCollectorLoaderTests.cs index fcb7061892..5175aec590 100644 --- a/test/datacollector.UnitTests/DataCollectorLoaderTests.cs +++ b/test/datacollector.UnitTests/DataCollectorLoaderTests.cs @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -namespace Microsoft.VisualStudio.TestPlatform.DataCollector.UnitTests +namespace Microsoft.VisualStudio.TestPlatform.Common.DataCollector.UnitTests { using System; using System.Reflection; diff --git a/test/datacollector.UnitTests/DummyDataCollectors.cs b/test/datacollector.UnitTests/DummyDataCollectors.cs index 19f8c67a40..a54e25218c 100644 --- a/test/datacollector.UnitTests/DummyDataCollectors.cs +++ b/test/datacollector.UnitTests/DummyDataCollectors.cs @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -namespace Microsoft.VisualStudio.TestPlatform.DataCollector.UnitTests +namespace Microsoft.VisualStudio.TestPlatform.Common.DataCollector.UnitTests { using System; using System.Collections.Generic; diff --git a/test/datacollector.UnitTests/Program.cs b/test/datacollector.UnitTests/Program.cs index b6e8af2a8b..7f39953476 100644 --- a/test/datacollector.UnitTests/Program.cs +++ b/test/datacollector.UnitTests/Program.cs @@ -1,6 +1,6 @@ // Copyright (c) Microsoft. All rights reserved. -namespace Microsoft.VisualStudio.TestPlatform.DataCollector.UnitTests +namespace Microsoft.VisualStudio.TestPlatform.Common.DataCollector.UnitTests { /// /// Main entry point for the command line runner. diff --git a/test/datacollector.UnitTests/TestPlatformDataCollectionEventsTests.cs b/test/datacollector.UnitTests/TestPlatformDataCollectionEventsTests.cs index 9b67141710..3984af5850 100644 --- a/test/datacollector.UnitTests/TestPlatformDataCollectionEventsTests.cs +++ b/test/datacollector.UnitTests/TestPlatformDataCollectionEventsTests.cs @@ -1,11 +1,11 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -namespace Microsoft.VisualStudio.TestPlatform.DataCollector.UnitTests +namespace Microsoft.VisualStudio.TestPlatform.Common.DataCollector.UnitTests { using System; - using Microsoft.VisualStudio.TestPlatform.DataCollector; + using Microsoft.VisualStudio.TestPlatform.Common.DataCollector; using Microsoft.VisualStudio.TestPlatform.ObjectModel; using Microsoft.VisualStudio.TestPlatform.ObjectModel.DataCollection; using Microsoft.VisualStudio.TestTools.UnitTesting; diff --git a/test/datacollector.UnitTests/TestPlatformDataCollectionLoggerTests.cs b/test/datacollector.UnitTests/TestPlatformDataCollectionLoggerTests.cs index d7d3e02263..7c744c1b54 100644 --- a/test/datacollector.UnitTests/TestPlatformDataCollectionLoggerTests.cs +++ b/test/datacollector.UnitTests/TestPlatformDataCollectionLoggerTests.cs @@ -1,11 +1,11 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -namespace Microsoft.VisualStudio.TestPlatform.DataCollector.UnitTests +namespace Microsoft.VisualStudio.TestPlatform.Common.DataCollector.UnitTests { using System; - using Microsoft.VisualStudio.TestPlatform.DataCollector.Interfaces; + using Microsoft.VisualStudio.TestPlatform.Common.DataCollector.Interfaces; using Microsoft.VisualStudio.TestPlatform.ObjectModel.DataCollection; using Microsoft.VisualStudio.TestPlatform.ObjectModel.Logging; using Microsoft.VisualStudio.TestTools.UnitTesting; diff --git a/test/datacollector.UnitTests/TestPlatformDataCollectionSinkTests.cs b/test/datacollector.UnitTests/TestPlatformDataCollectionSinkTests.cs index e24e3b3bac..9888107155 100644 --- a/test/datacollector.UnitTests/TestPlatformDataCollectionSinkTests.cs +++ b/test/datacollector.UnitTests/TestPlatformDataCollectionSinkTests.cs @@ -1,14 +1,14 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -namespace Microsoft.VisualStudio.TestPlatform.DataCollector.UnitTests +namespace Microsoft.VisualStudio.TestPlatform.Common.DataCollector.UnitTests { using System; using System.ComponentModel; using System.IO; - using Microsoft.VisualStudio.TestPlatform.DataCollector; - using Microsoft.VisualStudio.TestPlatform.DataCollector.Interfaces; + using Microsoft.VisualStudio.TestPlatform.Common.DataCollector; + using Microsoft.VisualStudio.TestPlatform.Common.DataCollector.Interfaces; using Microsoft.VisualStudio.TestPlatform.ObjectModel.DataCollection; using Microsoft.VisualStudio.TestTools.UnitTesting;