Beispiel #1
0
 public UnitTestClaimDeskXmlReceiveLocation()
 {
     Name            = ReceiveLocationName.About("Claim.Desk").FormattedAs.Xml;
     Enabled         = true;
     ReceivePipeline = new ReceivePipeline <XmlReceive>(
         pipeline => {
         pipeline.Validator <MicroPipelineComponent>(
             pc => {
             pc.Components = new IMicroPipelineComponent[] {
                 new ContextPropertyExtractor {
                     Extractors = new[] {
                         new XPathExtractor(BizTalkFactoryProperties.CorrelationToken, "/*[local-name()='Any']/*[local-name()='CorrelationToken']"),
                         new XPathExtractor(BizTalkFactoryProperties.EnvironmentTag, "/*[local-name()='Any']/*[local-name()='EnvironmentTag']"),
                         new XPathExtractor(BizTalkFactoryProperties.OutboundTransportLocation, "/*[local-name()='Any']/*[local-name()='OutboundTransportLocation']"),
                         new XPathExtractor(BizTalkFactoryProperties.ReceiverName, "/*[local-name()='Any']/*[local-name()='ReceiverName']"),
                         new XPathExtractor(BizTalkFactoryProperties.SenderName, "/*[local-name()='Any']/*[local-name()='SenderName']"),
                         new XPathExtractor(TrackingProperties.Value1, "/*[local-name()='Any']/*[local-name()='CorrelationToken']"),
                         new XPathExtractor(TrackingProperties.Value2, "/*[local-name()='Any']/*[local-name()='ReceiverName']"),
                         new XPathExtractor(TrackingProperties.Value3, "/*[local-name()='Any']/*[local-name()='SenderName']")
                     }
                 },
                 new ActivityTracker {
                     TrackingModes = ActivityTrackingModes.Claim
                 }
             };
         });
     });
     Transport.Adapter = new FileAdapter.Inbound(
         a => {
         a.FileMask      = "*.xml.claim";
         a.ReceiveFolder = @"C:\Files\Drops\BizTalk.Factory\In";
     });
     Transport.Host = CommonSettings.ReceiveHost;
 }
Beispiel #2
0
 public TestReferencedReceiveLocation()
 {
     Name              = "MyTestReferencedReceiveLocation";
     ReceivePipeline   = new ReceivePipeline <XmlReceive>();
     Transport.Adapter = new FileAdapter.Inbound(a => { a.ReceiveFolder = @"c:\file"; });
     Transport.Host    = "host";
 }
 public BankReceiveLocation()
 {
     Name              = ReceiveLocationName.About("AddPart").FormattedAs.Xml;
     ReceivePipeline   = new ReceivePipeline <PassThruReceive>();
     Transport.Adapter = new FileAdapter.Inbound(a => { a.ReceiveFolder = @"c:\file\drops"; });
     Transport.Host    = DummyHostResolutionPolicy.Default;
 }
