public void ChannelGoesDownPermanentlyOnlyOneChanelLocal_Ok() { Distributor distributor = new Distributor(); distributor.InitiateDistributionMap(@"Data\distributormap2.xml", _componentResolver); Assert.IsNotNull(distributor.AvailableChannels); Assert.AreEqual(1, distributor.AvailableChannels.Count(c => c.Status == Status.OfflineTemporary && c.NoOfFailedAttempts == 1)); distributor.DistributeMessages(); Assert.AreEqual(1, distributor.AvailableChannels.Count(c => c.Status == Status.OfflineTemporary && c.NoOfFailedAttempts == 2)); distributor.DistributeMessages(); Assert.AreEqual(1, distributor.AvailableChannels.Count(c => c.Status == Status.OfflineTemporary && c.NoOfFailedAttempts == 3)); distributor.DistributeMessages(); Assert.AreEqual(1, distributor.AvailableChannels.Count(c => c.Status == Status.OfflinePermanent && c.NoOfFailedAttempts == 3)); }
public void DistributeMessages_OneChannel_Ok() { Distributor distributor = new Distributor(); distributor.InitiateDistributionMap(@"Data\distributormaplocal2local.xml", _componentResolver); ChangePublisher changePublisher = InitiateLocalPublisher(); changePublisher.PublishPackage(); MockAllTheSubscribers(distributor.AvailableChannels,changePublisher.PublishedPackageNotDistributed[0]); distributor.DistributeMessages(); Assert.AreEqual(0, changePublisher.PublishedPackageNotDistributed.Count); }
public void DsitributeMessages_OnepublisherThreeChannels_OneNotPresentOneFailing() { Distributor distributor = new Distributor(); distributor.InitiateDistributionMap(@"Data\distributormaplocal2localandremoteNP.xml", _componentResolver); ChangePublisher changePublisher = InitiateLocalPublisher(); distributor.DistributeMessages(); Assert.AreEqual(1, changePublisher.PublishedPackageNotDistributed.Count); Assert.AreEqual(2, changePublisher.PublishedPackageNotDistributed[0].ChangePushItems.Count); }
public void ListAllComponents_AndRegisterMessages_Ok() { Distributor distributor = new Distributor(); distributor.InitiateDistributionMap(@"Data\distributormap5.xml", _componentResolver); ChangePublisher changePublisher = (ChangePublisher)distributor.AvailableChannels .FirstOrDefault(c => c.PublisherInfo.Port==0).Publisher; var mockItemDiscoverer = MockTestHelper.MockItemDiscoverer("root folder"); changePublisher.Initialize("root folder",mockItemDiscoverer); changePublisher.QueueInsert(@"root folder\Item One"); changePublisher.QueueInsert(@"root folder\ItemTwo"); changePublisher.PublishPackage(); MockAllTheSubscribers(distributor.AvailableChannels, changePublisher.PublishedPackageNotDistributed[0]); distributor.DistributeMessages(); var compo = distributor.ListAvailableChannels(); Assert.IsNotNull(compo); Assert.AreEqual(1, compo.Channels.Count); Assert.IsNotNull(compo.Channels[0].SubscriberInfo); Assert.AreEqual(State.Done, compo.Channels[0].PublisherInfo.CurrentPackage.State); Assert.AreEqual(1, compo.Channels[0].PublisherInfo.CurrentPackage.PackageMessages.Count(m => m.AbsolutePath == @"root folder\Item One")); Assert.AreEqual(2, compo.Channels[0].PublisherInfo.CurrentPackage.PackageMessages.Count(m => m.OperationType==OperationType.Insert)); Assert.AreEqual(State.Done, compo.Channels[0].SubscriberInfo.CurrentPackage.State); }