test_09_DomainPersistence.py 文件源码

python
阅读 43 收藏 0 点赞 0 评论 0

项目:core-framework 作者: RedhawkSDR 项目源码 文件源码
def test_ApplicationUsesDevice(self):
        self._nb_domMgr, self._domMgr = self.launchDomainManager(endpoint="giop:tcp::5679", dbURI=self._dbfile)
        self._nb_devMgr, devMgr = self.launchDeviceManager("/nodes/test_SADUsesDevice/DeviceManager.dcd.xml")

        self._domMgr.installApplication("/waveforms/SADUsesDeviceWave/SADUsesDeviceWaveExternalSimple.sad.xml")
        appFact = self._domMgr._get_applicationFactories()[0]
        app = appFact.create(appFact._get_name(), [], [])

        # Make sure that the allocation was made to the device
        prop = CF.DataType(id='simple_alloc', value=any.to_any(None))
        for dev in devMgr._get_registeredDevices():
            if dev._get_label() == 'SADUsesDevice_1':
                allocRes = dev.query([prop])
        self.assertEquals(allocRes[0].value.value(), 8)

        # Kill the domainMgr
        os.kill(self._nb_domMgr.pid, signal.SIGTERM)

        # TODO if SIGKILL is used (simulating a nodeBooter unexpected abort,
        # the IOR and the newly spawned domain manager do not work
        if not self.waitTermination(self._nb_domMgr):
            self.fail("Domain Manager Failed to Die")

        # Start the domainMgr again
        self._nb_domMgr, newDomMgr = self.launchDomainManager(endpoint="giop:tcp::5679", dbURI=self._dbfile)

        # Capacity still allocated to device
        prop = CF.DataType(id='simple_alloc', value=any.to_any(None))
        for dev in devMgr._get_registeredDevices():
            if dev._get_label() == 'SADUsesDevice_1':
                allocRes = dev.query([prop])
        self.assertEquals(allocRes[0].value.value(), 8)

        # Release app to free up device capacity to make sure usesdevicecapacties was properly restored
        newApp = newDomMgr._get_applications()[0]
        newApp.releaseObject()
        prop = CF.DataType(id='simple_alloc', value=any.to_any(None))
        for dev in devMgr._get_registeredDevices():
            if dev._get_label() == 'SADUsesDevice_1':
                allocRes = dev.query([prop])
        self.assertEquals(allocRes[0].value.value(), 10)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号