Exemplo n.º 1
0
        public void TrackBatchReleasedOnPollingWhenNoMessagingStepActivityIds()
        {
            BatchAdapter.AddPart(_envelopeSpecName, "partition-z", null, "<data>some-partitioned-value</data>");
            BatchAdapter.AddPart(_envelopeSpecName, "partition-z", null, "<data>some-partitioned-value</data>");
            BatchAdapter.AddPart(_envelopeSpecName, "partition-z", null, "<data>some-partitioned-value</data>");

            BatchReleasePort.Enable();

            // batch content handling process
            var process = TrackingRepository.SingleProcess(
                p => p.Name == Default.Processes.Unidentified &&
                p.BeginTime > StartTime &&
                p.Status == TrackingStatus.Completed &&
                _envelopeSpecName.StartsWith(p.Value1) &&
                p.Value3 == "partition-z");
            var releaseProcessBatchMessagingStep = process.SingleMessagingStep(
                s => s.Name == BizTalkFactoryApplication.ReceiveLocation <BatchReceiveLocation>().Name
                // TODO && s.MessageType == new SchemaMetadata<BatchContent>().MessageType
                && s.Status == TrackingStatus.Received);

            process.SingleMessagingStep(
                s => s.Name == BizTalkFactoryApplication.SendPort <UnitTestBatchReleaseSendPort>().Name &&
                s.Status == TrackingStatus.Sent &&
                s.MessageType == new SchemaMetadata <Envelope>().MessageType &&
                _envelopeSpecName.StartsWith(s.Value1) &&
                s.Value3 == "partition-z");

            // no batch release process has been created as no parts provide a MessagingStepActivityId that could be used to link a part to its batch
            Assert.That(releaseProcessBatchMessagingStep.Processes.Count(p => p.Name == Factory.Areas.Batch.Processes.Release && p.BeginTime > StartTime), Is.EqualTo(0));
        }
Exemplo n.º 2
0
        public void AddPartToPartitionedBatch()
        {
            BatchAdapter.CreatePartMessage(_envelopeSpecName, "partition-z").DropToFolder(DropFolders.INPUT_FOLDER, "part.xml.part");

            var process = TrackingRepository.SingleProcess(
                p => p.Name == Factory.Areas.Batch.Processes.Aggregate &&
                p.BeginTime > StartTime &&
                p.Value3 == "partition-z");

            process.SingleMessagingStep(
                s => s.Name == BizTalkFactoryApplication.ReceiveLocation <UnitTestBatchAddPartReceiveLocation>().Name &&
                s.MessageType == new SchemaMetadata <Any>().MessageType &&
                s.Status == TrackingStatus.Received &&
                _envelopeSpecName.StartsWith(s.Value1, StringComparison.Ordinal) &&
                s.Value3 == "partition-z");
            var addPartMessage = process.SingleMessagingStep(
                s => s.Name == BizTalkFactoryApplication.SendPort <BatchAddPartSendPort>().Name &&
                s.MessageType == new SchemaMetadata <Any>().MessageType &&
                s.Status == TrackingStatus.Sent &&
                _envelopeSpecName.StartsWith(s.Value1, StringComparison.Ordinal) &&
                s.Value3 == "partition-z");

            var part = BatchAdapter.Parts.Single();

            Assert.That(part.MessagingStepActivityId, Is.EqualTo(addPartMessage.ActivityID));
            Assert.That(part.Partition, Is.EqualTo("partition-z"));
        }
