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)); }
public TestRepository( IDbContext context, ILog log, RelationService relRepo, TrackingRepository trackRepo) : base(context, log, relRepo, trackRepo) { }
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")); }
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)); }
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>")); }
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" })); }
/// <summary> /// register the services we'll be using in the application /// </summary> /// <param name="container">the container to register against</param> private static void InitializeContainer(Container container) { // Source. container.Register <Concord.Push.Service.Source.ISourceDataAccess, Concord.Push.Data.Source.TfsSourceDataAccess>(); container.Register <ISourceRepository>(() => { var repository = new SourceRepository(container.GetInstance <Concord.Push.Service.Source.ISourceDataAccess>()); return(repository); }); // Team. container.Register <Concord.Push.Service.Team.ITeamDataAccess, Concord.Push.Data.Team.TfsTeamDataAccess>(); container.Register <ITeamRepository>(() => { var repository = new TeamRepository(container.GetInstance <Concord.Push.Service.Team.ITeamDataAccess>()); return(repository); }); // Tracking. container.Register <Concord.Push.Service.Tracking.ITrackingDataAccess, Concord.Push.Data.Tracking.TfsTrackingDataAccess>(); container.Register <ITrackingRepository>(() => { var repository = new TrackingRepository(container.GetInstance <Concord.Push.Service.Tracking.ITrackingDataAccess>()); return(repository); }); // Build. container.Register <Concord.Push.Service.Build.IBuildDataAccess, Concord.Push.Data.Build.TfsBuildDataAccess>(); container.Register <IBuildRepository>(() => { var repository = new BuildRepository(container.GetInstance <Concord.Push.Service.Build.IBuildDataAccess>()); return(repository); }); container.Register <ILogger>(() => { var logger = new Concord.Logging.Loggers.EFLogger( new ApplicationDetails { ApplicationName = Config.ConfigSettings.ApplicationName, ApplicationVersion = Config.ConfigSettings.ApplicationVersion, Environment = Config.ConfigSettings.Environment }); return(logger); }); }
public void AllTokensAvailableForCheckOutAreReleased() { var tokenUrls = new[] { "payload-data-file-13", "payload-data-file-23", "payload-data-file-33" }; var correlationTokens = new[] { "correlation-token-13", "correlation-token-23", "correlation-token-33" }; tokenUrls.Each( (i, tu) => { InsertToken(tu, correlationTokens[i]); new StringStream("This payload has been claimed to disk.").DropToFolder(CheckOutFolder, tu); }); ReleaseTokensFromDatabase(tokenUrls); correlationTokens.Each( ct => { // 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 == ct && p.BeginTime > StartTime); process.SingleMessagingStep(s => s.Name == "BizTalk.Factory.RL1.Claim.CheckOut.WCF-SQL.XML" && s.Value1 == ct && s.Status == TrackingStatus.Received); process.SingleMessagingStep(s => s.Name == "BizTalk.Factory.SP1.UnitTest.Claim.Redeem.FILE.XML" && s.Value1 == ct && s.Status == TrackingStatus.Sent); }); }
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>")); }
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"))); }
private void CreateReository <T>() where T : class { if (typeof(IRouteRepository).Equals((typeof(T))) && !RepositoriesCustom.Keys.Contains(typeof(T))) { IRouteRepository repository = new RouteRepository(_dbContext); RepositoriesCustom.Add(typeof(T), repository); } else if (typeof(IClientRepository).Equals((typeof(T))) && !RepositoriesCustom.Keys.Contains(typeof(T))) { IClientRepository repository = new ClientRepository(_dbContext); RepositoriesCustom.Add(typeof(T), repository); } else if (typeof(IProductRepository).Equals((typeof(T))) && !RepositoriesCustom.Keys.Contains(typeof(T))) { IProductRepository repository = new ProductRepository(_dbContext); RepositoriesCustom.Add(typeof(T), repository); } else if (typeof(IDeliveryRepository).Equals((typeof(T))) && !RepositoriesCustom.Keys.Contains(typeof(T))) { IDeliveryRepository repository = new DeliveryRepository(_dbContext); RepositoriesCustom.Add(typeof(T), repository); } else if (typeof(ISaleRepository).Equals((typeof(T))) && !RepositoriesCustom.Keys.Contains(typeof(T))) { ISaleRepository repository = new SaleRepository(_dbContext); RepositoriesCustom.Add(typeof(T), repository); } else if (typeof(IBoxRepository).Equals((typeof(T))) && !RepositoriesCustom.Keys.Contains(typeof(T))) { IBoxRepository repository = new BoxRepository(_dbContext); RepositoriesCustom.Add(typeof(T), repository); } else if (typeof(ITrackingRepository).Equals((typeof(T))) && !RepositoriesCustom.Keys.Contains(typeof(T))) { ITrackingRepository repository = new TrackingRepository(_dbContext); RepositoriesCustom.Add(typeof(T), repository); } }
public async Task DeletedEntityIsMarkedAndNotRemoved() { using (var context = Helpers.GetContext("DeletedEntity")) { context.Add(new Salesperson() { Id = 1, Deleted = false }); await context.SaveChangesAsync(); var repo = new TrackingRepository <Salesperson>(context); await repo.Delete(1); await repo.SaveChanges(); } using (var context = Helpers.GetContext("DeletedEntity")) { var person = context.Find <Salesperson>(1); Assert.IsTrue(person.Deleted, "The person should be marked deleted"); } }
public void PollForAvailableBatchesToRelease() { // create three-item partitioned batches, so as to trigger an automatic release via polling receive-location BatchAdapter.AddPart(_envelopeSpecName, "one", ActivityId.NewActivityId(), "<data>some-one-partitioned-value</data>"); BatchAdapter.AddPart(_envelopeSpecName, "one", ActivityId.NewActivityId(), "<data>some-one-partitioned-value</data>"); BatchAdapter.AddPart(_envelopeSpecName, "one", ActivityId.NewActivityId(), "<data>some-one-partitioned-value</data>"); BatchAdapter.AddPart(_envelopeSpecName, "two", ActivityId.NewActivityId(), "<data>some-two-partitioned-value</data>"); BatchAdapter.AddPart(_envelopeSpecName, "two", ActivityId.NewActivityId(), "<data>some-two-partitioned-value</data>"); BatchAdapter.AddPart(_envelopeSpecName, "two", ActivityId.NewActivityId(), "<data>some-two-partitioned-value</data>"); BatchAdapter.AddPart(_envelopeSpecName, "six", ActivityId.NewActivityId(), "<data>some-six-partitioned-value</data>"); BatchAdapter.AddPart(_envelopeSpecName, "six", ActivityId.NewActivityId(), "<data>some-six-partitioned-value</data>"); BatchAdapter.AddPart(_envelopeSpecName, "six", ActivityId.NewActivityId(), "<data>some-six-partitioned-value</data>"); BatchReleasePort.Enable(); // batch content handling processes TrackingRepository.SingleProcess( p => p.Name == Default.Processes.Unidentified && p.BeginTime > StartTime && p.Status == TrackingStatus.Completed && _envelopeSpecName.StartsWith(p.Value1) && p.Value3 == "one"); TrackingRepository.SingleProcess( p => p.Name == Default.Processes.Unidentified && p.BeginTime > StartTime && p.Status == TrackingStatus.Completed && _envelopeSpecName.StartsWith(p.Value1) && p.Value3 == "two"); TrackingRepository.SingleProcess( p => p.Name == Default.Processes.Unidentified && p.BeginTime > StartTime && p.Status == TrackingStatus.Completed && _envelopeSpecName.StartsWith(p.Value1) && p.Value3 == "six"); }
public TrackingController() { trackingService = new TrackingRepository(); }
public BLTracking() { _repo = new TrackingRepository(); }
public TrackerController() { this.trackingRepository = new TrackingRepository(); }
private TrackingCollection() { this.activeStorage = new List <LocationDetails>(); this.passiveStorage = new List <LocationDetails>(); this.trackingRepository = new TrackingRepository(); }
public TrackingModel GetShipmentDetail(string FrayteNumber) { var Result = new TrackingRepository().ShipmentFilter(FrayteNumber); return(new TrackingRepository().GetShipmentDetail(Result.ModuleType, Result.TrackingType, FrayteNumber)); }
public UploadController() { tracerService = new TracerService(); TRepository = new TrackingRepository(); }
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)); }
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); }