Example #1
0
        public RuntimeEngine(IModuleConfigData configData)
        {
            _globalInfo = new ModuleGlobalInfo(configData);
            bool isSyncMessenger = _globalInfo.ConfigData.GetProperty <bool>("EngineSyncMessenger");
            // TODO 暂时写死使用LocalTestMaintainer
            // 初始化消息收发器
            MessageTransceiver messageTransceiver = MessageTransceiver.GetTransceiver(_globalInfo, isSyncMessenger);

            messageTransceiver.Clear();
            _controller          = new EngineFlowController(_globalInfo);
            _statusManager       = new RuntimeStatusManager(_globalInfo);
            _syncManager         = new SynchronousManager(_globalInfo);
            _callBackProcessor   = new CallBackProcessor(_globalInfo);
            _debugManager        = EnableDebug ? new DebugManager(_globalInfo) : null;
            _runtimeInfoSelector = new RuntimeInfoSelector(_globalInfo, this);

            _globalInfo.RuntimeInitialize(messageTransceiver, _debugManager);

            _runtimeObjectManager = new RuntimeObjectManager(_globalInfo);

            RuntimeStateMachine stateMachine = new RuntimeStateMachine();

            _globalInfo.StateMachine = stateMachine;

            RegisterMessageHandler();

            _globalInfo.LogService.Print(LogLevel.Info, CommonConst.PlatformLogSession, "RuntimeEngine constructed.");
        }
 public EngineFlowController(ModuleGlobalInfo globalInfo)
 {
     _globalInfo       = globalInfo;
     this._blockHandle = new BlockHandle();
     // TODO 暂时写死,只是用本地测试生成实体
     _testsMaintainer = new LocalTestEntityMaintainer(_globalInfo, _blockHandle);
 }
Example #3
0
        public StateManageContext(ModuleGlobalInfo globalInfo, ISequenceFlowContainer sequenceData)
        {
            this.GlobalInfo         = globalInfo;
            this.RuntimeHash        = globalInfo.RuntimeHash;
            this.EventDispatcher    = new EventDispatcher();
            this.DatabaseProxy      = new PersistenceProxy(globalInfo);
            this.TestGenerationInfo = new TestGenerationInfo(sequenceData);
            this.TestResults        = new TestProjectResults(sequenceData);
            this.TestInstance       = new TestInstanceData()
            {
                Name                   = GlobalInfo.ConfigData.GetProperty <string>("TestName"),
                Description            = GlobalInfo.ConfigData.GetProperty <string>("TestDescription"),
                TestProjectName        = sequenceData.Name,
                TestProjectDescription = sequenceData.Description,
                RuntimeHash            = globalInfo.RuntimeHash,
                StartGenTime           = DateTime.MaxValue,
                EndGenTime             = DateTime.MaxValue,
                StartTime              = DateTime.MaxValue,
                EndTime                = DateTime.MinValue,
                ElapsedTime            = 0
            };

            this._eventStatusIndex = -1;
            this._dataStatusIndex  = -1;
            this._perfStatusIndex  = -1;
        }
Example #4
0
        public AssemblyInvoker(ModuleGlobalInfo globalInfo, IList <IAssemblyInfo> assemblyInfo, IList <ITypeData> typeDatas)
        {
            this._logService        = globalInfo.LogService;
            this._I18N              = globalInfo.I18N;
            this._assembliesMapping = new Dictionary <string, Assembly>(assemblyInfo.Count);
            this._typeDataMapping   = new Dictionary <string, Type>(typeDatas.Count);

            this._assemblyInfos = assemblyInfo;
            this._typeDatas     = typeDatas;

            //this._dotNetLibDir = context.GetProperty<string>("DotNetLibDir");
            //this._platformLibDir = context.GetProperty<string>("PlatformLibDir");
            //this._instanceLibDir = context.GetProperty<string>("InstanceLibDir").Split(';');

            _valueTypeConvertors = new Dictionary <string, Func <string, object> >(20)
            {
                { typeof(double).Name, valueStr => double.Parse(valueStr) },
                { typeof(float).Name, valueStr => float.Parse(valueStr) },
                { typeof(long).Name, valueStr => long.Parse(valueStr) },
                { typeof(ulong).Name, valueStr => ulong.Parse(valueStr) },
                { typeof(int).Name, valueStr => int.Parse(valueStr) },
                { typeof(uint).Name, valueStr => uint.Parse(valueStr) },
                { typeof(short).Name, valueStr => short.Parse(valueStr) },
                { typeof(ushort).Name, valueStr => ushort.Parse(valueStr) },
                { typeof(char).Name, valueStr => char.Parse(valueStr) },
                { typeof(byte).Name, valueStr => byte.Parse(valueStr) },
                { typeof(bool).Name, valueStr => bool.Parse(valueStr) },
                { typeof(decimal).Name, valueStr => decimal.Parse(valueStr) },
                { typeof(sbyte).Name, valueStr => sbyte.Parse(valueStr) },
                { typeof(DateTime).Name, valueStr => DateTime.Parse(valueStr) },
            };
        }
