Beispiel #1
0
            protected override IEnumerable <WhenStep> When()
            {
                yield return(CreateWriteEvent("stream1", "type1", "{\"Data\": 1}"));

                yield return
                    (new ProjectionManagementMessage.Command.Post(
                         Envelope, ProjectionMode.Continuous, _projectionName,
                         ProjectionManagementMessage.RunAs.System, "js", GivenOriginalSource(), true,
                         _checkpointsEnabled, _emitEnabled, _trackEmittedStreams));

                yield return(CreateWriteEvent("stream1", "type2", "{\"Data\": 2}"));

                yield return(CreateWriteEvent("stream2", "type2", "{\"Data\": 3}"));

                yield return(CreateWriteEvent("stream3", "type3", "{\"Data\": 4}"));

                yield return(CreateWriteEvent("stream3", "type1", "{\"Data\": 5}"));

                yield return
                    (new ProjectionManagementMessage.Command.Disable(
                         Envelope, _projectionName, ProjectionManagementMessage.RunAs.System));

                yield return
                    (new ProjectionManagementMessage.Command.UpdateQuery(
                         Envelope, _projectionName, ProjectionManagementMessage.RunAs.System, "js",
                         GivenUpdatedSource(), _emitEnabled));

                yield return(CreateWriteEvent("stream2", "type3", "{\"Data\": 6}"));

                yield return(CreateWriteEvent("stream3", "type4", "{\"Data\": 7}"));

                yield return
                    (new ProjectionManagementMessage.Command.Enable(
                         Envelope, _projectionName, ProjectionManagementMessage.RunAs.System));

                yield return(CreateWriteEvent("stream3", "type4", "{\"Data\": 8}"));

                yield return(CreateWriteEvent("stream4", "type5", "{\"Data\": 9}"));

                yield return(CreateWriteEvent("stream5", "type1", "{\"Data\": 10}"));

                yield return
                    (new ProjectionManagementMessage.Command.GetStatistics(
                         Envelope, ProjectionMode.AllNonTransient, _projectionName, false));

                yield return(new ProjectionManagementMessage.Command.GetState(Envelope, _projectionName, ""));

                yield return
                    (new ProjectionManagementMessage.Command.GetQuery(
                         Envelope, _projectionName, ProjectionManagementMessage.RunAs.Anonymous));

                _allStatistics = HandledMessages.OfType <ProjectionManagementMessage.Statistics>().LastOrDefault();
                _statistics    = _allStatistics != null?_allStatistics.Projections.SingleOrDefault() : null;

                _state     = HandledMessages.OfType <ProjectionManagementMessage.ProjectionState>().LastOrDefault();
                _stateData = _state != null?EatException(() => _state.State.ParseJson <JObject>()) : null;

                _query = HandledMessages.OfType <ProjectionManagementMessage.ProjectionQuery>().LastOrDefault();
            }
Beispiel #2
0
 private string StateFormatter(ICodec codec, ProjectionManagementMessage.ProjectionState state)
 {
     if (state.Exception != null)
     {
         return(state.Exception.ToString());
     }
     else
     {
         return(state.State);
     }
 }
Beispiel #3
0
 private ResponseConfiguration StateConfigurator(ICodec codec, ProjectionManagementMessage.ProjectionState state)
 {
     if (state.Exception != null)
     {
         return(Configure.InternalServerError());
     }
     else
     {
         return(state.Position != null
                    ? Configure.Ok("application/json", Helper.UTF8NoBom, null, null, false,
                                   new KeyValuePair <string, string>(SystemHeaders.ProjectionPosition, state.Position.ToJsonString()))
                    : Configure.Ok("application/json", Helper.UTF8NoBom, null, null, false));
     }
 }
 private string StateFormatter(ICodec codec, ProjectionManagementMessage.ProjectionState state)
 {
     return(state.State);
 }
 private ResponseConfiguration StateConfigurator(ICodec codec, ProjectionManagementMessage.ProjectionState state)
 {
     return(_jsonOkConfiguration);
 }
Beispiel #6
0
 private ResponseConfiguration StateConfigurator(ICodec codec, ProjectionManagementMessage.ProjectionState state)
 {
     return(Configure.OkNoCache("application/json"));
 }