public void TestFixtureSetUp()
        {
            _ioDispatcher      = new IODispatcher(_bus, new PublishEnvelope(_bus), true);
            _projectionVersion = new ProjectionVersion(3, 1, 2);
            _projectionConfig  = new ProjectionConfig(SystemAccounts.System, 10, 1000, 1000, 10, true, true, true,
                                                      false,
                                                      false, 5000, 10);
            _positionTagger = new MultiStreamPositionTagger(3, _streams);
            _positionTagger.AdjustTag(CheckpointTag.FromStreamPositions(3,
                                                                        new Dictionary <string, long> {
                { "a", 0 }, { "b", 0 }, { "c", 0 }
            }));
            _namingBuilder = ProjectionNamesBuilder.CreateForTest("projection");

            IODispatcherTestHelpers.SubscribeIODispatcher(_ioDispatcher, _bus);
            _bus.Subscribe <ClientMessage.ReadStreamEventsBackward>(this);

            _coreProjectionCheckpointWriter = new CoreProjectionCheckpointWriter(
                _namingBuilder.MakeCheckpointStreamName(), _ioDispatcher,
                _projectionVersion, _projectionName);

            _checkpointManager = new MultiStreamMultiOutputCheckpointManager(_bus, _projectionId, _projectionVersion,
                                                                             SystemAccounts.System,
                                                                             _ioDispatcher, _projectionConfig, _projectionName, _positionTagger, _namingBuilder, true, true, false,
                                                                             _coreProjectionCheckpointWriter);

            When();
        }
        public void DeleteProjectionStreams()
        {
            var sourceDefinition       = PersistedProjectionState.SourceDefinition ?? new ProjectionSourceDefinition();
            var projectionNamesBuilder = new ProjectionNamesBuilder(_name, sourceDefinition);

            if (PersistedProjectionState.DeleteCheckpointStream)
            {
                DeleteStream(projectionNamesBuilder.MakeCheckpointStreamName(), DeleteIfConditionsAreMet);
            }
            if (PersistedProjectionState.DeleteEmittedStreams)
            {
                if (_emittedStreamsDeleter == null)
                {
                    _emittedStreamsDeleter = new EmittedStreamsDeleter(
                        _ioDispatcher,
                        projectionNamesBuilder.GetEmittedStreamsName(),
                        projectionNamesBuilder.GetEmittedStreamsCheckpointName());
                }
                _emittedStreamsDeleter.DeleteEmittedStreams(DeleteIfConditionsAreMet);
            }
            if (!PersistedProjectionState.DeleteCheckpointStream &&
                !PersistedProjectionState.DeleteEmittedStreams)
            {
                DeleteIfConditionsAreMet();
            }
        }
示例#3
0
 protected new virtual void When()
 {
     _projectionVersion = new ProjectionVersion(1, 0, 0);
     _projectionName    = "projection";
     _checkpointWriter  = new CoreProjectionCheckpointWriter(
         _namingBuilder.MakeCheckpointStreamName(), _ioDispatcher, _projectionVersion, _projectionName);
     _checkpointReader = new CoreProjectionCheckpointReader(
         GetInputQueue(), _projectionCorrelationId, _ioDispatcher, _projectionCheckpointStreamId,
         _projectionVersion, _checkpointsEnabled);
     _manager = GivenCheckpointManager();
 }