Ticket #1124: multisync_hybrid.diff

File multisync_hybrid.diff, 2.2 KB (added by dgollub, 4 years ago)

Make conflict resolution more reliable by choosing the conflict-winner by memberid

  • tests/support.c

     
    524524        } 
    525525} 
    526526 
     527 
     528void conflict_handler_choose_member(OSyncEngine *engine, OSyncMappingEngine *mapping, void *user_data) 
     529{ 
     530        OSyncChange *change = NULL; 
     531        OSyncError *error = NULL; 
     532 
     533        osync_trace(TRACE_ENTRY, "%s(%p, %p, %p)", __func__, engine, mapping, user_data); 
     534         
     535        num_mapping_conflicts++; 
     536        fail_unless(num_engine_end_conflicts == 0, NULL); 
     537 
     538        change = osync_mapping_engine_member_change(mapping, GPOINTER_TO_UINT(user_data)); 
     539        osync_assert(osync_engine_mapping_solve(engine, mapping, change, &error)); 
     540        osync_assert(error == NULL); 
     541         
     542        osync_trace(TRACE_EXIT, "%s", __func__); 
     543} 
     544 
    527545void conflict_handler_choose_first(OSyncEngine *engine, OSyncMappingEngine *mapping, void *user_data) 
    528546{ 
    529547        OSyncChange *change = NULL; 
  • tests/support.h

     
    123123void mapping_status(OSyncEngineMappingUpdate *status, void *user_data); 
    124124 
    125125/* Conflict handlers */ 
     126void conflict_handler_choose_member(OSyncEngine *engine, OSyncMappingEngine *mapping, void *user_data); 
    126127void conflict_handler_choose_first(OSyncEngine *engine, OSyncMappingEngine *mapping, void *user_data); 
    127128void conflict_handler_choose_deleted(OSyncEngine *engine, OSyncMappingEngine *mapping, void *user_data); 
    128129void conflict_handler_choose_modified(OSyncEngine *engine, OSyncMappingEngine *mapping, void *user_data); 
  • tests/sync-tests/check_multisync.c

     
    10451045        char *testbed = setup_testbed("multisync_conflict_changetype_choose"); 
    10461046        OSyncError *error = NULL; 
    10471047        OSyncEngine *engine = setup_engine(testbed); 
    1048         osync_engine_set_conflict_callback(engine, conflict_handler_choose_modified, GINT_TO_POINTER(3)); 
     1048        osync_engine_set_conflict_callback(engine, conflict_handler_choose_member, GINT_TO_POINTER(2)); 
    10491049 
    10501050        fail_unless(osync_engine_initialize(engine, &error), NULL); 
    10511051        fail_unless(error == NULL, NULL);