Exemplo n.º 1
0
 def dm_updateautotask(request):
     message = "successful"
     try:
         autotask=DAL_AutomationTask.get_automation_task(request.POST["autotaskid"])
         autotask = AutomationTaskService.initlize_dm_instance(request,autotask)
         DAL_AutomationTask.add_automationtask(autotask)
     except Exception as ex:
         message = str(ex)
         SimpleLogger.error(message)
     return message
Exemplo n.º 2
0
 def disable_autotask(request):
     
     message = "successful"
     try:
         autotask=DAL_AutomationTask.get_automation_task(request.POST["autotaskid"])
         autotask.TaskIsActive=0
         DAL_AutomationTask.add_automationtask(autotask)
     except Exception as ex:
         message = str(ex)
         SimpleLogger.error(message)
     return message
Exemplo n.º 3
0
 def start_task(autotaskid,triggername,fromip):
     autotask=DAL_AutomationTask.get_automation_task(autotaskid)
     autotask.TaskStatus=AutomationTaskStatusEnum.TaskStatus_Inqueue
     queuetask=AutoTaskQueue()
     queuetask.TQCommand=AutoTaskQueueCommandTypeEnum.TaskQueueCommandType_Start
     queuetask.TQPriority=2
     queuetask.TQStatus =AutoTaskQueueStatusEnum.QueueTaskStatus_New
     queuetask.TQTaskID=autotaskid
     queuetask.TQTaskUUID=uuid.uuid1()
     queuetask.TQFromName=triggername
     queuetask.TQFromIP=fromip
     DAL_AutoTaskQueue.add_task_inqueue(queuetask)
     DAL_AutomationTask.updatetask(autotask)
Exemplo n.º 4
0
 def dm_createautotask(request):
     ''' create new  db model autotask
     '''
     message = "successful"
     try:
         autotask = AutoTask()
         autotask = AutomationTaskService.initlize_dm_instance(request,autotask)
         autotask.TaskStatus=AutomationTaskStatusEnum.TaskStatus_New
         DAL_AutomationTask.add_automationtask(autotask)
     except Exception as ex:
         message = str(ex)
         SimpleLogger.error(message)
     return message
Exemplo n.º 5
0
 def search_autotask_byname(autotaskname):
     result = None
     try:
         result = DAL_AutomationTask.get_all().filter(TaskName__icontains=autotaskname)
     except Exception as ex:
         print(ex)
     return result
Exemplo n.º 6
0
 def search_autotask_byid(autotaskid):
     autotask = None
     try:
         autotask = DAL_AutomationTask.get_all().filter(id=autotaskid)
     except Exception as ex:
         SimpleLogger.error(ex.message)
     return autotask
Exemplo n.º 7
0
 def search_autotask(searchkeyword):
     if searchkeyword == "ALL":
         result = DAL_AutomationTask.get_all().filter(TaskIsActive=1)
     else:
         result = AutomationTaskService.search_autotask_byid(searchkeyword)
         if  result ==None or len(result)==0:
             result = AutomationTaskService.search_autotask_byname(searchkeyword.strip())
     return result.order_by("-id")
Exemplo n.º 8
0
    def copy_autotask(request):
        message = "successful"
        try:
            from_autotask=DAL_AutomationTask.get_automation_task(request.POST["autotaskid"])
            to_autotask=AutoTask()
            to_autotask.TaskAgentID=from_autotask.TaskAgentID
            to_autotask.TaskOwner=request.user.id
            to_autotask.TaskStatus=AutomationTaskStatusEnum.TaskStatus_New
            to_autotask.TaskCaseQuerySet=from_autotask.TaskCaseQuerySet
            to_autotask.TaskIsSplit=from_autotask.TaskIsSplit
            to_autotask.TaskName=from_autotask.TaskName+str(time.time())
            to_autotask.TaskProjectID=from_autotask.TaskProjectID
            to_autotask.TaskTestingConfigID=from_autotask.TaskTestingConfigID
