示例#1
0
 def test_info(self):
     ds = DataService("svc1")
     node = mock.MagicMock()
     node.node_id = 'testnode'
     ds.node = node
     info = ds.info
     self.assertEqual(info.service_id, 'svc1')
     self.assertEqual(info.node_id, 'testnode')
     self.assertEqual(info.published_tables, [])
     self.assertEqual(info.subscribed_tables, [])
     self.assertEqual(info.rpc_endpoints_info, [])
示例#2
0
 def test_start_stop(self):
     ds = DataService("svc1")
     ds.node = mock.MagicMock()
     ds._rpc_server = mock.MagicMock()
     self.assertEqual(ds._running, False,
                      "Newly created service is marked as not running")
     ds.start()
     self.assertEqual(ds._running, True,
                      "Started service is marked as running")
     ds.stop()
     self.assertEqual(ds._running, False,
                      "Stopped service is marked as not running")
示例#3
0
 def __init__(self, name, keys, inbox=None, dataPath=None):
     DataService.__init__(self, name)
     self.name = name
     self.running = True