コード例 #1
0
ファイル: app.py プロジェクト: tdpreece/tdl-warmup
    def main(self):
        implementation_map = {
            'display_description': {
                'test_implementation': display_description,
                'action': 'publish'
            },
            'increment': {
                'test_implementation': lambda x: x[0] + 1,
                'action': 'publish'

            },
            'to_uppercase': {
                'test_implementation': to_uppercase,
                'action': 'publish'

            },
            'sum': {
                'test_implementation': sum,
                'action': 'publish'

            },
            'count_lines': {
                'test_implementation': count_lines,
                'action': 'publish'

            },
            'fizz_buzz': {
                'test_implementation': fizz_buzz,
                'action': 'publish'
            }
 
        }
        client = Client('172.20.10.2', 61613, 'tpreece')
        client.go_live_with(implementation_map)
コード例 #2
0
def run_client():
    client = Client(hostname='localhost', unique_id='*****@*****.**')

    rules = ProcessingRules()
    rules.on("display_description").call(lambda label, description: "OK").then("publish")
    rules.on("sum").call(add_numbers).then("publish")
    rules.on("end_round").call(lambda params: "OK").then("publish_and_stop")

    client.go_live_with(rules)
コード例 #3
0
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)
コード例 #4
0
ファイル: run.py プロジェクト: spike01/tdl-warmup
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)
コード例 #5
0
def start_client(args, email, hostname, action_if_no_args):
    configure_logging()

    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=email)

    rules = ProcessingRules()
    rules.on("display_description").call(display_and_save_description).then("publish")
    rules.on("sum").call(sum).then(runner_action.client_action)
    rules.on("hello").call(hello).then(runner_action.client_action)
    rules.on("fizz_buzz").call(fizz_buzz).then(runner_action.client_action)
    rules.on("checkout").call(checkout).then(runner_action.client_action)

    client.go_live_with(rules)
コード例 #6
0
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)
コード例 #7
0
ファイル: client_runner.py プロジェクト: CX-Checkout/llfu01
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)
コード例 #8
0
 def test_if_user_goes_live_client_should_process_all_messages(self):
     client = Client('localhost', 21613, 'test')
コード例 #9
0
def client_with_wrong_broker(context):
    incorrect_hostname = 'localhost'
    stomp_port = 11613
    username = '******'
    context.client = Client(incorrect_hostname, stomp_port, username)