示例#1
0
    def test_MultipleDevicesWithSameName(self):
        # Test that two different device managers can start devices with the same name

        # TODO We should check that these two actually have a device that has the same name
        # because, if someone changes the XML unwittingly then this test will pass
        # without really testing anything
        nb1, devMgr1 = self.launchDeviceManager(
            "/nodes/test_BasicTestDevice_node/DeviceManager.dcd.xml", debug=9)
        nb2, devMgr2 = self.launchDeviceManager(
            "/nodes/test_BasicTestDevice2_node/DeviceManager.dcd.xml", debug=9)

        self.assertEqual(len(self._domMgr._get_deviceManagers()), 2)
        for devMgr in self._domMgr._get_deviceManagers():
            self.assertEqual(len(devMgr._get_registeredDevices()), 1)

        # Although nothing in the spec specifies where a device is to be bound
        # ossie does /DomainName/DevicemgrName/DeviceName, so let's check that now
        # to ensure the behavior remains consistent
        dev1Name = URI.stringToName(scatest.getTestDomainName() +
                                    "/BasicTestDevice_node/BasicTestDevice1")
        dev2Name = URI.stringToName(scatest.getTestDomainName() +
                                    "/BasicTestDevice2_node/BasicTestDevice1")

        dev1 = self._root.resolve(dev1Name)._narrow(CF.Device)
        dev2 = self._root.resolve(dev2Name)._narrow(CF.Device)
        self.assertNotEqual(dev1, None)
        self.assertNotEqual(dev2, None)
示例#2
0
    def _test_BasicService(self, node, expected_name):
        devmgr_nb, devMgr = self.launchDeviceManager("/nodes/" + node +
                                                     "/DeviceManager.dcd.xml",
                                                     debug=1)
        self.assertEqual(len(devMgr._get_registeredServices()), 1)
        svc = devMgr._get_registeredServices()[0]
        self.assertNotEqual(svc, None)
        self.assertEqual(svc.serviceName, expected_name)
        self.assertNotEqual(svc.serviceObject, None)
        obj = svc.serviceObject
        obj = obj._narrow(CF.PropertySet)
        self.assertNotEqual(obj, None)

        # Check the name service to ensure the service is properly bound
        svcName = URI.stringToName(scatest.getTestDomainName() + "/" +
                                   expected_name)
        svcobj = self._root.resolve(svcName)._narrow(CF.PropertySet)
        self.assertNotEqual(svcobj, None)
        self.assert_(obj._is_equivalent(svcobj))

        # Check that all the parameters got set correctly
        props = obj.query([])
        d = dict([(p.id, any.from_any(p.value)) for p in props])
        self.assertEqual(d["SERVICE_NAME"], expected_name)
        self.assertEqual(d["DEVICE_MGR_IOR"],
                         self._orb.object_to_string(devMgr))
        self.assertEqual(d["PARAM1"], "ABCD")
        self.assertEqual(d["PARAM2"], 42)
        self.assertAlmostEqual(d["PARAM3"], 3.1459)
        self.assertEqual(d["PARAM4"], False)
        self.assertEqual(d["PARAM5"], "Hello World")
        self.assertEqual(d.has_key("PARAM6"), False)

        # Check that we unregister correctly
        os.kill(devmgr_nb.pid, signal.SIGTERM)

        svcName = URI.stringToName(scatest.getTestDomainName() + "/" +
                                   expected_name)
        time_begin = time.time()
        time_end = time.time()
        name_found = True
        while ((time_end - time_begin) < 2) and name_found:
            time_end = time.time()
            # Don't use assertRaises, so we can simplify things
            try:
                self._root.resolve(svcName)._narrow(CF.PropertySet)
                time.sleep(0.1)
            except CosNaming.NamingContext.NotFound:
                name_found = False
        if name_found:
            self.fail("Expected service to not exist in the naming service")
    def test_nodeBooterDomainNameFromDMD(self):
        """Test that we read the correct domainname from the DMD file, the test domain
        should have been created by the test runner"""
        domainName = scatest.getTestDomainName()
        # Test that we don't already have a bound domain
        try:
            domMgr = self._root.resolve(scatest.getDomainMgrURI())
            self.assertEqual(domMgr, None)
        except CosNaming.NamingContext.NotFound:
            pass # This exception is expected
        
        nb = Popen("../../control/framework/nodeBooter -D -debug 9 --nopersist", cwd=scatest.getSdrPath(), shell=True)
        
        time.sleep(5)
        # Test that the name exists and is a DomainManager
        domMgr = self._root.resolve(scatest.getDomainMgrURI())._narrow(CF.DomainManager)
        self.assertNotEqual(domMgr, None)

        # Kill the nodebooter
        os.kill(nb.pid, signal.SIGINT)
        time.sleep(5) # Give it time to shutdown
        self.assertEqual(nb.poll(), 0)

        # Test that we cleaned up the name; this should be automatic because
        # the naming context should be empty.
        try:
            domMgr = self._root.resolve(scatest.getDomainMgrURI())
            self.assertEqual(domMgr, None)
        except CosNaming.NamingContext.NotFound:
            pass # This exception is expected
    def test_nodeBooterDomainNameOverride(self):
        """Test that we can allow the user to override the domainname with the --domainname argument."""
        domainName = scatest.getTestDomainName()
        domainMgrURI = URI.stringToName("%s/%s" % (domainName, domainName))
        # Test that we don't already have a bound domain
        try:
            domMgr = self._root.resolve(domainMgrURI)
            self.assertEqual(domMgr, None)
        except CosNaming.NamingContext.NotFound:
            pass # This exception is expected

        nb = Popen("../../control/framework/nodeBooter -D --domainname %s -debug 9 --nopersist" % (domainName), cwd=scatest.getSdrPath(), shell=True)
        time.sleep(5)

        # Test that the name exists and is a DomainManager
        domMgr = self._root.resolve(domainMgrURI)._narrow(CF.DomainManager)
        self.assertNotEqual(domMgr, None)

        # Kill the nodebooter
        os.kill(nb.pid, signal.SIGINT)
        time.sleep(5) # Give it time to shutdown
        self.assertEqual(nb.poll(), 0)

        # Test that we cleaned up the name; this should be automatic because
        # the naming context should be empty.
        try:
            domMgr = self._root.resolve(domainMgrURI)
            self.assertEqual(domMgr, None)
        except CosNaming.NamingContext.NotFound:
            pass # This exception is expected
    def test_EventAppPortConnectionSIGINT(self):
        self.localEvent = threading.Event()
        self.eventFlag = False

        self._nb_domMgr, domMgr = self.launchDomainManager(endpoint="giop:tcp::5679", dbURI=self._dbfile)
        self._nb_devMgr, devMgr = self.launchDeviceManager("/nodes/test_EventPortTestDevice_node/DeviceManager.dcd.xml")

        domainName = scatest.getTestDomainName()
        domMgr.installApplication("/waveforms/PortConnectFindByDomainFinderEvent/PortConnectFindByDomainFinderEvent.sad.xml")
        appFact = domMgr._get_applicationFactories()[0]
        app = appFact.create(appFact._get_name(), [], [])
        app.start()

        # Kill the domainMgr
        os.kill(self._nb_domMgr.pid, signal.SIGINT)
        if not self.waitTermination(self._nb_domMgr, 5.0):
            self.fail("Domain Manager Failed to Die")

        # Restart the Domain Manager (which should restore the old channel)
        self._nb_domMgr, domMgr = self.launchDomainManager(endpoint="giop:tcp::5679", dbURI=self._dbfile)

        newappFact = domMgr._get_applicationFactories()
        self.assertEqual(len(newappFact), 0)

        apps = domMgr._get_applications()
        self.assertEqual(len(apps), 0)

        devMgrs = domMgr._get_deviceManagers()
        self.assertEqual(len(devMgrs), 0)
    def test_nodeBooterDomainNameOverride(self):
        """Test that we can allow the user to override the domainname with the --domainname argument."""
        domainName = scatest.getTestDomainName()
        domainMgrURI = URI.stringToName("%s/%s" % (domainName, domainName))
        # Test that we don't already have a bound domain
        try:
            domMgr = self._root.resolve(domainMgrURI)
            self.assertEqual(domMgr, None)
        except CosNaming.NamingContext.NotFound:
            pass # This exception is expected

        nb = Popen("../../control/framework/nodeBooter -D --domainname %s -debug 9 --nopersist" % (domainName), cwd=scatest.getSdrPath(), shell=True)
        domMgr = self.waitDomainManager(domainMgrURI)
        self.assertNotEqual(domMgr, None)

        # Kill the nodebooter
        os.kill(nb.pid, signal.SIGINT)
        self.assertPredicateWithWait(lambda: nb.poll() == 0)

        # Test that we cleaned up the name; this should be automatic because
        # the naming context should be empty.
        try:
            domMgr = self._root.resolve(domainMgrURI)
            self.assertEqual(domMgr, None)
        except CosNaming.NamingContext.NotFound:
            pass # This exception is expected