Beispiel #4
0
 public PartReceiveLocationStub()
 {
     Name            = ReceiveLocationName.About("Part").FormattedAs.Xml;
     Enabled         = true;
     ReceivePipeline = new ReceivePipeline <XmlReceive>(
         pipeline => {
         pipeline.Validator <MicroPipelineComponent>(
             pc => {
             pc.Components = new IMicroComponent[] {
                 new ContextPropertyExtractor {
                     Extractors = new[] {
                         new XPathExtractor(BatchProperties.EnvelopeSpecName, "/*[local-name()='Any']/*[local-name()='EnvelopeSpecName']", ExtractionMode.Promote),
                         new XPathExtractor(BatchProperties.EnvelopePartition, "/*[local-name()='Any']/*[local-name()='EnvelopePartition']"),
                         new XPathExtractor(TrackingProperties.Value1, "/*[local-name()='Any']/*[local-name()='EnvelopeSpecName']"),
                         new XPathExtractor(TrackingProperties.Value2, "/*[local-name()='Any']/*[local-name()='EnvironmentTag']"),
                         new XPathExtractor(TrackingProperties.Value3, "/*[local-name()='Any']/*[local-name()='EnvelopePartition']")
                     }
                 },
                 new ActivityTracker()
             };
         });
     });
     Transport.Adapter = new FileAdapter.Inbound(
         a => {
         a.FileMask      = "*.xml.part";
         a.ReceiveFolder = @"C:\Files\Drops\BizTalk.Factory\In";
     });
     Transport.Host = Platform.Settings.ReceivingHost;
 }
        public OneWayReceiveLocation()
        {
            Name            = nameof(OneWayReceiveLocation);
            Description     = "Some Useless One-Way Test Receive Location";
            Enabled         = false;
            ReceivePipeline = new ReceivePipeline <PassThruReceive>(
                pl => pl.Decoder <MicroPipelineComponent>(
                    c => {
                c.Components = new IMicroComponent[] {
                    new ContextBuilder {
                        ExecutionTime = PluginExecutionTime.Deferred,
                        BuilderType   = typeof(DummyContextBuilder)
                    }
                };
            }));
            Transport.Adapter = new DummyAdapter();

            Transport.Host     = "Receive Host Name";
            Transport.Schedule = new() {
                StartDate     = DateTime.Today,
                StopDate      = DateTime.Today.AddDays(12),
                ServiceWindow = new DailyServiceWindow {
                    StartTime = new(13, 15),
                    StopTime  = new(14, 15)
                }
            };
        }
 public BankReceiveLocation()
 {
     Name              = ReceiveLocationName.About("AddPart").FormattedAs.Xml;
     ReceivePipeline   = new ReceivePipeline <BatchReceive>();
     Transport.Adapter = new FileAdapter.Inbound(a => { a.ReceiveFolder = @"c:\files\drops"; });
     Transport.Host    = "Host";
 }
