[folks] tests: Add support for recent EDS D-Bus APIs in the unit tests



commit 256fa1ea13e5145272192ed6848bda99fcc72e1a
Author: Philip Withnall <philip withnall collabora co uk>
Date:   Mon Jan 19 19:19:43 2015 +0000

    tests: Add support for recent EDS D-Bus APIs in the unit tests
    
    We’re now on AddressBook8. Gosh.

 tests/lib/eds/test-case.vala |   56 ++++++++++++++++++-----------------------
 1 files changed, 25 insertions(+), 31 deletions(-)
---
diff --git a/tests/lib/eds/test-case.vala b/tests/lib/eds/test-case.vala
index 5d946c8..6e6e5ce 100644
--- a/tests/lib/eds/test-case.vala
+++ b/tests/lib/eds/test-case.vala
@@ -104,7 +104,15 @@ public class EdsTest.TestCase : Folks.TestCase
           "org.gnome.evolution.dataserver.Sources2",
           "org.gnome.evolution.dataserver.Sources1"
         };
+      const string address_book_services[] =
+        {
+          "org.gnome.evolution.dataserver.AddressBook8",
+          "org.gnome.evolution.dataserver.AddressBook7",
+          "org.gnome.evolution.dataserver.AddressBook6",
+          "org.gnome.evolution.dataserver.AddressBook5",
+        };
 
+      /* Source registry. */
       for (uint i = 0; i < sources_services.length; i++)
         {
           var service_file_name =
@@ -127,39 +135,25 @@ public class EdsTest.TestCase : Folks.TestCase
         }
 
       /* Address book factory. */
-      var service_file_name =
-          Path.build_filename (this.transient_dir, "dbus-1", "services",
-              "evolution-addressbook-factory.service");
-      var service_file = ("[D-BUS Service]\n" +
-          "Name=org.gnome.evolution.dataserver.AddressBook6\n" +
-          "Exec=%s/evolution-addressbook-factory\n").printf (libexec);
-
-      try
-        {
-          FileUtils.set_contents (service_file_name, service_file);
-        }
-      catch (FileError e3)
+      for (uint i = 0; i < address_book_services.length; i++)
         {
-          error ("Error creating D-Bus service file ‘%s’: %s",
-              service_file_name, e3.message);
-        }
-
-      /* The same for Evolution 3.8. */
-      service_file_name =
-          Path.build_filename (this.transient_dir, "dbus-1", "services",
-              "evolution-addressbook-factory-3-8.service");
-      service_file = ("[D-BUS Service]\n" +
-          "Name=org.gnome.evolution.dataserver.AddressBook5\n" +
-          "Exec=%s/evolution-addressbook-factory\n").printf (libexec);
+          var service_file_name =
+              Path.build_filename (this.transient_dir, "dbus-1", "services",
+                  "evolution-addressbook-factory-%u.service".printf (i));
+          var service_file = ("[D-BUS Service]\n" +
+              "Name=%s\n" +
+              "Exec=%s/evolution-addressbook-factory\n").printf (
+                  address_book_services[i], libexec);
 
-      try
-        {
-          FileUtils.set_contents (service_file_name, service_file);
-        }
-      catch (FileError e3)
-        {
-          error ("Error creating D-Bus service file ‘%s’: %s",
-              service_file_name, e3.message);
+          try
+            {
+              FileUtils.set_contents (service_file_name, service_file);
+            }
+          catch (FileError e3)
+            {
+              error ("Error creating D-Bus service file ‘%s’: %s",
+                  service_file_name, e3.message);
+            }
         }
     }
 


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