def test_hello(self): pd1 = {'name':'hello1','module':'ion.play.hello_process','class':'HelloService'} proc1 = ProcessDesc(**pd1) sup1 = yield bootstrap.create_supervisor() proc1_id = yield self.test_sup.spawn_child(proc1) sup2 = yield bootstrap.create_supervisor() logging.info('Calling hello there with hc(sup1)') hc1 = HelloProcessClient(proc=sup1,target=proc1_id) yield hc1.hello("Hi there, hello1") logging.info('Calling hello there with hc(sup2)') hc2 = HelloProcessClient(proc=sup2,target=proc1_id) yield hc2.hello("Hi there, hello1") logging.info('Tada!')
def test_hello(self): pd1 = { 'name': 'hello1', 'module': 'ion.play.hello_process', 'class': 'HelloService' } proc1 = ProcessDesc(**pd1) sup1 = yield bootstrap.create_supervisor() proc1_id = yield self.test_sup.spawn_child(proc1) sup2 = yield bootstrap.create_supervisor() logging.info('Calling hello there with hc(sup1)') hc1 = HelloProcessClient(proc=sup1, target=proc1_id) yield hc1.hello("Hi there, hello1") logging.info('Calling hello there with hc(sup2)') hc2 = HelloProcessClient(proc=sup2, target=proc1_id) yield hc2.hello("Hi there, hello1") logging.info('Tada!')
def test_send_message_instance2(self): """ Tests the RPC request/response without using the support provided by IonTestCase, ie., not using self.test_sup.rpc_send(..), but instead by creating a bootstrap.create_supervisor() and using its rpc_send method directly. This originally served as a basis to implement the SiamCiAdapterProxy. """ self._check_skip() p1 = yield bootstrap.create_supervisor() mc = message_client.MessageClient(proc=p1) message = yield mc.create_instance(Command_type, MessageName='command sent message') message.command ='echo' arg = message.args.add() arg.channel = "myCh1" arg.parameter = "myParam1" pid = SiamCiTestCase.pid (response, headers, msg) = yield p1.rpc_send(pid, 'echo', message) self.assertIsInstance(response, message_client.MessageInstance) self.assertEqual(Command_type, response.MessageObject.ObjectType) self.assertEqual(response.command, 'echo')
def start(self): """ Starts the proxy. Call this before any other operation on this object. """ if not self.proc: log.info("Starting SiamCiAdapterProxy") self.proc = yield bootstrap.create_supervisor() self.mc = message_client.MessageClient(proc=self.proc)
def _start_container(self): """ Starting and initialzing the container with a connection to a broker. @note Hardwired to connect to amoeba for broker. """ mopt = {} mopt['broker_host'] = CONF['broker_host'] mopt['broker_port'] = CONF['broker_port'] mopt['broker_vhost'] = CONF['broker_vhost'] mopt['broker_heartbeat'] = CONF['broker_heartbeat'] mopt['boot_script'] = None mopt['script'] = None self.cont_conn = yield container.startContainer(mopt) bootstrap.init_container() self.procRegistry = base_process.procRegistry self.test_sup = yield bootstrap.create_supervisor() #Load All Resource Descriptions for future decoding description_utility.load_descriptions() logging.info("============Magnet container started, "+repr(self.cont_conn))
def _start_container(self): """ Starting and initialzing the container with a connection to a broker. @note Hardwired to connect to amoeba for broker. """ mopt = {} mopt['broker_host'] = CONF['broker_host'] mopt['broker_port'] = CONF['broker_port'] mopt['broker_vhost'] = CONF['broker_vhost'] mopt['broker_heartbeat'] = CONF['broker_heartbeat'] mopt['boot_script'] = None mopt['script'] = None self.cont_conn = yield container.startContainer(mopt) bootstrap.init_container() self.procRegistry = base_process.procRegistry self.test_sup = yield bootstrap.create_supervisor() #Load All Resource Descriptions for future decoding description_utility.load_descriptions() logging.info("============Magnet container started, " + repr(self.cont_conn))