public void ThrowExceptionWhenInputMsgIsNull() { ReceivePipelineWrapper pipeline = PipelineFactory.CreateReceivePipeline(typeof(ReceivePipeline1)); pipeline.Execute(null); }
public void CanAddComponentToValidStage() { ReceivePipelineWrapper pipeline = PipelineFactory.CreateEmptyReceivePipeline(); IBaseComponent component = new XmlDasmComp(); pipeline.AddComponent(component, PipelineStage.Disassemble); }
public void ThrowExceptionWhenComponentAddedToInvalidStage() { ReceivePipelineWrapper pipeline = PipelineFactory.CreateEmptyReceivePipeline(); IBaseComponent partyResolution = new PartyRes(); pipeline.AddComponent(partyResolution, PipelineStage.PreAssemble); }
public void ThrowExceptionWhenCompponentAddedToNullStage() { ReceivePipelineWrapper pipeline = PipelineFactory.CreateEmptyReceivePipeline(); IBaseComponent partyResolution = new PartyRes(); pipeline.AddComponent(partyResolution, null); }
public void CanCreateEmptyReceivePipeline() { ReceivePipelineWrapper receivePipeline = PipelineFactory.CreateEmptyReceivePipeline(); Assert.IsNotNull(receivePipeline); }
public void CanCreateReceivePipelineFromType() { ReceivePipelineWrapper receivePipeline = PipelineFactory.CreateReceivePipeline(typeof(XMLReceive)); Assert.IsNotNull(receivePipeline); }
public void CanExecuteLoadedPipeline() { ReceivePipelineWrapper pipeline = PipelineFactory.CreateReceivePipeline(typeof(ReceivePipeline1)); // Create the input message to pass through the pipeline Stream stream = DocLoader.LoadStream("SampleDocument.xml"); IBaseMessage inputMessage = MessageHelper.CreateFromStream(stream); // Add the necessary schemas to the pipeline, so that // disassembling works pipeline.AddDocSpec(typeof(Schema1_NPP)); pipeline.AddDocSpec(typeof(Schema2_WPP)); // Execute the pipeline, and check the output MessageCollection outputMessages = pipeline.Execute(inputMessage); Assert.IsNotNull(outputMessages); Assert.IsTrue(outputMessages.Count > 0); // check we promoted properties correctly const string ns = "http://SampleSchemas.PropSchema1"; Assert.IsTrue(PropertyExists(outputMessages[0], ns, "Property1")); Assert.IsTrue(PropertyExists(outputMessages[0], ns, "Property1")); }
protected void ContextPropertyExtractorPromotesConstant(ReceivePipelineWrapper pipeline) { const string content = "<ns0:Root xmlns:ns0=\"http://schemas.microsoft.com/BizTalk/2003/Any\"><message>content</message></ns0:Root>"; using (var stream = new StringStream(content)) { pipeline.AddDocSpec(typeof(Any)); var microPipeline = (MicroPipelineComponent)pipeline.GetComponent(PipelineStage.Decode, 1); microPipeline.Components = new[] { new ContextPropertyExtractor { Extractors = new[] { new ConstantExtractor(BizTalkFactoryProperties.EnvironmentTag.QName, "tag", ExtractionMode.Promote) } } }; var inputMessage = MessageHelper.CreateFromStream(stream); inputMessage.GetProperty(BizTalkFactoryProperties.EnvironmentTag).Should().BeNull(); inputMessage.IsPromoted(BizTalkFactoryProperties.EnvironmentTag).Should().BeFalse(); var outputMessages = pipeline.Execute(inputMessage); outputMessages[0].GetProperty(BizTalkFactoryProperties.EnvironmentTag).Should().Be("tag"); outputMessages[0].IsPromoted(BizTalkFactoryProperties.EnvironmentTag).Should().BeTrue(); using (var reader = new StreamReader(outputMessages[0].BodyPart.Data)) { var readOuterXml = reader.ReadToEnd(); readOuterXml.Should().Be(content); } outputMessages[0].GetProperty(BizTalkFactoryProperties.EnvironmentTag).Should().Be("tag"); outputMessages[0].IsPromoted(BizTalkFactoryProperties.EnvironmentTag).Should().BeTrue(); } }
public void Receive_WithCertificate() { string thumbprint = "e8 3e ff 40 69 03 58 17 59 2d 3b f8 f7 56 58 90 5d 59 03 2a"; ReceivePipelineWrapper pipeline = Pipelines.Receive() .WithCertificate(thumbprint); Assert.AreEqual(thumbprint, pipeline.GroupSigningCertificate); }
public void CanAddNoTargetNSDocSpec() { ReceivePipelineWrapper pipeline = PipelineFactory.CreateEmptyReceivePipeline(); pipeline.AddDocSpec(typeof(NoNS)); IDocumentSpec docSpec = pipeline.GetKnownDocSpecByType("Root"); Assert.IsNotNull(docSpec); }
public void Receive_XmlDisassemblerSchemasAddedToPipeline() { XmlDisassembler xml = Disassembler.Xml() .WithDocumentSpec <Schema1_NPP.Root>(); ReceivePipelineWrapper pipeline = Pipelines.Receive() .WithDisassembler(xml); string name = typeof(Schema1_NPP.Root).AssemblyQualifiedName; Assert.IsNotNull(pipeline.GetKnownDocSpecByName(name)); }
public void Receive_FFDisassemblerSchemasAddedToPipeline() { FFDisassembler ff = Disassembler.FlatFile() .WithDocumentSpec <Schema3_FF>(); ReceivePipelineWrapper pipeline = Pipelines.Receive() .WithDisassembler(ff); string name = typeof(Schema3_FF).AssemblyQualifiedName; Assert.IsNotNull(pipeline.GetKnownDocSpecByName(name)); }
public void Setup() { rcvpipeline = PipelineFactory.CreateEmptyReceivePipeline(); XmlDasmComp xmlDasmComp = new XmlDasmComp(); rcvpipeline.AddComponent(xmlDasmComp, PipelineStage.Disassemble); sndpipeline = PipelineFactory.CreateEmptySendPipeline(); if (!File.Exists(googlecredentials)) { } }
private void configureJSONReceivePipeline(ReceivePipelineWrapper pipeline, string rootNode, string namespaceUri) { string configPath = Path.Combine(TestContext.DeploymentDirectory, "pipelineconfig.xml"); var configDoc = XDocument.Load(configPath); configDoc.Descendants("RootNode").First().SetValue(rootNode); configDoc.Descendants("RootNodeNamespace").First().SetValue(namespaceUri); configDoc.Save(configPath); pipeline.ApplyInstanceConfig(configPath); }
public void CanAddDocSpecByName() { ReceivePipelineWrapper pipeline = PipelineFactory.CreateEmptyReceivePipeline(); pipeline.AddDocSpec("SampleSchemas.Schema1_NPP+Root", "SampleSchemas"); IDocumentSpec docSpec = pipeline.GetKnownDocSpecByName(typeof(Schema1_NPP.Root).AssemblyQualifiedName); Assert.IsNotNull(docSpec); docSpec = pipeline.GetKnownDocSpecByType("http://SampleSchemas.Schema1_NPP#Root"); Assert.IsNotNull(docSpec); }
private static Stream Parse(Disassembler component, Stream inputDocument) { ReceivePipelineWrapper pipeline = Pipelines.Receive() .WithDisassembler(component); MessageCollection output = pipeline.Execute( MessageHelper.CreateFromStream(inputDocument) ); if (output.Count > 0) { return(output[0].BodyPart.GetOriginalDataStream()); } return(null); }
public void CanExecuteEmptyPipeline() { ReceivePipelineWrapper pipeline = PipelineFactory.CreateEmptyReceivePipeline(); // Create the input message to pass through the pipeline Stream stream = DocLoader.LoadStream("SampleDocument.xml"); IBaseMessage inputMessage = MessageHelper.CreateFromStream(stream); // Execute the pipeline, and check the output MessageCollection outputMessages = pipeline.Execute(inputMessage); Assert.IsNotNull(outputMessages); Assert.IsTrue(outputMessages.Count > 0); }
public void Receive_WithPromotedProps() { ReceivePipelineWrapper pipeline = Pipelines.Xml.Receive() .WithSpec <Schema2_WPP>(); IBaseMessage input = MessageHelper.CreateFromStream( DocLoader.LoadStream("SampleDocument.xml") ); MessageCollection output = pipeline.Execute(input); Property2 prop = new Property2(); object value = output[0].Context.Read(prop.QName.Name, prop.QName.Namespace); Assert.AreEqual("Field2_0", value); }
private static ReceivePipelineWrapper GeneratePipeline(string customPropertyNamespace, bool excludeSystemProperties) { PropertyMessageDecoder propertyMessageDecoder = new PropertyMessageDecoder(); propertyMessageDecoder.CustomPropertyNamespace = customPropertyNamespace; propertyMessageDecoder.ExcludeSystemProperties = excludeSystemProperties; ReceivePipelineWrapper pipeline = PipelineFactory.CreateEmptyReceivePipeline(); pipeline.AddComponent(propertyMessageDecoder, PipelineStage.Decode); pipeline.AddComponent(new Microsoft.BizTalk.Component.XmlDasmComp(), PipelineStage.Disassemble); pipeline.AddDocSpec(typeof(PropertyMessage)); return(pipeline); }
public void Receive_FullPipeline() { FFDisassembler ff = Disassembler.FlatFile() .WithDocumentSpec <Schema3_FF>(); ReceivePipelineWrapper pipeline = Pipelines.Receive() .WithDisassembler(ff); IBaseMessage input = MessageHelper.CreateFromStream( DocLoader.LoadStream("CSV_FF_RecvInput.txt") ); MessageCollection output = pipeline.Execute(input); Assert.AreEqual(1, output.Count); }
public void CanExecutePipelineWithMultiMsgOutput() { ReceivePipelineWrapper pipeline = PipelineFactory.CreateEmptyReceivePipeline(); pipeline.AddComponent(new XmlDasmComp(), PipelineStage.Disassemble); pipeline.AddDocSpec(typeof(SimpleBody)); pipeline.AddDocSpec(typeof(SimpleEnv)); Stream stream = DocLoader.LoadStream("Env_Batch_Input.xml"); IBaseMessage inputMessage = MessageHelper.CreateFromStream(stream); MessageCollection outputMessages = pipeline.Execute(inputMessage); Assert.IsNotNull(outputMessages); Assert.AreEqual(3, outputMessages.Count); }
public void CanExecutePipelineWithFlatFile() { ReceivePipelineWrapper pipeline = PipelineFactory.CreateReceivePipeline(typeof(CSV_FF_RecvPipeline)); // Create the input message to pass through the pipeline Stream stream = DocLoader.LoadStream("CSV_FF_RecvInput.txt"); IBaseMessage inputMessage = MessageHelper.CreateFromStream(stream); inputMessage.BodyPart.Charset = "UTF-8"; // Add the necessary schemas to the pipeline, so that // disassembling works pipeline.AddDocSpec(typeof(Schema3_FF)); // Execute the pipeline, and check the output MessageCollection outputMessages = pipeline.Execute(inputMessage); Assert.IsNotNull(outputMessages); Assert.IsTrue(outputMessages.Count > 0); }
public void ThrowExceptionWhenAddingNullComponent() { ReceivePipelineWrapper pipeline = PipelineFactory.CreateEmptyReceivePipeline(); pipeline.AddComponent(null, PipelineStage.ResolveParty); }
internal ReceivePipelineBuilder(Type type) { _pipeline = PipelineFactory.CreateReceivePipeline(type); }
public void Receive_CanAddPartyResolver() { ReceivePipelineWrapper pipeline = Pipelines.Receive() .WithPartyResolver(new PartyRes()); }
public void Receive_CanAddValidator() { ReceivePipelineWrapper pipeline = Pipelines.Receive() .WithValidator(new XmlValidator()); }
public void Receive_CanAddDisassembler() { ReceivePipelineWrapper pipeline = Pipelines.Receive() .WithDisassembler(new XmlDasmComp()); }
public void Receive_CanAddDecoder() { ReceivePipelineWrapper pipeline = Pipelines.Receive() .WithDecoder(new MIME_SMIME_Decoder()); }
public void ThrowExceptionWhenNullDocSpecAdded() { ReceivePipelineWrapper pipeline = PipelineFactory.CreateEmptyReceivePipeline(); pipeline.AddDocSpec(null); }
internal ReceivePipelineBuilder() { _pipeline = PipelineFactory.CreateEmptyReceivePipeline(); }