Exemplo n.º 1
0
 public void Setup()
 {
     _manager.Handle(
         new ProjectionManagementMessage.Post(
             new PublishEnvelope(_bus), ProjectionMode.Persistent, _projectionName, "JS", @"log(1);", enabled: true));
     OneWriteCompletes();
 }
Exemplo n.º 2
0
 public void projection_status_can_be_retrieved()
 {
     _manager.Handle(
         new ProjectionManagementMessage.Command.GetStatistics(new PublishEnvelope(_bus), null, "projection1", true));
     Assert.IsNotNull(
         _consumer.HandledMessages.OfType <ProjectionManagementMessage.Statistics>().SingleOrDefault(
             v => v.Projections[0].Name == "projection1"));
 }
Exemplo n.º 3
0
 public void projection_status_is_preparing()
 {
     _manager.Handle(
         new ProjectionManagementMessage.Command.GetStatistics(new PublishEnvelope(_bus), null, "projection1", true));
     Assert.AreEqual(
         ManagedProjectionState.Preparing,
         _consumer.HandledMessages.OfType <ProjectionManagementMessage.Statistics>().SingleOrDefault(
             v => v.Projections[0].Name == "projection1").Projections[0].MasterStatus);
 }
Exemplo n.º 4
0
        public void the_projection_source_can_be_retrieved()
        {
            _manager.Handle(new ProjectionManagementMessage.GetQuery(new PublishEnvelope(_bus), _projectionName));
            Assert.AreEqual(1, _consumer.HandledMessages.OfType <ProjectionManagementMessage.ProjectionQuery>().Count());
            var projectionQuery =
                _consumer.HandledMessages.OfType <ProjectionManagementMessage.ProjectionQuery>().Single();

            Assert.AreEqual(_projectionName, projectionQuery.Name);
            Assert.AreEqual(_newProjectionSource, projectionQuery.Query);
        }
Exemplo n.º 5
0
        public void it_cab_be_listed()
        {
            _manager.Handle(
                new ProjectionManagementMessage.GetStatistics(new PublishEnvelope(_publisher), null, null, false));

            Assert.AreEqual(
                1,
                _publisher.Messages.OfType <ProjectionManagementMessage.Statistics>().Count(
                    v => v.Projections.Any(p => p.Name == _projectionName)));
        }
 public void setup()
 {
     _timeProvider = new FakeTimeProvider();
     var queues = new Dictionary<Guid, IPublisher> { { _workerId, _bus } };
     _manager = new ProjectionManager(
         _bus,
         _bus,
         queues,
         _timeProvider,
         ProjectionType.All);
     _bus.Subscribe<ClientMessage.WriteEventsCompleted>(_manager);
     _bus.Subscribe<ClientMessage.ReadStreamEventsBackwardCompleted>(_manager);
     _manager.Handle(new SystemMessage.BecomeMaster(Guid.NewGuid()));
     _manager.Handle(new ProjectionManagementMessage.ReaderReady());
 }