Example #5
0
        protected MessageTransceiver(ModuleGlobalInfo globalInfo, ReceiveType receiveType)
        {
            this.GlobalInfo = globalInfo;
            // 创建上行队列
            FormatterType   formatterType = GlobalInfo.ConfigData.GetProperty <FormatterType>("EngineQueueFormat");
            MessengerOption receiveOption = new MessengerOption(CoreConstants.UpLinkMQName, GetMessageType)
            {
                Type        = MessengerType.MSMQ,
                HostAddress = Constants.LocalHostAddr,
                ReceiveType = receiveType,
                Formatter   = formatterType
            };

            UpLinkMessenger = Messenger.GetMessenger(receiveOption);
            this._consumers = new Dictionary <string, IMessageHandler>(Constants.DefaultRuntimeSize);
            // 创建下行队列
            MessengerOption sendOption = new MessengerOption(CoreConstants.DownLinkMQName, GetMessageType)
            {
                Type        = MessengerType.MSMQ,
                HostAddress = Constants.LocalHostAddr,
                ReceiveType = receiveType,
                Formatter   = formatterType
            };

            DownLinkMessenger   = Messenger.GetMessenger(sendOption);
            this._operationLock = new SpinLock();

            this.ZombieCleaner = new ZombieMessageCleaner(DownLinkMessenger, globalInfo);
        }
Example #6
0
 public DebugManager(ModuleGlobalInfo globalInfo)
 {
     this._globalInfo = globalInfo;
     _watchVariables  = new Dictionary <int, List <string> >(Constants.DefaultRuntimeSize);
     _breakPoints     = new Dictionary <int, List <CallStack> >(Constants.DefaultRuntimeSize);
     _debugHitSession = Constants.NoDebugHitSession;
 }
Example #7
0
 public AppDomainRuntimeContainer(int sessionId, ModuleGlobalInfo globalInfo,
                                  params object[] extraParam) : base(sessionId, globalInfo)
 {
     _appDomain = AppDomain.CreateDomain(GetAppDomainName());
     _testThd   = new Thread(StartLauncher)
     {
         Name         = GetThreadName(),
         IsBackground = true
     };
 }
Example #8
0
        public AppDomainRuntimeContainer(int sessionId, ModuleGlobalInfo globalInfo,
                                         params object[] extraParam) : base(sessionId, globalInfo)
        {
//            RuntimeType runtimeType = globalInfo.ConfigData.GetProperty<RuntimeType>("RuntimeType");
            _appDomain = AppDomain.CreateDomain(GetAppDomainName());
            _testThd   = new Thread(StartLauncher)
            {
                Name         = GetThreadName(),
                IsBackground = true
            };
        }
Example #9
0
 public static MessageTransceiver GetTransceiver(ModuleGlobalInfo globalInfo, bool isSyncMessenger)
 {
     // TODO 目前只实现了同步处理方式,异步处理后期实现
     if (isSyncMessenger)
     {
         return(new SyncMsgTransceiver(globalInfo));
     }
     else
     {
         return(new AsyncMsgTransceiver(globalInfo));
     }
 }
        public RuntimeStatusManager(ModuleGlobalInfo globalInfo)
        {
            _globalInfo = globalInfo;

            _eventProcessActions = new Dictionary <string, Action <EventInfoBase> >(5);
            _eventProcessActions.Add(typeof(AbortEventInfo).Name, AbortEventProcess);
            _eventProcessActions.Add(typeof(DebugEventInfo).Name, DebugEventProcess);
            _eventProcessActions.Add(typeof(ExceptionEventInfo).Name, ExceptionEventProcess);
            _eventProcessActions.Add(typeof(SyncEventInfo).Name, SyncEventProcess);
            _eventProcessActions.Add(typeof(TestGenEventInfo).Name, TestGenEventProcess);

            this._sessionStateHandles = new Dictionary <int, SessionStateHandle>(Constants.DefaultRuntimeSize);
        }
 public EngineFlowController(ModuleGlobalInfo globalInfo)
 {
     _globalInfo = globalInfo;
     // TODO 暂时写死,只是用本地测试生成实体
     _testsMaintainer = new LocalTestEntityMaintainer(_globalInfo, _blockHandle);
     if (EnableDebug)
     {
         _debugManager = new DebugManager(_globalInfo);
     }
     this._blockHandle = new BlockHandle()
     {
         Timeout = _globalInfo.ConfigData.GetProperty <int>("TestGenTimeout")
     };
 }
