Exemplo n.º 1
0
        public void ThrowExceptionWhenInputMsgIsNull()
        {
            SendPipelineWrapper pipeline =
                PipelineFactory.CreateSendPipeline(typeof(XMLTransmit));

            pipeline.Execute((MessageCollection)null);
        }
Exemplo n.º 2
0
        public void ThrowExceptionWhenInputMsgCollectionIsEmpty()
        {
            SendPipelineWrapper pipeline =
                PipelineFactory.CreateSendPipeline(typeof(XMLTransmit));

            pipeline.Execute(new MessageCollection());
        }
        public void TestPipeline()
        {
            IBaseMessage msg = MessageHelper.CreateFromString(Resource.GoogleBucketEntry_1);

            rcvpipeline.AddDocSpec(typeof(Schemas.BucketClaimCheck));



            MessageCollection messages = rcvpipeline.Execute(msg);

            IBaseMessage message = messages[0];



            SendPipelineWrapper snddirectpipeline = PipelineFactory.CreateSendPipeline(typeof(Pipelines.ClaimCheckSendPipeline));



            IBaseMessage sendmessage = snddirectpipeline.Execute(messages);



            Diff myDiff = DiffBuilder.Compare(Input.FromString(Resource.GoogleBucketResult))
                          .WithTest(Input.FromStream(sendmessage.BodyPart.Data))
                          .CheckForIdentical().Build();


            Assert.IsFalse(myDiff.HasDifferences());
        }
Exemplo n.º 4
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();
            }
        }
Exemplo n.º 5
0
        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;
        }
Exemplo n.º 6
0
        public void CanCreateSendPipelineFromType()
        {
            SendPipelineWrapper sendPipeline =
                PipelineFactory.CreateSendPipeline(typeof(XMLTransmit));

            Assert.IsNotNull(sendPipeline);
        }
Exemplo n.º 7
0
        public void CanCreateEmptySendPipeline()
        {
            SendPipelineWrapper sendPipeline =
                PipelineFactory.CreateEmptySendPipeline();

            Assert.IsNotNull(sendPipeline);
        }
Exemplo n.º 8
0
        public void CanSetSigningCertificate()
        {
            SendPipelineWrapper pipeline = PipelineFactory.CreateEmptySendPipeline();

            pipeline.GroupSigningCertificate = "whatever";
            Assert.IsNotNull(pipeline.GroupSigningCertificate);
        }
Exemplo n.º 9
0
        public void CanAddComponentToValidStage()
        {
            SendPipelineWrapper pipeline = PipelineFactory.CreateEmptySendPipeline();
            IBaseComponent      encoder  = new MIME_SMIME_Encoder();

            pipeline.AddComponent(encoder, PipelineStage.Encode);
        }
Exemplo n.º 10
0
        public void ThrowExceptionWhenComponentAddedToInvalidStage()
        {
            SendPipelineWrapper pipeline = PipelineFactory.CreateEmptySendPipeline();
            IBaseComponent      encoder  = new MIME_SMIME_Encoder();

            pipeline.AddComponent(encoder, PipelineStage.ResolveParty);
        }
Exemplo n.º 11
0
        public void CanExecutePipelineWithMultiInputMsgs()
        {
            SendPipelineWrapper pipeline =
                PipelineFactory.CreateSendPipeline(typeof(Env_SendPipeline));

            // Create the input message to pass through the pipeline
            string body =
                @"<o:Body xmlns:o='http://SampleSchemas.SimpleBody'>
               this is a body</o:Body>";

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

            // original code:
            // MessageCollection inputMessages = new MessageCollection();
            // inputMessages.Add(MessageHelper.CreateFromString(body));
            // inputMessages.Add(MessageHelper.CreateFromString(body));
            // inputMessages.Add(MessageHelper.CreateFromString(body));

            // Execute the pipeline, and check the output
            // we get a single message batched with all the
            // messages grouped into the envelope's body
            IBaseMessage outputMessage = pipeline.Execute(
                MessageHelper.CreateFromString(body),
                MessageHelper.CreateFromString(body),
                MessageHelper.CreateFromString(body)
                );

            Assert.IsNotNull(outputMessage);
        }
        public void Send_WithCertificate()
        {
            string thumbprint =
                "e8 3e ff 40 69 03 58 17 59 2d 3b f8 f7 56 58 90 5d 59 03 2a";
            SendPipelineWrapper pipeline = Pipelines.Send()
                                           .WithCertificate(thumbprint);

            Assert.AreEqual(thumbprint, pipeline.GroupSigningCertificate);
        }
Exemplo n.º 13
0
        public void CanGetIndividualComponents()
        {
            SendPipelineWrapper pipeline = Pipelines.Xml.Send()
                                           .WithAssembler(Assembler.FlatFile())
                                           .WithEncoder(new MIME_SMIME_Encoder());

            Assert.IsAssignableFrom <XmlAsmComp>(pipeline.GetComponent(PipelineStage.Assemble, 0));
            Assert.IsAssignableFrom <FFAsmComp>(pipeline.GetComponent(PipelineStage.Assemble, 1));
            Assert.IsAssignableFrom <MIME_SMIME_Encoder>(pipeline.GetComponent(PipelineStage.Encode, 0));
        }
Exemplo n.º 14
0
        private static Stream Assemble(Assembler component, Stream inputDocument)
        {
            SendPipelineWrapper pipeline = Pipelines.Send()
                                           .WithAssembler(component);
            IBaseMessage output = pipeline.Execute(
                MessageHelper.CreateFromStream(inputDocument)
                );

            return(output.BodyPart.GetOriginalDataStream());
        }
