Sending show plan graph to ADS on Result Set updated event (#1300)

* Sending showplan graph over json rpc in Result updated event
Translating showplan graph into simple objects to be sent over JSON RPC

* Revert "Sending showplan graph over json rpc in Result updated event"

This reverts commit 2d63a625fd200d057bf6093e233f05dea440347c.

* Added string for localization

* Sending showplan graph over json rpc in Result updated event
Translating showplan graph into simple objects to be sent over JSON RPC

* Refactoring class

* Removing test warning

* Removing unused imports
Adding copyright

* Removing unused prop

* removing formatted string out .strings file

* Formatting files
Adding Errors in show plan graph

* Adding a separate event for execution plan

* Now sending mulitple graphs when a batch has more than one query.
This commit is contained in:
Aasim Khan
2021-11-16 22:33:28 -08:00
committed by GitHub
parent 482afd8427
commit 2e7bac5659
14 changed files with 680 additions and 66 deletions

View File

@@ -3,12 +3,10 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System;
using System.IO;
using System.Reflection;
using System.Threading.Tasks;
using NUnit.Framework;
using Microsoft.SqlTools.ServiceLayer.ShowPlan.ShowPlanGraph;
using Microsoft.SqlTools.ServiceLayer.ShowPlan;
namespace Microsoft.SqlTools.ServiceLayer.UnitTests.ShowPlan
@@ -16,17 +14,16 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.ShowPlan
public class ShowPlanXMLTests
{
[Test]
public async Task ParseXMLFileReturnsValidShowPlanGraph()
public void ParseXMLFileReturnsValidShowPlanGraph()
{
Assembly assembly = Assembly.GetAssembly(typeof(ShowPlanXMLTests));
Stream scriptStream = assembly.GetManifestResourceStream(assembly.GetName().Name + ".ShowPlan.TestExecutionPlan.xml");
StreamReader reader = new StreamReader(scriptStream);
string text = reader.ReadToEnd();
var showPlanGraphs = ShowPlanGraph.ParseShowPlanXML(text, ShowPlanType.Actual);
Assert.AreEqual(1, showPlanGraphs.Length, "Single show plan graph not generated from the test xml file");
var testShowPlanGraph = showPlanGraphs[0];
Assert.NotNull(testShowPlanGraph, "graph should not be null");
Assert.NotNull(testShowPlanGraph.Root, "graph should have a root");
var showPlanGraphs = ShowPlanGraphUtils.CreateShowPlanGraph(text);
Assert.AreEqual(1, showPlanGraphs.Count, "exactly one show plan graph should be returned");
Assert.NotNull(showPlanGraphs[0], "graph should not be null");
Assert.NotNull(showPlanGraphs[0].Root, "graph should have a root");
}
}
}