Skip to content

Commit a62ac9e

Browse files
committed
Merge branch 'feature-componenttracking' into release-2.0
2 parents 9c94583 + 96935f3 commit a62ac9e

9 files changed

+103
-11
lines changed

BizTalkComponents.PipelineComponents.HttpDisassembler.sln

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,20 @@ EndProject
2020
Global
2121
GlobalSection(SolutionConfigurationPlatforms) = preSolution
2222
Debug|Any CPU = Debug|Any CPU
23+
NugetRelease|Any CPU = NugetRelease|Any CPU
2324
Release|Any CPU = Release|Any CPU
2425
EndGlobalSection
2526
GlobalSection(ProjectConfigurationPlatforms) = postSolution
2627
{4A6C8864-B06F-455E-A375-51F658673A72}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
2728
{4A6C8864-B06F-455E-A375-51F658673A72}.Debug|Any CPU.Build.0 = Debug|Any CPU
29+
{4A6C8864-B06F-455E-A375-51F658673A72}.NugetRelease|Any CPU.ActiveCfg = NugetRelease|Any CPU
30+
{4A6C8864-B06F-455E-A375-51F658673A72}.NugetRelease|Any CPU.Build.0 = NugetRelease|Any CPU
2831
{4A6C8864-B06F-455E-A375-51F658673A72}.Release|Any CPU.ActiveCfg = Release|Any CPU
2932
{4A6C8864-B06F-455E-A375-51F658673A72}.Release|Any CPU.Build.0 = Release|Any CPU
3033
{C52BFE1D-5760-4F69-BA03-43E34CA4F837}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
3134
{C52BFE1D-5760-4F69-BA03-43E34CA4F837}.Debug|Any CPU.Build.0 = Debug|Any CPU
35+
{C52BFE1D-5760-4F69-BA03-43E34CA4F837}.NugetRelease|Any CPU.ActiveCfg = NugetRelease|Any CPU
36+
{C52BFE1D-5760-4F69-BA03-43E34CA4F837}.NugetRelease|Any CPU.Build.0 = NugetRelease|Any CPU
3237
{C52BFE1D-5760-4F69-BA03-43E34CA4F837}.Release|Any CPU.ActiveCfg = Release|Any CPU
3338
{C52BFE1D-5760-4F69-BA03-43E34CA4F837}.Release|Any CPU.Build.0 = Release|Any CPU
3439
EndGlobalSection

Build/Build.proj

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,15 @@
55
<PropertyGroup>
66
<DestinationPath>.</DestinationPath>
77
<ApplicationName>BizTalkComponents.PipelineComponents.HttpDisassembler</ApplicationName>
8+
<Configuration></Configuration>
89
</PropertyGroup>
910
<ItemGroup>
10-
<Resource Include="..\Src\HttpDisassembler\bin\Debug\BizTalkComponents.PipelineComponents.HttpDisassembler.dll" />
11-
</ItemGroup>
11+
<Resource Include="..\Src\HttpDisassembler\bin\$(Configuration)\BizTalkComponents.PipelineComponents.HttpDisassembler.dll" />
12+
<Resource Include="..\packages\Microsoft.ApplicationInsights.2.0.1\lib\net45\Microsoft.ApplicationInsights.dll" />
13+
<Resource Include="..\packages\BizTalkComponents.Utilities.ComponentInstrumentation.1.0.0\lib\net45\BizTalkComponents.Utilities.ComponentInstrumentation.dll" />
14+
</ItemGroup>
1215
<Target Name="GetVersion">
13-
<MSBuild.ExtensionPack.Framework.Assembly TaskAction="GetInfo" NetAssembly="..\Src\HttpDisassembler\bin\Debug\BizTalkComponents.PipelineComponents.HttpDisassembler.dll">
16+
<MSBuild.ExtensionPack.Framework.Assembly TaskAction="GetInfo" NetAssembly="..\Src\HttpDisassembler\bin\$(Configuration)\BizTalkComponents.PipelineComponents.HttpDisassembler.dll">
1417
<Output TaskParameter="OutputItems" ItemName="Info"/>
1518
</MSBuild.ExtensionPack.Framework.Assembly>
1619
</Target>
@@ -23,4 +26,4 @@
2326
SourceLocation="C:\%(Info.AssemblyInformationalVersion)"
2427
Resources="@(Resource)" />
2528
</Target>
26-
</Project>
29+
</Project>