示例#7
0
    def test_EventAppPortConnectionSIGINT(self):
        self.localEvent = threading.Event()
        self.eventFlag = False

        self._nb_domMgr, domMgr = self.launchDomainManager(
            endpoint="giop:tcp::5679", dbURI=self._dbfile)
        self._nb_devMgr, devMgr = self.launchDeviceManager(
            "/nodes/test_EventPortTestDevice_node/DeviceManager.dcd.xml")

        domainName = scatest.getTestDomainName()
        domMgr.installApplication(
            "/waveforms/PortConnectFindByDomainFinderEvent/PortConnectFindByDomainFinderEvent.sad.xml"
        )
        appFact = domMgr._get_applicationFactories()[0]
        app = appFact.create(appFact._get_name(), [], [])
        app.start()

        # Kill the domainMgr
        os.kill(self._nb_domMgr.pid, signal.SIGINT)
        if not self.waitTermination(self._nb_domMgr, 5.0):
            self.fail("Domain Manager Failed to Die")

        # Restart the Domain Manager (which should restore the old channel)
        self._nb_domMgr, domMgr = self.launchDomainManager(
            endpoint="giop:tcp::5679", dbURI=self._dbfile)

        newappFact = domMgr._get_applicationFactories()
        self.assertEqual(len(newappFact), 0)

        apps = domMgr._get_applications()
        self.assertEqual(len(apps), 0)

        devMgrs = domMgr._get_deviceManagers()
        self.assertEqual(len(devMgrs), 0)
    def test_nodeBooterDomainNameFromDMD(self):
        """Test that we read the correct domainname from the DMD file, the test domain
        should have been created by the test runner"""
        domainName = scatest.getTestDomainName()
        # Test that we don't already have a bound domain
        try:
            domMgr = self._root.resolve(scatest.getDomainMgrURI())
            self.assertEqual(domMgr, None)
        except CosNaming.NamingContext.NotFound:
            pass # This exception is expected
        
        nb = Popen("../../control/framework/nodeBooter -D -debug 9 --nopersist", cwd=scatest.getSdrPath(), shell=True)
        domMgr = self.waitDomainManager(scatest.getDomainMgrURI())
        self.assertNotEqual(domMgr, None)

        # Kill the nodebooter
        os.kill(nb.pid, signal.SIGINT)
        self.assertPredicateWithWait(lambda: nb.poll() == 0)

        # Test that we cleaned up the name; this should be automatic because
        # the naming context should be empty.
        try:
            domMgr = self._root.resolve(scatest.getDomainMgrURI())
            self.assertEqual(domMgr, None)
        except CosNaming.NamingContext.NotFound:
            pass # This exception is expected
 def test_EventAppPortConnection(self):
     self.localEvent = threading.Event()
     self.eventFlag = False
     
     self._devBooter, self._devMgr = self.launchDeviceManager("/nodes/test_EventPortTestDevice_node/DeviceManager.dcd.xml", self._domMgr, debug=9)
     domainName = scatest.getTestDomainName()
     self._domMgr.installApplication("/waveforms/PortConnectFindByDomainFinderEvent/PortConnectFindByDomainFinderEvent.sad.xml")
     appFact = self._domMgr._get_applicationFactories()[0]
     app = appFact.create(appFact._get_name(), [], [])
     app.start()
     channelName = URI.stringToName("%s/%s" % (domainName, 'anotherChannel'))
     try:
         appChannel = self._root.resolve(channelName)._narrow(CosEventChannelAdmin__POA.EventChannel)
     except:
         self.assertEqual(False, True)
     else:
         self.assertEqual(True, True)
     
     # resolve the producer for the event
     supplier_admin = appChannel.for_suppliers()
     _proxy_consumer = supplier_admin.obtain_push_consumer()
     _supplier = Supplier_i()
     _proxy_consumer.connect_push_supplier(_supplier._this())
     
     # resolve the consumer for the event
     consumer_admin = appChannel.for_consumers()
     _proxy_supplier = consumer_admin.obtain_push_supplier()
     _consumer = Consumer_i(self)
     _proxy_supplier.connect_push_consumer(_consumer._this())
     
     _proxy_consumer.push(any.to_any("message"))
     self.localEvent.wait(5.0)
     self.assertEqual(self.eventFlag, True)
     
     app.releaseObject()
 def test_EventDevicePortConnection(self):
     self.localEvent = threading.Event()
     self.eventFlag = False
     
     self._devBooter, self._devMgr = self.launchDeviceManager("/nodes/test_EventPortTestDevice_node/DeviceManager.dcd.xml", self._domMgr, debug=9)
     time.sleep(1)   # this sleep is here for the connections to be established to the event service
     
     domainName = scatest.getTestDomainName()
     
     channelName = URI.stringToName("%s/%s" % (domainName, 'deviceEvent'))
     try:
         devChannel = self._root.resolve(channelName)._narrow(CosEventChannelAdmin__POA.EventChannel)
     except:
         self.assertEqual(False, True)
     else:
         self.assertEqual(True, True)
     
     # resolve the producer for the event
     supplier_admin = devChannel.for_suppliers()
     _proxy_consumer = supplier_admin.obtain_push_consumer()
     _supplier = Supplier_i()
     _proxy_consumer.connect_push_supplier(_supplier._this())
     
     # resolve the consumer for the event
     consumer_admin = devChannel.for_consumers()
     _proxy_supplier = consumer_admin.obtain_push_supplier()
     _consumer = ConsumerDevice_i(self)
     _proxy_supplier.connect_push_consumer(_consumer._this())
     
     _proxy_consumer.push(any.to_any("message device"))
     self.localEvent.wait(5.0)
     self.assertEqual(self.eventFlag, True)
    def _test_BasicService(self, node, expected_name):
        devmgr_nb, devMgr = self.launchDeviceManager("/nodes/"+node+"/DeviceManager.dcd.xml", debug=1)
        self.assertEqual(len(devMgr._get_registeredServices()), 1)
        svc = devMgr._get_registeredServices()[0]
        self.assertNotEqual(svc, None)
        self.assertEqual(svc.serviceName, expected_name)
        self.assertNotEqual(svc.serviceObject, None)
        obj = svc.serviceObject
        obj = obj._narrow(CF.PropertySet)
        self.assertNotEqual(obj, None)

        # Check the name service to ensure the service is properly bound
        svcName = URI.stringToName(scatest.getTestDomainName() + "/" + expected_name)
        svcobj = self._root.resolve(svcName)._narrow(CF.PropertySet)
        self.assertNotEqual(svcobj, None)
        self.assert_(obj._is_equivalent(svcobj))

        # Check that all the parameters got set correctly
        props = obj.query([])
        d = dict([(p.id, any.from_any(p.value)) for p in props])
        self.assertEqual(d["SERVICE_NAME"], expected_name)
        self.assertEqual(d["DEVICE_MGR_IOR"], self._orb.object_to_string(devMgr))
        self.assertEqual(d["PARAM1"], "ABCD")
        self.assertEqual(d["PARAM2"], 42)
        self.assertAlmostEqual(d["PARAM3"], 3.1459)
        self.assertEqual(d["PARAM4"], False)
        self.assertEqual(d["PARAM5"], "Hello World")
        self.assertEqual(d.has_key("PARAM6"), False)

        # Check that we unregister correctly
        os.kill(devmgr_nb.pid, signal.SIGTERM)

        svcName = URI.stringToName(scatest.getTestDomainName() + "/" + expected_name)
        time_begin = time.time()
        time_end = time.time()
        name_found = True
        while ((time_end - time_begin) < 2) and name_found:
            time_end = time.time()
            # Don't use assertRaises, so we can simplify things
            try:
                self._root.resolve(svcName)._narrow(CF.PropertySet)
                time.sleep(0.1)
            except CosNaming.NamingContext.NotFound:
                name_found = False
        if name_found:
            self.fail("Expected service to not exist in the naming service")
    def test_EventAppPortConnectionSIGQUIT(self):
        self.localEvent = threading.Event()
        self.eventFlag = False

        self._nb_domMgr, domMgr = self.launchDomainManager(endpoint="giop:tcp::5679", dbURI=self._dbfile)
        self._nb_devMgr, devMgr = self.launchDeviceManager("/nodes/test_EventPortTestDevice_node/DeviceManager.dcd.xml")

        domainName = scatest.getTestDomainName()
        domMgr.installApplication("/waveforms/PortConnectFindByDomainFinderEvent/PortConnectFindByDomainFinderEvent.sad.xml")
        appFact = domMgr._get_applicationFactories()[0]
        app = appFact.create(appFact._get_name(), [], [])
        app.start()

        # Kill the domainMgr
        os.kill(self._nb_domMgr.pid, signal.SIGQUIT)
        if not self.waitTermination(self._nb_domMgr, 5.0):
            self.fail("Domain Manager Failed to Die")

        # Restart the Domain Manager (which should restore the old channel)
        self._nb_domMgr, domMgr = self.launchDomainManager(endpoint="giop:tcp::5679", dbURI=self._dbfile)

        newappFact = domMgr._get_applicationFactories()[0]
        app2 = newappFact.create(appFact._get_name(), [], [])
        app2.start()
        channelName = URI.stringToName("%s/%s" % (domainName, 'anotherChannel'))
        try:
            appChannel = self._root.resolve(channelName)._narrow(CosEventChannelAdmin.EventChannel)
        except:
            self.assertEqual(False, True)
        else:
            self.assertEqual(True, True)

        # resolve the producer for the event
        supplier_admin = appChannel.for_suppliers()
        _proxy_consumer = supplier_admin.obtain_push_consumer()
        _supplier = Supplier_i()
        _proxy_consumer.connect_push_supplier(_supplier._this())

        # resolve the consumer for the event
        consumer_admin = appChannel.for_consumers()
        _proxy_supplier = consumer_admin.obtain_push_supplier()
        _consumer = Consumer_i(self)
        _proxy_supplier.connect_push_consumer(_consumer._this())

        # a flag is raised only when two responses come back (one for each running app)
        _proxy_consumer.push(any.to_any("message"))
        self.localEvent.wait(5.0)
        self.assertEqual(self.eventFlag, True)

        self.eventFlag = False
        # this step tests whether the number of subscribers to the channel is restored
        app2.releaseObject()

        self.localEvent.clear()
        _proxy_consumer.push(any.to_any("message"))
        self.localEvent.wait(5.0)
        self.assertEqual(self.eventFlag, True)
        app.releaseObject()
    def test_MultipleDevicesWithSameName(self):
        # Test that two different device managers can start devices with the same name

        # TODO We should check that these two actually have a device that has the same name
        # because, if someone changes the XML unwittingly then this test will pass
        # without really testing anything
        nb1, devMgr1 = self.launchDeviceManager("/nodes/test_BasicTestDevice_node/DeviceManager.dcd.xml", debug=9)
        nb2, devMgr2 = self.launchDeviceManager("/nodes/test_BasicTestDevice2_node/DeviceManager.dcd.xml", debug=9)

        self.assertEqual(len(self._domMgr._get_deviceManagers()), 2)
        for devMgr in self._domMgr._get_deviceManagers():
            self.assertEqual(len(devMgr._get_registeredDevices()), 1) 

        # Although nothing in the spec specifies where a device is to be bound
        # ossie does /DomainName/DevicemgrName/DeviceName, so let's check that now
        # to ensure the behavior remains consistent
        dev1Name = URI.stringToName(scatest.getTestDomainName() + "/BasicTestDevice_node/BasicTestDevice1")
        dev2Name = URI.stringToName(scatest.getTestDomainName() + "/BasicTestDevice2_node/BasicTestDevice1")

        dev1 = self._root.resolve(dev1Name)._narrow(CF.Device)
        dev2 = self._root.resolve(dev2Name)._narrow(CF.Device)
        self.assertNotEqual(dev1, None)
        self.assertNotEqual(dev2, None)
    def test_nodeBooterShutdown(self):
        """Test that nodeBooter correctly cleans up.
        In OSSIE 0.7.4, and possibly before, killing a nodebooter that was running
        a device manager would prevent you from restarting the devicemanager without
        first restarting the domainmanager.  Test that this condition is fixed"""
        #  It is important that these core pieces somewhat work for all the other tests to succeed
        nb1= Popen("../../control/framework/nodeBooter -D --nopersist", cwd=scatest.getSdrPath(), shell=True)
        domainName = scatest.getTestDomainName()

        domMgr = self.waitDomainManager(scatest.getDomainMgrURI())
        self.assertNotEqual(domMgr, None)
        self.assertEqual(len(domMgr._get_deviceManagers()), 0)

        nb2 = Popen("../../control/framework/nodeBooter -d /nodes/test_ExecutableDevice_node/DeviceManager.dcd.xml --domainname %s" % domainName, 
            cwd=scatest.getSdrPath(), shell=True)
        self.assertPredicateWithWait(lambda: len(domMgr._get_deviceManagers()) == 1)

        # Wait until the DeviceManager has finished launching its devices
        devMgr = domMgr._get_deviceManagers()[0]
        self.assertPredicateWithWait(lambda: len(devMgr._get_registeredDevices()) == 1)

        os.kill(nb2.pid, signal.SIGINT)
        self.assertPredicateWithWait(lambda: nb2.poll() != None)
        self.assertEqual(len(domMgr._get_deviceManagers()), 0)

        # Restart the device manager to prove that the shutdown was graceful.
        # In OSSIE 0.7.4 this would fail.
        nb3 = Popen("../../control/framework/nodeBooter -d /nodes/test_ExecutableDevice_node/DeviceManager.dcd.xml --domainname %s" % domainName, 
            cwd=scatest.getSdrPath(), shell=True)
        self.assertPredicateWithWait(lambda: len(domMgr._get_deviceManagers()) == 1)

        # Wait until the DeviceManager has finished launching its devices
        devMgr = domMgr._get_deviceManagers()[0]
        self.assertPredicateWithWait(lambda: len(devMgr._get_registeredDevices()) == 1)

        os.kill(nb3.pid, signal.SIGINT)
        self.assertPredicateWithWait(lambda: nb3.poll() != None)
        self.assertEqual(len(domMgr._get_deviceManagers()), 0)

        os.kill(nb1.pid, signal.SIGINT)
        self.assertPredicateWithWait(lambda: nb1.poll() != None)

        # Test that we cleaned up the name; this should be automatic because
        # the naming context should be empty.
        try:
            domMgr = self._root.resolve(scatest.getDomainMgrURI())
            self.assertEqual(domMgr, None)
        except CosNaming.NamingContext.NotFound:
            pass # This exception is expected
    def test_nodeBooterShutdownSIGQUIT(self):
        """Test that nodeBooter correctly cleans up.
        In OSSIE 0.7.4, and possibly before, killing a nodebooter that was running
        a device manager would prevent you from restarting the devicemanager without
        first restarting the domainmanager.  Test that this condition is fixed"""
        #  It is important that these core pieces somewhat work for all the other tests to succeed
        nb1= Popen("../../control/framework/nodeBooter -D -debug 9 --nopersist", cwd=scatest.getSdrPath(), shell=True)
        time.sleep(5) # Give it time to start

        domainName = scatest.getTestDomainName()
        domMgr = self._root.resolve(scatest.getDomainMgrURI())._narrow(CF.DomainManager)
        self.assertNotEqual(domMgr, None)
        self.assertEqual(len(domMgr._get_deviceManagers()), 0)

        nb2 = Popen("../../control/framework/nodeBooter -d /nodes/test_ExecutableDevice_node/DeviceManager.dcd.xml -debug 9 --domainname %s" % domainName, 
            cwd=scatest.getSdrPath(), shell=True)
        time.sleep(5) # Give it time to start
        self.assertEqual(len(domMgr._get_deviceManagers()), 1)

        os.kill(nb2.pid, signal.SIGQUIT)
        time.sleep(5) # Give it time to shutdown
        self.assertNotEqual(nb2.poll(), None)
        self.assertEqual(len(domMgr._get_deviceManagers()), 0)

        # Restart the device manager to prove that the shutdown was graceful.
        # In OSSIE 0.7.4 this would fail.
        nb3 = Popen("../../control/framework/nodeBooter -d /nodes/test_ExecutableDevice_node/DeviceManager.dcd.xml -debug 9 --domainname %s" % domainName, 
            cwd=scatest.getSdrPath(), shell=True)
        time.sleep(5) # Give it time to start
        self.assertEqual(len(domMgr._get_deviceManagers()), 1)

        os.kill(nb3.pid, signal.SIGQUIT)
        time.sleep(5) # Give it time to shutdown
        self.assertNotEqual(nb3.poll(), None)
        self.assertEqual(len(domMgr._get_deviceManagers()), 0)

        os.kill(nb1.pid, signal.SIGQUIT)
        time.sleep(5) # Give it time to shutdown
        self.assertNotEqual(nb1.poll(), None)

        # Test that we cleaned up the name; this should be automatic because
        # the naming context should be empty.
        try:
            domMgr = self._root.resolve(scatest.getDomainMgrURI())
            self.assertEqual(domMgr, None)
        except CosNaming.NamingContext.NotFound:
            pass # This exception is expected
 def test_registerWithEventChannel_creation(self):
     # launch DomainManager
     nodebooter, self._domMgr = self.launchDomainManager(debug=9)
     self.assertNotEqual(self._domMgr, None)
     self.gotData = False
     # set up consumer
     _consumer = Consumer_i(self)
     channelName = 'testChannel'
     self._domMgr.registerWithEventChannel(_consumer._this(), 'some_id', channelName)
     domainName = scatest.getTestDomainName()
     eventChannelURI = URI.stringToName("%s/%s" % (domainName, channelName))
     channel = self._root.resolve(eventChannelURI)._narrow(CosEventChannelAdmin.EventChannel)
     supplier_admin = channel.for_suppliers()
     proxy_consumer = supplier_admin.obtain_push_consumer()
     proxy_consumer.connect_push_supplier(None)
     proxy_consumer.push(any.to_any(True))
     begin_time = time.time()
     timeout = 5 # maximum of 5 seconds
     while ((time.time() - begin_time) < timeout) and not self.gotData:
         time.sleep(0.1)
     self.assertEqual(self.gotData, True)
     self._domMgr.unregisterFromEventChannel('some_id', channelName)
