[tracker/wip/carlosg/test: 2/3] tests: Generalize service tests so we can specify full URIs




commit b3dcad91c35aaffc76f13f2652c1e1275541c536
Author: Carlos Garnacho <carlosg gnome org>
Date:   Sun Apr 4 12:50:03 2021 +0200

    tests: Generalize service tests so we can specify full URIs
    
    These were made to test DBus services, generalize them a bit so we
    can use it to test other URI types.

 tests/libtracker-data/service/service-after-triples-1.rq    | 2 +-
 tests/libtracker-data/service/service-before-triples-1.rq   | 2 +-
 tests/libtracker-data/service/service-empty-1.rq            | 2 +-
 tests/libtracker-data/service/service-empty-2.rq            | 2 +-
 tests/libtracker-data/service/service-local-filter-1.rq     | 2 +-
 tests/libtracker-data/service/service-query-1.rq            | 2 +-
 tests/libtracker-data/service/service-union-with-local-1.rq | 2 +-
 tests/libtracker-data/service/service-union-with-local-2.rq | 2 +-
 tests/libtracker-data/service/service-union-with-local-3.rq | 2 +-
 tests/libtracker-data/service/service-var-1.rq              | 2 +-
 tests/libtracker-data/service/service-var-2.rq              | 2 +-
 tests/libtracker-data/tracker-service-test.c                | 9 ++++++---
 12 files changed, 17 insertions(+), 14 deletions(-)
