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.3.tar.gz (3.6 kB view details)

Uploaded Source

File details

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

File metadata

  • Download URL: vertx-eventbus-bridge-starter-1.0.3.tar.gz
  • Upload date:
  • Size: 3.6 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.3.tar.gz
Algorithm Hash digest
SHA256 944c646a6cac4f2b89371c2b12cd5598a49ad3d3245cbd70f5fbf54cbd877ab2
MD5 86661cf0146161c9629ae0b0ee45a263
BLAKE2b-256 4ed6fc47fc6e50f313a804d966a6921bd57afaef75dcaaac41ecc6cad43bf2b5

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