Пример #1
0
def create_seller_app(cid, participant, repetitions=20):
    role = 'Seller'
    lt_file = apps_utils.get_lt_full_name(gen.get_local_type_file_name(local_type_file_name, role))
    print lt_file 
    gen.generate_protocol(repetitions, lt_file, gen.ParticipantData(role))
    
    full_trace = gen.generate_client(repetitions, gen.ParticipantData(role))
    full_trace = full_trace + [[LocalType.SEND, 'END', 'Buyer']]
    
    seller_app = apps_utils.BaseApp(cid, role, participant, full_trace, 
                         lt_file, create_buyer_seller_conversation)
    return seller_app
Пример #2
0
def create_seller_app(cid, participant, repetitions=20):
    role = 'Seller'
    lt_file = local_type_file_name % (role)
    msg_content = gen.get_msg(test_data_file_name % (repetitions))

    full_trace = [[LocalType.RESV, 'Order', 'Buyer'],
                  [LocalType.SEND, 'Confirmation', 'Buyer', msg_content]]

    full_trace = full_trace + [[LocalType.SEND, 'END', 'Buyer']]

    seller_app = apps_utils.BaseApp(cid, role, participant, full_trace,
                                    lt_file, create_buyer_seller_conversation)
    return seller_app
Пример #3
0
def create_client_app(cid, participant):
    role = 'client'
    lt_file = apps_utils.get_lt_full_name("ecoop\LogicExample_at_Client.spr")

    event_trace = [[LocalType.RESV, 'Balance', 'Server', '1'],
                   [LocalType.RESV, 'OverdraftLimit', 'Server', '1'],
                   [LocalType.SEND, 'MakePayment', 'Server', '1'],
                   [LocalType.RESV, 'Balance', 'Server', 1],
                   [LocalType.RESV, 'OverdraftLimit', 'Server', '1'],
                   [LocalType.SEND, 'CloseAccount', 'Server', '1']]

    full_trace = event_trace
    full_trace = full_trace + [[LocalType.SEND, 'END', 'Seller']]
    app = apps_utils.BaseApp(cid, role, participant, full_trace, lt_file)
    return app
Пример #4
0
def create_server_app(cid, participant):
    role = 'server'
    lt_file = apps_utils.get_lt_full_name("ecoop\LogicExample_at_Server.spr")
    event_trace = [[LocalType.SEND, 'Balance1', 'Client', '1'],
                   [LocalType.SEND, 'OverdraftLimit1', 'Client', '1'],
                   [LocalType.RESV, 'MakePayment', 'Client', '1'],
                   [LocalType.SEND, 'Balance', 'Client', '1'],
                   [LocalType.SEND, 'OverdraftLimit', 'Client', '1'],
                   [LocalType.RESV, 'CloseAccount', 'Client', '1']]

    full_trace = event_trace
    full_trace = full_trace + [[LocalType.SEND, 'END', 'Client']]

    app = apps_utils.BaseApp(cid, role, participant, full_trace, lt_file,
                             create_logic_conversation)
    return app
Пример #5
0
def create_user_app(cid, participant, repetitions=1):
    role = 'U'
    lt_file = apps_utils.get_lt_full_name("DataAcquisition_at_U.spr")

    event_trace = [[LocalType.SEND, 'Push', 'A'],
                   [LocalType.RESV, 'Formatted', 'A'],
                   [LocalType.RESV, 'Formatted', 'A'],
                   [LocalType.SEND, 'Stop', 'A']]

    full_trace = event_trace

    full_trace = full_trace + [[LocalType.SEND, 'END', 'A']]

    app = apps_utils.BaseApp(cid, role, participant, full_trace, lt_file,
                             create_data_acquisition_conversation)
    return app
Пример #6
0
def create_instrument_app(cid, participant, repetitions=1):
    role = 'I'
    lt_file = apps_utils.get_lt_full_name("DataAcquisition_at_I.spr")

    event_trace = [[LocalType.SEND, 'Push', 'A'],
                   [LocalType.RESV, 'StreamMode', 'A'],
                   [LocalType.SEND, 'Supported', 'A'],
                   [LocalType.RESV, 'ConfigStream', 'A'],
                   [LocalType.SEND, 'Raw', 'A'], [LocalType.SEND, 'Raw', 'A'],
                   [LocalType.RESV, 'Stop', 'A']]

    full_trace = event_trace

    full_trace = full_trace + [[LocalType.SEND, 'END', 'A']]
    app = apps_utils.BaseApp(cid, role, participant, full_trace, lt_file)
    return app
Пример #7
0
def create_buyer_app(cid, participant, repetitions=20):
    role = 'Buyer'
    lt_file = apps_utils.get_lt_full_name("Benchmark_BuyerApp.spr")
    
    event_trace = [[LocalType.RESV, 'Confirmation', 'Seller', '1'],
                   [LocalType.SEND, 'OK', 'Seller', '-1'],
                   [LocalType.RESV, 'Confirmation', 'Seller', '1'], 
                   [LocalType.SEND, 'OK', 'Seller', '-1']]
    
    full_trace = event_trace
    for i in range(0, repetitions):
        full_trace = full_trace + event_trace
    
    end_trace = [[LocalType.RESV, 'OutOfStock', 'Seller']]
    full_trace = full_trace + end_trace + [[LocalType.SEND, 'END', 'Seller']]
    buyer_app = apps_utils.BaseApp(cid, role, participant, 
                        full_trace, lt_file)
    return buyer_app  
Пример #8
0
def create_agent_app(cid, participant, repetitions=1):
    role = 'A'
    lt_file = apps_utils.get_lt_full_name("DataAcquisition_at_A.spr")

    event_trace = [[LocalType.RESV, 'Push', 'U'],
                   [LocalType.SEND, 'StreamMode', 'I'],
                   [LocalType.RESV, 'Supported', 'I'],
                   [LocalType.SEND, 'ConfigStream', 'I'],
                   [LocalType.RESV, 'Raw', 'I'],
                   [LocalType.SEND, 'Formatted', 'U'],
                   [LocalType.RESV, 'Raw', 'I'],
                   [LocalType.SEND, 'Formatted', 'U'],
                   [LocalType.RESV, 'Stop', 'U'],
                   [LocalType.SEND, 'Stop', 'I']]

    full_trace = event_trace
    for i in range(0, repetitions):
        full_trace = full_trace + event_trace

    full_trace = full_trace + [[LocalType.SEND, 'END', 'I']]

    app = apps_utils.BaseApp(cid, role, participant, full_trace, lt_file,
                             create_data_acquisition_conversation)
    return app