#             to_autotask.TaskTpye=from_autotask.TaskTpye
            to_autotask.TaskViewScope=from_autotask.TaskViewScope
            DAL_AutomationTask.add_automationtask(to_autotask)
        except Exception as ex:
            message = str(ex)
            SimpleLogger.error(message)
        return message
Exemplo n.º 9
0
 def get_autotask_projests(autotaskid):
     all_projects=list()
     result=list()
     for project in all_projects:
         temp=dict()
         temp["text"]=project.TPName
         temp["memberid"]=project.id
         if autotaskid!=0:
             autotask=DAL_AutomationTask.get_automation_task(autotaskid)
             if project.id==autotask.TaskProjectID:
                 temp["selected"]=1
             else:
                 temp["selected"]=0
         else:
             temp["selected"]=0
         result.append(temp)
     return str(result).replace("u'","'")
Exemplo n.º 10
0
 def get_autotask_testcaseset(autotaskid):
     all_testingconfigs=DAL_AutoTestConfig.get_all()
     result=list()
     for testingconfig in all_testingconfigs:
         temp=dict()
         temp["text"]=testingconfig.TCFName
         temp["memberid"]=testingconfig.id
         if autotaskid!=0:
             autotask=DAL_AutomationTask.get_automation_task(autotaskid)
             if testingconfig.id==autotask.TaskTestingConfigID:
                 temp["selected"]=1
             else:
                 temp["selected"]=0
         else:
             temp["selected"]=0
         result.append(temp)
     return str(result).replace("u'","'")
Exemplo n.º 11
0
 def get_autotask_agent(autotaskid):
     all_agents=DAL_AutoAgent.get_all()
     result=list()
     for agent in all_agents:
         temp=dict()
         temp["text"]=agent.AName
         temp["memberid"]=agent.id
         if autotaskid!=0:
             autotask=DAL_AutomationTask.get_automation_task(autotaskid)
             if agent.id==autotask.TaskAgentID:
                 temp["selected"]=1
             else:
                 temp["selected"]=0
         else:
             temp["selected"]=0
         result.append(temp)
     return str(result).replace("u'","'")
Exemplo n.º 12
0
 def get_autotask_types(autotaskid):
     tasktypes = DAL_DictValue.getdatavaluebytype("AutoTaskType")
     result=list()
     for tasktype in tasktypes:
         temp=dict()
         temp["text"]=tasktype.DicDataName
         temp["memberid"]=tasktype.DicDataValue
         if autotaskid!=0:
             autotask=DAL_AutomationTask.get_automation_task(autotaskid)
             if tasktype.DicDataValue==autotask.TaskTpye:
                 temp["selected"]=1
             else:
                 temp["selected"]=0
         else:
             temp["selected"]=0
         result.append(temp)
     return str(result).replace("u'","'")
Exemplo n.º 13
0
 def check_name_exits(request):
     auottaskname=request.POST["autotaskname"]
     return DAL_AutomationTask.taskname_exits(auottaskname)
Exemplo n.º 14
0
 def get_autotask_taskviewscope(autotaskid):
     result=1
     if autotaskid!=0:
         autotask=DAL_AutomationTask.get_automation_task(autotaskid)
         result=autotask.TaskViewScope
     return result
Exemplo n.º 15
0
 def get_autotask_issplit(autotaskid):
     result=1
     if autotaskid!=0:
         autotask=DAL_AutomationTask.get_automation_task(autotaskid)
         result=autotask.TaskIsSplit
     return result
Exemplo n.º 16
0
 def get_autotask_namelist():
     autotasklist = DAL_AutomationTask.get_all()
     return str([item.TaskName for item in autotasklist]).replace("u'","'")
Exemplo n.º 17
0
 def get_autotask_name(autotaskid):
     result=""
     if autotaskid!=0:
         autotask=DAL_AutomationTask.get_automation_task(autotaskid)
         result=autotask.TaskName
     return result