[tracker/gdbus] tests: GDBus port of the IPC tests
- From: Philip Van Hoof <pvanhoof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/gdbus] tests: GDBus port of the IPC tests
- Date: Mon, 17 Jan 2011 13:29:31 +0000 (UTC)
commit bb82d01bff1d7cc12247e6e9d7607cb3fc0252e8
Author: Philip Van Hoof <philip codeminded be>
Date: Mon Jan 17 14:28:43 2011 +0100
tests: GDBus port of the IPC tests
tests/functional-tests/ipc/Makefile.am | 115 +++++++++-----------
tests/functional-tests/ipc/test-busy-handling.vala | 29 +++---
.../ipc/test-class-signal-performance-batch.vala | 18 ++--
.../ipc/test-class-signal-performance.vala | 25 +++--
tests/functional-tests/ipc/test-class-signal.vala | 13 +--
5 files changed, 94 insertions(+), 106 deletions(-)
---
diff --git a/tests/functional-tests/ipc/Makefile.am b/tests/functional-tests/ipc/Makefile.am
index 8987fed..6d38272 100644
--- a/tests/functional-tests/ipc/Makefile.am
+++ b/tests/functional-tests/ipc/Makefile.am
@@ -1,110 +1,97 @@
include $(top_srcdir)/Makefile.decl
-# Note: Even though we now use GDBus, we still link with
-# dbus-glib-1 for some of the below tests because we use
-# their raw APIs to test with, specifically:
-#
-# test-busy-handling
-# test-class-signal
-# test-class-signal-performance
-# test-class-signal-performance-batch
-#
-noinst_PROGRAMS = \
- test-busy-handling \
- test-direct-query \
- test-bus-query \
- test-default-update \
- test-bus-update \
- test-class-signal \
- test-class-signal-performance \
- test-class-signal-performance-batch \
+noinst_PROGRAMS = \
+ test-busy-handling \
+ test-direct-query \
+ test-bus-query \
+ test-default-update \
+ test-bus-update \
+ test-class-signal \
+ test-class-signal-performance \
+ test-class-signal-performance-batch \
test-update-array-performance
-AM_VALAFLAGS = \
- --pkg gio-2.0 \
- $(BUILD_VALAFLAGS) \
+AM_VALAFLAGS = \
+ --pkg gio-2.0 \
+ $(BUILD_VALAFLAGS) \
$(top_srcdir)/src/libtracker-sparql/tracker-sparql-$(TRACKER_API_VERSION).vapi \
$(top_srcdir)/src/libtracker-bus/tracker-bus.vapi
-AM_CPPFLAGS = \
- $(BUILD_CFLAGS) \
- -I$(top_srcdir)/src \
- -I$(top_builddir)/src \
+AM_CPPFLAGS =\
+ $(BUILD_CFLAGS) \
+ -I$(top_srcdir)/src \
+ -I$(top_builddir)/src \
$(LIBTRACKER_SPARQL_CFLAGS)
-LDADD = \
+LDADD =\
$(top_builddir)/src/libtracker-data/libtracker-data.la \
$(top_builddir)/src/libtracker-direct/libtracker-direct.la \
$(top_builddir)/src/libtracker-bus/libtracker-bus.la \
$(top_builddir)/src/libtracker-sparql/libtracker-sparql-$(TRACKER_API_VERSION).la \
$(top_builddir)/src/libtracker-common/libtracker-common.la \
- $(BUILD_LIBS) \
+ $(BUILD_LIBS)\
$(LIBTRACKER_SPARQL_LIBS)
-test_busy_handling_SOURCES = \
+test_busy_handling_SOURCES = \
test-busy-handling.vala
-test_busy_handling_CFLAGS = \
- $(AM_CPPFLAGS) \
+test_busy_handling_CFLAGS = \
+ $(AM_CPPFLAGS) \
$(TRACKER_DBUS_CFLAGS)
-test_busy_handling_VALAFLAGS = \
- --pkg dbus-glib-1 \
+test_busy_handling_VALAFLAGS = \
$(AM_VALAFLAGS)
-test_busy_handling_LDADD = \
- $(LDADD) \
+test_busy_handling_LDADD = \
+ $(LDADD) \
$(TRACKER_DBUS_LIBS)
-test_direct_query_SOURCES = \
- test-shared-query.vala \
+test_direct_query_SOURCES = \
+ test-shared-query.vala \
test-direct-query.vala
-test_default_update_SOURCES = \
- test-shared-update.vala \
+test_default_update_SOURCES = \
+ test-shared-update.vala \
test-default-update.vala
-test_bus_query_SOURCES = \
- test-shared-query.vala \
+test_bus_query_SOURCES = \
+ test-shared-query.vala \
test-bus-query.vala
-test_update_array_performance_SOURCES = \
+test_update_array_performance_SOURCES = \
test-update-array-performance.c
-test_bus_update_SOURCES = \
- test-shared-update.vala \
+test_bus_update_SOURCES = \
+ test-shared-update.vala \
test-bus-update.vala
-test_class_signal_SOURCES = \
+test_class_signal_SOURCES = \
test-class-signal.vala
-test_class_signal_CFLAGS = \
- $(AM_CPPFLAGS) \
+test_class_signal_CFLAGS = \
+ $(AM_CPPFLAGS) \
$(TRACKER_DBUS_CFLAGS)
-test_class_signal_VALAFLAGS = \
- --pkg dbus-glib-1 \
+test_class_signal_VALAFLAGS = \
$(AM_VALAFLAGS)
-test_class_signal_LDADD = \
- $(LDADD) \
+test_class_signal_LDADD = \
+ $(LDADD) \
$(TRACKER_DBUS_LIBS)
-test_class_signal_performance_SOURCES = \
+test_class_signal_performance_SOURCES = \
test-class-signal-performance.vala
-test_class_signal_performance_CFLAGS = \
- $(AM_CPPFLAGS) \
+test_class_signal_performance_CFLAGS = \
+ $(AM_CPPFLAGS) \
$(TRACKER_DBUS_CFLAGS)
-test_class_signal_performance_VALAFLAGS = \
- --pkg dbus-glib-1 \
+test_class_signal_performance_VALAFLAGS = \
$(AM_VALAFLAGS)
-test_class_signal_performance_LDADD = \
- $(LDADD) \
+test_class_signal_performance_LDADD = \
+ $(LDADD) \
$(TRACKER_DBUS_LIBS)
-test_class_signal_performance_batch_SOURCES = \
+test_class_signal_performance_batch_SOURCES = \
test-class-signal-performance-batch.vala
-test_class_signal_performance_batch_CFLAGS = \
- $(AM_CPPFLAGS) \
+test_class_signal_performance_batch_CFLAGS = \
+ $(AM_CPPFLAGS) \
$(TRACKER_DBUS_CFLAGS)
-test_class_signal_performance_batch_VALAFLAGS = \
- --pkg dbus-glib-1 \
+test_class_signal_performance_batch_VALAFLAGS = \
$(AM_VALAFLAGS)
-test_class_signal_performance_batch_LDADD = \
- $(LDADD) \
+test_class_signal_performance_batch_LDADD = \
+ $(LDADD) \
$(TRACKER_DBUS_LIBS)
diff --git a/tests/functional-tests/ipc/test-busy-handling.vala b/tests/functional-tests/ipc/test-busy-handling.vala
index 9f9885b..bad4170 100644
--- a/tests/functional-tests/ipc/test-busy-handling.vala
+++ b/tests/functional-tests/ipc/test-busy-handling.vala
@@ -27,20 +27,19 @@
// ./busy-handling-test
[DBus (name = "org.freedesktop.Tracker1.Resources")]
-private interface Resources : GLib.Object {
+private interface Resources : DBusProxy {
[DBus (name = "SparqlQuery", timeout = 99999999999)]
- public abstract async string[,] sparql_query (string query) throws DBus.Error;
+ public abstract async string[,] sparql_query (string query) throws DBusError;
}
[DBus (name = "org.freedesktop.Tracker1.Status")]
-private interface Status: GLib.Object {
+private interface Status: DBusProxy {
public signal void progress (string status, double progress);
- public abstract double get_progress () throws DBus.Error;
- public abstract string get_status () throws DBus.Error;
+ public abstract double get_progress () throws DBusError;
+ public abstract string get_status () throws DBusError;
}
public class TestApp {
- static DBus.Connection connection;
static Resources resources_object;
static Status status_object;
int res = -1;
@@ -55,13 +54,15 @@ public class TestApp {
double progress;
string status;
- connection = DBus.Bus.get (DBus.BusType.SESSION);
- resources_object = (Resources) connection.get_object ("org.freedesktop.Tracker1",
- "/org/freedesktop/Tracker1/Resources",
- "org.freedesktop.Tracker1.Resources");
- status_object = (Status) connection.get_object ("org.freedesktop.Tracker1",
- "/org/freedesktop/Tracker1/Status",
- "org.freedesktop.Tracker1.Status");
+ resources_object = GLib.Bus.get_proxy_sync (BusType.SESSION,
+ "org.freedesktop.Tracker1",
+ "/org/freedesktop/Tracker1/Resources",
+ DBusProxyFlags.DO_NOT_LOAD_PROPERTIES | DBusProxyFlags.DO_NOT_CONNECT_SIGNALS);
+
+ status_object = GLib.Bus.get_proxy_sync (BusType.SESSION,
+ "org.freedesktop.Tracker1",
+ "/org/freedesktop/Tracker1/Status",
+ DBusProxyFlags.DO_NOT_LOAD_PROPERTIES | DBusProxyFlags.DO_NOT_CONNECT_SIGNALS);
status_object.progress.connect (on_status_cb);
progress = status_object.get_progress ();
@@ -69,7 +70,7 @@ public class TestApp {
ready = (progress == 1.0 && status == "Idle");
- } catch (DBus.Error e) {
+ } catch (GLib.Error e) {
warning ("Could not connect to D-Bus service: %s", e.message);
initialized = false;
res = -1;
diff --git a/tests/functional-tests/ipc/test-class-signal-performance-batch.vala b/tests/functional-tests/ipc/test-class-signal-performance-batch.vala
index a3b0306..1390481 100644
--- a/tests/functional-tests/ipc/test-class-signal-performance-batch.vala
+++ b/tests/functional-tests/ipc/test-class-signal-performance-batch.vala
@@ -31,17 +31,16 @@ struct Event {
}
[DBus (name = "org.freedesktop.Tracker1.Resources")]
-private interface Resources : GLib.Object {
+private interface Resources : DBusProxy {
[DBus (name = "GraphUpdated")]
public signal void graph_updated (string class_name, Event[] deletes, Event[] inserts);
[DBus (name = "BatchSparqlUpdate")]
- public abstract async void batch_sparql_update_async (string query) throws Sparql.Error, DBus.Error;
+ public abstract async void batch_sparql_update_async (string query) throws Sparql.Error, DBusError;
[DBus (name = "SparqlUpdate")]
- public abstract async void sparql_update_async (string query) throws Sparql.Error, DBus.Error;
+ public abstract async void sparql_update_async (string query) throws Sparql.Error, DBusError;
}
public class TestApp {
- static DBus.Connection dbus_connection;
static Resources resources_object;
MainLoop loop;
bool initialized = false;
@@ -53,15 +52,16 @@ public class TestApp {
requires (!initialized) {
try {
con = Tracker.Sparql.Connection.get();
- dbus_connection = DBus.Bus.get (DBus.BusType.SESSION);
- resources_object = (Resources) dbus_connection.get_object ("org.freedesktop.Tracker1",
- "/org/freedesktop/Tracker1/Resources",
- "org.freedesktop.Tracker1.Resources");
+
+ resources_object = GLib.Bus.get_proxy_sync (BusType.SESSION,
+ "org.freedesktop.Tracker1",
+ "/org/freedesktop/Tracker1/Resources",
+ DBusProxyFlags.DO_NOT_LOAD_PROPERTIES | DBusProxyFlags.DO_NOT_CONNECT_SIGNALS);
resources_object.graph_updated.connect (on_graph_updated_received);
t = new GLib.Timer ();
-
+
} catch (GLib.Error e) {
warning ("Could not connect to D-Bus service: %s", e.message);
initialized = false;
diff --git a/tests/functional-tests/ipc/test-class-signal-performance.vala b/tests/functional-tests/ipc/test-class-signal-performance.vala
index 1fd796e..ce2070d 100644
--- a/tests/functional-tests/ipc/test-class-signal-performance.vala
+++ b/tests/functional-tests/ipc/test-class-signal-performance.vala
@@ -52,16 +52,16 @@ struct Event {
}
[DBus (name = "org.freedesktop.Tracker1.Resources")]
-private interface Resources : GLib.Object {
+private interface Resources : DBusProxy {
[DBus (name = "GraphUpdated")]
public signal void graph_updated (string class_name, Event[] deletes, Event[] inserts);
[DBus (name = "SparqlUpdate")]
- public abstract async void sparql_update_async (string query) throws Sparql.Error, DBus.Error;
+ public abstract async void sparql_update_async (string query) throws Sparql.Error, DBusError;
}
[DBus (name = "org.freedesktop.Tracker1.Resources.Class")]
-private interface ResourcesClass : GLib.Object {
+private interface ResourcesClass : DBusProxy {
[DBus (name = "SubjectsAdded")]
public signal void subjects_added (string [] subjects);
[DBus (name = "SubjectsChanged")]
@@ -69,7 +69,6 @@ private interface ResourcesClass : GLib.Object {
}
public class TestApp {
- static DBus.Connection dbus_connection;
static Resources resources_object;
static ResourcesClass class_object;
MainLoop loop;
@@ -82,14 +81,16 @@ public class TestApp {
requires (!initialized) {
try {
con = Tracker.Sparql.Connection.get();
- dbus_connection = DBus.Bus.get (DBus.BusType.SESSION);
- resources_object = (Resources) dbus_connection.get_object ("org.freedesktop.Tracker1",
- "/org/freedesktop/Tracker1/Resources",
- "org.freedesktop.Tracker1.Resources");
-
- class_object = (ResourcesClass) dbus_connection.get_object ("org.freedesktop.Tracker1",
- "/org/freedesktop/Tracker1/Resources/Classes/nmm/MusicPiece",
- "org.freedesktop.Tracker1.Resources.Class");
+
+ resources_object = GLib.Bus.get_proxy_sync (BusType.SESSION,
+ "org.freedesktop.Tracker1",
+ "/org/freedesktop/Tracker1/Resources",
+ DBusProxyFlags.DO_NOT_LOAD_PROPERTIES | DBusProxyFlags.DO_NOT_CONNECT_SIGNALS);
+
+ class_object = GLib.Bus.get_proxy_sync (BusType.SESSION,
+ "org.freedesktop.Tracker1",
+ "/org/freedesktop/Tracker1/Resources/Classes/nmm/MusicPiece",
+ DBusProxyFlags.DO_NOT_LOAD_PROPERTIES | DBusProxyFlags.DO_NOT_CONNECT_SIGNALS);
class_object.subjects_added.connect (on_subjects_added);
class_object.subjects_changed.connect (on_subjects_changed);
diff --git a/tests/functional-tests/ipc/test-class-signal.vala b/tests/functional-tests/ipc/test-class-signal.vala
index 21c1d65..109aeac 100644
--- a/tests/functional-tests/ipc/test-class-signal.vala
+++ b/tests/functional-tests/ipc/test-class-signal.vala
@@ -32,16 +32,15 @@ struct Event {
}
[DBus (name = "org.freedesktop.Tracker1.Resources")]
-private interface Resources : GLib.Object {
+private interface Resources : DBusProxy {
[DBus (name = "GraphUpdated")]
public signal void graph_updated (string class_name, Event[] deletes, Event[] inserts);
[DBus (name = "SparqlUpdate")]
- public abstract async void sparql_update_async (string query) throws Sparql.Error, DBus.Error;
+ public abstract async void sparql_update_async (string query) throws Sparql.Error, DBusError;
}
public class TestApp {
- static DBus.Connection dbus_connection;
static Resources resources_object;
int res = -1;
MainLoop loop;
@@ -58,10 +57,10 @@ public class TestApp {
// Switch between kinds of query connections here:
signal_con = con;
- dbus_connection = DBus.Bus.get (DBus.BusType.SESSION);
- resources_object = (Resources) dbus_connection.get_object ("org.freedesktop.Tracker1",
- "/org/freedesktop/Tracker1/Resources",
- "org.freedesktop.Tracker1.Resources");
+ resources_object = GLib.Bus.get_proxy_sync (BusType.SESSION,
+ "org.freedesktop.Tracker1",
+ "/org/freedesktop/Tracker1/Resources",
+ DBusProxyFlags.DO_NOT_LOAD_PROPERTIES | DBusProxyFlags.DO_NOT_CONNECT_SIGNALS);
resources_object.graph_updated.connect (on_graph_updated_received);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]