tracker r1749 - branches/indexer-split/tests/libtracker-db



Author: ifrade
Date: Tue Jun 24 14:02:30 2008
New Revision: 1749
URL: http://svn.gnome.org/viewvc/tracker?rev=1749&view=rev

Log:
Forgot the files

Added:
   branches/indexer-split/tests/libtracker-db/
   branches/indexer-split/tests/libtracker-db/Makefile.am
   branches/indexer-split/tests/libtracker-db/run-test-in-tmp-dir.sh
   branches/indexer-split/tests/libtracker-db/tracker-db-manager-test.c

Added: branches/indexer-split/tests/libtracker-db/Makefile.am
==============================================================================
--- (empty file)
+++ branches/indexer-split/tests/libtracker-db/Makefile.am	Tue Jun 24 14:02:30 2008
@@ -0,0 +1,34 @@
+include $(top_srcdir)/Makefile.decl
+
+noinst_PROGRAMS = $(TEST_PROGS)
+
+TEST_PROGS += tracker-db-manager
+
+INCLUDES = 				\
+	-g 				\
+	-DG_LOG_DOMAIN=\"Tracker\"	\
+	-I$(top_srcdir)/src		\
+	-I$(top_srcdir)/tests/common	\
+	$(DBUS_CFLAGS)			\
+	$(SQLITE3_CFLAGS)						\
+	$(QDBM_CFLAGS)			\
+	$(GMODULE_CFLAGS)		\
+	$(GTHREAD_CFLAGS)		\
+	$(GLIB2_CFLAGS)
+
+
+
+tracker_db_manager_SOURCES = \
+	tracker-db-manager-test.c 
+
+tracker_db_manager_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

Added: branches/indexer-split/tests/libtracker-db/run-test-in-tmp-dir.sh
==============================================================================
--- (empty file)
+++ branches/indexer-split/tests/libtracker-db/run-test-in-tmp-dir.sh	Tue Jun 24 14:02:30 2008
@@ -0,0 +1,12 @@
+#!/bin/bash
+
+GLIB_DIR=`pkg-config --variable=prefix glib-2.0`
+. ../scripts/xdg_dirs.source
+
+# Ensure we have gtester in PATH
+export PATH=$PATH:$GLIB_DIR/bin
+
+make test
+./tracker-db-manager
+
+. ../scripts/xdg_dirs.unsource

Added: branches/indexer-split/tests/libtracker-db/tracker-db-manager-test.c
==============================================================================
--- (empty file)
+++ branches/indexer-split/tests/libtracker-db/tracker-db-manager-test.c	Tue Jun 24 14:02:30 2008
@@ -0,0 +1,112 @@
+#include <glib.h>
+#include <glib/gtestutils.h>
+
+
+#include <libtracker-db/tracker-db-manager.h>
+
+
+GStaticMutex global_mutex = G_STATIC_MUTEX_INIT;
+
+gboolean
+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);
+
+        result_set = tracker_db_interface_execute_query (iface, 
+                                                         &error, 
+                                                         query);
+
+        if (error && error->message) {
+                g_warning ("Error loading query:'%s' - %s", query, error->message);
+                g_error_free (error);
+                return FALSE;
+        }
+
+        return TRUE;
+}
+
+void
+test_assert_tables_in_db (TrackerDB db, gchar *query) 
+{
+
+        //g_static_mutex_lock (&global_mutex);
+
+        g_assert (test_assert_query_run (db, query));
+
+        //g_static_mutex_unlock (&global_mutex);
+}
+
+static void
+test_creation_common_db () {
+/*
+  Options              Volumes           ServiceLinks      
+  BackupServices       BackupMetaData    KeywordImages
+  VFolders             MetaDataTypes     MetaDataChildren
+  MetaDataGroup        MetadataOptions   ServiceTypes
+  ServiceTileMetadata  ServiceTabular    Metadata ServiceTypeOptions
+  FileMimes            FileMimePrefixes
+*/
+
+        test_assert_tables_in_db (TRACKER_DB_COMMON, "SELECT * FROM MetaDataTypes");
+}
+
+static void
+test_creation_xesam_db () 
+{
+/*
+   XesamMetaDataTypes   XesamServiceTypes      XesamServiceMapping   XesamMetaDataMapping
+   XesamServiceChildren XesamMetaDataChildren  XesamServiceLookup    XesamMetaDataLookup
+*/
+        test_assert_tables_in_db (TRACKER_DB_XESAM, "SELECT * FROM XesamServiceTypes");
+}
+
+static void
+test_creation_file_meta_db ()
+{
+        test_assert_tables_in_db (TRACKER_DB_FILE_METADATA, "SELECT * FROM 'file-meta'.ServiceMetaData");
+}
+
+static void
+test_creation_file_contents_db ()
+{
+        test_assert_tables_in_db (TRACKER_DB_FILE_CONTENTS, "SELECT * FROM 'file-contents'.ServiceContents");
+}
+
+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_ATTACH_ALL | TRACKER_DB_MANAGER_FORCE_REINDEX, 
+                                 &first_time);
+
+/*
+        g_test_add_func ("/libtracker-db/tracker-db-manager/common_db_tables",
+                        test_creation_common_db);
+
+        g_test_add_func ("/libtracker-db/tracker-db-manager/xesam_db_tables",
+                         test_creation_xesam_db);
+*/
+        g_test_add_func ("/libtracker-db/tracker-db-manager/file_meta_db_tables",
+                         test_creation_file_meta_db);
+
+        /*       g_test_add_func ("/libtracker-db/tracker-db-manager/file_contents_db_tables",
+                         test_creation_file_contents_db);
+        */
+        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]