Beispiel #7
0
 public TwoWaySoapSendPortStub()
 {
     Name                  = SendPortName.Towards("Stub").About("Message").FormattedAs.Xml;
     State                 = ServiceState.Started;
     SendPipeline          = new SendPipeline <XmlTransmit>();
     ReceivePipeline       = new ReceivePipeline <XmlReceive>();
     Transport.Adapter     = new WcfBasicHttpAdapter.Outbound(a => { a.Address = new EndpointAddress("http://localhost:8000/soap-stub"); });
     Transport.Host        = Platform.Settings.TransmittingHost;
     Transport.RetryPolicy = RetryPolicy.RealTime;
 }
 public UnitTestStubSendPort()
 {
     Name                  = SendPortName.Towards("UnitTest").About("Stub").FormattedAs.Xml;
     State                 = ServiceState.Started;
     SendPipeline          = new SendPipeline <XmlTransmit>();
     ReceivePipeline       = new ReceivePipeline <XmlReceive>();
     Transport.Adapter     = new WcfBasicHttpAdapter.Outbound(a => { a.Address = new EndpointAddress("http://localhost:8000/stubservice"); });
     Transport.Host        = CommonSettings.TransmitHost;
     Transport.RetryPolicy = RetryPolicy.RealTime;
 }
        public void ReceivePipelineSerializationIsEmptyWhenDefaultPipelineConfigIsNotOverridden()
        {
            Skip.IfNot(BizTalkServerGroup.IsConfigured);

            var pipeline = new ReceivePipeline <Microsoft.BizTalk.DefaultPipelines.XMLReceive>();
            var pipelineBindingSerializer = pipeline.GetPipelineBindingInfoSerializer();

            var binding = pipelineBindingSerializer.Serialize();

            binding.Should().BeEmpty();
        }
        public void ReceivePipelineDslGrammarVariant5()
        {
            Skip.IfNot(BizTalkServerGroup.IsConfigured);

            // not fluent-DSL
            var pipeline = new ReceivePipeline <XmlReceive>();

            pipeline.Stages.Decode.Component <FailedMessageRoutingEnablerComponent>().Enabled = false;
            pipeline.Stages.Decode.Component <MicroPipelineComponent>().Components            = new IMicroComponent[] { new XsltRunner {
                                                                                                                            MapType = typeof(IdentityTransform)
                                                                                                                        } };
            pipeline.Stages.Disassemble.Component <XmlDasmComp>().DocumentSpecNames = new() {
                new SchemaWithNone(SchemaMetadata.For <Any>().DocumentSpec.DocSpecStrongName),
                new SchemaWithNone(SchemaMetadata.For <soap_envelope_1__2.Envelope>().DocumentSpec.DocSpecStrongName)
            };
            pipeline.Stages.Disassemble.Component <XmlDasmComp>().RecoverableInterchangeProcessing = true;
            pipeline.Stages.Validate.Component <MicroPipelineComponent>().Components = new IMicroComponent[] { new XsltRunner {
                                                                                                                   MapType = typeof(IdentityTransform)
                                                                                                               } };
            var binding = pipeline.GetPipelineBindingInfoSerializer().Serialize();

            // fluent-DSL fifth variant
            var pipeline5 = ReceivePipeline <XmlReceive> .Configure(
                pl => {
                pl.Stages.Decode
                .ComponentAt <FailedMessageRoutingEnablerComponent>(0).Configure(c => { c.Enabled = false; })
                .ComponentAt <MicroPipelineComponent>(1)
                .Configure(mpc => { mpc.Components = new IMicroComponent[] { new XsltRunner {
                                                                                 MapType = typeof(IdentityTransform)
                                                                             } }; });
                pl.Stages.Disassemble.ComponentAt <XmlDasmComp>(0).Configure(
                    c => {
                    c.DocumentSpecNames = new() {
                        new SchemaWithNone(SchemaMetadata.For <Any>().DocumentSpec.DocSpecStrongName),
                        new SchemaWithNone(SchemaMetadata.For <soap_envelope_1__2.Envelope>().DocumentSpec.DocSpecStrongName)
                    };
                    c.RecoverableInterchangeProcessing = true;
                });
                pl.Stages.Validate.ComponentAt <MicroPipelineComponent>(0)
                .Configure(mpc => { mpc.Components = new IMicroComponent[] { new XsltRunner {
                                                                                 MapType = typeof(IdentityTransform)
                                                                             } }; });
            });

            var binding5 = pipeline5.GetPipelineBindingInfoSerializer().Serialize();

            binding5.Should().Be(binding);
        }

        [SkippableFact]
        public void ReceivePipelineSerializationKeepsOnlyStagesWhoseComponentsDefaultConfigHasBeenOverridden2()

        {
            Skip.IfNot(BizTalkServerGroup.IsConfigured);

            var pipeline = ReceivePipeline <XmlReceive> .Configure(
                pl => pl
                .FirstDecoder <FailedMessageRoutingEnablerComponent>(
                    c => {
                c.Enabled = false;
                c.SuppressRoutingFailureReport = false;
            })
                .FirstDecoder <MicroPipelineComponent>(
                    c => {
                c.Enabled    = true;
                c.Components = new IMicroComponent[] { new XsltRunner {
                                                           MapType = typeof(IdentityTransform)
                                                       } };
            }));

            var binding = pipeline.GetPipelineBindingInfoSerializer().Serialize();

            binding.Should().Be(
                "<Root><Stages>" +
                "<Stage CategoryId=\"9d0e4103-4cce-4536-83fa-4a5040674ad6\">" +
                "<Components>" +
                $"<Component Name=\"{typeof(FailedMessageRoutingEnablerComponent).FullName}\">" +
                "<Properties>" +
                "<Enabled vt=\"11\">0</Enabled>" +
                "<SuppressRoutingFailureReport vt=\"11\">0</SuppressRoutingFailureReport>" +
                "</Properties>" +
                "</Component>" +
                $"<Component Name=\"{typeof(MicroPipelineComponent).FullName}\">" +
                "<Properties>" +
                "<Components vt=\"8\">" + (
                    "&lt;mComponents&gt;" +
                    $"&lt;mComponent name='{typeof(XsltRunner).AssemblyQualifiedName}'&gt;" + (
                        "&lt;Encoding&gt;utf-8&lt;/Encoding&gt;" +
                        $"&lt;Map&gt;{typeof(IdentityTransform).AssemblyQualifiedName}&lt;/Map&gt;") +
                    "&lt;/mComponent&gt;" +
                    "&lt;/mComponents&gt;") +
                "</Components>" +
                "</Properties>" +
                "</Component>" +
                "</Components>" +
                "</Stage>" +
                "</Stages></Root>"
                );
        }
Beispiel #12
0
 public TwoWaySendPort()
 {
     Name            = nameof(TwoWaySendPort);
     Description     = "Some Useless Two-Way Test Send Port";
     SendPipeline    = new SendPipeline <PassThruTransmit>();
     ReceivePipeline = new ReceivePipeline <PassThruReceive>(
         pl => pl.Decoder <MicroPipelineComponent>(
             c => {
         c.Components = new IMicroComponent[] {
             new ContextBuilder {
                 ExecutionTime = PluginExecutionTime.Deferred,
                 BuilderType   = typeof(DummyContextBuilder)
             }
         };
     }));
     Transport.Adapter = new DummyAdapter();
     Transport.Host    = "Send Host Name";
 }
