[tracker/direct-access: 37/90] libtracker-bus: Implemented D-Bus FD passing using TrackerSparqlCursor API



commit 2c0f499415580ce8da810a44cc0248aab2540a47
Author: Martyn Russell <martyn lanedo com>
Date:   Wed Jul 14 17:42:34 2010 +0100

    libtracker-bus: Implemented D-Bus FD passing using TrackerSparqlCursor API

 tests/functional-tests/Makefile.am      |   31 ++++++++++++++++++++++---
 tests/functional-tests/direct-test.vala |   38 ++++++++++++++++++++----------
 2 files changed, 52 insertions(+), 17 deletions(-)
---
diff --git a/tests/functional-tests/Makefile.am b/tests/functional-tests/Makefile.am
index 7f724e5..66d8eaa 100644
--- a/tests/functional-tests/Makefile.am
+++ b/tests/functional-tests/Makefile.am
@@ -8,6 +8,7 @@ INCLUDES =					\
 	-I$(top_builddir)/src/libtracker-sparql	\
 	-I$(top_builddir)/src/libtracker-bus	\
 	-I$(top_builddir)/src/libtracker-direct	\
+	-I$(top_builddir)/src/libtracker-bus	\
 	$(WARN_CFLAGS)				\
 	$(DBUS_CFLAGS)				\
 	$(GLIB2_CFLAGS)				\
@@ -109,24 +110,46 @@ direct_test_SOURCES = \
 	direct_test.vala.stamp \
 	$(direct_test_VALASOURCES:.vala=.c)
 
-vapi_sources = \
-	$(top_srcdir)/src/libtracker-sparql/tracker-sparql-$(TRACKER_API_VERSION).vapi	\
+bus_test_VALASOURCES = bus-test.vala
+
+bus_test_SOURCES = \
+	bus_test.vala.stamp \
+	$(bus_test_VALASOURCES:.vala=.c)
+
+direct_vapi_sources = \
+	$(top_srcdir)/src/libtracker-sparql/tracker-sparql-$(TRACKER_API_VERSION).vapi \
 	$(top_srcdir)/src/libtracker-direct/tracker-direct-$(TRACKER_API_VERSION).vapi
 
-direct-test.vala.stamp: $(direct_test_VALASOURCES) $(vapi_sources)
+direct-test.vala.stamp: $(direct_test_VALASOURCES) $(direct_vapi_sources)
 	$(AM_V_GEN)$(VALAC) $(GCOV_VALAFLAGS) -C $(VALAFLAGS) --pkg gio-2.0 $^
 	$(AM_V_GEN)touch $@
 
 direct_test_LDADD = \
 	$(top_builddir)/src/libtracker-direct/libtracker-direct-$(TRACKER_API_VERSION).la \
 	$(top_builddir)/src/libtracker-sparql/libtracker-sparql-$(TRACKER_API_VERSION).la \
+	$(GIO_LIBS) \
 	$(GLIB2_LIBS)
 
+bus_vapi_sources = \
+	$(top_srcdir)/src/libtracker-sparql/tracker-sparql-$(TRACKER_API_VERSION).vapi \
+	$(top_srcdir)/src/libtracker-bus/tracker-bus-$(TRACKER_API_VERSION).vapi
+
+bus-test.vala.stamp: $(bus_test_VALASOURCES) $(bus_vapi_sources)
+	$(AM_V_GEN)$(VALAC) $(GCOV_VALAFLAGS) -C $(VALAFLAGS) --pkg gio-2.0 --pkg dbus-glib-1 $^
+	$(AM_V_GEN)touch $@
+
+bus_test_LDADD = \
+	$(top_builddir)/src/libtracker-bus/libtracker-bus-$(TRACKER_API_VERSION).la \
+	$(top_builddir)/src/libtracker-sparql/libtracker-sparql-$(TRACKER_API_VERSION).la \
+	$(top_builddir)/src/libtracker-common/libtracker-common.la \
+	$(GIO_LIBS) \
+	$(GLIB2_LIBS) \
+	$(DBUS_LIBS)
+
 BUILT_SOURCES = \
 	busy-handling-test.vala.stamp \
 	direct-test.vala.stamp \
 	bus-query-test.vala.stamp \
-	bus-query-test.vala.stamp 		\
 	bus-update-test.vala.stamp
 
 EXTRA_DIST = 					\
diff --git a/tests/functional-tests/direct-test.vala b/tests/functional-tests/direct-test.vala
index f00d8ce..b73581a 100644
--- a/tests/functional-tests/direct-test.vala
+++ b/tests/functional-tests/direct-test.vala
@@ -1,28 +1,40 @@
 using Tracker;
 using Tracker.Sparql;
-using Tracker.Direct;
 
 int
 main( string[] args )
 {
-//	Sparql.Connection con = new Direct.Connection ();
-//	Cursor cursor = con.query ("SELECT ?u WHERE { ?u a rdfs:Class }");
+	Sparql.Connection con = new Tracker.Direct.Connection ();
+	Cursor cursor;
+	
+	try {
+		cursor = con.query ("SELECT ?u WHERE { ?u a rdfs:Class }");
+	} catch (GLib.Error e) {
+		warning ("Couldn't perform query: %s", e.message);
+		return -1;
+	}
 
-//	while (cursor.next()) {
-//		int i;
+	try {
+		while (cursor.next()) {
+			int i;
 
-//		for (i = 0; i < cursor.n_columns; i++) {
-//			print ("%s%s", i != 0 ? ",":"", cursor.get_string (i));
-//		}
+			for (i = 0; i < cursor.n_columns; i++) {
+				print ("%s%s", i != 0 ? ",":"", cursor.get_string (i));
+			}
 
-//		print ("\n");
-//	}
-	
+			print ("\n");
+		}
+	} catch (GLib.Error e) {
+		warning ("Couldn't iterate query results: %s", e.message);
+		return -1;
+	}
+		
 	// Testing new API with GModule
 	
-	print ("\n\n");
+//	print ("\n\n");
+
+//	Lookup foo = new Lookup ();
 
-	Lookup foo = new Lookup ();
 
 	return( 0 );
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]