示例#1
0
        /// <summary>
        /// constructor defining the different parameters of PCClient
        /// </summary>
        /// <param name="pcModel">IPCModel object</param>
        /// <param name="fileLog">FileLog object already defined</param>
        /// <param name="maxUnlockWait">How long to wait for the reports.zip file to be downloaded (in secondfs). Optional (default 200 seconds)</param>
        public PCClient(IPCModel pcModel, FileLog fileLog, int maxUnlockWait = 200)
        {
            try
            {
                //defining log file
                if (fileLog == null)
                {
                    Int32 unixTimestamp = (Int32)(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1))).TotalSeconds;
                    _logFullFileName = Path.Combine(string.Format(_workDirectory, unixTimestamp.ToString()), _logFileName);
                    _fileLog         = new FileLog(_logFullFileName);
                }
                else
                {
                    _fileLog = fileLog;
                }

                if (_maxUnlockWait < maxUnlockWait)
                {
                    _maxUnlockWait = maxUnlockWait;
                }

                _fileLog.Write(LogMessageType.Debug, String.Format("PC.Plugins.Automation PCModel has started\n"));

                _pcModel = pcModel;

                if (!string.IsNullOrEmpty(_pcModel.ProxyOutURL))
                {
                    fileLog.Write(LogMessageType.Info, "Using proxy: " + _pcModel.ProxyOutURL);
                }
                _pcRestProxy = new PCRestProxy(_pcModel.isHTTPSProtocol(), _pcModel.PCServerAndPort, _pcModel.Domain, _pcModel.Project, _pcModel.ProxyOutURL, _pcModel.ProxyOutUser, _pcModel.ProxyOutPassword);
            }
            catch (Exception e)
            {
                fileLog.Write(LogMessageType.Error, e.Message);
            }
        }
示例#2
0
        public PCBuilder(
            string serverAndPort,
            string pcServerName,
            string userName,
            string password,
            string domain,
            string project,
            string testId,
            bool autoTestInstance,
            string testInstanceID,
            string timeslotDurationHours,
            string timeslotDurationMinutes,
            string pcPostRunActionsRequest,
            bool vudsMode,
            bool statusBySLA,
            string description,
            string addRunToTrendReport,
            string trendReportId,
            bool HTTPSProtocol,
            string proxyOutURL,
            string proxyOutUser,
            string proxyOutPassword,
            string workDirectory = "",
            string logFileName   = "")
        {
            Int32 unixTimestamp = (Int32)(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1))).TotalSeconds;

            _workDirectory   = !String.IsNullOrWhiteSpace(workDirectory) ? workDirectory : String.Format(_workDirectory, unixTimestamp.ToString());
            _logFileName     = !String.IsNullOrWhiteSpace(logFileName) ? logFileName : _logFileName;;
            _logFullFileName = Path.Combine(_workDirectory, _logFileName);
            _fileLog         = new FileLog(_logFullFileName);

            _userName = userName;
            _password = password;
            _timeslotDurationHours   = timeslotDurationHours;
            _timeslotDurationMinutes = timeslotDurationMinutes;
            _statusBySLA             = statusBySLA;

            _pcModel =
                new PCModel(
                    serverAndPort,
                    pcServerName,
                    userName,
                    password,
                    domain,
                    project,
                    testId,
                    autoTestInstance,
                    testInstanceID,
                    timeslotDurationHours,
                    timeslotDurationMinutes,
                    new PCPostRunActionsRequest(true, pcPostRunActionsRequest),
                    vudsMode,
                    description,
                    addRunToTrendReport,
                    trendReportId,
                    HTTPSProtocol,
                    proxyOutURL,
                    proxyOutUser,
                    proxyOutPassword);
        }