Exemplo n.º 3
0
        public void ControlReleaseSkippedWhenBatchIsDisabled()
        {
            // register the batch again so as to disable it
            BatchAdapter.RegisterBatch(_envelopeSpecName, null, false, 3);

            BatchAdapter.AddPart(_envelopeSpecName, null, ActivityId.NewActivityId(), "<data>some-value</data>");
            BatchAdapter.CreateReleaseMessage(_envelopeSpecName, null).DropToFolder(DropFolders.INPUT_FOLDER, "release_batch.xml");

            // batch controlled release process
            var process = TrackingRepository.SingleProcess(
                p => p.Name == Factory.Areas.Batch.Processes.Release &&
                p.BeginTime > StartTime &&
                p.Status == TrackingStatus.Completed);

            process.SingleMessagingStep(
                s => s.Name == BizTalkFactoryApplication.ReceiveLocation <UnitTestInputMessageReceiveLocation>().Name &&
                s.MessageType == new SchemaMetadata <Schemas.Xml.Batch.Release>().MessageType &&
                s.Status == TrackingStatus.Received &&
                _envelopeSpecName.StartsWith(s.Value1));
            process.SingleMessagingStep(
                s => s.Name == BizTalkFactoryApplication.SendPort <BatchQueueControlledReleaseSendPort>().Name &&
                s.MessageType == new SchemaMetadata <Schemas.Xml.Batch.Release>().MessageType &&
                s.Status == TrackingStatus.Sent &&
                _envelopeSpecName.StartsWith(s.Value1));

            Assert.That(BatchAdapter.QueuedControlledReleases.Count(), Is.EqualTo(0));
        }
Exemplo n.º 4
0
            public static void Disable()
            {
                var application     = BizTalkServerGroup.Applications[BizTalkFactoryApplication.Name];
                var receiveLocation = application
                                      .ReceivePorts[BizTalkFactoryApplication.ReceivePort <BatchReceivePort>().Name]
                                      .ReceiveLocations[BizTalkFactoryApplication.ReceiveLocation <BatchReceiveLocation>().Name];

                receiveLocation.Disable();
                application.ApplyChanges();
            }
Exemplo n.º 5
0
        public void ControlReleaseOneEnvelopeAndOnePartition()
        {
            BatchAdapter.AddPart(_envelopeSpecName, "partition-z", ActivityId.NewActivityId(), "<data>some-partitioned-value</data>");
            BatchAdapter.CreateReleaseMessage(_envelopeSpecName, "partition-z").DropToFolder(DropFolders.INPUT_FOLDER, "release_batch.xml");

            // batch controlled release process
            var process = TrackingRepository.SingleProcess(
                p => p.Name == Factory.Areas.Batch.Processes.Release &&
                p.BeginTime > StartTime &&
                p.Status == TrackingStatus.Completed &&
                _envelopeSpecName.StartsWith(p.Value1) &&
                p.Value3 == "partition-z");

            process.SingleMessagingStep(
                s => s.Name == BizTalkFactoryApplication.ReceiveLocation <UnitTestInputMessageReceiveLocation>().Name &&
                s.MessageType == new SchemaMetadata <Schemas.Xml.Batch.Release>().MessageType &&
                s.Status == TrackingStatus.Received &&
                _envelopeSpecName.StartsWith(s.Value1) &&
                s.Value3 == "partition-z");
            process.SingleMessagingStep(
                s => s.Name == BizTalkFactoryApplication.SendPort <BatchQueueControlledReleaseSendPort>().Name &&
                s.MessageType == new SchemaMetadata <Schemas.Xml.Batch.Release>().MessageType &&
                s.Status == TrackingStatus.Sent &&
                _envelopeSpecName.StartsWith(s.Value1) &&
                s.Value3 == "partition-z");

            Assert.That(BatchAdapter.QueuedControlledReleases.Count(), Is.EqualTo(1));
            BatchReleasePort.Enable();

            // batch content handling process
            process = TrackingRepository.SingleProcess(
                p => p.Name == Default.Processes.Unidentified &&
                p.BeginTime > StartTime &&
                p.Status == TrackingStatus.Completed &&
                _envelopeSpecName.StartsWith(p.Value1) &&
                p.Value3 == "partition-z");
            process.SingleMessagingStep(
                s => s.Name == BizTalkFactoryApplication.ReceiveLocation <BatchReceiveLocation>().Name
                // TODO && s.MessageType == new SchemaMetadata<BatchContent>().MessageType
                && s.Status == TrackingStatus.Received);
            var envelopeMessagingStep = process.SingleMessagingStep(
                s => s.Name == BizTalkFactoryApplication.SendPort <UnitTestBatchReleaseSendPort>().Name &&
                s.Status == TrackingStatus.Sent &&
                s.MessageType == new SchemaMetadata <Envelope>().MessageType &&
                _envelopeSpecName.StartsWith(s.Value1) &&
                s.Value3 == "partition-z");

            Assert.That(
                envelopeMessagingStep.Message.Body,
                Is.EqualTo("<ns0:Envelope xmlns:ns0=\"urn:schemas.stateless.be:biztalk:envelope:2013:07\"><data>some-partitioned-value</data></ns0:Envelope>"));
        }
