Skip to content

Commit

Permalink
compiled
Browse files Browse the repository at this point in the history
  • Loading branch information
jakubch1 committed Jun 10, 2020
1 parent e7b839f commit 6aa2912
Show file tree
Hide file tree
Showing 18 changed files with 220 additions and 323 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace Microsoft.VisualStudio.TestPlatform.Client.DesignMode
using System.Net;
using System.Threading;
using System.Threading.Tasks;

using Microsoft.VisualStudio.TestPlatform.Client.MultiTestRunsFinalization;
using Microsoft.VisualStudio.TestPlatform.Client.RequestHelper;
using Microsoft.VisualStudio.TestPlatform.Common.Logging;
using Microsoft.VisualStudio.TestPlatform.Common.Utilities;
Expand Down Expand Up @@ -476,7 +476,7 @@ private void StartMultiTestRunsFinalization(MultiTestRunsFinalizationPayload fin
try
{
testRequestManager.ResetOptions();
testRequestManager.FinalizeMultiTestRuns(finalizationPayload);
testRequestManager.FinalizeMultiTestRuns(finalizationPayload, new MultiTestRunsFinalizationEventsHandler(this.communicationManager));
}
catch (Exception ex)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
// 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.CommunicationUtilities.EventHandlers
namespace Microsoft.VisualStudio.TestPlatform.Client.MultiTestRunsFinalization
{
using System.Collections.Generic;

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;
using System.Collections.Generic;

/// <summary>
/// The multi test finalization event handler.
/// </summary>
public class MultiTestRunsFinalizationEventsHandler : IMultiTestRunsFinalizationEventsHandler
{
private ITestRequestHandler requestHandler;
private ICommunicationManager communicationManager;

/// <summary>
/// Initializes a new instance of the <see cref="MultiTestRunsFinalizationEventsHandler"/> class.
/// </summary>
/// <param name="requestHandler"> The Request Handler. </param>
public MultiTestRunsFinalizationEventsHandler(ITestRequestHandler requestHandler)
public MultiTestRunsFinalizationEventsHandler(ICommunicationManager communicationManager)
{
this.requestHandler = requestHandler;
this.communicationManager = communicationManager;
}

/// <summary>
Expand All @@ -33,26 +33,8 @@ public MultiTestRunsFinalizationEventsHandler(ITestRequestHandler requestHandler
/// <param name="message"> Logging message. </param>
public void HandleLogMessage(TestMessageLevel level, string message)
{
switch ((TestMessageLevel)level)
{
case TestMessageLevel.Informational:
EqtTrace.Info(message);
break;

case TestMessageLevel.Warning:
EqtTrace.Warning(message);
break;

case TestMessageLevel.Error:
EqtTrace.Error(message);
break;

default:
EqtTrace.Info(message);
break;
}

this.requestHandler.SendLog(level, message);
var testMessagePayload = new TestMessagePayload { MessageLevel = level, Message = message };
this.communicationManager.SendMessage(MessageType.TestMessage, testMessagePayload);
}

public void HandleMultiTestRunsFinalizationComplete(ICollection<AttachmentSet> attachments)
Expand All @@ -62,13 +44,18 @@ public void HandleMultiTestRunsFinalizationComplete(ICollection<AttachmentSet> a
EqtTrace.Info("Multi test runs finalization completed.");
}

this.requestHandler.MultiTestRunsFinalizationComplete(attachments);
var payload = new MultiTestRunsFinalizationCompletePayload()
{
Attachments = null
};

// Send run complete to translation layer
this.communicationManager.SendMessage(MessageType.MultiTestRunsFinalizationComplete, payload);
}

public void HandleRawMessage(string rawMessage)
{
// No-Op
// TestHost at this point has no functionality where it requires rawmessage
}
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ public interface ITestRequestManager : IDisposable
/// Finalize multi test runs
/// </summary>
/// <param name="multiTestRunsFinalizationPayload">Multi test runs finalization payload</param>
void FinalizeMultiTestRuns(MultiTestRunsFinalizationPayload multiTestRunsFinalizationPayload);
/// <param name="multiTestRunsFinalizationEventsHandler">Multi test runs finalization events handler</param>
void FinalizeMultiTestRuns(MultiTestRunsFinalizationPayload multiTestRunsFinalizationPayload, IMultiTestRunsFinalizationEventsHandler multiTestRunsFinalizationEventsHandler);

/// <summary>
/// Cancel the current TestRun request
Expand All @@ -68,6 +69,6 @@ public interface ITestRequestManager : IDisposable
/// <summary>
/// Cancels the current multi test runs finalization request
/// </summary>
void CancelMultiTestRunsFinalizaiton();
void CancelMultiTestRunsFinalization();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;

namespace Microsoft.VisualStudio.TestPlatform.ObjectModel.Engine
{
Expand All @@ -16,11 +18,7 @@ public interface IMultiTestRunsFinalizationManager
/// </summary>
/// <param name="attachments">Attachments</param>
/// <param name="eventHandler">EventHandler for handling multi test runs finalization events from Engine</param>
void FinalizeMultiTestRuns(ICollection<AttachmentSet> attachments, IMultiTestRunsFinalizationEventsHandler eventHandler);

/// <summary>
/// Aborts multi test runs finalization
/// </summary>
void Abort();
/// <param name="cancellationToken">Cancellation token</param>
Task FinalizeMultiTestRunsAsync(ICollection<AttachmentSet> attachments, IMultiTestRunsFinalizationEventsHandler eventHandler, CancellationToken cancellationToken);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Threading;

namespace Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.DataCollection
{
Expand All @@ -19,7 +20,7 @@ public MultiTestRunsDataCollectorAttachmentsHandler(IDataCollectorAttachments da
this.dataCollectorAttachmentsHandler = dataCollectorAttachmentsHandler;
}

public void HandleAttachements(ICollection<AttachmentSet> attachments)
public void HandleAttachements(ICollection<AttachmentSet> attachments, CancellationToken cancellationToken)
{
Uri attachementUri = dataCollectorAttachmentsHandler.GetExtensionUri();
if (attachementUri != null)
Expand All @@ -31,7 +32,7 @@ public void HandleAttachements(ICollection<AttachmentSet> attachments)
attachments.Remove(coverageAttachment);
}

ICollection<AttachmentSet> mergedAttachments = dataCollectorAttachmentsHandler.HandleDataCollectionAttachmentSets(new Collection<AttachmentSet>(coverageAttachments));
ICollection<AttachmentSet> mergedAttachments = dataCollectorAttachmentsHandler.HandleDataCollectionAttachmentSets(new Collection<AttachmentSet>(coverageAttachments), cancellationToken);
foreach (var attachment in mergedAttachments)
{
attachments.Add(attachment);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
namespace Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.DataCollection
{
using System.Collections.Generic;

using System.Threading;
using Microsoft.VisualStudio.TestPlatform.CommunicationUtilities;
using Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.Interfaces;
using Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Client.Parallel;
Expand Down Expand Up @@ -53,7 +53,7 @@ public override void HandleTestRunComplete(

if (parallelRunComplete)
{
attachmentsHandler.HandleAttachements(runDataAggregator.RunContextAttachments);
attachmentsHandler.HandleAttachements(runDataAggregator.RunContextAttachments, CancellationToken.None);

var completedArgs = new TestRunCompleteEventArgs(this.runDataAggregator.GetAggregatedRunStats(),
this.runDataAggregator.IsCanceled,
Expand Down
Loading

0 comments on commit 6aa2912

Please sign in to comment.