public void setup()
        {
            _publisher = new FakePublisher();
            _manager = new ProjectionManager(_publisher, checkpointForStatistics: null);

            _manager.Handle(new ProjectionManagementMessage.Post(new PublishEnvelope(_publisher), @"log(1);", enabled: true));
        }
 public void setup()
 {
     _publisher = new FakePublisher();
     _readyHandler = new TestMessageHandler<ProjectionMessage.Projections.ReadyForCheckpoint>();
     _stream = new EmittedStream("test", _publisher, _readyHandler, false, 50);
     _stream.Start();
 }
 public void setup()
 {
     _publisher = new FakePublisher();
     _readyHandler = new TestCheckpointManagerMessageHandler();;
     _stream = new EmittedStream("test", CheckpointTag.FromPosition(0, -1), _publisher, _readyHandler, 50);
     _stream.Start();
 }
 public void TearDown()
 {
     _bus = null;
     _manager = null;
     _correlationID = Guid.Empty;
     _prepareAck = null;
     _commitAck = null;
 }
        public void Setup()
        {
            var fakePublisher = new FakePublisher();
            _ioDispatcher = new IODispatcher(fakePublisher, new PublishEnvelope(fakePublisher));

            _subscriptionDispatcher =
                new ReaderSubscriptionDispatcher(new FakePublisher());
        }
 public void setup()
 {
     _publisher = new FakePublisher();
     _readyHandler = new TestMessageHandler<ProjectionMessage.Projections.ReadyForCheckpoint>();
     _stream = new EmittedStream("test", _publisher, _readyHandler, false, 50);
     _stream.EmitEvents(
         new[] {new EmittedEvent("stream", Guid.NewGuid(), "type", "data")}, CheckpointTag.FromPosition(200, 150));
 }
        public void setup()
        {
            _publisher = new FakePublisher();
            _manager = new ProjectionManager(_publisher, checkpointForStatistics: null);

            _projectionQuery = @"fromAll(); on_any(function(){});log(1);";
            _manager.Handle(new ProjectionManagementMessage.Post(new PublishEnvelope(_publisher), _projectionQuery, enabled: true));
            _projectionName = _publisher.Messages.OfType<ProjectionManagementMessage.Updated>().Single().Name;
        }
 public void setup()
 {
     _publisher = new FakePublisher();
     _readyHandler = new TestMessageHandler<ProjectionMessage.Projections.ReadyForCheckpoint>();
     _stream = new EmittedStream("test", _publisher, _readyHandler, false, 50);
     _stream.Start();
     _stream.EmitEvents(
         new[] {new EmittedEvent("stream", Guid.NewGuid(), "type", "data")}, CheckpointTag.FromPosition(-1, -1));
     var msg = _publisher.Messages.OfType<ClientMessage.WriteEvents>().First();
     _stream.Handle(new ClientMessage.WriteEventsCompleted(msg.CorrelationId, msg.EventStreamId, 0));
     _stream.Checkpoint();
 }
 public void setup()
 {
     _fakePublisher = new FakePublisher();
     _readDispatcher =
         new RequestResponseDispatcher
             <ClientMessage.ReadStreamEventsBackward, ClientMessage.ReadStreamEventsBackwardCompleted>(
             _fakePublisher, v => v.CorrelationId, v => v.CorrelationId, new PublishEnvelope(_fakePublisher));
     _writeDispatcher =
         new RequestResponseDispatcher<ClientMessage.WriteEvents, ClientMessage.WriteEventsCompleted>(
             _fakePublisher, v => v.CorrelationId, v => v.CorrelationId, new PublishEnvelope(_fakePublisher));
     ;
 }
