コード例 #1
0
        /// <summary>
        /// Execute this step.
        /// </summary>
        protected override void ExecuteMain()
        {
            string log = string.Empty;

            try
            {
                this.Status = StepStatusEnum.Executing;
                string path   = Path.Combine(Settings.Default.ReplayToolPath, "RiskApiCaller.exe");
                string cmd    = "{0} call /isZipped:{1} /TPS:{2} /path:{3} /count:{4} /newGuid:{5} /needLog:{6} /rptType:\"{7}\" /description:\"{8}\" /isBaseLine:{9} /isDisplay:{10} /jumpMinute:{11}".FormatWith(path, true, Properties.Settings.Default.ReplayToolTPS, Properties.Settings.Default.RiskAPICaller_DataFilePath, Properties.Settings.Default.ReplayToolCount, true, false, string.Empty, "For generating agg data", false, false, 0);
                int    result = ThirdPartyProgramBLL.RunCommand(out log, cmd);

                switch (result)
                {
                case 0:
                    this.Status       = StepStatusEnum.Pass;
                    this.ResultDetail = new StepResultDetail("Successfully ran replay tool.");
                    break;

                case -1073741510:
                    this.Status       = StepStatusEnum.Cancelled;
                    this.ResultDetail = new StepResultDetail("User cancelled the replay tool run.");
                    break;

                default:
                    this.Status       = StepStatusEnum.Failed;
                    this.ResultDetail = new StepResultDetail("Replay tool didn't run successfully, please check log for more detailed information.");
                    break;
                }
            }
            catch (Exception ex)
            {
                this.Status       = StepStatusEnum.Failed;
                this.ResultDetail = new StepResultDetail("Error has occurred, please check log.", ExceptionHelper.CentralProcessSingle2(ex));
            }
            finally
            {
                if (this.ResultDetail != null)
                {
                    if (!string.IsNullOrEmpty(log))
                    {
                        this.ResultDetail.Message += "Execution log: \r\n{0}".FormatWith(log);
                    }

                    Log.Info(this.ResultDetail.Message);
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// Execute this step.
        /// </summary>
        protected override void ExecuteMain()
        {
            string log = string.Empty;

            try
            {
                this.Status = StepStatusEnum.Executing;
                string path = Path.Combine(Settings.Default.ReplayToolPath, "RiskApiCaller.exe");

                string cmd = "{0} call /iszipped:{1} /newGuid:{2} /TPS:{3} /path:{4} /count:{5} /needRpt:{6} /description:{7} /isBaseLine:{8} /jumpMinute:{9} /takoSvr:{10} /ImpersonateUserName:{11} /ImpersonateDomain:{12} /ImpersonatePassword:{13}".FormatWith(
                    path,
                    Properties.Settings.Default.RiskAPICaller_IsZipped,
                    Properties.Settings.Default.RiskAPICaller_NewGuid,
                    Properties.Settings.Default.RiskAPICaller_TPS_ChangedRun,
                    Path.Combine(Properties.Settings.Default.RiskAPICaller_DataFilePath, "{0}.dat.gz".FormatWith(string.Join("_", Properties.Settings.Default.RuleIds.ToArray()))),
                    Properties.Settings.Default.RiskAPICaller_Count_Run,
                    true,
                    Properties.Settings.Default.RiskAPICaller_Description,
                    false,
                    Properties.Settings.Default.RiskAPICaller_JumpMinute,
                    Properties.Settings.Default.RiskAPICaller_TakoServer,
                    Properties.Settings.Default.RiskAPICaller_ImpersonateUserName,
                    Properties.Settings.Default.RiskAPICaller_ImpersonateDomain,
                    Properties.Settings.Default.RiskAPICaller_ImpersonatePassword);

                int result = ThirdPartyProgramBLL.RunCommand(out log, cmd);

                switch (result)
                {
                case 0:
                    this.Status       = StepStatusEnum.Pass;
                    this.ResultDetail = new StepResultDetail("Successfully ran replay tool.");
                    break;

                case -1073741510:
                    this.Status       = StepStatusEnum.Cancelled;
                    this.ResultDetail = new StepResultDetail("User cancelled the replay tool run.");
                    break;

                case -532462766:
                    this.Status       = StepStatusEnum.Warning;
                    this.ResultDetail = new StepResultDetail("This step has run successfully, but some exceptions had been thrown by that step during running. Please check log file for more detailed information.");
                    break;

                default:
                    this.Status       = StepStatusEnum.Failed;
                    this.ResultDetail = new StepResultDetail("Replay tool didn't run successfully, please check log for more detailed information.");
                    break;
                }
            }
            catch (Exception ex)
            {
                this.Status       = StepStatusEnum.Failed;
                this.ResultDetail = new StepResultDetail("Error has occurred, please check log.", ExceptionHelper.CentralProcessSingle2(ex));
            }
            finally
            {
                if (this.ResultDetail != null)
                {
                    if (!string.IsNullOrEmpty(log))
                    {
                        this.ResultDetail.Message += "Execution log: \r\n{0}".FormatWith(log);
                    }

                    Log.Info(this.ResultDetail.Message);
                }
            }
        }
コード例 #3
0
        protected override void ExecuteMain()
        {
            try
            {
                string log = "";
                this.Status = StepStatusEnum.Executing;
                Impersonator impersonator = new Impersonator(
                    Properties.Settings.Default.DomainUserName,
                    Properties.Settings.Default.Domain,
                    Properties.Settings.Default.DomainPassword);

                Properties.Settings.Default.RiskAPICaller_Count_Run = (Properties.Settings.Default.TransactionCountPerRule * Properties.Settings.Default.RuleIds.Count).ToString();

                Properties.Settings.Default.Save();

                string path = Path.Combine(Properties.Settings.Default.ReplayToolPath, "MixedMerge.exe");

                string cmd = "{0} Mix /SrcFileFolder:\"{1}\" /RuleID:\"{2}\" /DefaultDstCnt:{3} /DstFileFolder:\"{4}\" /ImpersonateUserName:{5} /ImpersonateDomain:{6} /ImpersonatePassword:{7}".FormatWith(
                    path,
                    Properties.Settings.Default.RuleDestFolder,
                    string.Join(",", Properties.Settings.Default.RuleIds.ToArray()),
                    Properties.Settings.Default.RiskAPICaller_Count_Run,
                    Properties.Settings.Default.RiskAPICaller_DataFilePath,
                    Properties.Settings.Default.DomainUserName,
                    Properties.Settings.Default.Domain,
                    Properties.Settings.Default.DomainPassword
                    );

                Log.Info("Starting {0}".FormatWith(cmd));

                int result = ThirdPartyProgramBLL.RunCommand(out log, cmd);

                switch (result)
                {
                case 0:
                    this.Status       = StepStatusEnum.Pass;
                    this.ResultDetail = new StepResultDetail(log + "\r\nSuccessfully ran mixed merge tool.");
                    break;

                case -1073741510:
                    this.Status       = StepStatusEnum.Cancelled;
                    this.ResultDetail = new StepResultDetail(log + "\r\nUser cancelled the replay tool run.");
                    break;

                case -532462766:
                    this.Status       = StepStatusEnum.Warning;
                    this.ResultDetail = new StepResultDetail(log + "\r\nThis step has run successfully, but some exceptions had been thrown by that step during running. Please check log file for more detailed information.");
                    break;

                default:
                    this.Status       = StepStatusEnum.Failed;
                    this.ResultDetail = new StepResultDetail(log + "\r\nFailed, please check log for more detailed information.");
                    break;
                }

                impersonator.Undo();
            }
            catch (Exception ex)
            {
                this.Status       = StepStatusEnum.Failed;
                this.ResultDetail = new StepResultDetail("Error has occurred, please check log.", ExceptionHelper.CentralProcessSingle2(ex));
            }
            finally
            {
                if (this.ResultDetail != null)
                {
                    Log.Info(this.ResultDetail.Message);
                }
            }
        }