Src/HttpDisassembler/BizTalkComponents.PipelineComponents.HttpDisassembler.csproj

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2+
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
33
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
44
<PropertyGroup>
55
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -9,7 +9,7 @@
99
<AppDesignerFolder>Properties</AppDesignerFolder>
1010
<RootNamespace>BizTalkComponents.PipelineComponents.HttpDisassembler</RootNamespace>
1111
<AssemblyName>BizTalkComponents.PipelineComponents.HttpDisassembler</AssemblyName>
12-
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
12+
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
1313
<FileAlignment>512</FileAlignment>
1414
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
1515
<RestorePackages>true</RestorePackages>
@@ -23,6 +23,7 @@
2323
<DefineConstants>DEBUG;TRACE</DefineConstants>
2424
<ErrorReport>prompt</ErrorReport>
2525
<WarningLevel>4</WarningLevel>
26+
<Prefer32Bit>false</Prefer32Bit>
2627
</PropertyGroup>
2728
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
2829
<DebugType>pdbonly</DebugType>
@@ -31,14 +32,32 @@
3132
<DefineConstants>TRACE</DefineConstants>
3233
<ErrorReport>prompt</ErrorReport>
3334
<WarningLevel>4</WarningLevel>
35+
<Prefer32Bit>false</Prefer32Bit>
3436
</PropertyGroup>
3537
<PropertyGroup>
3638
<SignAssembly>true</SignAssembly>
3739
</PropertyGroup>
3840
<PropertyGroup>
3941
<AssemblyOriginatorKeyFile>BizTalkComponents.HttpDisassembler.snk</AssemblyOriginatorKeyFile>
4042
</PropertyGroup>
43+
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'NugetRelease|AnyCPU'">
44+
<DebugSymbols>true</DebugSymbols>
45+
<OutputPath>bin\NugetRelease\</OutputPath>
46+
<DefineConstants>TRACE;DEBUG;tracking</DefineConstants>
47+
<DebugType>full</DebugType>
48+
<PlatformTarget>AnyCPU</PlatformTarget>
49+
<ErrorReport>prompt</ErrorReport>
50+
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
51+
</PropertyGroup>
4152
<ItemGroup>
53+
<Reference Include="BizTalkComponents.Utilities.ComponentInstrumentation, Version=1.0.0.0, Culture=neutral, PublicKeyToken=8fc5a9041a4c00c5, processorArchitecture=MSIL">
54+
<HintPath>..\..\packages\BizTalkComponents.Utilities.ComponentInstrumentation.1.0.0\lib\net45\BizTalkComponents.Utilities.ComponentInstrumentation.dll</HintPath>
55+
<Private>True</Private>
56+
</Reference>
57+
<Reference Include="Microsoft.ApplicationInsights, Version=2.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
58+
<HintPath>..\..\packages\Microsoft.ApplicationInsights.2.0.1\lib\net45\Microsoft.ApplicationInsights.dll</HintPath>
59+
<Private>True</Private>
60+
</Reference>
4261
<Reference Include="Microsoft.BizTalk.Pipeline, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
4362
<SpecificVersion>False</SpecificVersion>
4463
<HintPath>..\..\..\..\..\Windows\assembly\GAC_MSIL\Microsoft.BizTalk.Pipeline\3.0.1.0__31bf3856ad364e35\Microsoft.BizTalk.Pipeline.dll</HintPath>
@@ -67,6 +86,7 @@
6786
<ItemGroup>
6887
<None Include="BizTalkComponents.HttpDisassembler.snk" />
6988
<None Include="BizTalkComponents.PipelineComponents.HttpDisassembler.nuspec" />
89+
<None Include="packages.config" />
7090
</ItemGroup>
7191
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
7292
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />

