Example #1
0
 /*
  * QA tools transactions
  */
 public Task <string> StartQAToolsTransaction(IMachineInfo machine, GammaTXQATools tool, object qatoolArgs = null)
 {
     return(Task.Run(() =>
     {
         var trx = GammaClientTXFactory.GetQAToolsTX(machine, tool);
         AddTransaction(trx);
         return StartTransactions(trx, machine, tool, qatoolArgs);
     }));
 }
Example #2
0
        internal static GammaClientTransaction GetQAToolsTX(IMachineInfo machine, GammaTXQATools op_code)
        {
            var trx = new GammaClientTransaction()
            {
                Machine        = machine.MachineName,
                TX_TYPE        = GammaTransactionType.QATOOLS,
                TX_SUB_TYPE    = (int)op_code,
                TX_CONTENT     = string.Empty,
                TX_RESULT      = string.Empty,
                TX_RESULT_CODE = GammaTransactionRC.RUNNING,
            };

            GammaClientTXLogger.GetInstance().RegisterTransaction(trx);
            return(trx);
        }
Example #3
0
        private Task <string> StartTransactions(IGammaClientTransaction trx, IMachineInfo machine, GammaTXQATools tool, object qatoolArgs = null)
        {
            trx.TransactionStarted();
            Task <string> task;

            switch (tool)
            {
            case GammaTXQATools.GETLOG:
                if (qatoolArgs != null)
                {
                    bool tmp = (bool)qatoolArgs;
                    task = GammaProxyFactory.GetQAToolsProxy(machine).GetLogAsync(tmp);
                }
                else
                {
                    throw new Exception("Unexpected error when try to get operation option.");
                }
                break;

            case GammaTXQATools.CLEARLOG:
                task = GammaProxyFactory.GetQAToolsProxy(machine).ClearLogAsync();
                break;

            case GammaTXQATools.UPLOAD:
                if (qatoolArgs != null)
                {
                    GammaServiceLib.UploadRecord tmp = qatoolArgs as GammaServiceLib.UploadRecord;
                    task = GammaProxyFactory.GetQAToolsProxy(machine).UploadLogAsync(tmp);
                }
                else
                {
                    throw new Exception("Unexpected error when try to get upload information.");
                }
                break;

            default:
                task = GenerateCompletedTask(TX_RESULT_SUC);
                break;
            }
            BindCmdTaskWithTranscation(task, trx);
            return(task);
        }