public void Setup() { queues = new List <FakePublisher>() { new FakePublisher() }.ToArray(); publisher = new FakePublisher(); _coordinator = new ProjectionCoreCoordinator(ProjectionType.None, timeoutScheduler, queues, publisher, envelope); // Start components _coordinator.Handle(new ProjectionSubsystemMessage.StartComponents(instanceCorrelationId)); _coordinator.Handle( new ProjectionCoreServiceMessage.SubComponentStarted(EventReaderCoreService.SubComponentName, instanceCorrelationId)); // Stop components but don't handle component stopped _coordinator.Handle(new ProjectionSubsystemMessage.StopComponents(instanceCorrelationId)); var stopReader = queues[0].Messages.OfType <ReaderCoreServiceMessage.StopReader>().First(); queueId = stopReader.QueueId; //clear queues for clearer testing queues[0].Messages.Clear(); }
public void Setup() { queues = new List <FakePublisher>() { new FakePublisher() }.ToArray(); publisher = new FakePublisher(); _coordinator = new ProjectionCoreCoordinator(ProjectionType.All, timeoutScheduler, queues, publisher, envelope); // Start components _coordinator.Handle(new ProjectionSubsystemMessage.StartComponents(instanceCorrelationId)); // All components started _coordinator.Handle( new ProjectionCoreServiceMessage.SubComponentStarted(EventReaderCoreService.SubComponentName, instanceCorrelationId)); _coordinator.Handle( new ProjectionCoreServiceMessage.SubComponentStarted(ProjectionCoreService.SubComponentName, instanceCorrelationId)); _coordinator.Handle( new ProjectionCoreServiceMessage.SubComponentStarted( ProjectionCoreServiceCommandReader.SubComponentName, instanceCorrelationId)); // Stop components, but don't handle any sub component stopped messages _coordinator.Handle(new ProjectionSubsystemMessage.StopComponents(instanceCorrelationId)); //clear queues for clearer testing queues[0].Messages.Clear(); }
public void Setup() { queues = new List <FakePublisher>() { new FakePublisher() }.ToArray(); publisher = new FakePublisher(); _coordinator = new ProjectionCoreCoordinator(ProjectionType.None, timeoutScheduler, queues, publisher, envelope); _coordinator.Handle(new SystemMessage.BecomeMaster(Guid.NewGuid())); _coordinator.Handle(new SystemMessage.SystemCoreReady()); _coordinator.Handle(new SystemMessage.EpochWritten(new EpochRecord(0, 0, Guid.NewGuid(), 0, DateTime.Now))); }
public void should_not_start_reader_if_subcomponents_not_stopped() { // None of the subcomponents stopped // Start components _coordinator.Handle(new ProjectionSubsystemMessage.StartComponents(Guid.NewGuid())); Assert.AreEqual(0, queues[0].Messages.FindAll(x => x is ReaderCoreServiceMessage.StartReader).Count); }
public void Setup() { queues = new List <FakePublisher>() { new FakePublisher() }.ToArray(); publisher = new FakePublisher(); _coordinator = new ProjectionCoreCoordinator(ProjectionType.System, timeoutScheduler, queues, publisher, envelope); _coordinator.Handle(new SystemMessage.SystemCoreReady()); _coordinator.Handle(new SystemMessage.BecomeMaster(Guid.NewGuid())); _coordinator.Handle(new SystemMessage.EpochWritten(new EpochRecord(0, 0, Guid.NewGuid(), 0, DateTime.Now))); //force stop _coordinator.Handle(new SystemMessage.BecomeUnknown(Guid.NewGuid())); //clear queues for clearer testing queues[0].Messages.Clear(); }
public void Setup() { queues = new List <FakePublisher>() { new FakePublisher() }.ToArray(); publisher = new FakePublisher(); _coordinator = new ProjectionCoreCoordinator(ProjectionType.System, timeoutScheduler, queues, publisher, envelope); _coordinator.Handle(new ProjectionSubsystemMessage.StartComponents(Guid.NewGuid())); }
public void Setup() { queues = new List <FakePublisher>() { new FakePublisher() }.ToArray(); publisher = new FakePublisher(); var instanceCorrelationId = Guid.NewGuid(); _coordinator = new ProjectionCoreCoordinator(ProjectionType.All, timeoutScheduler, queues, publisher, envelope); // Start all sub components _coordinator.Handle(new ProjectionSubsystemMessage.StartComponents(instanceCorrelationId)); // All components started _coordinator.Handle( new ProjectionCoreServiceMessage.SubComponentStarted(EventReaderCoreService.SubComponentName, instanceCorrelationId)); _coordinator.Handle( new ProjectionCoreServiceMessage.SubComponentStarted(ProjectionCoreService.SubComponentName, instanceCorrelationId)); // Stop Components _coordinator.Handle(new ProjectionSubsystemMessage.StopComponents(instanceCorrelationId)); // Publish SubComponent stopped messages for the projection core service stopCoreMessages = queues[0].Messages .FindAll(x => x.GetType() == typeof(ProjectionCoreServiceMessage.StopCore)) .Select(x => x as ProjectionCoreServiceMessage.StopCore) .ToList(); foreach (var msg in stopCoreMessages) { _coordinator.Handle( new ProjectionCoreServiceMessage.SubComponentStopped(ProjectionCoreService.SubComponentName, msg.QueueId)); } }
public void Setup() { queues = new List <FakePublisher>() { new FakePublisher() }.ToArray(); publisher = new FakePublisher(); var instanceCorrelationId = Guid.NewGuid(); _coordinator = new ProjectionCoreCoordinator(ProjectionType.None, timeoutScheduler, queues, publisher, envelope); // Start components _coordinator.Handle(new ProjectionSubsystemMessage.StartComponents(instanceCorrelationId)); // start sub components _coordinator.Handle( new ProjectionCoreServiceMessage.SubComponentStarted(EventReaderCoreService.SubComponentName, instanceCorrelationId)); //force stop _coordinator.Handle(new ProjectionSubsystemMessage.StopComponents(instanceCorrelationId)); }
private void BecomeReady() { //become ready _coordinator.Handle(new SystemMessage.BecomeMaster(Guid.NewGuid())); _coordinator.Handle(new SystemMessage.EpochWritten(new EpochRecord(0, 0, Guid.NewGuid(), 0, DateTime.Now))); }