public void Setup() { _state = null; _projection = null; Given(); _logged = new List<string>(); _stateHandlerFactory = new ProjectionStateHandlerFactory(); _stateHandler = _stateHandlerFactory.Create( "JS", _projection, logger: s => { if (s.StartsWith("P:")) Console.WriteLine(s); else _logged.Add(s); }); // skip prelude debug output _source = _stateHandler.GetSourceDefinition(); if (_state != null) _stateHandler.Load(_state); else _stateHandler.Initialize(); if (_sharedState != null) _stateHandler.LoadShared(_sharedState); When(); }
public void Setup() { _state = null; _projection = null; Given(); _logged = new List <string>(); _stateHandlerFactory = new ProjectionStateHandlerFactory(CompilationTimeout, ExecutionTimeout, JavascriptProjectionRuntime.Interpreted); _stateHandler = CreateStateHandler(); _source = _stateHandler.GetSourceDefinition(); if (_state != null) { _stateHandler.Load(_state); } else { _stateHandler.Initialize(); } if (_sharedState != null) { _stateHandler.LoadShared(_sharedState); } When(); }
public void Setup() { _state = null; _projection = null; Given(); _logged = new List <string>(); _stateHandlerFactory = new ProjectionStateHandlerFactory(); _stateHandler = _stateHandlerFactory.Create( "JS", _projection, logger: (s, _) => { if (s.StartsWith("P:")) { Console.WriteLine(s); } else { _logged.Add(s); } }); // skip prelude debug output _source = _stateHandler.GetSourceDefinition(); if (_state != null) { _stateHandler.Load(_state); } else { _stateHandler.Initialize(); } if (_sharedState != null) { _stateHandler.LoadShared(_sharedState); } When(); }
public void Setup() { _state = null; _projection = null; Given(); _logged = new List <string>(); _stateHandlerFactory = new ProjectionStateHandlerFactory(TimeSpan.FromMilliseconds(1000), TimeSpan.FromMilliseconds(500), JavascriptProjectionRuntime.Legacy); _stateHandler = CreateStateHandler(); _source = _stateHandler.GetSourceDefinition(); if (_state != null) { _stateHandler.Load(_state); } else { _stateHandler.Initialize(); } if (_sharedState != null) { _stateHandler.LoadShared(_sharedState); } When(); }
public void Setup() { _state = null; _projection = null; Given(); _logged = new List <string>(); _stateHandlerFactory = new ProjectionStateHandlerFactory(); _stateHandler = CreateStateHandler(); _source = _stateHandler.GetSourceDefinition(); if (_state != null) { _stateHandler.Load(_state); } else { _stateHandler.Initialize(); } if (_sharedState != null) { _stateHandler.LoadShared(_sharedState); } When(); }
/// <summary> /// initializes or loads existing partition state /// </summary> /// <param name="partition"></param> /// <returns>true - if new partition state was initialized</returns> private bool InitOrLoadHandlerState(string partition) { if (_handlerPartition == partition) { return(false); } var newState = _partitionStateCache.GetLockedPartitionState(partition); _handlerPartition = partition; var initialized = false; if (newState != null && !String.IsNullOrEmpty(newState.State)) { _projectionStateHandler.Load(newState.State); } else { initialized = true; _projectionStateHandler.Initialize(); } //if (!_sharedStateSet && _isBiState) if (_isBiState) { var newSharedState = _partitionStateCache.GetLockedPartitionState(""); if (newSharedState != null && !String.IsNullOrEmpty(newSharedState.State)) { _projectionStateHandler.LoadShared(newSharedState.State); } else { _projectionStateHandler.InitializeShared(); } } return(initialized); }