示例#17
0
 def test_registerWithEventChannel_creation(self):
     # launch DomainManager
     nodebooter, self._domMgr = self.launchDomainManager(debug=9)
     self.assertNotEqual(self._domMgr, None)
     self.gotData = False
     # set up consumer
     _consumer = Consumer_i(self)
     channelName = 'testChannel'
     self._domMgr.registerWithEventChannel(_consumer._this(), 'some_id',
                                           channelName)
     domainName = scatest.getTestDomainName()
     eventChannelURI = URI.stringToName("%s/%s" % (domainName, channelName))
     channel = self._root.resolve(eventChannelURI)._narrow(
         CosEventChannelAdmin.EventChannel)
     supplier_admin = channel.for_suppliers()
     proxy_consumer = supplier_admin.obtain_push_consumer()
     proxy_consumer.connect_push_supplier(None)
     proxy_consumer.push(any.to_any(True))
     begin_time = time.time()
     timeout = 5  # maximum of 5 seconds
     while ((time.time() - begin_time) < timeout) and not self.gotData:
         time.sleep(0.1)
     self.assertEqual(self.gotData, True)
     self._domMgr.unregisterFromEventChannel('some_id', channelName)
示例#18
0
    def test_EventAppPortConnectionSIGQUIT(self):
        self.localEvent = threading.Event()
        self.eventFlag = False

        self._nb_domMgr, domMgr = self.launchDomainManager(
            endpoint="giop:tcp::5679", dbURI=self._dbfile)
        self._nb_devMgr, devMgr = self.launchDeviceManager(
            "/nodes/test_EventPortTestDevice_node/DeviceManager.dcd.xml")

        domainName = scatest.getTestDomainName()
        domMgr.installApplication(
            "/waveforms/PortConnectFindByDomainFinderEvent/PortConnectFindByDomainFinderEvent.sad.xml"
        )
        appFact = domMgr._get_applicationFactories()[0]
        app = appFact.create(appFact._get_name(), [], [])
        app.start()

        # Kill the domainMgr
        os.kill(self._nb_domMgr.pid, signal.SIGQUIT)
        if not self.waitTermination(self._nb_domMgr, 5.0):
            self.fail("Domain Manager Failed to Die")

        # Restart the Domain Manager (which should restore the old channel)
        self._nb_domMgr, domMgr = self.launchDomainManager(
            endpoint="giop:tcp::5679", dbURI=self._dbfile)

        newappFact = domMgr._get_applicationFactories()[0]
        app2 = newappFact.create(appFact._get_name(), [], [])
        app2.start()
        channelName = URI.stringToName("%s/%s" %
                                       (domainName, 'anotherChannel'))
        try:
            appChannel = self._root.resolve(channelName)._narrow(
                CosEventChannelAdmin.EventChannel)
        except:
            self.assertEqual(False, True)
        else:
            self.assertEqual(True, True)

        # resolve the producer for the event
        supplier_admin = appChannel.for_suppliers()
        _proxy_consumer = supplier_admin.obtain_push_consumer()
        _supplier = Supplier_i()
        _proxy_consumer.connect_push_supplier(_supplier._this())

        # resolve the consumer for the event
        consumer_admin = appChannel.for_consumers()
        _proxy_supplier = consumer_admin.obtain_push_supplier()
        _consumer = Consumer_i(self)
        _proxy_supplier.connect_push_consumer(_consumer._this())

        # a flag is raised only when two responses come back (one for each running app)
        _proxy_consumer.push(any.to_any("message"))
        self.localEvent.wait(5.0)
        self.assertEqual(self.eventFlag, True)

        self.eventFlag = False
        # this step tests whether the number of subscribers to the channel is restored
        app2.releaseObject()

        self.localEvent.clear()
        _proxy_consumer.push(any.to_any("message"))
        self.localEvent.wait(5.0)
        self.assertEqual(self.eventFlag, True)
        app.releaseObject()
 def setUp(self):
     domBooter, self._domMgr = self.launchDomainManager(debug=9)
     devBooter, self._devMgr = self.launchDeviceManager("/nodes/test_ExecutableDevice_node/DeviceManager.dcd.xml", debug=9)
     self._rhDom = redhawk.attach(scatest.getTestDomainName())
     self.assertEquals(len(self._rhDom._get_applications()), 0)
    def test_ODMEvents_DeviceManager(self):
        # Test DeviceManager related events
        
        # launch DomainManager
        nodebooter, self._domMgr = self.launchDomainManager(debug=9)

        # connect to the channel
        domainName = scatest.getTestDomainName()
        channelManager = ChannelManager(self._orb)
        odmChannel = channelManager.getEventChannel('ODM_Channel', domainName)
        if odmChannel == None:
            self.fail("Could not connect to the ODM_Channel")

        
        # set up consumer
        consumer_admin = odmChannel.for_consumers()
        _proxy_supplier = consumer_admin.obtain_push_supplier()
        _consumer = ConsumerODM_i(self)
        _proxy_supplier.connect_push_consumer(_consumer._this())

        # start the device manager
        devBooter, devMgr = self.launchDeviceManager("/nodes/test_BasicTestDevice_node/DeviceManager.dcd.xml", debug=9)
        self.assertNotEqual(devMgr, None)

        timeout = 0.0
        while (_consumer.getAddedEventCount('DEVICE_MANAGER') < 1 and _consumer.getAddedEventCount('DEVICE') < 1 and timeout < 2):
            timeout += 0.2
            time.sleep(0.2)

        try:
            devMgr.shutdown()
        except CORBA.Exception:
            pass

        timeout = 0.0
        while (_consumer.getRemovedEventCount('DEVICE_MANAGER') < 1 and _consumer.getRemovedEventCount('DEVICE') < 1 and timeout < 2):
            timeout += 0.2
            time.sleep(0.2)

        # start the second device manager
        devBooter, devMgr = self.launchDeviceManager("/nodes/test_BasicService_node/DeviceManager.dcd.xml", debug=9)
        self.assertNotEqual(devMgr, None)

        timeout = 0.0
        while (_consumer.getAddedEventCount('DEVICE_MANAGER') < 2 and _consumer.getAddedEventCount('SERVICE') < 1 and timeout < 2):
            timeout += 0.2
            time.sleep(0.2)

        try:
            devMgr.shutdown()
        except CORBA.Exception:
            pass

        timeout = 0.0
        while (_consumer.getRemovedEventCount('DEVICE_MANAGER') < 2 and _consumer.getRemovedEventCount('SERVICE') < 1 and timeout < 2):
            timeout += 0.2
            time.sleep(0.2)


        self.assertEqual(_consumer.getAddedEventCount('DEVICE_MANAGER'), 2)
        self.assertEqual(_consumer.getAddedEventCount('DEVICE'), 1)
        self.assertEqual(_consumer.getAddedEventCount('SERVICE'), 1)
        self.assertEqual(_consumer.getRemovedEventCount('DEVICE_MANAGER'), 2)
        self.assertEqual(_consumer.getRemovedEventCount('DEVICE'), 1)
        self.assertEqual(_consumer.getRemovedEventCount('SERVICE'), 1)
        
        self.terminateChild(devBooter)
    def test_ServiceShutdown_DevMgr(self):
        num_services = 5
        num_devices = 1
        
        # This test makes sure that services are unregistered from the naming service upon shutdown of the DeviceManager
        devmgr_nb, devMgr = self.launchDeviceManager("/nodes/test_MultipleService_node/DeviceManager.dcd.xml", debug=9)
        self.assertEqual(len(devMgr._get_registeredServices()), num_services)
        
        # Makes sure that the correct number of processes forked
        self.assertEquals(len(getChildren(devmgr_nb.pid)), num_services + num_devices)
    
        svcName = URI.stringToName(scatest.getTestDomainName() + "/BasicService1")
        self._root.resolve(svcName)._narrow(CF.PropertySet)
        
        names = ["BasicService1", "BasicService2", "BasicService3", "BasicService4", "BasicService5"]

        for svc in devMgr._get_registeredServices():
            self.assertNotEqual(svc, None)
            self.assertEqual(svc.serviceName in names, True)
            names.remove(svc.serviceName)
            obj = svc.serviceObject
            obj = obj._narrow(CF.PropertySet)
            self.assertNotEqual(obj, None)

            # Check the name service to ensure the service is properly bound
            svcName = URI.stringToName(scatest.getTestDomainName() + "/" + svc.serviceName)
            svcobj = self._root.resolve(svcName)._narrow(CF.PropertySet)
            self.assertNotEqual(svcobj, None)
            self.assert_(obj._is_equivalent(svcobj))

            # Check that all the parameters got set correctly
            props = obj.query([])
            d = dict([(p.id, any.from_any(p.value)) for p in props])
            self.assertEqual(d["SERVICE_NAME"], svc.serviceName)
            self.assertEqual(d["DEVICE_MGR_IOR"], self._orb.object_to_string(devMgr))
            self.assertEqual(d["PARAM1"], "ABCD")
            self.assertEqual(d["PARAM2"], 42)
            self.assertEqual(d["PARAM3"], 3.1459)
            self.assertEqual(d["PARAM4"], False)
            self.assertEqual(d["PARAM5"], "Hello World")
            self.assertEqual(d.has_key("PARAM6"), False)

        # Check that we unregister correctly
        os.kill(devmgr_nb.pid, signal.SIGINT)

        names = ["BasicService1", "BasicService2", "BasicService3", "BasicService4", "BasicService5"]
        svcNames = []
        for n in names:
            svcNames.append(URI.stringToName(scatest.getTestDomainName() + "/" + n))
        
        # Needs to allow time for unregistering
        self.assert_(self.waitTermination(devmgr_nb), "Nodebooter did not die after shutdown")

        # Don't use assertRaises, so we can simplify things
        for name in svcNames:
            try:
                self._root.resolve(name)._narrow(CF.PropertySet)
            except CosNaming.NamingContext.NotFound:
                pass
            else:
                self.fail("Expected service to not exist in the naming service: " + str(name))
            
        # Makes sure that all children are dead
        self.assertEquals(len(getChildren(devmgr_nb.pid)), 0)
    def test_ExternalServices(self):
        devmgr_nb, devMgr = self.launchDeviceManager("/nodes/test_MultipleService_node/DeviceManager.dcd.xml", debug=9)
        
        import ossie.utils.popen as _popen

        serviceName = "BasicService10"

        args = []
        args.append("sdr/dev/services/BasicService/BasicService.py")
        args.append("DEVICE_MGR_IOR")
        args.append(self._orb.object_to_string(devMgr))
        args.append("SERVICE_NAME")
        args.append(serviceName)
        args.append("LOGGING_CONFIG_URI")
        args.append("runtest.props")
        args.append("PARAM1")
        args.append("ABCD")
        args.append("PARAM2")
        args.append("42")
        args.append("PARAM3")
        args.append("3.1459")
        args.append("PARAM4")
        args.append("False")
        args.append("PARAM5")
        args.append("Hello World")
        exec_file = "sdr/dev/services/BasicService/BasicService.py"
        external_process = _popen.Popen(args, executable=exec_file, cwd=os.getcwd(), preexec_fn=os.setpgrp)

        serviceName2 = "BasicService11"
        args[4] = serviceName2
        exec_file = "sdr/dev/services/BasicService/BasicService.py"
        external_process2 = _popen.Popen(args, executable=exec_file, cwd=os.getcwd(), preexec_fn=os.setpgrp)

        time.sleep(1)

        names = ["BasicService1", "BasicService2", "BasicService3", "BasicService4", "BasicService5", serviceName, serviceName2]   
        
        # Makes sure external service registered
        for svc in devMgr._get_registeredServices():
            self.assertNotEqual(svc, None)
            self.assertEqual(svc.serviceName in names, True)

            names.remove(svc.serviceName)
            obj = svc.serviceObject
            obj = obj._narrow(CF.PropertySet)
            self.assertNotEqual(obj, None)
            
            # Check the name service to ensure the service is properly bound
            svcName = URI.stringToName(scatest.getTestDomainName() + "/" + svc.serviceName)
            svcobj = self._root.resolve(svcName)._narrow(CF.PropertySet)
            self.assertNotEqual(svcobj, None)
            self.assert_(obj._is_equivalent(svcobj))
            
            # Check that all the parameters got set correctly
            props = obj.query([])
            d = dict([(p.id, any.from_any(p.value)) for p in props])
            self.assertEqual(d["SERVICE_NAME"], svc.serviceName)
            self.assertEqual(d["DEVICE_MGR_IOR"], self._orb.object_to_string(devMgr))
            self.assertEqual(d["PARAM1"], "ABCD")
            self.assertEqual(d["PARAM2"], 42)
            self.assertEqual(d["PARAM3"], 3.1459)
            self.assertEqual(d["PARAM4"], False)
            self.assertEqual(d["PARAM5"], "Hello World")
            self.assertEqual(d.has_key("PARAM6"), False)

        # Make sure a component can communicate with the Service
        self._domMgr.installApplication("/waveforms/ServiceConnection/ServiceConnection.sad.xml")
        self.assertEquals(len(self._domMgr._get_applicationFactories()), 1)
        factory = self._domMgr._get_applicationFactories()[0]
        app = factory.create(factory._get_name(), [], [])
        self.assertEquals(len(self._domMgr._get_applications()), 1)    
              
        # Make sure an app that uses external services can launch
        app.start()
        port = app._get_registeredComponents()[0].componentObject.getPort("output") 
        app.releaseObject()

        # Kill the 2 external services
        os.kill(external_process.pid, signal.SIGINT)
        os.kill(external_process2.pid, signal.SIGINT)
        
        # Give time for kill signals to be caught
        time.sleep(1)
        os.kill(devmgr_nb.pid, signal.SIGINT)
                
        # Make sure services are no longer register with the domain manager
        names = ["BasicService1", "BasicService2", "BasicService3", "BasicService4", "BasicService5", serviceName, serviceName2]  
        svcNames = []
        for n in names:
            svcNames.append(URI.stringToName(scatest.getTestDomainName() + "/" + n))
        
        # Needs to allow time for unregistering
        self.assert_(self.waitTermination(devmgr_nb), "Nodebooter did not die after shutdown")
        
        # Don't use assertRaises, so we can simplify things
        for name in svcNames:
            try:
                self._root.resolve(name)._narrow(CF.PropertySet)
            except CosNaming.NamingContext.NotFound:
                pass
            else:
                self.fail("Expected service to not exist in the naming service") 
        
        # Makes sure all children are cleaned
        self.assertEquals(len(getChildren(devmgr_nb.pid)), 0)