Exemplo n.º 7
0
 public void setup()
 {
     _manager = new ProjectionManager(_bus, checkpointForStatistics: null);
     _bus.Subscribe <ClientMessage.WriteEventsCompleted>(_manager);
     _bus.Subscribe <ProjectionMessage.Projections.Stopped>(_manager);
     _projectionName = "test-projection";
     _manager.Handle(
         new ProjectionManagementMessage.Post(
             new PublishEnvelope(_bus), ProjectionMode.Persistent, _projectionName, "JS",
             @"fromAll(); on_any(function(){});log(1);", enabled: true));
     // when
     _newProjectionSource = @"fromAll(); on_any(function(){});log(2);";
     _manager.Handle(
         new ProjectionManagementMessage.UpdateQuery(
             new PublishEnvelope(_bus), _projectionName, "JS", _newProjectionSource));
 }
 public void setup()
 {
     _manager = new ProjectionManager(_bus, _bus, new IPublisher[]{_bus});
     _bus.Subscribe<ClientMessage.WriteEventsCompleted>(_manager);
     _bus.Subscribe<ClientMessage.ReadStreamEventsBackwardCompleted>(_manager);
     _manager.Handle(new SystemMessage.BecomeWorking());
 }
 public void setup()
 {
     _manager = new ProjectionManager(_bus, _bus, new IPublisher[] { _bus });
     _bus.Subscribe <ClientMessage.WriteEventsCompleted>(_manager);
     _bus.Subscribe <ClientMessage.ReadStreamEventsBackwardCompleted>(_manager);
     _manager.Handle(new SystemMessage.BecomeWorking());
 }
        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()
 {
     _manager = new ProjectionManager(_bus, checkpointForStatistics: null);
     _bus.Subscribe<ClientMessage.WriteEventsCompleted>(_manager);
     _bus.Subscribe<ProjectionMessage.Projections.Stopped>(_manager);
     _projectionName = "test-projection";
     _manager.Handle(
         new ProjectionManagementMessage.Post(
             new PublishEnvelope(_bus), ProjectionMode.Persistent, _projectionName, "JS",
             @"fromAll(); on_any(function(){});log(1);", enabled: true));
     // when
     _newProjectionSource = @"fromAll(); on_any(function(){});log(2);";
     _manager.Handle(
         new ProjectionManagementMessage.UpdateQuery(
             new PublishEnvelope(_bus), _projectionName, "JS", _newProjectionSource));
 }
Exemplo n.º 12
0
 public void setup()
 {
     _manager = new ProjectionManager(_bus, _bus, new IPublisher[] { _bus }, checkpointForStatistics: null);
     _bus.Subscribe <ClientMessage.WriteEventsCompleted>(_manager);
     _bus.Subscribe <ClientMessage.ReadStreamEventsBackwardCompleted>(_manager);
     _manager.Handle(new SystemMessage.SystemStart());
 }
 public void setup()
 {
     _manager = new ProjectionManager(_bus, _bus, new IPublisher[]{_bus}, checkpointForStatistics: null);
     _bus.Subscribe<ClientMessage.WriteEventsCompleted>(_manager);
     _bus.Subscribe<ClientMessage.ReadStreamEventsBackwardCompleted>(_manager);
     _manager.Handle(new SystemMessage.SystemStart());
 }
 public void setup()
 {
     _timeProvider = new FakeTimeProvider();
     _manager = new ProjectionManager(_bus, _bus, new IPublisher[] { _bus }, _timeProvider, RunProjections.All);
     _bus.Subscribe<ClientMessage.WriteEventsCompleted>(_manager);
     _bus.Subscribe<ClientMessage.ReadStreamEventsBackwardCompleted>(_manager);
     _manager.Handle(new SystemMessage.BecomeMaster(Guid.NewGuid()));
 }
 public void setup()
 {
     _timeProvider = new FakeTimeProvider();
     _manager      = new ProjectionManager(_bus, _bus, new IPublisher[] { _bus }, _timeProvider, RunProjections.All);
     _bus.Subscribe <ClientMessage.WriteEventsCompleted>(_manager);
     _bus.Subscribe <ClientMessage.ReadStreamEventsBackwardCompleted>(_manager);
     _manager.Handle(new SystemMessage.BecomeMaster(Guid.NewGuid()));
 }
        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()
        {
            _timeProvider = new FakeTimeProvider();
            var queues = new Dictionary <Guid, IPublisher> {
                { _workerId, _bus }
            };

            _manager = new ProjectionManager(
                _bus,
                _bus,
                queues,
                _timeProvider,
                ProjectionType.All);
            _bus.Subscribe <ClientMessage.WriteEventsCompleted>(_manager);
            _bus.Subscribe <ClientMessage.ReadStreamEventsBackwardCompleted>(_manager);
            _manager.Handle(new SystemMessage.BecomeMaster(Guid.NewGuid()));
            _manager.Handle(new ProjectionManagementMessage.ReaderReady());
        }
