示例#1
0
 def enableIgnore(self, bEnable=True):
     if bEnable:
         self.m_oldErrorMode = WBXTF.WBXTFSetErrorModeAsIgnore()
         self.m_enableIgnore = True
     elif "m_oldErrorMode" in dir(self):
         self.m_enableIgnore = False
         WBXTF.WBXTFSetErrorMode(self.m_oldErrorMode)
示例#2
0
 def checkChatAllLastInfo(self, sCommand):
     nNum = 0
     if self.env.getHost() != None:
         nNum = nNum + 1
     nNum = nNum + len(self.env.getAttendees())
     ress = self.env.sendToAll("chat.GetAllChatMsg()")
     if len(ress) != nNum:
         WBXTF.WBXTFCheck("Verify chat", False)
         return False
     for res in ress:
         try:
             nCount = len(res["result"]["result"])
             if nCount == 0:
                 WBXTF.WBXTFCheck(
                     "Verify the last chat string: not get the chat from attendee",
                     False)
                 return False
             lastText = res["result"]["result"][nCount - 1]["Chatmsg"]
             if lastText != sCommand:
                 WBXTF.WBXTFCheck(
                     "Verify the last chat string: chat message does not match",
                     False)
                 return False
         except Exception:
             WBXTF.WBXTFCheck("Verify the last chat string" % (ress), False)
             return False
     WBXTF.WBXTFCheck("Verify the last chat string", True)
     return True
示例#3
0
 def __check(self, text, bExpress):
     if "m_enableIgnore" in dir(self) and self.m_enableIgnore:
         return
     if self.bEnableTrace:
         WBXTF.WBXTFCheck(text, bExpress)
     else:
         WBXTF.WBXTFCheck("", bExpress)
示例#4
0
    def joinMeetingForGroup(self, group):
        self.__output("Start to join the meeting")
        if self.bNeedUpateMeetingInfo and (
                not self.__updateMeetingToGroup(group)):
            WBXTF.WBXTFError("Fail to update meeting information")
            return False

        res = group.execute("meeting.Open()")
        if not self.__checkResultsAsTrue(res):
            WBXTF.WBXTFError("Fail to join meeting")
            return False
        return self.waitMeetingJoin()
示例#5
0
    def joinMeeting(self):
        self.__output("Start to join the meeting")
        if self.bNeedUpateMeetingInfo and (
                not self.__updateMeetingToAttendee()):
            WBXTF.WBXTFError("Fail to update meeting information")
            return False

        res = self.SendToAttendee("meeting.Open()")
        if not self.__checkResultsAsTrue(res):
            WBXTF.WBXTFError("Fail to join meeting")
            return False
        return self.waitMeetingJoin()
示例#6
0
 def createMeetingByMeetingInfo(self):
     self.__output("Start to create a meeting")
     if not self.__updateMeetingToHost():
         WBXTF.WBXTFError("Fail to update meeting information")
         return False
     res = self.groupHost.execute("meeting.Open()")
     if not self.__checkResultsAsTrue(res):
         WBXTF.WBXTFError("Fail to create meeting")
         return False
     bRes = self.waitMeetingCreate()
     self.bNeedUpateMeetingInfo = True
     return bRes
示例#7
0
    def __runAttendee(self, sAttendeeMachines, nToolNum):
        if len(sAttendeeMachines) <= 0:
            return ASKGroup()
        self.__output("Start to run the %d attendees" % nToolNum)
        nEveryTool = int(
            (nToolNum + len(sAttendeeMachines) - 1) / len(sAttendeeMachines))
        nRemained = nToolNum
        bRes = True
        group = ASKGroup()
        for machine in sAttendeeMachines:
            nTool = nEveryTool
            if nTool > nRemained:
                nTool = nRemained
            if nTool == 0:
                break

            objs = WBXTF.WBXTFRunObjects(machine, self.sToolPath,
                                         self.sParamAttendee, nTool,
                                         self.nTimeout)
            if len(objs) != nTool:
                bRes = False
                break
            self.groupAttendee.addList(objs)
            group.addList(objs)
            nRemained = nRemained - nTool
        self.__check("Verify running attendees", bRes)
        return group
示例#8
0
 def closeSession(self, sessionName):
     self.__output("Start to close session:%s" % (sessionName))
     res = self.sendToHost("%s.Close" % (sessionName))
     if not self.__checkResultsAsTrue(res):
         WBXTF.WBXTFError("Fail to create session %s" % (sessionName))
         return False
     return True
示例#9
0
 def runClient(self, attendeename=None):
     sURL = "%s/m.php?MT=3&AT=JM&BU=%s/&MK=%s&[email protected]&AN=%s" % (
         self.sScheduleSite, self.sScheduleSite, self.sConfMeetingKey,
         attendeename)
     if len(self.sClientMachines) <= 0 or self.nToolNumClient <= 0:
         return
     if len(self.objClients) > 0:
         return
     self.__output("Start to run the clients")
     bRes = True
     nEveryTool = int(
         (self.nToolNumClient + len(self.sClientMachines) - 1) /
         len(self.sClientMachines))
     nRemained = self.nToolNumClient
     for machine in self.sClientMachines:
         nTool = nEveryTool
         if nTool > nRemained:
             nTool = nRemained
         if nTool == 0:
             break
         objs = WBXTF.WBXTFRun(machine, self.sClientIEPath, sURL, nTool)
         if len(objs) != nTool:
             bRes = False
             break
         for obj in objs:
             addObj = {}
             addObj['machine'] = machine
             addObj['handle'] = obj
             self.objClients.append(addObj)
     self.__check("Verify running clients", bRes)
