def install_exception_handlers(): config.REMOTE_CALL_RETRY = 0 # wait 2^N seconds (N=5 -> approx 1 minute) # default handlers for remote calls errors def handle_REMOTE_CALL_ERROR(program,retries, exc): if retries >= config.REMOTE_CALL_RETRY: return False logger.warning('REMOTE_CALL_ERROR handler: waiting %ds %s',1<<retries,repr(exc)) time.sleep(1<<retries) return True omniORB.installTransientExceptionHandler(program,handle_REMOTE_CALL_ERROR) omniORB.installCommFailureExceptionHandler(program,handle_REMOTE_CALL_ERROR)
def disconnect_push_consumer (self): pass # if SIGKILL is used (simulating a nodeBooter unexpected abort) # the next attempt to communicate with the domain manager will # throw a COMM_FAILURE because the connection died unexpectedly # Clients that hold references to the DomainManager should # include code similar to that below def comm_failure_retry(cookie, n_retries, exception): # For the purposes of the unit test, only allow 1 retry if n_retries == 0: return True else: return False omniORB.installCommFailureExceptionHandler(None, comm_failure_retry) class DomainPersistenceTest(scatest.CorbaTestCase): def setUp(self): self._dbfile = tempfile.mktemp() def tearDown(self): scatest.CorbaTestCase.tearDown(self) try: os.remove(self._dbfile) except OSError: pass def test_BasicOperation(self): self._nb_domMgr, self._domMgr = self.launchDomainManager(endpoint="giop:tcp::5679", dbURI=self._dbfile) self._nb_devMgr, devMgr = self.launchDeviceManager("/nodes/test_PortTestDevice_node/DeviceManager.dcd.xml")
# if SIGKILL is used (simulating a nodeBooter unexpected abort) # the next attempt to communicate with the domain manager will # throw a COMM_FAILURE because the connection died unexpectedly # Clients that hold references to the DomainManager should # include code similar to that below def comm_failure_retry(cookie, n_retries, exception): # For the purposes of the unit test, only allow 1 retry if n_retries == 0: return True else: return False omniORB.installCommFailureExceptionHandler(None, comm_failure_retry) @scatest.requirePersistence class DomainPersistenceTest(scatest.CorbaTestCase): def setUp(self): self._dbfile = tempfile.mktemp() def tearDown(self): scatest.CorbaTestCase.tearDown(self) try: os.remove(self._dbfile) except OSError: pass def test_BasicOperation(self):
return False else: return True def systemFailure(cookie, retries, exc): if retries > 5: return False else: return True ENCODING = 'utf-8' cookie = None omniORB.installTransientExceptionHandler(cookie, transientFailure) omniORB.installCommFailureExceptionHandler(cookie, commFailure) omniORB.installSystemExceptionHandler(cookie, systemFailure) importIDL(whois.conf.get('corba', 'idl')) ccReg = sys.modules['ccReg'] registry = sys.modules['Registry'] # CORBA end def convertProperties(props, output): cproperties = [] if not props: return cproperties for key, value in props.iteritems(): if type(value) is unicode:
return True def systemFailure(cookie, retries, exc): if retries > 5: return False else: return True ENCODING = 'utf-8' cookie = None omniORB.installTransientExceptionHandler(cookie, transientFailure) omniORB.installCommFailureExceptionHandler(cookie, commFailure) omniORB.installSystemExceptionHandler(cookie, systemFailure) importIDL(whois.conf.get('corba', 'idl')) ccReg = sys.modules['ccReg'] registry = sys.modules['Registry'] # CORBA end def convertProperties(props, output): cproperties = [] if not props: return cproperties for key, value in props.iteritems():