tracker r2131 - in branches/indexer-split: . src/tracker-indexer tests tests/tracker-indexer
- From: ifrade svn gnome org
- To: svn-commits-list gnome org
- Subject: tracker r2131 - in branches/indexer-split: . src/tracker-indexer tests tests/tracker-indexer
- Date: Thu, 21 Aug 2008 11:13:22 +0000 (UTC)
Author: ifrade
Date: Thu Aug 21 11:13:22 2008
New Revision: 2131
URL: http://svn.gnome.org/viewvc/tracker?rev=2131&view=rev
Log:
Added method to calculate diff between metadata of the file. Included unit tests
Added:
branches/indexer-split/tests/tracker-indexer/
branches/indexer-split/tests/tracker-indexer/Makefile.am
branches/indexer-split/tests/tracker-indexer/tracker-metadata-utils-test.c
Modified:
branches/indexer-split/ChangeLog
branches/indexer-split/configure.ac
branches/indexer-split/src/tracker-indexer/tracker-metadata-utils.c
branches/indexer-split/src/tracker-indexer/tracker-metadata-utils.h
branches/indexer-split/tests/Makefile.am
Modified: branches/indexer-split/configure.ac
==============================================================================
--- branches/indexer-split/configure.ac (original)
+++ branches/indexer-split/configure.ac Thu Aug 21 11:13:22 2008
@@ -245,12 +245,10 @@
glib_pkgconfig=$glib_pkgconfig_tmp
AC_PATH_PROG(GTESTER, [gtester], [no] )
if test "x$GTESTER" = "xno" ; then
- AC_MSG_ERROR([*** Gtester is not in the path])
+ AC_MSG_ERROR([*** Gtester is not in the path])
else
- PKG_CHECK_MODULES(XESAM_GLIB,
- xesam-glib,
- [have_xesam_glib=yes],
- [have_xesam_glib=no])
+ PKG_CHECK_MODULES(XESAM_GLIB,
+ xesam-glib, [have_xesam_glib=yes], [have_xesam_glib=no])
fi
fi
else
@@ -935,6 +933,11 @@
AC_DEFINE(HAVE_HILDON_THUMBNAIL, 1, [Define if we have hildon-thumbnail])
fi
+AC_CONFIG_LINKS(tests/tracker-indexer/tracker-metadata.c:src/tracker-indexer/tracker-metadata.c
+ tests/tracker-indexer/tracker-metadata.h:src/tracker-indexer/tracker-metadata.h
+ tests/tracker-indexer/tracker-metadata-utils.c:src/tracker-indexer/tracker-metadata-utils.c
+ tests/tracker-indexer/tracker-metadata-utils.h:src/tracker-indexer/tracker-metadata-utils.h)
+
##################################################################
# Write generated files
##################################################################
@@ -992,6 +995,7 @@
tests/scripts/Makefile
tests/trackerd/Makefile
tests/trackerd/xesam/Makefile
+ tests/tracker-indexer/Makefile
thumbnailers/application/Makefile
thumbnailers/image/Makefile
thumbnailers/Makefile
Modified: branches/indexer-split/src/tracker-indexer/tracker-metadata-utils.c
==============================================================================
--- branches/indexer-split/src/tracker-indexer/tracker-metadata-utils.c (original)
+++ branches/indexer-split/src/tracker-indexer/tracker-metadata-utils.c Thu Aug 21 11:13:22 2008
@@ -299,3 +299,245 @@
return metadata;
}
+
+typedef struct {
+ TrackerMetadata *old_metadata;
+ TrackerMetadata *new_metadata;
+ GSList *actions;
+} MergeForeach;
+
+static gboolean
+lists_equal (GList *one, GList *two)
+{
+ GList *one_iter, *two_iter;
+
+ one_iter = one;
+ two_iter = two;
+
+ if (g_list_length (one_iter) != g_list_length (two_iter)) {
+ return FALSE;
+ }
+
+
+ for (one_iter = one, two_iter = two;
+ one_iter != NULL && two_iter != NULL;
+ one_iter = one_iter->next, two_iter = two_iter->next) {
+ if (strcmp ((gchar *) one_iter->data, (gchar *) two_iter->data)) {
+ return FALSE;
+ }
+
+ }
+ return TRUE;
+}
+
+static MetadataActionItem *
+metadata_action_item_new () {
+
+ MetadataActionItem *action;
+
+ action = g_slice_new (MetadataActionItem);
+
+ action->action = TRACKER_METADATA_ACTION_NEW;
+ action->metadata_type = NULL;
+
+ action->old_value = NULL;
+ action->new_value = NULL;
+
+ action->old_values = NULL;
+ action->new_values = NULL;
+
+ return action;
+}
+
+static void
+calculate_merge_action (TrackerField *field,
+ gpointer value,
+ gpointer user_data) {
+
+ MergeForeach *data;
+ MetadataActionItem *action;
+
+ data = (MergeForeach *) user_data;
+
+ if (tracker_field_get_multiple_values (field)) {
+
+ const GList *old_values;
+
+ old_values = tracker_metadata_lookup_multiple_values (data->old_metadata,
+ tracker_field_get_name (field));
+
+ if (!old_values) {
+ action = metadata_action_item_new ();
+
+ action->action = TRACKER_METADATA_ACTION_NEW;
+ action->metadata_type = g_strdup (tracker_field_get_name (field));
+ action->old_values = NULL;
+ action->new_values = g_list_copy ((GList *)value);
+
+ data->actions = g_slist_prepend (data->actions, action);
+ return;
+ }
+
+ if (old_values && !value) {
+ action = metadata_action_item_new ();
+
+ action->action = TRACKER_METADATA_ACTION_DELETE;
+ action->metadata_type = g_strdup (tracker_field_get_name (field));
+ action->old_values = old_values;
+ action->new_value = NULL;
+
+ data->actions = g_slist_prepend (data->actions, action);
+ return;
+ }
+
+ if (!lists_equal (old_values, (GList *)value)) {
+ action = metadata_action_item_new ();
+
+ action->action = TRACKER_METADATA_ACTION_UPDATE;
+ action->metadata_type = g_strdup (tracker_field_get_name (field));
+ action->old_values = g_list_copy (old_values);
+ action->new_values = g_list_copy ((GList *)value);
+
+ data->actions = g_slist_prepend (data->actions, action);
+ return;
+ }
+
+ } else {
+
+ const gchar *old_value;
+
+ old_value = tracker_metadata_lookup (data->old_metadata,
+ tracker_field_get_name (field));
+
+ /* New metadata */
+ if (!old_value) {
+ action = metadata_action_item_new ();
+
+ action->action = TRACKER_METADATA_ACTION_NEW;
+ action->metadata_type = g_strdup (tracker_field_get_name (field));
+ action->old_value = NULL;
+ action->new_value = g_strdup ((const gchar *)value);
+
+ data->actions = g_slist_prepend (data->actions, action);
+ return;
+ }
+
+ /* Metadata with previous value but now is NULL: Delete */
+ if (old_value && !value) {
+ action = metadata_action_item_new ();
+
+ action->action = TRACKER_METADATA_ACTION_DELETE;
+ action->metadata_type = g_strdup (tracker_field_get_name (field));
+ action->old_value = g_strdup (old_value);
+ action->new_value = NULL;
+
+ data->actions = g_slist_prepend (data->actions, action);
+ return;
+ }
+
+ /* Different old and new values: Update */
+ if (strcmp (old_value, (const gchar *)value) != 0) {
+ action = metadata_action_item_new ();
+
+ action->action = TRACKER_METADATA_ACTION_UPDATE;
+ action->metadata_type = g_strdup (tracker_field_get_name (field));
+ action->old_value = g_strdup (old_value);
+ action->new_value = g_strdup ((const gchar *)value);
+
+ data->actions = g_slist_prepend (data->actions, action);
+ return;
+ }
+ }
+}
+
+
+static void
+add_deleted_items (TrackerField *field,
+ gpointer value,
+ gpointer user_data)
+{
+ MergeForeach *data;
+
+ data = (MergeForeach *)user_data;
+
+ /*
+ * If the metadata is embedded and is not in the new metadata set
+ * of the file, we move it to "new metadata" with NULL value, to
+ * remove it from the DB.
+ *
+ * If the metadata is not embedded we must not remove it! (For instance,
+ * playcount of a music file).
+ */
+ if (tracker_field_get_multiple_values (field)) {
+ if (!tracker_metadata_lookup_multiple_values (data->new_metadata,
+ tracker_field_get_name (field))
+ && tracker_field_get_embedded (field)) {
+ tracker_metadata_insert_multiple_values (data->new_metadata,
+ tracker_field_get_name (field),
+ NULL);
+ }
+
+ } else {
+ if (!tracker_metadata_lookup (data->new_metadata,
+ tracker_field_get_name (field))
+ && tracker_field_get_embedded (field)) {
+
+ tracker_metadata_insert (data->new_metadata,
+ tracker_field_get_name (field),
+ NULL);
+ }
+ }
+}
+
+
+GSList *
+tracker_metadata_utils_calculate_merge (TrackerMetadata *old_metadata,
+ TrackerMetadata *new_metadata)
+{
+ MergeForeach data;
+
+ data.old_metadata = old_metadata;
+ data.new_metadata = new_metadata;
+ data.actions = NULL;
+
+ /*
+ * First we check all the old metadata are in the new metadata.
+ * If a metadata is embedded and is not in the new metadata, we
+ * must remove it from the DB. We indicate that adding it to the
+ * new metadata with a NULL value.
+ */
+ tracker_metadata_foreach (old_metadata,
+ add_deleted_items,
+ &data);
+
+ /*
+ * Traverse the new metadata table, checking old and new value, and
+ * decide what action is required in the DB.
+ */
+ tracker_metadata_foreach (new_metadata,
+ calculate_merge_action,
+ &data);
+
+ return data.actions;
+}
+
+void
+tracker_metadata_utils_action_item_free (MetadataActionItem *item, gpointer user_data)
+{
+ if (!item) {
+ return;
+ }
+
+ if (item->old_value) {
+ g_free (item->old_value);
+ }
+
+ if (item->new_value) {
+ g_free (item->new_value);
+ }
+
+ if (item->metadata_type) {
+ g_free (item->metadata_type);
+ }
+
+}
Modified: branches/indexer-split/src/tracker-indexer/tracker-metadata-utils.h
==============================================================================
--- branches/indexer-split/src/tracker-indexer/tracker-metadata-utils.h (original)
+++ branches/indexer-split/src/tracker-indexer/tracker-metadata-utils.h Thu Aug 21 11:13:22 2008
@@ -26,8 +26,33 @@
G_BEGIN_DECLS
+typedef enum {
+ TRACKER_METADATA_ACTION_NEW,
+ TRACKER_METADATA_ACTION_DELETE,
+ TRACKER_METADATA_ACTION_UPDATE
+} MetadataMergeAction;
+
+typedef struct {
+ MetadataMergeAction action;
+ gchar *metadata_type;
+ /* Metadata type with single value */
+ gchar *old_value;
+ gchar *new_value;
+ /* Metadata type with ultiple value */
+ GList *old_values;
+ GList *new_values;
+} MetadataActionItem;
+
+void tracker_metadata_utils_action_item_free (MetadataActionItem *item,
+ gpointer user_data);
+
TrackerMetadata * tracker_metadata_utils_get_data (const gchar *file);
+GSList * tracker_metadata_utils_calculate_merge (TrackerMetadata *old_metadata,
+ TrackerMetadata *new_metadata);
+
+
+
G_END_DECLS
#endif /* __TRACKER_METADATA_UTILS_H__ */
Modified: branches/indexer-split/tests/Makefile.am
==============================================================================
--- branches/indexer-split/tests/Makefile.am (original)
+++ branches/indexer-split/tests/Makefile.am Thu Aug 21 11:13:22 2008
@@ -4,5 +4,6 @@
libtracker-common \
trackerd \
scripts \
- libtracker-db
+ libtracker-db \
+ tracker-indexer
Added: branches/indexer-split/tests/tracker-indexer/Makefile.am
==============================================================================
--- (empty file)
+++ branches/indexer-split/tests/tracker-indexer/Makefile.am Thu Aug 21 11:13:22 2008
@@ -0,0 +1,32 @@
+include $(top_srcdir)/Makefile.decl
+
+noinst_PROGRAMS = $(TEST_PROGS)
+
+TEST_PROGS += tracker-metadata-utils
+
+INCLUDES = \
+ -g \
+ -DG_LOG_DOMAIN=\"Tracker\" \
+ -DEXTRACTOR_PATH=\""$(libexecdir)/tracker-extract"\" \
+ -I$(top_srcdir)/src \
+ -I$(top_srcdir)/tests/common \
+ $(GMODULE_CFLAGS) \
+ $(GTHREAD_CFLAGS) \
+ $(GLIB2_CFLAGS)
+
+
+tracker_metadata_utils_SOURCES = \
+ tracker-metadata-utils-test.c \
+ tracker-metadata-utils.c \
+ tracker-metadata.c
+
+tracker_metadata_utils_LDADD = \
+ $(top_builddir)/src/libtracker-db/libtracker-db.la \
+ $(top_builddir)/src/libtracker-common/libtracker-common.la \
+ $(top_builddir)/tests/common/libtracker-testcommon.la \
+ $(top_builddir)/src/xdgmime/libxdgmime.la \
+ $(GMODULE_LIBS) \
+ $(GTHREAD_LIBS) \
+ $(GIO_LIBS) \
+ $(GLIB2_LIBS)
+
Added: branches/indexer-split/tests/tracker-indexer/tracker-metadata-utils-test.c
==============================================================================
--- (empty file)
+++ branches/indexer-split/tests/tracker-indexer/tracker-metadata-utils-test.c Thu Aug 21 11:13:22 2008
@@ -0,0 +1,359 @@
+#include <glib.h>
+#include <glib/gtestutils.h>
+#include <string.h>
+#include <libtracker-common/tracker-ontology.h>
+#include <libtracker-common/tracker-type-utils.h>
+#include <tracker-test-helpers.h>
+#include "tracker-metadata-utils.h"
+
+/* From src/tracker-indexer/tracker-metadata-utils.c */
+#define METADATA_FILE_EXT "File:Ext"
+#define METADATA_FILE_PATH "File:Path"
+#define METADATA_FILE_NAME "File:Name"
+#define METADATA_FILE_SIZE "File:Size"
+
+#define TEST_METADATA_PLAYCOUNT "Audio:Playcount"
+#define TEST_METADATA_SUBJECT "DC:Subject"
+#define TEST_METADATA_USER_KEYWORDS "User:Keywords"
+
+static void
+ontology_init ()
+{
+ TrackerField *ext, *name, *path, *size, *playcount, *dc_subject, *user_keywords;
+
+ tracker_ontology_init ();
+
+ ext = g_object_new (TRACKER_TYPE_FIELD,
+ "name", METADATA_FILE_EXT,
+ "embedded", TRUE,
+ "multiple-values", FALSE,
+ NULL);
+
+ name = g_object_new (TRACKER_TYPE_FIELD,
+ "name", METADATA_FILE_NAME,
+ "embedded", TRUE,
+ "multiple-values", FALSE,
+ NULL);
+ path = g_object_new (TRACKER_TYPE_FIELD,
+ "name", METADATA_FILE_PATH,
+ "embedded", TRUE,
+ "multiple-values", FALSE,
+ NULL);
+
+ size = g_object_new (TRACKER_TYPE_FIELD,
+ "name", METADATA_FILE_SIZE,
+ "embedded", TRUE,
+ "multiple-values", FALSE,
+ NULL);
+
+ playcount = g_object_new (TRACKER_TYPE_FIELD,
+ "name", TEST_METADATA_PLAYCOUNT,
+ "embedded", FALSE,
+ "multiple-values", FALSE,
+ NULL);
+
+ dc_subject = g_object_new (TRACKER_TYPE_FIELD,
+ "name", TEST_METADATA_SUBJECT,
+ "embedded", TRUE,
+ "multiple-values", TRUE,
+ NULL);
+
+ user_keywords = g_object_new (TRACKER_TYPE_FIELD,
+ "name", TEST_METADATA_USER_KEYWORDS,
+ "embedded", FALSE,
+ "multiple-values", TRUE,
+ NULL);
+ tracker_ontology_add_field (ext);
+ tracker_ontology_add_field (name);
+ tracker_ontology_add_field (path);
+ tracker_ontology_add_field (size);
+ tracker_ontology_add_field (playcount);
+ tracker_ontology_add_field (dc_subject);
+ tracker_ontology_add_field (user_keywords);
+}
+
+static void
+ontology_shutdown ()
+{
+ tracker_ontology_shutdown ();
+}
+
+static GList *
+array_to_glist (gchar **elements)
+{
+ GList *result = NULL;
+ guint i;
+
+ if (!elements) {
+ return NULL;
+ }
+
+ for (i = 0; i < g_strv_length (elements); i++) {
+ result = g_list_append (result, elements[i]);
+ }
+
+ return result;
+}
+
+static gboolean
+action_in_list (GSList *actions, MetadataMergeAction action, const gchar *field_name)
+{
+ GSList *iter;
+
+ for (iter = actions; iter != NULL; iter = iter->next) {
+ MetadataActionItem *item = (MetadataActionItem *)iter->data;
+
+ if (item->action == action
+ && !strcmp (item->metadata_type, field_name)) {
+ return TRUE;
+ }
+ }
+
+ return FALSE;
+}
+
+
+static TrackerMetadata *
+get_metadata_table (const gchar *path,
+ const gchar *name,
+ const gchar *ext,
+ const gchar *playcount,
+ gchar **subject,
+ gchar **user_keywords) {
+
+ TrackerMetadata *table;
+
+ table = tracker_metadata_new ();
+
+ if (ext) {
+ tracker_metadata_insert (table, METADATA_FILE_EXT, g_strdup (ext));
+ }
+
+ if (path) {
+ tracker_metadata_insert (table, METADATA_FILE_PATH, g_strdup (path));
+ }
+
+ if (name) {
+ tracker_metadata_insert (table, METADATA_FILE_NAME, g_strdup (name));
+ }
+
+ if (playcount) {
+ tracker_metadata_insert (table, TEST_METADATA_PLAYCOUNT, g_strdup (playcount));
+ }
+
+ if (subject) {
+ tracker_metadata_insert_multiple_values (table,
+ TEST_METADATA_SUBJECT,
+ array_to_glist (subject));
+ }
+
+ if (user_keywords) {
+ tracker_metadata_insert_multiple_values (table,
+ TEST_METADATA_USER_KEYWORDS,
+ array_to_glist (subject));
+ }
+
+ tracker_metadata_insert (table, METADATA_FILE_SIZE, "0");
+
+ return table;
+}
+
+static void
+test_merge_no_changes ()
+{
+ TrackerMetadata *one;
+
+ g_assert (TRACKER_IS_FIELD (tracker_ontology_get_field_def (METADATA_FILE_EXT)));
+ one = get_metadata_table ("/test", "test-image", "png", NULL, NULL, NULL);
+ g_assert (!tracker_metadata_utils_calculate_merge (one, one));
+}
+
+static void
+test_merge_update_field ()
+{
+
+ TrackerMetadata *one, *two;
+ GSList *actions;
+
+ one = get_metadata_table ("/test", "test-image", "png", "0", NULL, NULL);
+ two = get_metadata_table ("/test", "test-image", "jpeg", NULL, NULL, NULL);
+ actions = tracker_metadata_utils_calculate_merge (one, two);
+
+ /* Expected one action, type update, property File:Ext
+ *
+ */
+ g_assert (actions);
+ g_assert_cmpint (g_slist_length (actions), ==, 1);
+
+ g_assert (action_in_list (actions, TRACKER_METADATA_ACTION_UPDATE, METADATA_FILE_EXT));
+
+ g_assert_cmpint (((MetadataActionItem*)actions->data)->action, ==, TRACKER_METADATA_ACTION_UPDATE);
+ g_assert (tracker_test_helpers_cmpstr_equal ("png", ((MetadataActionItem*)actions->data)->old_value));
+ g_assert (tracker_test_helpers_cmpstr_equal ("jpeg", ((MetadataActionItem*)actions->data)->new_value));
+
+ g_slist_foreach (actions, (GFunc)tracker_metadata_utils_action_item_free, NULL);
+}
+
+static void
+test_merge_delete_field ()
+{
+ TrackerMetadata *one, *two;
+ GSList *actions;
+
+ one = get_metadata_table ("/test", "test-image", "png", "0", NULL, NULL);
+ two = get_metadata_table ("/test", "test-image", NULL, NULL, NULL, NULL);
+ actions = tracker_metadata_utils_calculate_merge (one, two);
+
+ /* Expected one action, type delete, property File:Ext
+ * (The embedded data remain in the DB!)
+ */
+ g_assert (actions);
+ g_assert_cmpint (g_slist_length (actions), ==, 1);
+ g_assert_cmpint (((MetadataActionItem*)actions->data)->action, ==, TRACKER_METADATA_ACTION_DELETE);
+ g_assert (tracker_test_helpers_cmpstr_equal ("png", ((MetadataActionItem*)actions->data)->old_value));
+ g_assert ( !(((MetadataActionItem*)actions->data)->new_value) );
+
+ g_slist_foreach (actions, (GFunc)tracker_metadata_utils_action_item_free, NULL);
+}
+
+static void
+test_merge_new_field ()
+{
+ TrackerMetadata *one, *two;
+ GSList *actions;
+
+ one = get_metadata_table ("/test", "test-image", NULL, "0", NULL, NULL);
+ two = get_metadata_table ("/test", "test-image", "png", NULL, NULL, NULL);
+ actions = tracker_metadata_utils_calculate_merge (one, two);
+
+ /* Expected one action, type new , property File:Ext
+ * (The embedded data remain in the DB!)
+ */
+ g_assert (actions);
+ g_assert_cmpint (g_slist_length (actions), ==, 1);
+ g_assert_cmpint (((MetadataActionItem*)actions->data)->action, ==, TRACKER_METADATA_ACTION_NEW);
+ g_assert (tracker_test_helpers_cmpstr_equal ("png", ((MetadataActionItem*)actions->data)->new_value));
+ g_assert ( !(((MetadataActionItem*)actions->data)->old_value) );
+
+ g_slist_foreach (actions, (GFunc)tracker_metadata_utils_action_item_free, NULL);
+}
+
+static void
+test_merge_no_changes_mv_embedded ()
+{
+ TrackerMetadata *one, *two;
+ GSList *actions = NULL;
+ gchar *subject[] = {"line1", "line2", NULL};
+
+ one = get_metadata_table ("/test", "test-image", NULL, NULL, subject, NULL);
+ two = get_metadata_table ("/test", "test-image", NULL, NULL, subject, NULL);
+ actions = tracker_metadata_utils_calculate_merge (one, two);
+
+ g_assert (!actions);
+}
+
+static void
+test_merge_update_mv_embedded ()
+{
+ TrackerMetadata *one, *two;
+ GSList *actions = NULL;
+ gchar *subject_1[] = {"line1", "line2", NULL};
+ gchar *subject_2[] = {"line1", "line3", NULL};
+
+ one = get_metadata_table ("/test", "test-image", NULL, NULL, subject_1, NULL);
+ two = get_metadata_table ("/test", "test-image", NULL, NULL, subject_2, NULL);
+ actions = tracker_metadata_utils_calculate_merge (one, two);
+
+ g_assert (actions);
+ g_assert (action_in_list (actions, TRACKER_METADATA_ACTION_UPDATE, TEST_METADATA_SUBJECT));
+}
+
+static void
+test_merge_delete_mv_embedded ()
+{
+ TrackerMetadata *one, *two;
+ GSList *actions = NULL;
+ gchar *subject[] = {"line1", "line2", NULL};
+
+ one = get_metadata_table ("/test", "test-image", NULL, NULL, subject, NULL);
+ two = get_metadata_table ("/test", "test-image", NULL, NULL, NULL, NULL);
+ actions = tracker_metadata_utils_calculate_merge (one, two);
+
+ g_assert (actions);
+ g_assert (action_in_list (actions, TRACKER_METADATA_ACTION_DELETE, TEST_METADATA_SUBJECT));
+}
+
+static void
+test_merge_new_mv_embedded ()
+{
+ TrackerMetadata *one, *two;
+ GSList *actions = NULL;
+ gchar *subject[] = {"line1", "line2", NULL};
+
+ one = get_metadata_table ("/test", "test-image", NULL, NULL, NULL, NULL);
+ two = get_metadata_table ("/test", "test-image", NULL, NULL, subject, NULL);
+ actions = tracker_metadata_utils_calculate_merge (one, two);
+
+ g_assert (actions);
+ g_assert (action_in_list (actions, TRACKER_METADATA_ACTION_NEW, TEST_METADATA_SUBJECT));
+}
+
+
+static void
+test_merge_update_mv_no_embedded ()
+{
+ TrackerMetadata *one, *two;
+ GSList *actions = NULL;
+ gchar *keywords[] = {"tag1", "tag2", NULL};
+
+ one = get_metadata_table ("/test", "test-image", NULL, NULL, NULL, keywords);
+ two = get_metadata_table ("/test", "test-image", NULL, NULL, NULL, NULL);
+ actions = tracker_metadata_utils_calculate_merge (one, two);
+
+ /* Are not-embedded data, set by user or applications.
+ * The metadata must remain in the DB -> No action
+ */
+ g_assert (!actions);
+}
+
+int
+main (int argc, char **argv) {
+
+ int result;
+
+ g_type_init ();
+ g_test_init (&argc, &argv, NULL);
+
+ ontology_init ();
+
+ g_test_add_func ("/tracker-indexer/tracker-metadata-utils/merge_no_changes",
+ test_merge_no_changes);
+ g_test_add_func ("/tracker-indexer/tracker-metadata-utils/merge_update_field",
+ test_merge_update_field);
+ g_test_add_func ("/tracker-indexer/tracker-metadata-utils/merge_delete_field",
+ test_merge_delete_field);
+ g_test_add_func ("/tracker-indexer/tracker-metadata-utils/merge_new_field",
+ test_merge_new_field);
+
+ g_test_add_func ("/tracker-indexer/tracker-metadata-utils/merge_no_changes_mv_emb",
+ test_merge_no_changes_mv_embedded);
+ g_test_add_func ("/tracker-indexer/tracker-metadata-utils/merge_update_field_mv_emb",
+ test_merge_update_mv_embedded);
+ g_test_add_func ("/tracker-indexer/tracker-metadata-utils/merge_delete_field_mv_emb",
+ test_merge_delete_mv_embedded);
+ g_test_add_func ("/tracker-indexer/tracker-metadata-utils/merge_new_field_mv_emb",
+ test_merge_new_mv_embedded);
+
+
+ g_test_add_func ("/tracker-indexer/tracker-metadata-utils/merge_update_field_mv_no_emb",
+ test_merge_update_mv_no_embedded);
+
+
+ result = g_test_run ();
+
+ /* End */
+
+ ontology_shutdown ();
+
+ return result;
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]