示例#23
0
    def test_ExternalServices(self):
        devmgr_nb, devMgr = self.launchDeviceManager(
            "/nodes/test_MultipleService_node/DeviceManager.dcd.xml", debug=9)

        import ossie.utils.popen as _popen

        serviceName = "BasicService10"

        args = []
        args.append("sdr/dev/services/BasicService/BasicService.py")
        args.append("DEVICE_MGR_IOR")
        args.append(self._orb.object_to_string(devMgr))
        args.append("SERVICE_NAME")
        args.append(serviceName)
        args.append("LOGGING_CONFIG_URI")
        args.append("runtest.props")
        args.append("PARAM1")
        args.append("ABCD")
        args.append("PARAM2")
        args.append("42")
        args.append("PARAM3")
        args.append("3.1459")
        args.append("PARAM4")
        args.append("False")
        args.append("PARAM5")
        args.append("Hello World")
        exec_file = "sdr/dev/services/BasicService/BasicService.py"
        external_process = _popen.Popen(args,
                                        executable=exec_file,
                                        cwd=os.getcwd(),
                                        preexec_fn=os.setpgrp)

        serviceName2 = "BasicService11"
        args[4] = serviceName2
        exec_file = "sdr/dev/services/BasicService/BasicService.py"
        external_process2 = _popen.Popen(args,
                                         executable=exec_file,
                                         cwd=os.getcwd(),
                                         preexec_fn=os.setpgrp)

        time.sleep(1)

        names = [
            "BasicService1", "BasicService2", "BasicService3", "BasicService4",
            "BasicService5", serviceName, serviceName2
        ]

        # Makes sure external service registered
        for svc in devMgr._get_registeredServices():
            self.assertNotEqual(svc, None)
            self.assertEqual(svc.serviceName in names, True)

            names.remove(svc.serviceName)
            obj = svc.serviceObject
            obj = obj._narrow(CF.PropertySet)
            self.assertNotEqual(obj, None)

            # Check the name service to ensure the service is properly bound
            svcName = URI.stringToName(scatest.getTestDomainName() + "/" +
                                       svc.serviceName)
            svcobj = self._root.resolve(svcName)._narrow(CF.PropertySet)
            self.assertNotEqual(svcobj, None)
            self.assert_(obj._is_equivalent(svcobj))

            # Check that all the parameters got set correctly
            props = obj.query([])
            d = dict([(p.id, any.from_any(p.value)) for p in props])
            self.assertEqual(d["SERVICE_NAME"], svc.serviceName)
            self.assertEqual(d["DEVICE_MGR_IOR"],
                             self._orb.object_to_string(devMgr))
            self.assertEqual(d["PARAM1"], "ABCD")
            self.assertEqual(d["PARAM2"], 42)
            self.assertEqual(d["PARAM3"], 3.1459)
            self.assertEqual(d["PARAM4"], False)
            self.assertEqual(d["PARAM5"], "Hello World")
            self.assertEqual(d.has_key("PARAM6"), False)

        # Make sure a component can communicate with the Service
        self._domMgr.installApplication(
            "/waveforms/ServiceConnection/ServiceConnection.sad.xml")
        self.assertEquals(len(self._domMgr._get_applicationFactories()), 1)
        factory = self._domMgr._get_applicationFactories()[0]
        app = factory.create(factory._get_name(), [], [])
        self.assertEquals(len(self._domMgr._get_applications()), 1)

        # Make sure an app that uses external services can launch
        app.start()
        port = app._get_registeredComponents()[0].componentObject.getPort(
            "output")
        app.releaseObject()

        # Kill the 2 external services
        os.kill(external_process.pid, signal.SIGINT)
        os.kill(external_process2.pid, signal.SIGINT)

        # Give time for kill signals to be caught
        time.sleep(1)
        os.kill(devmgr_nb.pid, signal.SIGINT)

        # Make sure services are no longer register with the domain manager
        names = [
            "BasicService1", "BasicService2", "BasicService3", "BasicService4",
            "BasicService5", serviceName, serviceName2
        ]
        svcNames = []
        for n in names:
            svcNames.append(
                URI.stringToName(scatest.getTestDomainName() + "/" + n))

        # Needs to allow time for unregistering
        self.assert_(self.waitTermination(devmgr_nb),
                     "Nodebooter did not die after shutdown")

        # Don't use assertRaises, so we can simplify things
        for name in svcNames:
            try:
                self._root.resolve(name)._narrow(CF.PropertySet)
            except CosNaming.NamingContext.NotFound:
                pass
            else:
                self.fail(
                    "Expected service to not exist in the naming service")

        # Makes sure all children are cleaned
        self.assertEquals(len(getChildren(devmgr_nb.pid)), 0)
