Skip to content

Commit a79fc47

Browse files
authored
Merge pull request #3 from BizTalkComponents/ver-1.1.0
Ver 1.1.0
2 parents addffb1 + 4c880bb commit a79fc47

20 files changed

+1079
-1
lines changed

Build/Build.proj

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<Project DefaultTargets="GenerateMsi" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2+
<Import Project="$(MSBuildExtensionsPath1)\BtsMsiTask\BtsMsiTask.targets" />
3+
<Import Project="$(MSBuildExtensionsPath1)\ExtensionPack\4.0\MSBuild.ExtensionPack.tasks"/>
4+
<PropertyGroup>
5+
<DestinationPath>$(BUILD_STAGINGDIRECTORY)</DestinationPath>
6+
<ApplicationName>Shared</ApplicationName>
7+
<SourceLocation>$(BUILD_SOURCESDIRECTORY)</SourceLocation>
8+
</PropertyGroup>
9+
<ItemGroup>
10+
<Resource Include="$(BUILD_SOURCESDIRECTORY)\src\ConcatContextProperties\bin\$(BuildConfiguration)\BizTalkComponents.PipelineComponents.ConcatContextProperties.dll" />
11+
</ItemGroup>
12+
13+
<Target Name="GetVersion">
14+
<MSBuild.ExtensionPack.Framework.Assembly TaskAction="GetInfo" NetAssembly="$(BUILD_SOURCESDIRECTORY)\src\ConcatContextProperties\bin\$(BuildConfiguration)\BizTalkComponents.PipelineComponents.ConcatContextProperties.dll">
15+
<Output TaskParameter="OutputItems" ItemName="Info"/>
16+
</MSBuild.ExtensionPack.Framework.Assembly>
17+
</Target>
18+
19+
<Target Name="GenerateMsi" DependsOnTargets="GetVersion">
20+
<MsiTask ApplicationDescription="$(ApplicationDescription)"
21+
Version="%(Info.AssemblyInformationalVersion)"
22+
FileName="BizTalkComponents.PipelineComponents.ConcatContextProperties%(Info.AssemblyInformationalVersion).msi"
23+
DestinationPath="$(DestinationPath)"
24+
ApplicationName="$(ApplicationName)"
25+
BtsAssemblies="@(BtsAssembly)"
26+
Resources="@(Resource)"
27+
SourceLocation="$(SourceLocation)"
28+
ReferenceApplications="@(ReferenceApplication)" />
29+
</Target>
30+
31+
</Project>

