Пример #1
0
        public RandomizedElectionsAndGossipTestCase(int maxIterCnt,
                                                    int instancesCnt,
                                                    double httpLossProbability,
                                                    double httpDupProbability,
                                                    int httpMaxDelay,
                                                    int timerMinDelay,
                                                    int timerMaxDelay,
                                                    CreateInitialGossip createInitialGossip,
                                                    CreateUpdatedGossip createUpdatedGossip,
                                                    int?rndSeed = null)
            : base(maxIterCnt,
                   instancesCnt,
                   httpLossProbability,
                   httpDupProbability,
                   httpMaxDelay,
                   timerMinDelay,
                   timerMaxDelay,
                   rndSeed)
        {
            _createInitialGossip = createInitialGossip;
            _createUpdatedGossip = createUpdatedGossip;

            _sendOverHttpBlockingProcessor = new SendOverHttpBlockingProcessor(Rnd,
                                                                               Runner,
                                                                               HttpLossProbability,
                                                                               HttpDupProbability,
                                                                               HttpMaxDelay);

            _updateGossipProcessor = new UpdateGossipProcessor(new ElectionsInstance[0],
                                                               _sendOverHttpBlockingProcessor,
                                                               _createUpdatedGossip,
                                                               Enqueue
                                                               );
        }
        public RandomizedElectionsAndGossipTestCase(int maxIterCnt,
                                                    int instancesCnt,
                                                    double httpLossProbability,
                                                    double httpDupProbability,
                                                    int httpMaxDelay,
                                                    int timerMinDelay,
                                                    int timerMaxDelay,
                                                    CreateInitialGossip createInitialGossip,
                                                    CreateUpdatedGossip createUpdatedGossip,
                                                    int? rndSeed = null)
            : base(maxIterCnt,
                   instancesCnt,
                   httpLossProbability,
                   httpDupProbability,
                   httpMaxDelay,
                   timerMinDelay,
                   timerMaxDelay,
                   rndSeed)
        {
            _createInitialGossip = createInitialGossip;
            _createUpdatedGossip = createUpdatedGossip;

            _sendOverHttpBlockingProcessor = new SendOverHttpBlockingProcessor(Rnd,
                                                                               Runner,
                                                                               HttpLossProbability,
                                                                               HttpDupProbability,
                                                                               HttpMaxDelay);

            _updateGossipProcessor = new UpdateGossipProcessor(new ElectionsInstance[0],
                                                               _sendOverHttpBlockingProcessor,
                                                               _createUpdatedGossip,
                                                               Enqueue
                                                               );
        }
Пример #3
0
        public UpdateGossipProcessor(IEnumerable <ElectionsInstance> allInstances,
                                     SendOverHttpBlockingProcessor sendOverHttpProcessor,
                                     RandomizedElectionsAndGossipTestCase.CreateUpdatedGossip createUpdatedGossip,
                                     Action <RandTestQueueItem, Message> enqueue)
        {
            _sendOverHttpProcessor = sendOverHttpProcessor;
            _createUpdatedGossip   = createUpdatedGossip;
            _enqueue   = enqueue;
            _instances = allInstances.ToArray();

            _processedItems = new List <RandTestQueueItem>();
            ProcessedItems  = _processedItems;
        }
        public UpdateGossipProcessor(IEnumerable<ElectionsInstance> allInstances,
                                     SendOverHttpBlockingProcessor sendOverHttpProcessor,
                                     RandomizedElectionsAndGossipTestCase.CreateUpdatedGossip createUpdatedGossip,
                                     Action<RandTestQueueItem, Message> enqueue)
        {
            _sendOverHttpProcessor = sendOverHttpProcessor;
            _createUpdatedGossip = createUpdatedGossip;
            _enqueue = enqueue;
            _instances = allInstances.ToArray();

            _processedItems = new List<RandTestQueueItem>();
            ProcessedItems = _processedItems;
        }