From: <svn...@op...> - 2009-09-14 17:53:11
|
Author: bellmich Date: Mon Sep 14 19:52:56 2009 New Revision: 1274 URL: http://libsyncml.opensync.org/changeset/1274 Log: - added some location related functions which are necessary for account/IMEI handling - added set_local - added set_remote - added get_local - fixed mapping generation (copy&paste mistake) - data store sessions must always be checked before they are dispatched Modified: trunk/libsyncml/data_sync_api/sml_data_sync_session.c trunk/libsyncml/data_sync_api/sml_data_sync_session.h trunk/libsyncml/data_sync_api/sml_data_sync_session_private.h trunk/tests/check_data_sync_api.c Modified: trunk/libsyncml/data_sync_api/sml_data_sync_session.c ============================================================================== --- trunk/libsyncml/data_sync_api/sml_data_sync_session.c Mon Sep 14 19:49:51 2009 (r1273) +++ trunk/libsyncml/data_sync_api/sml_data_sync_session.c Mon Sep 14 19:52:56 2009 (r1274) @@ -33,6 +33,7 @@ enum { PROP_0, + PROP_LOCAL, PROP_REMOTE }; @@ -43,6 +44,9 @@ GParamSpec *pspec) { switch (property_id) { + case PROP_LOCAL: + g_value_set_object (value, SML_DATA_SYNC_SESSION (object)->priv->local); + break; case PROP_REMOTE: g_value_set_object (value, SML_DATA_SYNC_SESSION (object)->priv->remote); break; @@ -58,6 +62,12 @@ GParamSpec *pspec) { switch (property_id) { + case PROP_LOCAL: + if (SML_DATA_SYNC_SESSION (object)->priv->local) + g_object_unref (SML_DATA_SYNC_SESSION (object)->priv->local); + SML_DATA_SYNC_SESSION (object)->priv->local = SML_LOCATION (value); + g_object_ref(SML_LOCATION (value)); + break; case PROP_REMOTE: if (SML_DATA_SYNC_SESSION (object)->priv->remote) g_object_unref (SML_DATA_SYNC_SESSION (object)->priv->remote); @@ -121,6 +131,18 @@ object_class->finalize = sml_data_sync_session_finalize; /** + * SmlDataSyncSession:local: + * + * The local location property. + */ + g_object_class_install_property (object_class, + PROP_LOCAL, + g_param_spec_object ("local", + "local", + "local location", + G_TYPE_OBJECT, + G_PARAM_READWRITE)); + /** * SmlDataSyncSession:remote: * * The remote location property. @@ -226,6 +248,48 @@ } /** + * sml_data_sync_session_get_local: + * @self: A #SmlDataSyncSession + * + * Gets the local property. + * + * Return value: + */ +SmlLocation* +sml_data_sync_session_get_local (SmlDataSyncSession *self) +{ + g_return_val_if_fail (SML_IS_DATA_SYNC_SESSION (self), NULL); + + if (!self->priv->local && + smlSessionGetSource(self->priv->session) && + smlSessionGetEstablished(self->priv->session)) + { + sml_data_sync_session_set_local(self, smlSessionGetSource(self->priv->session)); + } + + return self->priv->local; +} + +/** + * sml_data_sync_session_set_local: + * @self: A #SmlDataSyncSession + * @local: + * + * Sets the local property. + */ +void +sml_data_sync_session_set_local (SmlDataSyncSession *self, + SmlLocation* local) +{ + g_return_if_fail (SML_IS_DATA_SYNC_SESSION (self)); + g_return_if_fail (SML_IS_LOCATION (local)); + + if (self->priv->local) + g_object_unref (self->priv->local); + self->priv->local = g_object_ref (local); +} + +/** * sml_data_sync_session_get_remote: * @self: A #SmlDataSyncSession * @@ -237,6 +301,14 @@ sml_data_sync_session_get_remote (SmlDataSyncSession *self) { g_return_val_if_fail (SML_IS_DATA_SYNC_SESSION (self), NULL); + + if (!self->priv->remote && + smlSessionGetTarget(self->priv->session) && + smlSessionGetEstablished(self->priv->session)) + { + sml_data_sync_session_set_remote(self, smlSessionGetTarget(self->priv->session)); + } + return self->priv->remote; } @@ -362,7 +434,7 @@ SmlDataSyncDataStoreSession *datastore = o->data; smlAssert(datastore); - if (!sml_data_sync_data_store_session_send_changes(datastore, error)) + if (!sml_data_sync_data_store_session_send_mappings(datastore, error)) goto error; } @@ -456,7 +528,8 @@ { smlTrace(TRACE_INTERNAL, "%s: data store session %p", __func__, o->data); SmlDataSyncDataStoreSession *session = o->data; - if (!sml_data_sync_data_store_session_dispatch(session)) + if (sml_data_sync_data_store_session_check(session) && + !sml_data_sync_data_store_session_dispatch(session)) { smlTrace(TRACE_EXIT, "%s - FALSE", __func__); return FALSE; @@ -505,6 +578,22 @@ GList *o = NULL; GError *locerror = NULL; + /* I (bellmich) still looking for the perfect time + * when to set the remote peers identity. + */ + if (!self->priv->local && + smlSessionGetSource(self->priv->session) && + smlSessionGetEstablished(self->priv->session)) + { + sml_data_sync_session_set_local(self, smlSessionGetSource(self->priv->session)); + } + if (!self->priv->remote && + smlSessionGetTarget(self->priv->session) && + smlSessionGetEstablished(self->priv->session)) + { + sml_data_sync_session_set_remote(self, smlSessionGetTarget(self->priv->session)); + } + switch (type) { case SML_MANAGER_SESSION_FLUSH: smlTrace(TRACE_INTERNAL, "%s: ignored event %d ", __func__, type); Modified: trunk/libsyncml/data_sync_api/sml_data_sync_session.h ============================================================================== --- trunk/libsyncml/data_sync_api/sml_data_sync_session.h Mon Sep 14 19:49:51 2009 (r1273) +++ trunk/libsyncml/data_sync_api/sml_data_sync_session.h Mon Sep 14 19:52:56 2009 (r1274) @@ -65,6 +65,7 @@ #include "sml_data_sync_data_store.h" GType sml_data_sync_session_get_type (void); +SmlLocation* sml_data_sync_session_get_local (SmlDataSyncSession *self); SmlLocation* sml_data_sync_session_get_remote (SmlDataSyncSession *self); gboolean sml_data_sync_session_send_changes (SmlDataSyncSession *self, GError **error); gboolean sml_data_sync_session_abort (SmlDataSyncSession *self, GError **error); Modified: trunk/libsyncml/data_sync_api/sml_data_sync_session_private.h ============================================================================== --- trunk/libsyncml/data_sync_api/sml_data_sync_session_private.h Mon Sep 14 19:49:51 2009 (r1273) +++ trunk/libsyncml/data_sync_api/sml_data_sync_session_private.h Mon Sep 14 19:52:56 2009 (r1274) @@ -53,6 +53,7 @@ struct _SmlDataSyncSessionPrivate { + SmlLocation* local; SmlLocation* remote; GList* list_data_store_sessions; /* SmlDataSyncDataStoreSession */ GHashTable* hash_dsdss2dsdss; /* SmlDataSyncDataStoreSession => SmlDataSyncDataStoreSession */ @@ -68,6 +69,9 @@ SmlDevInf* remote_dev_inf; }; +void sml_data_sync_session_set_local (SmlDataSyncSession *self, SmlLocation* local); +void sml_data_sync_session_set_remote (SmlDataSyncSession *self, SmlLocation* remote); + G_END_DECLS #endif /* __SML_DATA_SYNC_SESSION_PRIVATE_H__ */ Modified: trunk/tests/check_data_sync_api.c ============================================================================== --- trunk/tests/check_data_sync_api.c Mon Sep 14 19:49:51 2009 (r1273) +++ trunk/tests/check_data_sync_api.c Mon Sep 14 19:52:56 2009 (r1274) @@ -31,11 +31,16 @@ GMutex *runMutex = NULL; int locks; -GList *client_items; -SmlDataSync *client; +GList *clients; +typedef struct SmlDataSyncTestClient { + GList *items; + SmlDataSync *client; + SmlDataSyncDataStore *data_store; +} SmlDataSyncTestClient; + SmlDataSync *server; -SmlDataSyncDataStore *client_data_store; SmlDataSyncDataStore *server_data_store; + const char *transport; @@ -45,21 +50,21 @@ gboolean sendAllChanges (SmlDataSyncSession *session, + SmlDataSyncTestClient *client, GError **error) { smlTrace(TRACE_ENTRY, "%s", __func__); - SmlDataSync *dsObject = sml_data_sync_session_get_data_sync(session); SmlDataSyncDataStoreSession *dss = NULL; - if (dsObject == client) - dss = sml_data_sync_session_get_data_store_session(session, client_data_store, error); + if (client) + dss = sml_data_sync_session_get_data_store_session(session, client->data_store, error); else dss = sml_data_sync_session_get_data_store_session(session, server_data_store, error); sml_fail_unless(dss != NULL, "%s", GET_ERROR_MESSAGE((*error))); - if (dsObject == client) + if (client) { - GList *list = client_items; + GList *list = client->items; size_t count = 0; for (;list;list = list->next) { @@ -94,12 +99,13 @@ smlTrace(TRACE_ENTRY, "%s(%p, %i, %p, %p)", __func__, dsObject, type, userdata, error); GError *locerror = NULL; - //if (!dsObject) - // dsObject = sml_data_sync_session_get_data_sync(session); + SmlDataSyncTestClient *client = NULL; + if (userdata) + client = userdata; switch (type) { case SML_DATA_SYNC_SESSION_EVENT_ERROR: - if (dsObject == client) { + if (client) { sml_fail_unless(FALSE, "OMA DS client failed: %s", error->message); } else { sml_fail_unless(FALSE, "OMA DS server failed: %s", error->message); @@ -118,17 +124,17 @@ break; case SML_DATA_SYNC_SESSION_EVENT_GOT_ALL_ALERTS: /* g_message("All alerts of the remote device were received."); */ - if (dsObject == client) + if (client) { - if (!sendAllChanges(session, &locerror)) + if (!sendAllChanges(session, client, &locerror)) goto error; } break; case SML_DATA_SYNC_SESSION_EVENT_GOT_ALL_CHANGES: /* g_message("All changes of the remote device were received."); */ - if (dsObject == server) + if (!client) { - if (!sendAllChanges(session, &locerror)) + if (!sendAllChanges(session, NULL, &locerror)) goto error; } /* the map of the client is send automatically */ @@ -170,18 +176,45 @@ SmlDataSyncSession *dss = sml_data_sync_data_store_session_get_data_sync_session(session); SmlDataSync *dsObject = sml_data_sync_session_get_data_sync(dss); - if (dsObject == client) { - sml_fail_unless(FALSE, "A change was received from the server."); + if (dsObject != server) { + sml_fail_unless(FALSE, "A change was received by the server."); } /* check the source */ - if (datastore == client_data_store) { + if (datastore != server_data_store) { sml_fail_unless(FALSE, "The data store is wrong (from client)."); } + /* determine client */ + + /* This is a hack because of the behaviour of the OBEX server. */ + smlTrace(TRACE_INTERNAL, "%s: session(server->remote) ::= %p", __func__, sml_data_sync_session_get_remote(dss)); + smlTrace(TRACE_INTERNAL, "%s: session(server->remote) ::= %s", __func__, sml_location_get_full_uri(sml_data_sync_session_get_remote(dss))); + smlTrace(TRACE_INTERNAL, "%s: session(server->local) ::= %p", __func__, sml_data_sync_session_get_local(dss)); + smlTrace(TRACE_INTERNAL, "%s: session(server->local) ::= %s", __func__, sml_location_get_full_uri(sml_data_sync_session_get_local(dss))); + GList *list = clients; + SmlDataSyncTestClient *client = NULL; + for (;list; list = list->next) { + client = list->data; + smlTrace(TRACE_INTERNAL, "%s: client(local) ::= %p", __func__, sml_data_sync_get_local(client->client)); + smlTrace(TRACE_INTERNAL, "%s: client(local) ::= %s", __func__, sml_location_get_full_uri(sml_data_sync_get_local(client->client))); + smlTrace(TRACE_INTERNAL, "%s: client(remote) ::= %p", __func__, sml_data_sync_get_remote(client->client)); + smlTrace(TRACE_INTERNAL, "%s: client(remote) ::= %s", __func__, sml_location_get_full_uri(sml_data_sync_get_remote(client->client))); + if (sml_location_is_equal(sml_data_sync_get_local(client->client), sml_data_sync_session_get_remote(dss))) + { + /* correct client */ + continue; + smlTrace(TRACE_INTERNAL, "%s - correct client", __func__); + } else { + /* wrong client */ + client = NULL; + } + } + sml_fail_unless(client != NULL, "Cannot find correct client."); + /* handle the item */ - GList *list = client_items; + list = client->items; size_t count = 0; for (; list; list = list->next) { count++; @@ -248,13 +281,23 @@ // return SML_ALERT_UNKNOWN; //} -void init_testbed(const char *transport_type, const char *port) +void init_testbed(unsigned int peers, const char *transport_type, const char *port) { /* general init */ setup_testbed(NULL); GError *error = NULL; - client_items = NULL; - + + /* initialize clients */ + clients = NULL; + unsigned int i = 0; + for (;i < peers; i++) + { + SmlDataSyncTestClient *client = smlTryMalloc0(sizeof(SmlDataSyncTestClient), &error); + if (!client) + goto error; + clients = g_list_append(clients, client); + } + #ifdef ENABLE_OPENOBEX_TCP transport = "OBEX"; #endif @@ -273,22 +316,32 @@ #endif if (!strcmp(transport, "HTTP")) { - client = sml_data_sync_new(); - if (!sml_data_sync_set_session_type(client, SML_SESSION_TYPE_CLIENT, &error)) - goto error; - if (!sml_data_sync_set_transport_type(client, SML_TRANSPORT_HTTP_CLIENT, &error)) - goto error; + GList *list = clients; + for (; list; list = list->next) + { + SmlDataSyncTestClient *client = list->data; + client->client = sml_data_sync_new(); + if (!sml_data_sync_set_session_type(client->client, SML_SESSION_TYPE_CLIENT, &error)) + goto error; + if (!sml_data_sync_set_transport_type(client->client, SML_TRANSPORT_HTTP_CLIENT, &error)) + goto error; + } server = sml_data_sync_new(); if (!sml_data_sync_set_session_type(server, SML_SESSION_TYPE_SERVER, &error)) goto error; if (!sml_data_sync_set_transport_type(server, SML_TRANSPORT_HTTP_SERVER, &error)) goto error; } else { - client = sml_data_sync_new(); - if (!sml_data_sync_set_session_type(client, SML_SESSION_TYPE_CLIENT, &error)) - goto error; - if (!sml_data_sync_set_transport_type(client, SML_TRANSPORT_OBEX_SERVER, &error)) - goto error; + GList *list = clients; + for (; list; list = list->next) + { + SmlDataSyncTestClient *client = list->data; + client->client = sml_data_sync_new(); + if (!sml_data_sync_set_session_type(client->client, SML_SESSION_TYPE_CLIENT, &error)) + goto error; + if (!sml_data_sync_set_transport_type(client->client, SML_TRANSPORT_OBEX_SERVER, &error)) + goto error; + } server = sml_data_sync_new(); if (!sml_data_sync_set_session_type(server, SML_SESSION_TYPE_SERVER, &error)) goto error; @@ -296,29 +349,68 @@ goto error; } + /* client configuration */ + + GList *list = clients; + unsigned int count = 0; + for (; list; list = list->next) + { + count++; + SmlDataSyncTestClient *client = list->data; + + /* set identifier for test verification */ + gchar *name = g_strdup_printf("client %d", count); + if (!sml_data_sync_set_option (client->client, + SML_DATA_SYNC_CONFIG_IDENTIFIER, + name, + &error)) + goto error; + if (!sml_data_sync_set_option (client->client, + SML_DATA_SYNC_CONFIG_TARGET, + "account", + &error)) + goto error; + smlSafeCFree(&name); + + + /* default configuration of callbacks */ + sml_data_sync_register_event_callback(client->client, recvEventCallback, client); + + /* configure transport */ + if (!strcmp(transport, "HTTP")) { + /* HTTP */ + char *url = g_strdup_printf("http://127.0.0.1:%s", port); + if (!sml_data_sync_set_option( + client->client, + SML_TRANSPORT_CONFIG_URL, + url, &error)) + goto error; + smlSafeCFree(&url); + } else { + /* OBEX */ + if (!sml_data_sync_set_option( + client->client, + SML_DATA_SYNC_CONFIG_CONNECTION_TYPE, + SML_DATA_SYNC_CONFIG_CONNECTION_NET, + &error)) + goto error; + if (!sml_data_sync_set_option( + client->client, + SML_TRANSPORT_CONFIG_PORT, + port, &error)) + goto error; + } + } + + /* server configuration */ + /* default configuration of callbacks */ - sml_data_sync_register_event_callback(client, recvEventCallback, NULL); sml_data_sync_register_event_callback(server, recvEventCallback, NULL); /* configure transport */ - if (!strcmp(transport, "HTTP")) { - /* HTTP */ - char *url = g_strdup_printf("http://127.0.0.1:%s", port); - if (!sml_data_sync_set_option( - client, - SML_TRANSPORT_CONFIG_URL, - url, &error)) - goto error; - smlSafeCFree(&url); - } else { + if (strcmp(transport, "HTTP")) { /* OBEX */ if (!sml_data_sync_set_option( - client, - SML_DATA_SYNC_CONFIG_CONNECTION_TYPE, - SML_DATA_SYNC_CONFIG_CONNECTION_NET, - &error)) - goto error; - if (!sml_data_sync_set_option( server, SML_DATA_SYNC_CONFIG_CONNECTION_TYPE, SML_DATA_SYNC_CONFIG_CONNECTION_NET, @@ -329,11 +421,6 @@ SML_TRANSPORT_CONFIG_URL, "127.0.0.1", &error)) goto error; - if (!sml_data_sync_set_option( - client, - SML_TRANSPORT_CONFIG_PORT, - port, &error)) - goto error; } if (!sml_data_sync_set_option( server, @@ -349,26 +436,49 @@ void run_testbed() { GError *error = NULL; - locks = 2; + locks = 2*g_list_length(clients); + + runMutex = g_mutex_new(); + g_mutex_lock(runMutex); /* init the sync */ if (!strcmp(transport, "HTTP")) { if (!sml_data_sync_initialize(server, &error)) goto error; - if (!sml_data_sync_initialize(client, &error)) - goto error; + GList *list = clients; + for (; list; list = list->next) + { + SmlDataSyncTestClient *client = list->data; + if (!sml_data_sync_initialize(client->client, &error)) + goto error; + } if (!sml_data_sync_run(server, &error)) goto error; - if (!sml_data_sync_run(client, &error)) - goto error; + list = clients; + for (; list; list = list->next) + { + SmlDataSyncTestClient *client = list->data; + if (!sml_data_sync_run(client->client, &error)) + goto error; + } } else { - if (!sml_data_sync_initialize(client, &error)) - goto error; + GList *list = clients; + for (; list; list = list->next) + { + SmlDataSyncTestClient *client = list->data; + if (!sml_data_sync_initialize(client->client, &error)) + goto error; + } if (!sml_data_sync_initialize(server, &error)) goto error; - if (!sml_data_sync_run(client, &error)) - goto error; + list = clients; + for (; list; list = list->next) + { + SmlDataSyncTestClient *client = list->data; + if (!sml_data_sync_run(client->client, &error)) + goto error; + } /* The OBEX server needs some time to start. */ if (g_getenv("SYNCML_TRACE")) usleep(2000); @@ -378,37 +488,47 @@ goto error; } - runMutex = g_mutex_new(); - g_mutex_lock(runMutex); g_mutex_lock(runMutex); g_mutex_unlock(runMutex); g_mutex_free(runMutex); runMutex = NULL; /* close the object */ - g_object_unref(client); + GList *list = clients; + for (; list; list = list->next) + { + SmlDataSyncTestClient *client = list->data; + g_object_unref(client->client); + g_list_free(client->items); + } g_object_unref(server); - g_list_free(client_items); return; error: + if (runMutex) { + g_mutex_trylock(runMutex); + g_mutex_unlock(runMutex); + g_mutex_free(runMutex); + runMutex = NULL; + } sml_fail_unless(FALSE, "%s", error->message); } START_TEST (ds_api_text_vcard_21) { GError *error = NULL; - init_testbed("HTTP", "17001"); + init_testbed(1, "HTTP", "17001"); /* register datastore * the source must be identical because this is http */ - client_data_store = sml_data_sync_data_store_new(); - sml_data_sync_data_store_set_content_type (client_data_store, "text/x-vcard"); - sml_data_sync_data_store_set_local_uri (client_data_store, "contacts"); - sml_data_sync_data_store_register_change_callback(client_data_store, recvChangeCallback, NULL); - if (!sml_data_sync_add_data_store(client, client_data_store, &error)) + SmlDataSyncTestClient *client = clients->data; + client->data_store = sml_data_sync_data_store_new(); + sml_data_sync_data_store_set_content_type (client->data_store, "text/x-vcard"); + sml_data_sync_data_store_set_local_uri (client->data_store, "contacts"); + sml_data_sync_data_store_register_change_callback(client->data_store, recvChangeCallback, client); + if (!sml_data_sync_add_data_store(client->client, client->data_store, &error)) goto error; server_data_store = sml_data_sync_data_store_new(); @@ -419,7 +539,7 @@ goto error; /* configure test data */ - client_items = g_list_append(client_items, (char *) "blabla"); + client->items = g_list_append(client->items, (char *) "blabla"); run_testbed(); @@ -432,17 +552,18 @@ START_TEST (ds_api_image_jpeg) { GError *error = NULL; - init_testbed("OBEX", "17002"); + init_testbed(1, "OBEX", "17002"); /* register datastore * the source must be identical if this is http */ - client_data_store = sml_data_sync_data_store_new(); - sml_data_sync_data_store_set_content_type (client_data_store, "image/jpeg"); - sml_data_sync_data_store_set_local_uri (client_data_store, "dcim"); - sml_data_sync_data_store_register_change_callback(client_data_store, recvChangeCallback, NULL); - if (!sml_data_sync_add_data_store(client, client_data_store, &error)) + SmlDataSyncTestClient *client = clients->data; + client->data_store = sml_data_sync_data_store_new(); + sml_data_sync_data_store_set_content_type (client->data_store, "image/jpeg"); + sml_data_sync_data_store_set_local_uri (client->data_store, "dcim"); + sml_data_sync_data_store_register_change_callback(client->data_store, recvChangeCallback, NULL); + if (!sml_data_sync_add_data_store(client->client, client->data_store, &error)) goto error; server_data_store = sml_data_sync_data_store_new(); @@ -456,7 +577,7 @@ goto error; /* configure test data */ - client_items = g_list_append(client_items, (char *) "this is an image"); + client->items = g_list_append(client->items, (char *) "this is an image"); run_testbed(); @@ -469,17 +590,18 @@ START_TEST (ds_api_unknown_ct) { GError *error = NULL; - init_testbed("HTTP", "17003"); + init_testbed(1, "HTTP", "17003"); /* register datastore * the source must be identical because this is http */ - client_data_store = sml_data_sync_data_store_new(); - sml_data_sync_data_store_set_content_type (client_data_store, "unknown/content-type"); - sml_data_sync_data_store_set_local_uri (client_data_store, "data"); - sml_data_sync_data_store_register_change_callback(client_data_store, recvChangeCallback, NULL); - if (!sml_data_sync_add_data_store(client, client_data_store, &error)) + SmlDataSyncTestClient *client = clients->data; + client->data_store = sml_data_sync_data_store_new(); + sml_data_sync_data_store_set_content_type (client->data_store, "unknown/content-type"); + sml_data_sync_data_store_set_local_uri (client->data_store, "data"); + sml_data_sync_data_store_register_change_callback(client->data_store, recvChangeCallback, NULL); + if (!sml_data_sync_add_data_store(client->client, client->data_store, &error)) goto error; server_data_store = sml_data_sync_data_store_new(); @@ -490,7 +612,7 @@ goto error; /* configure test data */ - client_items = g_list_append(client_items, (char *) "this is some data"); + client->items = g_list_append(client->items, (char *) "this is some data"); run_testbed(); @@ -503,17 +625,18 @@ START_TEST (ds_api_multi_text_vcard_21) { GError *error = NULL; - init_testbed("HTTP", "17004"); + init_testbed(1, "HTTP", "17004"); /* register datastore * the source must be identical because this is http */ - client_data_store = sml_data_sync_data_store_new(); - sml_data_sync_data_store_set_content_type (client_data_store, "text/x-vcard"); - sml_data_sync_data_store_set_local_uri (client_data_store, "contacts"); - sml_data_sync_data_store_register_change_callback(client_data_store, recvChangeCallback, NULL); - if (!sml_data_sync_add_data_store(client, client_data_store, &error)) + SmlDataSyncTestClient *client = clients->data; + client->data_store = sml_data_sync_data_store_new(); + sml_data_sync_data_store_set_content_type (client->data_store, "text/x-vcard"); + sml_data_sync_data_store_set_local_uri (client->data_store, "contacts"); + sml_data_sync_data_store_register_change_callback(client->data_store, recvChangeCallback, NULL); + if (!sml_data_sync_add_data_store(client->client, client->data_store, &error)) goto error; server_data_store = sml_data_sync_data_store_new(); @@ -527,7 +650,7 @@ int max_items = 10000; int i; for(i = 0; i < max_items; i++) { - client_items = g_list_append(client_items, (char *) "client data"); + client->items = g_list_append(client->items, (char *) "client data"); } run_testbed(); |