def __init__(self): DummyEndpoint.__init__(self) # when dispatching to partner, we request the function name as # it would appear in the Waldo source file. However, the # compiler mangles it into another name. The call below # ensures that that the mangled name exists. setattr( self, util.endpoint_call_func_name('endpoint_func'), self.endpoint_func)
def run_test(): endpoint = DummyEndpoint() init_map_val = { 'a': 'hi', 'b': 'hello' } map_var = LockedMapVariable(Waldo._host_uuid,False,{}) init_list_val = [1,3,3,4,5] list_var = LockedListVariable(Waldo._host_uuid,False,[]) ### load each container with elements load_event = endpoint._act_event_map.create_root_event() for map_index in init_map_val.keys(): map_var.get_val(load_event).add_key(load_event,map_index,init_map_val[map_index]) for list_index in range(0,len(init_list_val)): list_var.get_val(load_event).append_val(load_event,init_list_val[list_index]) load_event.begin_first_phase_commit() ### create conflicting events: both try to write older_event,younger_event = endpoint.create_older_and_younger_root_events() should_commit = 57 should_not_commit = should_commit + 1 list_var.get_val(younger_event).append_val(younger_event,should_not_commit) list_var.get_val(older_event).append_val(older_event,should_commit) older_event.begin_first_phase_commit() read_event = endpoint._act_event_map.create_root_event() if list_var.get_val(read_event).get_len(read_event) != (len(init_list_val) + 1): print 'Error did not commit anything' return False if list_var.get_val(read_event).get_val_on_key(read_event,len(init_list_val)) != should_commit: print 'Error did not commit correct value' return False return True