-
Notifications
You must be signed in to change notification settings - Fork 324
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1. Enable use of new Message type. 2. Protocol version check between runner and host 3. Object model changes for reducing the verbosity. 4. Serializers for supported protocol versions. 5. Unit and Performance tests 6. Fixed the issue : SendLog message to be sent post version check.
- Loading branch information
1 parent
080f045
commit 208db29
Showing
33 changed files
with
1,125 additions
and
150 deletions.
There are no files selected for viewing
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
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
17 changes: 17 additions & 0 deletions
17
src/Microsoft.TestPlatform.CommunicationUtilities/Messages/VersionedMessage.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,17 @@ | ||
// 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 | ||
{ | ||
/// <summary> | ||
/// Construct with version used for communication | ||
/// Introduced in 15.1.0 version and default message protocol v2 onwards. | ||
/// </summary> | ||
public class VersionedMessage : Message | ||
{ | ||
/// <summary> | ||
/// Gets or sets the version of the message | ||
/// </summary> | ||
public int Version { get; set; } | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
src/Microsoft.TestPlatform.CommunicationUtilities/Resources/Resources.Designer.cs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
51 changes: 51 additions & 0 deletions
51
src/Microsoft.TestPlatform.CommunicationUtilities/Serialization/TestCaseConverter.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,51 @@ | ||
// 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.Serialization | ||
{ | ||
using System; | ||
using Microsoft.VisualStudio.TestPlatform.ObjectModel; | ||
using Newtonsoft.Json; | ||
|
||
/// <summary> | ||
/// Converter used by v1 protocol serializer to serialize TestCase object to and from v1 json | ||
/// </summary> | ||
public class TestCaseConverter : JsonConverter | ||
{ | ||
/// <inheritdoc/> | ||
public override bool CanRead => false; | ||
|
||
/// <inheritdoc/> | ||
public override bool CanConvert(Type objectType) | ||
{ | ||
return typeof(TestCase) == objectType; | ||
} | ||
|
||
/// <inheritdoc/> | ||
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) | ||
{ | ||
// We do not need this as SetPropetyValue inside StoreKvpList will | ||
// set the properties as expected. | ||
throw new NotImplementedException(); | ||
} | ||
|
||
/// <inheritdoc/> | ||
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) | ||
{ | ||
// P2 to P1 | ||
var testCase = value as TestCase; | ||
var properties = testCase.GetProperties(); | ||
|
||
writer.WriteStartObject(); | ||
writer.WritePropertyName("Properties"); | ||
writer.WriteStartArray(); | ||
foreach (var property in properties) | ||
{ | ||
serializer.Serialize(writer, property); | ||
} | ||
|
||
writer.WriteEndArray(); | ||
writer.WriteEndObject(); | ||
} | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
...rosoft.TestPlatform.CommunicationUtilities/Serialization/TestPlatformContractResolver1.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,31 @@ | ||
// 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.Serialization | ||
{ | ||
using System; | ||
using Microsoft.VisualStudio.TestPlatform.ObjectModel; | ||
using Newtonsoft.Json.Serialization; | ||
|
||
/// <summary> | ||
/// JSON contract resolver for mapping test platform types for v1 serialization. | ||
/// </summary> | ||
public class TestPlatformContractResolver1 : DefaultTestPlatformContractResolver | ||
{ | ||
/// <inheritdoc/> | ||
protected override JsonContract CreateContract(Type objectType) | ||
{ | ||
var contract = base.CreateContract(objectType); | ||
if (typeof(TestCase) == objectType) | ||
{ | ||
contract.Converter = new TestCaseConverter(); | ||
} | ||
else if (typeof(TestResult) == objectType) | ||
{ | ||
contract.Converter = new TestResultConverter(); | ||
} | ||
|
||
return contract; | ||
} | ||
} | ||
} |
Oops, something went wrong.