Beispiel #1
0
 public void a_negative_checkpoint_handled_interval_throws_argument_out_of_range_exception()
 {
     Assert.Throws <ArgumentOutOfRangeException>(() => {
         IProjectionStateHandler projectionStateHandler = new FakeProjectionStateHandler();
         var version          = new ProjectionVersion(1, 0, 0);
         var projectionConfig = new ProjectionConfig(null, -1, 10, 1000, 250, true, true, false, false, false,
                                                     true, 10000, 1);
         new ContinuousProjectionProcessingStrategy(
             "projection",
             version,
             projectionStateHandler,
             projectionConfig,
             projectionStateHandler.GetSourceDefinition(),
             null,
             _subscriptionDispatcher).Create(
             Guid.NewGuid(),
             new FakePublisher(),
             Guid.NewGuid(),
             SystemAccount.Principal,
             new FakePublisher(),
             _ioDispatcher,
             _subscriptionDispatcher,
             new RealTimeProvider());
     });
 }
Beispiel #2
0
 a_checkpoint_threshold_less_tan_checkpoint_handled_threshold_throws_argument_out_of_range_exception()
 {
     Assert.Throws <ArgumentException>(() => {
         IProjectionStateHandler projectionStateHandler = new FakeProjectionStateHandler();
         var version          = new ProjectionVersion(1, 0, 0);
         var projectionConfig = new ProjectionConfig(null, 10, 5, 1000, 250, true, true, false, false,
                                                     true, 10000, 1);
         new ContinuousProjectionProcessingStrategy(
             "projection",
             version,
             projectionStateHandler,
             projectionConfig,
             projectionStateHandler.GetSourceDefinition(),
             null,
             _subscriptionDispatcher,
             true).Create(
             Guid.NewGuid(),
             new FakePublisher(),
             Guid.NewGuid(),
             SystemAccounts.System,
             new FakePublisher(),
             _ioDispatcher,
             _subscriptionDispatcher,
             new RealTimeProvider());
     });
 }
 public void a_null_name_throws_argument_null_excveption()
 {
     IProjectionStateHandler projectionStateHandler = new FakeProjectionStateHandler();
     var version = new ProjectionVersion(1, 0, 0);
     new ContinuousProjectionProcessingStrategy(
         null, version, projectionStateHandler, _defaultProjectionConfig,
         projectionStateHandler.GetSourceDefinition(), null, _subscriptionDispatcher).Create(
             Guid.NewGuid(), new FakePublisher(), SystemAccount.Principal, new FakePublisher(), _ioDispatcher,
             _subscriptionDispatcher, new RealTimeProvider());
 }
        public void a_null_io_dispatcher__throws_argument_null_exception()
        {
            IProjectionStateHandler projectionStateHandler = new FakeProjectionStateHandler();
            var version = new ProjectionVersion(1, 0, 0);

            new ContinuousProjectionProcessingStrategy(
                "projection", version, projectionStateHandler, _defaultProjectionConfig,
                projectionStateHandler.GetSourceDefinition(), null, _subscriptionDispatcher).Create(
                Guid.NewGuid(), new FakePublisher(), SystemAccount.Principal, new FakePublisher(), null,
                _subscriptionDispatcher, new RealTimeProvider());
        }
        public void a_null_run_as_does_not_throw_exception()
        {
            IProjectionStateHandler projectionStateHandler = new FakeProjectionStateHandler();
            var version = new ProjectionVersion(1, 0, 0);

            new ContinuousProjectionProcessingStrategy(
                "projection", version, projectionStateHandler, _defaultProjectionConfig,
                projectionStateHandler.GetSourceDefinition(), null, _subscriptionDispatcher).Create(
                Guid.NewGuid(), new FakePublisher(), null, new FakePublisher(), _ioDispatcher,
                _subscriptionDispatcher, new RealTimeProvider());
        }
 public void a_negative_checkpoint_handled_interval_throws_argument_out_of_range_exception()
 {
     IProjectionStateHandler projectionStateHandler = new FakeProjectionStateHandler();
     var version = new ProjectionVersion(1, 0, 0);
     var projectionConfig = new ProjectionConfig(null, -1, 10, 1000, 250, true, true, false, false, false);
     new ContinuousProjectionProcessingStrategy(
         "projection", version, projectionStateHandler, projectionConfig,
         projectionStateHandler.GetSourceDefinition(), null, _subscriptionDispatcher).Create(
             Guid.NewGuid(), new FakePublisher(), SystemAccount.Principal, new FakePublisher(), _ioDispatcher,
             _subscriptionDispatcher, new RealTimeProvider());
 }
        public void a_zero_checkpoint_handled_threshold_throws_argument_out_of_range_exception()
        {
            IProjectionStateHandler projectionStateHandler = new FakeProjectionStateHandler();
            var version          = new ProjectionVersion(1, 0, 0);
            var projectionConfig = new ProjectionConfig(null, 0, 10, 1000, 250, true, true, false, false, false);

            new ContinuousProjectionProcessingStrategy(
                "projection", version, projectionStateHandler, projectionConfig,
                projectionStateHandler.GetSourceDefinition(), null, _subscriptionDispatcher).Create(
                Guid.NewGuid(), new FakePublisher(), SystemAccount.Principal, new FakePublisher(), _ioDispatcher,
                _subscriptionDispatcher, new RealTimeProvider());
        }