Exemplo n.º 18
0
 public void projection_status_is_running()
 {
     _manager.Handle(
         new ProjectionManagementMessage.GetStatistics(new PublishEnvelope(_bus), null, _projectionName, true));
     Assert.AreEqual(
         ManagedProjectionState.Running,
         _consumer.HandledMessages.OfType <ProjectionManagementMessage.Statistics>().Single().Projections[0].
         MasterStatus);
 }
Exemplo n.º 19
0
        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;
        }
Exemplo n.º 20
0
 public void setup()
 {
     _manager = new ProjectionManager(_bus, _bus, new IPublisher[] { _bus }, checkpointForStatistics: null);
     _bus.Subscribe <ClientMessage.WriteEventsCompleted>(_manager);
     _projectionName = "test-projection";
     _manager.Handle(
         new ProjectionManagementMessage.Post(
             new PublishEnvelope(_bus), ProjectionMode.Persistent, _projectionName, "JS",
             @"fromAll(); on_any(function(){});log(1);", enabled: true));
 }
        public void setup()
        {
            _bus = new InMemoryBus("bus");
            _consumer = new WatchingConsumer();
            _bus.Subscribe(_consumer);

            _manager = new ProjectionManager(_bus, checkpointForStatistics: null);
            _bus.Subscribe<ProjectionMessage.Projections.Stopped>(_manager);
            _projectionName = "test-projection";
            _manager.Handle(
                new ProjectionManagementMessage.Post(
                    new PublishEnvelope(_bus), ProjectionMode.AdHoc, _projectionName, "JS",
                    @"fromAll(); on_any(function(){});log(1);", enabled: true));
            // when
            _newProjectionSource = @"fromAll(); on_any(function(){});log(2);";
            _manager.Handle(
                new ProjectionManagementMessage.UpdateQuery(
                    new PublishEnvelope(_bus), _projectionName, "JS", _newProjectionSource));
        }
        public void setup()
        {
            _bus      = new InMemoryBus("bus");
            _consumer = new WatchingConsumer();
            _bus.Subscribe(_consumer);

            _manager = new ProjectionManager(_bus, checkpointForStatistics: null);
            _bus.Subscribe <ProjectionMessage.Projections.Stopped>(_manager);
            _projectionName = "test-projection";
            _manager.Handle(
                new ProjectionManagementMessage.Post(
                    new PublishEnvelope(_bus), ProjectionMode.AdHoc, _projectionName, "JS",
                    @"fromAll(); on_any(function(){});log(1);", enabled: true));
            // when
            _newProjectionSource = @"fromAll(); on_any(function(){});log(2);";
            _manager.Handle(
                new ProjectionManagementMessage.UpdateQuery(
                    new PublishEnvelope(_bus), _projectionName, "JS", _newProjectionSource));
        }
Exemplo n.º 23
0
        public void setup()
        {
            _timeProvider = new FakeTimeProvider();
            var queues = new Dictionary <Guid, IPublisher> {
                { _workerId, _bus }
            };

            _manager = new ProjectionManager(
                _bus,
                _bus,
                queues,
                _timeProvider,
                ProjectionType.All,
                _ioDispatcher,
                TimeSpan.FromMinutes(Opts.ProjectionsQueryExpiryDefault));
            _bus.Subscribe <ClientMessage.WriteEventsCompleted>(_manager);
            _bus.Subscribe <ClientMessage.ReadStreamEventsBackwardCompleted>(_manager);
            _bus.Subscribe <ClientMessage.ReadStreamEventsForwardCompleted>(_manager);
            _manager.Handle(new SystemMessage.BecomeMaster(Guid.NewGuid()));
            _manager.Handle(new ProjectionManagementMessage.ReaderReady());
        }
 public void setup()
 {
     _manager = new ProjectionManager(_bus, _bus, new IPublisher[]{_bus}, checkpointForStatistics: null);
     _bus.Subscribe<ClientMessage.WriteEventsCompleted>(_manager);
     _projectionName = "test-projection";
     _manager.Handle(
         new ProjectionManagementMessage.Post(
             new PublishEnvelope(_bus), ProjectionMode.Persistent, _projectionName, "JS",
             @"fromAll(); on_any(function(){});log(1);", enabled: true));
 }