Exemplo n.º 6
0
        public void ControlReleaseOneEnvelopeAndAllPartitions()
        {
            BatchAdapter.AddPart(_envelopeSpecName, null, ActivityId.NewActivityId(), "<data>some-partitioned-value</data>");
            BatchAdapter.AddPart(_envelopeSpecName, "p-one", ActivityId.NewActivityId(), "<data>some-partitioned-value</data>");
            BatchAdapter.AddPart(_envelopeSpecName, "p-two", ActivityId.NewActivityId(), "<data>some-partitioned-value</data>");
            BatchAdapter.AddPart(_envelopeSpecName, "p-six", ActivityId.NewActivityId(), "<data>some-partitioned-value</data>");

            BatchAdapter.AddPart("e-one", null, ActivityId.NewActivityId(), "<data>some-partitioned-value</data>");
            BatchAdapter.AddPart("e-one", "p-one", ActivityId.NewActivityId(), "<data>some-partitioned-value</data>");
            BatchAdapter.AddPart("e-one", "p-two", ActivityId.NewActivityId(), "<data>some-partitioned-value</data>");
            BatchAdapter.AddPart("e-one", "p-six", ActivityId.NewActivityId(), "<data>some-partitioned-value</data>");

            BatchAdapter.CreateReleaseMessage(_envelopeSpecName, "*").DropToFolder(DropFolders.INPUT_FOLDER, "release_batch.xml");

            // batch controlled release process
            var process = TrackingRepository.SingleProcess(
                p => p.Name == Factory.Areas.Batch.Processes.Release &&
                p.BeginTime > StartTime &&
                p.Status == TrackingStatus.Completed &&
                p.Status == TrackingStatus.Completed &&
                _envelopeSpecName.StartsWith(p.Value1) &&
                p.Value3 == "*");

            process.SingleMessagingStep(
                s => s.Name == BizTalkFactoryApplication.ReceiveLocation <UnitTestInputMessageReceiveLocation>().Name &&
                s.MessageType == new SchemaMetadata <Schemas.Xml.Batch.Release>().MessageType &&
                s.Status == TrackingStatus.Received &&
                _envelopeSpecName.StartsWith(s.Value1) &&
                s.Value3 == "*");
            process.SingleMessagingStep(
                s => s.Name == BizTalkFactoryApplication.SendPort <BatchQueueControlledReleaseSendPort>().Name &&
                s.MessageType == new SchemaMetadata <Schemas.Xml.Batch.Release>().MessageType &&
                s.Status == TrackingStatus.Sent &&
                _envelopeSpecName.StartsWith(s.Value1) &&
                s.Value3 == "*");

            var queuedControlledReleases = BatchAdapter.QueuedControlledReleases.ToArray();

            Assert.That(
                queuedControlledReleases.Count(),
                Is.EqualTo(4));
            Assert.That(
                queuedControlledReleases.Select(qcr => qcr.EnvelopeId).Distinct().Single(),
                Is.EqualTo(BatchAdapter.Envelopes.Single(e => e.SpecName == _envelopeSpecName).Id));
            Assert.That(
                queuedControlledReleases.Select(qcr => qcr.Partition),
                Is.EquivalentTo(new[] { "0", "p-one", "p-two", "p-six" }));
        }
