コード例 #1
0
    def test_send_byte_string(self):
        """
        @brief Test that any arbitrary byte string can be sent through the
        ion + magnet stack. Use a 20 byte sha1 digest as test string.
        """
        p1 = ReceiverProcess()
        pid1 = yield p1.spawn()

        processes = [
            {'name':'echo','module':'ion.core.test.test_baseprocess','class':'EchoProcess'},
        ]
        sup = yield self._spawn_processes(processes, sup=p1)

        pid2 = p1.get_child_id('echo')

        byte_string = sha.sha('test').digest()

        yield p1.send(pid2, 'echo', byte_string)
        logging.info('Sent byte-string')

        msg = yield p1.await_message()
        logging.info('Received byte-string')
        self.assertEquals(msg.payload['content']['value'], byte_string)

        yield sup.shutdown()
コード例 #2
0
    def test_send_byte_string(self):
        """
        @brief Test that any arbitrary byte string can be sent through the
        ion + magnet stack. Use a 20 byte sha1 digest as test string.
        """
        p1 = ReceiverProcess()
        pid1 = yield p1.spawn()

        processes = [
            {
                'name': 'echo',
                'module': 'ion.core.test.test_baseprocess',
                'class': 'EchoProcess'
            },
        ]
        sup = yield self._spawn_processes(processes, sup=p1)

        pid2 = p1.get_child_id('echo')

        byte_string = sha.sha('test').digest()

        yield p1.send(pid2, 'echo', byte_string)
        logging.info('Sent byte-string')

        msg = yield p1.await_message()
        logging.info('Received byte-string')
        self.assertEquals(msg.payload['content']['value'], byte_string)

        yield sup.shutdown()
コード例 #3
0
    def test_process(self):
        # Also test the ReceiverProcess helper class
        p1 = ReceiverProcess()
        pid1 = yield p1.spawn()

        processes = [
            {
                'name': 'echo',
                'module': 'ion.core.test.test_baseprocess',
                'class': 'EchoProcess'
            },
        ]
        sup = yield self._spawn_processes(processes, sup=p1)
        assert sup == p1

        pid2 = p1.get_child_id('echo')

        yield p1.send(pid2, 'echo', 'content123')
        logging.info('Sent echo message')

        msg = yield p1.await_message()
        logging.info('Received echo message')

        self.assertEquals(msg.payload['op'], 'result')
        self.assertEquals(msg.payload['content']['value'], 'content123')

        yield sup.shutdown()
コード例 #4
0
    def test_process(self):
        # Also test the ReceiverProcess helper class
        p1 = ReceiverProcess()
        pid1 = yield p1.spawn()

        processes = [
            {'name':'echo','module':'ion.core.test.test_baseprocess','class':'EchoProcess'},
        ]
        sup = yield self._spawn_processes(processes, sup=p1)
        assert sup == p1

        pid2 = p1.get_child_id('echo')

        yield p1.send(pid2, 'echo','content123')
        logging.info('Sent echo message')

        msg = yield p1.await_message()
        logging.info('Received echo message')

        self.assertEquals(msg.payload['op'], 'result')
        self.assertEquals(msg.payload['content']['value'], 'content123')

        yield sup.shutdown()