def execute_runner_action(hostname, runner_action, solutions, username): print("Chosen action is: {}".format(runner_action.name)) client = Client(hostname, unique_id=username) rules = ProcessingRules() rules.on("display_description").call(RoundManagement.display_and_save_description).then("publish") for key, value in solutions.iteritems(): rules.on(key).call(value).then(runner_action.client_action) client.go_live_with(rules) RecordingSystem.notify_event(RoundManagement.get_last_fetched_round(), runner_action.short_name)
def create_the_queues(context): username = '******' context.request_queue = context.broker.add_queue('{}.req'.format(username)) context.request_queue.purge() context.response_queue = context.broker.add_queue( '{}.resp'.format(username)) context.response_queue.purge() hostname = 'localhost' stomp_port = 21613 context.client = Client(hostname, stomp_port, username)
def start_client(ready): client = Client(hostname=HOSTNAME, unique_id=EMAIL) rules = ProcessingRules() rules.on("display_description").call(display_and_save_description).then("publish") # STEP 5. Uncomment the following line to register the sum method and run again # rules.on("sum").call(App.sum).then(publish_if(ready)) # STEP 6. Run the test (test/test_app.py) and see it fail # STEP 7. Fix the sum method implementation in lib/app.py client.go_live_with(rules)
def start_client(args, username, hostname, action_if_no_args, solutions): configure_logging() if not is_recording_system_ok(): print("Please run `record_screen_and_upload` before continuing.") return value_from_args = extract_action_from(args) runner_action = value_from_args if value_from_args is not None else action_if_no_args print("Chosen action is: {}".format(runner_action.name)) client = Client(hostname, unique_id=username) rules = ProcessingRules() rules.on("display_description").call(RoundManagement.display_and_save_description).then("publish") for key, value in solutions.iteritems(): rules.on(key).call(value).then(runner_action.client_action) client.go_live_with(rules) RecordingSystem.notify_event(RoundManagement.get_last_fetched_round(), runner_action.short_name)
def test_if_user_goes_live_client_should_process_all_messages(self): client = Client('localhost', 21613, 'test')
def client_with_wrong_broker(context): incorrect_hostname = 'localhost' stomp_port = 11613 username = '******' context.client = Client(incorrect_hostname, stomp_port, username)