Exemplo n.º 7
0
        public void PollForAvailableBatchesWithItemCountSizeLimit()
        {
            // drop more items than twice the item count limit, which is 3, so as to release two batches
            for (var i = 0; i < 8; i++)
            {
                BatchAdapter.AddPart(_envelopeSpecName, "p-count-limit", ActivityId.NewActivityId(), string.Format("<data>count-limit-value-{0}</data>", i));
            }

            BatchReleasePort.Enable();

            // batch content handling processes
            var processesQuery = TrackingRepository.Processes.Where(
                p => p.Name == Default.Processes.Unidentified &&
                p.BeginTime > StartTime &&
                p.Status == TrackingStatus.Completed &&
                _envelopeSpecName.StartsWith(p.Value1) &&
                p.Value3 == "p-count-limit");

            // 2 processes have been tracked as more items than twice the item count limit have been accumulated
            Assert.That(() => processesQuery.Count(), Is.EqualTo(2).After(TimeSpan.FromSeconds(30), TimeSpan.FromSeconds(1)));
            var processes = processesQuery.ToArray();

            // ensure the 2 processes are issued from the same polling, thereby validating that all available batches are
            // released in one shot (i.e., in DEV, one within one second of the other, when polling every 5 seconds)
            Assert.That(processes[0].BeginTime, Is.EqualTo(processes[1].BeginTime).Within(TimeSpan.FromSeconds(1)));

            // each batch is made of 3 parts
            var envelopeMessage1 = processes[0].MessagingSteps.Single(
                s => s.Name == BizTalkFactoryApplication.SendPort <UnitTestBatchReleaseSendPort>().Name &&
                s.MessageType == new SchemaMetadata <Envelope>().MessageType &&
                s.Status == TrackingStatus.Sent &&
                _envelopeSpecName.StartsWith(s.Value1) &&
                s.Value3 == "p-count-limit");

            Assert.That(Regex.Matches(envelopeMessage1.Message.Body, @"<data>count-limit-value-\d</data>").Count, Is.EqualTo(3));
            var envelopeMessage2 = processes[1].MessagingSteps.Single(
                s => s.Name == BizTalkFactoryApplication.SendPort <UnitTestBatchReleaseSendPort>().Name &&
                s.MessageType == new SchemaMetadata <Envelope>().MessageType &&
                s.Status == TrackingStatus.Sent &&
                _envelopeSpecName.StartsWith(s.Value1) &&
                s.Value3 == "p-count-limit");

            Assert.That(Regex.Matches(envelopeMessage2.Message.Body, @"<data>count-limit-value-\d</data>").Count, Is.EqualTo(3));

            // 2 parts have been left in the database
            Assert.That(BatchAdapter.Parts.Count(), Is.EqualTo(2));
        }
Exemplo n.º 8
0
        public void Unenlist()
        {
            var application = BizTalkServerGroup.Applications[BizTalkFactorySettings.APPLICATION_NAME];
            var sendPort    = application.SendPorts[BizTalkFactoryApplication.SendPort <SinkFailedMessageSendPort>().Name];

            sendPort.Unenlist();
            application.ApplyChanges();
            Assert.That(sendPort.Status, Is.EqualTo(PortStatus.Bound));

            sendPort.Enlist();
            application.ApplyChanges();
            Assert.That(sendPort.Status, Is.EqualTo(PortStatus.Stopped));

            sendPort.Unenlist();
            application.ApplyChanges();
            Assert.That(sendPort.Status, Is.EqualTo(PortStatus.Bound));

            sendPort.Start();
            application.ApplyChanges();
            Assert.That(sendPort.Status, Is.EqualTo(PortStatus.Started));
        }
Exemplo n.º 9
0
        public void CheckedOutTokenHasAnyExtraXmlContentRestored()
        {
            const string tokenUrl         = "payload-data-file";
            const string correlationToken = "correlation-token-2";
            const string environmentTag   = "environment-tag-2";
            const string receiverName     = "receiver-name-2";
            const string senderName       = "sender-name-2";
            const string extraContent     = "<extra-content>"
                                            + "<node>value</node>"
                                            + "<record><field1>value1</field1><field2>value2</field2><field3>value3</field3></record>"
                                            + "</extra-content>"
                                            + "<optional-content><node>value</node></optional-content>";

            InsertToken(tokenUrl, correlationToken, environmentTag, "text-message-type-2", receiverName, senderName, extraContent);
            new StringStream("This payload has been claimed to disk.").DropToFolder(CheckOutFolder, tokenUrl);
            ReleaseTokenFromDatabase(tokenUrl);

            // Unidentified process because check-in phase has been skipped and no Claim.Check process name could have been inserted in context
            var process = TrackingRepository.SingleProcess(
                p => p.Name == Default.Processes.Unidentified &&
                p.Value1 == correlationToken &&
                p.Value2 == receiverName &&
                p.Value3 == senderName &&
                p.BeginTime > StartTime);
            var tokenMessagingStep = process.SingleMessagingStep(
                s => s.Name == BizTalkFactoryApplication.ReceiveLocation <ClaimReceiveLocation>().Name &&
                s.Value1 == correlationToken &&
                s.Value2 == receiverName &&
                s.Value3 == senderName &&
                s.Status == TrackingStatus.Received);

            process.SingleMessagingStep(
                s => s.Name == BizTalkFactoryApplication.SendPort <UnitTestClaimRedeemSendPort>().Name &&
                s.Value1 == correlationToken &&
                s.Value2 == receiverName &&
                s.Value3 == senderName &&
                s.Status == TrackingStatus.Sent);
            Assert.That(tokenMessagingStep.Message.Body, Does.EndWith("</clm:Url>" + extraContent + "</clm:CheckOut>"));
        }
