protected override void Given() { _timeProvider = new FakeTimeProvider(); _mp = new ManagedProjection( _bus, Guid.NewGuid(), 1, "name", true, null, _writeDispatcher, _readDispatcher, _bus, _bus, _handlerFactory, _timeProvider); }
protected override void Given() { _projectionName = "projectionName"; _projectionDefinitionStreamId = ProjectionNamesBuilder.ProjectionsStreamPrefix + _projectionName; _coreProjectionId = Guid.NewGuid(); _timeProvider = new FakeTimeProvider(); _managedProjection = new ManagedProjection( Guid.NewGuid(), Guid.NewGuid(), 1, _projectionName, true, null, _streamDispatcher, _writeDispatcher, _readDispatcher, _bus, _timeProvider, new RequestResponseDispatcher <CoreProjectionManagementMessage.GetState, CoreProjectionStatusMessage.StateReport>( _bus, v => v.CorrelationId, v => v.CorrelationId, new PublishEnvelope(_bus)), new RequestResponseDispatcher <CoreProjectionManagementMessage.GetResult, CoreProjectionStatusMessage.ResultReport>( _bus, v => v.CorrelationId, v => v.CorrelationId, new PublishEnvelope(_bus)), _ioDispatcher, TimeSpan.FromMinutes(Opts.ProjectionsQueryExpiryDefault)); }
protected override void Given() { _timeProvider = new FakeTimeProvider(); _mp = new ManagedProjection( Guid.NewGuid(), Guid.NewGuid(), 1, "name", true, null, _streamDispatcher, _writeDispatcher, _readDispatcher, _bus, _timeProvider, new RequestResponseDispatcher <CoreProjectionManagementMessage.GetState, CoreProjectionStatusMessage.StateReport>( _bus, v => v.CorrelationId, v => v.CorrelationId, new PublishEnvelope(_bus)), new RequestResponseDispatcher <CoreProjectionManagementMessage.GetResult, CoreProjectionStatusMessage.ResultReport>( _bus, v => v.CorrelationId, v => v.CorrelationId, new PublishEnvelope(_bus)), _ioDispatcher); }
protected override IEnumerable <WhenStep> When() { ProjectionManagementMessage.Post message = new ProjectionManagementMessage.Post( Envelope, ProjectionMode.Transient, _projectionName, ProjectionManagementMessage.RunAs.System, typeof(FakeForeachStreamProjection), "", true, 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 ? ManagedProjection.SerializePrincipal(message.RunAs) : null, }); var sourceDefinition = new FakeForeachStreamProjection("", Console.WriteLine).GetSourceDefinition(); var projectionSourceDefinition = ProjectionSourceDefinition.From( _projectionName, sourceDefinition, message.HandlerType, message.Query); _mp.Handle( new CoreProjectionManagementMessage.Prepared( _coreProjectionId, projectionSourceDefinition, null)); yield break; }
protected override void Given() { _timeProvider = new FakeTimeProvider(); _mp = CreateManagedProjection(); _mp.InitializeNew( new ManagedProjection.PersistedState { Enabled = false, HandlerType = "JS", Query = "fromAll().when({});", Mode = ProjectionMode.Continuous, EmitEnabled = true, CheckpointsDisabled = false, Epoch = -1, Version = -1, RunAs = SerializedRunAs.SerializePrincipal(ProjectionManagementMessage.RunAs.Anonymous), }, null); _mp.Handle(new CoreProjectionStatusMessage.Prepared(_projectionId, new ProjectionSourceDefinition())); OneWriteCompletes(); _consumer.HandledMessages.Clear(); _mp.Handle(new CoreProjectionStatusMessage.Faulted( _projectionId, "test")); _updateConfig = CreateConfig(); try { _mp.Handle(_updateConfig); } catch (Exception ex) { _thrownException = ex; } }
protected ProjectionManagementMessage.ProjectionConfig GetProjectionConfig(ManagedProjection mp) { ProjectionManagementMessage.ProjectionConfig getConfigResult = null; mp.Handle(new ProjectionManagementMessage.Command.GetConfig( new CallbackEnvelope(m => getConfigResult = (ProjectionManagementMessage.ProjectionConfig)m), "name", SerializedRunAs.SerializePrincipal(ProjectionManagementMessage.RunAs.Anonymous))); return(getConfigResult); }
protected override void Given() { _timeProvider = new FakeTimeProvider(); _mp = CreateManagedProjection(); _mp.InitializeNew( _persistedState, null); _mp.Handle(new CoreProjectionStatusMessage.Prepared(_projectionId, new ProjectionSourceDefinition())); // Complete write of persisted state to start projection OneWriteCompletes(); _config = GetProjectionConfig(_mp); }
public void null_query_throws_argument_null_exception() { ProjectionManagementMessage.Post message = new ProjectionManagementMessage.Post( new NoopEnvelope(), ProjectionMode.OneTime, "name", ProjectionManagementMessage.RunAs.Anonymous, "JS", query: null, enabled: true, checkpointsEnabled: false, emitEnabled: 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 ? ManagedProjection.SerializePrincipal(message.RunAs) : null, }); }
protected override void Given() { var persistedState = new ManagedProjection.PersistedState { Enabled = true, HandlerType = "JS", Query = @"log(1);", Mode = ProjectionMode.Continuous, EmitEnabled = true, CheckpointsDisabled = true, Epoch = -1, Version = -1, RunAs = SerializedRunAs.SerializePrincipal(ProjectionManagementMessage.RunAs.Anonymous), ProjectionSubsystemVersion = 4 }; ExistingEvent(ProjectionNamesBuilder.ProjectionsStreamPrefix + _projectionName, ProjectionEventTypes.ProjectionUpdated, "", persistedState.ToJson()); _timeProvider = new FakeTimeProvider(); _mp = new ManagedProjection( Guid.NewGuid(), Guid.NewGuid(), 1, "name", true, null, _streamDispatcher, _writeDispatcher, _readDispatcher, _bus, _timeProvider, new RequestResponseDispatcher <CoreProjectionManagementMessage.GetState, CoreProjectionStatusMessage.StateReport>( _bus, v => v.CorrelationId, v => v.CorrelationId, new PublishEnvelope(_bus)), new RequestResponseDispatcher <CoreProjectionManagementMessage.GetResult, CoreProjectionStatusMessage.ResultReport>( _bus, v => v.CorrelationId, v => v.CorrelationId, new PublishEnvelope(_bus)), _ioDispatcher, TimeSpan.FromMinutes(Opts.ProjectionsQueryExpiryDefault)); }
protected override void Given() { _timeProvider = new FakeTimeProvider(); _mp = CreateManagedProjection(); _mp.InitializeNew( _persistedState, null); _mp.Handle(new CoreProjectionStatusMessage.Prepared(_projectionId, new ProjectionSourceDefinition())); // Complete write of persisted state to start projection OneWriteCompletes(); try { _mp.Handle(CreateConfig()); } catch (InvalidOperationException ex) { _thrownException = ex; } }
public FaultedState(ManagedProjection managedProjection) : base(managedProjection) { }
public CompletedState(ManagedProjection managedProjection) : base(managedProjection) { }
public LoadingStateState(ManagedProjection managedProjection) : base(managedProjection) { }
protected ManagedProjectionStateBase(ManagedProjection managedProjection) { _managedProjection = managedProjection; }
public DeletingState(ManagedProjection managedProjection) : base(managedProjection) { managedProjection.DeleteProjectionStreams(); }
public StartingState(ManagedProjection managedProjection) : base(managedProjection) { }
public RunningState(ManagedProjection managedProjection) : base(managedProjection) { }
public CreatingLoadingLoadedState(ManagedProjection managedProjection) : base(managedProjection) { }
protected override void Given() { _mp = new ManagedProjection( Guid.NewGuid(), "name", null, _writeDispatcher, _readDispatcher, _bus, _handlerFactory); }
public PreparedState(ManagedProjection managedProjection) : base(managedProjection) { }
public PreparingState(ManagedProjection managedProjection) : base(managedProjection) { }
public AbortedState(ManagedProjection managedProjection) : base(managedProjection) { }
public void empty_name_throws_argument_exception2() { var mp = new ManagedProjection(_bus, Guid.NewGuid(), "", null, _writeDispatcher, _readDispatcher, _bus, _handlerFactory); }
public StoppedState(ManagedProjection managedProjection) : base(managedProjection) { }
public AbortingState(ManagedProjection managedProjection) : base(managedProjection) { }
public void empty_guid_throws_invali_argument_exception2() { var mp = new ManagedProjection(_bus, Guid.Empty, "name", null, _writeDispatcher, _readDispatcher, _bus, _handlerFactory); }
public void null_name_throws_argument_null_exception() { var mp = new ManagedProjection( Guid.NewGuid(), null, null, _writeDispatcher, _readDispatcher, _bus, _handlerFactory); }