---
diff --git a/tests/libtracker-data/service/service-after-triples-1.rq 
b/tests/libtracker-data/service/service-after-triples-1.rq
index c458ef306..fb06e12ed 100644
--- a/tests/libtracker-data/service/service-after-triples-1.rq
+++ b/tests/libtracker-data/service/service-after-triples-1.rq
@@ -1,6 +1,6 @@
 SELECT ?u {
   ?u a rdfs:Resource .
-  SERVICE <dbus:%s> {
+  SERVICE <%s> {
     ?u nrl:indexed true
   }
 }
diff --git a/tests/libtracker-data/service/service-before-triples-1.rq 
b/tests/libtracker-data/service/service-before-triples-1.rq
index f41171537..f867e97f9 100644
--- a/tests/libtracker-data/service/service-before-triples-1.rq
+++ b/tests/libtracker-data/service/service-before-triples-1.rq
@@ -1,5 +1,5 @@
 SELECT ?u {
-  SERVICE <dbus:%s> {
+  SERVICE <%s> {
     ?u a rdfs:Resource
   }
   ?u nrl:indexed true
diff --git a/tests/libtracker-data/service/service-empty-1.rq 
b/tests/libtracker-data/service/service-empty-1.rq
index 476290070..23136fa1f 100644
--- a/tests/libtracker-data/service/service-empty-1.rq
+++ b/tests/libtracker-data/service/service-empty-1.rq
@@ -1,4 +1,4 @@
 SELECT ?u {
-  SERVICE <dbus:%s> {
+  SERVICE <%s> {
   }
 }
diff --git a/tests/libtracker-data/service/service-empty-2.rq 
b/tests/libtracker-data/service/service-empty-2.rq
index 688f584b9..3bd6a5f13 100644
--- a/tests/libtracker-data/service/service-empty-2.rq
+++ b/tests/libtracker-data/service/service-empty-2.rq
@@ -1,5 +1,5 @@
 SELECT ?u {
-  SERVICE <dbus:%s> {
+  SERVICE <%s> {
     SELECT 42 { }
   }
 }
diff --git a/tests/libtracker-data/service/service-local-filter-1.rq 
b/tests/libtracker-data/service/service-local-filter-1.rq
index d8db5c57e..5c8f8c1b9 100644
--- a/tests/libtracker-data/service/service-local-filter-1.rq
+++ b/tests/libtracker-data/service/service-local-filter-1.rq
@@ -1,5 +1,5 @@
 SELECT ?u {
-  SERVICE <dbus:%s> {
+  SERVICE <%s> {
     ?u nrl:indexed true;
        rdfs:label ?l
   }
diff --git a/tests/libtracker-data/service/service-query-1.rq 
b/tests/libtracker-data/service/service-query-1.rq
index 310a72d25..6ca52b186 100644
--- a/tests/libtracker-data/service/service-query-1.rq
+++ b/tests/libtracker-data/service/service-query-1.rq
@@ -1,5 +1,5 @@
 SELECT ?u {
-  SERVICE <dbus:%s> {
+  SERVICE <%s> {
     ?u nrl:indexed true
   }
 }
diff --git a/tests/libtracker-data/service/service-union-with-local-1.rq 
b/tests/libtracker-data/service/service-union-with-local-1.rq
index 83a4eb5d7..098604a54 100644
--- a/tests/libtracker-data/service/service-union-with-local-1.rq
+++ b/tests/libtracker-data/service/service-union-with-local-1.rq
@@ -2,7 +2,7 @@ SELECT ?u {
   {
     ?u nrl:indexed true;
   } UNION {
-    SERVICE <dbus:%s> {
+    SERVICE <%s> {
       ?u nrl:indexed true;
     }
   }
diff --git a/tests/libtracker-data/service/service-union-with-local-2.rq 
b/tests/libtracker-data/service/service-union-with-local-2.rq
index 0566ec42e..1d3df0d69 100644
--- a/tests/libtracker-data/service/service-union-with-local-2.rq
+++ b/tests/libtracker-data/service/service-union-with-local-2.rq
@@ -10,7 +10,7 @@ SELECT ?u ?s {
   {
     SELECT ?u ?s {
       ?u a rdfs:Resource .
-      SERVICE <dbus:%s> {
+      SERVICE <%s> {
         SELECT ?u ('b' AS ?s) {
           ?u nrl:indexed true
         }
diff --git a/tests/libtracker-data/service/service-union-with-local-3.rq 
b/tests/libtracker-data/service/service-union-with-local-3.rq
index 67eaf6293..45105baf4 100644
--- a/tests/libtracker-data/service/service-union-with-local-3.rq
+++ b/tests/libtracker-data/service/service-union-with-local-3.rq
@@ -9,7 +9,7 @@ SELECT ?u ?s {
   UNION
   {
     SELECT ?u ?s {
-      SERVICE <dbus:%s> {
+      SERVICE <%s> {
         SELECT ?u ('b' AS ?s) {
           ?u nrl:indexed true
         }
diff --git a/tests/libtracker-data/service/service-var-1.rq b/tests/libtracker-data/service/service-var-1.rq
index 8a5ea245a..cc5342dbd 100644
--- a/tests/libtracker-data/service/service-var-1.rq
+++ b/tests/libtracker-data/service/service-var-1.rq
@@ -1,5 +1,5 @@
 SELECT ?u {
-  VALUES ?s { 'dbus:%s' } .
+  VALUES ?s { '%s' } .
   SERVICE ?s {
     ?u nrl:indexed true
   }
diff --git a/tests/libtracker-data/service/service-var-2.rq b/tests/libtracker-data/service/service-var-2.rq
index 38cfcb753..5e8bca2dd 100644
--- a/tests/libtracker-data/service/service-var-2.rq
+++ b/tests/libtracker-data/service/service-var-2.rq
@@ -3,4 +3,4 @@ SELECT ?u {
     ?u nrl:indexed true
   }
 }
-VALUES ?s { 'dbus:%s' }
+VALUES ?s { '%s' }
diff --git a/tests/libtracker-data/tracker-service-test.c b/tests/libtracker-data/tracker-service-test.c
index ee2fb60ae..d6caed5b3 100644
--- a/tests/libtracker-data/tracker-service-test.c
+++ b/tests/libtracker-data/tracker-service-test.c
@@ -183,7 +183,7 @@ test_sparql_query (TestInfo      *test_info,
        GError *error = NULL;
        gchar *query, *query_filename, *service_query;
        gchar *results_filename;
-       gchar *prefix, *test_prefix;
+       gchar *prefix, *test_prefix, *uri;
        GFile *ontology;
        GThread *thread;
 
@@ -213,12 +213,15 @@ test_sparql_query (TestInfo      *test_info,
        results_filename = g_strconcat (test_prefix, ".out", NULL);
        g_free (test_prefix);
 
+       uri = g_strdup_printf ("dbus:%s",
+                              g_dbus_connection_get_unique_name (dbus_conn));
+
        /* perform actual query */
-       service_query = g_strdup_printf (query,
-                                        g_dbus_connection_get_unique_name (dbus_conn));
+       service_query = g_strdup_printf (query, uri);
        cursor = tracker_sparql_connection_query (local, service_query, NULL, &error);
        g_free (service_query);
        g_free (query);
+       g_free (uri);
 
        check_result (cursor, test_info, results_filename, error);
        g_free (results_filename);


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