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"));
        }
Beispiel #2
0
        public void CanCreateTransaction()
        {
            SendPipelineWrapper pipeline =
                PipelineFactory.CreateSendPipeline(typeof(XMLTransmit));

            using (TransactionControl control = pipeline.EnableTransactions())
            {
                // 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));

                MessageCollection inputMessages = new MessageCollection();
                inputMessages.Add(inputMessage);

                // Execute the pipeline, and check the output
                IBaseMessage outputMessage = pipeline.Execute(inputMessages);

                Assert.IsNotNull(outputMessage);
                control.SetComplete();
            }
        }
Beispiel #3
0
        public void CanCreateMultipartFromStreamSimple()
        {
            IBaseMessage message = MessageHelper.Create(
                DocLoader.LoadStream("Env_Batch_Input.xml"),
                DocLoader.LoadStream("CSV_FF_RecvInput.txt")
                );

            Assert.AreEqual(2, message.PartCount);
        }
        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 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);
        }
Beispiel #6
0
        public void CanExecuteEmptyPipeline()
        {
            SendPipelineWrapper pipeline =
                PipelineFactory.CreateEmptySendPipeline();

            // Create the input message to pass through the pipeline
            Stream       stream       = DocLoader.LoadStream("SampleDocument.xml");
            IBaseMessage inputMessage = MessageHelper.CreateFromStream(stream);

            MessageCollection inputMessages = new MessageCollection();

            inputMessages.Add(inputMessage);

            // Execute the pipeline, and check the output
            IBaseMessage outputMessage = pipeline.Execute(inputMessages);

            Assert.IsNotNull(outputMessage);
        }
        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);
        }
Beispiel #8
0
        public void CanLoadMessageFromFiles()
        {
            string dir      = Path.GetTempPath();
            string ctxFile  = "doc1_context.xml";
            string bodyFile = "doc1_body.out";

            DocLoader.ExtractToDir(ctxFile, dir);
            DocLoader.ExtractToDir(bodyFile, dir);

            IBaseMessage msg =
                MessageHelper.LoadMessage(Path.Combine(dir, ctxFile));

            Assert.IsNotNull(msg);
            Assert.AreEqual(1, msg.PartCount);

            string ns  = "http://schemas.microsoft.com/BizTalk/2003/file-properties";
            string val = (string)msg.Context.Read("ReceivedFileName", ns);

            IBaseMessagePart part = msg.BodyPart;

            Assert.AreEqual("UTF-8", part.Charset);
            Assert.AreEqual("text/xml", part.ContentType);
        }
Beispiel #9
0
        public void CanExecutePipelineWithFlatFile()
        {
            SendPipelineWrapper pipeline =
                PipelineFactory.CreateSendPipeline(typeof(CSV_FF_SendPipeline));

            // Create the input message to pass through the pipeline
            Stream       stream       = DocLoader.LoadStream("CSV_XML_SendInput.xml");
            IBaseMessage inputMessage = MessageHelper.CreateFromStream(stream);

            inputMessage.BodyPart.Charset = "UTF-8";

            // Add the necessary schemas to the pipeline, so that
            // assembling works
            pipeline.AddDocSpec(typeof(Schema3_FF));

            MessageCollection inputMessages = new MessageCollection();

            inputMessages.Add(inputMessage);

            // Execute the pipeline, and check the output
            IBaseMessage outputMessage = pipeline.Execute(inputMessages);

            Assert.IsNotNull(outputMessage);
        }