コード例 #1
0
        public long AddRuntimeObject(string objectType, int sessionId, params object[] param)
        {
            RuntimeObject runtimeObject = null;

            switch (objectType)
            {
            case Constants.BreakPointObjectName:
                runtimeObject = new BreakPointObject((CallStack)param[0]);
                break;

            case Constants.WatchDataObjectName:
                runtimeObject = new WatchDataObject(sessionId, (int)param[0],
                                                    (string)param[1]);
                break;

            case Constants.EvaluationObjectName:
                runtimeObject = new EvaluationObject(sessionId, (int)param[0],
                                                     (string)param[1]);
                break;

            default:
                _globalInfo.LogService.Print(LogLevel.Warn, CommonConst.PlatformLogSession,
                                             $"Unsupported runtime object type: {0}.");
                _globalInfo.ExceptionManager.Append(new TestflowDataException(
                                                        ModuleErrorCode.InvalidRuntimeObjectType,
                                                        _globalInfo.I18N.GetFStr("InvalidRuntimeObjType", objectType)));
                return(Constants.InvalidObjectId);

                break;
            }
            AddObject(runtimeObject);
            return(runtimeObject.Id);
        }
コード例 #2
0
ファイル: ModuleUtils.cs プロジェクト: spartajet/Testflow
        public static string GetRuntimeVariableString(WatchDataObject watchDataObj, ISequenceFlowContainer sequenceData)
        {
            const char delim = '.';

            string[]  watchElem     = watchDataObj.WatchData.Split(delim);
            string    variableName  = watchElem[0];
            int       sequenceIndex = watchDataObj.Sequence;
            IVariable variable      = null;

            if (sequenceData is ITestProject)
            {
                ITestProject testProject = sequenceData as ITestProject;
                if (watchDataObj.Session == CommonConst.TestGroupSession)
                {
                    variable = GetVariableByNameAndSequence(testProject, sequenceIndex, variableName);
                }
                else
                {
                    variable = GetVariableByNameAndSequence(testProject.SequenceGroups[watchDataObj.Session],
                                                            sequenceIndex, variableName);
                }
            }
            else if (sequenceData is ISequenceGroup)
            {
                ISequenceGroup sequenceGroup = sequenceData as ISequenceGroup;
                variable = GetVariableByNameAndSequence(sequenceGroup, sequenceIndex, variableName);
            }
            if (null == variable)
            {
                return(null);
            }
            watchElem[0] = CoreUtils.GetRuntimeVariableName(watchDataObj.Session, variable);
            return(string.Join(delim.ToString(), watchElem));
        }
コード例 #3
0
        public void RemoveObject(RuntimeObject runtimeObject)
        {
            switch (runtimeObject.ObjectName)
            {
            case Constants.BreakPointObjectName:
                BreakPointObject breakPointObject = (BreakPointObject)runtimeObject;
                RemoveBreakPoint(breakPointObject.BreakPoint.Session, breakPointObject.BreakPoint);
                break;

            case Constants.WatchDataObjectName:
                WatchDataObject watchDataObject = (WatchDataObject)runtimeObject;
                RemoveWatchVariable(watchDataObject.Session, watchDataObject);
                break;

            case Constants.EvaluationObjectName:
                // ignore
                break;
            }
        }
コード例 #4
0
        public void AddObject(RuntimeObject runtimeObject)
        {
            switch (runtimeObject.ObjectName)
            {
            case Constants.BreakPointObjectName:
                BreakPointObject breakPointObject = (BreakPointObject)runtimeObject;
                AddBreakPoint(breakPointObject.BreakPoint.Session, breakPointObject.BreakPoint);
                break;

            case Constants.WatchDataObjectName:
                WatchDataObject watchDataObject = (WatchDataObject)runtimeObject;
                AddWatchVariable(watchDataObject.Session, watchDataObject);
                break;

            case Constants.EvaluationObjectName:
                EvaluateExpression((EvaluationObject)runtimeObject);
                break;
            }
        }
コード例 #5
0
        private void AddWatchVariable(int session, WatchDataObject watchDataObj)
        {
            string watchDataName = ModuleUtils.GetRuntimeVariableString(watchDataObj, _sequenceData);

            if (!_watchVariables.ContainsKey(session))
            {
                _watchVariables.Add(session, new List <string>(Constants.DefaultRuntimeSize));
            }
            if (!_watchVariables[session].Contains(watchDataName))
            {
                _watchVariables[session].Add(watchDataName);
            }
            RuntimeState runtimeState = _globalInfo.StateMachine.State;

            if (runtimeState == RuntimeState.Running || runtimeState == RuntimeState.Blocked ||
                runtimeState == RuntimeState.DebugBlocked)
            {
                SendRefreshWatchMessage(session);
            }
        }
コード例 #6
0
        private void RemoveWatchVariable(int session, WatchDataObject watchDataObj)
        {
            string watchDataName = ModuleUtils.GetRuntimeVariableString(watchDataObj, _sequenceData);

            if (!_watchVariables.ContainsKey(session))
            {
                return;
            }
            if (_watchVariables[session].Contains(watchDataName))
            {
                _watchVariables[session].Remove(watchDataName);
                if (0 == _watchVariables[session].Count)
                {
                    _watchVariables.Remove(session);
                }
            }
            RuntimeState runtimeState = _globalInfo.StateMachine.State;

            if (runtimeState == RuntimeState.Running || runtimeState == RuntimeState.Blocked ||
                runtimeState == RuntimeState.DebugBlocked)
            {
                SendRefreshWatchMessage(session);
            }
        }