Beispiel #8
0
        public void setup()
        {
            _bus = new InMemoryBus("bus");
            _listEventsHandler = new TestHandler <ClientMessage.ReadStreamEventsBackward>();
            _bus.Subscribe(_listEventsHandler);
            _ioDispatcher           = new IODispatcher(_bus, new PublishEnvelope(_bus));
            _subscriptionDispatcher =
                new ReaderSubscriptionDispatcher
                    (_bus);
            _bus.Subscribe(
                _subscriptionDispatcher.CreateSubscriber <EventReaderSubscriptionMessage.CommittedEventReceived>());
            _bus.Subscribe(
                _subscriptionDispatcher.CreateSubscriber <EventReaderSubscriptionMessage.CheckpointSuggested>());
            _bus.Subscribe(_subscriptionDispatcher.CreateSubscriber <EventReaderSubscriptionMessage.EofReached>());
            _bus.Subscribe(
                _subscriptionDispatcher.CreateSubscriber <EventReaderSubscriptionMessage.PartitionEofReached>());
            _bus.Subscribe(_subscriptionDispatcher
                           .CreateSubscriber <EventReaderSubscriptionMessage.PartitionMeasured>());
            _bus.Subscribe(_subscriptionDispatcher.CreateSubscriber <EventReaderSubscriptionMessage.PartitionDeleted>());
            _bus.Subscribe(_subscriptionDispatcher.CreateSubscriber <EventReaderSubscriptionMessage.ProgressChanged>());
            _bus.Subscribe(
                _subscriptionDispatcher.CreateSubscriber <EventReaderSubscriptionMessage.SubscriptionStarted>());
            _bus.Subscribe(_subscriptionDispatcher.CreateSubscriber <EventReaderSubscriptionMessage.NotAuthorized>());
            _bus.Subscribe(
                _subscriptionDispatcher.CreateSubscriber <EventReaderSubscriptionMessage.ReaderAssignedReader>());
            _bus.Subscribe(_ioDispatcher.BackwardReader);
            _bus.Subscribe(_ioDispatcher.ForwardReader);
            _bus.Subscribe(_ioDispatcher.Writer);
            _bus.Subscribe(_ioDispatcher);
            IProjectionStateHandler projectionStateHandler = new FakeProjectionStateHandler();

            _projectionConfig =
                new ProjectionConfig(null, 5, 10, 1000, 250, true, true, false, false, false, true, 10000, 1);
            var version = new ProjectionVersion(1, 0, 0);
            var projectionProcessingStrategy = new ContinuousProjectionProcessingStrategy(
                "projection", version, projectionStateHandler, _projectionConfig,
                projectionStateHandler.GetSourceDefinition(), null, _subscriptionDispatcher);

            _coreProjection = projectionProcessingStrategy.Create(
                Guid.NewGuid(),
                _bus,
                Guid.NewGuid(),
                SystemAccount.Principal,
                _bus,
                _ioDispatcher,
                _subscriptionDispatcher,
                new RealTimeProvider());
            _coreProjection.Start();
        }
 public void setup()
 {
     _bus = new InMemoryBus("bus");
     _listEventsHandler = new TestHandler<ClientMessage.ReadStreamEventsBackward>();
     _bus.Subscribe(_listEventsHandler);
     _ioDispatcher = new IODispatcher(_bus, new PublishEnvelope(_bus));
     _subscriptionDispatcher =
         new ReaderSubscriptionDispatcher
             (_bus);
     _bus.Subscribe(
         _subscriptionDispatcher.CreateSubscriber<EventReaderSubscriptionMessage.CommittedEventReceived>());
     _bus.Subscribe(
         _subscriptionDispatcher.CreateSubscriber<EventReaderSubscriptionMessage.CheckpointSuggested>());
     _bus.Subscribe(_subscriptionDispatcher.CreateSubscriber<EventReaderSubscriptionMessage.EofReached>());
     _bus.Subscribe(_subscriptionDispatcher.CreateSubscriber<EventReaderSubscriptionMessage.PartitionEofReached>());
     _bus.Subscribe(_subscriptionDispatcher.CreateSubscriber<EventReaderSubscriptionMessage.PartitionMeasured>());
     _bus.Subscribe(_subscriptionDispatcher.CreateSubscriber<EventReaderSubscriptionMessage.PartitionDeleted>());
     _bus.Subscribe(_subscriptionDispatcher.CreateSubscriber<EventReaderSubscriptionMessage.ProgressChanged>());
     _bus.Subscribe(_subscriptionDispatcher.CreateSubscriber<EventReaderSubscriptionMessage.SubscriptionStarted>());
     _bus.Subscribe(_subscriptionDispatcher.CreateSubscriber<EventReaderSubscriptionMessage.NotAuthorized>());
     _bus.Subscribe(_subscriptionDispatcher.CreateSubscriber<EventReaderSubscriptionMessage.ReaderAssignedReader>());
     _bus.Subscribe(_ioDispatcher.BackwardReader);
     _bus.Subscribe(_ioDispatcher.ForwardReader);
     _bus.Subscribe(_ioDispatcher.Writer);
     _bus.Subscribe(_ioDispatcher);
     IProjectionStateHandler projectionStateHandler = new FakeProjectionStateHandler();
     _projectionConfig = new ProjectionConfig(null, 5, 10, 1000, 250, true, true, false, false, false);
     var version = new ProjectionVersion(1, 0, 0);
     var projectionProcessingStrategy = new ContinuousProjectionProcessingStrategy(
         "projection", version, projectionStateHandler, _projectionConfig,
         projectionStateHandler.GetSourceDefinition(), null, _subscriptionDispatcher);
     _coreProjection = projectionProcessingStrategy.Create(
         Guid.NewGuid(),
         _bus,
         Guid.NewGuid(),
         SystemAccount.Principal,
         _bus,
         _ioDispatcher,
         _subscriptionDispatcher,
         new RealTimeProvider());
     _coreProjection.Start();
 }
