def addEngine(self, n=1): for i in range(n): e = es.EngineService() e.startService() regDict = self.controller.register_engine(es.QueuedEngine(e), None) e.id = regDict['id'] self.engines.append(e)
def testRegisterUnregisterMultipleEngines(self): e1 = es.EngineService() qe1 = es.QueuedEngine(e1) e2 = es.EngineService() qe2 = es.QueuedEngine(e2) rd1 = self.controller.register_engine(qe1, 0) self.assertEquals(rd1['id'], 0) rd2 = self.controller.register_engine(qe2, 1) self.assertEquals(rd2['id'], 1) self.controller.unregister_engine(0) rd1 = self.controller.register_engine(qe1, 0) self.assertEquals(rd1['id'], 0) self.controller.unregister_engine(1) rd2 = self.controller.register_engine(qe2, 0) self.assertEquals(rd2['id'], 1) self.controller.unregister_engine(0) self.controller.unregister_engine(1) self.assertEquals(self.controller.engines, {})
def testRegisterUnregisterEngine(self): engine = es.EngineService() qengine = es.QueuedEngine(engine) regDict = self.controller.register_engine(qengine, 0) self.assert_(isinstance(regDict, dict)) self.assert_(regDict.has_key('id')) self.assert_(regDict['id'] == 0) self.controller.unregister_engine(0) self.assert_(self.controller.engines.get(0, None) == None)
def testRegisterCallables(self): e1 = es.EngineService() qe1 = es.QueuedEngine(e1) self.registerCallableCalled = ';lkj' self.unregisterCallableCalled = ';lkj' self.controller.on_register_engine_do(self._registerCallable, False) self.controller.on_unregister_engine_do(self._unregisterCallable, False) self.controller.register_engine(qe1, 0) self.assertEquals(self.registerCallableCalled, 'asdf') self.controller.unregister_engine(0) self.assertEquals(self.unregisterCallableCalled, 'asdf') self.controller.on_register_engine_do_not(self._registerCallable) self.controller.on_unregister_engine_do_not(self._unregisterCallable)
def setUp(self): # Start a server and append to self.servers self.controller_reference = FCRemoteEngineRefFromService(self) self.controller_tub = Tub() self.controller_tub.listenOn('tcp:10111:interface=127.0.0.1') self.controller_tub.setLocation('127.0.0.1:10111') furl = self.controller_tub.registerReference(self.controller_reference) self.controller_tub.startService() # Start an EngineService and append to services/client self.engine_service = es.EngineService() self.engine_service.startService() self.engine_tub = Tub() self.engine_tub.startService() engine_connector = EngineConnector(self.engine_tub) d = engine_connector.connect_to_controller(self.engine_service, furl) # This deferred doesn't fire until after register_engine has returned and # thus, self.engine has been defined and the tets can proceed. return d
def setUp(self): self.controller = IPythonCocoaController.alloc().init() self.engine = es.EngineService() self.engine.startService()
def setUp(self): self.rawEngine = es.EngineService() self.rawEngine.startService() self.engine = es.IEngineQueued(self.rawEngine)
def setUp(self): self.engine = es.EngineService() self.engine.startService()