Пример #10
0
 public void SetUp()
 {
     _bus = new FakePublisher();
     _manager = new TwoPhaseCommitRequestManager(_bus, 2, 2);
     _correlationID = Guid.NewGuid();
     _manager.Handle(new ReplicationMessage.WriteRequestCreated(_correlationID,
                                                                new NoopEnvelope(),
                                                                "test-stream",
                                                                -1,
                                                                new Event[0]));
     _prepareAck = new ReplicationMessage.PrepareAck(_correlationID, 0, PrepareFlags.TransactionBegin | PrepareFlags.TransactionEnd);
     _commitAck = new ReplicationMessage.CommitAck(_correlationID, 0, 0);
 }
 public void Setup()
 {
     Publisher = new FakePublisher();
     Envelope = new FakeEnvelope();
     Manager = OnManager(Publisher);
     foreach(var m in WithInitialMessages())
     {
         Manager.AsDynamic().Handle(m);
     }
     Publisher.Messages.Clear();
     Manager.AsDynamic().Handle(When());
     Produced = new List<Message>(Publisher.Messages);
 }
 public void setup()
 {
     _publisher = new FakePublisher();
     _readyHandler = new TestMessageHandler<ProjectionMessage.Projections.ReadyForCheckpoint>();
     _stream = new EmittedStream("test", _publisher, _readyHandler, false, 50);
     try
     {
         _stream.Checkpoint();
     }
     catch (Exception ex)
     {
         _caughtException = ex;
     }
 }
 public void setup()
 {
     _timeProvider = new FakeTimeProvider();
     _queues = new Dictionary<Guid, IPublisher> {{Guid.NewGuid(), new FakePublisher()}};
     _timeoutSchedulers = ProjectionCoreWorkersNode.CreateTimeoutSchedulers(_queues.Count);
     var fakePublisher = new FakePublisher();
     new ProjectionCoreCoordinator(
         ProjectionType.All, 
         _timeoutSchedulers,
         _queues.Values.ToArray(),
         fakePublisher,
         new NoopEnvelope());
     _ioDispatcher = new IODispatcher(fakePublisher, new PublishEnvelope(fakePublisher));
 }
 public void setup()
 {
     _publisher = new FakePublisher();
     _readyHandler = new TestCheckpointManagerMessageHandler();;
     _stream = new EmittedStream("test", CheckpointTag.FromPosition(0, -1), _publisher, _readyHandler, 50);
     try
     {
         _stream.Checkpoint();
     }
     catch (Exception ex)
     {
         _caughtException = ex;
     }
 }
        public void setup()
        {
            _checkpointUnhandledBytesThreshold = 1000;
            Given();
            _bus = new FakePublisher();
            _projectionCorrelationId = Guid.NewGuid();
            _eventHandler = new TestMessageHandler<ProjectionMessage.Projections.CommittedEventReceived>();
            _checkpointHandler = new TestMessageHandler<ProjectionMessage.Projections.CheckpointSuggested>();
            _subscription = new ProjectionSubscription(
                _projectionCorrelationId, CheckpointTag.FromPosition(0, -1), _eventHandler, _checkpointHandler,
                CreateCheckpointStrategy(), _checkpointUnhandledBytesThreshold);

            When();
        }
        public void setup()
        {
            _checkpointUnhandledBytesThreshold = 1000;
            Given();
            _bus = new FakePublisher();
            _projectionCorrelationId = Guid.NewGuid();
            _eventHandler = new TestHandler<ProjectionSubscriptionMessage.CommittedEventReceived>();
            _checkpointHandler = new TestHandler<ProjectionSubscriptionMessage.CheckpointSuggested>();
            _progressHandler = new TestHandler<ProjectionSubscriptionMessage.ProgressChanged>();
            _eofHandler = new TestHandler<ProjectionSubscriptionMessage.EofReached>();
            _checkpointStrategy = CreateCheckpointStrategy();
            _subscription = CreateProjectionSubscription();


            When();
        }
        public void SetUp()
        {
            _bus = new FakePublisher();
            _manager = new TwoPhaseCommitRequestManager(_bus, 2, 2);

            _correlationID = Guid.NewGuid();

            _manager.Handle(new ReplicationMessage.WriteRequestCreated(
                                _correlationID,
                                new NoopEnvelope(),
                                "test-stream",
                                -1,
                                new[]
                                {
                                    new Event(Guid.NewGuid(), "test-event-type", false,  null, null),
                                    new Event(Guid.NewGuid(), "test-event-type", false,  null, null),
                                    new Event(Guid.NewGuid(), "test-event-type", false,  null, null)
                                }));
        }
 public void setup()
 {
     _fakePublisher = new FakePublisher();
     _ioDispatcher = new IODispatcher(_fakePublisher, new PublishEnvelope(_fakePublisher));
 }
 protected override TwoPhaseRequestManagerBase OnManager(FakePublisher publisher)
 {
     return new DeleteStreamTwoPhaseRequestManager(publisher, 3, 3, PrepareTimeout, CommitTimeout);
 }
 protected override TwoPhaseRequestManagerBase OnManager(FakePublisher publisher)
 {
     return new WriteStreamTwoPhaseRequestManager(publisher, 3, 3);
 }
 protected override TwoPhaseRequestManagerBase OnManager(FakePublisher publisher)
 {
     return new TransactionCommitTwoPhaseRequestManager(publisher, 3, 3);
 }
 protected override TwoPhaseRequestManagerBase OnManager(FakePublisher publisher)
 {
     return new TransactionCommitTwoPhaseRequestManager(publisher, 3, 3, PrepareTimeout, CommitTimeout, false);
 }
 protected override Dictionary<Guid, IPublisher> GivenCoreQueues()
 {
     _coreQueue1 = new FakePublisher();
     _coreQueue2 = new FakePublisher();
     return new Dictionary<Guid, IPublisher> {{Guid.NewGuid(), _coreQueue1}, {Guid.NewGuid(), _coreQueue2}};
 }
 public void setup()
 {
     _readyHandler = new TestCheckpointManagerMessageHandler();
     _fakePublisher = new FakePublisher();
     _ioDispatcher = new IODispatcher(_fakePublisher, new PublishEnvelope(_fakePublisher));
 }
 protected abstract TwoPhaseRequestManagerBase OnManager(FakePublisher publisher);
 public void TearDown()
 {
     _bus = null;
     _manager = null;
     _correlationID = Guid.Empty;
 }
 protected override IPublisher[] GivenCoreQueues()
 {
     _coreQueue1 = new FakePublisher();
     _coreQueue2 = new FakePublisher();
     return new[] { _coreQueue1, _coreQueue2 };
 }