示例#24
0
    def test_ServiceShutdown_DomMgr(self):
        num_services = 5
        num_devices = 1
        # This test makes sure that services are unregistered from the naming service upon shutdown of the DomainManager
        devmgr_nb, devMgr = self.launchDeviceManager(
            "/nodes/test_MultipleService_node/DeviceManager.dcd.xml", debug=9)
        timeout = 5
        begin_time = time.time()
        done = False
        while not done:
            current_time = time.time()
            if (current_time - begin_time) > timeout:
                break
            if len(devMgr._get_registeredServices()) == num_services:
                break
        self.assertEqual(len(devMgr._get_registeredServices()), num_services)

        # Makes sure that the correct number of processes forked
        self.assertEquals(len(getChildren(devmgr_nb.pid)),
                          num_services + num_devices)

        svcName = URI.stringToName(scatest.getTestDomainName() +
                                   "/BasicService1")
        self._root.resolve(svcName)._narrow(CF.PropertySet)

        names = [
            "BasicService1", "BasicService2", "BasicService3", "BasicService4",
            "BasicService5"
        ]

        for svc in devMgr._get_registeredServices():
            self.assertNotEqual(svc, None)
            self.assertEqual(svc.serviceName in names, True)
            names.remove(svc.serviceName)
            obj = svc.serviceObject
            obj = obj._narrow(CF.PropertySet)
            self.assertNotEqual(obj, None)

            # Check the name service to ensure the service is properly bound
            svcName = URI.stringToName(scatest.getTestDomainName() + "/" +
                                       svc.serviceName)
            svcobj = self._root.resolve(svcName)._narrow(CF.PropertySet)
            self.assertNotEqual(svcobj, None)
            self.assert_(obj._is_equivalent(svcobj))

            # Check that all the parameters got set correctly
            props = obj.query([])
            d = dict([(p.id, any.from_any(p.value)) for p in props])
            self.assertEqual(d["SERVICE_NAME"], svc.serviceName)
            self.assertEqual(d["DEVICE_MGR_IOR"],
                             self._orb.object_to_string(devMgr))
            self.assertEqual(d["PARAM1"], "ABCD")
            self.assertEqual(d["PARAM2"], 42)
            self.assertEqual(d["PARAM3"], 3.1459)
            self.assertEqual(d["PARAM4"], False)
            self.assertEqual(d["PARAM5"], "Hello World")
            self.assertEqual(d.has_key("PARAM6"), False)

        # Check that we unregister correctly
        os.kill(self._domBooter.pid, signal.SIGINT)

        names = [
            "BasicService1", "BasicService2", "BasicService3", "BasicService4",
            "BasicService5"
        ]
        svcNames = []
        for n in names:
            svcNames.append(
                URI.stringToName(scatest.getTestDomainName() + "/" + n))

        # Needs to allow time for unregistering
        self.assert_(self.waitTermination(self._domBooter),
                     "Nodebooter did not die after shutdown")

        # Don't use assertRaises, so we can simplify things
        for name in svcNames:
            try:
                self._root.resolve(name)._narrow(CF.PropertySet)
            except CosNaming.NamingContext.NotFound:
                pass
            else:
                self.fail(
                    "Expected service to not exist in the naming service: " +
                    str(name))

        # Makes sure that all children are dead
        self.assertEquals(len(getChildren(devmgr_nb.pid)), 0)
 def setUp(self):
     domBooter, self._domMgr = self.launchDomainManager(debug=9)
     devBooter, self._devMgr = self.launchDeviceManager("/nodes/test_ExecutableDevice_node/DeviceManager.dcd.xml", debug=9)
     self._rhDom = redhawk.attach(scatest.getTestDomainName())
     self.assertEquals(len(self._rhDom._get_applications()), 0)
