internal static RoundBasedRegisterTestSetup CreateRoundBasedRegister(IEnumerable <string> synod, string localNodeUri) { var appConfig = new RendezvousServiceConfiguration { Synod = new SynodConfiguration { Members = synod, LocalNode = localNodeUri, HeartBeatInterval = TimeSpan.FromSeconds(5), IntercomEndpoint = $"inproc://{Guid.NewGuid()}", MissingHeartBeatsBeforeReconnect = 4 }, Lease = new LeaseConfiguration { ClockDrift = TimeSpan.FromMilliseconds(10), MessageRoundtrip = TimeSpan.FromMilliseconds(100), NodeResponseTimeout = TimeSpan.FromMilliseconds(1000), MaxLeaseTimeSpan = TimeSpan.FromSeconds(3) } }; var socketConfig = new SocketConfiguration { ReceivingHighWatermark = 1000, SendingHighWatermark = 1000, Linger = TimeSpan.Zero }; var logger = new Mock <ILogger>(); var performanceCounterManager = new Mock <IPerformanceCounterManager <KinoPerformanceCounters> >(); var synodConfigProvider = new SynodConfigurationProvider(appConfig.Synod); var intercomMessageHub = new IntercomMessageHub(new SocketFactory(socketConfig), synodConfigProvider, performanceCounterManager.Object, logger.Object); var ballotGenerator = new BallotGenerator(appConfig.Lease); var roundBasedRegister = new RoundBasedRegister(intercomMessageHub, ballotGenerator, synodConfigProvider, appConfig.Lease, logger.Object); logger.Verify(m => m.Error(It.IsAny <object>()), Times.Never); return(new RoundBasedRegisterTestSetup(ballotGenerator, synodConfigProvider.LocalNode, roundBasedRegister)); }
internal static RoundBasedRegisterTestSetup CreateRoundBasedRegister(IEnumerable <string> synod, string localNodeUri) { var appConfig = new RendezvousServiceConfiguration { Synod = new SynodConfiguration { Members = synod, LocalNode = localNodeUri }, Lease = new LeaseConfiguration { ClockDrift = TimeSpan.FromMilliseconds(10), MessageRoundtrip = TimeSpan.FromMilliseconds(100), NodeResponseTimeout = TimeSpan.FromMilliseconds(1000), MaxLeaseTimeSpan = TimeSpan.FromSeconds(3) } }; var socketConfig = new SocketConfiguration { ReceivingHighWatermark = 1000, SendingHighWatermark = 1000, Linger = TimeSpan.Zero }; var synodConfig = new global::kino.Consensus.Configuration.SynodConfiguration(new SynodConfigurationProvider(appConfig.Synod)); var logger = new Mock <ILogger>(); var performanceCounterManager = new Mock <IPerformanceCounterManager <KinoPerformanceCounters> >(); var intercomMessageHub = new IntercomMessageHub(new SocketFactory(socketConfig), synodConfig, performanceCounterManager.Object, logger.Object); var ballotGenerator = new BallotGenerator(appConfig.Lease); var roundBasedRegister = new RoundBasedRegister(intercomMessageHub, ballotGenerator, synodConfig, appConfig.Lease, logger.Object); return(new RoundBasedRegisterTestSetup(ballotGenerator, synodConfig.LocalNode, roundBasedRegister, appConfig.Lease.MaxLeaseTimeSpan)); }