示例#10
0
 def createSession(self, sessionName):
     self.__output("Start to open session:%s" % (sessionName))
     res = self.sendToHost("%s.Open" % (sessionName))
     if not self.__checkResultsAsTrue(res):
         WBXTF.WBXTFError("Fail to create session %s" % (sessionName))
         return
     self.WaitSessionCreate(sessionName)
示例#11
0
 def __checkResult(self, result, expectation):
     try:
         if result["rc"] != 0 or WBXTF.WBXTFEqualWithoutType(
                 expectation, result["result"]["result"]) == False:
             return False
         return True
     except Exception:
         return False
示例#12
0
 def exitClient(self):
     if len(self.objClients) == 0:
         return
     self.__output("Start to exit clients")
     for client in self.objClients:
         handles = []
         handles.append(client["handle"])
         WBXTF.WBXTFStop(client["machine"], handles)
     self.objClients = []
示例#13
0
    def runHost(self):
        if self.groupHost.getCount() > 0:
            return ASKGroup()

        self.__output("Start to run the host")
        objHost = WBXTF.WBXTFRunObject(self.sHostMachine, self.sToolPath,
                                       self.sParamHost, self.nTimeout)
        bRes = objHost != None
        self.__check("Verify running host", bRes)
        if bRes:
            self.groupHost.add(objHost)
            WBXTF.WBXTFOutput("RunHost SetUniqueAttendeeId %s" %
                              self.sHostMachine)
            self.groupHost.execute("config.SetUniqueAttendeeId(%s)" %
                                   self.sHostMachine)
        group = ASKGroup()
        group.copyFrom(self.groupHost)
        return group
示例#14
0
 def deploy(self):
     self.__output("Start to deploy the tool")
     if len(self.sDeploySourceMachine) == 0:
         WBXTF.WBXTFError("Fail to deploying: not set source machine")
         return
     if len(self.sDeploySourcePath) == 0:
         WBXTF.WBXTFError("Fail to deploying: not set source path")
         return
     if len(self.sDeployTargetPath) == 0:
         WBXTF.WBXTFError("Fail to deploying: not set target path")
         return
     bRes = True
     for machine in self.sMachines:
         objMachine = WBXTF.WBXTFObject("staf://%s/pack" % (machine))
         res = objMachine.Execute(
             "Install(%s, %s, %s, %s)" %
             (self.sDeployPackName, self.sDeploySourceMachine,
              self.sDeploySourcePath, self.sDeployTargetPath))
         try:
             if res["rc"] != 0 or int(res["result"]["rc"]) != 0:
                 bRes = False
                 WBXTF.WBXTFError("Fail to deploy on machine %s:%s" %
                                  (machine, res))
         except Exception:
             bRes = False
             WBXTF.WBXTFError("Fail to deploy on machine %s" % machine)
     self.sToolPath = self.sDeployTargetPath
     self.sToolPath = self.sToolPath + "/attendee.exe"
     return bRes
示例#15
0
 def __checkResults(self, results, expectation, nCount=-1):
     try:
         if nCount >= 0 and nCount != len(results):
             return False
         for res in results:
             if res["result"]["rc"] != 0:
                 return False
             if WBXTF.WBXTFEqualWithoutType(
                     expectation, res["result"]["result"]) == False:
                 return False
         return True
     except Exception:
         return False
示例#16
0
 def createMeetingByScheduleInfo(self):
     self.__output("Start to schedule a meeting")
     res = self.groupHost.execute(
         "meeting.Schedule(%s,,%s,%s,%s,%s,%s,%s,1,%d,0,%s)" %
         (self.sScheduleSite, self.sScheduleUser, self.sSchedulePass,
          self.sScheduleMT, self.sScheduleName, self.sScheduleMeetingPWD,
          self.sScheduleTCParam, self.nPCNAccountIndex,
          WBXTF.WBXTFVar(self.dictSchOptionParam)))
     if not self.__checkResultsAsTrue(res):
         self.__check("Verify creating meeting", False)
         return False
     bRes = self.waitMeetingCreate()
     self.bNeedUpateMeetingInfo = True
     self.__updateMeetingInfoFromHost()
     return bRes
示例#17
0
    def checkPollingAnswers(self):
        resAttendees = self.env.sendToAttendee("polling.GetPollAnswers()")
        resHosts = self.env.sendToHost("polling.GetPollAnswers()")

        for resA in resAttendees:
            try:
                bCorrect = 0
                for resH in resHosts[0]["result"]["result"]:
                    if resA["result"]["result"][0] == resH:
                        bCorrect = 1
                if bCorrect == 0:
                    strErrorMsg = "Verify polling data:" \
                          "Sender userid=" + str(resA["result"]["result"][0]["userid"]) + \
                          "answer:" + str(resA["result"]["result"][0]["answer"])
                    WBXTF.WBXTFCheck(strErrorMsg, False)
                    return False
                elif bCorrect == 1:
                    strResMsg = "Verify polling data:"\
                          "Sender userid=" + str(resA["result"]["result"][0]["userid"])
                    WBXTF.WBXTFCheck(strResMsg, True)
                    return True
            except Exception:
                WBXTF.WBXTFCheck("Verify polling data: Error", False)
                return False
示例#18
0
 def __terminateGroup(self, group):
     listHandles = []
     for item in group.m_objs:
         if item.nPort > 0:
             WBXTF.WBXTFStop(item.sMachine, [item.nPort])
示例#19
0
 def __output(self, text, type=WBXTF.typeInfo):
     if self.bEnableTrace:
         WBXTF.WBXTFOutput(text, type)