Beispiel #1
0
 def test3HashSearch(self):
     for I in range (START_ELEMENTS+10):
         buffer = "TEST%d"%I
         str1 = FstringHash()
         str1.setString(buffer)
         self.assertEquals(List.addOrGet( str1),None)
     buffer = "TEST%d"%(START_ELEMENTS-10)
     str1 = FstringHash()
     str1.setString(buffer)
     self.assertEquals(List.Search(str1).getString(),"TEST%d"%(START_ELEMENTS-10))
Beispiel #2
0
        def test1Name(self):
            self.assertEquals(router1.start( None, "testezlog.xml"),RET_OK)
            strH = FstringHash()
            strH.setString( "TEST00")

            #// TEST Name from file
            self.assertEquals(router1.equals( strH),True)

            #// TEST from node config
            conf = Fconfig()
            conf.startXml( "testezlog.xml")
            router2.start( None, conf.getCurrent())
            self.assertEquals(router2.equals( strH),True)
            router1.end()
            router2.end()
Beispiel #3
0
    def createRoom(self):
        """/** Create a room with a structure defined by the config or node in start method */"""
        classInfos = {  'type':None,\
                'conf':None,\
                'lib':None,\
                'debug':None}

        linkInfos = {   'source':None,\
                'type':None,\
                'value':None,\
                'fields':None,\
                'dest':None}
        strH = FstringHash()
        port = Fport

        # search for rooms, boards, doors and programms
        def IMPORT_PORTS(A,B,CLASS):
            if self.Find(A,False) == RET_OK:
                while True:
                    self.pushCurrent()
                    # read informations
                    self.getClassInfos(classInfos)
                    # let's build and start this
                    # if both are None or strcasecmp
                    # TODO  ugliest code in this library
                    if ((classInfos['type']==None and B==None) or \
                            (B <> None and classInfos['type'] <> None\
                            and (classInfos['type'].upper() == B.upper()))):
                        childRoom = CLASS()
                        if classInfos['conf'] <> None:
                            childRoom.start(self,classInfos['conf'])
                        else:
                            childRoom.start(self,self.current)
                        ptr = self.listHash.addOrGet(childRoom)
                        if ptr <> None:
                            ptr = None
                            return RET_PORTEXIST
                    self.popCurrent()
                    # search for a next one
                    if self.FindNext(A,False) != RET_OK:
                        break

        self.resetCurrent()
        if self.gotoChildren() != RET_OK:
            return RET_NOINFOS
        # search and build
        IMPORT_PORTS( ES.XML_ROOM,None,Frouter)
        IMPORT_PORTS( ES.XML_ROOM,"ROOM",Frouter)
        IMPORT_PORTS( ES.XML_BOARD,None,FevenBoard)
        IMPORT_PORTS( ES.XML_BOARD,"BOARD",FevenBoard)

        IMPORT_PORTS( ES.XML_DOOR, "file", Fdoor_file)
        IMPORT_PORTS( ES.XML_DOOR, "cout", Fdoor_cout)
        IMPORT_PORTS( ES.XML_PRG, "concat", Fdoor_concat)

        # seach for <envenja_link>, if dosen't exists, create an evendata and send it
        if self.Find(ES.XML_LNK, False) != RET_OK:
            return RET_OK
        while True:
            self.pushCurrent()
            self.getLinkInfos(linkInfos)
            if linkInfos['source'] <> None:
                strH.setString(linkInfos['source'])
                port = self.listHash.Search(strH)
                # if this source has been built, send a ACT_SYS_ADDDEST msg
                if port <> None:
                    data = self.getFreeEvenData()
                    data.setData( ES.XML_LNKTYPE, linkInfos['type'])
                    data.setData( ES.XML_LNKVALUE, linkInfos['value'])
                    data.setData( ES.XML_LNKFIELDS, linkInfos['fields'])
                    data.setData( ES.XML_LNKDEST, linkInfos['dest'])

                    data.definePortAction( ES.ACT_SYS_ADDDEST, linkInfos['source'])
                    self.sendEvenDataSys(data,port)
            self.popCurrent()
            if self.FindNext( ES.XML_LNK,False) != RET_OK:
                break
        return RET_OK
Beispiel #4
0
#    global gvActionDestination1Data
#    global gvActionDestination2Data
#    global gvActionFollowDestination
#    global gvActionWait
#    global gvActionAdd
#    global gvActionUpdate
#    global gvActionDelete
#    global gvActionGet
#    global gvActionFind
#    global gvActionEnd
#    global gvActionError
#    global gvActionSysAddDest
#    global gvNoValues
#
gvActionNormal = FstringHash()
gvActionNormal.setString(ES.ACT_NORMAL)

gvActionDestination1Data = FstringHash()
gvActionDestination1Data.setString(ES.ACT_DESTINATION1DATA)

gvActionDestination2Data = FstringHash()
gvActionDestination2Data.setString(ES.ACT_DESTINATION2DATA)

gvActionFollowDestination = FstringHash()
gvActionFollowDestination.setString(ES.ACT_FOLLOWDESTINATION)

gvActionWait = FstringHash()
gvActionWait.setString(ES.ACT_WAIT)

gvActionAdd = FstringHash()
gvActionAdd.setString(ES.ACT_ADD)