Example #12
0
        public static RuntimeContainer CreateContainer(int session, RuntimePlatform platform,
                                                       ModuleGlobalInfo globalInfo, params object[] extraParam)
        {
            switch (platform)
            {
            case RuntimePlatform.Clr:
                return(new AppDomainRuntimeContainer(session, globalInfo, extraParam));

                break;

            case RuntimePlatform.Common:
                return(new ProcessRuntimeContainer(session, globalInfo, extraParam));

                break;

            default:
                throw new ArgumentException();
            }
        }
Example #13
0
        public RuntimeEngine(IModuleConfigData configData)
        {
            _globalInfo = new ModuleGlobalInfo(configData);
            bool isSyncMessenger = _globalInfo.ConfigData.GetProperty <bool>("EngineSyncMessenger");
            // TODO 暂时写死使用LocalTestMaintainer
            // 初始化消息收发器
            MessageTransceiver messageTransceiver = MessageTransceiver.GetTransceiver(_globalInfo, isSyncMessenger);

            _controller    = new EngineFlowController(_globalInfo);
            _statusManager = new RuntimeStatusManager(_globalInfo);
            _syncManager   = new SynchronousManager(_globalInfo);

            _globalInfo.RuntimeInitialize(messageTransceiver, _controller.Debugger);

            _runtimeObjectManager = new RuntimeObjectManager();

            RuntimeStateMachine stateMachine = new RuntimeStateMachine();

            _globalInfo.StateMachine = stateMachine;

            RegisterMessageHandler();
        }
Example #14
0
 public AsyncMsgTransceiver(ModuleGlobalInfo globalInfo) : base(globalInfo, ReceiveType.Asynchronous)
 {
 }
Example #15
0
 public PersistenceProxy(ModuleGlobalInfo globalInfo)
 {
     this._globalInfo = globalInfo;
     _dataMaintainer  = globalInfo.TestflowRunner.DataMaintainer;
 }
Example #16
0
 public CallBackProcessor(ModuleGlobalInfo globalInfo)
 {
     _globalInfo        = globalInfo;
     _callBackMethods   = new Dictionary <string, MethodInfo>(Constants.DefaultRuntimeSize);
     _callBackFunctions = new Dictionary <string, IFunctionData>(Constants.DefaultRuntimeSize);
 }
 public InnerGlobalInitializersCompiler(Compilation compilation, Module module, MethodDefinition methodDefinition, ModuleGlobalInfo info)
     : base(compilation, module, methodDefinition)
 {
     this.info = info;
 }
Example #18
0
 public ProcessRuntimeContainer(int session, ModuleGlobalInfo globalInfo,
                                params object[] extraParam) : base(session, globalInfo)
 {
     // TODO
 }
Example #19
0
 public LocalTestEntityMaintainer(ModuleGlobalInfo globalInfo, BlockHandle blockHandle)
 {
     _globalInfo             = globalInfo;
     this._runtimeContainers = new Dictionary <int, RuntimeContainer>(Constants.DefaultRuntimeSize);
     this._blockHandle       = blockHandle;
 }
Example #20
0
 public PersistenceProxy(ModuleGlobalInfo globalInfo)
 {
     this._globalInfo = globalInfo;
 }
 public AsyncMsgTransceiver(ModuleGlobalInfo globalInfo) : base(globalInfo)
 {
 }
Example #22
0
 public RuntimeInfoSelector(ModuleGlobalInfo globalInfo, RuntimeEngine runtimeEngine)
 {
     _globalInfo = globalInfo;
     _engine     = runtimeEngine;
 }
Example #23
0
 public SynchronousManager(ModuleGlobalInfo globalInfo)
 {
     this._globalInfo = globalInfo;
 }
Example #24
0
 public ZombieMessageCleaner(Messenger messenger, ModuleGlobalInfo globalInfo)
 {
     _globalInfo = globalInfo;
     _messenger  = messenger;
     _cleanTimer = new Timer(CleanZombieMessage, null, Timeout.Infinite, Timeout.Infinite);
 }
Example #25
0
 public RuntimeObjectManager(ModuleGlobalInfo globalInfo)
 {
     this._runtimeObjects = new Dictionary <long, RuntimeObject>(100);
     this._customers      = new Dictionary <string, IRuntimeObjectCustomer>(Constants.DefaultRuntimeSize);
     this._globalInfo     = globalInfo;
 }
Example #26
0
 public SyncMsgTransceiver(ModuleGlobalInfo globalInfo) : base(globalInfo)
 {
     _engineMessageQueue = new LocalMessageQueue <MessageBase>(Constants.DefaultEventsQueueSize);
     _statusMessageQueue = new LocalMessageQueue <MessageBase>(Constants.DefaultEventsQueueSize);
 }
Example #27
0
 protected RuntimeContainer(int session, ModuleGlobalInfo globalInfo)
 {
     this.Session    = session;
     this.GlobalInfo = globalInfo;
     this.HostReady  = false;
 }