Exemplo n.º 10
0
        public void ClaimBinaryMessage()
        {
            ResourceManager.Load("Data.Payload.bin").DropToFolder(DropFolders.INPUT_FOLDER, "Payload.bin.claim");

            var process = TrackingRepository.SingleProcess(
                p => p.Name == Factory.Areas.Claim.Processes.Check &&
                p.BeginTime > StartTime,
                TimeSpan.FromSeconds(60));

            process.SingleMessagingStep(
                s => s.Name == BizTalkFactoryApplication.ReceiveLocation <UnitTestClaimDeskAnyReceiveLocation>().Name &&
                s.Status == TrackingStatus.Received &&
                s.MessageSize == ResourceManager.Load("Data.Payload.bin", stream => stream.Length));
            process.SingleMessagingStep(
                s => s.Name == BizTalkFactoryApplication.SendPort <ClaimCheckInSendPort>().Name &&
                s.MessageType == new SchemaMetadata <Schemas.Xml.Claim.CheckIn>().MessageType &&
                s.Status == TrackingStatus.Sent);

            var token = FindTokens().Single();

            Assert.That(File.Exists(Path.Combine(CheckInFolder, token.Url.Replace("\\", string.Empty) + ".chk")));
        }
Exemplo n.º 11
0
        public void TrackBatchReleasedOnPolling()
        {
            BatchAdapter.CreatePartMessage(_envelopeSpecName, "partition-z").DropToFolder(DropFolders.INPUT_FOLDER, "part.xml.part");
            var process = TrackingRepository.SingleProcess(
                p => p.Name == Factory.Areas.Batch.Processes.Aggregate &&
                p.BeginTime > StartTime);
            var addPartMessage1 = process.SingleMessagingStep(
                s => s.Name == BizTalkFactoryApplication.SendPort <BatchAddPartSendPort>().Name &&
                s.MessageType == new SchemaMetadata <Any>().MessageType &&
                s.Status == TrackingStatus.Sent &&
                _envelopeSpecName.StartsWith(s.Value1) &&
                s.Value3 == "partition-z");

            BatchAdapter.CreatePartMessage(_envelopeSpecName, "partition-z").DropToFolder(DropFolders.INPUT_FOLDER, "part.xml.part");
            process = TrackingRepository.SingleProcess(
                p => p.Name == Factory.Areas.Batch.Processes.Aggregate
                // ReSharper disable once AccessToModifiedClosure
                && p.BeginTime > process.EndTime);
            var addPartMessage2 = process.SingleMessagingStep(
                s => s.Name == BizTalkFactoryApplication.SendPort <BatchAddPartSendPort>().Name &&
                s.MessageType == new SchemaMetadata <Any>().MessageType &&
                s.Status == TrackingStatus.Sent &&
                _envelopeSpecName.StartsWith(s.Value1) &&
                s.Value3 == "partition-z");

            BatchAdapter.CreatePartMessage(_envelopeSpecName, "partition-z").DropToFolder(DropFolders.INPUT_FOLDER, "part.xml.part");
            process = TrackingRepository.SingleProcess(
                p => p.Name == Factory.Areas.Batch.Processes.Aggregate
                // ReSharper disable once AccessToModifiedClosure
                && p.BeginTime > process.EndTime);
            var addPartMessage3 = process.SingleMessagingStep(
                s => s.Name == BizTalkFactoryApplication.SendPort <BatchAddPartSendPort>().Name &&
                s.MessageType == new SchemaMetadata <Any>().MessageType &&
                s.Status == TrackingStatus.Sent &&
                _envelopeSpecName.StartsWith(s.Value1) &&
                s.Value3 == "partition-z");

            BatchReleasePort.Enable();

            // batch controlled release process
            process = TrackingRepository.SingleProcess(
                p => p.Name == Factory.Areas.Batch.Processes.Release &&
                p.BeginTime > StartTime &&
                p.Status == TrackingStatus.Completed);
            // 1st part
            process.SingleMessagingStep(s => s.ActivityID == addPartMessage1.ActivityID);
            // 2nd part
            process.SingleMessagingStep(s => s.ActivityID == addPartMessage2.ActivityID);
            // 3rd part
            process.SingleMessagingStep(s => s.ActivityID == addPartMessage3.ActivityID);
            // batch content
            var releaseProcessBatchMessagingStep = process.SingleMessagingStep(
                s => s.Name == BizTalkFactoryApplication.ReceiveLocation <BatchReceiveLocation>().Name
                // TODO && s.MessageType == new SchemaMetadata<BatchContent>().MessageType
                && s.Status == TrackingStatus.Received);

            // batch content handling process
            process = TrackingRepository.SingleProcess(
                p => p.Name == Default.Processes.Unidentified &&
                p.BeginTime > StartTime &&
                p.Status == TrackingStatus.Completed &&
                _envelopeSpecName.StartsWith(p.Value1) &&
                p.Value3 == "partition-z");
            var handlingProcessBatchMessagingStep = process.SingleMessagingStep(
                s => s.Name == BizTalkFactoryApplication.ReceiveLocation <BatchReceiveLocation>().Name
                // TODO && s.MessageType == new SchemaMetadata<BatchContent>().MessageType
                && s.Status == TrackingStatus.Received);

            Assert.That(releaseProcessBatchMessagingStep.ActivityID, Is.EqualTo(handlingProcessBatchMessagingStep.ActivityID));

            // a part is linked to both its aggregate and release processes
            Assert.That(addPartMessage1.Processes.Count(), Is.EqualTo(2));
            Assert.That(addPartMessage1.Processes.SingleOrDefault(p => p.Name == Factory.Areas.Batch.Processes.Aggregate), Is.Not.Null);
            Assert.That(addPartMessage1.Processes.SingleOrDefault(p => p.Name == Factory.Areas.Batch.Processes.Release), Is.Not.Null);

            // a batch is linked to both its release and handling processes
            Assert.That(releaseProcessBatchMessagingStep.Processes.Count(), Is.EqualTo(2));
            Assert.That(releaseProcessBatchMessagingStep.Processes.SingleOrDefault(p => p.Name == Factory.Areas.Batch.Processes.Release), Is.Not.Null);
            Assert.That(releaseProcessBatchMessagingStep.Processes.SingleOrDefault(p => p.Name == Default.Processes.Unidentified), Is.Not.Null);
        }
