Esempio n. 1
0
        protected override IEnumerable <WhenStep> When()
        {
            ProjectionManagementMessage.Command.Post message = new ProjectionManagementMessage.Command.Post(
                Envelope, ProjectionMode.Transient, _projectionName, ProjectionManagementMessage.RunAs.System,
                typeof(FakeForeachStreamProjection), "", true, false, false, false);
            _mp.InitializeNew(
                new ManagedProjection.PersistedState {
                Enabled             = message.Enabled,
                HandlerType         = message.HandlerType,
                Query               = message.Query,
                Mode                = message.Mode,
                EmitEnabled         = message.EmitEnabled,
                CheckpointsDisabled = !message.CheckpointsEnabled,
                Epoch               = -1,
                Version             = -1,
                RunAs               = message.EnableRunAs ? SerializedRunAs.SerializePrincipal(message.RunAs) : null,
            },
                null);

            var sourceDefinition           = new FakeForeachStreamProjection("", Console.WriteLine).GetSourceDefinition();
            var projectionSourceDefinition = ProjectionSourceDefinition.From(sourceDefinition);

            _mp.Handle(
                new CoreProjectionStatusMessage.Prepared(
                    _coreProjectionId, projectionSourceDefinition));
            yield break;
        }
        protected override IEnumerable <WhenStep> When()
        {
            ProjectionManagementMessage.Command.Post message = new ProjectionManagementMessage.Command.Post(
                Envelope, ProjectionMode.OneTime, _projectionName, ProjectionManagementMessage.RunAs.System,
                typeof(FakeForeachStreamProjection), "", true, false, false, false);
            _managedProjection.InitializeNew(
                new ManagedProjection.PersistedState
            {
                Enabled             = message.Enabled,
                HandlerType         = message.HandlerType,
                Query               = message.Query,
                Mode                = message.Mode,
                EmitEnabled         = message.EmitEnabled,
                CheckpointsDisabled = !message.CheckpointsEnabled,
                Epoch               = -1,
                Version             = -1,
                RunAs               = message.EnableRunAs ? SerializedRunAs.SerializePrincipal(message.RunAs) : null,
            },
                null);

            var sourceDefinition           = new FakeForeachStreamProjection("", Console.WriteLine).GetSourceDefinition();
            var projectionSourceDefinition = ProjectionSourceDefinition.From(sourceDefinition);

            _managedProjection.Handle(
                new CoreProjectionStatusMessage.Prepared(
                    _coreProjectionId, projectionSourceDefinition));

            _originalPersistedStateEventId = _consumer.HandledMessages.OfType <ClientMessage.WriteEvents>().Where(x => x.EventStreamId == _projectionDefinitionStreamId).First().Events[0].EventId;

            CompleteWriteWithResult(_failureCondition);

            _consumer.HandledMessages.Clear();

            yield break;
        }
 public ProjectionQuery(string name, string query, bool emitEnabled, ProjectionSourceDefinition definition)
 {
     _name        = name;
     _query       = query;
     _emitEnabled = emitEnabled;
     _definition  = definition;
 }
 public ProjectionQuery(string name, string query, bool emitEnabled, ProjectionSourceDefinition definition, ProjectionOutputConfig outputConfig)
 {
     _name         = name;
     _query        = query;
     _emitEnabled  = emitEnabled;
     _definition   = definition;
     _outputConfig = outputConfig;
 }
Esempio n. 5
0
 public Prepared(
     Guid projectionId, ProjectionSourceDefinition sourceDefinition,
     SlaveProjectionDefinitions slaveProjections)
     : base(projectionId)
 {
     _sourceDefinition = sourceDefinition;
     _slaveProjections = slaveProjections;
 }
Esempio n. 6
0
        public SourceDefinition(ProjectionSourceDefinition sourceDefinition)
        {
            if (sourceDefinition == null)
            {
                throw new ArgumentNullException("sourceDefinition");
            }

            _sourceDefinition = sourceDefinition;
        }
Esempio n. 7
0
        protected override ProjectionProcessingStrategy GivenProjectionProcessingStrategy()
        {
            var sourceDefinition = _stateHandler.GetSourceDefinition();
            var source           = QuerySourcesDefinition.From(sourceDefinition).ToJson();

            return(new ParallelQueryProcessingStrategy(
                       _projectionName, _version, GivenProjectionStateHandler, _projectionConfig,
                       ProjectionSourceDefinition.From(
                           _projectionName, sourceDefinition, typeof(FakeProjectionStateHandler).GetNativeHandlerName(),
                           source), new ProjectionNamesBuilder(_projectionName, sourceDefinition), null,
                       _spoolProcessingResponseDispatcher, _subscriptionDispatcher));
        }
        protected override void Given()
        {
            _projectionId = Guid.NewGuid();

            var builder = new SourceDefinitionBuilder();

            builder.FromStream("s1");
            builder.FromStream("s2");
            builder.IncludeEvent("e1");
            builder.IncludeEvent("e2");
            builder.SetByStream();
            builder.SetResultStreamNameOption("result-stream");
            _definition = ProjectionSourceDefinition.From(builder);
        }
 public ProjectionQuery(
     string name,
     string query,
     bool emitEnabled,
     string projectionType,
     bool?trackEmittedStreams,
     bool?checkpointsEnabled,
     ProjectionSourceDefinition definition,
     ProjectionOutputConfig outputConfig)
 {
     _name                = name;
     _query               = query;
     _emitEnabled         = emitEnabled;
     _projectionType      = projectionType;
     _trackEmittedStreams = trackEmittedStreams;
     _checkpointsEnabled  = checkpointsEnabled;
     _definition          = definition;
     _outputConfig        = outputConfig;
 }
Esempio n. 10
0
 public Prepared(Guid projectionId, ProjectionSourceDefinition sourceDefinition)
     : base(projectionId)
 {
     _sourceDefinition = sourceDefinition;
 }