Ejemplo n.º 1
0
 def test_already_started(self):
     """the service starts during the getService if parent already started"""
     parent = service.AsyncMultiService()
     self.successResultOf(parent.startService())
     r = self.successResultOf(UnderTestSharedService.getService(parent))
     self.assertEqual(r.running, 1)
     # then we stop the parent, and the shared service stops
     self.successResultOf(parent.stopService())
     self.assertEqual(r.running, 0)
Ejemplo n.º 2
0
 def test_startup(self):
     """the service starts when parent starts and stop"""
     parent = service.AsyncMultiService()
     r = yield UnderTestSharedService.getService(parent)
     self.assertEqual(r.running, 0)
     yield parent.startService()
     self.assertEqual(r.running, 1)
     yield parent.stopService()
     self.assertEqual(r.running, 0)
Ejemplo n.º 3
0
 def test_startup(self):
     """the service starts when parent starts and stop"""
     parent = service.AsyncMultiService()
     r = self.successResultOf(UnderTestSharedService.getService(parent))
     self.assertEqual(r.running, 0)
     self.successResultOf(parent.startService())
     self.assertEqual(r.running, 1)
     self.successResultOf(parent.stopService())
     self.assertEqual(r.running, 0)
Ejemplo n.º 4
0
 def test_creation(self):
     parent = service.AsyncMultiService()
     r = yield UnderTestSharedService.getService(parent)
     r2 = yield UnderTestSharedService.getService(parent)
     r3 = yield UnderTestSharedService.getService(parent, "arg1")
     r4 = yield UnderTestSharedService.getService(parent, "arg1")
     self.assertIdentical(r, r2)
     self.assertNotIdentical(r, r3)
     self.assertIdentical(r3, r4)
     self.assertEqual(len(list(iter(parent))), 2)
Ejemplo n.º 5
0
 def test_already_stopped_last(self):
     parent = service.AsyncMultiService()
     o = UnderTestDependentService()
     o.setServiceParent(parent)
     self.successResultOf(parent.startService())
     self.successResultOf(parent.stopService())
Ejemplo n.º 6
0
 def test_bad_constructor(self):
     parent = service.AsyncMultiService()
     self.failureResultOf(
         UnderTestSharedService.getService(parent, arg2="foo"))
Ejemplo n.º 7
0
 def setUp(self):
     self.svc = service.AsyncMultiService()
Ejemplo n.º 8
0
 def test_already_stopped_last(self):
     parent = service.AsyncMultiService()
     o = UnderTestDependentService()
     yield o.setServiceParent(parent)
     yield parent.startService()
     yield parent.stopService()
Ejemplo n.º 9
0
 def test_bad_constructor(self):
     parent = service.AsyncMultiService()
     with self.assertRaises(Exception):
         yield UnderTestSharedService.getService(parent, arg2="foo")