Beispiel #13
0
 public TwoWayReceiveLocation()
 {
     Name            = nameof(TwoWayReceiveLocation);
     Description     = "Some Useless Two-Way Test Receive Location";
     Enabled         = false;
     ReceivePipeline = new ReceivePipeline <PassThruReceive>();
     SendPipeline    = new SendPipeline <PassThruTransmit>(
         pl => pl.PreAssembler <MicroPipelineComponent>(
             c => {
         c.Components = new IMicroComponent[] {
             new ContextBuilder {
                 ExecutionTime = PluginExecutionTime.Deferred,
                 BuilderType   = typeof(DummyContextBuilder)
             }
         };
     }));
     Transport.Adapter = new DummyAdapter();
     Transport.Host    = "Receive Host Name";
 }
 public BatchReceiveLocation()
 {
     Name            = ReceiveLocationName.About("Release").FormattedAs.Xml;
     Enabled         = true;
     ReceivePipeline = new ReceivePipeline <PassThruReceive>(
         pipeline => {
         pipeline.Decoder <MicroPipelineComponent>(
             pc => {
             pc.Components = new IMicroPipelineComponent[] {
                 new BatchTracker(),
                 new EnvelopeBuilder(),
                 new ContextPropertyExtractor()
             };
         });
     });
     Transport.Adapter = new WcfSqlAdapter.Inbound(
         a => {
         a.Address = new SqlAdapterConnectionUri {
             InboundId      = "AvailableBatches",
             InitialCatalog = "BizTalkFactoryTransientStateDb",
             Server         = CommonSettings.ProcessingDatabaseHostName,
             InstanceName   = CommonSettings.ProcessingDatabaseInstanceName
         };
         a.PolledDataAvailableStatement = "SELECT COUNT(1) FROM vw_batch_NextAvailableBatch";
         a.PollingStatement             = "EXEC usp_batch_ReleaseNextBatch";
         a.PollingInterval                = BatchReleasePollingInterval;
         a.PollWhileDataFound             = true;
         a.InboundOperationType           = InboundOperation.XmlPolling;
         a.XmlStoredProcedureRootNodeName = "BodyWrapper";
         a.InboundBodyLocation            = InboundMessageBodySelection.UseBodyPath;
         a.InboundBodyPathExpression      = "/BodyWrapper/*";
         a.InboundNodeEncoding            = MessageBodyFormat.Xml;
         a.ServiceBehaviors               = new[] {
             new SqlAdapterInboundTransactionBehavior {
                 TransactionIsolationLevel = IsolationLevel.ReadCommitted,
                 TransactionTimeout        = TimeSpan.FromMinutes(2)
             }
         };
     });
     Transport.Host = CommonSettings.ReceiveHost;
 }
        public void ReceivePipelineSerializationKeepsOnlyStagesWhoseComponentsDefaultConfigHasBeenOverridden()
        {
            Skip.IfNot(BizTalkServerGroup.IsConfigured);

            var pipeline = new ReceivePipeline <Microsoft.BizTalk.DefaultPipelines.XMLReceive>(
                pl => pl.Disassembler <XmlDasmComp>(c => { c.RecoverableInterchangeProcessing = true; }));
            var pipelineBindingSerializer = pipeline.GetPipelineBindingInfoSerializer();

            var binding = pipelineBindingSerializer.Serialize();

            binding.Should().Be(
                "<Root><Stages>" +
                "<Stage CategoryId=\"9d0e4105-4cce-4536-83fa-4a5040674ad6\">" +
                "<Components>" +
                $"<Component Name=\"{typeof(XmlDasmComp).FullName}\">" +
                "<Properties><RecoverableInterchangeProcessing vt=\"11\">-1</RecoverableInterchangeProcessing></Properties>" +
                "</Component>" +
                "</Components>" +
                "</Stage>" +
                "</Stages></Root>");
        }
Beispiel #16
0
 public static IDslSerializer GetPipelineBindingInfoSerializer <T>(this ReceivePipeline <T> pipeline) where T : ReceivePipeline, new()
 {
     return(new PipelineBindingInfoSerializer(pipeline));
 }