Commit 6c53cf31 6c53cf3101f508c7e89b1ee139dc158556bf8cea by Christian Gerdes

Initial commit from CodePlex 2017-09-02

0 parents
Showing 33 changed files with 2836 additions and 0 deletions
1 
2 Microsoft Visual Studio Solution File, Format Version 12.00
3 # Visual Studio 2012
4 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebServicePluginForWebTestMessageEditor", "WebTestWebServiceMessageEditor\WebServicePluginForWebTestMessageEditor.csproj", "{23707A49-589B-4A36-BDAA-2896E647D07D}"
5 EndProject
6 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebServicePluginForWebTestResultTab", "WebTestWebServiceResultAddin\WebServicePluginForWebTestResultTab.csproj", "{48B3509E-1FD8-4875-8FC6-137647EB83AA}"
7 EndProject
8 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebServicePluginForWebTestRuntime", "WebTestWebServiceRuntime\WebServicePluginForWebTestRuntime.csproj", "{F9E36CFA-A657-4DD4-BD17-BA3D91EB469F}"
9 EndProject
10 Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "WebServicePluginsSetup", "WebTestWebServiceSetup\WebServicePluginsSetup.wixproj", "{73ACCDA5-47C1-40C9-B63E-AFF657E046E4}"
11 EndProject
12 Global
13 GlobalSection(TeamFoundationVersionControl) = preSolution
14 SccNumberOfProjects = 4
15 SccEnterpriseProvider = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C}
16 SccTeamFoundationServer = https://tfs.codeplex.com/tfs/tfs03
17 SccProjectUniqueName0 = WebTestWebServiceRuntime\\WebServicePluginForWebTestRuntime.csproj
18 SccProjectName0 = WebTestWebServiceRuntime
19 SccAuxPath0 = https://tfs.codeplex.com/tfs/tfs03
20 SccLocalPath0 = WebTestWebServiceRuntime
21 SccProvider0 = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C}
22 SccProjectUniqueName1 = WebTestWebServiceResultAddin\\WebServicePluginForWebTestResultTab.csproj
23 SccProjectName1 = WebTestWebServiceResultAddin
24 SccAuxPath1 = https://tfs.codeplex.com/tfs/tfs03
25 SccLocalPath1 = WebTestWebServiceResultAddin
26 SccProvider1 = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C}
27 SccProjectUniqueName2 = WebTestWebServiceMessageEditor\\WebServicePluginForWebTestMessageEditor.csproj
28 SccProjectName2 = WebTestWebServiceMessageEditor
29 SccAuxPath2 = https://tfs.codeplex.com/tfs/tfs03
30 SccLocalPath2 = WebTestWebServiceMessageEditor
31 SccProvider2 = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C}
32 SccProjectUniqueName3 = WebTestWebServiceSetup\\WebServicePluginsSetup.wixproj
33 SccProjectName3 = WebTestWebServiceSetup
34 SccAuxPath3 = https://tfs.codeplex.com/tfs/tfs03
35 SccLocalPath3 = WebTestWebServiceSetup
36 SccProvider3 = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C}
37 EndGlobalSection
38 GlobalSection(SolutionConfigurationPlatforms) = preSolution
39 Debug|Any CPU = Debug|Any CPU
40 Debug|Mixed Platforms = Debug|Mixed Platforms
41 Debug|x86 = Debug|x86
42 Release|Any CPU = Release|Any CPU
43 Release|Mixed Platforms = Release|Mixed Platforms
44 Release|x86 = Release|x86
45 EndGlobalSection
46 GlobalSection(ProjectConfigurationPlatforms) = postSolution
47 {23707A49-589B-4A36-BDAA-2896E647D07D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
48 {23707A49-589B-4A36-BDAA-2896E647D07D}.Debug|Any CPU.Build.0 = Debug|Any CPU
49 {23707A49-589B-4A36-BDAA-2896E647D07D}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
50 {23707A49-589B-4A36-BDAA-2896E647D07D}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
51 {23707A49-589B-4A36-BDAA-2896E647D07D}.Debug|x86.ActiveCfg = Debug|Any CPU
52 {23707A49-589B-4A36-BDAA-2896E647D07D}.Release|Any CPU.ActiveCfg = Release|Any CPU
53 {23707A49-589B-4A36-BDAA-2896E647D07D}.Release|Any CPU.Build.0 = Release|Any CPU
54 {23707A49-589B-4A36-BDAA-2896E647D07D}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
55 {23707A49-589B-4A36-BDAA-2896E647D07D}.Release|Mixed Platforms.Build.0 = Release|Any CPU
56 {23707A49-589B-4A36-BDAA-2896E647D07D}.Release|x86.ActiveCfg = Release|Any CPU
57 {48B3509E-1FD8-4875-8FC6-137647EB83AA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
58 {48B3509E-1FD8-4875-8FC6-137647EB83AA}.Debug|Any CPU.Build.0 = Debug|Any CPU
59 {48B3509E-1FD8-4875-8FC6-137647EB83AA}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
60 {48B3509E-1FD8-4875-8FC6-137647EB83AA}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
61 {48B3509E-1FD8-4875-8FC6-137647EB83AA}.Debug|x86.ActiveCfg = Debug|Any CPU
62 {48B3509E-1FD8-4875-8FC6-137647EB83AA}.Release|Any CPU.ActiveCfg = Release|Any CPU
63 {48B3509E-1FD8-4875-8FC6-137647EB83AA}.Release|Any CPU.Build.0 = Release|Any CPU
64 {48B3509E-1FD8-4875-8FC6-137647EB83AA}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
65 {48B3509E-1FD8-4875-8FC6-137647EB83AA}.Release|Mixed Platforms.Build.0 = Release|Any CPU
66 {48B3509E-1FD8-4875-8FC6-137647EB83AA}.Release|x86.ActiveCfg = Release|Any CPU
67 {F9E36CFA-A657-4DD4-BD17-BA3D91EB469F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
68 {F9E36CFA-A657-4DD4-BD17-BA3D91EB469F}.Debug|Any CPU.Build.0 = Debug|Any CPU
69 {F9E36CFA-A657-4DD4-BD17-BA3D91EB469F}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
70 {F9E36CFA-A657-4DD4-BD17-BA3D91EB469F}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
71 {F9E36CFA-A657-4DD4-BD17-BA3D91EB469F}.Debug|x86.ActiveCfg = Debug|Any CPU
72 {F9E36CFA-A657-4DD4-BD17-BA3D91EB469F}.Release|Any CPU.ActiveCfg = Release|Any CPU
73 {F9E36CFA-A657-4DD4-BD17-BA3D91EB469F}.Release|Any CPU.Build.0 = Release|Any CPU
74 {F9E36CFA-A657-4DD4-BD17-BA3D91EB469F}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
75 {F9E36CFA-A657-4DD4-BD17-BA3D91EB469F}.Release|Mixed Platforms.Build.0 = Release|Any CPU
76 {F9E36CFA-A657-4DD4-BD17-BA3D91EB469F}.Release|x86.ActiveCfg = Release|Any CPU
77 {73ACCDA5-47C1-40C9-B63E-AFF657E046E4}.Debug|Any CPU.ActiveCfg = Debug|x86
78 {73ACCDA5-47C1-40C9-B63E-AFF657E046E4}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
79 {73ACCDA5-47C1-40C9-B63E-AFF657E046E4}.Debug|Mixed Platforms.Build.0 = Debug|x86
80 {73ACCDA5-47C1-40C9-B63E-AFF657E046E4}.Debug|x86.ActiveCfg = Debug|x86
81 {73ACCDA5-47C1-40C9-B63E-AFF657E046E4}.Debug|x86.Build.0 = Debug|x86
82 {73ACCDA5-47C1-40C9-B63E-AFF657E046E4}.Release|Any CPU.ActiveCfg = Release|x86
83 {73ACCDA5-47C1-40C9-B63E-AFF657E046E4}.Release|Mixed Platforms.ActiveCfg = Release|x86
84 {73ACCDA5-47C1-40C9-B63E-AFF657E046E4}.Release|Mixed Platforms.Build.0 = Release|x86
85 {73ACCDA5-47C1-40C9-B63E-AFF657E046E4}.Release|x86.ActiveCfg = Release|x86
86 {73ACCDA5-47C1-40C9-B63E-AFF657E046E4}.Release|x86.Build.0 = Release|x86
87 EndGlobalSection
88 GlobalSection(SolutionProperties) = preSolution
89 HideSolutionNode = FALSE
90 EndGlobalSection
91 EndGlobal
1 //*************************************************************************************************
2 // MessageEditor.Designer.cs
3 // Owner: Mahipal Kante
4 //
5 // UI of Editor for Web Service Request Body
6 // The Web Service response can be plain XML or 'application/soap+msbin1'
7 // (binary - used by Silverlight application with WCF RIA) or JSON
8 //
9 // Copyright(c) Microsoft Corporation, 2010
10 //*************************************************************************************************
11 namespace WebTest.WebService.Plugin.MessageEditors
12 {
13 partial class MessageEditor
14 {
15 /// <summary>
16 /// Required designer variable.
17 /// </summary>
18 private System.ComponentModel.IContainer components = null;
19
20 /// <summary>
21 /// Clean up any resources being used.
22 /// </summary>
23 /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
24 protected override void Dispose(bool disposing)
25 {
26 if (disposing && (components != null))
27 {
28 components.Dispose();
29 }
30 base.Dispose(disposing);
31 }
32
33 #region Component Designer generated code
34
35 /// <summary>
36 /// Required method for Designer support - do not modify
37 /// the contents of this method with the code editor.
38 /// </summary>
39 private void InitializeComponent()
40 {
41 this.requestTextBox = new System.Windows.Forms.TextBox();
42 this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
43 this.tabControl1 = new System.Windows.Forms.TabControl();
44 this.tabPage1 = new System.Windows.Forms.TabPage();
45 this.treeViewRequest = new System.Windows.Forms.TreeView();
46 this.tabPage2 = new System.Windows.Forms.TabPage();
47 this.panel1 = new System.Windows.Forms.Panel();
48 this.requestXMLEditor = new System.Windows.Forms.LinkLabel();
49 this.tableLayoutPanel1.SuspendLayout();
50 this.tabControl1.SuspendLayout();
51 this.tabPage1.SuspendLayout();
52 this.tabPage2.SuspendLayout();
53 this.panel1.SuspendLayout();
54 this.SuspendLayout();
55 //
56 // requestTextBox
57 //
58 this.requestTextBox.Dock = System.Windows.Forms.DockStyle.Fill;
59 this.requestTextBox.Location = new System.Drawing.Point(3, 3);
60 this.requestTextBox.Multiline = true;
61 this.requestTextBox.Name = "requestTextBox";
62 this.requestTextBox.ScrollBars = System.Windows.Forms.ScrollBars.Both;
63 this.requestTextBox.Size = new System.Drawing.Size(326, 166);
64 this.requestTextBox.TabIndex = 0;
65 this.requestTextBox.WordWrap = false;
66 //
67 // tableLayoutPanel1
68 //
69 this.tableLayoutPanel1.ColumnCount = 1;
70 this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
71 this.tableLayoutPanel1.Controls.Add(this.tabControl1, 0, 1);
72 this.tableLayoutPanel1.Controls.Add(this.panel1, 0, 0);
73 this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
74 this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0);
75 this.tableLayoutPanel1.Name = "tableLayoutPanel1";
76 this.tableLayoutPanel1.RowCount = 2;
77 this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25F));
78 this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
79 this.tableLayoutPanel1.Size = new System.Drawing.Size(346, 229);
80 this.tableLayoutPanel1.TabIndex = 1;
81 //
82 // tabControl1
83 //
84 this.tabControl1.Controls.Add(this.tabPage1);
85 this.tabControl1.Controls.Add(this.tabPage2);
86 this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill;
87 this.tabControl1.Location = new System.Drawing.Point(3, 28);
88 this.tabControl1.Name = "tabControl1";
89 this.tabControl1.SelectedIndex = 0;
90 this.tabControl1.Size = new System.Drawing.Size(340, 198);
91 this.tabControl1.TabIndex = 0;
92 //
93 // tabPage1
94 //
95 this.tabPage1.Controls.Add(this.treeViewRequest);
96 this.tabPage1.Location = new System.Drawing.Point(4, 22);
97 this.tabPage1.Name = "tabPage1";
98 this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
99 this.tabPage1.Size = new System.Drawing.Size(332, 172);
100 this.tabPage1.TabIndex = 0;
101 this.tabPage1.Text = "TreeView";
102 this.tabPage1.UseVisualStyleBackColor = true;
103 //
104 // treeViewRequest
105 //
106 this.treeViewRequest.Dock = System.Windows.Forms.DockStyle.Fill;
107 this.treeViewRequest.LabelEdit = true;
108 this.treeViewRequest.Location = new System.Drawing.Point(3, 3);
109 this.treeViewRequest.Name = "treeViewRequest";
110 this.treeViewRequest.Size = new System.Drawing.Size(326, 166);
111 this.treeViewRequest.TabIndex = 0;
112 //
113 // tabPage2
114 //
115 this.tabPage2.Controls.Add(this.requestTextBox);
116 this.tabPage2.Location = new System.Drawing.Point(4, 22);
117 this.tabPage2.Name = "tabPage2";
118 this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
119 this.tabPage2.Size = new System.Drawing.Size(332, 172);
120 this.tabPage2.TabIndex = 1;
121 this.tabPage2.Text = "Text View";
122 this.tabPage2.UseVisualStyleBackColor = true;
123 //
124 // panel1
125 //
126 this.panel1.Controls.Add(this.requestXMLEditor);
127 this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
128 this.panel1.Location = new System.Drawing.Point(3, 3);
129 this.panel1.Name = "panel1";
130 this.panel1.Size = new System.Drawing.Size(340, 19);
131 this.panel1.TabIndex = 1;
132 //
133 // requestXMLEditor
134 //
135 this.requestXMLEditor.AutoSize = true;
136 this.requestXMLEditor.Location = new System.Drawing.Point(4, 4);
137 this.requestXMLEditor.Name = "requestXMLEditor";
138 this.requestXMLEditor.Size = new System.Drawing.Size(96, 13);
139 this.requestXMLEditor.TabIndex = 0;
140 this.requestXMLEditor.TabStop = true;
141 this.requestXMLEditor.Text = "View in XML Editor";
142 this.requestXMLEditor.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.requestXMLEditor_LinkClicked);
143 //
144 // UserControl1
145 //
146 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
147 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
148 this.Controls.Add(this.tableLayoutPanel1);
149 this.Name = "UserControl1";
150 this.Size = new System.Drawing.Size(346, 229);
151 this.tableLayoutPanel1.ResumeLayout(false);
152 this.tabControl1.ResumeLayout(false);
153 this.tabPage1.ResumeLayout(false);
154 this.tabPage2.ResumeLayout(false);
155 this.tabPage2.PerformLayout();
156 this.panel1.ResumeLayout(false);
157 this.panel1.PerformLayout();
158 this.ResumeLayout(false);
159
160 }
161
162 #endregion
163
164 private System.Windows.Forms.TextBox requestTextBox;
165 private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
166 private System.Windows.Forms.TabControl tabControl1;
167 private System.Windows.Forms.TabPage tabPage1;
168 private System.Windows.Forms.TabPage tabPage2;
169 private System.Windows.Forms.TreeView treeViewRequest;
170 private System.Windows.Forms.Panel panel1;
171 private System.Windows.Forms.LinkLabel requestXMLEditor;
172 }
173 }
1 //*************************************************************************************************
2 // MessageEditor.cs
3 // Owner: Mahipal Kante
4 //
5 // UI of Editor for Web Service Request Body
6 // The Web Service response can be plain XML or 'application/soap+msbin1'
7 // (binary - used by Silverlight application with WCF RIA) or JSON
8 //
9 // Copyright(c) Microsoft Corporation, 2010
10 //*************************************************************************************************
11 using System;
12 using System.Collections.Generic;
13 using System.ComponentModel;
14 using System.Drawing;
15 using System.Data;
16 using System.Linq;
17 using System.Text;
18 using System.Windows.Forms;
19 using System.Xml;
20 using WebTest.WebService.Plugin.ResultTab;
21 using WebTest.WebService.Plugin.Runtime;
22
23 namespace WebTest.WebService.Plugin.MessageEditors
24 {
25 internal partial class MessageEditor : UserControl
26 {
27 /// <summary>
28 ///
29 /// </summary>
30 /// <param name="contentHandler">Handler for given content type</param>
31 public MessageEditor(ContentHandler contentHandler)
32 {
33 InitializeComponent();
34
35 this.tabControl1.SelectedIndexChanged += new System.EventHandler(this.TabChanged);
36 this.xmlTreeView = new XmlTreeView(this.treeViewRequest);
37
38 this.contentHandler = contentHandler;
39 this.xmlTreeView.ShowXML(contentHandler.XmlDocument);
40 this.requestTextBox.Text = contentHandler.XmlString;
41
42 ContextMenu treeContextMenu = new ContextMenu();
43 this.treeParameterizeMenuItem = new MenuItem("Parameterize");
44 treeContextMenu.MenuItems.Add(treeParameterizeMenuItem);
45 this.treeViewRequest.ContextMenu = treeContextMenu;
46
47
48 this.treeParameterizeMenuItem.MenuItems.Clear();
49 this.treeParameterizeMenuItem.MenuItems.Add(new MenuItem("Type Parameter", AddParameter));
50
51 Connect connect = Connect.GetInstance();
52 if (connect != null)
53 {
54 this.webTestDetail = connect.GetActiveWebTest();
55 }
56 requestXMLEditor.Visible = (this.webTestDetail != null);
57 if (this.webTestDetail != null)
58 {
59 List<string> parameters = this.webTestDetail.GetParameterList();
60
61 foreach (string parameter in parameters)
62 {
63 this.treeParameterizeMenuItem.MenuItems.Add(new MenuItem(parameter, AddParameter));
64 }
65 }
66 }
67
68 /// <summary>
69 /// Makes sure both tabs are synced with the current changes that are done in Text Box
70 /// </summary>
71 public void UpdateContent()
72 {
73 if (this.tabControl1.SelectedTab.Equals(this.tabPage2))
74 {
75 this.contentHandler.XmlString = this.requestTextBox.Text;
76 }
77 }
78
79 private void AddParameter(object sender, EventArgs e)
80 {
81 MenuItem menuItem = sender as MenuItem;
82 if (menuItem == null)
83 {
84 return;
85 }
86 this.xmlTreeView.AddParameter(menuItem.Text);
87 }
88
89 private void TabChanged(object sender, EventArgs e)
90 {
91 if (this.tabControl1.SelectedTab.Equals(this.tabPage1))
92 {
93 this.contentHandler.XmlString = this.requestTextBox.Text;
94 xmlTreeView.ShowXML(this.contentHandler.XmlDocument);
95 }
96 else
97 {
98 this.requestTextBox.Text = this.contentHandler.XmlString;
99 }
100 }
101
102 private void requestXMLEditor_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
103 {
104 Connect.GetInstance().ShowInXMLEditor("Request Content", this.requestTextBox.Text);
105 }
106
107 private ContentHandler contentHandler;
108
109 private WebTestDetail webTestDetail;
110 private XmlTreeView xmlTreeView;
111 private MenuItem treeParameterizeMenuItem;
112 }
113 }
1 <?xml version="1.0" encoding="utf-8"?>
2 <root>
3 <!--
4 Microsoft ResX Schema
5
6 Version 2.0
7
8 The primary goals of this format is to allow a simple XML format
9 that is mostly human readable. The generation and parsing of the
10 various data types are done through the TypeConverter classes
11 associated with the data types.
12
13 Example:
14
15 ... ado.net/XML headers & schema ...
16 <resheader name="resmimetype">text/microsoft-resx</resheader>
17 <resheader name="version">2.0</resheader>
18 <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
19 <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
20 <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
21 <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
22 <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
23 <value>[base64 mime encoded serialized .NET Framework object]</value>
24 </data>
25 <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
26 <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
27 <comment>This is a comment</comment>
28 </data>
29
30 There are any number of "resheader" rows that contain simple
31 name/value pairs.
32
33 Each data row contains a name, and value. The row also contains a
34 type or mimetype. Type corresponds to a .NET class that support
35 text/value conversion through the TypeConverter architecture.
36 Classes that don't support this are serialized and stored with the
37 mimetype set.
38
39 The mimetype is used for serialized objects, and tells the
40 ResXResourceReader how to depersist the object. This is currently not
41 extensible. For a given mimetype the value must be set accordingly:
42
43 Note - application/x-microsoft.net.object.binary.base64 is the format
44 that the ResXResourceWriter will generate, however the reader can
45 read any of the formats listed below.
46
47 mimetype: application/x-microsoft.net.object.binary.base64
48 value : The object must be serialized with
49 : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
50 : and then encoded with base64 encoding.
51
52 mimetype: application/x-microsoft.net.object.soap.base64
53 value : The object must be serialized with
54 : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
55 : and then encoded with base64 encoding.
56
57 mimetype: application/x-microsoft.net.object.bytearray.base64
58 value : The object must be serialized into a byte array
59 : using a System.ComponentModel.TypeConverter
60 : and then encoded with base64 encoding.
61 -->
62 <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
63 <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
64 <xsd:element name="root" msdata:IsDataSet="true">
65 <xsd:complexType>
66 <xsd:choice maxOccurs="unbounded">
67 <xsd:element name="metadata">
68 <xsd:complexType>
69 <xsd:sequence>
70 <xsd:element name="value" type="xsd:string" minOccurs="0" />
71 </xsd:sequence>
72 <xsd:attribute name="name" use="required" type="xsd:string" />
73 <xsd:attribute name="type" type="xsd:string" />
74 <xsd:attribute name="mimetype" type="xsd:string" />
75 <xsd:attribute ref="xml:space" />
76 </xsd:complexType>
77 </xsd:element>
78 <xsd:element name="assembly">
79 <xsd:complexType>
80 <xsd:attribute name="alias" type="xsd:string" />
81 <xsd:attribute name="name" type="xsd:string" />
82 </xsd:complexType>
83 </xsd:element>
84 <xsd:element name="data">
85 <xsd:complexType>
86 <xsd:sequence>
87 <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
88 <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
89 </xsd:sequence>
90 <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
91 <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
92 <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
93 <xsd:attribute ref="xml:space" />
94 </xsd:complexType>
95 </xsd:element>
96 <xsd:element name="resheader">
97 <xsd:complexType>
98 <xsd:sequence>
99 <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
100 </xsd:sequence>
101 <xsd:attribute name="name" type="xsd:string" use="required" />
102 </xsd:complexType>
103 </xsd:element>
104 </xsd:choice>
105 </xsd:complexType>
106 </xsd:element>
107 </xsd:schema>
108 <resheader name="resmimetype">
109 <value>text/microsoft-resx</value>
110 </resheader>
111 <resheader name="version">
112 <value>2.0</value>
113 </resheader>
114 <resheader name="reader">
115 <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
116 </resheader>
117 <resheader name="writer">
118 <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
119 </resheader>
120 </root>
...\ No newline at end of file ...\ No newline at end of file
1 //*************************************************************************************************
2 // Msbin1MessageEditor.cs
3 // Owner: Mahipal Kante
4 //
5 // Web Test Plugin for editing 'application/soap+msbin1' content type Web Service Requests
6 // (used by Silverlight application with WCF RIA)
7 //
8 // Copyright(c) Microsoft Corporation, 2010
9 //*************************************************************************************************
10 using Microsoft.VisualStudio.TestTools.WebTesting;
11 using WebTest.WebService.Plugin.ResultTab;
12 using WebTest.WebService.Plugin.Runtime;
13
14 namespace WebTest.WebService.Plugin.MessageEditors
15 {
16 /// <summary>
17 /// Editor for MSBin1 content type (WCF messages)
18 /// </summary>
19 public class Msbin1MessageEditor : IBinaryHttpBodyEditorPlugin
20 {
21 /// <summary>
22 ///
23 /// </summary>
24 public Msbin1MessageEditor()
25 {
26 }
27
28 /// <summary>
29 /// Determine if this plugin supports a content type.
30 /// </summary>
31 /// <param name="contentType">The content type to test.</param>
32 /// <returns>Returns true if the plugin supports the specified content type.</returns>
33 public bool SupportsContentType(string contentType)
34 {
35 return contentType.ToLower().Contains("msbin1");
36 }
37
38 /// <summary>
39 /// Create a UserControl to edit the specified bytes. This control will be hosted in the
40 /// plugin dialog which provides OK and Cancel buttons.
41 /// </summary>
42 /// <param name="contentType">The content type of the BinaryHttpBody.</param>
43 /// <param name="initialValue">
44 /// The bytes to edit. The bytes are the payload of a BinaryHttpBody.
45 /// </param>
46 /// <returns>
47 /// A UserControl capable of displaying and editing the byte array value of
48 /// the specified content type.
49 /// </returns>
50 public object CreateEditor(string contentType, byte[] initialValue)
51 {
52 contentHandler = new Msbin1ContentHandler(contentType.ToLower().Contains("soap"));
53 contentHandler.MessageBytes = initialValue;
54 messageEditor = new MessageEditor(contentHandler);
55 return messageEditor;
56 }
57
58 /// <summary>
59 /// Gets the edited bytes after the OK button is clicked on the plugin dialog.
60 /// </summary>
61 public byte[] GetNewValue()
62 {
63 messageEditor.UpdateContent();
64 return contentHandler.MessageBytes;
65 }
66
67 private MessageEditor messageEditor = null;
68 private Msbin1ContentHandler contentHandler = null;
69 }
70 }
1 using System.Reflection;
2 using System.Runtime.CompilerServices;
3 using System.Runtime.InteropServices;
4
5 // General Information about an assembly is controlled through the following
6 // set of attributes. Change these attribute values to modify the information
7 // associated with an assembly.
8 [assembly: AssemblyTitle("ClassLibrary1")]
9 [assembly: AssemblyDescription("")]
10 [assembly: AssemblyConfiguration("")]
11 [assembly: AssemblyCompany("Microsoft IT")]
12 [assembly: AssemblyProduct("ClassLibrary1")]
13 [assembly: AssemblyCopyright("Copyright © Microsoft IT 2010")]
14 [assembly: AssemblyTrademark("")]
15 [assembly: AssemblyCulture("")]
16
17 // Setting ComVisible to false makes the types in this assembly not visible
18 // to COM components. If you need to access a type in this assembly from
19 // COM, set the ComVisible attribute to true on that type.
20 [assembly: ComVisible(false)]
21
22 // The following GUID is for the ID of the typelib if this project is exposed to COM
23 [assembly: Guid("fe8ec1e0-7f8a-4935-b5f3-00f482453031")]
24
25 // Version information for an assembly consists of the following four values:
26 //
27 // Major Version
28 // Minor Version
29 // Build Number
30 // Revision
31 //
32 // You can specify all the values or you can default the Build and Revision Numbers
33 // by using the '*' as shown below:
34 // [assembly: AssemblyVersion("1.0.*")]
35 [assembly: AssemblyVersion("1.0.0.0")]
36 [assembly: AssemblyFileVersion("1.0.0.0")]
1 <?xml version="1.0" encoding="utf-8"?>
2 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3 <PropertyGroup>
4 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
5 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
6 <ProductVersion>8.0.30703</ProductVersion>
7 <SchemaVersion>2.0</SchemaVersion>
8 <ProjectGuid>{23707A49-589B-4A36-BDAA-2896E647D07D}</ProjectGuid>
9 <OutputType>Library</OutputType>
10 <AppDesignerFolder>Properties</AppDesignerFolder>
11 <RootNamespace>WebTest.WebService.Plugin.MessageEditors</RootNamespace>
12 <AssemblyName>WebTest.WebService.Plugin.MessageEditors</AssemblyName>
13 <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
14 <FileAlignment>512</FileAlignment>
15 <SccProjectName>SAK</SccProjectName>
16 <SccLocalPath>SAK</SccLocalPath>
17 <SccAuxPath>SAK</SccAuxPath>
18 <SccProvider>SAK</SccProvider>
19 <TargetFrameworkProfile />
20 </PropertyGroup>
21 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
22 <DebugSymbols>true</DebugSymbols>
23 <DebugType>full</DebugType>
24 <Optimize>false</Optimize>
25 <OutputPath>bin\Debug\</OutputPath>
26 <DefineConstants>DEBUG;TRACE</DefineConstants>
27 <ErrorReport>prompt</ErrorReport>
28 <WarningLevel>4</WarningLevel>
29 <Prefer32Bit>false</Prefer32Bit>
30 </PropertyGroup>
31 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
32 <DebugType>pdbonly</DebugType>
33 <Optimize>true</Optimize>
34 <OutputPath>bin\Release\</OutputPath>
35 <DefineConstants>TRACE</DefineConstants>
36 <ErrorReport>prompt</ErrorReport>
37 <WarningLevel>4</WarningLevel>
38 <Prefer32Bit>false</Prefer32Bit>
39 </PropertyGroup>
40 <ItemGroup>
41 <Reference Include="Extensibility, Version=7.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
42 <EmbedInteropTypes>True</EmbedInteropTypes>
43 </Reference>
44 <Reference Include="Microsoft.VisualStudio.QualityTools.WebTestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
45 <Reference Include="System" />
46 <Reference Include="System.Core" />
47 <Reference Include="System.Drawing" />
48 <Reference Include="System.Windows.Forms" />
49 <Reference Include="System.Xml.Linq" />
50 <Reference Include="System.Data.DataSetExtensions" />
51 <Reference Include="Microsoft.CSharp" />
52 <Reference Include="System.Data" />
53 <Reference Include="System.Xml" />
54 </ItemGroup>
55 <ItemGroup>
56 <Compile Include="Msbin1MessageEditor.cs" />
57 <Compile Include="Properties\AssemblyInfo.cs" />
58 <Compile Include="MessageEditor.cs">
59 <SubType>UserControl</SubType>
60 </Compile>
61 <Compile Include="MessageEditor.Designer.cs">
62 <DependentUpon>MessageEditor.cs</DependentUpon>
63 </Compile>
64 <Compile Include="WebServicePostRecording.cs" />
65 <Compile Include="XmlMessageEditor.cs" />
66 </ItemGroup>
67 <ItemGroup>
68 <EmbeddedResource Include="MessageEditor.resx">
69 <DependentUpon>MessageEditor.cs</DependentUpon>
70 </EmbeddedResource>
71 </ItemGroup>
72 <ItemGroup>
73 <ProjectReference Include="..\WebTestWebServiceResultAddin\WebServicePluginForWebTestResultTab.csproj">
74 <Project>{48B3509E-1FD8-4875-8FC6-137647EB83AA}</Project>
75 <Name>WebServicePluginForWebTestResultTab</Name>
76 </ProjectReference>
77 <ProjectReference Include="..\WebTestWebServiceRuntime\WebServicePluginForWebTestRuntime.csproj">
78 <Project>{F9E36CFA-A657-4DD4-BD17-BA3D91EB469F}</Project>
79 <Name>WebServicePluginForWebTestRuntime</Name>
80 </ProjectReference>
81 </ItemGroup>
82 <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
83 <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
84 Other similar extension points exist, see Microsoft.Common.targets.
85 <Target Name="BeforeBuild">
86 </Target>
87 <Target Name="AfterBuild">
88 </Target>
89 -->
90 </Project>
...\ No newline at end of file ...\ No newline at end of file
1 //*************************************************************************************************
2 // WebServicePostRecording.cs
3 // Owner: Mahipal Kante
4 //
5 // WebTestRecorderPlugin Implementation:
6 // Web Test Plugin for adding references to the other Web Service plugins
7 // (Extraction/Validation rules etc) to the WebTest after completing recording.
8 // This gets executed if user selects the plugin in the dialog that gets displayed
9 // before a record session.
10 //
11 // Copyright(c) Microsoft Corporation, 2010
12 //*************************************************************************************************
13 using System.ComponentModel;
14 using Microsoft.VisualStudio.TestTools.WebTesting;
15 using System.Diagnostics.CodeAnalysis;
16 using WebTest.WebService.Plugin.ResultTab;
17 using WebTest.WebService.Plugin.Runtime;
18
19 namespace WebTest.WebService.Plugin.MessageEditors
20 {
21 [DisplayName("Plugin for Web Service Messages")]
22 [Description("XPath extraction/validation rules that extract data from Web Service responses for various content types")]
23 class WebServicePostRecording : WebTestRecorderPlugin
24 {
25 /// <summary>
26 /// Parameters:
27 /// sender:
28 /// The source of the event.
29 ///
30 /// e:
31 /// A Microsoft.VisualStudio.TestTools.WebTesting.PostWebTestRecordingEventArgs
32 /// that contains the event data.
33 /// </summary>
34 /// <param name="sender"></param>
35 /// <param name="e"></param>
36 [SuppressMessage("Microsoft.Security", "CA2109:ReviewVisibleEventHandlers")]
37 public override void PostWebTestDynamicParameterDetection(object sender, PostWebTestRecordingEventArgs e)
38 {
39 Connect connect = Connect.GetInstance();
40 if (connect != null)
41 {
42 connect.AddWebTestRecording(e.RecordedWebTest);
43 }
44
45 bool pluginFound = false;
46 foreach (WebTestPluginReference pluginReference1 in e.RecordedWebTest.WebTestPluginReferences)
47 {
48 if (pluginReference1.Type.ToString().Equals(typeof(WebServicePlugin).ToString()))
49 {
50 pluginFound = true;
51 break;
52 }
53 }
54
55 if (!pluginFound)
56 {
57 WebTestPluginReference pluginReference = new WebTestPluginReference();
58 pluginReference.Type = typeof(WebServicePlugin);
59 e.RecordedWebTest.WebTestPluginReferences.Add(pluginReference);
60 }
61
62 // Mark it as modified
63 e.RecordedWebTestModified = true;
64 }
65 }
66 }
1 //*************************************************************************************************
2 // XmlMessageEditor.cs
3 // Owner: Mahipal Kante
4 //
5 // Web Test Plugin for editing XML string type Web Service Requests
6 //
7 // Copyright(c) Microsoft Corporation, 2010
8 //*************************************************************************************************
9 using Microsoft.VisualStudio.TestTools.WebTesting;
10 using WebTest.WebService.Plugin.ResultTab;
11 using WebTest.WebService.Plugin.Runtime;
12
13 namespace WebTest.WebService.Plugin.MessageEditors
14 {
15 /// <summary>
16 /// Editor for generic text based hierarchical messages such as XML, JSON etc
17 /// </summary>
18 public class XmlMessageEditor : IStringHttpBodyEditorPlugin
19 {
20 public XmlMessageEditor()
21 {
22 }
23
24 /// <summary>
25 /// Determine if this plugin supports a content type.
26 /// </summary>
27 /// <param name="contentType">The content type to test.</param>
28 /// <returns>Returns true if the plugin supports the specified content type.</returns>
29 public bool SupportsContentType(string contentType)
30 {
31 return (ContentHandlerFactory.GetHandler(contentType) != null);
32 }
33
34 /// <summary>
35 /// Create a UserControl to edit the specified bytes. This control will be hosted in the
36 /// plugin dialog which provides OK and Cancel buttons.
37 /// </summary>
38 /// <param name="contentType">The content type of the BinaryHttpBody.</param>
39 /// <param name="initialValue">
40 /// The bytes to edit. The bytes are the payload of a BinaryHttpBody.
41 /// </param>
42 /// <returns>A UserControl capable of displaying and editing the byte array
43 /// value of the specified content type.
44 /// </returns>
45 public object CreateEditor(string contentType, string initialValue)
46 {
47 contentHandler = ContentHandlerFactory.GetHandler(contentType);
48 contentHandler.MessageString = initialValue;
49 messageEditor = new MessageEditor(contentHandler);
50 return messageEditor;
51 }
52
53 /// <summary>
54 /// Gets the edited bytes after the OK button is clicked on the plugin dialog.
55 /// </summary>
56 public string GetNewValue()
57 {
58 messageEditor.UpdateContent();
59 return contentHandler.MessageString;
60 }
61
62 private MessageEditor messageEditor;
63 private ContentHandler contentHandler = null;
64 }
65 }
No preview for this file type
No preview for this file type
1 //------------------------------------------------------------------------------
2 // <auto-generated>
3 // This code was generated by a tool.
4 // Runtime Version:4.0.30319.17929
5 //
6 // Changes to this file may cause incorrect behavior and will be lost if
7 // the code is regenerated.
8 // </auto-generated>
9 //------------------------------------------------------------------------------
10
11 namespace WebTest.WebService.Plugin.ResultTab.Properties {
12 using System;
13
14
15 /// <summary>
16 /// A strongly-typed resource class, for looking up localized strings, etc.
17 /// </summary>
18 // This class was auto-generated by the StronglyTypedResourceBuilder
19 // class via a tool like ResGen or Visual Studio.
20 // To add or remove a member, edit your .ResX file then rerun ResGen
21 // with the /str option, or rebuild your VS project.
22 [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
23 [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 internal class Resources {
26
27 private static global::System.Resources.ResourceManager resourceMan;
28
29 private static global::System.Globalization.CultureInfo resourceCulture;
30
31 [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
32 internal Resources() {
33 }
34
35 /// <summary>
36 /// Returns the cached ResourceManager instance used by this class.
37 /// </summary>
38 [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
39 internal static global::System.Resources.ResourceManager ResourceManager {
40 get {
41 if (object.ReferenceEquals(resourceMan, null)) {
42 global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("WebTest.WebService.Plugin.ResultTab.Properties.Resources", typeof(Resources).Assembly);
43 resourceMan = temp;
44 }
45 return resourceMan;
46 }
47 }
48
49 /// <summary>
50 /// Overrides the current thread's CurrentUICulture property for all
51 /// resource lookups using this strongly typed resource class.
52 /// </summary>
53 [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
54 internal static global::System.Globalization.CultureInfo Culture {
55 get {
56 return resourceCulture;
57 }
58 set {
59 resourceCulture = value;
60 }
61 }
62 }
63 }
1 <?xml version="1.0" encoding="utf-8"?>
2 <root>
3 <!--
4 Microsoft ResX Schema
5
6 Version 2.0
7
8 The primary goals of this format is to allow a simple XML format
9 that is mostly human readable. The generation and parsing of the
10 various data types are done through the TypeConverter classes
11 associated with the data types.
12
13 Example:
14
15 ... ado.net/XML headers & schema ...
16 <resheader name="resmimetype">text/microsoft-resx</resheader>
17 <resheader name="version">2.0</resheader>
18 <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
19 <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
20 <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
21 <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
22 <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
23 <value>[base64 mime encoded serialized .NET Framework object]</value>
24 </data>
25 <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
26 <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
27 <comment>This is a comment</comment>
28 </data>
29
30 There are any number of "resheader" rows that contain simple
31 name/value pairs.
32
33 Each data row contains a name, and value. The row also contains a
34 type or mimetype. Type corresponds to a .NET class that support
35 text/value conversion through the TypeConverter architecture.
36 Classes that don't support this are serialized and stored with the
37 mimetype set.
38
39 The mimetype is used for serialized objects, and tells the
40 ResXResourceReader how to depersist the object. This is currently not
41 extensible. For a given mimetype the value must be set accordingly:
42
43 Note - application/x-microsoft.net.object.binary.base64 is the format
44 that the ResXResourceWriter will generate, however the reader can
45 read any of the formats listed below.
46
47 mimetype: application/x-microsoft.net.object.binary.base64
48 value : The object must be serialized with
49 : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
50 : and then encoded with base64 encoding.
51
52 mimetype: application/x-microsoft.net.object.soap.base64
53 value : The object must be serialized with
54 : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
55 : and then encoded with base64 encoding.
56
57 mimetype: application/x-microsoft.net.object.bytearray.base64
58 value : The object must be serialized into a byte array
59 : using a System.ComponentModel.TypeConverter
60 : and then encoded with base64 encoding.
61 -->
62 <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
63 <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
64 <xsd:element name="root" msdata:IsDataSet="true">
65 <xsd:complexType>
66 <xsd:choice maxOccurs="unbounded">
67 <xsd:element name="metadata">
68 <xsd:complexType>
69 <xsd:sequence>
70 <xsd:element name="value" type="xsd:string" minOccurs="0" />
71 </xsd:sequence>
72 <xsd:attribute name="name" use="required" type="xsd:string" />
73 <xsd:attribute name="type" type="xsd:string" />
74 <xsd:attribute name="mimetype" type="xsd:string" />
75 <xsd:attribute ref="xml:space" />
76 </xsd:complexType>
77 </xsd:element>
78 <xsd:element name="assembly">
79 <xsd:complexType>
80 <xsd:attribute name="alias" type="xsd:string" />
81 <xsd:attribute name="name" type="xsd:string" />
82 </xsd:complexType>
83 </xsd:element>
84 <xsd:element name="data">
85 <xsd:complexType>
86 <xsd:sequence>
87 <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
88 <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
89 </xsd:sequence>
90 <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
91 <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
92 <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
93 <xsd:attribute ref="xml:space" />
94 </xsd:complexType>
95 </xsd:element>
96 <xsd:element name="resheader">
97 <xsd:complexType>
98 <xsd:sequence>
99 <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
100 </xsd:sequence>
101 <xsd:attribute name="name" type="xsd:string" use="required" />
102 </xsd:complexType>
103 </xsd:element>
104 </xsd:choice>
105 </xsd:complexType>
106 </xsd:element>
107 </xsd:schema>
108 <resheader name="resmimetype">
109 <value>text/microsoft-resx</value>
110 </resheader>
111 <resheader name="version">
112 <value>2.0</value>
113 </resheader>
114 <resheader name="reader">
115 <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
116 </resheader>
117 <resheader name="writer">
118 <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
119 </resheader>
120 </root>
...\ No newline at end of file ...\ No newline at end of file
1 <?xml version="1.0" encoding="utf-8"?>
2 <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
3 <PropertyGroup>
4 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
5 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
6 <ProductVersion>8.0.30424</ProductVersion>
7 <SchemaVersion>2.0</SchemaVersion>
8 <ProjectGuid>{48B3509E-1FD8-4875-8FC6-137647EB83AA}</ProjectGuid>
9 <OutputType>Library</OutputType>
10 <StartupObject>
11 </StartupObject>
12 <NoStandardLibraries>false</NoStandardLibraries>
13 <AssemblyName>WebTest.WebService.Plugin.ResultTab</AssemblyName>
14 <DeploymentDirectory>.\bin\</DeploymentDirectory>
15 <SccProjectName>SAK</SccProjectName>
16 <SccLocalPath>SAK</SccLocalPath>
17 <SccAuxPath>SAK</SccAuxPath>
18 <SccProvider>SAK</SccProvider>
19 <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
20 <TargetFrameworkProfile />
21 </PropertyGroup>
22 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
23 <DebugSymbols>true</DebugSymbols>
24 <Optimize>false</Optimize>
25 <OutputPath>.\bin\Debug\</OutputPath>
26 <EnableUnmanagedDebugging>false</EnableUnmanagedDebugging>
27 <DefineConstants>DEBUG;TRACE</DefineConstants>
28 <WarningLevel>4</WarningLevel>
29 <IncrementalBuild>false</IncrementalBuild>
30 <DocumentationFile>WebTest.WebService.Plugin.ResultTab.xml</DocumentationFile>
31 <Prefer32Bit>false</Prefer32Bit>
32 </PropertyGroup>
33 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
34 <DebugSymbols>false</DebugSymbols>
35 <Optimize>true</Optimize>
36 <OutputPath>.\bin\Release\</OutputPath>
37 <EnableUnmanagedDebugging>false</EnableUnmanagedDebugging>
38 <DefineConstants>TRACE</DefineConstants>
39 <WarningLevel>4</WarningLevel>
40 <IncrementalBuild>false</IncrementalBuild>
41 <DocumentationFile>WebTest.WebService.Plugin.ResultTab.xml</DocumentationFile>
42 <Prefer32Bit>false</Prefer32Bit>
43 </PropertyGroup>
44 <PropertyGroup>
45 <RootNamespace>WebTest.WebService.Plugin.ResultTab</RootNamespace>
46 </PropertyGroup>
47 <ItemGroup>
48 <Reference Include="Extensibility, Version=7.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
49 <EmbedInteropTypes>False</EmbedInteropTypes>
50 </Reference>
51 <Reference Include="Microsoft.mshtml, Version=7.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
52 <EmbedInteropTypes>True</EmbedInteropTypes>
53 </Reference>
54 <Reference Include="Microsoft.VisualStudio.QualityTools.LoadTestFramework" />
55 <Reference Include="Microsoft.VisualStudio.QualityTools.LoadTestPackage">
56 <HintPath>C:\Program Files\Microsoft Visual Studio 11.0\Common7\IDE\PrivateAssemblies\Microsoft.VisualStudio.QualityTools.LoadTestPackage.dll</HintPath>
57 <HintPath>C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\PrivateAssemblies\Microsoft.VisualStudio.QualityTools.LoadTestPackage.dll</HintPath>
58 <Private>False</Private>
59 </Reference>
60 <Reference Include="Microsoft.VisualStudio.QualityTools.WebTestFramework" />
61 <Reference Include="System" />
62 <Reference Include="System.Core" />
63 <Reference Include="System.Data" />
64 <Reference Include="System.Drawing" />
65 <Reference Include="System.Windows.Forms" />
66 <Reference Include="System.Xml" />
67 <Reference Include="Microsoft.CSharp" />
68 <Reference Include="Microsoft.VisualStudio.Shell.11.0" />
69 <Reference Include="Microsoft.VisualStudio.Shell.Immutable.11.0" />
70 <Reference Include="Microsoft.VisualStudio.OLE.Interop" />
71 <Reference Include="Microsoft.VisualStudio.Shell.Interop" />
72 <Reference Include="Microsoft.VisualStudio.Shell.Interop.8.0" />
73 <Reference Include="Microsoft.VisualStudio.Shell.Interop.9.0" />
74 <Reference Include="Microsoft.VisualStudio.Shell.Interop.10.0" />
75 <Reference Include="VSLangProj, Version=7.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
76 <EmbedInteropTypes>True</EmbedInteropTypes>
77 </Reference>
78 <Reference Include="VSLangProj2, Version=7.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
79 <EmbedInteropTypes>True</EmbedInteropTypes>
80 </Reference>
81 <Reference Include="VSLangProj80, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
82 <EmbedInteropTypes>True</EmbedInteropTypes>
83 </Reference>
84 </ItemGroup>
85 <ItemGroup>
86 <Compile Include="AssemblyInfo.cs">
87 <SubType>Code</SubType>
88 </Compile>
89 <Compile Include="Connect.cs">
90 <SubType>Code</SubType>
91 </Compile>
92 <Compile Include="Properties\Resources.Designer.cs">
93 <AutoGen>True</AutoGen>
94 <DesignTime>True</DesignTime>
95 <DependentUpon>Resources.resx</DependentUpon>
96 </Compile>
97 <Compile Include="WebServiceResult.cs">
98 <SubType>UserControl</SubType>
99 </Compile>
100 <Compile Include="WebServiceResult.Designer.cs">
101 <DependentUpon>WebServiceResult.cs</DependentUpon>
102 </Compile>
103 <Compile Include="WebTestDetail.cs" />
104 <Compile Include="XmlTreeView.cs" />
105 </ItemGroup>
106 <ItemGroup>
107 <COMReference Include="EnvDTE">
108 <Guid>{80CC9F66-E7D8-4DDD-85B6-D9E6CD0E93E2}</Guid>
109 <VersionMajor>8</VersionMajor>
110 <VersionMinor>0</VersionMinor>
111 <Lcid>0</Lcid>
112 <WrapperTool>primary</WrapperTool>
113 <Isolated>False</Isolated>
114 <EmbedInteropTypes>False</EmbedInteropTypes>
115 </COMReference>
116 <COMReference Include="EnvDTE100">
117 <Guid>{26AD1324-4B7C-44BC-84F8-B86AED45729F}</Guid>
118 <VersionMajor>10</VersionMajor>
119 <VersionMinor>0</VersionMinor>
120 <Lcid>0</Lcid>
121 <WrapperTool>primary</WrapperTool>
122 <Isolated>False</Isolated>
123 <EmbedInteropTypes>False</EmbedInteropTypes>
124 </COMReference>
125 <COMReference Include="EnvDTE80">
126 <Guid>{1A31287A-4D7D-413E-8E32-3B374931BD89}</Guid>
127 <VersionMajor>8</VersionMajor>
128 <VersionMinor>0</VersionMinor>
129 <Lcid>0</Lcid>
130 <WrapperTool>primary</WrapperTool>
131 <Isolated>False</Isolated>
132 <EmbedInteropTypes>False</EmbedInteropTypes>
133 </COMReference>
134 <COMReference Include="EnvDTE90">
135 <Guid>{2CE2370E-D744-4936-A090-3FFFE667B0E1}</Guid>
136 <VersionMajor>9</VersionMajor>
137 <VersionMinor>0</VersionMinor>
138 <Lcid>0</Lcid>
139 <WrapperTool>primary</WrapperTool>
140 <Isolated>False</Isolated>
141 <EmbedInteropTypes>False</EmbedInteropTypes>
142 </COMReference>
143 <COMReference Include="Microsoft.VisualStudio.CommandBars">
144 <Guid>{1CBA492E-7263-47BB-87FE-639000619B15}</Guid>
145 <VersionMajor>8</VersionMajor>
146 <VersionMinor>0</VersionMinor>
147 <Lcid>0</Lcid>
148 <WrapperTool>primary</WrapperTool>
149 <Isolated>False</Isolated>
150 <EmbedInteropTypes>False</EmbedInteropTypes>
151 </COMReference>
152 <COMReference Include="stdole">
153 <Guid>{00020430-0000-0000-C000-000000000046}</Guid>
154 <VersionMajor>2</VersionMajor>
155 <VersionMinor>0</VersionMinor>
156 <Lcid>0</Lcid>
157 <WrapperTool>primary</WrapperTool>
158 <Isolated>False</Isolated>
159 <EmbedInteropTypes>False</EmbedInteropTypes>
160 </COMReference>
161 </ItemGroup>
162 <ItemGroup>
163 <Content Include="WebServicePluginForWebTestResultTab.AddIn">
164 <SubType>Designer</SubType>
165 </Content>
166 </ItemGroup>
167 <ItemGroup>
168 <EmbeddedResource Include="Properties\Resources.resx">
169 <Generator>ResXFileCodeGenerator</Generator>
170 <LastGenOutput>Resources.Designer.cs</LastGenOutput>
171 </EmbeddedResource>
172 <EmbeddedResource Include="WebServiceResult.resx">
173 <DependentUpon>WebServiceResult.cs</DependentUpon>
174 </EmbeddedResource>
175 </ItemGroup>
176 <ItemGroup>
177 <ProjectReference Include="..\WebTestWebServiceRuntime\WebServicePluginForWebTestRuntime.csproj">
178 <Project>{F9E36CFA-A657-4DD4-BD17-BA3D91EB469F}</Project>
179 <Name>WebServicePluginForWebTestRuntime</Name>
180 <Private>False</Private>
181 </ProjectReference>
182 </ItemGroup>
183 <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
184 <PropertyGroup>
185 <PreBuildEvent>
186 </PreBuildEvent>
187 <PostBuildEvent>
188 </PostBuildEvent>
189 </PropertyGroup>
190 <ProjectExtensions />
191 <Target Name="AfterBuild">
192 <PropertyGroup>
193 <DllName>$(AssemblyName).dll</DllName>
194 <PdbName>$(AssemblyName).pdb</PdbName>
195 <DocFileName>$(AssemblyName).xml</DocFileName>
196 </PropertyGroup>
197 <Delete Condition="Exists('$(DeploymentDirectory)$(DllName)')" Files="$(DeploymentDirectory)$(DllName)">
198 </Delete>
199 <Delete Condition="Exists('$(DeploymentDirectory)$(PdbName)')" Files="$(DeploymentDirectory)$(PdbName)">
200 </Delete>
201 <Delete Condition="Exists('$(DeploymentDirectory)$(DocFileName)')" Files="$(DeploymentDirectory)$(DocFileName)">
202 </Delete>
203 <Copy Condition="Exists('$(OutputPath)$(DllName)')" SourceFiles="$(OutputPath)$(DllName)" DestinationFolder="$(DeploymentDirectory)">
204 <Output TaskParameter="DestinationFiles" ItemName="FileWrites" />
205 </Copy>
206 <Copy Condition="Exists('$(OutputPath)$(PdbName)')" SourceFiles="$(OutputPath)$(PdbName)" DestinationFolder="$(DeploymentDirectory)">
207 <Output TaskParameter="DestinationFiles" ItemName="FileWrites" />
208 </Copy>
209 <Copy Condition="Exists('$(OutputPath)$(DocFileName)')" SourceFiles="$(OutputPath)$(DocFileName)" DestinationFolder="$(DeploymentDirectory)">
210 <Output TaskParameter="DestinationFiles" ItemName="FileWrites" />
211 </Copy>
212 </Target>
213 </Project>
...\ No newline at end of file ...\ No newline at end of file
1 <?xml version="1.0" encoding="utf-8"?>
2 <root>
3 <!--
4 Microsoft ResX Schema
5
6 Version 2.0
7
8 The primary goals of this format is to allow a simple XML format
9 that is mostly human readable. The generation and parsing of the
10 various data types are done through the TypeConverter classes
11 associated with the data types.
12
13 Example:
14
15 ... ado.net/XML headers & schema ...
16 <resheader name="resmimetype">text/microsoft-resx</resheader>
17 <resheader name="version">2.0</resheader>
18 <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
19 <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
20 <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
21 <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
22 <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
23 <value>[base64 mime encoded serialized .NET Framework object]</value>
24 </data>
25 <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
26 <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
27 <comment>This is a comment</comment>
28 </data>
29
30 There are any number of "resheader" rows that contain simple
31 name/value pairs.
32
33 Each data row contains a name, and value. The row also contains a
34 type or mimetype. Type corresponds to a .NET class that support
35 text/value conversion through the TypeConverter architecture.
36 Classes that don't support this are serialized and stored with the
37 mimetype set.
38
39 The mimetype is used for serialized objects, and tells the
40 ResXResourceReader how to depersist the object. This is currently not
41 extensible. For a given mimetype the value must be set accordingly:
42
43 Note - application/x-microsoft.net.object.binary.base64 is the format
44 that the ResXResourceWriter will generate, however the reader can
45 read any of the formats listed below.
46
47 mimetype: application/x-microsoft.net.object.binary.base64
48 value : The object must be serialized with
49 : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
50 : and then encoded with base64 encoding.
51
52 mimetype: application/x-microsoft.net.object.soap.base64
53 value : The object must be serialized with
54 : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
55 : and then encoded with base64 encoding.
56
57 mimetype: application/x-microsoft.net.object.bytearray.base64
58 value : The object must be serialized into a byte array
59 : using a System.ComponentModel.TypeConverter
60 : and then encoded with base64 encoding.
61 -->
62 <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
63 <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
64 <xsd:element name="root" msdata:IsDataSet="true">
65 <xsd:complexType>
66 <xsd:choice maxOccurs="unbounded">
67 <xsd:element name="metadata">
68 <xsd:complexType>
69 <xsd:sequence>
70 <xsd:element name="value" type="xsd:string" minOccurs="0" />
71 </xsd:sequence>
72 <xsd:attribute name="name" use="required" type="xsd:string" />
73 <xsd:attribute name="type" type="xsd:string" />
74 <xsd:attribute name="mimetype" type="xsd:string" />
75 <xsd:attribute ref="xml:space" />
76 </xsd:complexType>
77 </xsd:element>
78 <xsd:element name="assembly">
79 <xsd:complexType>
80 <xsd:attribute name="alias" type="xsd:string" />
81 <xsd:attribute name="name" type="xsd:string" />
82 </xsd:complexType>
83 </xsd:element>
84 <xsd:element name="data">
85 <xsd:complexType>
86 <xsd:sequence>
87 <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
88 <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
89 </xsd:sequence>
90 <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
91 <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
92 <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
93 <xsd:attribute ref="xml:space" />
94 </xsd:complexType>
95 </xsd:element>
96 <xsd:element name="resheader">
97 <xsd:complexType>
98 <xsd:sequence>
99 <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
100 </xsd:sequence>
101 <xsd:attribute name="name" type="xsd:string" use="required" />
102 </xsd:complexType>
103 </xsd:element>
104 </xsd:choice>
105 </xsd:complexType>
106 </xsd:element>
107 </xsd:schema>
108 <resheader name="resmimetype">
109 <value>text/microsoft-resx</value>
110 </resheader>
111 <resheader name="version">
112 <value>2.0</value>
113 </resheader>
114 <resheader name="reader">
115 <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
116 </resheader>
117 <resheader name="writer">
118 <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
119 </resheader>
120 </root>
...\ No newline at end of file ...\ No newline at end of file
1 //*************************************************************************************************
2 // WebTestDetail.cs
3 // Owner: Mahipal Kante
4 //
5 // Details of WebTest
6 //
7 // Copyright(c) Microsoft Corporation, 2010
8 //*************************************************************************************************
9 using System;
10 using System.IO;
11 using System.Collections.Generic;
12 using System.Linq;
13 using System.Text;
14 using EnvDTE80;
15 using EnvDTE;
16 using Microsoft.VisualStudio.TestTools.WebTesting;
17
18 namespace WebTest.WebService.Plugin.ResultTab
19 {
20 /// <summary>
21 /// Details of a Declarative WebTest project Item
22 /// </summary>
23 public class WebTestDetail
24 {
25 /// <summary>
26 ///
27 /// </summary>
28 /// <param name="fullPath"></param>
29 /// <param name="applicationObject"></param>
30 public WebTestDetail(string fullPath, DTE2 applicationObject)
31 {
32 this.FullPath = fullPath;
33 this._applicationObject = applicationObject;
34 }
35
36 /// <summary>
37 /// Web Test object
38 /// </summary>
39 public DeclarativeWebTest WebTest
40 {
41 get
42 {
43 if (webTest == null || (new FileInfo(FullPath).LastWriteTime > LastSavedTimeStamp))
44 {
45 webTest = DeclarativeWebTestSerializer.Open(FullPath);
46 LastSavedTimeStamp = new FileInfo(FullPath).LastWriteTime;
47 }
48 return webTest;
49 }
50 set
51 {
52 webTest = value;
53 LastSavedTimeStamp = new FileInfo(FullPath).LastWriteTime;
54 }
55 }
56
57 /// <summary>
58 /// Path to the WebTest file
59 /// </summary>
60 public string FullPath
61 {
62 get;
63 set;
64 }
65
66 /// <summary>
67 /// LastSavedTimeStamp
68 /// </summary>
69 public DateTime LastSavedTimeStamp
70 {
71 get;
72 set;
73 }
74
75 /// <summary>
76 /// ProjectItem of DTE
77 /// </summary>
78 public ProjectItem ProjectItem
79 {
80 get;
81 set;
82 }
83
84 /// <summary>
85 /// If there are pending changes, save first, as we are going to make our
86 /// changes to the file directly.
87 /// </summary>
88 public void PrepareToSave()
89 {
90 if (this.ProjectItem != null && this.ProjectItem.Document != null)
91 {
92 this.ProjectItem.Document.Close(vsSaveChanges.vsSaveChangesPrompt);
93 }
94 }
95
96 /// <summary>
97 /// Save WebTest to file
98 /// </summary>
99 public void Save()
100 {
101 DeclarativeWebTestSerializer.Save(this.WebTest, this.FullPath);
102 this.LastSavedTimeStamp = DateTime.Now;
103
104 if (this.ProjectItem != null)
105 {
106 Window window = this.ProjectItem.Open();
107 window.Activate();
108 }
109 }
110
111 /// <summary>
112 /// Parse parameters from all items of Web Test
113 /// </summary>
114 /// <returns></returns>
115 public List<string> GetParameterList()
116 {
117 List<string> list = new List<string>();
118
119 DeclarativeWebTest w = WebTest;
120
121 for (int i = 1; i <= w.Items.Count; i++)
122 {
123 WebTestRequest requestInWebTest = webTest.GetItem(i) as WebTestRequest;
124 if (requestInWebTest != null)
125 {
126 foreach (ExtractionRuleReference reference in requestInWebTest.ExtractionRuleReferences)
127 {
128 list.Add(reference.ContextParameterName);
129 }
130 }
131 }
132
133 return list;
134 }
135
136 private DTE2 _applicationObject;
137 private DeclarativeWebTest webTest = null;
138 }
139 }
1 //*************************************************************************************************
2 // XmlTreeView.cs
3 // Owner: Mahipal Kante
4 //
5 // Wrapper for TreeView that bings XML to TreeView
6 //
7 // Copyright(c) Microsoft Corporation, 2010
8 //*************************************************************************************************
9 using System;
10 using System.Collections.Generic;
11 using System.Linq;
12 using System.Text;
13 using System.Windows.Forms;
14 using System.Xml;
15
16 namespace WebTest.WebService.Plugin.ResultTab
17 {
18 /// <summary>
19 /// Wrapper for TreeView to enable XML content view
20 /// </summary>
21 public class XmlTreeView
22 {
23 private TreeView treeView;
24 private XmlDocument dom;
25
26 /// <summary>
27 /// Wrapper for TreeView to enable XML content view
28 /// </summary>
29 /// <param name="treeView">TreeView where XML content needs to be shown</param>
30 public XmlTreeView(TreeView treeView)
31 {
32 this.treeView = treeView;
33 treeView.BeforeExpand += new TreeViewCancelEventHandler(TreeExpanded);
34 treeView.AfterLabelEdit += new NodeLabelEditEventHandler(treeViewRequest_AfterLabelEdit);
35 }
36
37 /// <summary>
38 /// Show XML in tree
39 /// </summary>
40 /// <param name="xmlString"></param>
41 /// <returns></returns>
42 public XmlDocument ShowXML(string xmlString)
43 {
44 try
45 {
46 // Load the XML file.
47 this.dom = new XmlDocument();
48 dom.LoadXml(xmlString);
49 ShowXML(dom);
50 return dom;
51 }
52 catch (Exception)
53 {
54 //MessageBox.Show(ex.Message, "Error");
55 }
56 return null;
57 }
58
59 /// <summary>
60 /// Show XML in tree
61 /// </summary>
62 /// <param name="reader"></param>
63 /// <returns></returns>
64 public XmlDocument ShowXML(XmlReader reader)
65 {
66 try
67 {
68 // Load the XML file.
69 this.dom = new XmlDocument();
70 dom.Load(reader);
71 ShowXML(dom);
72 return dom;
73 }
74 catch (Exception)
75 {
76 //MessageBox.Show(ex.Message, "Error");
77 }
78 return null;
79 }
80
81 /// <summary>
82 /// Show XML in tree
83 /// </summary>
84 /// <param name="dom"></param>
85 public void ShowXML(XmlDocument dom)
86 {
87 try
88 {
89 this.dom = dom;
90 XmlNode xNode = dom.DocumentElement;
91
92 // Load the XML into the TreeView.
93 treeView.Nodes.Clear();
94
95 TreeNode treeNode = new TreeNode(xNode.Name);
96 treeNode.Tag = xNode;
97 if (xNode.HasChildNodes)
98 {
99 treeNode.Nodes.Add(new TreeNode("dummy"));
100 }
101 else
102 {
103 treeNode.Text = xNode.InnerXml.Trim();
104 }
105
106 treeView.Nodes.Add(treeNode);
107 treeNode.Collapse();
108 }
109 catch (Exception ex)
110 {
111 MessageBox.Show(ex.Message, "Error");
112 }
113 }
114
115 /// <summary>
116 /// Indicates whether message has been edited since last update
117 /// </summary>
118 public bool MessageEdited
119 {
120 get;
121 set;
122 }
123
124 /// <summary>
125 /// replaces currently selected XML node's contents with given parameter name
126 /// </summary>
127 /// <param name="parameterName">name of the parameter</param>
128 public void AddParameter(string parameterName)
129 {
130 TreeNode treeNode = this.treeView.SelectedNode;
131 TreeNode parentTreeNode = treeNode.Parent;
132 if (treeNode != null && parentTreeNode != null)
133 {
134 if (parameterName.Equals("Type Parameter"))
135 {
136 if (!treeNode.IsEditing)
137 {
138 treeNode.BeginEdit();
139 }
140 return;
141 }
142
143 ParameterizeNode(treeNode, "{{" + parameterName + "}}");
144 }
145 }
146
147 private void treeViewRequest_AfterLabelEdit(object sender, System.Windows.Forms.NodeLabelEditEventArgs e)
148 {
149 if (e.Label != null)
150 {
151 if (e.Label.Length > 0)
152 {
153 //Stop editing without canceling the label change.
154 e.Node.EndEdit(false);
155 ParameterizeNode(e.Node, e.Label);
156 }
157 else
158 {
159 // Cancel the label edit action, inform the user, and
160 // place the node in edit mode again
161 e.CancelEdit = true;
162 MessageBox.Show("Invalid input.\nThe label cannot be blank",
163 "Node Label Edit");
164 e.Node.BeginEdit();
165 }
166 }
167 }
168
169 private void TreeExpanded(object sender, TreeViewCancelEventArgs e)
170 {
171 if (e.Node.Nodes.Count == 1 && e.Node.Nodes[0].Text.Equals("dummy"))
172 {
173 e.Node.Nodes.Clear();
174 XmlNode parentNode = e.Node.Tag as XmlNode;
175 XmlNodeList nodeList = parentNode.ChildNodes;
176 for (int i = 0; i <= nodeList.Count - 1; i++)
177 {
178 XmlNode xNode = parentNode.ChildNodes[i];
179 TreeNode treeNode = new TreeNode();
180 treeNode.Tag = xNode;
181 if (xNode.NodeType.Equals(XmlNodeType.Element))
182 {
183 treeNode.Text = xNode.Name;
184 if (xNode.HasChildNodes)
185 {
186 treeNode.Nodes.Add(new TreeNode("dummy"));
187 }
188 else
189 {
190 treeNode.Nodes.Add(new TreeNode(xNode.Value));
191 }
192 }
193 else
194 {
195 treeNode.Text = xNode.Value;
196 }
197
198 e.Node.Nodes.Add(treeNode);
199 treeNode.Collapse();
200 }
201 }
202 }
203
204 private void ParameterizeNode(TreeNode treeNode, string parameter)
205 {
206 TreeNode parentTreeNode = treeNode.Parent;
207 XmlNode xNode = treeNode.Tag as XmlNode;
208 if (xNode != null)
209 {
210 XmlNode parentXNode = parentTreeNode.Tag as XmlNode;
211 treeNode.Text = parameter;
212 if (xNode is XmlText)
213 {
214 xNode.Value = parameter;
215 }
216 else
217 {
218 XmlText textNode = dom.CreateTextNode(parameter);
219 parentXNode.ReplaceChild(textNode, xNode);
220 treeNode.Tag = textNode;
221 treeNode.Nodes.Clear();
222 }
223 this.MessageEdited = true;
224 }
225 }
226 }
227 }
1 //*************************************************************************************************
2 // ContentHandler.cs
3 // Owner: Mahipal Kante
4 //
5 // Base class for handling a content type
6 //
7 // Copyright(c) Microsoft Corporation, 2010
8 //*************************************************************************************************
9 using System;
10 using System.Collections.Generic;
11 using System.Linq;
12 using System.Text;
13 using System.Xml;
14 using System.IO;
15 using System.Xml.XPath;
16
17 namespace WebTest.WebService.Plugin.Runtime
18 {
19 /// <summary>
20 /// Base class for handling a content type
21 /// </summary>
22 public class ContentHandler
23 {
24 private string xmlString = string.Empty;
25 private XmlDocument xmlDocument = null;
26
27 /// <summary>
28 /// Is it a binary format?
29 /// </summary>
30 public virtual bool IsBinary
31 {
32 get
33 {
34 return false;
35 }
36 }
37
38 /// <summary>
39 /// Raw binary content
40 /// </summary>
41 public virtual Byte[] MessageBytes
42 {
43 get
44 {
45 throw new NotImplementedException();
46 }
47 set
48 {
49 throw new NotImplementedException();
50 }
51 }
52
53 /// <summary>
54 /// Raw string content
55 /// </summary>
56 public virtual string MessageString
57 {
58 get
59 {
60 return XmlToString(this.XmlDocument);
61 }
62 set
63 {
64 this.xmlString = value;
65 this.xmlDocument = null;
66 }
67 }
68
69 /// <summary>
70 /// message converted to XML
71 /// </summary>
72 public string XmlString
73 {
74 get
75 {
76 return XmlToIndentedString(this.XmlDocument);
77 }
78 set
79 {
80 this.xmlString = value;
81 this.xmlDocument = null;
82 }
83 }
84
85 /// <summary>
86 /// XML Document of the message
87 /// </summary>
88 public XmlDocument XmlDocument
89 {
90 get
91 {
92 if (this.xmlDocument == null)
93 {
94 if (string.IsNullOrEmpty(this.xmlString))
95 {
96 this.LoadDocument();
97 }
98 else
99 {
100 try
101 {
102 this.xmlDocument = new XmlDocument();
103 this.xmlDocument.LoadXml(this.xmlString);
104 }
105 catch (Exception)
106 {
107 // Try setting it as a native format message
108 this.MessageString = this.xmlString;
109 this.LoadDocument();
110 }
111 }
112 }
113
114 return xmlDocument;
115 }
116 set
117 {
118 this.xmlDocument = value;
119 }
120 }
121
122 /// <summary>
123 /// XPath document of XML
124 /// </summary>
125 public virtual XPathDocument XPathDocument
126 {
127 get
128 {
129 return new XPathDocument(new StringReader(this.xmlString));
130 }
131 }
132
133 /// <summary>
134 /// Evaluates XPath
135 /// </summary>
136 /// <param name="xPath">xPath expression</param>
137 /// <returns></returns>
138 public XPathNodeIterator EvaluateXPath(string xPath)
139 {
140 XPathDocument x = this.XPathDocument;
141 XPathNavigator nav = x.CreateNavigator();
142 XmlNamespaceManager context = new XmlNamespaceManager(nav.NameTable);
143 while (nav.MoveToFollowing(XPathNodeType.Element))
144 {
145 IDictionary<string, string> whatever = nav.GetNamespacesInScope(XmlNamespaceScope.All);
146 foreach (KeyValuePair<string, string> key in whatever)
147 {
148 context.AddNamespace(key.Key, key.Value);
149 }
150 }
151
152 // Compile a standard XPath expression
153 XPathExpression expr;
154 expr = nav.Compile(xPath);
155 expr.SetContext(context);
156 return nav.Select(expr);
157 }
158
159 /// <summary>
160 /// Override to perform custom load
161 /// </summary>
162 protected virtual void LoadDocument()
163 {
164 }
165
166 /// <summary>
167 /// Converts XmlDocument to String
168 /// </summary>
169 /// <param name="dom"></param>
170 /// <returns></returns>
171 public static string XmlToString(XmlDocument dom)
172 {
173 string message = string.Empty;
174 System.Text.UTF8Encoding encoding = new System.Text.UTF8Encoding();
175 using (var stream = new MemoryStream())
176 {
177 using (XmlTextWriter writer = new XmlTextWriter(stream, encoding))
178 {
179 dom.WriteTo(writer);
180 }
181 message = encoding.GetString(stream.ToArray());
182 }
183
184 return message;
185 }
186
187 /// <summary>
188 /// Converts XmlDocument to String
189 /// </summary>
190 /// <param name="dom"></param>
191 /// <returns></returns>
192 public static string XmlToIndentedString(XmlDocument dom)
193 {
194 string message = string.Empty;
195 System.Text.UTF8Encoding encoding = new System.Text.UTF8Encoding();
196 using (var stream = new MemoryStream())
197 {
198 using (XmlTextWriter writer = new XmlTextWriter(stream, encoding))
199 {
200 writer.Formatting = Formatting.Indented;
201 dom.WriteTo(writer);
202 }
203 message = encoding.GetString(stream.ToArray());
204 }
205
206 return message;
207 }
208
209 /// <summary>
210 /// Parses XML in string form and returns XmlDocument
211 /// </summary>
212 /// <param name="xmlString"></param>
213 /// <returns></returns>
214 public static XmlDocument StringToXml(string xmlString)
215 {
216 XmlDocument dom = new XmlDocument();
217 dom.LoadXml(xmlString);
218 return dom;
219 }
220 }
221 }
1 //*************************************************************************************************
2 // ContentHandlerFactory.cs
3 // Owner: Mahipal Kante
4 //
5 // Creates appropriate handler for a given content type
6 //
7 // Copyright(c) Microsoft Corporation, 2010
8 //*************************************************************************************************
9 using System;
10 using System.Collections.Generic;
11 using System.Linq;
12 using System.Text;
13
14 namespace WebTest.WebService.Plugin.Runtime
15 {
16 /// <summary>
17 /// Creates appropriate handler for a given content type
18 /// </summary>
19 public class ContentHandlerFactory
20 {
21 /// <summary>
22 /// Creates appropriate handler for a given content type
23 /// </summary>
24 /// <param name="contentType">content type</param>
25 /// <returns></returns>
26 public static ContentHandler GetHandler(string contentType)
27 {
28 if (contentType.ToLower().Contains("msbin1"))
29 {
30 return new Msbin1ContentHandler(contentType.ToLower().Contains("soap"));
31 }
32 else if (contentType.ToLower().Contains("json"))
33 {
34 return new JsonContentHandler();
35 }
36 else if (contentType.ToLower().Contains("xml"))
37 {
38 return new ContentHandler();
39 }
40 else
41 {
42 return null;
43 }
44 }
45 }
46 }
1 //*************************************************************************************************
2 // JsonContentHandler.cs
3 // Owner: Mahipal Kante
4 //
5 // Encode/decode JSON format for Web Service response. converts JSON into XML back and forth
6 //
7 // Copyright(c) Microsoft Corporation, 2010
8 //*************************************************************************************************
9 using System;
10 using System.Collections.Generic;
11 using System.Linq;
12 using System.Text;
13 using System.Xml;
14 using System.Runtime.Serialization.Json;
15 using System.IO;
16 using System.Xml.XPath;
17
18 namespace WebTest.WebService.Plugin.Runtime
19 {
20 public class JsonContentHandler : ContentHandler
21 {
22 public override string MessageString
23 {
24 get
25 {
26 string message = string.Empty;
27 System.Text.UTF8Encoding encoding = new System.Text.UTF8Encoding();
28
29 using (var stream = new MemoryStream())
30 {
31 using (XmlDictionaryWriter writer = JsonReaderWriterFactory.CreateJsonWriter(stream, encoding))
32 {
33 this.XmlDocument.WriteTo(writer);
34 }
35 message = encoding.GetString(stream.ToArray());
36 }
37
38 return message;
39 }
40 set
41 {
42 this.jsonMessage = value;
43 this.XmlString = string.Empty;
44 }
45 }
46
47 public override XPathDocument XPathDocument
48 {
49 get
50 {
51 return new XPathDocument(GetReader());
52 }
53 }
54
55 protected override void LoadDocument()
56 {
57 try
58 {
59 this.XmlDocument = new XmlDocument();
60 this.XmlDocument.Load(GetReader());
61 }
62 catch (Exception)
63 {
64 // try setting it as an XML
65 this.XmlString = jsonMessage;
66 }
67 }
68
69 private XmlDictionaryReader GetReader()
70 {
71 System.Text.UTF8Encoding encoding = new System.Text.UTF8Encoding();
72
73 XmlDictionaryReader jsonReader =
74 System.Runtime.Serialization.Json.JsonReaderWriterFactory.CreateJsonReader(
75 encoding.GetBytes(this.jsonMessage),
76 XmlDictionaryReaderQuotas.Max);
77
78 return jsonReader;
79 }
80
81 private string jsonMessage = string.Empty;
82 }
83 }
1 //*************************************************************************************************
2 // Msbin1ContentHandler.cs
3 // Owner: Mahipal Kante
4 //
5 // Encode/decode MSBin1 binary format for Web Service response
6 // When the Web Service response is 'application/soap+msbin1 or application/msbin1'
7 // (binary - used by Silverlight application with WCF RIA)
8 //
9 // Copyright(c) Microsoft Corporation, 2010
10 //*************************************************************************************************
11 using System;
12 using System.Collections.Generic;
13 using System.Linq;
14 using System.Text;
15 using System.Xml;
16 using System.ServiceModel.Channels;
17 using System.IO;
18
19 namespace WebTest.WebService.Plugin.Runtime
20 {
21 public class Msbin1ContentHandler : ContentHandler
22 {
23 private static readonly BufferManager _bufferManager = BufferManager.CreateBufferManager(int.MaxValue, int.MaxValue);
24
25 public Msbin1ContentHandler(bool isSoapMessage)
26 {
27 soapMessage = isSoapMessage;
28 }
29
30 public override Byte[] MessageBytes
31 {
32 get
33 {
34 MemoryStream memStream = new MemoryStream();
35 if (soapMessage)
36 {
37 // Encrypt result back into binary data
38 XmlWriter meWrite = XmlWriter.Create(memStream);
39 meWrite.WriteRaw(this.MessageString);
40 meWrite.Flush();
41 memStream.Position = 0;
42
43 XmlReader meRead = XmlReader.Create(memStream);
44 Message newMessage = Message.CreateMessage(meRead, int.MaxValue, originalMessage.Version);
45 var bindingElement = new BinaryMessageEncodingBindingElement();
46 var factory = bindingElement.CreateMessageEncoderFactory();
47 using (MemoryStream memoryStream = new MemoryStream())
48 {
49 factory.Encoder.WriteMessage(newMessage, memoryStream);
50 return memoryStream.ToArray();
51 }
52 }
53 else
54 {
55 XmlDictionaryWriter meWrite = XmlDictionaryWriter.CreateBinaryWriter(memStream);
56 XmlDocument document = StringToXml(this.MessageString);
57 document.Save(meWrite);
58 return memStream.ToArray();
59 }
60 }
61 set
62 {
63 this.messageBytes = value;
64 // Decrypt body bytes to string
65
66 if (soapMessage)
67 {
68 var bindingElement = new BinaryMessageEncodingBindingElement();
69 var factory = bindingElement.CreateMessageEncoderFactory();
70 originalMessage = factory.Encoder.ReadMessage(new ArraySegment<byte>(messageBytes), _bufferManager);
71 this.MessageString = originalMessage.ToString();
72 }
73 else
74 {
75 XmlDictionaryReader reader = XmlDictionaryReader.CreateBinaryReader(messageBytes, XmlDictionaryReaderQuotas.Max);
76
77 XmlDocument document = new XmlDocument();
78 document.Load(reader);
79 this.MessageString = XmlToString(document);
80 }
81 }
82 }
83
84 public override bool IsBinary
85 {
86 get
87 {
88 return true;
89 }
90 }
91
92 private byte[] messageBytes = null;
93 private Message originalMessage = null;
94 private bool soapMessage = false;
95 }
96 }
1 using System.Reflection;
2 using System.Runtime.CompilerServices;
3 using System.Runtime.InteropServices;
4
5 // General Information about an assembly is controlled through the following
6 // set of attributes. Change these attribute values to modify the information
7 // associated with an assembly.
8 [assembly: AssemblyTitle("WebTestSilverLightPlugin")]
9 [assembly: AssemblyDescription("")]
10 [assembly: AssemblyConfiguration("")]
11 [assembly: AssemblyCompany("Microsoft IT")]
12 [assembly: AssemblyProduct("WebTestSilverLightPlugin")]
13 [assembly: AssemblyCopyright("Copyright © Microsoft IT 2010")]
14 [assembly: AssemblyTrademark("")]
15 [assembly: AssemblyCulture("")]
16
17 // Setting ComVisible to false makes the types in this assembly not visible
18 // to COM components. If you need to access a type in this assembly from
19 // COM, set the ComVisible attribute to true on that type.
20 [assembly: ComVisible(false)]
21
22 // The following GUID is for the ID of the typelib if this project is exposed to COM
23 [assembly: Guid("88c51893-3ea0-4a7b-8942-cf06ba21bf79")]
24
25 // Version information for an assembly consists of the following four values:
26 //
27 // Major Version
28 // Minor Version
29 // Build Number
30 // Revision
31 //
32 // You can specify all the values or you can default the Build and Revision Numbers
33 // by using the '*' as shown below:
34 // [assembly: AssemblyVersion("1.0.*")]
35 [assembly: AssemblyVersion("1.0.0.0")]
36 [assembly: AssemblyFileVersion("1.0.0.0")]
1 //*************************************************************************************************
2 // WebServicePlugin.cs
3 // Owner: Mahipal Kante
4 //
5 // This Web Test plugin performs Data Binding on binary format for Web Service response
6 // When the Web Service response is 'application/soap+msbin1'
7 // (binary - used by Silverlight application with WCF RIA)
8 //
9 // Copyright(c) Microsoft Corporation, 2010
10 //*************************************************************************************************
11 using Microsoft.VisualStudio.TestTools.WebTesting;
12 using System.Diagnostics.CodeAnalysis;
13
14 namespace WebTest.WebService.Plugin.Runtime
15 {
16 public class WebServicePlugin : WebTestPlugin
17 {
18 /// Summary:
19 /// When overridden in a derived class, represents the method that will handle
20 /// the event associated with the completion of a Web page.
21 ///
22 /// Parameters:
23 /// sender:
24 /// The source of the event.
25 ///
26 /// e:
27 /// A PostPageEventArgs that contains the event data.
28 ///
29 [SuppressMessage("Microsoft.Security", "CA2109:ReviewVisibleEventHandlers")]
30 public override void PostPage(object sender, PostPageEventArgs e)
31 {
32 }
33
34 //
35 // Summary:
36 // When overridden in a derived class, represents the method that will handle
37 // the event associated with the completion of an HTTP request.
38 //
39 // Parameters:
40 // sender:
41 // The source of the event.
42 //
43 // e:
44 // A PostRequestEventArgs that contains the event data.
45 [SuppressMessage("Microsoft.Security", "CA2109:ReviewVisibleEventHandlers")]
46 public override void PostRequest(object sender, PostRequestEventArgs e)
47 {
48 }
49
50 //
51 // Summary:
52 // When overridden in a derived class, represents the method that will handle
53 // the event associated with the completion of a transaction that is defined
54 // in the Web test.
55 //
56 // Parameters:
57 // sender:
58 // The source of the event.
59 //
60 // e:
61 // A PostTransactionEventArgs that contains the event data.
62 [SuppressMessage("Microsoft.Security", "CA2109:ReviewVisibleEventHandlers")]
63 public override void PostTransaction(object sender, PostTransactionEventArgs e)
64 {
65 }
66
67 //
68 // Summary:
69 // When overridden in a derived class, represents the method that will handle
70 // the event associated with the end of a Web test.
71 //
72 // Parameters:
73 // sender:
74 // The source of the event.
75 //
76 // e:
77 // A Microsoft.VisualStudio.TestTools.WebTesting.PostWebTestEventArgs that contains
78 // the event data.
79 [SuppressMessage("Microsoft.Security", "CA2109:ReviewVisibleEventHandlers")]
80 public override void PostWebTest(object sender, PostWebTestEventArgs e)
81 {
82 }
83
84 //
85 // Summary:
86 // When overridden in a derived class, represents the method that will handle
87 // the event associated with the start of a Web page.
88 //
89 // Parameters:
90 // sender:
91 // The source of the event.
92 //
93 // e:
94 // A PrePageEventArgs that contains the event data.
95 [SuppressMessage("Microsoft.Security", "CA2109:ReviewVisibleEventHandlers")]
96 public override void PrePage(object sender, PrePageEventArgs e)
97 {
98 }
99
100 //
101 // Summary:
102 // When overridden in a derived class, represents the method that will handle
103 // the event associated with the start of an HTTP request.
104 //
105 // Parameters:
106 // sender:
107 // The source of the event.
108 //
109 // e:
110 // A PreRequestEventArgs that contains the event data.
111 [SuppressMessage("Microsoft.Security", "CA2109:ReviewVisibleEventHandlers")]
112 public override void PreRequest(object sender, PreRequestEventArgs e)
113 {
114 }
115
116 /// <summary>
117 /// This method performs Data Binding on MSBin1 binray format for Web Service response
118 /// When the Web Service response is 'application/soap+msbin1'
119 // (binary - used by Silverlight application with WCF RIA)
120 /// </summary>
121 /// <param name="sender"></param>
122 /// <param name="e"></param>
123 [SuppressMessage("Microsoft.Security", "CA2109:ReviewVisibleEventHandlers")]
124 public override void PreRequestDataBinding(object sender, PreRequestDataBindingEventArgs e)
125 {
126 BinaryHttpBody binaryHttpBody = e.Request.Body as BinaryHttpBody;
127 if (binaryHttpBody == null || string.IsNullOrEmpty(binaryHttpBody.ContentType))
128 {
129 return;
130 }
131
132 if (!binaryHttpBody.ContentType.Contains("msbin1"))
133 {
134 return;
135 }
136
137 ContentHandler contentHandler = ContentHandlerFactory.GetHandler(binaryHttpBody.ContentType);
138 if (contentHandler != null)
139 {
140 contentHandler.MessageBytes = binaryHttpBody.Data;
141
142 string text = contentHandler.MessageString;
143
144 // do Data Binding on the string version of binary data
145 string newText = DataBindingHelper.UpdateBindingSites(e.WebTest.Context, text);
146
147 contentHandler.MessageString = newText;
148
149 // set the new binary data into http body
150 binaryHttpBody.Data = contentHandler.MessageBytes;
151 }
152 }
153
154 //
155 // Summary:
156 // When overridden in a derived class, represents the method that will handle
157 // the event associated with the start of a transaction that is defined in the
158 // Web test.
159 //
160 // Parameters:
161 // sender:
162 // The source of the event.
163 //
164 // e:
165 // A PreTransactionEventArgs that contains the event data.
166 [SuppressMessage("Microsoft.Security", "CA2109:ReviewVisibleEventHandlers")]
167 public override void PreTransaction(object sender, PreTransactionEventArgs e)
168 {
169 }
170
171 //
172 // Summary:
173 // When overridden in a derived class, represents the method that will handle
174 // the event associated with the start of a Web test.
175 //
176 // Parameters:
177 // sender:
178 // The source of the event.
179 //
180 // e:
181 // A Microsoft.VisualStudio.TestTools.WebTesting.PostWebTestEventArgs that contains
182 // the event data.
183 [SuppressMessage("Microsoft.Security", "CA2109:ReviewVisibleEventHandlers")]
184 public override void PreWebTest(object sender, PreWebTestEventArgs e)
185 {
186 }
187 }
188 }
1 <?xml version="1.0" encoding="utf-8"?>
2 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3 <PropertyGroup>
4 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
5 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
6 <ProductVersion>8.0.30703</ProductVersion>
7 <SchemaVersion>2.0</SchemaVersion>
8 <ProjectGuid>{F9E36CFA-A657-4DD4-BD17-BA3D91EB469F}</ProjectGuid>
9 <OutputType>Library</OutputType>
10 <AppDesignerFolder>Properties</AppDesignerFolder>
11 <RootNamespace>WebTest.WebService.Plugin.Runtime</RootNamespace>
12 <AssemblyName>WebTest.WebService.Plugin.Runtime</AssemblyName>
13 <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
14 <FileAlignment>512</FileAlignment>
15 <SccProjectName>SAK</SccProjectName>
16 <SccLocalPath>SAK</SccLocalPath>
17 <SccAuxPath>SAK</SccAuxPath>
18 <SccProvider>SAK</SccProvider>
19 <TargetFrameworkProfile />
20 </PropertyGroup>
21 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
22 <DebugSymbols>true</DebugSymbols>
23 <DebugType>full</DebugType>
24 <Optimize>false</Optimize>
25 <OutputPath>bin\Debug\</OutputPath>
26 <DefineConstants>DEBUG;TRACE</DefineConstants>
27 <ErrorReport>prompt</ErrorReport>
28 <WarningLevel>4</WarningLevel>
29 <Prefer32Bit>false</Prefer32Bit>
30 </PropertyGroup>
31 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
32 <DebugType>pdbonly</DebugType>
33 <Optimize>true</Optimize>
34 <OutputPath>bin\Release\</OutputPath>
35 <DefineConstants>TRACE</DefineConstants>
36 <ErrorReport>prompt</ErrorReport>
37 <WarningLevel>4</WarningLevel>
38 <Prefer32Bit>false</Prefer32Bit>
39 </PropertyGroup>
40 <ItemGroup>
41 <Reference Include="Microsoft.VisualStudio.QualityTools.WebTestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
42 <Reference Include="System" />
43 <Reference Include="System.Core" />
44 <Reference Include="System.Runtime.Serialization" />
45 <Reference Include="System.ServiceModel" />
46 <Reference Include="System.Xml.Linq" />
47 <Reference Include="System.Data.DataSetExtensions" />
48 <Reference Include="Microsoft.CSharp" />
49 <Reference Include="System.Data" />
50 <Reference Include="System.Xml" />
51 </ItemGroup>
52 <ItemGroup>
53 <Compile Include="JsonContentHandler.cs" />
54 <Compile Include="ContentHandler.cs" />
55 <Compile Include="ContentHandlerFactory.cs" />
56 <Compile Include="DataBindingHelper.cs" />
57 <Compile Include="Msbin1ContentHandler.cs" />
58 <Compile Include="WebServicePlugin.cs" />
59 <Compile Include="Properties\AssemblyInfo.cs" />
60 <Compile Include="XPathExtractionRule.cs" />
61 <Compile Include="XPathValidationRule.cs" />
62 </ItemGroup>
63 <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
64 <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
65 Other similar extension points exist, see Microsoft.Common.targets.
66 <Target Name="BeforeBuild">
67 </Target>
68 <Target Name="AfterBuild">
69 </Target>
70 -->
71 </Project>
...\ No newline at end of file ...\ No newline at end of file
1 //*************************************************************************************************
2 // XPathExtractionRule.cs
3 // Owner: Mahipal Kante
4 //
5 // This web test plugin extracts data from a Web Service response using XPath expression.
6 // The Web Service response can be plain XML or 'application/soap+msbin1'
7 // (binary - used by Silverlight application with WCF RIA) or JSON
8 //
9 // Copyright(c) Microsoft Corporation, 2010
10 //*************************************************************************************************
11 using System;
12 using System.Collections.Generic;
13 using System.Linq;
14 using System.Text;
15 using System.ComponentModel;
16 using Microsoft.VisualStudio.TestTools.WebTesting;
17 using System.Xml.XPath;
18 using System.Xml;
19 using System.IO;
20
21 namespace WebTest.WebService.Plugin.Runtime
22 {
23 [DisplayName("XPathExtractionRule")]
24 [Description("Extracts a value using XPath expression")]
25 public class XPathExtractionRule : ExtractionRule
26 {
27 // The name of the desired input field
28 private string xPathValue;
29 [DisplayName("XPathToSearch")]
30 [Description("Extracts a value using XPath expression")]
31 public string XPathToSearch
32 {
33 get { return xPathValue; }
34 set { xPathValue = value; }
35 }
36
37 // To set a default value use:[DefaultValue(<value>)]
38 private int indexValue;
39 [Description("Indicates which occurrence of the string to extract. This is zero-based index.")]
40 public int Index
41 {
42 get { return indexValue; }
43 set { indexValue = value; }
44 }
45
46 private bool randomMatch;
47 [DisplayName("ExtractRandomMatch")]
48 [Description("If true, all matches are found and one of the matches is randomly returned.")]
49 public bool ExtractRandomMatch
50 {
51 get { return randomMatch; }
52 set { randomMatch = value; }
53 }
54
55 /// <summary>
56 /// The Extract method. The parameter e contains the Web test context.
57 /// </summary>
58 /// <param name="sender"></param>
59 /// <param name="e"></param>
60 public override void Extract(object sender, ExtractionEventArgs e)
61 {
62 try
63 {
64 ContentHandler contentHandler = ContentHandlerFactory.GetHandler(e.Response.ContentType);
65 if (contentHandler == null)
66 {
67 return;
68 }
69
70 if (contentHandler.IsBinary)
71 {
72 contentHandler.MessageBytes = e.Response.BodyBytes;
73 }
74 else
75 {
76 contentHandler.MessageString = e.Response.BodyString;
77 }
78
79 XPathNodeIterator iterator = contentHandler.EvaluateXPath(XPathToSearch);
80
81 List<string> values = new List<string>();
82
83 int i = 0;
84 while (iterator.MoveNext())
85 {
86 XPathNavigator nav2 = iterator.Current.Clone();
87
88 string value;
89 if (nav2.NodeType.Equals(XPathNodeType.Element))
90 {
91 value = nav2.InnerXml;
92 }
93 else
94 {
95 value = nav2.Value;
96 }
97
98 values.Add(value);
99 if (!ExtractRandomMatch && (i == Index))
100 {
101 // add the extracted value to the Web test context
102 e.WebTest.Context.Add(this.ContextParameterName, value);
103 e.Success = true;
104 return;
105 }
106 i++;
107 }
108
109 if (ExtractRandomMatch && (values.Count > 0))
110 {
111 Random random = new Random();
112 e.WebTest.Context.Add(this.ContextParameterName, values[random.Next(values.Count)]);
113 e.Success = true;
114 return;
115 }
116 }
117 catch (Exception ex)
118 {
119 e.Message = ex.Message;
120 }
121
122 e.Success = false;
123 return;
124 }
125 }
126 }
1 //*************************************************************************************************
2 // XPathValidationRule.cs
3 // Owner: Mahipal Kante
4 //
5 // This web test plugin validates a Web Service response using XPath expression.
6 // The Web Service response can be plain XML or 'application/soap+msbin1'
7 // (binary - used by Silverlight application with WCF RIA) or JSON
8 //
9 // Copyright(c) Microsoft Corporation, 2010
10 //*************************************************************************************************
11 using System;
12 using System.Collections.Generic;
13 using System.Linq;
14 using System.Text;
15 using System.ComponentModel;
16 using Microsoft.VisualStudio.TestTools.WebTesting;
17 using System.Xml.XPath;
18 using System.IO;
19 using System.Xml;
20
21 namespace WebTest.WebService.Plugin.Runtime
22 {
23 [DisplayName("XPathValidationRule")]
24 [Description("Validates response using XPath expression")]
25 public class XPathValidationRule : ValidationRule
26 {
27 // The name of the desired input field
28 private string xPathValue;
29 [DisplayName("XPathToSearch")]
30 [Description("XPath expression to evaluate")]
31 public string XPathToSearch
32 {
33 get { return xPathValue; }
34 set { xPathValue = value; }
35 }
36
37 private int indexValue = -1;
38 [Description("Indicates which occurrence of the XPath result to validate. This is a zero based index. -1 indicates try and match against all of them.")]
39 public int Index
40 {
41 get { return indexValue; }
42 set { indexValue = value; }
43 }
44
45 private string expectedValue = string.Empty;
46 [DisplayName("ExpectedValue")]
47 [Description("The Expected result of XPath evaluation")]
48 public string ExpectedValue
49 {
50 get { return expectedValue; }
51 set { expectedValue = value; }
52 }
53
54 private bool ignoreCase = true;
55 [DisplayName("IgnoreCase")]
56 [Description("Ignores case when comparing the result of XPath with the expected value")]
57 public bool IgnoreCase
58 {
59 get { return ignoreCase; }
60 set { ignoreCase = value; }
61 }
62
63 /// <summary>
64 /// The Validation method. The parameter e contains the Web test context.
65 /// </summary>
66 /// <param name="sender"></param>
67 /// <param name="e"></param>
68 public override void Validate(object sender, ValidationEventArgs e)
69 {
70 try
71 {
72 ContentHandler contentHandler = ContentHandlerFactory.GetHandler(e.Response.ContentType);
73 if (contentHandler == null)
74 {
75 return;
76 }
77
78 if (contentHandler.IsBinary)
79 {
80 contentHandler.MessageBytes = e.Response.BodyBytes;
81 }
82 else
83 {
84 contentHandler.MessageString = e.Response.BodyString;
85 }
86
87 XPathNodeIterator iterator = contentHandler.EvaluateXPath(XPathToSearch);
88 int i = 0;
89 while (iterator.MoveNext())
90 {
91 XPathNavigator nav2 = iterator.Current.Clone();
92 if ((i == -1) || (i == Index))
93 {
94 string value;
95 if (nav2.NodeType.Equals(XPathNodeType.Element))
96 {
97 value = nav2.InnerXml;
98 }
99 else
100 {
101 value = nav2.Value;
102 }
103
104
105 if (ignoreCase)
106 {
107 e.IsValid = ExpectedValue.Equals(value, StringComparison.OrdinalIgnoreCase);
108 }
109 else
110 {
111 e.IsValid = ExpectedValue.Equals(value, StringComparison.Ordinal);
112 }
113
114 if (i == Index || e.IsValid)
115 {
116 return;
117 }
118 }
119 i++;
120 }
121 }
122 catch (Exception ex)
123 {
124 e.Message = ex.Message;
125 }
126
127 e.IsValid = false;
128 return;
129 }
130 }
131 }
1 <?xml version="1.0" encoding="UTF-8"?>
2 <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
3
4 <Product Id="{289E27D1-0F89-4F1A-A2C7-9584091B9950}" Name="Web Test Plugin for Web Service Messages - VS 2012" Language="1033" Version="3.0.0.0" Manufacturer="Microsoft IT" UpgradeCode="{BF388820-5266-41AF-BFFE-DC183C37D624}">
5 <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
6 <Media Id="1" Cabinet="WebServicePlugins1.cab" EmbedCab="yes" />
7
8 <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
9
10 <Feature Id="ProductFeature" Title="Web Test Plugin for Web Service Messages" Level="1">
11 <ComponentRef Id="WebTestMessageEditor" />
12 <ComponentRef Id="WebTestResultTab" />
13 <ComponentRef Id="WebTestRuntime" />
14 </Feature>
15
16 <Property Id="VS2012INSTALLFOLDER" Secure="yes">
17 <RegistrySearch Id="VS2012InstallationFolderRegistrySearchId" Type="raw"
18 Root="HKLM" Key="SOFTWARE\Microsoft\VisualStudio\11.0" Name="InstallDir"></RegistrySearch>
19 </Property>
20
21 <Condition Message="Visual Studio 2012 not found.">
22 Installed OR VS2012INSTALLFOLDER
23 </Condition>
24 </Product>
25
26 <Fragment>
27 <Directory Id="TARGETDIR" Name="SourceDir">
28 <Directory Id="VS2012INSTALLFOLDER">
29 <Directory Id="PrivateAssemblies" Name="PrivateAssemblies">
30 <Directory Id="WebTestPlugins" Name="WebTestPlugins">
31 <Component Id="WebTestMessageEditor" Guid="{17E95CD2-6B83-46C9-AEE5-019853FF62EC}">
32 <File Source="$(var.WebServicePluginForWebTestMessageEditor.TargetPath)" Vital="yes" DiskId="1"/>
33 </Component>
34 </Directory>
35 </Directory>
36 <Directory Id="PublicAssemblies" Name="PublicAssemblies">
37 <Component Id="WebTestRuntime" Guid="{854C9BA4-3E3E-4D0A-9DB1-DFF8140E834C}">
38 <File Source="$(var.WebServicePluginForWebTestRuntime.TargetPath)" Vital="yes" DiskId="1"/>
39 </Component>
40 </Directory>
41 </Directory>
42
43 <Directory Id="AppDataFolder">
44 <Directory Id="MSAppDataDir" Name="Microsoft">
45 <Directory Id="VSAppDataDir" Name="VisualStudio">
46 <Directory Id="VSAppDataVersionDir" Name="11.0">
47 <Directory Id="VSAddins" Name="Addins">
48 <Component Id="WebTestResultTab" Guid="{27569640-6946-4E4F-8E55-109E99A79DB9}">
49 <RegistryValue KeyPath="yes" Root="HKCU" Key="SOFTWARE\Microsoft\WebServicePlugin" Name="Installed" Type="integer" Value="1" Action="write" />
50 <File Source="$(var.WebServicePluginForWebTestResultTab.TargetPath)" Vital="yes" DiskId="1"/>
51 <File Source="$(var.WebServicePluginForWebTestResultTab.ProjectDir)WebServicePluginForWebTestResultTab.Addin" Vital="yes" DiskId="1"/>
52 <RemoveFolder Id="RemoveMSAppDataDir" Directory="MSAppDataDir" On="uninstall"/>
53 <RemoveFolder Id="RemoveVSAppDataDir" Directory="VSAppDataDir" On="uninstall"/>
54 <RemoveFolder Id="RemoveVSAppDataVersionDir" Directory="VSAppDataVersionDir" On="uninstall"/>
55 <RemoveFolder Id="RemoveVSAddins" Directory="VSAddins" On="uninstall"/>
56 </Component>
57 </Directory>
58 </Directory>
59 </Directory>
60 </Directory>
61 </Directory>
62 </Directory>
63 </Fragment>
64 </Wix>
...\ No newline at end of file ...\ No newline at end of file
1 Install Wix Toolset to load installer project
2 http://wix.codeplex.com/
...\ No newline at end of file ...\ No newline at end of file
1 <?xml version="1.0" encoding="utf-8"?>
2 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3 <PropertyGroup>
4 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
5 <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
6 <ProductVersion>3.6</ProductVersion>
7 <ProjectGuid>73accda5-47c1-40c9-b63e-aff657e046e4</ProjectGuid>
8 <SchemaVersion>2.0</SchemaVersion>
9 <OutputName>Setup</OutputName>
10 <OutputType>Package</OutputType>
11 <WixTargetsPath Condition=" '$(WixTargetsPath)' == '' AND '$(MSBuildExtensionsPath32)' != '' ">$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets</WixTargetsPath>
12 <WixTargetsPath Condition=" '$(WixTargetsPath)' == '' ">$(MSBuildExtensionsPath)\Microsoft\WiX\v3.x\Wix.targets</WixTargetsPath>
13 <Name>WebServicePluginsSetup</Name>
14 <SccProjectName>SAK</SccProjectName>
15 <SccLocalPath>SAK</SccLocalPath>
16 <SccAuxPath>SAK</SccAuxPath>
17 <SccProvider>SAK</SccProvider>
18 </PropertyGroup>
19 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
20 <OutputPath>bin\$(Configuration)\</OutputPath>
21 <IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
22 <DefineConstants>Debug</DefineConstants>
23 </PropertyGroup>
24 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
25 <OutputPath>bin\$(Configuration)\</OutputPath>
26 <IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
27 </PropertyGroup>
28 <ItemGroup>
29 <Compile Include="Product.wxs" />
30 </ItemGroup>
31 <ItemGroup>
32 <ProjectReference Include="..\WebTestWebServiceMessageEditor\WebServicePluginForWebTestMessageEditor.csproj">
33 <Name>WebServicePluginForWebTestMessageEditor</Name>
34 <Project>{23707a49-589b-4a36-bdaa-2896e647d07d}</Project>
35 <Private>True</Private>
36 <DoNotHarvest>True</DoNotHarvest>
37 <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups>
38 <RefTargetDir>INSTALLFOLDER</RefTargetDir>
39 </ProjectReference>
40 <ProjectReference Include="..\WebTestWebServiceResultAddin\WebServicePluginForWebTestResultTab.csproj">
41 <Name>WebServicePluginForWebTestResultTab</Name>
42 <Project>{48b3509e-1fd8-4875-8fc6-137647eb83aa}</Project>
43 <Private>True</Private>
44 <DoNotHarvest>True</DoNotHarvest>
45 <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups>
46 <RefTargetDir>INSTALLFOLDER</RefTargetDir>
47 </ProjectReference>
48 <ProjectReference Include="..\WebTestWebServiceRuntime\WebServicePluginForWebTestRuntime.csproj">
49 <Name>WebServicePluginForWebTestRuntime</Name>
50 <Project>{f9e36cfa-a657-4dd4-bd17-ba3d91eb469f}</Project>
51 <Private>True</Private>
52 <DoNotHarvest>True</DoNotHarvest>
53 <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups>
54 <RefTargetDir>INSTALLFOLDER</RefTargetDir>
55 </ProjectReference>
56 </ItemGroup>
57 <Import Project="$(WixTargetsPath)" />
58 <!--
59 To modify your build process, add your task inside one of the targets below and uncomment it.
60 Other similar extension points exist, see Wix.targets.
61 <Target Name="BeforeBuild">
62 </Target>
63 <Target Name="AfterBuild">
64 </Target>
65 -->
66 </Project>
...\ No newline at end of file ...\ No newline at end of file