Skip to main content

Starter used to start an EventBus bridge for testing

Project description

test-eventbus-bridge

A vertx eventbus bridge that is used for testing

How to used it

Install using pip:

pip install vertx-eventbus-bridge-starter

import unittest
from testeventbus import EventBusBridgeStarter, CountDownLatch
from vertx import EventBus


class EventBusClientTests(unittest.TestCase):
    """
    This is the tests against a local test eventbus bridge
    """

    starter = None

    def __init__(self, *args, **kwargs):
        super(EventBusClientTests, self).__init__(*args, **kwargs)
    
    @classmethod
    def setUpClass(cls):
        print("Start EventBus Bridge")
        cls.starter = EventBusBridgeStarter(debug=True)
        cls.starter.start()
        cls.starter.wait_started()
        print("yes, Bridge started !!")
    
    @classmethod
    def tearDownClass(cls):
        print("Now stop the bridge")
        cls.starter.stop()
    
    def test_send(self):
        latch = CountDownLatch()
        ebus = EventBus()
        ebus.connect()
    
        def handler(message):
            self.assertEqual(message['body']['hello'], 'world')
            ebus.close()
            latch.count_down()
        ebus.register_handler('echo-back', handler)
        ebus.send("echo", reply_address="echo-back", body={"hello": "world"})
        latch.awaits(5)

TODO

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

vertx-eventbus-bridge-starter-1.0.2.tar.gz (3.5 kB view details)

Uploaded Source

File details

Details for the file vertx-eventbus-bridge-starter-1.0.2.tar.gz.

File metadata

  • Download URL: vertx-eventbus-bridge-starter-1.0.2.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/52.0.0.post20210125 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.7.0

File hashes

Hashes for vertx-eventbus-bridge-starter-1.0.2.tar.gz
Algorithm Hash digest
SHA256 01184f7ddec3110b84497d72de55e9c982129d86d63f5812772c26742e786f3c
MD5 c545d27834fcd361fc8681f8421f51a2
BLAKE2b-256 c9500df1c9429ce6a2dc2382af96a82878a73c6ed61e3f0b50b218a7c9c33f25

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page