示例#1
0
 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)
示例#2
0
 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, {})
示例#3
0
 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)
示例#4
0
 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)
示例#5
0
    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
示例#6
0
 def setUp(self):
     self.controller = IPythonCocoaController.alloc().init()
     self.engine = es.EngineService()
     self.engine.startService()
示例#7
0
 def setUp(self):
     self.rawEngine = es.EngineService()
     self.rawEngine.startService()
     self.engine = es.IEngineQueued(self.rawEngine)
示例#8
0
 def setUp(self):
     self.engine = es.EngineService()
     self.engine.startService()