Src/HttpDisassembler/BizTalkComponents.PipelineComponents.HttpDisassembler.nuspec

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,8 @@
1010
<releaseNotes>Initial release.</releaseNotes>
1111
<copyright>Copyright 2014</copyright>
1212
<tags>BizTalk</tags>
13+
<dependencies>
14+
<dependency id="BizTalkComponents.Utilities.ComponentInstrumentation" version="1.0" />
15+
</dependencies>
1316
</metadata>
1417
</package>

Src/HttpDisassembler/HttpDisassembler.cs

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,31 @@
99
using Microsoft.BizTalk.Message.Interop;
1010
using Microsoft.XLANGs.RuntimeTypes;
1111
using BizTalkComponents.Utils;
12-
12+
using BizTalkComponents.Utilities.ComponentInstrumentation;
13+
using System.Runtime.InteropServices;
1314
namespace BizTalkComponents.PipelineComponents.HttpDisassembler
1415
{
16+
1517
[System.Runtime.InteropServices.Guid("FE75A97A-EB7C-49AF-8778-136FA366A5F4")]
1618
[ComponentCategory(CategoryTypes.CATID_PipelineComponent)]
1719
[ComponentCategory(CategoryTypes.CATID_DisassemblingParser)]
1820
public partial class HttpDisassembler : IBaseComponent, IPersistPropertyBag, IComponentUI, IDisassemblerComponent
1921
{
2022
private const string DocumentSpecNamePropertyName = "DocumentSpecName";
2123
private readonly Queue _outputQueue = new Queue();
24+
private readonly ComponentInstrumentationHelper _instrumentationHelper;
2225

26+
#if tracking
27+
public HttpDisassembler()
28+
{
29+
_instrumentationHelper = new ComponentInstrumentationHelper(new AppInsightsComponentTracker("insert key here"), Name);
30+
}
31+
#else
32+
public HttpDisassembler()
33+
{
34+
_instrumentationHelper = new ComponentInstrumentationHelper(new TraceComponentTracker(), Name);
35+
}
36+
#endif
2337
[RequiredRuntime]
2438
[DisplayName("DocumentSpecName")]
2539
[Description("DocumentSpec name of the schema to create an instance from.")]
@@ -31,11 +45,22 @@ public void Disassemble(IPipelineContext pContext, IBaseMessage pInMsg)
3145

3246
if (!Validate(out errorMessage))
3347
{
34-
throw new ArgumentException(errorMessage);
48+
var ex = new ArgumentException(errorMessage);
49+
_instrumentationHelper.TrackComponentError(ex);
50+
throw ex;
3551
}
3652

3753
//Get a reference to the BizTalk schema.
38-
var documentSpec = (DocumentSpec)pContext.GetDocumentSpecByName(DocumentSpecName);
54+
DocumentSpec documentSpec;
55+
try
56+
{
57+
documentSpec = (DocumentSpec)pContext.GetDocumentSpecByName(DocumentSpecName);
58+
}
59+
catch (COMException cex)
60+
{
61+
_instrumentationHelper.TrackComponentError(cex);
62+
throw cex;
63+
}
3964

4065
//Get a list of properties defined in the schema.
4166
var annotations = documentSpec.GetPropertyAnnotationEnumerator();
@@ -71,6 +96,7 @@ public void Disassemble(IPipelineContext pContext, IBaseMessage pInMsg)
7196
outMsg.Context.Promote(new ContextProperty(SystemProperties.SchemaStrongName), documentSpec.DocSpecStrongName);
7297

7398
_outputQueue.Enqueue(outMsg);
99+
_instrumentationHelper.TrackComponentSuccess();
74100

75101
}
76102

Src/HttpDisassembler/Properties/AssemblyInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,4 @@
3434
// [assembly: AssemblyVersion("1.0.*")]
3535
[assembly: AssemblyVersion("1.0.0.0")]
3636
[assembly: AssemblyFileVersion("1.0.0.0")]
37-
[assembly: AssemblyInformationalVersion("1.5.0.0")]
37+
[assembly: AssemblyInformationalVersion("2.0.0-beta2")]
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
3+
<package id="BizTalkComponents.Utilities.ComponentInstrumentation" version="1.0.0" targetFramework="net45" />
34
<package id="BizTalkComponents.Utils" version="2.1.0.4" targetFramework="net45" developmentDependency="true" />
5+
<package id="Microsoft.ApplicationInsights" version="2.0.1" targetFramework="net45" />
46
</packages>

Tests/UnitTests/BizTalkComponents.HttpDisassembler.Tests.UnitTests.csproj

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2+
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
33
<PropertyGroup>
44
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
55
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
@@ -18,6 +18,7 @@
1818
<TestProjectType>UnitTest</TestProjectType>
1919
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
2020
<RestorePackages>true</RestorePackages>
21+
<TargetFrameworkProfile />
2122
</PropertyGroup>
2223
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
2324
<DebugSymbols>true</DebugSymbols>
@@ -36,6 +37,15 @@
3637
<ErrorReport>prompt</ErrorReport>
3738
<WarningLevel>4</WarningLevel>
3839
</PropertyGroup>
40+
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'NugetRelease|AnyCPU'">
41+
<DebugSymbols>true</DebugSymbols>
42+
<OutputPath>bin\NugetRelease\</OutputPath>
43+
<DefineConstants>DEBUG;TRACE</DefineConstants>
44+
<DebugType>full</DebugType>
45+
<PlatformTarget>AnyCPU</PlatformTarget>
46+
<ErrorReport>prompt</ErrorReport>
47+
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
48+
</PropertyGroup>
3949
<ItemGroup>
4050
<Reference Include="BizTalkComponents.Utils, Version=1.0.0.0, Culture=neutral, PublicKeyToken=87c265fe42e38fa5, processorArchitecture=MSIL">
4151
<SpecificVersion>False</SpecificVersion>

Tests/UnitTests/HttpDisassemblerTest.cs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using Microsoft.VisualStudio.TestTools.UnitTesting;
44
using Winterdom.BizTalk.PipelineTesting;
55
using BizTalkComponents.Utils.ContextPropertyHelpers;
6+
using System.Runtime.InteropServices;
67

78
namespace BizTalkComponents.HttpDisassembler.Tests.UnitTests
89
{
@@ -36,5 +37,27 @@ public void CreateMessageTest()
3637
Assert.AreEqual("value1", doc.Descendants("TestElement1").Single().Value);
3738
Assert.AreEqual("value2", doc.Descendants("TestElement2").Single().Value);
3839
}
40+
41+
[TestMethod]
42+
[ExpectedException(typeof(COMException))]
43+
public void UnknownDocType()
44+
{
45+
var pipeline = PipelineFactory.CreateEmptyReceivePipeline();
46+
47+
pipeline.AddDocSpec(typeof(TestSchema));
48+
49+
var disassembler = new PipelineComponents.HttpDisassembler.HttpDisassembler
50+
{
51+
DocumentSpecName = "Schema"
52+
};
53+
54+
var message = MessageHelper.CreateFromString(string.Empty);
55+
message.Context.Promote(new ContextProperty("http://BiztalkComponents.PropertySchema#TestProperty1"), "value1");
56+
message.Context.Promote(new ContextProperty("http://BiztalkComponents.PropertySchema#TestProperty2"), "value2");
57+
58+
pipeline.AddComponent(disassembler, PipelineStage.Disassemble);
59+
60+
var result = pipeline.Execute(message);
61+
}
3962
}
4063
}

0 commit comments

Comments
 (0)