示例#26
0
    def test_ODMEvents_DeviceManager(self):
        # Test DeviceManager related events

        # launch DomainManager
        nodebooter, self._domMgr = self.launchDomainManager(debug=9)

        # connect to the channel
        domainName = scatest.getTestDomainName()
        channelManager = ChannelManager(self._orb)
        odmChannel = channelManager.getEventChannel('ODM_Channel', domainName)
        if odmChannel == None:
            self.fail("Could not connect to the ODM_Channel")

        # set up consumer
        consumer_admin = odmChannel.for_consumers()
        _proxy_supplier = consumer_admin.obtain_push_supplier()
        _consumer = ConsumerODM_i(self)
        _proxy_supplier.connect_push_consumer(_consumer._this())

        # start the device manager
        devBooter, devMgr = self.launchDeviceManager(
            "/nodes/test_BasicTestDevice_node/DeviceManager.dcd.xml", debug=9)
        self.assertNotEqual(devMgr, None)

        timeout = 0.0
        while ((_consumer.getAddedEventCount('DEVICE_MANAGER') < 1
                or _consumer.getAddedEventCount('DEVICE') < 1)
               and timeout < 2):
            timeout += 0.2
            time.sleep(0.2)

        try:
            devMgr.shutdown()
        except CORBA.Exception:
            pass

        timeout = 0.0
        while ((_consumer.getRemovedEventCount('DEVICE_MANAGER') < 1
                or _consumer.getRemovedEventCount('DEVICE') < 1)
               and timeout < 2):
            timeout += 0.2
            time.sleep(0.2)

        # start the second device manager
        devBooter, devMgr = self.launchDeviceManager(
            "/nodes/test_BasicService_node/DeviceManager.dcd.xml", debug=9)
        self.assertNotEqual(devMgr, None)

        timeout = 0.0
        while ((_consumer.getAddedEventCount('DEVICE_MANAGER') < 2
                or _consumer.getAddedEventCount('SERVICE') < 1)
               and timeout < 2):
            timeout += 0.2
            time.sleep(0.2)

        try:
            devMgr.shutdown()
        except CORBA.Exception:
            pass

        timeout = 0.0
        while ((_consumer.getRemovedEventCount('DEVICE_MANAGER') < 2
                or _consumer.getRemovedEventCount('SERVICE') < 1)
               and timeout < 2):
            timeout += 0.2
            time.sleep(0.2)

        self.assertEqual(_consumer.getAddedEventCount('DEVICE_MANAGER'), 2)
        self.assertEqual(_consumer.getAddedEventCount('DEVICE'), 1)
        self.assertEqual(_consumer.getAddedEventCount('SERVICE'), 1)
        self.assertEqual(_consumer.getRemovedEventCount('DEVICE_MANAGER'), 2)
        self.assertEqual(_consumer.getRemovedEventCount('DEVICE'), 1)
        self.assertEqual(_consumer.getRemovedEventCount('SERVICE'), 1)

        self.terminateChild(devBooter)