ConcatContextProperties.sln

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio 14
4+
VisualStudioVersion = 14.0.25420.1
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConcatContextProperties", "src\ConcatContextProperties\ConcatContextProperties.csproj", "{76CC9E57-4C8A-498D-BFD7-E0499130B140}"
7+
EndProject
8+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestConcatContextProperties", "Tests\TestConcatContextProperties\TestConcatContextProperties.csproj", "{650B1A1C-2475-4990-B50B-35F1AF1EFCE7}"
9+
EndProject
10+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{358FED7C-E269-434D-90E1-F9BC9323A8BA}"
11+
ProjectSection(SolutionItems) = preProject
12+
README.md = README.md
13+
EndProjectSection
14+
EndProject
15+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Build", "Build", "{48EC5E78-2DDC-4CC2-B18C-33DD9BBC0D65}"
16+
ProjectSection(SolutionItems) = preProject
17+
Build\Build.proj = Build\Build.proj
18+
EndProjectSection
19+
EndProject
20+
Global
21+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
22+
Debug|Any CPU = Debug|Any CPU
23+
Release|Any CPU = Release|Any CPU
24+
EndGlobalSection
25+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
26+
{76CC9E57-4C8A-498D-BFD7-E0499130B140}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
27+
{76CC9E57-4C8A-498D-BFD7-E0499130B140}.Debug|Any CPU.Build.0 = Debug|Any CPU
28+
{76CC9E57-4C8A-498D-BFD7-E0499130B140}.Release|Any CPU.ActiveCfg = Release|Any CPU
29+
{76CC9E57-4C8A-498D-BFD7-E0499130B140}.Release|Any CPU.Build.0 = Release|Any CPU
30+
{650B1A1C-2475-4990-B50B-35F1AF1EFCE7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
31+
{650B1A1C-2475-4990-B50B-35F1AF1EFCE7}.Debug|Any CPU.Build.0 = Debug|Any CPU
32+
{650B1A1C-2475-4990-B50B-35F1AF1EFCE7}.Release|Any CPU.ActiveCfg = Release|Any CPU
33+
{650B1A1C-2475-4990-B50B-35F1AF1EFCE7}.Release|Any CPU.Build.0 = Release|Any CPU
34+
EndGlobalSection
35+
GlobalSection(SolutionProperties) = preSolution
36+
HideSolutionNode = FALSE
37+
EndGlobalSection
38+
EndGlobal

README.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,23 @@
1-
# ConcatContextProperties
1+
2+
# Concat Context Properties
3+
Allows to concatenate several context properties and text values and writes the result to a context property.
4+
5+
## Properties
6+
|Property|Type|Description|
7+
|--|--|--|
8+
|Parameters |String (Required)| A parameters array separated by comma, parameters can be fixed text or context properties (see n |
9+
|ThrowException| Boolean | If true, the component throws an exception if a parameter is invalid, the default is false.
10+
|PropertyPath| String (Required)|The context property the concatenated value will be stored in (http://namespace#property)
11+
|PromoteProperty| Boolean| if true, the property specified in the PropertyPath will be promoted, otherwise it will be written to the context without promotion.
12+
13+
### *Parameters*
14+
The parameters property is an array of parameters separated by comma, like concat function in different programing languages, parameters should have at least two parameters.
15+
16+
A parameter can be a fixed text or a context property, fixed texts must be quoted with double quotation "text value", while a context property must be enclosed with curly brackets {http://namespace#property}.
17+
18+
There are few special characters allowed in the text parameters, these characters are: {CR}, {LF}, {CRLF}, {TAB}
19+
the following is an example of the parameters property value:
20+
~~~
21+
"Get{TAB}Properties{CRLF}",{https://namespace1#property1},"-",{https://namespace2#property2}
22+
~~~
23+
if a property does not exist in the message context, and ThrowException is set to True, InvalidArgumentException will be thrown, otherwise, the property will be ignored and it will be repalced with empty string.
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
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("TestConcatContextProperties")]
9+
[assembly: AssemblyDescription("")]
10+
[assembly: AssemblyConfiguration("")]
11+
[assembly: AssemblyCompany("")]
12+
[assembly: AssemblyProduct("TestConcatContextProperties")]
13+
[assembly: AssemblyCopyright("Copyright © 2020")]
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("650b1a1c-2475-4990-b50b-35f1af1efce7")]
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")]
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="14.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+
<ProjectGuid>{650B1A1C-2475-4990-B50B-35F1AF1EFCE7}</ProjectGuid>
7+
<OutputType>Library</OutputType>
8+
<AppDesignerFolder>Properties</AppDesignerFolder>
9+
<RootNamespace>TestConcatContextProperties</RootNamespace>
10+
<AssemblyName>TestConcatContextProperties</AssemblyName>
11+
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
12+
<FileAlignment>512</FileAlignment>
13+
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
14+
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
15+
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
16+
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
17+
<IsCodedUITest>False</IsCodedUITest>
18+
<TestProjectType>UnitTest</TestProjectType>
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+
</PropertyGroup>
30+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
31+
<DebugType>pdbonly</DebugType>
32+
<Optimize>true</Optimize>
33+
<OutputPath>bin\Release\</OutputPath>
34+
<DefineConstants>TRACE</DefineConstants>
35+
<ErrorReport>prompt</ErrorReport>
36+
<WarningLevel>4</WarningLevel>
37+
</PropertyGroup>
38+
<ItemGroup>
39+
<Reference Include="Microsoft.BizTalk.Pipeline, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
40+
<Reference Include="System" />
41+
<Reference Include="Winterdom.BizTalk.PipelineTesting, Version=1.1.0.0, Culture=neutral, PublicKeyToken=8671935c07812470, processorArchitecture=MSIL">
42+
<HintPath>..\..\packages\Winterdom.BizTalk.PipelineTesting.1.2.2.0\lib\net45\Winterdom.BizTalk.PipelineTesting.dll</HintPath>
43+
<Private>True</Private>
44+
</Reference>
45+
</ItemGroup>
46+
<Choose>
47+
<When Condition="('$(VisualStudioVersion)' == '10.0' or '$(VisualStudioVersion)' == '') and '$(TargetFrameworkVersion)' == 'v3.5'">
48+
<ItemGroup>
49+
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
50+
</ItemGroup>
51+
</When>
52+
<Otherwise>
53+
<ItemGroup>
54+
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework" />
55+
</ItemGroup>
56+
</Otherwise>
57+
</Choose>
58+
<ItemGroup>
59+
<Compile Include="UnitTest1.cs" />
60+
<Compile Include="Properties\AssemblyInfo.cs" />
61+
</ItemGroup>
62+
<ItemGroup>
63+
<None Include="packages.config" />
64+
</ItemGroup>
65+
<ItemGroup>
66+
<ProjectReference Include="..\..\src\ConcatContextProperties\ConcatContextProperties.csproj">
67+
<Project>{76cc9e57-4c8a-498d-bfd7-e0499130b140}</Project>
68+
<Name>ConcatContextProperties</Name>
69+
</ProjectReference>
70+
</ItemGroup>
71+
<Choose>
72+
<When Condition="'$(VisualStudioVersion)' == '10.0' And '$(IsCodedUITest)' == 'True'">
73+
<ItemGroup>
74+
<Reference Include="Microsoft.VisualStudio.QualityTools.CodedUITestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
75+
<Private>False</Private>
76+
</Reference>
77+
<Reference Include="Microsoft.VisualStudio.TestTools.UITest.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
78+
<Private>False</Private>
79+
</Reference>
80+
<Reference Include="Microsoft.VisualStudio.TestTools.UITest.Extension, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
81+
<Private>False</Private>
82+
</Reference>
83+
<Reference Include="Microsoft.VisualStudio.TestTools.UITesting, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
84+
<Private>False</Private>
85+
</Reference>
86+
</ItemGroup>
87+
</When>
88+
</Choose>
89+
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
90+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
91+
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
92+
Other similar extension points exist, see Microsoft.Common.targets.
93+
<Target Name="BeforeBuild">
94+
</Target>
95+
<Target Name="AfterBuild">
96+
</Target>
97+
-->
98+
</Project>
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
using System;
2+
using Microsoft.VisualStudio.TestTools.UnitTesting;
3+
using Winterdom.BizTalk.PipelineTesting;
4+
using BizTalkComponents.PipelineComponents.ConcatContextProperties;
5+
6+
namespace TestConcatContextProperties
7+
{
8+
[TestClass]
9+
public class UnitTest1
10+
{
11+
[TestMethod]
12+
public void TestConcatProperties()
13+
{
14+
var pipeline = PipelineFactory.CreateEmptySendPipeline();
15+
pipeline.AddComponent(new ConcatContextProperties
16+
{
17+
PropertyPath="https://schemas.company.com/propertyschema#concatenatedValue",
18+
PromoteProperty=true,
19+
Parameters= "\"Abc\",{https://schemas.company.com/propertyschema#property1},{https://schemas.company.com/propertyschema#property2},\"jkl\"",
20+
21+
}, PipelineStage.PreAssemble);
22+
var msg = MessageHelper.CreateFromString("");
23+
msg.Context.Promote("property1", "https://schemas.company.com/propertyschema", "def");
24+
msg.Context.Promote("property2", "https://schemas.company.com/propertyschema", "ghi");
25+
var output = pipeline.Execute(msg);
26+
string concatenatedValue = (string)output.Context.Read("concatenatedValue", "https://schemas.company.com/propertyschema");
27+
Assert.AreEqual(concatenatedValue, "Abcdefghijkl");
28+
}
29+
30+
[TestMethod]
31+
public void TestPropertyNotExisted()
32+
{
33+
var pipeline = PipelineFactory.CreateEmptySendPipeline();
34+
pipeline.AddComponent(new ConcatContextProperties
35+
{
36+
PropertyPath = "https://schemas.company.com/propertyschema#concatenatedValue",
37+
PromoteProperty = true,
38+
Parameters = "\"Abc\",{https://schemas.company.com/propertyschema#property1},{https://schemas.company.com/propertyschema#property2},\"123\"",
39+
}, PipelineStage.PreAssemble);
40+
var msg = MessageHelper.CreateFromString("");
41+
msg.Context.Promote("property1", "https://schemas.company.com/propertyschema", "def");
42+
var output = pipeline.Execute(msg);
43+
string concatenatedValue = (string)output.Context.Read("concatenatedValue", "https://schemas.company.com/propertyschema");
44+
Assert.AreEqual(concatenatedValue, "Abcdef123");
45+
}
46+
[TestMethod, ExpectedException(typeof(ArgumentException))]
47+
public void TestPropertyNotExistedThrowException()
48+
{
49+
var pipeline = PipelineFactory.CreateEmptySendPipeline();
50+
pipeline.AddComponent(new ConcatContextProperties
51+
{
52+
PropertyPath = "https://schemas.company.com/propertyschema#concatenatedValue",
53+
PromoteProperty = true,
54+
Parameters = "\"Abc\",{https://schemas.company.com/propertyschema#property1},{https://schemas.company.com/propertyschema#property2},\"123\"",
55+
ThrowException=true
56+
}, PipelineStage.PreAssemble);
57+
var msg = MessageHelper.CreateFromString("");
58+
msg.Context.Promote("property1", "https://schemas.company.com/propertyschema", "def");
59+
var output = pipeline.Execute(msg);
60+
string concatenatedValue = (string)output.Context.Read("concatenatedValue", "https://schemas.company.com/propertyschema");
61+
Assert.AreEqual(concatenatedValue, "Abcdef123");
62+
}
63+
64+
[TestMethod, ExpectedException(typeof(ArgumentException))]
65+
public void TestConcatPropertiesWrongParameters()
66+
{
67+
var pipeline = PipelineFactory.CreateEmptySendPipeline();
68+
pipeline.AddComponent(new ConcatContextProperties
69+
{
70+
PropertyPath = "https://schemas.company.com/propertyschema#concatenatedValue",
71+
PromoteProperty = true,
72+
Parameters = "\"Abc,{https://schemas.company.com/propertyschema#property1},{https://schemas.company.com/propertyschema#property2},\"jkl\"",
73+
74+
}, PipelineStage.PreAssemble);
75+
var msg = MessageHelper.CreateFromString("");
76+
msg.Context.Promote("property1", "https://schemas.company.com/propertyschema", "def");
77+
msg.Context.Promote("property2", "https://schemas.company.com/propertyschema", "ghi");
78+
var output = pipeline.Execute(msg);
79+
string concatenatedValue = (string)output.Context.Read("concatenatedValue", "https://schemas.company.com/propertyschema");
80+
Assert.AreEqual(concatenatedValue, "Abcdefghijkl");
81+
}
82+
83+
[TestMethod]
84+
public void TestSpecialCharacters()
85+
{
86+
var pipeline = PipelineFactory.CreateEmptySendPipeline();
87+
pipeline.AddComponent(new ConcatContextProperties
88+
{
89+
PropertyPath = "https://schemas.company.com/propertyschema#concatenatedValue",
90+
PromoteProperty = true,
91+
Parameters = "{https://schemas.company.com/propertyschema#property1},\"he{LF}l{CR}lo{CRLF}Wor{TAB}ld\"",
92+
93+
}, PipelineStage.PreAssemble);
94+
var msg = MessageHelper.CreateFromString("");
95+
msg.Context.Promote("property1", "https://schemas.company.com/propertyschema", "def");
96+
msg.Context.Promote("property2", "https://schemas.company.com/propertyschema", "ghi");
97+
var output = pipeline.Execute(msg);
98+
string concatenatedValue = (string)output.Context.Read("concatenatedValue", "https://schemas.company.com/propertyschema");
99+
Assert.AreEqual(concatenatedValue, "defhe\nl\rlo\r\nWor\tld");
100+
}
101+
}
102+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<packages>
3+
<package id="Winterdom.BizTalk.PipelineTesting" version="1.2.2.0" targetFramework="net452" />
4+
</packages>

0 commit comments

Comments
 (0)