[tracker/direct-access: 10/38] functional-tests: Added functional test, libtracker-direct: Added .vapi create



commit 8500bccb73136913ed268e65187a35f64fe02978
Author: Philip Van Hoof <philip codeminded be>
Date:   Wed Jul 7 15:56:45 2010 +0200

    functional-tests: Added functional test, libtracker-direct: Added .vapi create

 src/libtracker-direct/Makefile.am       |    7 +++++-
 tests/functional-tests/Makefile.am      |   34 +++++++++++++++++++++++++-----
 tests/functional-tests/direct-test.vala |   23 +++++++++++++++++++++
 3 files changed, 57 insertions(+), 7 deletions(-)
---
diff --git a/src/libtracker-direct/Makefile.am b/src/libtracker-direct/Makefile.am
index 82f7181..e74309e 100644
--- a/src/libtracker-direct/Makefile.am
+++ b/src/libtracker-direct/Makefile.am
@@ -38,8 +38,13 @@ vapi_sources =						\
 	$(top_srcdir)/src/libtracker-data/libtracker-data.vapi	\
 	$(top_srcdir)/src/libtracker-data/tracker-sparql-query.vapi
 
+# Vala bindings
+vapidir = $(datadir)/vala/vapi
+vapi_DATA = \
+	tracker-direct-$(TRACKER_API_VERSION).vapi
+
 libtracker-direct.vala.stamp: $(libtracker_direct_la_VALASOURCES) $(vapi_sources)
-	$(AM_V_GEN)$(VALAC) $(GCOV_VALAFLAGS) -C $(VALAFLAGS) --pkg gio-2.0 -H tracker-direct.h $^
+	$(AM_V_GEN)$(VALAC) $(GCOV_VALAFLAGS) -C $(VALAFLAGS) --pkg gio-2.0 -H tracker-direct.h --vapi tracker-direct-$(TRACKER_API_VERSION).vapi $^
 	$(AM_V_GEN)touch $@
 
 BUILT_SOURCES = 					\
diff --git a/tests/functional-tests/Makefile.am b/tests/functional-tests/Makefile.am
index 8050f20..043c2f7 100644
--- a/tests/functional-tests/Makefile.am
+++ b/tests/functional-tests/Makefile.am
@@ -8,6 +8,7 @@ INCLUDES =					\
 	-I$(top_srcdir)/src/libtracker-bus	\
 	-I$(top_builddir)/src/libtracker-sparql	\
 	-I$(top_builddir)/src/libtracker-bus	\
+	-I$(top_builddir)/src/libtracker-direct	\
 	$(WARN_CFLAGS)				\
 	$(DBUS_CFLAGS)				\
 	$(GLIB2_CFLAGS)				\
@@ -52,7 +53,7 @@ bashscripts_SCRIPTS = 				\
 	@sed -e "s|@topsrcdir[ ]|${top_srcdir}|" \
 	     -e "s|@libexecdir[ ]|${libexecdir}|" $< > $@
 
-noinst_PROGRAMS = busy-handling-test bus-query-test bus-update-test
+noinst_PROGRAMS = busy-handling-test direct-test bus-query-test bus-update-test
 
 busy_handling_test_VALASOURCES = busy-handling-test.vala
 
@@ -69,8 +70,7 @@ busy_handling_test_LDADD = \
 	$(GLIB2_LIBS) \
 	$(DBUS_LIBS)
 
-BUILT_SOURCES = 				\
-	busy-handling-test.vala.stamp
+direct_test_VALASOURCES = direct-test.vala
 
 bus_query_test_VALASOURCES = shared-query-test.vala bus-query-test.vala
 
@@ -106,13 +106,35 @@ bus_query_test_LDADD = \
 
 bus_update_test_LDADD = $(bus_query_test_LDADD)
 
-BUILT_SOURCES = 				\
+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	\
+	$(top_srcdir)/src/libtracker-direct/tracker-direct-$(TRACKER_API_VERSION).vapi
+
+direct-test.vala.stamp: $(direct_test_VALASOURCES) $(vapi_sources)
+	$(AM_V_GEN)$(VALAC) $(GCOV_VALAFLAGS) -C $(VALAFLAGS) --pkg gio-2.0 $^
+	$(AM_V_GEN)touch $@
+
+# I need to add libtracker-data.la here, I don't understand yet why. I think
+# that means that something about libtracker-direct or libtracker-sparql is
+# wrong -- Philip
+
+direct_test_LDADD = \
+	$(top_builddir)/src/libtracker-data/libtracker-data.la \
+	$(top_builddir)/src/libtracker-direct/libtracker-direct-$(TRACKER_API_VERSION).la \
+	$(top_builddir)/src/libtracker-sparql/libtracker-sparql-$(TRACKER_API_VERSION).la \
+	$(GLIB2_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 = 					\
 	$(config_SCRIPTS) 			\
 	$(bashscripts_SCRIPTS)			\
@@ -124,7 +146,7 @@ EXTRA_DIST = 					\
 	$(bus_query_test_VALASOURCES)		\
 	$(bus_update_test_VALASOURCES)
 
-CLEANFILES = $(bashscripts_SCRIPTS)
+CLEANFILES = $(bashscripts_SCRIPTS) $(BUILD_SOURCES)
 
 MAINTAINERCLEANFILES =					\
 	$(BUILT_SOURCES)				\
diff --git a/tests/functional-tests/direct-test.vala b/tests/functional-tests/direct-test.vala
new file mode 100644
index 0000000..3269396
--- /dev/null
+++ b/tests/functional-tests/direct-test.vala
@@ -0,0 +1,23 @@
+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 }");
+
+	while (cursor.iter_next()) {
+		int i;
+
+		for (i = 0; i < cursor.n_columns; i++) {
+			print ("%s%s", i != 0 ? ",":"", cursor.get_string (i));
+		}
+
+		print ("\n");
+	}
+
+	return( 0 );
+}
+



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