tracker r1765 - in branches/indexer-split: . tests/libtracker-db
- From: ifrade svn gnome org
- To: svn-commits-list gnome org
- Subject: tracker r1765 - in branches/indexer-split: . tests/libtracker-db
- Date: Wed, 25 Jun 2008 13:07:28 +0000 (UTC)
Author: ifrade
Date: Wed Jun 25 13:07:28 2008
New Revision: 1765
URL: http://svn.gnome.org/viewvc/tracker?rev=1765&view=rev
Log:
Test for custom-attached connections
Added:
branches/indexer-split/tests/libtracker-db/tracker-db-manager-test-custom.c
Modified:
branches/indexer-split/ChangeLog
branches/indexer-split/tests/libtracker-db/Makefile.am
branches/indexer-split/tests/libtracker-db/tracker-db-manager-common.c
branches/indexer-split/tests/libtracker-db/tracker-db-manager-common.h
Modified: branches/indexer-split/tests/libtracker-db/Makefile.am
==============================================================================
--- branches/indexer-split/tests/libtracker-db/Makefile.am (original)
+++ branches/indexer-split/tests/libtracker-db/Makefile.am Wed Jun 25 13:07:28 2008
@@ -2,7 +2,7 @@
noinst_PROGRAMS = $(TEST_PROGS)
-TEST_PROGS += tracker-db-manager-unattach tracker-db-manager-attach
+TEST_PROGS += tracker-db-manager-unattach tracker-db-manager-attach tracker-db-manager-custom
INCLUDES = \
-g \
@@ -51,3 +51,20 @@
$(GTHREAD_LIBS) \
$(GLIB2_LIBS) \
-lz
+
+tracker_db_manager_custom_SOURCES = \
+ tracker-db-manager-test-custom.c \
+ tracker-db-manager-common.c \
+ tracker-db-manager-common.h
+
+tracker_db_manager_custom_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 \
+ $(SQLITE3_LIBS) \
+ $(QDBM_LIBS) \
+ $(GMODULE_LIBS) \
+ $(GTHREAD_LIBS) \
+ $(GLIB2_LIBS) \
+ -lz
Modified: branches/indexer-split/tests/libtracker-db/tracker-db-manager-common.c
==============================================================================
--- branches/indexer-split/tests/libtracker-db/tracker-db-manager-common.c (original)
+++ branches/indexer-split/tests/libtracker-db/tracker-db-manager-common.c Wed Jun 25 13:07:28 2008
@@ -4,11 +4,19 @@
test_assert_query_run (TrackerDB db, const gchar *query)
{
TrackerDBInterface *iface;
- TrackerDBResultSet *result_set;
- GError *error = NULL;
iface = tracker_db_manager_get_db_interface (db);
+ return test_assert_query_run_on_iface (iface, query);
+
+}
+
+gboolean
+test_assert_query_run_on_iface (TrackerDBInterface *iface, const gchar *query)
+{
+ TrackerDBResultSet *result_set;
+ GError *error = NULL;
+
result_set = tracker_db_interface_execute_query (iface,
&error,
query);
@@ -21,4 +29,3 @@
return TRUE;
}
-
Modified: branches/indexer-split/tests/libtracker-db/tracker-db-manager-common.h
==============================================================================
--- branches/indexer-split/tests/libtracker-db/tracker-db-manager-common.h (original)
+++ branches/indexer-split/tests/libtracker-db/tracker-db-manager-common.h Wed Jun 25 13:07:28 2008
@@ -5,5 +5,6 @@
#include <libtracker-db/tracker-db-manager.h>
gboolean test_assert_query_run (TrackerDB db, const gchar *query);
+gboolean test_assert_query_run_on_iface (TrackerDBInterface *iface, const gchar *query);
#endif
Added: branches/indexer-split/tests/libtracker-db/tracker-db-manager-test-custom.c
==============================================================================
--- (empty file)
+++ branches/indexer-split/tests/libtracker-db/tracker-db-manager-test-custom.c Wed Jun 25 13:07:28 2008
@@ -0,0 +1,69 @@
+#include <glib.h>
+#include <glib/gtestutils.h>
+
+
+#include <libtracker-db/tracker-db-manager.h>
+#include "tracker-db-manager-common.h"
+
+void
+test_assert_tables_in_db (TrackerDBInterface *iface, gchar *query)
+{
+ g_assert (test_assert_query_run_on_iface (iface, query));
+}
+
+static void
+test_custom_common_filemeta_filecontents ()
+{
+ TrackerDBInterface *iface;
+
+ iface = tracker_db_manager_get_db_interfaces (3,
+ TRACKER_DB_COMMON,
+ TRACKER_DB_FILE_METADATA,
+ TRACKER_DB_FILE_CONTENTS);
+
+ test_assert_tables_in_db (iface, "SELECT * FROM MetadataTypes");
+ test_assert_tables_in_db (iface, "SELECT * FROM ServiceMetadata");
+ test_assert_tables_in_db (iface, "SELECT * FROM ServiceContents");
+}
+
+
+static void
+test_custom_xesam_no_common ()
+{
+ TrackerDBInterface *iface;
+
+ iface = tracker_db_manager_get_db_interfaces (1,
+ TRACKER_DB_XESAM);
+
+ test_assert_tables_in_db (iface, "SELECT * FROM XesamMetaDataTypes");
+}
+
+
+
+int
+main (int argc, char **argv) {
+
+ int result;
+ gint first_time;
+
+ g_type_init ();
+ g_thread_init (NULL);
+ g_test_init (&argc, &argv, NULL);
+
+ /* Init */
+ tracker_db_manager_init (TRACKER_DB_MANAGER_FORCE_REINDEX,
+ &first_time);
+
+ g_test_add_func ("/libtracker-db/tracker-db-manager/custom/common_filemeta_filecontents",
+ test_custom_common_filemeta_filecontents);
+
+ g_test_add_func ("/libtracker-db/tracker-db-manager/custom/xesam_no_common",
+ test_custom_xesam_no_common);
+
+ result = g_test_run ();
+
+ /* End */
+ tracker_db_manager_shutdown (TRUE);
+
+ return result;
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]