test_09_DomainPersistence.py 文件源码

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

项目:core-framework 作者: RedhawkSDR 项目源码 文件源码
def test_ServicesRestored(self):
        domBooter, domMgr = self.launchDomainManager(endpoint="giop:tcp::5679", dbURI=self._dbfile)
        devBooter, devMgr = self.launchDeviceManager("/nodes/test_PortTestDevice_node/DeviceManager.dcd.xml")
        svcBooter, svcMgr = self.launchDeviceManager("/nodes/test_BasicService_node/DeviceManager.dcd.xml")

        # Make sure that the service node is up before killing the domain manager
        while len(svcMgr._get_registeredServices()) != 1:
            time.sleep(0.1)

        # Forcibly terminate the domain manager to simulate a crash
        os.kill(domBooter.pid, signal.SIGKILL)
        if not self.waitTermination(domBooter):
            self.fail("DomainManager failed to die")

        # Restart the domain manager
        domBooter, domMgr = self.launchDomainManager(endpoint="giop:tcp::5679", dbURI=self._dbfile)

        # Check that the domain manager reconnected to the device managers.
        self.assertEqual(len(domMgr._get_deviceManagers()), 2)

        # Install the PortConnectServiceName application and try to create an
        # instance to verify that the domain manager is still aware of the services
        # that had previously been registered.
        domMgr.installApplication("/waveforms/PortConnectServiceName/PortConnectServiceName.sad.xml")
        self.assertEqual(len(domMgr._get_applicationFactories()), 1)
        appFact = domMgr._get_applicationFactories()[0]
        try:
            app = appFact.create(appFact._get_name(), [], [])
        except CF.ApplicationFactory.CreateApplicationError:
            self.fail("Unable to create application with service connection")

        # The BasicService provides a PropertySet interface, so verify that some
        # properties are returned from the service test of the PortTest component.
        testResults = app.runTest(1, [])
        self.assertNotEqual(len(testResults), 0)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号