Exemplo n.º 12
0
        public void ClaimXmlMessage()
        {
            new FakeClaimStream().DropToFolder(DropFolders.INPUT_FOLDER, "large_message.xml.claim");

            var process = TrackingRepository.SingleProcess(
                p => p.Name == Factory.Areas.Claim.Processes.Check &&
                p.BeginTime > StartTime &&
                p.Value1 == "embedded-correlation-token" &&
                p.Value2 == "embedded-receiver-name" &&
                p.Value3 == "embedded-sender-name",
                TimeSpan.FromSeconds(60));

            // message check-in phase
            var inboundMessagingStep = process.SingleMessagingStep(
                s => s.Name == BizTalkFactoryApplication.ReceiveLocation <UnitTestClaimDeskXmlReceiveLocation>().Name &&
                s.MessageType == new SchemaMetadata <Schemas.Xml.Claim.CheckIn>().MessageType &&
                s.Status == TrackingStatus.Received &&
                s.Value1 == "embedded-correlation-token" &&
                s.Value2 == "embedded-receiver-name" &&
                s.Value3 == "embedded-sender-name");
            var tokenMessagingStep = process.SingleMessagingStep(
                s => s.Name == BizTalkFactoryApplication.SendPort <ClaimCheckInSendPort>().Name &&
                s.MessageType == new SchemaMetadata <Schemas.Xml.Claim.CheckIn>().MessageType &&
                s.Status == TrackingStatus.Sent &&
                s.Value1 == "embedded-correlation-token" &&
                s.Value2 == "embedded-receiver-name" &&
                s.Value3 == "embedded-sender-name");

            // claim-specific context properties are captured
            Assert.That(tokenMessagingStep.Context.GetProperty(BizTalkFactoryProperties.CorrelationToken).Value, Is.EqualTo("embedded-correlation-token"));
            Assert.That(tokenMessagingStep.Context.GetProperty(BizTalkFactoryProperties.EnvironmentTag).Value, Is.EqualTo("embedded-environment-tag"));
            Assert.That(tokenMessagingStep.Context.GetProperty(BizTalkFactoryProperties.ReceiverName).Value, Is.EqualTo("embedded-receiver-name"));
            Assert.That(tokenMessagingStep.Context.GetProperty(BizTalkFactoryProperties.SenderName).Value, Is.EqualTo("embedded-sender-name"));

            // payload has been claimed into claim store
            var token = FindTokens().Single();

            Assert.That(token.MessageType, Is.EqualTo(new SchemaMetadata <Any>().MessageType));
            using (var reader = XmlReader.Create(tokenMessagingStep.Message.Stream))
            {
                var url = reader.AsMessageBodyCaptureDescriptor().Data;
                Assert.That(token.Url, Is.EqualTo(url));
            }
            Assert.That(File.Exists(token.FilePath));

            // move the claimed payload from the check-in folder to the check-out one as the ClaimStoreAgent would do
            ReleaseToken(token);

            // message check-out phase
            tokenMessagingStep = process.SingleMessagingStep(
                s => s.Name == BizTalkFactoryApplication.ReceiveLocation <ClaimReceiveLocation>().Name &&
                s.MessageType == new SchemaMetadata <Schemas.Xml.Claim.CheckOut>().MessageType &&
                s.Status == TrackingStatus.Received &&
                s.Value1 == "embedded-correlation-token" &&
                s.Value2 == "embedded-receiver-name" &&
                s.Value3 == "embedded-sender-name");
            var outboundMessagingStep = process.SingleMessagingStep(
                s => s.Name == BizTalkFactoryApplication.SendPort <UnitTestClaimRedeemSendPort>().Name &&
                s.MessageType == new SchemaMetadata <Schemas.Xml.Claim.CheckOut>().MessageType &&
                s.Status == TrackingStatus.Sent &&
                s.Value1 == "embedded-correlation-token" &&
                s.Value2 == "embedded-receiver-name" &&
                s.Value3 == "embedded-sender-name");

            // claim-specific context properties are restored and promoted
            Assert.That(
                tokenMessagingStep.Context.GetProperty(BizTalkFactoryProperties.ClaimedMessageType),
                Has.Property("Value").EqualTo(new SchemaMetadata <Any>().MessageType).And.Property("IsPromoted").True);
            Assert.That(
                tokenMessagingStep.Context.GetProperty(BizTalkFactoryProperties.CorrelationToken),
                Has.Property("Value").EqualTo("embedded-correlation-token").And.Property("IsPromoted").True);
            Assert.That(
                tokenMessagingStep.Context.GetProperty(BizTalkFactoryProperties.EnvironmentTag),
                Has.Property("Value").EqualTo("embedded-environment-tag").And.Property("IsPromoted").True);
            Assert.That(
                tokenMessagingStep.Context.GetProperty(BizTalkFactoryProperties.ReceiverName),
                Has.Property("Value").EqualTo("embedded-receiver-name").And.Property("IsPromoted").True);
            Assert.That(
                tokenMessagingStep.Context.GetProperty(BizTalkFactoryProperties.SenderName),
                Has.Property("Value").EqualTo("embedded-sender-name").And.Property("IsPromoted").True);

            // original inbound message payload has been restored
            Assert.That(inboundMessagingStep.Message.Body, Is.EqualTo(outboundMessagingStep.Message.Body));
        }