Beispiel #10
0
 public void an_empty_name_throws_argument_exception()
 {
     Assert.Throws <ArgumentException>(() => {
         IProjectionStateHandler projectionStateHandler = new FakeProjectionStateHandler();
         var version = new ProjectionVersion(1, 0, 0);
         new ContinuousProjectionProcessingStrategy(
             "",
             version,
             projectionStateHandler,
             _defaultProjectionConfig,
             projectionStateHandler.GetSourceDefinition(),
             null,
             _subscriptionDispatcher).Create(
             Guid.NewGuid(),
             new FakePublisher(),
             Guid.NewGuid(),
             SystemAccount.Principal,
             new FakePublisher(),
             _ioDispatcher,
             _subscriptionDispatcher,
             new RealTimeProvider());
     });
 }
Beispiel #11
0
 public void a_null_time_provider__throws_argument_null_exception()
 {
     Assert.Throws <ArgumentNullException>(() => {
         IProjectionStateHandler projectionStateHandler = new FakeProjectionStateHandler();
         var version = new ProjectionVersion(1, 0, 0);
         new ContinuousProjectionProcessingStrategy(
             "projection",
             version,
             projectionStateHandler,
             _defaultProjectionConfig,
             projectionStateHandler.GetSourceDefinition(),
             null,
             _subscriptionDispatcher).Create(
             Guid.NewGuid(),
             new FakePublisher(),
             Guid.NewGuid(),
             SystemAccounts.System,
             new FakePublisher(),
             _ioDispatcher,
             _subscriptionDispatcher,
             null);
     });
 }
Beispiel #12
0
 protected ProjectionProcessingStrategy CreateProjectionProcessingStrategy()
 {
     return(new ContinuousProjectionProcessingStrategy(
                _projectionName, _version, _stateHandler, _projectionConfig, _stateHandler.GetSourceDefinition(), null,
                _subscriptionDispatcher));
 }
 public void a_null_run_as_does_not_throw_exception()
 {
     IProjectionStateHandler projectionStateHandler = new FakeProjectionStateHandler();
     var version = new ProjectionVersion(1, 0, 0);
     new ContinuousProjectionProcessingStrategy(
         "projection", version, projectionStateHandler, _defaultProjectionConfig,
         projectionStateHandler.GetSourceDefinition(), null, _subscriptionDispatcher).Create(
             Guid.NewGuid(), new FakePublisher(), null, new FakePublisher(), _ioDispatcher,
             _subscriptionDispatcher, new RealTimeProvider());
 }