def run(self): communication_service = Communication(host=self._master_hostname, port=self._master_port, service_name=self._name, server=False) communication_service.startup() self._services['CommunicationService'] = communication_service communication_service.register('CommunicationService', communication_service.get_queue()) #heartbeat_service = HeartBeatService(communication_service=communication_service, interval=10) #communication_service.register('HeartBeatService', heartbeat_service.get_queue()) #heartbeat_service.startup() #self._services['HeartBeatService'] = heartbeat_service storage_service = StorageService(directory=self._data_directory, communication_service=communication_service) communication_service.register('StorageService', storage_service.get_queue()) storage_service.startup() self._services['StorageService'] = storage_service index_service = IndexService(block_size=1024, index_directory=self._index_directory, communication_service=communication_service) communication_service.register('IndexService', index_service.get_queue()) index_service.startup() self._services['IndexService'] = index_service node = Node() node._id = 1 node._type = 'Person' node._properties['Name'] = 'Sagar' node._properties['Age'] = 21 add_node = AddNode(node)
class TestCommunicationService(unittest.TestCase): def setUp(self): logging.basicConfig(format='%(asctime)s\t%(levelname)-10s\t%(threadName)-32s\t%(name)-32s\t%(message)s', level=logging.DEBUG, datefmt='%Y-%m-%d %H:%M:%S') self.master = Communication(host='localhost', port=4545, service_name='Master', server=True) self.worker = Communication(host='localhost', port=4545, service_name='Worker', server=False) self.masterq = Queue() self.workerq = Queue() self.master.register('Q', self.masterq) self.worker.register('Q', self.workerq) self.master.startup() self.worker.startup() time.sleep(2) def test_send_string(self): self.master.send('Worker', 'Q', 'Hello World') message = self.workerq.get() self.assertEqual(message, 'Hello World') self.worker.send('Master', 'Q', 'Hello World') message = self.masterq.get() self.assertEqual(message, 'Hello World') def test_send_numbers(self): self.master.send('Worker', 'Q', 1234) message = self.workerq.get() self.assertEqual(message, 1234) self.worker.send('Master', 'Q', 12.34) message = self.masterq.get() self.assertEqual(message, 12.34) def tearDown(self): self.worker.shutdown() self.master.shutdown()
def run(self): communication_service = Communication(host='localhost', port=4545, service_name='Master', server=True) communication_service.startup() self._services['CommunicationService'] = communication_service communication_service.register('CommunicationService', communication_service.get_queue()) heartbeat_service = HeartBeatService(communication_service=communication_service, interval=5) communication_service.register('HeartBeatService', heartbeat_service.get_queue()) heartbeat_service.startup() self._services['HeartBeatService'] = heartbeat_service
def run(self): communication_service = Communication(host='localhost', port=4545, service_name='Worker', server=False) communication_service.startup() self._services['CommunicationService'] = communication_service communication_service.register('CommunicationService', communication_service.get_queue()) heartbeat_service = HeartBeatService(communication_service=communication_service, interval=5) communication_service.register('HeartBeatService', heartbeat_service.get_queue()) heartbeat_service.startup() self._services['HeartBeatService'] = heartbeat_service storage_service = StorageService(directory="C:\\Users\\Sagar\\PycharmProjects\\pygraphdb\\pygraphdb", communication_service=communication_service) communication_service.register('StorageService', storage_service.get_queue()) storage_service.startup() self._services['StorageService'] = storage_service
def run(self): communication_service = Communication(host='localhost', port=4545, service_name='Master', server=True) communication_service.startup() self._services['CommunicationService'] = communication_service communication_service.register('CommunicationService', communication_service.get_queue()) heartbeat_service = HeartBeatService( communication_service=communication_service, interval=5) communication_service.register('HeartBeatService', heartbeat_service.get_queue()) heartbeat_service.startup() self._services['HeartBeatService'] = heartbeat_service
def run(self): communication_service = Communication(host=self._hostname, port=self._port, service_name=self._name, server=True) communication_service.startup() self._services['CommunicationService'] = communication_service communication_service.register('CommunicationService', communication_service.get_queue()) #heartbeat_service = HeartBeatService(communication_service=communication_service, interval=10) #communication_service.register('HeartBeatService', heartbeat_service.get_queue()) #heartbeat_service.startup() #self._services['HeartBeatService'] = heartbeat_service client_listener = ClientListener(communication_service=communication_service, queryport=5454) client_listener.startup() self._services['ClientListener'] = client_listener query_processor = QueryProcessor(communication_service=communication_service) query_processor.startup() communication_service.register('QueryProcessor', query_processor.get_queue()) self._services['QueryProcessor'] = query_processor query_planner = QueryPlanner(query_processor=query_processor, communication_service=communication_service) query_planner.startup() communication_service.register('QueryPlanner', query_planner.get_queue()) self._services['QueryPlanner'] = query_planner
def run(self): communication_service = Communication(host='localhost', port=4545, service_name='Worker', server=False) communication_service.startup() self._services['CommunicationService'] = communication_service communication_service.register('CommunicationService', communication_service.get_queue()) heartbeat_service = HeartBeatService( communication_service=communication_service, interval=5) communication_service.register('HeartBeatService', heartbeat_service.get_queue()) heartbeat_service.startup() self._services['HeartBeatService'] = heartbeat_service storage_service = StorageService( directory="C:\\Users\\Sagar\\PycharmProjects\\pygraphdb\\pygraphdb", communication_service=communication_service) communication_service.register('StorageService', storage_service.get_queue()) storage_service.startup() self._services['StorageService'] = storage_service