/// <summary> /// Adds a pipeline component to the Encode stage /// </summary> /// <param name="encoder">The component to add</param> /// <returns>This instance</returns> public SendPipelineBuilder WithEncoder(IBaseComponent encoder) { if (encoder == null) { throw new ArgumentNullException("encoder"); } _pipeline.AddComponent(encoder, PipelineStage.Encode); return(this); }
private void btnRun_Click(object sender, EventArgs e) { string Key = txtKey.Text; string PropertyPath = txtPropertyPath.Text; string DestinationPath = txtDestinationPath.Text; string ListName = txtListName.Text; IBaseMessage message = MessageHelper.CreateFromString("<testfile/>"); message.Context.Promote(new ContextProperty(PropertyPath), Key); var component = new SharepointLookup() { Disabled = false, PropertyPath = PropertyPath, DestinationPath = DestinationPath, ListName = ListName, ThrowException = true, PromoteProperty = true }; SendPipelineWrapper sendPipeline = PipelineFactory.CreateEmptySendPipeline(); sendPipeline.AddComponent(component, PipelineStage.PreAssemble); IBaseMessage results = sendPipeline.Execute(message); string result = (string)results.Context.Read(new ContextProperty(DestinationPath)); txtResult.Text = result; }
public void CanEnumerateComponents() { SendPipelineWrapper pipeline = PipelineFactory.CreateEmptySendPipeline(); pipeline.AddComponent(new XmlAsmComp(), PipelineStage.Assemble); pipeline.AddComponent(new MIME_SMIME_Encoder(), PipelineStage.Encode); pipeline.AddComponent(new FFAsmComp(), PipelineStage.Assemble); int numComponents = 0; foreach (IBaseComponent component in pipeline) { numComponents++; } Assert.AreEqual(3, numComponents); }
public void ThrowExceptionWhenComponentAddedToInvalidStage() { SendPipelineWrapper pipeline = PipelineFactory.CreateEmptySendPipeline(); IBaseComponent encoder = new MIME_SMIME_Encoder(); pipeline.AddComponent(encoder, PipelineStage.ResolveParty); }
public void CanAddComponentToValidStage() { SendPipelineWrapper pipeline = PipelineFactory.CreateEmptySendPipeline(); IBaseComponent encoder = new MIME_SMIME_Encoder(); pipeline.AddComponent(encoder, PipelineStage.Encode); }
public void SetFileName_ShouldIncludeSourceFilename() { var component = new SetFileName() { IncludeOriginalFilename = true }; pipeline.AddComponent(component, PipelineStage.Encode); var result = pipeline.Execute(msg); string newFileName = result.Context.Read(receivedFileName.PropertyName, receivedFileName.PropertyNamespace).ToString(); Assert.AreEqual(originalFileName, newFileName); }
public void Test() { var config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); if (config.AppSettings.Settings["SharePointSite"] == null) { config.AppSettings.Settings.Add("SharePointSite", "https://TestUrl.org"); } else { config.AppSettings.Settings["SharePointSite"].Value = "https://TestUrl.org"; } string Key = "274"; string DestinationPath = "https://Test.Schemas.PropertySchema#Destination"; IBaseMessage message = MessageHelper.CreateFromString("<Test/>"); message.Context.Write("Key", "https://Test.Schemas.PropertySchema", Key); message.Context.Write("DestinationPath", "https://Test.Schemas.PropertySchema", DestinationPath); var component = new SharepointLookup() { Disabled = false, PropertyPath = "https://Test.Schemas.PropertySchema#Key", DestinationPath = "https://Test.Schemas.PropertySchema#DestinationPath", ListName = "TestList", ThrowException = true, PromoteProperty = true }; SendPipelineWrapper sendPipeline = PipelineFactory.CreateEmptySendPipeline(); sendPipeline.AddComponent(component, PipelineStage.PreAssemble); IBaseMessage results = sendPipeline.Execute(message); Assert.AreEqual(Key, results.Context.Read("StoreId", "https://Test.Schemas.PropertySchema")); Assert.IsTrue(results.Context.IsPromoted("DestinationPath", "https://Test.Schemas.PropertySchema")); }
public void TestGoogleBucket() { IBaseMessage msg = MessageHelper.CreateFromString(Resource.GoogleBucketEntry_1); rcvpipeline.AddDocSpec(typeof(Schemas.BucketClaimCheck)); MessageCollection messages = rcvpipeline.Execute(msg); IBaseMessage message = messages[0]; ClaimCheckPipelineComponent claimCheckPipelineComponent = new ClaimCheckPipelineComponent(); claimCheckPipelineComponent.Enabled = true; claimCheckPipelineComponent.ClientId = "111382948100122064143"; claimCheckPipelineComponent.ServiceAccountName = "*****@*****.**"; FileInfo credentials = new FileInfo(googlecredentials); var jsonfilepath = credentials.FullName; claimCheckPipelineComponent.ServiceAccountKey = jsonfilepath; sndpipeline.AddComponent(claimCheckPipelineComponent, PipelineStage.Encode); IBaseMessage sendmessage = sndpipeline.Execute(messages); Diff myDiff = DiffBuilder.Compare(Input.FromString(Resource.GoogleBucketResult)) .WithTest(Input.FromStream(sendmessage.BodyPart.Data)) .CheckForIdentical().Build(); Assert.IsFalse(myDiff.HasDifferences()); }
public void Test() { IBaseMessage message = MessageHelper.CreateFromString("<test/>"); message.Context.Write("property1", "namespace1", "filename1.txt"); message.Context.Write("property2", "namespace2", "123"); var component = new SetHttpHeaders() { Disabled = false, DestinationPath = "MyNamespace#HttpHeaders", HeaderNames = "FileName;StoreID", PromoteProperty = true, PropertyPaths = "namespace1#property1;namespace2#property2" }; SendPipelineWrapper SendPipeline = PipelineFactory.CreateEmptySendPipeline(); SendPipeline.AddComponent(component, PipelineStage.PreAssemble); IBaseMessage results = SendPipeline.Execute(message); Assert.AreEqual("FileName:filename1.txt StoreID:123", results.Context.Read("HttpHeaders", "MyNamespace")); }
public void CanExecuteBtfAssembler() { SendPipelineWrapper pipeline = PipelineFactory.CreateEmptySendPipeline(); pipeline.GroupSigningCertificate = "9302859B216AB1E97A2EB4F94E894A128E4A3B6E"; MIME_SMIME_Encoder mime = new MIME_SMIME_Encoder(); mime.SignatureType = MIME_SMIME_Encoder.SMIME_SignatureType.BlobSign; mime.SendBodyPartAsAttachment = true; mime.AddSigningCertToMessage = true; mime.EnableEncryption = false; mime.ContentTransferEncoding = MIME_SMIME_Encoder.MIMETransferEncodingType.SevenBit; pipeline.AddComponent(mime, PipelineStage.Encode); BTFAsmComp asm = new BTFAsmComp(); asm.DesignProp_epsFromAddress = "asdasd"; asm.DesignProp_epsFromAddressType = "asdad"; asm.DesignProp_epsToAddress = "eweww"; asm.DesignProp_epsToAddressType = " asdd"; asm.DesignProp_isReliable = true; asm.DesignProp_propTopic = "wewew"; asm.DesignProp_svcDeliveryRctRqtSendBy = 4; asm.DesignProp_svcDeliveryRctRqtSendToAddress = "ddd"; asm.DesignProp_svcDeliveryRctRqtSendToAddressType = "sss"; pipeline.AddComponent(asm, PipelineStage.Assemble); pipeline.AddDocSpec(typeof(BTF2Schemas.btf2_endpoints_header)); pipeline.AddDocSpec(typeof(BTF2Schemas.btf2_envelope)); pipeline.AddDocSpec(typeof(BTF2Schemas.btf2_manifest_header)); pipeline.AddDocSpec(typeof(BTF2Schemas.btf2_process_header)); pipeline.AddDocSpec(typeof(BTF2Schemas.btf2_receipt_header)); pipeline.AddDocSpec(typeof(BTF2Schemas.btf2_services_header)); pipeline.AddDocSpec(typeof(SampleSchemas.SimpleBody)); string body = @"<o:Body xmlns:o='http://SampleSchemas.SimpleBody'> this is a body</o:Body>"; MessageCollection inputMessages = new MessageCollection(); IBaseMessage inputMsg = MessageHelper.CreateFromString(body); inputMsg.Context.Write("PassThroughBTF", "http://schemas.microsoft.com/BizTalk/2003/mime-properties", false); inputMessages.Add(inputMsg); inputMsg.BodyPart.PartProperties.Write("ContentTransferEncoding", "http://schemas.microsoft.com/BizTalk/2003/mime-properties", "7bit"); IBaseMessage output = pipeline.Execute(inputMessages); byte[] buffer = new byte[64 * 1024]; Stream input = output.BodyPart.Data; int bytesRead; Stream outputs = new FileStream("c:\\temp\\t.xml", FileMode.Truncate, FileAccess.Write); using ( outputs ) { while ((bytesRead = input.Read(buffer, 0, buffer.Length)) > 0) { outputs.Write(buffer, 0, bytesRead); } } }