From: Naoki Kambe Date: Wed, 1 Aug 2012 10:13:08 +0000 (+0900) Subject: [2136] Introduced an address() method for the Component classes X-Git-Tag: trac2351_base~112^2~26 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=5fa38c20028899696a48c1a3b8edf54918cd252b;p=thirdparty%2Fkea.git [2136] Introduced an address() method for the Component classes It returns the "_address" attribute of the classes. This is used for the "show_processes" command of Boss to provide address information. --- diff --git a/src/lib/python/isc/bind10/component.py b/src/lib/python/isc/bind10/component.py index da2730c85f..9c29ace589 100644 --- a/src/lib/python/isc/bind10/component.py +++ b/src/lib/python/isc/bind10/component.py @@ -371,6 +371,14 @@ class BaseComponent: """ pass + def address(self): + """ + Provides the name of the address used on the message bus + + You need to provide this method in a concrete implementation. + """ + pass + class Component(BaseComponent): """ The most common implementation of a component. It can be used either @@ -454,6 +462,12 @@ class Component(BaseComponent): else: self._procinfo.process.terminate() + def address(self): + """ + Returns the name of the address used on the message bus + """ + return self._address + class Configurator: """ This thing keeps track of configuration changes and starts and stops diff --git a/src/lib/python/isc/bind10/tests/component_test.py b/src/lib/python/isc/bind10/tests/component_test.py index af529f867e..3f26870452 100644 --- a/src/lib/python/isc/bind10/tests/component_test.py +++ b/src/lib/python/isc/bind10/tests/component_test.py @@ -164,6 +164,13 @@ class ComponentTests(BossUtils, unittest.TestCase): component = self.__create_component('core') self.assertEqual('No process', component.name()) + def test_address(self): + """ + Test the address provides whatever we passed to the constructor as process. + """ + component = self.__create_component('core') + self.assertEqual("homeless", component.address()) + def test_guts(self): """ Test the correct data are stored inside the component.