Skip to content

Commit

Permalink
More changes
Browse files Browse the repository at this point in the history
  • Loading branch information
jakubch1 committed Jun 15, 2020
1 parent 08b646a commit e16e3ad
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ internal interface IMultiTestRunFinalizationManager
/// Finalizes multi test
/// </summary>
/// <param name="attachments">Attachments</param>
/// <param name="eventHandler">EventHandler for handling multi test run finalization events from Engine</param>
/// <param name="cancellationToken">Cancellation token</param>
Task<Collection<AttachmentSet>> FinalizeMultiTestRunAsync(ICollection<AttachmentSet> attachments, CancellationToken cancellationToken);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,14 @@ namespace Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Client.Parallel
using Microsoft.VisualStudio.TestPlatform.CommunicationUtilities;
using Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.Interfaces;
using Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.ObjectModel;
using Microsoft.VisualStudio.TestPlatform.CoreUtilities.Tracing;
using Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.DataCollection;
using Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.MultiTestRunFinalization;
using Microsoft.VisualStudio.TestPlatform.ObjectModel;
using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client;
using Microsoft.VisualStudio.TestPlatform.ObjectModel.Engine;
using Microsoft.VisualStudio.TestPlatform.ObjectModel.Logging;
using Microsoft.VisualStudio.TestPlatform.Utilities;

/// <summary>
/// ParallelProxyExecutionManager that manages parallel execution
Expand Down Expand Up @@ -258,12 +261,16 @@ private ParallelRunEventsHandler GetEventsHandler(IProxyExecutionManager concurr
{
var concurrentManagerWithDataCollection = concurrentManager as ProxyExecutionManagerWithDataCollection;

// TODO : use TestPluginCache to iterate over all IDataCollectorAttachments
var finalizationManager = new MultiTestRunFinalizationManager(TestPlatformEventSource.Instance, new CodeCoverageDataAttachmentsHandler());

return new ParallelDataCollectionEventsHandler(
this.requestData,
concurrentManagerWithDataCollection,
this.currentRunEventsHandler,
this,
this.currentRunDataAggregator,
finalizationManager,
concurrentManagerWithDataCollection.CancellationToken);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ public ParallelDataCollectionEventsHandler(IRequestData requestData,
ITestRunEventsHandler actualRunEventsHandler,
IParallelProxyExecutionManager parallelProxyExecutionManager,
ParallelRunDataAggregator runDataAggregator,
IMultiTestRunFinalizationManager finalizationManager,
CancellationToken cancellationToken) :
this(requestData, proxyExecutionManager, actualRunEventsHandler, parallelProxyExecutionManager, runDataAggregator, JsonDataSerializer.Instance)
{
// TODO : use TestPluginCache to iterate over all IDataCollectorAttachments
this.finalizationManager = new MultiTestRunFinalizationManager(TestPlatformEventSource.Instance, new CodeCoverageDataAttachmentsHandler());
this.finalizationManager = finalizationManager;
this.cancellationToken = cancellationToken;
}

Expand Down Expand Up @@ -65,7 +65,7 @@ public override void HandleTestRunComplete(
this.runDataAggregator.IsCanceled,
this.runDataAggregator.IsAborted,
this.runDataAggregator.GetAggregatedException(),
attachments,
attachments ?? runDataAggregator.RunContextAttachments,
this.runDataAggregator.ElapsedTime);

// Add Metrics from Test Host
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,17 @@ namespace Microsoft.VisualStudio.TestPlatform.ObjectModel.DataCollection
/// </summary>
public interface IDataCollectorAttachments
{
/// <summary>
/// Gets the attachment set after Test Run Session
/// </summary>
/// <returns>Gets the attachment set after Test Run Session</returns>
ICollection<AttachmentSet> HandleDataCollectionAttachmentSets(ICollection<AttachmentSet> dataCollectionAttachments);

/// <summary>
/// Gets the attachment set after Test Run Session
/// </summary>
/// <returns>Gets the attachment set after Test Run Session</returns>
ICollection<AttachmentSet> HandleDataCollectionAttachmentSets(ICollection<AttachmentSet> dataCollectionAttachments, CancellationToken cancellationToken);
// TODO: add new method

/// <summary>
/// Gets the attachment Uri, which is handled by current Collector
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ public Uri GetExtensionUri()
return CodeCoverageDataCollectorUri;
}

public ICollection<AttachmentSet> HandleDataCollectionAttachmentSets(ICollection<AttachmentSet> dataCollectionAttachments)
{
return HandleDataCollectionAttachmentSets(dataCollectionAttachments, CancellationToken.None);
}

public ICollection<AttachmentSet> HandleDataCollectionAttachmentSets(ICollection<AttachmentSet> dataCollectionAttachments, CancellationToken cancellationToken)
{
if (dataCollectionAttachments != null && dataCollectionAttachments.Any())
Expand Down

0 comments on commit e16e3ad

Please sign in to comment.