Exemplo n.º 15
0
        public void Send_XmlAssemblerSchemasAddedToPipeline()
        {
            XmlAssembler xml = Assembler.Xml()
                               .WithDocumentSpec <Schema1_NPP.Root>();
            SendPipelineWrapper pipeline = Pipelines.Send()
                                           .WithAssembler(xml);

            string name = typeof(Schema1_NPP.Root).AssemblyQualifiedName;

            Assert.IsNotNull(pipeline.GetKnownDocSpecByName(name));
        }
Exemplo n.º 16
0
        public void Send_FFAssemblerSchemasAddedToPipeline()
        {
            FFAssembler ff = Assembler.FlatFile()
                             .WithDocumentSpec <Schema3_FF>();
            SendPipelineWrapper pipeline = Pipelines.Send()
                                           .WithAssembler(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))
            {
            }
        }
Exemplo n.º 18
0
        public void CanGetIndividualComponents()
        {
            SendPipelineWrapper pipeline = Pipelines.Xml.Send()
                                           .WithAssembler(Assembler.FlatFile())
                                           .WithEncoder(new MIME_SMIME_Encoder());

            Assert.IsInstanceOfType(typeof(XmlAsmComp),
                                    pipeline.GetComponent(PipelineStage.Assemble, 0));
            Assert.IsInstanceOfType(typeof(FFAsmComp),
                                    pipeline.GetComponent(PipelineStage.Assemble, 1));
            Assert.IsInstanceOfType(typeof(MIME_SMIME_Encoder),
                                    pipeline.GetComponent(PipelineStage.Encode, 0));
        }
Exemplo n.º 19
0
        public void Initialize()
        {
            string inputXml =
                @"<root>
                    <element1>value1</element1>
                    <element2>value2</element2>
                    <element3>value3</element3>
                </root>";

            msg = MessageHelper.CreateFromString(inputXml);
            msg.Context.Write(receivedFileName.PropertyName, receivedFileName.PropertyNamespace, originalFileName);
            pipeline = PipelineFactory.CreateEmptySendPipeline();
        }
Exemplo n.º 20
0
        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);
        }
Exemplo n.º 21
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);
        }
Exemplo n.º 22
0
        public void CanReadXmlAssemblerStream()
        {
            SendPipelineWrapper pipeline = Pipelines.Xml.Send()
                                           .WithSpec <Schema3_FF>();
            IBaseMessage input = MessageHelper.CreateFromStream(
                DocLoader.LoadStream("CSV_XML_SendInput.xml")
                );
            IBaseMessage output = pipeline.Execute(input);

            Assert.IsNotNull(output);
            // doc should load fine
            XmlDocument doc = new XmlDocument();

            doc.Load(output.BodyPart.Data);
            XmlNodeList fields = doc.SelectNodes("//*[local-name()='Field3']");

            Assert.Greater(fields.Count, 0);
        }
Exemplo n.º 23
0
        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"));
        }
Exemplo n.º 24
0
        public void CanApplyConfigToPipeline()
        {
            XmlTextReader reader = new XmlTextReader(
                DocLoader.LoadStream("PipelineInstanceConfig.xml")
                );
            SendPipelineWrapper pipeline = Pipelines.Xml.Send()
                                           .WithAssembler(Assembler.Xml())
                                           .WithEncoder(new MIME_SMIME_Encoder())
                                           .WithInstanceConfig(reader);

            XmlAsmComp xmlassm = (XmlAsmComp)
                                 pipeline.GetComponent(PipelineStage.Assemble, 0);

            Assert.IsFalse(xmlassm.AddXMLDeclaration);
            Assert.IsFalse(xmlassm.PreserveBom);

            MIME_SMIME_Encoder enc = (MIME_SMIME_Encoder)
                                     pipeline.GetComponent(PipelineStage.Encode, 0);

            Assert.IsTrue(enc.EnableEncryption);
            Assert.AreEqual(MIME_SMIME_Encoder.MIMETransferEncodingType.SevenBit,
                            enc.ContentTransferEncoding);
        }
Exemplo n.º 25
0
        public void Send_FullPipeline()
        {
            XmlAssembler xml = XmlAssembler.Xml()
                               .WithDocumentSpec <SimpleBody>()
                               .WithEnvelopeSpec <SimpleEnv>();
            SendPipelineWrapper pipeline = Pipelines.Send()
                                           .WithAssembler(xml)
                                           .WithEncoder(new MIME_SMIME_Encoder());

            // Create the input message to pass through the pipeline
            string body =
                @"<o:Body xmlns:o='http://SampleSchemas.SimpleBody'>
               this is a body</o:Body>";
            // Execute the pipeline, and check the output
            // we get a single message batched with all the
            // messages grouped into the envelope's body
            IBaseMessage outputMessage = pipeline.Execute(
                MessageHelper.CreateFromString(body),
                MessageHelper.CreateFromString(body),
                MessageHelper.CreateFromString(body)
                );

            Assert.IsNotNull(outputMessage);
        }
Exemplo n.º 26
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);
        }
Exemplo n.º 27
0
        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"));
        }
Exemplo n.º 28
0
        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);
                }
            }
        }
 public void Send_CanAddPreAssembler()
 {
     SendPipelineWrapper pipeline = Pipelines.Send()
                                    .WithPreAssembler(new MIME_SMIME_Encoder());
 }
 public void Send_CanAddAssembler()
 {
     SendPipelineWrapper pipeline = Pipelines.Send()
                                    .WithAssembler(new XmlAsmComp()).End();
 }