-
Notifications
You must be signed in to change notification settings - Fork 325
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
214 additions
and
54 deletions.
There are no files selected for viewing
25 changes: 11 additions & 14 deletions
25
...stPlatform.Common/Interfaces/Engine/TesthostProtocol/IMultiTestRunsFinalizationManager.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,21 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
||
using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client; | ||
using System.Collections.Generic; | ||
|
||
namespace Microsoft.VisualStudio.TestPlatform.ObjectModel.Engine.TesthostProtocol | ||
{ | ||
using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client; | ||
using System.Collections.Generic; | ||
|
||
namespace Microsoft.VisualStudio.TestPlatform.Common.Interfaces.Engine.TesthostProtocol | ||
/// <summary> | ||
/// Orchestrates multi test runs finalization operations for the engine communicating with the test host process. | ||
/// </summary> | ||
public interface IMultiTestRunsFinalizationManager | ||
{ | ||
/// <summary> | ||
/// Orchestrates multi test runs finalization operations for the engine communicating with the test host process. | ||
/// Finalizes multi test runs | ||
/// </summary> | ||
public interface IMultiTestRunsFinalizationManager | ||
{ | ||
/// <summary> | ||
/// Discovers tests | ||
/// </summary> | ||
/// <param name="discoveryCriteria">Settings, parameters for the discovery request</param> | ||
/// <param name="eventHandler">EventHandler for handling discovery events from Engine</param> | ||
void FinalizeMultiTestRuns(IEnumerable<AttachmentSet> attachments, IMultiTestRunsFinalizationEventsHandler eventHandler); | ||
} | ||
/// <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); | ||
} | ||
} |
74 changes: 74 additions & 0 deletions
74
...stPlatform.CommunicationUtilities/EventHandlers/MultiTestRunsFinalizationEventsHandler.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
// 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 | ||
{ | ||
using System.Collections.Generic; | ||
|
||
using Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.Interfaces; | ||
using Microsoft.VisualStudio.TestPlatform.ObjectModel; | ||
using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client; | ||
using Microsoft.VisualStudio.TestPlatform.ObjectModel.Logging; | ||
|
||
/// <summary> | ||
/// The multi test finalization event handler. | ||
/// </summary> | ||
public class MultiTestRunsFinalizationEventsHandler : IMultiTestRunsFinalizationEventsHandler | ||
{ | ||
private ITestRequestHandler requestHandler; | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref="MultiTestRunsFinalizationEventsHandler"/> class. | ||
/// </summary> | ||
/// <param name="requestHandler"> The Request Handler. </param> | ||
public MultiTestRunsFinalizationEventsHandler(ITestRequestHandler requestHandler) | ||
{ | ||
this.requestHandler = requestHandler; | ||
} | ||
|
||
/// <summary> | ||
/// The handle discovery message. | ||
/// </summary> | ||
/// <param name="level"> Logging level. </param> | ||
/// <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); | ||
} | ||
|
||
public void HandleMultiTestRunsFinalizationComplete(ICollection<AttachmentSet> attachments) | ||
{ | ||
if (EqtTrace.IsInfoEnabled) | ||
{ | ||
EqtTrace.Info("Multi test runs finalization completed."); | ||
} | ||
|
||
this.requestHandler.MultiTestRunsFinalizationComplete(attachments); | ||
} | ||
|
||
public void HandleRawMessage(string rawMessage) | ||
{ | ||
// No-Op | ||
// TestHost at this point has no functionality where it requires rawmessage | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
...stPlatform.CrossPlatEngine/DataCollection/MultiTestRunsDataCollectorAttachmentsHandler.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
||
using Microsoft.VisualStudio.TestPlatform.ObjectModel; | ||
using Microsoft.VisualStudio.TestPlatform.ObjectModel.DataCollection; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Collections.ObjectModel; | ||
using System.Linq; | ||
|
||
namespace Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.DataCollection | ||
{ | ||
public class MultiTestRunsDataCollectorAttachmentsHandler | ||
{ | ||
private readonly IDataCollectorAttachments dataCollectorAttachmentsHandler; | ||
|
||
public MultiTestRunsDataCollectorAttachmentsHandler(IDataCollectorAttachments dataCollectorAttachmentsHandler) | ||
{ | ||
this.dataCollectorAttachmentsHandler = dataCollectorAttachmentsHandler; | ||
} | ||
|
||
public void HandleAttachements(ICollection<AttachmentSet> attachments) | ||
{ | ||
Uri attachementUri = dataCollectorAttachmentsHandler.GetExtensionUri(); | ||
if (attachementUri != null) | ||
{ | ||
var coverageAttachments = attachments.Where(dataCollectionAttachment => attachementUri.Equals(dataCollectionAttachment.Uri)).ToArray(); | ||
|
||
foreach (var coverageAttachment in coverageAttachments) | ||
{ | ||
attachments.Remove(coverageAttachment); | ||
} | ||
|
||
ICollection<AttachmentSet> mergedAttachments = dataCollectorAttachmentsHandler.HandleDataCollectionAttachmentSets(new Collection<AttachmentSet>(coverageAttachments)); | ||
foreach (var attachment in mergedAttachments) | ||
{ | ||
attachments.Add(attachment); | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 31 additions & 3 deletions
34
...estPlatform.CrossPlatEngine/MultiTestRunsFinalization/MultiTestRunsFinalizationManager.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,38 @@ | ||
using System; | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
||
using System.Collections.Generic; | ||
using System.Text; | ||
using Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.DataCollection; | ||
using Microsoft.VisualStudio.TestPlatform.ObjectModel; | ||
using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client; | ||
using Microsoft.VisualStudio.TestPlatform.ObjectModel.Engine.TesthostProtocol; | ||
|
||
namespace Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.MultiTestRunsFinalization | ||
{ | ||
class MultiTestRunsFinalizationManager | ||
/// <summary> | ||
/// Orchestrates multi test runs finalization operations for the engine communicating with the test host process. | ||
/// </summary> | ||
public class MultiTestRunsFinalizationManager : IMultiTestRunsFinalizationManager | ||
{ | ||
private readonly MultiTestRunsDataCollectorAttachmentsHandler attachmentsHandler; | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref="MultiTestRunsFinalizationManager"/> class. | ||
/// </summary> | ||
public MultiTestRunsFinalizationManager(MultiTestRunsDataCollectorAttachmentsHandler attachmentsHandler) | ||
{ | ||
this.attachmentsHandler = attachmentsHandler; | ||
} | ||
|
||
/// <summary> | ||
/// Finalizes multi test runs | ||
/// </summary> | ||
/// <param name="attachments">Attachments</param> | ||
/// <param name="eventHandler">EventHandler for handling multi test runs finalization events from Engine</param> | ||
public void FinalizeMultiTestRuns(ICollection<AttachmentSet> attachments, IMultiTestRunsFinalizationEventsHandler eventHandler) | ||
{ | ||
attachmentsHandler.HandleAttachements(attachments); | ||
eventHandler.HandleMultiTestRunsFinalizationComplete(attachments); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.