Changeset 3421

Show
Ignore:
Timestamp:
07/08/08 12:15:59 (3 months ago)
Author:
dgollub
Message:

Updated mock-sync initialize function to use:
osync_plugin_config_find_active_ressource()

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/tests/mock-plugin/mock_sync.c

    r3396 r3421  
    580580                osync_assert(sink); 
    581581 
    582                 OSyncList *r = osync_plugin_config_get_ressources(config); 
    583                 for (; r; r = r->next) { 
    584                         OSyncPluginRessource *res = r->data; 
    585  
    586                         OSyncList *o = osync_plugin_ressource_get_objformat_sinks(res); 
    587                         for (; o; o = o->next) { 
    588                                 OSyncObjFormatSink *format_sink = (OSyncObjFormatSink *) o->data;  
    589                                 const char *objformat_str = osync_objformat_sink_get_objformat(format_sink); 
    590                                 osync_assert(objformat_str); 
    591                                 OSyncObjFormat *objformat = osync_format_env_find_objformat(formatenv, objformat_str); 
    592                                 osync_assert(objformat); 
    593                                 const char *objtype = osync_objformat_get_objtype(objformat); 
    594                                 osync_assert(objtype); 
    595                                 if (!strcmp(objtype, osync_objtype_sink_get_name(sink))) { 
    596                                         dir->res = osync_plugin_ressource_ref(res); 
    597                                         dir->path = g_strdup(osync_plugin_ressource_get_path(res)); 
    598                                         dir->objformat = osync_objformat_ref(objformat); 
    599                                         break; 
    600                                 } 
    601                                                   
    602                         } 
    603  
    604                         if (dir->res) 
    605                                 break; 
    606                 } 
     582                const char *objtype = osync_objtype_sink_get_name(sink); 
     583                dir->res = osync_plugin_config_find_active_ressource(config, objtype); 
     584                dir->path = osync_plugin_ressource_get_path(dir->res); 
     585                osync_assert(dir->path); 
     586 
     587                OSyncList *format_sinks = osync_plugin_ressource_get_objformat_sinks(dir->res); 
     588                osync_assert(osync_list_length(format_sinks) == 1); 
     589                OSyncObjFormatSink *format_sink = osync_list_nth_data(format_sinks, 0); 
     590                const char *objformat_str = osync_objformat_sink_get_objformat(format_sink); 
     591                osync_assert(objformat_str); 
     592                dir->objformat = osync_format_env_find_objformat(formatenv, objformat_str); 
     593                osync_assert(dir->objformat); 
     594                osync_objformat_ref(dir->objformat); 
    607595 
    608596                osync_trace(TRACE_INTERNAL, "The configdir: %s", osync_plugin_info_get_configdir(info)); 
    609597                char *tablepath = g_strdup_printf("%s/hashtable.db", osync_plugin_info_get_configdir(info)); 
    610                 dir->hashtable = osync_hashtable_new(tablepath, osync_objtype_sink_get_name(sink), error); 
     598                dir->hashtable = osync_hashtable_new(tablepath, objtype, error); 
    611599                g_free(tablepath); 
    612600