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();
        }
Пример #3
0
        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();
        }
Пример #4
0
        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();
        }
Пример #5
0
 public void setup()
 {
     _state      = null;
     _projection = null;
     Given();
     _logged = new List <string>();
     _stateHandlerFactory = new ProjectionStateHandlerFactory();
     _stateHandler        = _stateHandlerFactory.Create(
         "JS", _projection, s =>
     {
         if (!s.StartsWith("P:"))
         {
             _logged.Add(s);
         }
         else
         {
             Console.WriteLine(s);
         }
     });         // skip prelude debug output
     _source = new SourceRecorder();
     _stateHandler.ConfigureSourceProcessingStrategy(_source);
     if (_state != null)
     {
         _stateHandler.Load(_state);
     }
     else
     {
         _stateHandler.Initialize();
     }
 }
        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();
        }
        private void SetHandlerState(string partition)
        {
            if (_handlerPartition == partition)
            {
                return;
            }
            var newState = _partitionStateCache.GetLockedPartitionState(partition);

            _handlerPartition = partition;
            if (newState != null && !String.IsNullOrEmpty(newState.State))
            {
                _projectionStateHandler.Load(newState.State);
            }
            else
            {
                _projectionStateHandler.Initialize();
            }
        }
 public void setup()
 {
     _state = null;
     _projection = null;
     Given();
     _logged = new List<string>();
     _stateHandlerFactory = new ProjectionStateHandlerFactory();
     _stateHandler = _stateHandlerFactory.Create(
         "JS", _projection, s =>
             {
                 if (!s.StartsWith("P:")) _logged.Add(s);
                 else Console.WriteLine(s);
             }); // skip prelude debug output
     _source = new SourceRecorder();
     _stateHandler.ConfigureSourceProcessingStrategy(_source);
     if (_state != null)
         _stateHandler.Load(_state);
     else
         _stateHandler.Initialize();
 }
        /// <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);
        }