[tracker-miners/wip/carlosg/stable-content-urns: 1/8] tests: Make tracker-miner-fs-test more similar to the original




commit a9408e957c13fa1f4293b744ef99c88785ce8641
Author: Carlos Garnacho <carlosg gnome org>
Date:   Mon Dec 20 15:35:46 2021 +0100

    tests: Make tracker-miner-fs-test more similar to the original
    
    Most notably, create the graphs beforehand, and ensure the index roots
    get the nie:dataSource data set. This is optional now but the differences
    will show in future commits.

 tests/libtracker-miner/tracker-miner-fs-test.c | 38 ++++++++++++++++----------
 1 file changed, 23 insertions(+), 15 deletions(-)
---
diff --git a/tests/libtracker-miner/tracker-miner-fs-test.c b/tests/libtracker-miner/tracker-miner-fs-test.c
index 013fe8b26..59c1b1983 100644
--- a/tests/libtracker-miner/tracker-miner-fs-test.c
+++ b/tests/libtracker-miner/tracker-miner-fs-test.c
@@ -39,6 +39,8 @@ test_miner_process_file (TrackerMinerFS      *miner,
        TrackerIndexingTree *tree;
        gchar *uri, *parent_uri;
        GFile *parent;
+       GFile *root;
+       gchar *root_uri;
 
        ((TestMiner *) miner)->n_process_file++;
 
@@ -76,24 +78,21 @@ test_miner_process_file (TrackerMinerFS      *miner,
        if (tracker_indexing_tree_file_is_root (tree, file)) {
                tracker_resource_set_uri (resource, "nie:rootElementOf", uri);
                tracker_resource_add_uri (resource, "rdf:type", "nie:DataSource");
-       } else {
-               GFile *root;
-               gchar *root_uri;
-
-               root = tracker_indexing_tree_get_root (tree, file, NULL);
-               if (root) {
-                       root_uri = g_file_get_uri (root);
-                       tracker_resource_set_uri (resource, "nie:dataSource", root_uri);
-                       g_free (root_uri);
-               }
+       }
 
-               parent = g_file_get_parent (file);
-               parent_uri = g_file_get_uri (file);
-               tracker_resource_set_uri (resource, "nfo:belongsToContainer", parent_uri);
-               g_free (parent_uri);
-               g_object_unref (parent);
+       root = tracker_indexing_tree_get_root (tree, file, NULL);
+       if (root) {
+               root_uri = g_file_get_uri (root);
+               tracker_resource_set_uri (resource, "nie:dataSource", root_uri);
+               g_free (root_uri);
        }
 
+       parent = g_file_get_parent (file);
+       parent_uri = g_file_get_uri (parent);
+       tracker_resource_set_uri (resource, "nfo:belongsToContainer", parent_uri);
+       g_free (parent_uri);
+       g_object_unref (parent);
+
        tracker_sparql_buffer_push (buffer, file, "tracker:FileSystem", resource);
        g_object_unref (resource);
        g_free (uri);
@@ -273,6 +272,15 @@ fixture_setup (TrackerMinerFSTestFixture *fixture,
        g_assert_no_error (error);
        g_object_unref (ontology);
 
+       tracker_sparql_connection_update (fixture->connection,
+                                         "CREATE SILENT GRAPH tracker:FileSystem; "
+                                         "CREATE SILENT GRAPH tracker:Software; "
+                                         "CREATE SILENT GRAPH tracker:Documents; "
+                                         "CREATE SILENT GRAPH tracker:Pictures; "
+                                         "CREATE SILENT GRAPH tracker:Audio; "
+                                         "CREATE SILENT GRAPH tracker:Video ",
+                                         NULL, NULL);
+
        fixture->miner = test_miner_new (fixture->connection, &error);
        g_assert_no_error (error);
 }


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