コード例 #1
0
ファイル: ConnectionTest.py プロジェクト: angrycaptain19/dash
 def getConnections(self):
     connectors = []
     for k in self.outLinks.keys():
         connectors.append(Connector(k, False, self.getNextPort()))
     for k in self.inLinks.keys():
         connectors.append(Connector(k, True, self.getNextPort()))
     return connectors
コード例 #2
0
    def testConnection(self):
        compName = 'abc'
        compId = 123
        compHost = 'foo'

        comp = MockComponent(compName, compId, compHost)

        connType = 'xyz'
        connPort = 987

        conn = Connector(connType, True, connPort)

        ctn = Connection(conn, comp)

        expStr = '%s:%s#%d@%s:%d' % (connType, compName, compId, compHost,
                                     connPort)
        self.assertEquals(expStr, str(ctn),
                          'Expected "%s", not "%s"' % (expStr, str(ctn)))

        cMap = ctn.getMap()
        self.checkConnectionMap(connType, cMap, 'type')
        self.checkConnectionMap(compName, cMap, 'compName')
        self.checkConnectionMap(compId, cMap, 'compNum')
        self.checkConnectionMap(compHost, cMap, 'host')
        self.checkConnectionMap(connPort, cMap, 'port')
コード例 #3
0
    def testConnector(self):
        typeStr = 'abc'
        port = 123

        for isInput in (False, True):
            conn = Connector(typeStr, isInput, port)
            if isInput:
                expStr = '%d=>%s' % (port, typeStr)
            else:
                expStr = '%s=>' % typeStr
            self.assertEquals(expStr, str(conn),
                              'Expected "%s", not "%s"' % (expStr, str(conn)))
コード例 #4
0
    def connect(self, inputs):
        cDict = {}
        for data in inputs:
            comp = MockComponent(data[0], data[1], data[2])
            for cData in data[3:]:
                conn = Connector(cData[0], cData[1], cData[2])

                if not cDict.has_key(conn.type):
                    cDict[conn.type] = ConnTypeEntry(conn.type)
                cDict[conn.type].add(conn, comp)

        return cDict
コード例 #5
0
ファイル: CnCMiscTest.py プロジェクト: sourcery-ai-bot/dash
    def testConnector(self):
        typeStr = 'abc'
        port = 123

        for descrCh in (Connector.OUTPUT, Connector.INPUT):
            conn = Connector(typeStr, descrCh, port)
            if descrCh == Connector.INPUT:
                expStr = '%d=>%s' % (port, typeStr)
            else:
                expStr = '%s=>' % typeStr
            self.assertEquals(expStr, str(conn),
                              'Expected "%s", not "%s"' % (expStr, str(conn)))