[evolution-data-server/sqlite-refactor: 15/21] Ported the lower level cursor tests to use EBookSqlite.



commit 234cffecf8901584217f427bdf6b2ea49ad84135
Author: Tristan Van Berkom <tristanvb openismus com>
Date:   Mon Nov 18 19:41:53 2013 +0900

    Ported the lower level cursor tests to use EBookSqlite.
    
    Refactored the whole test suite so that it's isolated to
    libedata-book, use the EBookSqlite directly.
    
    Now for the majority of test cases, we test with and without
    fields in the summary (with an empty summary configuration)
    and we also test the EBookSqlite with a callback to fetch
    vcards and without a callback.
    
    We also now test for e164 number change notifications in locale changes.

 tests/libebook/data/vcards/simple-1.vcf            |    1 +
 tests/libebook/data/vcards/simple-2.vcf            |    1 +
 tests/libebook/data/vcards/sorted-4.vcf            |    2 +-
 tests/libebook/data/vcards/sorted-5.vcf            |    2 +-
 tests/libedata-book/Makefile.am                    |   15 -
 tests/libedata-book/data-test-utils.c              |  684 +++++++++-----------
 tests/libedata-book/data-test-utils.h              |  116 ++--
 tests/libedata-book/test-sqlite-create-cursor.c    |   95 +--
 tests/libedata-book/test-sqlite-cursor-calculate.c |  455 +++++++-------
 .../test-sqlite-cursor-change-locale.c             |   96 ++-
 .../test-sqlite-cursor-de-DE-migrated.c            |   32 -
 .../test-sqlite-cursor-en-US-migrated.c            |   33 -
 .../test-sqlite-cursor-fr-CA-migrated.c            |   32 -
 .../test-sqlite-cursor-move-by-de-DE.c             |   62 ++-
 .../test-sqlite-cursor-move-by-en-US.c             |  102 ++--
 .../test-sqlite-cursor-move-by-fr-CA.c             |   63 ++-
 .../test-sqlite-cursor-move-by-posix.c             |   62 ++-
 .../test-sqlite-cursor-posix-initial.c             |   35 -
 .../test-sqlite-cursor-posix-migrated.c            |   32 -
 tests/libedata-book/test-sqlite-cursor-set-sexp.c  |  100 ++--
 .../libedata-book/test-sqlite-cursor-set-target.c  |  128 +++--
 tests/libedata-book/test-sqlite-get-contact.c      |   48 +-
 22 files changed, 1041 insertions(+), 1155 deletions(-)
---
diff --git a/tests/libebook/data/vcards/simple-1.vcf b/tests/libebook/data/vcards/simple-1.vcf
index ea6383c..a42f151 100644
--- a/tests/libebook/data/vcards/simple-1.vcf
+++ b/tests/libebook/data/vcards/simple-1.vcf
@@ -1,4 +1,5 @@
 BEGIN:VCARD
+UID:simple-1
 FN:Foo Bar
 EMAIL;INTERNET:foo bar example org
 END:VCARD
diff --git a/tests/libebook/data/vcards/simple-2.vcf b/tests/libebook/data/vcards/simple-2.vcf
index 4fa3707..773a3e1 100644
--- a/tests/libebook/data/vcards/simple-2.vcf
+++ b/tests/libebook/data/vcards/simple-2.vcf
@@ -1,4 +1,5 @@
 BEGIN:VCARD
+UID:simple-2
 FN:Baz Qux
 EMAIL;INTERNET:baz qux example com
 END:VCARD
diff --git a/tests/libebook/data/vcards/sorted-4.vcf b/tests/libebook/data/vcards/sorted-4.vcf
index 888b89c..61a0c56 100644
--- a/tests/libebook/data/vcards/sorted-4.vcf
+++ b/tests/libebook/data/vcards/sorted-4.vcf
@@ -1,6 +1,6 @@
 BEGIN:VCARD
 UID:sorted-4
 N:bat;First Name
-TEL;TYPE=work,pref:+9999999
+TEL;TYPE=work,pref:12 245999
 EMAIL:big bobby brown org
 END:VCARD
diff --git a/tests/libebook/data/vcards/sorted-5.vcf b/tests/libebook/data/vcards/sorted-5.vcf
index bf6c11a..8a8993f 100644
--- a/tests/libebook/data/vcards/sorted-5.vcf
+++ b/tests/libebook/data/vcards/sorted-5.vcf
@@ -1,6 +1,6 @@
 BEGIN:VCARD
 UID:sorted-5
 N:bäd;First Name
-TEL;HOME:+6666666
+TEL;HOME:049-2459-4393
 EMAIL;TYPE=home,work:james brown com
 END:VCARD
diff --git a/tests/libedata-book/Makefile.am b/tests/libedata-book/Makefile.am
index 0901c95..346b081 100644
--- a/tests/libedata-book/Makefile.am
+++ b/tests/libedata-book/Makefile.am
@@ -61,11 +61,6 @@ TESTS = \
        test-sqlite-cursor-set-target \
        test-sqlite-cursor-calculate \
        test-sqlite-cursor-set-sexp \
-       test-sqlite-cursor-posix-initial \
-       test-sqlite-cursor-en-US-migrated \
-       test-sqlite-cursor-fr-CA-migrated \
-       test-sqlite-cursor-de-DE-migrated \
-       test-sqlite-cursor-posix-migrated \
        test-sqlite-cursor-change-locale
 
 noinst_PROGRAMS = $(TESTS)
@@ -100,16 +95,6 @@ test_sqlite_cursor_calculate_LDADD=$(TEST_LIBS)
 test_sqlite_cursor_calculate_CPPFLAGS=$(TEST_CPPFLAGS)
 test_sqlite_cursor_set_sexp_LDADD=$(TEST_LIBS)
 test_sqlite_cursor_set_sexp_CPPFLAGS=$(TEST_CPPFLAGS)
-test_sqlite_cursor_posix_initial_LDADD=$(TEST_LIBS)
-test_sqlite_cursor_posix_initial_CPPFLAGS=$(TEST_CPPFLAGS)
-test_sqlite_cursor_en_US_migrated_LDADD=$(TEST_LIBS)
-test_sqlite_cursor_en_US_migrated_CPPFLAGS=$(TEST_CPPFLAGS)
-test_sqlite_cursor_fr_CA_migrated_LDADD=$(TEST_LIBS)
-test_sqlite_cursor_fr_CA_migrated_CPPFLAGS=$(TEST_CPPFLAGS)
-test_sqlite_cursor_de_DE_migrated_LDADD=$(TEST_LIBS)
-test_sqlite_cursor_de_DE_migrated_CPPFLAGS=$(TEST_CPPFLAGS)
-test_sqlite_cursor_posix_migrated_LDADD=$(TEST_LIBS)
-test_sqlite_cursor_posix_migrated_CPPFLAGS=$(TEST_CPPFLAGS)
 test_sqlite_cursor_change_locale_LDADD=$(TEST_LIBS)
 test_sqlite_cursor_change_locale_CPPFLAGS=$(TEST_CPPFLAGS)
 
diff --git a/tests/libedata-book/data-test-utils.c b/tests/libedata-book/data-test-utils.c
index f917f0b..92bd9a9 100644
--- a/tests/libedata-book/data-test-utils.c
+++ b/tests/libedata-book/data-test-utils.c
@@ -25,16 +25,6 @@
 
 #include "data-test-utils.h"
 
-/* This forces the GType to be registered in a way that
- * avoids a "statement with no effect" compiler warning.
- * FIXME Use g_type_ensure() once we require GLib 2.34. */
-#define REGISTER_TYPE(type) \
-       (g_type_class_unref (g_type_class_ref (type)))
-
-
-#define SQLITEDB_EMAIL_ID    "addressbook localbackend com"
-#define SQLITEDB_FOLDER_NAME "folder"
-
 gchar *
 new_vcard_from_test_case (const gchar *case_name)
 {
@@ -69,217 +59,233 @@ new_contact_from_test_case (const gchar *case_name)
                contact = e_contact_new_from_vcard (vcard);
        g_free (vcard);
 
+       if (!contact)
+               g_error ("failed to construct contact from test case '%s'",
+                        case_name);
+
        return contact;
 }
 
-static gboolean
-contacts_are_equal_shallow (EContact *a,
-                            EContact *b)
+void
+add_contact_from_test_case (EbSqlFixture *fixture,
+                           const gchar *case_name,
+                           EContact **ret_contact)
 {
-       const gchar *uid_a, *uid_b;
+       EContact *contact;
+       GError *error = NULL;
 
-        /* Avoid warnings if one or more are NULL, to make this function
-         * "NULL-friendly" */
-       if (!a && !b)
-               return TRUE;
+       contact = new_contact_from_test_case (case_name);
 
-       if (!E_IS_CONTACT (a) || !E_IS_CONTACT (b))
-               return FALSE;
+       if (!e_book_sqlite_add_contact (fixture->ebsql,
+                                       contact, case_name,
+                                       FALSE, NULL, &error))
+               g_error ("Failed to add contact: %s", error->message);
 
-       uid_a = e_contact_get_const (a, E_CONTACT_UID);
-       uid_b = e_contact_get_const (b, E_CONTACT_UID);
+       if (ret_contact)
+               *ret_contact = g_object_ref (contact);
 
-       return g_strcmp0 (uid_a, uid_b) == 0;
+       /* Hold on to this so we can load vcards */
+       g_hash_table_insert (fixture->contacts, g_strdup (case_name), contact);
 }
 
-gboolean
-add_contact_from_test_case_verify (EBookClient *book_client,
-                                   const gchar *case_name,
-                                   EContact **contact)
+static void
+delete_work_directory (const gchar *filename)
 {
-       EContact *contact_orig;
-       EContact *contact_final;
-       gchar *uid;
-       GError *error = NULL;
+       /* XXX Instead of complex error checking here, we should ideally use
+        * a recursive GDir / g_unlink() function.
+        *
+        * We cannot use GFile and the recursive delete function without
+        * corrupting our contained D-Bus environment with service files
+        * from the OS.
+        */
+       const gchar *argv[] = { "/bin/rm", "-rf", filename, NULL };
+       gboolean spawn_succeeded;
+       gint exit_status;
 
-       contact_orig = new_contact_from_test_case (case_name);
+       spawn_succeeded = g_spawn_sync (
+               NULL, (gchar **) argv, NULL, 0, NULL, NULL,
+                                       NULL, NULL, &exit_status, NULL);
 
-       if (!e_book_client_add_contact_sync (book_client, contact_orig, &uid, NULL, &error))
-               g_error ("Failed to add contact: %s", error->message);
+       g_assert (spawn_succeeded);
+       g_assert (WIFEXITED (exit_status));
+       g_assert_cmpint (WEXITSTATUS (exit_status), ==, 0);
+}
 
-       e_contact_set (contact_orig, E_CONTACT_UID, uid);
+ESourceBackendSummarySetup *
+setup_empty_book (void)
+{
+       ESourceBackendSummarySetup *setup;
+       ESource *scratch;
+       GError *error = NULL;
 
-       if (!e_book_client_get_contact_sync (book_client, uid, &contact_final, NULL, &error))
-               g_error ("Failed to get contact: %s", error->message);
+       scratch = e_source_new_with_uid ("test-source", NULL, &error);
+       if (!scratch)
+               g_error ("Error creating scratch source");
 
-        /* verify the contact was added "successfully" (not thorough) */
-       g_assert (contacts_are_equal_shallow (contact_orig, contact_final));
+       /* This is a bit of a cheat */
+       setup = g_object_new (E_TYPE_SOURCE_BACKEND_SUMMARY_SETUP, "source", scratch, NULL);
+       e_source_backend_summary_setup_set_summary_fields (setup,
+                                                          /* We don't use this field in our tests anyway */
+                                                          E_CONTACT_FILE_AS,
+                                                          0);
 
-       if (contact)
-                *contact = contact_final;
-       else
-               g_object_unref (contact_final);
-       g_object_unref (contact_orig);
-       g_free (uid);
+       g_object_unref (scratch);
 
-       return TRUE;
+       return setup;
 }
 
 static gchar *
-get_addressbook_directory (ESourceRegistry *registry,
-                          ESource         *source)
+fetch_vcard_from_hash (const gchar *uid,
+                      const gchar *extra,
+                      gpointer     user_data)
 {
-       ESource *builtin_source;
-       const gchar *user_data_dir;
-       const gchar *uid;
-       gchar *filename = NULL;
-
-       uid = e_source_get_uid (source);
-       g_return_val_if_fail (uid != NULL, NULL);
+       EbSqlFixture *fixture = user_data;
+       EContact     *contact;
 
-       user_data_dir = e_get_user_data_dir ();
+       g_assert (extra && extra[0]);
 
-       builtin_source = e_source_registry_ref_builtin_address_book (registry);
-
-       /* Special case directory for the builtin addressbook source */
-       if (builtin_source != NULL && e_source_equal (source, builtin_source))
-               uid = "system";
-
-       filename = g_build_filename (user_data_dir, "addressbook", uid, NULL);
-
-       if (builtin_source)
-               g_object_unref (builtin_source);
+       /* vCards not stored in shallow addressbooks, instead loaded on the fly */
+       contact = g_hash_table_lookup (fixture->contacts, extra);
+       if (contact)
+               return e_vcard_to_string (E_VCARD (contact), EVC_FORMAT_VCARD_30);
 
-       return filename;
+       return NULL;
 }
 
-static EBookBackendSqliteDB *
-open_sqlitedb (ESourceRegistry *registry,
-              ESource         *source)
+static void 
+contact_change_cb (EbSqlChangeType     change_type,
+                  const gchar        *uid,
+                  const gchar        *extra,
+                  const gchar        *vcard,
+                  gpointer            user_data)
 {
-       EBookBackendSqliteDB *ebsdb;
-       GError *error = NULL;
-       gchar *dirname;
-
-       dirname = get_addressbook_directory (registry, source);
-       ebsdb   = e_book_backend_sqlitedb_new (dirname,
-                                              SQLITEDB_EMAIL_ID,
-                                              SQLITEDB_FOLDER_ID,
-                                              SQLITEDB_FOLDER_NAME,
-                                              TRUE, &error);
+       EbSqlFixture *fixture = user_data;
+       EContact *contact;
 
-       if (!ebsdb)
-               g_error ("Failed to open SQLite backend: %s", error->message);
+       if (change_type == EBSQL_CHANGE_LOCALE_CHANGED)
+               fixture->n_locale_changes++;
+       else if (change_type == EBSQL_CHANGE_CONTACT_ADDED)
+               fixture->n_add_changes++;
 
-       g_free (dirname);
-
-       return ebsdb;
+       /* Replace the current contact with the new one */
+       contact = e_contact_new_from_vcard (vcard);
+       g_hash_table_insert (fixture->contacts, g_strdup (extra), contact);
 }
 
 void
-e_sqlitedb_fixture_setup (ESqliteDBFixture *fixture,
-                         gconstpointer     user_data)
+e_sqlite_fixture_setup (EbSqlFixture  *fixture,
+                       gconstpointer  user_data)
 {
-       EBookClient *book_client;
+       EbSqlClosure *closure = (EbSqlClosure *)user_data;
+       ESourceBackendSummarySetup *setup = NULL;
+       gchar  *filename, *directory;
+       GError *error = NULL;
 
-       e_test_server_utils_setup ((ETestServerFixture *)fixture, user_data);
+       fixture->contacts =
+               g_hash_table_new_full (g_str_hash,
+                                      g_str_equal,
+                                      g_free,
+                                      g_object_unref);
+
+       /* Cleanup from last test */
+       directory  = g_build_filename (SRCDIR, "cache", NULL);
+       delete_work_directory (directory);
+       g_free (directory);
+
+       filename = g_build_filename (SRCDIR, "cache", "contacts.db", NULL);
+
+       if (closure->setup_summary)
+               setup = closure->setup_summary ();
+
+       if (closure->without_vcards)
+               fixture->ebsql = e_book_sqlite_new_full (filename,
+                                                        setup,
+                                                        fetch_vcard_from_hash,
+                                                        contact_change_cb,
+                                                        fixture,
+                                                        NULL, NULL,
+                                                        &error);
+       else
+               fixture->ebsql = e_book_sqlite_new_full (filename,
+                                                        setup,
+                                                        NULL,
+                                                        contact_change_cb,
+                                                        fixture,
+                                                        NULL, NULL,
+                                                        &error);
 
-       book_client = E_TEST_SERVER_UTILS_SERVICE (fixture, EBookClient);
-       fixture->ebsdb = open_sqlitedb (((ETestServerFixture *)fixture)->registry,
-                                       e_client_get_source (E_CLIENT (book_client)));
-}
+       g_clear_object (&setup);
 
-void
-e_sqlitedb_fixture_teardown (ESqliteDBFixture *fixture,
-                            gconstpointer     user_data)
-{
-       g_object_unref (fixture->ebsdb);
-       e_test_server_utils_teardown ((ETestServerFixture *)fixture, user_data);
+       if (!fixture->ebsql)
+               g_error ("Failed to create the SQLite: %s", error->message);
+
+       g_free (filename);
 }
 
 void
-e_sqlitedb_cursor_fixture_setup_book (ESource            *scratch,
-                                     ETestServerClosure *closure)
+e_sqlite_fixture_teardown (EbSqlFixture   *fixture,
+                          gconstpointer   user_data)
 {
-       ESourceBackendSummarySetup *setup;
-
-       g_type_class_unref (g_type_class_ref (E_TYPE_SOURCE_BACKEND_SUMMARY_SETUP));
-       setup = e_source_get_extension (scratch, E_SOURCE_EXTENSION_BACKEND_SUMMARY_SETUP);
-       e_source_backend_summary_setup_set_summary_fields (setup,
-                                                          E_CONTACT_FAMILY_NAME,
-                                                          E_CONTACT_GIVEN_NAME,
-                                                          E_CONTACT_EMAIL,
-                                                          0);
-       e_source_backend_summary_setup_set_indexed_fields (setup,
-                                                          E_CONTACT_FAMILY_NAME, E_BOOK_INDEX_PREFIX,
-                                                          E_CONTACT_GIVEN_NAME, E_BOOK_INDEX_PREFIX,
-                                                          E_CONTACT_EMAIL, E_BOOK_INDEX_PREFIX,
-                                                          0);
+       g_object_unref (fixture->ebsql);
+       g_hash_table_destroy (fixture->contacts);
 }
 
 void
-e_sqlitedb_cursor_fixture_setup (EbSdbCursorFixture *fixture,
-                                gconstpointer       user_data)
+e_sqlite_cursor_fixture_setup (EbSqlCursorFixture *fixture,
+                              gconstpointer       user_data)
 {
-       ETestServerFixture *base_fixture = (ETestServerFixture *)fixture;
-       ESqliteDBFixture *ebsdb_fixture = (ESqliteDBFixture *)fixture;
-       EbSdbCursorClosure *data = (EbSdbCursorClosure *)user_data;
-       EContactField sort_fields[] = { E_CONTACT_FAMILY_NAME, E_CONTACT_GIVEN_NAME };
+       EbSqlFixture       *base_fixture = (EbSqlFixture   *)fixture;
+       EbSqlCursorClosure *data = (EbSqlCursorClosure *)user_data;
+       EContactField       sort_fields[] = { E_CONTACT_FAMILY_NAME, E_CONTACT_GIVEN_NAME };
        EBookCursorSortType sort_types[] = { data->sort_type, data->sort_type };
-       EBookClient *book_client;
        GSList *contacts = NULL;
+       GSList *extra_list = NULL;
        GError *error = NULL;
        gint i;
        gchar *sexp = NULL;
-       const gchar *source_name;
 
-       /* Support the migration tests */
-       source_name = g_getenv ("MIGRATION_TEST_SOURCE_NAME");
-       if (source_name != NULL)
-               base_fixture->source_name = g_strdup (source_name);
-
-       /* Setup the EBookClient, but don't open the EBookBackendSqliteDB until after
-        * we've specified the locale
-        */
-       e_test_server_utils_setup ((ETestServerFixture *)fixture, user_data);
-       book_client = E_TEST_SERVER_UTILS_SERVICE (fixture, EBookClient);
+       e_sqlite_fixture_setup (base_fixture, user_data);
 
        if (data->locale)
-               e_sqlitedb_cursor_fixture_set_locale (fixture, data->locale);
+               e_sqlite_cursor_fixture_set_locale (fixture, data->locale);
        else
-               e_sqlitedb_cursor_fixture_set_locale (fixture, "en_US.UTF-8");
-
-       /* Now open the EBookBackendSqliteDB */
-       ebsdb_fixture->ebsdb = open_sqlitedb (((ETestServerFixture *)fixture)->registry,
-                                             e_client_get_source (E_CLIENT (book_client)));
+               e_sqlite_cursor_fixture_set_locale (fixture, "en_US.UTF-8");
 
        for (i = 0; i < N_SORTED_CONTACTS; i++) {
                gchar *case_name = g_strdup_printf ("sorted-%d", i + 1);
                gchar *vcard;
                EContact *contact;
 
-               vcard    = new_vcard_from_test_case (case_name);
-               contact  = e_contact_new_from_vcard (vcard);
-               contacts = g_slist_prepend (contacts, contact);
+               vcard      = new_vcard_from_test_case (case_name);
+               contact    = e_contact_new_from_vcard (vcard);
+               contacts   = g_slist_prepend (contacts, contact);
+               extra_list = g_slist_prepend (extra_list, case_name);
+
                g_free (vcard);
-               g_free (case_name);
 
                fixture->contacts[i] = contact;
-       }
 
-       if (!e_book_client_add_contacts_sync (book_client, contacts, NULL, NULL, &error)) { 
+               /* These need to be added to the hash as well */
+               g_hash_table_insert (base_fixture->contacts,
+                                    g_strdup (case_name),
+                                    g_object_ref (contact));
+       }
 
+       if (!e_book_sqlite_add_contacts (base_fixture->ebsql,
+                                        contacts, extra_list,
+                                        FALSE, NULL, &error)) {
                /* Dont complain here, we re-use the same addressbook for multiple tests
                 * and we can't add the same contacts twice
                 */
-               if (g_error_matches (error, E_BOOK_CLIENT_ERROR,
-                                    E_BOOK_CLIENT_ERROR_CONTACT_ID_ALREADY_EXISTS))
+               if (g_error_matches (error, E_BOOK_SQLITE_ERROR,
+                                    E_BOOK_SQLITE_ERROR_CONSTRAINT))
                        g_clear_error (&error);
                else
                        g_error ("Failed to add test contacts: %s", error->message);
        }
 
        g_slist_free (contacts);
+       g_slist_free_full (extra_list, g_free);
 
        /* Allow a surrounding fixture setup to add a query here */
        if (fixture->query) {
@@ -288,28 +294,29 @@ e_sqlitedb_cursor_fixture_setup (EbSdbCursorFixture *fixture,
                fixture->query = NULL;
        }
 
-       fixture->cursor = e_book_backend_sqlitedb_cursor_new (((ESqliteDBFixture *) fixture)->ebsdb,
-                                                             SQLITEDB_FOLDER_ID,
-                                                             sexp, sort_fields, sort_types, 2, &error);
+       fixture->cursor = e_book_sqlite_cursor_new (base_fixture->ebsql, sexp,
+                                                   sort_fields, sort_types, 2, &error);
 
-       g_free (sexp);
+       if (!fixture->cursor)
+               g_error ("Failed to create cursor: %s\n", error->message);
 
-       g_assert (fixture->cursor != NULL);
+       g_free (sexp);
 }
 
 void
-e_sqlitedb_cursor_fixture_filtered_setup (EbSdbCursorFixture *fixture,
-                                         gconstpointer  user_data)
+e_sqlite_cursor_fixture_filtered_setup (EbSqlCursorFixture *fixture,
+                                       gconstpointer  user_data)
 {
        fixture->query = e_book_query_field_test (E_CONTACT_EMAIL, E_BOOK_QUERY_ENDS_WITH, ".com");
 
-       e_sqlitedb_cursor_fixture_setup (fixture, user_data);
+       e_sqlite_cursor_fixture_setup (fixture, user_data);
 }
 
 void
-e_sqlitedb_cursor_fixture_teardown (EbSdbCursorFixture *fixture,
+e_sqlite_cursor_fixture_teardown (EbSqlCursorFixture *fixture,
                                    gconstpointer       user_data)
 {
+       EbSqlFixture *base_fixture = (EbSqlFixture   *)fixture;
        gint i;
 
        for (i = 0; i < N_SORTED_CONTACTS; i++) {
@@ -317,93 +324,24 @@ e_sqlitedb_cursor_fixture_teardown (EbSdbCursorFixture *fixture,
                        g_object_unref (fixture->contacts[i]);
        }
 
-       if (fixture->locale1)
-               g_object_unref (fixture->locale1);
-
-       if (fixture->own_id > 0)
-               g_bus_unown_name (fixture->own_id);
-
-       e_book_backend_sqlitedb_cursor_free (((ESqliteDBFixture *) fixture)->ebsdb, fixture->cursor);
-       e_sqlitedb_fixture_teardown ((ESqliteDBFixture *)fixture, user_data);
-}
-
-typedef struct {
-       EbSdbCursorFixture *fixture;
-       const gchar *locale;
-} ChangeLocaleData;
-
-static void
-book_client_locale_change (EBookClient *book,
-                          GParamSpec  *pspec,
-                          ChangeLocaleData *data)
-{
-       ETestServerFixture *base_fixture = (ETestServerFixture *)data->fixture;
-
-       if (!g_strcmp0 (e_book_client_get_locale (book), data->locale))
-               g_main_loop_quit (base_fixture->loop);
+       e_book_sqlite_cursor_free (base_fixture->ebsql, fixture->cursor);
+       e_sqlite_fixture_teardown (base_fixture, user_data);
 }
 
 void
-e_sqlitedb_cursor_fixture_set_locale (EbSdbCursorFixture *fixture,
-                                     const gchar        *locale)
+e_sqlite_cursor_fixture_set_locale (EbSqlCursorFixture *fixture,
+                                   const gchar        *locale)
 {
-       ETestServerFixture *base_fixture = (ETestServerFixture *)fixture;
-       EBookClient *book_client;
-       ChangeLocaleData data = { fixture, locale };
-       gulong handler_id;
-       gchar *strv[2] = { NULL, NULL };
-
-       book_client = E_TEST_SERVER_UTILS_SERVICE (fixture, EBookClient);
-
-       /* We're already in the right locale */
-       if (g_strcmp0 (locale, e_book_client_get_locale (book_client)) == 0)
-               return;
-
-       if (!fixture->locale1) {
-               GDBusConnection *bus;
-               GError *error = NULL;
-
-               /* We use the 'org.freedesktop.locale1 on the session bus instead
-                * of the system bus only for testing purposes... in real life
-                * this service is on the system bus.
-                */
-               bus = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &error);
-               if (!bus)
-                       g_error ("Failed to get system bus: %s", error->message);
-
-               fixture->locale1 = e_dbus_locale1_skeleton_new ();
-
-               /* Set initial locale before exporting on the bus */
-               strv[0] = g_strdup_printf ("LANG=%s", locale);
-               e_dbus_locale1_set_locale (fixture->locale1, (const gchar * const *)strv);
-               g_free (strv[0]);
-
-               if (!g_dbus_interface_skeleton_export (G_DBUS_INTERFACE_SKELETON (fixture->locale1),
-                                                      bus, "/org/freedesktop/locale1", &error))
-                       g_error ("Failed to export org.freedesktop.locale1: %s", error->message);
-
-               fixture->own_id =
-                       g_bus_own_name_on_connection (bus,
-                                                     "org.freedesktop.locale1",
-                                                     G_BUS_NAME_OWNER_FLAGS_REPLACE,
-                                                     NULL, NULL, NULL, NULL);
-
-               g_object_unref (bus);
-       } else {
-               /* Send locale change message */
-               strv[0] = g_strdup_printf ("LANG=%s", locale);
-               e_dbus_locale1_set_locale (fixture->locale1, (const gchar * const *)strv);
-               g_free (strv[0]);
-       }
+       EbSqlFixture *base_fixture = (EbSqlFixture   *)fixture;
+       GError *error = NULL;
 
-       handler_id = g_signal_connect (book_client, "notify::locale",
-                                      G_CALLBACK (book_client_locale_change), &data);
-       g_main_loop_run (base_fixture->loop);
-       g_signal_handler_disconnect (book_client, handler_id);
+       if (!e_book_sqlite_set_locale (base_fixture->ebsql,
+                                      locale, NULL, &error))
+               g_error ("Failed to set locale: %s", error->message);
 }
 
 static gint
-find_contact_data (EbSdbSearchData *data,
+find_contact_data (EbSqlSearchData *data,
                   const gchar     *uid)
 {
        return g_strcmp0 (data->uid, uid);
@@ -471,7 +409,7 @@ print_results (GSList      *results)
        g_print ("\nPRINTING RESULTS:\n");
 
        for (l = results; l; l = l->next) {
-               EbSdbSearchData *data = l->data;
+               EbSqlSearchData *data = l->data;
 
                g_print ("\n%s\n", data->vcard);
        }
@@ -487,21 +425,21 @@ print_results (GSList      *results)
 static StepData *
 step_test_new_internal (const gchar *test_path,
                        const gchar *locale,
-                       gsize        struct_size)
+                       gboolean     store_vcards,
+                       gboolean     empty_book)
 {
        StepData *data;
 
-       data = g_slice_alloc0 (struct_size);
-       data->parent.parent.type = E_TEST_SERVER_ADDRESS_BOOK;
-       data->parent.parent.customize = e_sqlitedb_cursor_fixture_setup_book;
+       data = g_slice_new0 (StepData);
+
        data->parent.locale = g_strdup (locale);
        data->parent.sort_type = E_BOOK_CURSOR_SORT_ASCENDING;
-       data->path = g_strdup (test_path);
-       data->struct_size = struct_size;
 
-       /* Keep the work dir for migration tests */
-       if (g_getenv ("MIGRATION_TEST_SOURCE_NAME") != NULL)
-           data->parent.parent.keep_work_directory = TRUE;
+       data->parent.parent.without_vcards = (store_vcards == FALSE);
+       if (empty_book)
+               data->parent.parent.setup_summary = setup_empty_book;
+
+       data->path = g_strdup (test_path);
 
        return data;
 }
@@ -509,56 +447,81 @@ step_test_new_internal (const gchar *test_path,
 static void
 step_test_free (StepData *data)
 {
+       GList *l;
+
        g_free (data->path);
        g_free ((gchar *)data->parent.locale);
-       g_slice_free1 (data->struct_size, data);
+
+       for (l = data->assertions; l; l = l->next) {
+               StepAssertion *assertion = l->data;
+
+               g_free (assertion->locale);
+               g_slice_free (StepAssertion, assertion);
+       }
+
+       g_slice_free (StepData, data);
 }
 
 StepData *
-step_test_new (const gchar *test_path,
-              const gchar *locale)
+step_test_new (const gchar *test_prefix,
+              const gchar *test_path,
+              const gchar *locale,
+              gboolean     store_vcards,
+              gboolean     empty_book)
 {
-       return step_test_new_internal (test_path, locale, sizeof (StepData));
+       StepData *data;
+       gchar *path;
+
+       path = g_strconcat (test_prefix, test_path, NULL);
+       data = step_test_new_internal (path, locale, store_vcards, empty_book);
+       g_free (path);
+
+       return data;
 }
 
 StepData *
-step_test_new_full (const gchar         *test_path,
+step_test_new_full (const gchar         *test_prefix,
+                   const gchar         *test_path,
                    const gchar         *locale,
+                   gboolean             store_vcards,
+                   gboolean             empty_book,
                    EBookCursorSortType  sort_type)
 {
        StepData *data;
+       gchar *path;
 
-       data = step_test_new_internal (test_path, locale, sizeof (StepData));
+       path = g_strconcat (test_prefix, test_path, NULL);
+       data = step_test_new_internal (path, locale, store_vcards, empty_book);
        data->parent.sort_type = sort_type;
+       g_free (path);
 
        return data;
 }
 
 static void
-test_cursor_move_teardown (EbSdbCursorFixture *fixture,
+test_cursor_move_teardown (EbSqlCursorFixture *fixture,
                           gconstpointer  user_data)
 {
        StepData *data = (StepData *)user_data;
 
-       e_sqlitedb_cursor_fixture_teardown (fixture, user_data);
-
+       e_sqlite_cursor_fixture_teardown (fixture, user_data);
        step_test_free (data);
 }
 
 static void
-assert_step (EbSdbCursorFixture *fixture,
+assert_step (EbSqlCursorFixture *fixture,
             StepData *data,
-            gint i,
+            StepAssertion *assertion,
             GSList *results,
             gint n_results,
             gboolean expect_results)
 {
        GSList *uids = NULL;
-       gint j, expected = 0;
+       gint i, expected = 0;
 
        /* Count the number of really expected results */
-       for (j = 0; j < ABS (data->counts[i]); j++) {
-               gint index = data->expected[i][j];
+       for (i = 0; i < ABS (assertion->count); i++) {
+               gint index = assertion->expected[i];
 
                if (index < 0)
                        break;
@@ -577,10 +540,10 @@ assert_step (EbSdbCursorFixture *fixture,
 
 #if DEBUG_FIXTURE
        g_print ("%s: Constructing expected result list for a fetch of %d: ",
-                data->path, data->counts[i]);
+                data->path, assertion->count);
 #endif
-       for (j = 0; j < ABS (data->counts[i]); j++) {
-               gint index = data->expected[i][j];
+       for (i = 0; i < ABS (assertion->count); i++) {
+               gint index = assertion->expected[i];
                gchar *uid;
 
                if (index < 0)
@@ -603,122 +566,90 @@ assert_step (EbSdbCursorFixture *fixture,
 }
 
 static void
-test_step (EbSdbCursorFixture *fixture,
+test_step (EbSqlCursorFixture *fixture,
           gconstpointer  user_data)
 {
+       EbSqlFixture *base_fixture = (EbSqlFixture   *)fixture;
        StepData *data = (StepData *)user_data;
        GSList *results = NULL;
        GError *error = NULL;
-       gint i;
-       gint expected_position = 0, last_expected_position = 0, position;
-       gint total;
        gint n_results;
-       EbSdbCursorOrigin origin;
+       EbSqlCursorOrigin origin;
+       GList *l;
+       gboolean reset = TRUE;
 
-       total = data->filtered ? N_FILTERED_CONTACTS : N_SORTED_CONTACTS;
+       for (l = data->assertions; l; l = l->next) {
+               StepAssertion *assertion = l->data;
 
-       for (i = 0; i < MAX_STEP_COUNTS && data->counts[i] != 0; i++) {
+               if (assertion->locale) {
+                       gint n_locale_changes = base_fixture->n_locale_changes;
 
-               /* For the first call to e_book_backend_sqlitedb_cursor_step(),
-                * set the origin accordingly.
-                */
-               if (i == 0) {
-                       if (data->counts[i] < 0)
-                               origin = EBSDB_CURSOR_ORIGIN_END;
-                       else
-                               origin = EBSDB_CURSOR_ORIGIN_BEGIN;
-               } else
-                       origin = EBSDB_CURSOR_ORIGIN_CURRENT;
-
-               if (expected_position == 0 && data->counts[i] < 0)
-                       expected_position = (total + 1) - ABS (data->counts[i]);
-               else
-                       expected_position += data->counts[i];
+                       if (!e_book_sqlite_set_locale (base_fixture->ebsql,
+                                                      assertion->locale,
+                                                      NULL, &error))
+                               g_error ("Failed to set locale: %s", error->message);
 
-               if (expected_position > total || expected_position < 1)
-                       expected_position = 0;
+                       n_locale_changes = (base_fixture->n_locale_changes - n_locale_changes);
+
+                       /* Only check for contact changes is phone numbers are supported,
+                        * contact changes only happen because of e164 number interpretations.
+                        */
+                       if (e_phone_number_is_supported () &&
+                           assertion->count != n_locale_changes)
+                               g_error ("Expected %d e164 numbers to change, %d actually changed.",
+                                        assertion->count, n_locale_changes);
+
+                       reset = TRUE;
+                       continue;
+               }
+
+               /* For the first call to e_book_sqlite_cursor_step(),
+               * or the first reset after locale change, set the origin accordingly.
+                */
+               if (reset) {
+                       if (assertion->count < 0)
+                               origin = EBSQL_CURSOR_ORIGIN_END;
+                       else
+                               origin = EBSQL_CURSOR_ORIGIN_BEGIN;
+
+                      reset = FALSE;
+               } else
+                       origin = EBSQL_CURSOR_ORIGIN_CURRENT;
 
                /* Try only fetching the contacts but not moving the cursor */
-               n_results = e_book_backend_sqlitedb_cursor_step (((ESqliteDBFixture *) fixture)->ebsdb,
-                                                                fixture->cursor,
-                                                                EBSDB_CURSOR_STEP_FETCH,
-                                                                origin,
-                                                                data->counts[i],
-                                                                &results, &error);
+               n_results = e_book_sqlite_cursor_step (base_fixture->ebsql,
+                                                      fixture->cursor,
+                                                      EBSQL_CURSOR_STEP_FETCH,
+                                                      origin,
+                                                      assertion->count,
+                                                      &results,
+                                                      NULL, &error);
                if (n_results < 0)
                        g_error ("Error fetching cursor results: %s", error->message);
 
                print_results (results);
-               assert_step (fixture, data, i, results, n_results, TRUE);
-               g_slist_foreach (results, (GFunc)e_book_backend_sqlitedb_search_data_free, NULL);
+               assert_step (fixture, data, assertion, results, n_results, TRUE);
+               g_slist_foreach (results, (GFunc)e_book_sqlite_search_data_free, NULL);
                g_slist_free (results);
                results = NULL;
 
-               if (!e_book_backend_sqlitedb_cursor_calculate (((ESqliteDBFixture *) fixture)->ebsdb,
-                                                              fixture->cursor, NULL, &position, &error))
-                       g_error ("Error calculating cursor: %s", error->message);
-
-               /* We only fetched but didn't move.
-                *
-                * Check that we are still at the previously expected position.
-                */
-               g_assert_cmpint (last_expected_position, ==, position);
-               last_expected_position = expected_position;
-
                /* Do it again, this time only moving the cursor */
-               n_results = e_book_backend_sqlitedb_cursor_step (((ESqliteDBFixture *) fixture)->ebsdb,
-                                                                fixture->cursor,
-                                                                EBSDB_CURSOR_STEP_MOVE,
-                                                                origin,
-                                                                data->counts[i],
-                                                                &results, &error);
+               n_results = e_book_sqlite_cursor_step (base_fixture->ebsql,
+                                                      fixture->cursor,
+                                                      EBSQL_CURSOR_STEP_MOVE,
+                                                      origin,
+                                                      assertion->count,
+                                                      &results,
+                                                      NULL, &error);
                if (n_results < 0)
                        g_error ("Error fetching cursor results: %s", error->message);
 
                print_results (results);
-               assert_step (fixture, data, i, results, n_results, FALSE);
-               g_slist_foreach (results, (GFunc)e_book_backend_sqlitedb_search_data_free, NULL);
+               assert_step (fixture, data, assertion, results, n_results, FALSE);
+               g_slist_foreach (results, (GFunc)e_book_sqlite_search_data_free, NULL);
                g_slist_free (results);
                results = NULL;
-
-               if (!e_book_backend_sqlitedb_cursor_calculate (((ESqliteDBFixture *) fixture)->ebsdb,
-                                                              fixture->cursor, NULL, &position, &error))
-                       g_error ("Error calculating cursor: %s", error->message);
-
-               /* This time we moved the cursor but did not fetch, let's assert the new position
-                */
-               g_assert_cmpint (expected_position, ==, position);
        }
-
-       if (data->counts[0] < 0) {
-               expected_position = (total + 1) - ABS (data->counts[0]);
-               origin = EBSDB_CURSOR_ORIGIN_END;
-       } else {
-               expected_position = data->counts[0];
-               origin = EBSDB_CURSOR_ORIGIN_BEGIN;
-       }
-
-       /* One more, test reset API, the first batch from the beginning, this time move & fetch results 
together */
-       n_results = e_book_backend_sqlitedb_cursor_step (((ESqliteDBFixture *) fixture)->ebsdb,
-                                                        fixture->cursor,
-                                                        EBSDB_CURSOR_STEP_MOVE |
-                                                        EBSDB_CURSOR_STEP_FETCH,
-                                                        origin,
-                                                        data->counts[0],
-                                                        &results, &error);
-       if (n_results < 0)
-               g_error ("Error fetching cursor results: %s", error->message);
-
-       print_results (results);
-       assert_step (fixture, data, 0, results, n_results, TRUE);
-       g_slist_foreach (results, (GFunc)e_book_backend_sqlitedb_search_data_free, NULL);
-       g_slist_free (results);
-       results = NULL;
-
-       if (!e_book_backend_sqlitedb_cursor_calculate (((ESqliteDBFixture *) fixture)->ebsdb,
-                                                      fixture->cursor, NULL, &position, &error))
-               g_error ("Error calculating cursor: %s", error->message);
-       g_assert_cmpint (expected_position, ==, position);
 }
 
 static void
@@ -726,36 +657,28 @@ step_test_add_assertion_va_list (StepData *data,
                                 gint      count,
                                 va_list   args)
 {
-       gint i, j;
-       gint expected;
+       StepAssertion *assertion = g_slice_new0 (StepAssertion);
+       gint expected, i;
 
-       for (i = 0; i < MAX_STEP_COUNTS; i++) {
-
-               /* Find the next available test slot */
-               if (data->counts[i] == 0) {
-                       data->counts[i] = count;
+       assertion->count = count;
 
 #if DEBUG_FIXTURE
-                       g_print ("Adding assertion to test %d: %s\n", i + 1, data->path);
-                       g_print ("  Test will move by %d and expect: ", count);
+       g_print ("Adding assertion to test %d: %s\n", i + 1, data->path);
+       g_print ("  Test will move by %d and expect: ", count);
 #endif
-                       for (j = 0; j < ABS (count); j++) {
-                               expected = va_arg (args, gint);
+       for (i = 0; i < ABS (count); i++) {
+               expected = va_arg (args, gint);
 
 #if DEBUG_FIXTURE
-                               g_print ("%d ", expected);
+               g_print ("%d ", expected);
 #endif
-                               data->expected[i][j] = expected - 1;
-                       }
+               assertion->expected[i] = expected - 1;
+       }
 #if DEBUG_FIXTURE
-                       g_print ("\n");
+       g_print ("\n");
 #endif
 
-                       break;
-               }
-       }
-
-       g_assert (i < MAX_STEP_COUNTS);
+       data->assertions = g_list_append (data->assertions, assertion);
 }
 
 /* A positive of negative 'count' value
@@ -770,7 +693,6 @@ step_test_add_assertion (StepData *data,
                         gint      count,
                         ...)
 {
-
        va_list args;
 
        va_start (args, count);
@@ -779,15 +701,27 @@ step_test_add_assertion (StepData *data,
 }
 
 void
+step_test_change_locale (StepData    *data,
+                        const gchar *locale,
+                        gint         expected_changes)
+{
+       StepAssertion *assertion = g_slice_new0 (StepAssertion);
+
+       assertion->locale = g_strdup (locale);
+       assertion->count  = expected_changes;
+       data->assertions  = g_list_append (data->assertions, assertion);
+}
+
+void
 step_test_add (StepData  *data,
               gboolean   filtered)
 {
        data->filtered = filtered;
 
-       g_test_add (data->path, EbSdbCursorFixture, data,
+       g_test_add (data->path, EbSqlCursorFixture, data,
                    filtered ?
-                   e_sqlitedb_cursor_fixture_filtered_setup :
-                   e_sqlitedb_cursor_fixture_setup,
+                   e_sqlite_cursor_fixture_filtered_setup :
+                   e_sqlite_cursor_fixture_setup,
                    test_step,
                    test_cursor_move_teardown);
 }
diff --git a/tests/libedata-book/data-test-utils.h b/tests/libedata-book/data-test-utils.h
index 5015cdd..1da28fb 100644
--- a/tests/libedata-book/data-test-utils.h
+++ b/tests/libedata-book/data-test-utils.h
@@ -22,10 +22,7 @@
 #ifndef DATA_TEST_UTILS_H
 #define DATA_TEST_UTILS_H
 
-#include <libebook/libebook.h>
 #include <libedata-book/libedata-book.h>
-#include "e-test-server-utils.h"
-#include "e-dbus-localed.h"
 
 /* This legend shows the add order, and various sort order of the sorted
  * vcards. The UIDs of these contacts are formed as 'sorted-1', 'sorted-2' etc
@@ -66,81 +63,91 @@
  *     http://demo.icu-project.org/icu-bin/locexp?_=en_US&d_=en&x=col
  */
 
-#define SQLITEDB_FOLDER_ID   "folder_id"
-#define N_SORTED_CONTACTS    20
-#define MAX_STEP_COUNTS   5
 
 /* 13 contacts in the test data have an email address ending with ".com" */
 #define N_FILTERED_CONTACTS  13
+#define N_SORTED_CONTACTS    20
 
+typedef ESourceBackendSummarySetup * (* EbSqlSetupSummary) (void);
 
 typedef struct {
-       ETestServerFixture parent_fixture;
+       EBookSqlite *ebsql;
 
-       EBookBackendSqliteDB *ebsdb;
-} ESqliteDBFixture;
+       GHashTable  *contacts;
+       gint         n_add_changes;
+       gint         n_locale_changes;
+} EbSqlFixture;
 
 typedef struct {
-       ESqliteDBFixture parent_fixture;
+       gboolean           without_vcards;
+       EbSqlSetupSummary  setup_summary;
+} EbSqlClosure;
 
-       EbSdbCursor     *cursor;
+typedef struct {
+       EbSqlFixture     parent_fixture;
+
+       EbSqlCursor     *cursor;
        EContact        *contacts[N_SORTED_CONTACTS];
        EBookQuery      *query;
 
-       EDBusLocale1    *locale1;
        guint            own_id;
-} EbSdbCursorFixture;
+} EbSqlCursorFixture;
 
 typedef struct {
-       ETestServerClosure  parent;
+       EbSqlClosure          parent;
 
-       const gchar        *locale;
-       EBookCursorSortType sort_type;
-} EbSdbCursorClosure;
+       const gchar          *locale;
+       EBookCursorSortType   sort_type;
+} EbSqlCursorClosure;
 
 typedef struct {
-       EbSdbCursorClosure parent;
-       gchar *path;
+       /* A locale change */
+       gchar *locale;
 
-       /* array of counts to move by, terminated with 0 or MAX_COUNTS */
-       gint counts[MAX_STEP_COUNTS];
+       /* count argument for move */
+       gint count;
+
+       /* An array of 'ABS (counts[i])' expected contacts */
+       gint expected[N_SORTED_CONTACTS];
+} StepAssertion;
+
+typedef struct {
+       EbSqlCursorClosure parent;
+       gchar *path;
 
-       /* For each step() command, an array of 'ABS (counts[i])' expected contacts */
-       gint expected[MAX_STEP_COUNTS][N_SORTED_CONTACTS];
+       GList *assertions;
 
        /* Whether this is a filtered test */
        gboolean filtered;
-
-       /* Private detail */
-       gsize struct_size;
 } StepData;
 
-void     e_sqlitedb_fixture_setup          (ESqliteDBFixture *fixture,
-                                           gconstpointer     user_data);
-void     e_sqlitedb_fixture_teardown       (ESqliteDBFixture *fixture,
-                                           gconstpointer     user_data);
-
-void     e_sqlitedb_cursor_fixture_setup_book (ESource            *scratch,
-                                              ETestServerClosure *closure);
-void     e_sqlitedb_cursor_fixture_setup    (EbSdbCursorFixture *fixture,
-                                            gconstpointer       user_data);
-void     e_sqlitedb_cursor_fixture_teardown (EbSdbCursorFixture *fixture,
-                                            gconstpointer       user_data);
-void     e_sqlitedb_cursor_fixture_set_locale (EbSdbCursorFixture *fixture,
-                                              const gchar        *locale);
+/* Base fixture */
+void     e_sqlite_fixture_setup              (EbSqlFixture     *fixture,
+                                             gconstpointer     user_data);
+void     e_sqlite_fixture_teardown           (EbSqlFixture *fixture,
+                                             gconstpointer     user_data);
+ESourceBackendSummarySetup *setup_empty_book (void);
+
+/* Cursor fixture */
+void     e_sqlite_cursor_fixture_setup       (EbSqlCursorFixture *fixture,
+                                             gconstpointer       user_data);
+void     e_sqlite_cursor_fixture_teardown    (EbSqlCursorFixture *fixture,
+                                             gconstpointer       user_data);
+void     e_sqlite_cursor_fixture_set_locale  (EbSqlCursorFixture *fixture,
+                                             const gchar        *locale);
 
 /* Filters contacts with E_CONTACT_EMAIL ending with '.com' */
-void     e_sqlitedb_cursor_fixture_filtered_setup (EbSdbCursorFixture *fixture,
-                                                  gconstpointer  user_data);
-
+void     e_sqlite_cursor_fixture_filtered_setup (EbSqlCursorFixture *fixture,
+                                                gconstpointer       user_data);
 
 gchar    *new_vcard_from_test_case         (const gchar *case_name);
 EContact *new_contact_from_test_case       (const gchar *case_name);
 
-gboolean add_contact_from_test_case_verify (EBookClient *book_client,
-                                           const gchar *case_name,
-                                           EContact   **contact);
 
+
+void      add_contact_from_test_case       (EbSqlFixture *fixture,
+                                           const gchar *case_name,
+                                           EContact **ret_contact);
 void     assert_contacts_order_slist       (GSList      *results,
                                            GSList      *uids);
 void     assert_contacts_order             (GSList      *results,
@@ -153,11 +160,22 @@ void     print_results                     (GSList      *results);
 void      step_test_add_assertion          (StepData    *data,
                                            gint         count,
                                            ...);
-StepData *step_test_new                    (const gchar *test_path,
-                                           const gchar *locale);
-StepData *step_test_new_full               (const gchar *test_path,
+void      step_test_change_locale          (StepData    *data,
+                                           const gchar *locale,
+                                           gint         expected_changes);
+
+StepData *step_test_new                    (const gchar *test_prefix,
+                                           const gchar *test_path,
                                            const gchar *locale,
-                                           EBookCursorSortType sort_type);
+                                           gboolean     store_vcards,
+                                           gboolean     empty_book);
+StepData *step_test_new_full               (const gchar         *test_prefix,
+                                           const gchar         *test_path,
+                                           const gchar         *locale,
+                                           gboolean             store_vcards,
+                                           gboolean             empty_book,
+                                           EBookCursorSortType  sort_type);
+
 void      step_test_add                    (StepData    *data,
                                            gboolean     filtered);
 
diff --git a/tests/libedata-book/test-sqlite-create-cursor.c b/tests/libedata-book/test-sqlite-create-cursor.c
index 399ad09..3549ea1 100644
--- a/tests/libedata-book/test-sqlite-create-cursor.c
+++ b/tests/libedata-book/test-sqlite-create-cursor.c
@@ -6,29 +6,29 @@
 
 #include "data-test-utils.h"
 
-static ETestServerClosure book_closure = { E_TEST_SERVER_ADDRESS_BOOK, NULL, 0 };
+static EbSqlClosure closure = { FALSE, NULL };
 
 static void
-test_create_cursor_empty_query (ESqliteDBFixture *fixture,
-                               gconstpointer     user_data)
+test_create_cursor_empty_query (EbSqlFixture   *fixture,
+                               gconstpointer   user_data)
 {
-       EbSdbCursor  *cursor;
+       EbSqlCursor  *cursor;
        EContactField sort_fields[] = { E_CONTACT_FAMILY_NAME, E_CONTACT_GIVEN_NAME };
        EBookCursorSortType sort_types[] = { E_BOOK_CURSOR_SORT_ASCENDING, E_BOOK_CURSOR_SORT_ASCENDING };
        GError       *error = NULL;
 
-       cursor = e_book_backend_sqlitedb_cursor_new (fixture->ebsdb, SQLITEDB_FOLDER_ID, NULL,
-                                                    sort_fields, sort_types, 2, &error);
+       cursor = e_book_sqlite_cursor_new (fixture->ebsql, NULL,
+                                          sort_fields, sort_types, 2, &error);
 
        g_assert (cursor != NULL);
-       e_book_backend_sqlitedb_cursor_free (fixture->ebsdb, cursor);
+       e_book_sqlite_cursor_free (fixture->ebsql, cursor);
 }
 
 static void
-test_create_cursor_valid_query (ESqliteDBFixture *fixture,
-                               gconstpointer     user_data)
+test_create_cursor_valid_query (EbSqlFixture   *fixture,
+                               gconstpointer   user_data)
 {
-       EbSdbCursor  *cursor;
+       EbSqlCursor  *cursor;
        EContactField sort_fields[] = { E_CONTACT_FAMILY_NAME, E_CONTACT_GIVEN_NAME };
        EBookCursorSortType sort_types[] = { E_BOOK_CURSOR_SORT_ASCENDING, E_BOOK_CURSOR_SORT_ASCENDING };
        EBookQuery   *query;
@@ -38,69 +38,44 @@ test_create_cursor_valid_query (ESqliteDBFixture *fixture,
        query = e_book_query_field_test (E_CONTACT_FULL_NAME, E_BOOK_QUERY_IS, "James Brown");
        sexp  = e_book_query_to_string (query);
 
-       cursor = e_book_backend_sqlitedb_cursor_new (fixture->ebsdb, SQLITEDB_FOLDER_ID, sexp,
-                                                    sort_fields, sort_types, 2, &error);
+       cursor = e_book_sqlite_cursor_new (fixture->ebsql, sexp,
+                                          sort_fields, sort_types, 2, &error);
 
        g_assert (cursor != NULL);
-       e_book_backend_sqlitedb_cursor_free (fixture->ebsdb, cursor);
+       e_book_sqlite_cursor_free (fixture->ebsql, cursor);
        g_free (sexp);
        e_book_query_unref (query);
 }
 
 static void
-test_create_cursor_invalid_query (ESqliteDBFixture *fixture,
-                                 gconstpointer     user_data)
+test_create_cursor_invalid_sort (EbSqlFixture   *fixture,
+                                gconstpointer   user_data)
 {
-       EbSdbCursor  *cursor;
-       EContactField sort_fields[] = { E_CONTACT_FAMILY_NAME, E_CONTACT_GIVEN_NAME };
-       EBookCursorSortType sort_types[] = { E_BOOK_CURSOR_SORT_ASCENDING, E_BOOK_CURSOR_SORT_ASCENDING };
-       EBookQuery   *query;
-       gchar        *sexp;
-       GError       *error = NULL;
-
-       query = e_book_query_field_test (E_CONTACT_TEL, E_BOOK_QUERY_CONTAINS, "888");
-       sexp  = e_book_query_to_string (query);
-
-       cursor = e_book_backend_sqlitedb_cursor_new (fixture->ebsdb, SQLITEDB_FOLDER_ID, sexp,
-                                                    sort_fields, sort_types, 2, &error);
-
-       g_assert (cursor == NULL);
-       g_assert (error);
-       g_assert (g_error_matches (error, E_BOOK_SDB_ERROR, E_BOOK_SDB_ERROR_INVALID_QUERY));
-
-       g_free (sexp);
-       e_book_query_unref (query);
-}
-
-static void
-test_create_cursor_invalid_sort (ESqliteDBFixture *fixture,
-                                gconstpointer     user_data)
-{
-       EbSdbCursor  *cursor;
+       EbSqlCursor  *cursor;
        EContactField sort_fields[] = { E_CONTACT_TEL };
        EBookCursorSortType sort_types[] = { E_BOOK_CURSOR_SORT_ASCENDING };
        GError       *error = NULL;
 
-       cursor = e_book_backend_sqlitedb_cursor_new (fixture->ebsdb, SQLITEDB_FOLDER_ID, NULL,
-                                                    sort_fields, sort_types, 1, &error);
+       cursor = e_book_sqlite_cursor_new (fixture->ebsql, NULL,
+                                          sort_fields, sort_types, 1, &error);
 
        g_assert (cursor == NULL);
        g_assert (error);
-       g_assert (g_error_matches (error, E_BOOK_SDB_ERROR, E_BOOK_SDB_ERROR_INVALID_QUERY));
+       g_assert (g_error_matches (error, E_BOOK_SQLITE_ERROR, E_BOOK_SQLITE_ERROR_INVALID_QUERY));
 }
 
 static void
-test_create_cursor_missing_sort (ESqliteDBFixture *fixture,
-                                gconstpointer     user_data)
+test_create_cursor_missing_sort (EbSqlFixture   *fixture,
+                                gconstpointer   user_data)
 {
-       EbSdbCursor  *cursor;
+       EbSqlCursor  *cursor;
        GError       *error = NULL;
 
-       cursor = e_book_backend_sqlitedb_cursor_new (fixture->ebsdb, SQLITEDB_FOLDER_ID, NULL, NULL, NULL, 0, 
&error);
+       cursor = e_book_sqlite_cursor_new (fixture->ebsql, NULL, NULL, NULL, 0, &error);
 
        g_assert (cursor == NULL);
        g_assert (error);
-       g_assert (g_error_matches (error, E_BOOK_SDB_ERROR, E_BOOK_SDB_ERROR_INVALID_QUERY));
+       g_assert (g_error_matches (error, E_BOOK_SQLITE_ERROR, E_BOOK_SQLITE_ERROR_INVALID_QUERY));
 }
 
 gint
@@ -116,16 +91,14 @@ main (gint argc,
        g_assert (g_setenv ("LC_ALL", "en_US.UTF-8", TRUE));
        setlocale (LC_ALL, "");
 
-       g_test_add ("/EbSdbCursor/Create/EmptyQuery", ESqliteDBFixture, &book_closure,
-                   e_sqlitedb_fixture_setup, test_create_cursor_empty_query, e_sqlitedb_fixture_teardown);
-       g_test_add ("/EbSdbCursor/Create/ValidQuery", ESqliteDBFixture, &book_closure,
-                   e_sqlitedb_fixture_setup, test_create_cursor_valid_query, e_sqlitedb_fixture_teardown);
-       g_test_add ("/EbSdbCursor/Create/InvalidQuery", ESqliteDBFixture, &book_closure,
-                   e_sqlitedb_fixture_setup, test_create_cursor_invalid_query, e_sqlitedb_fixture_teardown);
-       g_test_add ("/EbSdbCursor/Create/InvalidSort", ESqliteDBFixture, &book_closure,
-                   e_sqlitedb_fixture_setup, test_create_cursor_invalid_sort, e_sqlitedb_fixture_teardown);
-       g_test_add ("/EbSdbCursor/Create/MissingSort", ESqliteDBFixture, &book_closure,
-                   e_sqlitedb_fixture_setup, test_create_cursor_missing_sort, e_sqlitedb_fixture_teardown);
-
-       return e_test_server_utils_run ();
+       g_test_add ("/EbSqlCursor/Create/EmptyQuery", EbSqlFixture, &closure,
+                   e_sqlite_fixture_setup, test_create_cursor_empty_query, e_sqlite_fixture_teardown);
+       g_test_add ("/EbSqlCursor/Create/ValidQuery", EbSqlFixture, &closure,
+                   e_sqlite_fixture_setup, test_create_cursor_valid_query, e_sqlite_fixture_teardown);
+       g_test_add ("/EbSqlCursor/Create/InvalidSort", EbSqlFixture, &closure,
+                   e_sqlite_fixture_setup, test_create_cursor_invalid_sort, e_sqlite_fixture_teardown);
+       g_test_add ("/EbSqlCursor/Create/MissingSort", EbSqlFixture, &closure,
+                   e_sqlite_fixture_setup, test_create_cursor_missing_sort, e_sqlite_fixture_teardown);
+
+       return g_test_run ();
 }
diff --git a/tests/libedata-book/test-sqlite-cursor-calculate.c 
b/tests/libedata-book/test-sqlite-cursor-calculate.c
index cb2cbe0..3766f56 100644
--- a/tests/libedata-book/test-sqlite-cursor-calculate.c
+++ b/tests/libedata-book/test-sqlite-cursor-calculate.c
@@ -6,27 +6,25 @@
 
 #include "data-test-utils.h"
 
-static EbSdbCursorClosure ascending_closure = {
-       { E_TEST_SERVER_ADDRESS_BOOK, e_sqlitedb_cursor_fixture_setup_book, 0 },
-       NULL, 
-       E_BOOK_CURSOR_SORT_ASCENDING
+static EbSqlCursorClosure ascending_closure = { 
+       { FALSE, NULL },
+       NULL, E_BOOK_CURSOR_SORT_ASCENDING
 };
 
-static EbSdbCursorClosure descending_closure = {
-       { E_TEST_SERVER_ADDRESS_BOOK, e_sqlitedb_cursor_fixture_setup_book, 0 },
-       NULL, 
-       E_BOOK_CURSOR_SORT_DESCENDING
+static EbSqlCursorClosure descending_closure = { 
+       { FALSE, NULL },
+       NULL, E_BOOK_CURSOR_SORT_DESCENDING
 };
 
 static void
-test_cursor_calculate_initial (EbSdbCursorFixture *fixture,
+test_cursor_calculate_initial (EbSqlCursorFixture *fixture,
                               gconstpointer  user_data)
 {
        GError *error = NULL;
        gint    position = 0, total = 0;
 
-       if (!e_book_backend_sqlitedb_cursor_calculate (((ESqliteDBFixture *) fixture)->ebsdb,
-                                                      fixture->cursor, &total, &position, &error))
+       if (!e_book_sqlite_cursor_calculate (((EbSqlFixture *) fixture)->ebsql,
+                                            fixture->cursor, &total, &position, NULL, &error))
            g_error ("Error calculating cursor: %s", error->message);
 
        g_assert_cmpint (position, ==, 0);
@@ -34,7 +32,7 @@ test_cursor_calculate_initial (EbSdbCursorFixture *fixture,
 }
 
 static void
-test_cursor_calculate_move_forward (EbSdbCursorFixture *fixture,
+test_cursor_calculate_move_forward (EbSqlCursorFixture *fixture,
                                    gconstpointer  user_data)
 {
        GSList *results = NULL;
@@ -42,12 +40,12 @@ test_cursor_calculate_move_forward (EbSdbCursorFixture *fixture,
        gint    position = 0, total = 0;
 
        /* Move cursor */
-       if (e_book_backend_sqlitedb_cursor_step (((ESqliteDBFixture *) fixture)->ebsdb,
-                                                fixture->cursor,
-                                                EBSDB_CURSOR_STEP_MOVE | EBSDB_CURSOR_STEP_FETCH,
-                                                EBSDB_CURSOR_ORIGIN_CURRENT,
-                                                5,
-                                                &results, &error) < 0)
+       if (e_book_sqlite_cursor_step (((EbSqlFixture *) fixture)->ebsql,
+                                      fixture->cursor,
+                                      EBSQL_CURSOR_STEP_MOVE | EBSQL_CURSOR_STEP_FETCH,
+                                      EBSQL_CURSOR_ORIGIN_CURRENT,
+                                      5,
+                                      &results, NULL, &error) < 0)
                g_error ("Error fetching cursor results: %s", error->message);
 
        /* Assert the first 5 contacts in en_US order */
@@ -59,13 +57,13 @@ test_cursor_calculate_move_forward (EbSdbCursorFixture *fixture,
                               "sorted-5",
                               "sorted-6",
                               NULL);
-       g_slist_foreach (results, (GFunc)e_book_backend_sqlitedb_search_data_free, NULL);
+       g_slist_foreach (results, (GFunc)e_book_sqlite_search_data_free, NULL);
        g_slist_free (results);
 
        /* Check new position */
-       if (!e_book_backend_sqlitedb_cursor_calculate (((ESqliteDBFixture *) fixture)->ebsdb,
-                                                      fixture->cursor, &total, &position, &error))
-           g_error ("Error calculating cursor: %s", error->message);
+       if (!e_book_sqlite_cursor_calculate (((EbSqlFixture *) fixture)->ebsql,
+                                            fixture->cursor, &total, &position, NULL, &error))
+               g_error ("Error calculating cursor: %s", error->message);
 
        /* results 0 + 5 = position 5, result index 4 (results[0, 1, 2, 3, 4]) */
        g_assert_cmpint (position, ==, 5);
@@ -73,7 +71,7 @@ test_cursor_calculate_move_forward (EbSdbCursorFixture *fixture,
 }
 
 static void
-test_cursor_calculate_move_backwards (EbSdbCursorFixture *fixture,
+test_cursor_calculate_move_backwards (EbSqlCursorFixture *fixture,
                                      gconstpointer  user_data)
 {
        GSList *results = NULL;
@@ -81,12 +79,12 @@ test_cursor_calculate_move_backwards (EbSdbCursorFixture *fixture,
        gint    position = 0, total = 0;
 
        /* Move cursor */
-       if (e_book_backend_sqlitedb_cursor_step (((ESqliteDBFixture *) fixture)->ebsdb,
-                                                fixture->cursor,
-                                                EBSDB_CURSOR_STEP_MOVE | EBSDB_CURSOR_STEP_FETCH,
-                                                EBSDB_CURSOR_ORIGIN_END,
-                                                -5,
-                                                &results, &error) < 0)
+       if (e_book_sqlite_cursor_step (((EbSqlFixture *) fixture)->ebsql,
+                                      fixture->cursor,
+                                      EBSQL_CURSOR_STEP_MOVE | EBSQL_CURSOR_STEP_FETCH,
+                                      EBSQL_CURSOR_ORIGIN_END,
+                                      -5,
+                                      &results, NULL, &error) < 0)
                g_error ("Error fetching cursor results: %s", error->message);
 
        /* Assert the last 5 contacts in en_US order */
@@ -98,12 +96,12 @@ test_cursor_calculate_move_backwards (EbSdbCursorFixture *fixture,
                               "sorted-13",
                               "sorted-12",
                               NULL);
-       g_slist_foreach (results, (GFunc)e_book_backend_sqlitedb_search_data_free, NULL);
+       g_slist_foreach (results, (GFunc)e_book_sqlite_search_data_free, NULL);
        g_slist_free (results);
 
        /* Check new position */
-       if (!e_book_backend_sqlitedb_cursor_calculate (((ESqliteDBFixture *) fixture)->ebsdb,
-                                                      fixture->cursor, &total, &position, &error))
+       if (!e_book_sqlite_cursor_calculate (((EbSqlFixture *) fixture)->ebsql,
+                                            fixture->cursor, &total, &position, NULL, &error))
            g_error ("Error calculating cursor: %s", error->message);
 
        /* results 20 - 5 = position 16 result index 15 (results[20, 19, 18, 17, 16]) */
@@ -112,7 +110,7 @@ test_cursor_calculate_move_backwards (EbSdbCursorFixture *fixture,
 }
 
 static void
-test_cursor_calculate_back_and_forth (EbSdbCursorFixture *fixture,
+test_cursor_calculate_back_and_forth (EbSqlCursorFixture *fixture,
                                      gconstpointer  user_data)
 {
        GSList *results = NULL;
@@ -120,69 +118,69 @@ test_cursor_calculate_back_and_forth (EbSdbCursorFixture *fixture,
        gint    position = 0, total = 0;
 
        /* Move cursor */
-       if (e_book_backend_sqlitedb_cursor_step (((ESqliteDBFixture *) fixture)->ebsdb,
-                                                fixture->cursor, 
-                                                EBSDB_CURSOR_STEP_MOVE | EBSDB_CURSOR_STEP_FETCH,
-                                                EBSDB_CURSOR_ORIGIN_BEGIN,
-                                                7,
-                                                &results, &error) < 0)
+       if (e_book_sqlite_cursor_step (((EbSqlFixture *) fixture)->ebsql,
+                                      fixture->cursor, 
+                                      EBSQL_CURSOR_STEP_MOVE | EBSQL_CURSOR_STEP_FETCH,
+                                      EBSQL_CURSOR_ORIGIN_BEGIN,
+                                      7,
+                                      &results, NULL, &error) < 0)
                g_error ("Error fetching cursor results: %s", error->message);
        
        g_assert_cmpint (g_slist_length (results), ==, 7);
-       g_slist_foreach (results, (GFunc)e_book_backend_sqlitedb_search_data_free, NULL);
+       g_slist_foreach (results, (GFunc)e_book_sqlite_search_data_free, NULL);
        g_slist_free (results);
        results = NULL;
 
        /* Check new position */
-       if (!e_book_backend_sqlitedb_cursor_calculate (((ESqliteDBFixture *) fixture)->ebsdb,
-                                                      fixture->cursor, &total, &position, &error))
-           g_error ("Error calculating cursor: %s", error->message);
+       if (!e_book_sqlite_cursor_calculate (((EbSqlFixture *) fixture)->ebsql,
+                                            fixture->cursor, &total, &position, NULL, &error))
+               g_error ("Error calculating cursor: %s", error->message);
 
        /* results 0 + 7 = position 7 result index 6 (results[0, 1, 2, 3, 4, 5, 6]) */
        g_assert_cmpint (position, ==, 7);
        g_assert_cmpint (total, ==, 20);
 
        /* Move cursor */
-       if (e_book_backend_sqlitedb_cursor_step (((ESqliteDBFixture *) fixture)->ebsdb,
-                                                fixture->cursor,
-                                                EBSDB_CURSOR_STEP_MOVE | EBSDB_CURSOR_STEP_FETCH,
-                                                EBSDB_CURSOR_ORIGIN_CURRENT,
-                                                -4,
-                                                &results, &error) < 0)
+       if (e_book_sqlite_cursor_step (((EbSqlFixture *) fixture)->ebsql,
+                                      fixture->cursor,
+                                      EBSQL_CURSOR_STEP_MOVE | EBSQL_CURSOR_STEP_FETCH,
+                                      EBSQL_CURSOR_ORIGIN_CURRENT,
+                                      -4,
+                                      &results, NULL, &error) < 0)
                g_error ("Error fetching cursor results: %s", error->message);
 
        g_assert_cmpint (g_slist_length (results), ==, 4);
-       g_slist_foreach (results, (GFunc)e_book_backend_sqlitedb_search_data_free, NULL);
+       g_slist_foreach (results, (GFunc)e_book_sqlite_search_data_free, NULL);
        g_slist_free (results);
        results = NULL;
 
        /* Check new position */
-       if (!e_book_backend_sqlitedb_cursor_calculate (((ESqliteDBFixture *) fixture)->ebsdb,
-                                                      fixture->cursor, &total, &position, &error))
-           g_error ("Error calculating cursor: %s", error->message);
+       if (!e_book_sqlite_cursor_calculate (((EbSqlFixture *) fixture)->ebsql,
+                                            fixture->cursor, &total, &position, NULL, &error))
+               g_error ("Error calculating cursor: %s", error->message);
 
        /* results 7 - 4 = position 3 result index 2 (results[5, 4, 3, 2]) */
        g_assert_cmpint (position, ==, 3);
        g_assert_cmpint (total, ==, 20);
 
        /* Move cursor */
-       if (e_book_backend_sqlitedb_cursor_step (((ESqliteDBFixture *) fixture)->ebsdb,
-                                                fixture->cursor,
-                                                EBSDB_CURSOR_STEP_MOVE | EBSDB_CURSOR_STEP_FETCH,
-                                                EBSDB_CURSOR_ORIGIN_CURRENT,
-                                                5,
-                                                &results, &error) < 0)
+       if (e_book_sqlite_cursor_step (((EbSqlFixture *) fixture)->ebsql,
+                                      fixture->cursor,
+                                      EBSQL_CURSOR_STEP_MOVE | EBSQL_CURSOR_STEP_FETCH,
+                                      EBSQL_CURSOR_ORIGIN_CURRENT,
+                                      5,
+                                      &results, NULL, &error) < 0)
                g_error ("Error fetching cursor results: %s", error->message);
 
        g_assert_cmpint (g_slist_length (results), ==, 5);
-       g_slist_foreach (results, (GFunc)e_book_backend_sqlitedb_search_data_free, NULL);
+       g_slist_foreach (results, (GFunc)e_book_sqlite_search_data_free, NULL);
        g_slist_free (results);
        results = NULL;
 
        /* Check new position */
-       if (!e_book_backend_sqlitedb_cursor_calculate (((ESqliteDBFixture *) fixture)->ebsdb,
-                                                      fixture->cursor, &total, &position, &error))
-           g_error ("Error calculating cursor: %s", error->message);
+       if (!e_book_sqlite_cursor_calculate (((EbSqlFixture *) fixture)->ebsql,
+                                            fixture->cursor, &total, &position, NULL, &error))
+               g_error ("Error calculating cursor: %s", error->message);
 
        /* results 3 + 5 = position 8 result index 7 (results[3, 4, 5, 6, 7]) */
        g_assert_cmpint (position, ==, 8);
@@ -190,7 +188,7 @@ test_cursor_calculate_back_and_forth (EbSdbCursorFixture *fixture,
 }
 
 static void
-test_cursor_calculate_partial_target (EbSdbCursorFixture *fixture,
+test_cursor_calculate_partial_target (EbSqlCursorFixture *fixture,
                                      gconstpointer  user_data)
 {
        GError *error = NULL;
@@ -200,18 +198,18 @@ test_cursor_calculate_partial_target (EbSdbCursorFixture *fixture,
        const gchar *const *labels;
 
        /* First verify our test... in en_US locale the label 'C' should exist with the index 3 */
-       collator = e_book_backend_sqlitedb_ref_collator (((ESqliteDBFixture *) fixture)->ebsdb);
+       collator = e_book_sqlite_ref_collator (((EbSqlFixture *) fixture)->ebsql);
        labels = e_collator_get_index_labels (collator, &n_labels, NULL, NULL, NULL);
        g_assert_cmpstr (labels[3], ==, "C");
        e_collator_unref (collator);
 
        /* Set the cursor at the start of family names beginning with 'C' */
-       e_book_backend_sqlitedb_cursor_set_target_alphabetic_index (((ESqliteDBFixture *) fixture)->ebsdb,
-                                                                   fixture->cursor, 3);
+       e_book_sqlite_cursor_set_target_alphabetic_index (((EbSqlFixture *) fixture)->ebsql,
+                                                         fixture->cursor, 3);
 
        /* Check new position */
-       if (!e_book_backend_sqlitedb_cursor_calculate (((ESqliteDBFixture *) fixture)->ebsdb,
-                                                      fixture->cursor, &total, &position, &error))
+       if (!e_book_sqlite_cursor_calculate (((EbSqlFixture *) fixture)->ebsql,
+                                            fixture->cursor, &total, &position, NULL, &error))
                g_error ("Error calculating cursor: %s", error->message);
 
        /* Position is 13, there are 13 contacts before the letter 'C' in en_US locale */
@@ -220,26 +218,23 @@ test_cursor_calculate_partial_target (EbSdbCursorFixture *fixture,
 }
 
 static void
-test_cursor_calculate_after_modification (EbSdbCursorFixture *fixture,
+test_cursor_calculate_after_modification (EbSqlCursorFixture *fixture,
                                          gconstpointer  user_data)
 {
-       EBookClient  *book_client;
        GError *error = NULL;
        gint    position = 0, total = 0;
 
-       book_client = E_TEST_SERVER_UTILS_SERVICE (fixture, EBookClient);
-
        /* Set the cursor to point exactly 'blackbird' (which is the 12th contact) */
-       if (e_book_backend_sqlitedb_cursor_step (((ESqliteDBFixture *) fixture)->ebsdb,
-                                                fixture->cursor,
-                                                EBSDB_CURSOR_STEP_MOVE,
-                                                EBSDB_CURSOR_ORIGIN_CURRENT,
-                                                12, NULL, &error) < 0)
+       if (e_book_sqlite_cursor_step (((EbSqlFixture *) fixture)->ebsql,
+                                      fixture->cursor,
+                                      EBSQL_CURSOR_STEP_MOVE,
+                                      EBSQL_CURSOR_ORIGIN_CURRENT,
+                                      12, NULL, NULL, &error) < 0)
                g_error ("Error fetching cursor results: %s", error->message);
 
        /* Check new position */
-       if (!e_book_backend_sqlitedb_cursor_calculate (((ESqliteDBFixture *) fixture)->ebsdb,
-                                                      fixture->cursor, &total, &position, &error))
+       if (!e_book_sqlite_cursor_calculate (((EbSqlFixture *) fixture)->ebsql,
+                                            fixture->cursor, &total, &position, NULL, &error))
                g_error ("Error calculating cursor: %s", error->message);
 
        /* blackbird is at position 12 in en_US locale */
@@ -249,18 +244,24 @@ test_cursor_calculate_after_modification (EbSdbCursorFixture *fixture,
        /* Rename Muffler -> Jacob Appelbaum */
        e_contact_set (fixture->contacts[19 - 1], E_CONTACT_FAMILY_NAME, "Appelbaum");
        e_contact_set (fixture->contacts[19 - 1], E_CONTACT_GIVEN_NAME, "Jacob");
-       if (!e_book_client_modify_contact_sync (book_client, fixture->contacts[19 - 1], NULL, &error))
-               g_error ("modify contact sync: %s", error->message);
+       if (!e_book_sqlite_add_contact (((EbSqlFixture *) fixture)->ebsql,
+                                       fixture->contacts[19 - 1],
+                                       e_contact_get_const (fixture->contacts[19 - 1], E_CONTACT_UID),
+                                       TRUE, NULL, &error))
+               g_error ("Failed to modify contact: %s", error->message);
 
        /* Rename Müller -> Sade Adu */
        e_contact_set (fixture->contacts[20 - 1], E_CONTACT_FAMILY_NAME, "Adu");
        e_contact_set (fixture->contacts[20 - 1], E_CONTACT_GIVEN_NAME, "Sade");
-       if (!e_book_client_modify_contact_sync (book_client, fixture->contacts[20 - 1], NULL, &error))
-               g_error ("modify contact sync: %s", error->message);
+       if (!e_book_sqlite_add_contact (((EbSqlFixture *) fixture)->ebsql,
+                                       fixture->contacts[20 - 1],
+                                       e_contact_get_const (fixture->contacts[20 - 1], E_CONTACT_UID),
+                                       TRUE, NULL, &error))
+               g_error ("Failed to modify contact: %s", error->message);
 
        /* Check new position */
-       if (!e_book_backend_sqlitedb_cursor_calculate (((ESqliteDBFixture *) fixture)->ebsdb,
-                                                      fixture->cursor, &total, &position, &error))
+       if (!e_book_sqlite_cursor_calculate (((EbSqlFixture *) fixture)->ebsql,
+                                            fixture->cursor, &total, &position, NULL, &error))
                g_error ("Error calculating cursor: %s", error->message);
 
        /* blackbird is now at position 14 after moving 2 later contacts to begin with 'A' */
@@ -269,14 +270,14 @@ test_cursor_calculate_after_modification (EbSdbCursorFixture *fixture,
 }
 
 static void
-test_cursor_calculate_filtered_initial (EbSdbCursorFixture *fixture,
+test_cursor_calculate_filtered_initial (EbSqlCursorFixture *fixture,
                                        gconstpointer  user_data)
 {
        GError *error = NULL;
        gint    position = 0, total = 0;
 
-       if (!e_book_backend_sqlitedb_cursor_calculate (((ESqliteDBFixture *) fixture)->ebsdb,
-                                                      fixture->cursor, &total, &position, &error))
+       if (!e_book_sqlite_cursor_calculate (((EbSqlFixture *) fixture)->ebsql,
+                                            fixture->cursor, &total, &position, NULL, &error))
            g_error ("Error calculating cursor: %s", error->message);
 
        g_assert_cmpint (position, ==, 0);
@@ -284,7 +285,7 @@ test_cursor_calculate_filtered_initial (EbSdbCursorFixture *fixture,
 }
 
 static void
-test_cursor_calculate_filtered_move_forward (EbSdbCursorFixture *fixture,
+test_cursor_calculate_filtered_move_forward (EbSqlCursorFixture *fixture,
                                             gconstpointer  user_data)
 {
        GSList *results = NULL;
@@ -292,21 +293,21 @@ test_cursor_calculate_filtered_move_forward (EbSdbCursorFixture *fixture,
        gint    position = 0, total = 0;
 
        /* Move cursor */
-       if (e_book_backend_sqlitedb_cursor_step (((ESqliteDBFixture *) fixture)->ebsdb,
-                                                fixture->cursor,
-                                                EBSDB_CURSOR_STEP_MOVE | EBSDB_CURSOR_STEP_FETCH,
-                                                EBSDB_CURSOR_ORIGIN_CURRENT,
-                                                5, &results, &error) < 0)
+       if (e_book_sqlite_cursor_step (((EbSqlFixture *) fixture)->ebsql,
+                                      fixture->cursor,
+                                      EBSQL_CURSOR_STEP_MOVE | EBSQL_CURSOR_STEP_FETCH,
+                                      EBSQL_CURSOR_ORIGIN_CURRENT,
+                                      5, &results, NULL, &error) < 0)
                g_error ("Error fetching cursor results: %s", error->message);
 
        g_assert_cmpint (g_slist_length (results), ==, 5);
-       g_slist_foreach (results, (GFunc)e_book_backend_sqlitedb_search_data_free, NULL);
+       g_slist_foreach (results, (GFunc)e_book_sqlite_search_data_free, NULL);
        g_slist_free (results);
        results = NULL;
 
        /* Check new position */
-       if (!e_book_backend_sqlitedb_cursor_calculate (((ESqliteDBFixture *) fixture)->ebsdb,
-                                                      fixture->cursor, &total, &position, &error))
+       if (!e_book_sqlite_cursor_calculate (((EbSqlFixture *) fixture)->ebsql,
+                                            fixture->cursor, &total, &position, NULL, &error))
            g_error ("Error calculating cursor: %s", error->message);
 
        /* results 0 + 5 = position 5, result index 4 (results[0, 1, 2, 3, 4]) */
@@ -315,7 +316,7 @@ test_cursor_calculate_filtered_move_forward (EbSdbCursorFixture *fixture,
 }
 
 static void
-test_cursor_calculate_filtered_move_backwards (EbSdbCursorFixture *fixture,
+test_cursor_calculate_filtered_move_backwards (EbSqlCursorFixture *fixture,
                                               gconstpointer  user_data)
 {
        GSList *results = NULL;
@@ -323,23 +324,23 @@ test_cursor_calculate_filtered_move_backwards (EbSdbCursorFixture *fixture,
        gint    position = 0, total = 0;
 
        /* Move cursor */
-       if (e_book_backend_sqlitedb_cursor_step (((ESqliteDBFixture *) fixture)->ebsdb,
-                                                fixture->cursor,
-                                                EBSDB_CURSOR_STEP_MOVE | EBSDB_CURSOR_STEP_FETCH,
-                                                EBSDB_CURSOR_ORIGIN_END,
-                                                -5,
-                                                &results, &error) < 0)
+       if (e_book_sqlite_cursor_step (((EbSqlFixture *) fixture)->ebsql,
+                                      fixture->cursor,
+                                      EBSQL_CURSOR_STEP_MOVE | EBSQL_CURSOR_STEP_FETCH,
+                                      EBSQL_CURSOR_ORIGIN_END,
+                                      -5,
+                                      &results, NULL, &error) < 0)
                g_error ("Error fetching cursor results: %s", error->message);
 
        g_assert_cmpint (g_slist_length (results), ==, 5);
-       g_slist_foreach (results, (GFunc)e_book_backend_sqlitedb_search_data_free, NULL);
+       g_slist_foreach (results, (GFunc)e_book_sqlite_search_data_free, NULL);
        g_slist_free (results);
        results = NULL;
 
        /* Check new position */
-       if (!e_book_backend_sqlitedb_cursor_calculate (((ESqliteDBFixture *) fixture)->ebsdb,
-                                                      fixture->cursor, &total, &position, &error))
-           g_error ("Error calculating cursor: %s", error->message);
+       if (!e_book_sqlite_cursor_calculate (((EbSqlFixture *) fixture)->ebsql,
+                                            fixture->cursor, &total, &position, NULL, &error))
+               g_error ("Error calculating cursor: %s", error->message);
 
        /* results 13 - 5 = position 9 (results[13, 12, 11, 10, 9]) */
        g_assert_cmpint (position, ==, 9);
@@ -347,7 +348,7 @@ test_cursor_calculate_filtered_move_backwards (EbSdbCursorFixture *fixture,
 }
 
 static void
-test_cursor_calculate_filtered_partial_target (EbSdbCursorFixture *fixture,
+test_cursor_calculate_filtered_partial_target (EbSqlCursorFixture *fixture,
                                               gconstpointer  user_data)
 {
        GError *error = NULL;
@@ -357,18 +358,18 @@ test_cursor_calculate_filtered_partial_target (EbSdbCursorFixture *fixture,
        const gchar *const *labels;
 
        /* First verify our test... in en_US locale the label 'C' should exist with the index 3 */
-       collator = e_book_backend_sqlitedb_ref_collator (((ESqliteDBFixture *) fixture)->ebsdb);
+       collator = e_book_sqlite_ref_collator (((EbSqlFixture *) fixture)->ebsql);
        labels = e_collator_get_index_labels (collator, &n_labels, NULL, NULL, NULL);
        g_assert_cmpstr (labels[3], ==, "C");
        e_collator_unref (collator);
 
        /* Set the cursor at the start of family names beginning with 'C' */
-       e_book_backend_sqlitedb_cursor_set_target_alphabetic_index (((ESqliteDBFixture *) fixture)->ebsdb,
-                                                                   fixture->cursor, 3);
+       e_book_sqlite_cursor_set_target_alphabetic_index (((EbSqlFixture *) fixture)->ebsql,
+                                                         fixture->cursor, 3);
 
        /* Check new position */
-       if (!e_book_backend_sqlitedb_cursor_calculate (((ESqliteDBFixture *) fixture)->ebsdb,
-                                                      fixture->cursor, &total, &position, &error))
+       if (!e_book_sqlite_cursor_calculate (((EbSqlFixture *) fixture)->ebsql,
+                                            fixture->cursor, &total, &position, NULL, &error))
                g_error ("Error calculating cursor: %s", error->message);
 
        /* There are 9 contacts before the letter 'C' in the en_US locale */
@@ -377,38 +378,41 @@ test_cursor_calculate_filtered_partial_target (EbSdbCursorFixture *fixture,
 }
 
 static void
-test_cursor_calculate_filtered_after_modification (EbSdbCursorFixture *fixture,
+test_cursor_calculate_filtered_after_modification (EbSqlCursorFixture *fixture,
                                                   gconstpointer  user_data)
 {
-       EBookClient  *book_client;
        GError *error = NULL;
        gint    position = 0, total = 0;
 
-       book_client = E_TEST_SERVER_UTILS_SERVICE (fixture, EBookClient);
-
        /* Set the cursor to point exactly 'blackbird' (which is the 8th contact when filtered) */
-       if (e_book_backend_sqlitedb_cursor_step (((ESqliteDBFixture *) fixture)->ebsdb,
-                                                fixture->cursor,
-                                                EBSDB_CURSOR_STEP_MOVE,
-                                                EBSDB_CURSOR_ORIGIN_BEGIN,
-                                                8, NULL, &error) < 0)
+       if (e_book_sqlite_cursor_step (((EbSqlFixture *) fixture)->ebsql,
+                                      fixture->cursor,
+                                      EBSQL_CURSOR_STEP_MOVE,
+                                      EBSQL_CURSOR_ORIGIN_BEGIN,
+                                      8, NULL, NULL, &error) < 0)
                g_error ("Error fetching cursor results: %s", error->message);
 
        /* 'blackbirds' -> Jacob Appelbaum */
        e_contact_set (fixture->contacts[18 - 1], E_CONTACT_FAMILY_NAME, "Appelbaum");
        e_contact_set (fixture->contacts[18 - 1], E_CONTACT_GIVEN_NAME, "Jacob");
-       if (!e_book_client_modify_contact_sync (book_client, fixture->contacts[18 - 1], NULL, &error))
-               g_error ("modify contact sync: %s", error->message);
+       if (!e_book_sqlite_add_contact (((EbSqlFixture *) fixture)->ebsql,
+                                       fixture->contacts[18 - 1],
+                                       e_contact_get_const (fixture->contacts[18 - 1], E_CONTACT_UID),
+                                       TRUE, NULL, &error))
+               g_error ("Failed to modify contact: %s", error->message);
 
        /* 'black-birds' -> Sade Adu */
        e_contact_set (fixture->contacts[17 - 1], E_CONTACT_FAMILY_NAME, "Adu");
        e_contact_set (fixture->contacts[17 - 1], E_CONTACT_GIVEN_NAME, "Sade");
-       if (!e_book_client_modify_contact_sync (book_client, fixture->contacts[17 - 1], NULL, &error))
-               g_error ("modify contact sync: %s", error->message);
+       if (!e_book_sqlite_add_contact (((EbSqlFixture *) fixture)->ebsql,
+                                       fixture->contacts[17 - 1],
+                                       e_contact_get_const (fixture->contacts[17 - 1], E_CONTACT_UID),
+                                       TRUE, NULL, &error))
+               g_error ("Failed to modify contact: %s", error->message);
 
        /* Check new position */
-       if (!e_book_backend_sqlitedb_cursor_calculate (((ESqliteDBFixture *) fixture)->ebsdb,
-                                                      fixture->cursor, &total, &position, &error))
+       if (!e_book_sqlite_cursor_calculate (((EbSqlFixture *) fixture)->ebsql,
+                                            fixture->cursor, &total, &position, NULL, &error))
                g_error ("Error calculating cursor: %s", error->message);
 
        /* blackbird is now at position 11 after moving 2 later contacts to begin with 'A' */
@@ -417,7 +421,7 @@ test_cursor_calculate_filtered_after_modification (EbSdbCursorFixture *fixture,
 }
 
 static void
-test_cursor_calculate_descending_move_forward (EbSdbCursorFixture *fixture,
+test_cursor_calculate_descending_move_forward (EbSqlCursorFixture *fixture,
                                               gconstpointer  user_data)
 {
        GSList *results = NULL;
@@ -425,12 +429,12 @@ test_cursor_calculate_descending_move_forward (EbSdbCursorFixture *fixture,
        gint    position = 0, total = 0;
 
        /* Move cursor */
-       if (e_book_backend_sqlitedb_cursor_step (((ESqliteDBFixture *) fixture)->ebsdb,
-                                                fixture->cursor,
-                                                EBSDB_CURSOR_STEP_MOVE | EBSDB_CURSOR_STEP_FETCH,
-                                                EBSDB_CURSOR_ORIGIN_BEGIN,
-                                                5,
-                                                &results, &error) < 0)
+       if (e_book_sqlite_cursor_step (((EbSqlFixture *) fixture)->ebsql,
+                                      fixture->cursor,
+                                      EBSQL_CURSOR_STEP_MOVE | EBSQL_CURSOR_STEP_FETCH,
+                                      EBSQL_CURSOR_ORIGIN_BEGIN,
+                                      5,
+                                      &results, NULL, &error) < 0)
                g_error ("Error fetching cursor results: %s", error->message);
 
        /* Assert the first 5 contacts in en_US order */
@@ -442,13 +446,13 @@ test_cursor_calculate_descending_move_forward (EbSdbCursorFixture *fixture,
                               "sorted-13",
                               "sorted-12",
                               NULL);
-       g_slist_foreach (results, (GFunc)e_book_backend_sqlitedb_search_data_free, NULL);
+       g_slist_foreach (results, (GFunc)e_book_sqlite_search_data_free, NULL);
        g_slist_free (results);
        results = NULL;
 
        /* Check new position */
-       if (!e_book_backend_sqlitedb_cursor_calculate (((ESqliteDBFixture *) fixture)->ebsdb,
-                                                      fixture->cursor, &total, &position, &error))
+       if (!e_book_sqlite_cursor_calculate (((EbSqlFixture *) fixture)->ebsql,
+                                            fixture->cursor, &total, &position, NULL, &error))
            g_error ("Error calculating cursor: %s", error->message);
 
        /* results 0 + 5 = position 5, result index 4 (results[0, 1, 2, 3, 4]) */
@@ -457,7 +461,7 @@ test_cursor_calculate_descending_move_forward (EbSdbCursorFixture *fixture,
 }
 
 static void
-test_cursor_calculate_descending_move_backwards (EbSdbCursorFixture *fixture,
+test_cursor_calculate_descending_move_backwards (EbSqlCursorFixture *fixture,
                                                 gconstpointer  user_data)
 {
        GSList *results = NULL;
@@ -465,11 +469,11 @@ test_cursor_calculate_descending_move_backwards (EbSdbCursorFixture *fixture,
        gint    position = 0, total = 0;
 
        /* Move cursor */
-       if (e_book_backend_sqlitedb_cursor_step (((ESqliteDBFixture *) fixture)->ebsdb,
-                                                fixture->cursor,
-                                                EBSDB_CURSOR_STEP_MOVE | EBSDB_CURSOR_STEP_FETCH,      
-                                                EBSDB_CURSOR_ORIGIN_END,
-                                                -5, &results, &error) < 0)
+       if (e_book_sqlite_cursor_step (((EbSqlFixture *) fixture)->ebsql,
+                                      fixture->cursor,
+                                      EBSQL_CURSOR_STEP_MOVE | EBSQL_CURSOR_STEP_FETCH,        
+                                      EBSQL_CURSOR_ORIGIN_END,
+                                      -5, &results, NULL, &error) < 0)
                g_error ("Error fetching cursor results: %s", error->message);
 
        /* Assert the last 5 contacts in en_US order */
@@ -481,13 +485,13 @@ test_cursor_calculate_descending_move_backwards (EbSdbCursorFixture *fixture,
                               "sorted-5",
                               "sorted-6",
                               NULL);
-       g_slist_foreach (results, (GFunc)e_book_backend_sqlitedb_search_data_free, NULL);
+       g_slist_foreach (results, (GFunc)e_book_sqlite_search_data_free, NULL);
        g_slist_free (results);
        results = NULL;
 
        /* Check new position */
-       if (!e_book_backend_sqlitedb_cursor_calculate (((ESqliteDBFixture *) fixture)->ebsdb,
-                                                      fixture->cursor, &total, &position, &error))
+       if (!e_book_sqlite_cursor_calculate (((EbSqlFixture *) fixture)->ebsql,
+                                            fixture->cursor, &total, &position, NULL, &error))
            g_error ("Error calculating cursor: %s", error->message);
 
        /* results 20 - 5 = position 16 result index 15 (results[20, 19, 18, 17, 16]) */
@@ -496,7 +500,7 @@ test_cursor_calculate_descending_move_backwards (EbSdbCursorFixture *fixture,
 }
 
 static void
-test_cursor_calculate_descending_partial_target (EbSdbCursorFixture *fixture,
+test_cursor_calculate_descending_partial_target (EbSqlCursorFixture *fixture,
                                                 gconstpointer  user_data)
 {
        GError *error = NULL;
@@ -506,18 +510,18 @@ test_cursor_calculate_descending_partial_target (EbSdbCursorFixture *fixture,
        const gchar *const *labels;
 
        /* First verify our test... in en_US locale the label 'C' should exist with the index 3 */
-       collator = e_book_backend_sqlitedb_ref_collator (((ESqliteDBFixture *) fixture)->ebsdb);
+       collator = e_book_sqlite_ref_collator (((EbSqlFixture *) fixture)->ebsql);
        labels = e_collator_get_index_labels (collator, &n_labels, NULL, NULL, NULL);
        g_assert_cmpstr (labels[3], ==, "C");
        e_collator_unref (collator);
 
        /* Set the cursor at the start of family names beginning with 'C' */
-       e_book_backend_sqlitedb_cursor_set_target_alphabetic_index (((ESqliteDBFixture *) fixture)->ebsdb,
-                                                                   fixture->cursor, 3);
+       e_book_sqlite_cursor_set_target_alphabetic_index (((EbSqlFixture *) fixture)->ebsql,
+                                                         fixture->cursor, 3);
 
        /* Check new position */
-       if (!e_book_backend_sqlitedb_cursor_calculate (((ESqliteDBFixture *) fixture)->ebsdb,
-                                                      fixture->cursor, &total, &position, &error))
+       if (!e_book_sqlite_cursor_calculate (((EbSqlFixture *) fixture)->ebsql,
+                                            fixture->cursor, &total, &position, NULL, &error))
                g_error ("Error calculating cursor: %s", error->message);
 
        /* Position is 7, there are 7 contacts leading up to the last 'C' in en_US locale
@@ -527,26 +531,23 @@ test_cursor_calculate_descending_partial_target (EbSdbCursorFixture *fixture,
 }
 
 static void
-test_cursor_calculate_descending_after_modification (EbSdbCursorFixture *fixture,
+test_cursor_calculate_descending_after_modification (EbSqlCursorFixture *fixture,
                                                     gconstpointer  user_data)
 {
-       EBookClient  *book_client;
        GError *error = NULL;
        gint    position = 0, total = 0;
 
-       book_client = E_TEST_SERVER_UTILS_SERVICE (fixture, EBookClient);
-
        /* Set the cursor to point exactly 'Bät' (which is the 12th contact in descending order) */
-       if (e_book_backend_sqlitedb_cursor_step (((ESqliteDBFixture *) fixture)->ebsdb,
-                                                fixture->cursor,
-                                                EBSDB_CURSOR_STEP_MOVE,
-                                                EBSDB_CURSOR_ORIGIN_BEGIN,
-                                                12, NULL, &error) < 0)
+       if (e_book_sqlite_cursor_step (((EbSqlFixture *) fixture)->ebsql,
+                                      fixture->cursor,
+                                      EBSQL_CURSOR_STEP_MOVE,
+                                      EBSQL_CURSOR_ORIGIN_BEGIN,
+                                      12, NULL, NULL, &error) < 0)
                g_error ("Error fetching cursor results: %s", error->message);
 
        /* Check new position */
-       if (!e_book_backend_sqlitedb_cursor_calculate (((ESqliteDBFixture *) fixture)->ebsdb,
-                                                      fixture->cursor, &total, &position, &error))
+       if (!e_book_sqlite_cursor_calculate (((EbSqlFixture *) fixture)->ebsql,
+                                            fixture->cursor, &total, &position, NULL, &error))
                g_error ("Error calculating cursor: %s", error->message);
 
        /* 'Bät' is at position 12 in en_US locale (descending order) */
@@ -556,18 +557,24 @@ test_cursor_calculate_descending_after_modification (EbSdbCursorFixture *fixture
        /* Rename Muffler -> Jacob Appelbaum */
        e_contact_set (fixture->contacts[19 - 1], E_CONTACT_FAMILY_NAME, "Appelbaum");
        e_contact_set (fixture->contacts[19 - 1], E_CONTACT_GIVEN_NAME, "Jacob");
-       if (!e_book_client_modify_contact_sync (book_client, fixture->contacts[19 - 1], NULL, &error))
-               g_error ("modify contact sync: %s", error->message);
+       if (!e_book_sqlite_add_contact (((EbSqlFixture *) fixture)->ebsql,
+                                       fixture->contacts[19 - 1],
+                                       e_contact_get_const (fixture->contacts[19 - 1], E_CONTACT_UID),
+                                       TRUE, NULL, &error))
+               g_error ("Failed to modify contact: %s", error->message);
 
        /* Rename Müller -> Sade Adu */
        e_contact_set (fixture->contacts[20 - 1], E_CONTACT_FAMILY_NAME, "Adu");
        e_contact_set (fixture->contacts[20 - 1], E_CONTACT_GIVEN_NAME, "Sade");
-       if (!e_book_client_modify_contact_sync (book_client, fixture->contacts[20 - 1], NULL, &error))
-               g_error ("modify contact sync: %s", error->message);
+       if (!e_book_sqlite_add_contact (((EbSqlFixture *) fixture)->ebsql,
+                                       fixture->contacts[20 - 1],
+                                       e_contact_get_const (fixture->contacts[20 - 1], E_CONTACT_UID),
+                                       TRUE, NULL, &error))
+               g_error ("Failed to modify contact: %s", error->message);
 
        /* Check new position */
-       if (!e_book_backend_sqlitedb_cursor_calculate (((ESqliteDBFixture *) fixture)->ebsdb,
-                                                      fixture->cursor, &total, &position, &error))
+       if (!e_book_sqlite_cursor_calculate (((EbSqlFixture *) fixture)->ebsql,
+                                            fixture->cursor, &total, &position, NULL, &error))
                g_error ("Error calculating cursor: %s", error->message);
 
        /* 'Bät' is now at position 10 in descending order after moving 2 contacts to begin with 'A' */
@@ -584,76 +591,76 @@ main (gint argc,
 #endif
        g_test_init (&argc, &argv, NULL);
 
-       g_test_add ("/EbSdbCursor/Calculate/Initial", EbSdbCursorFixture, &ascending_closure,
-                   e_sqlitedb_cursor_fixture_setup,
+       g_test_add ("/EbSqlCursor/Calculate/Initial", EbSqlCursorFixture, &ascending_closure,
+                   e_sqlite_cursor_fixture_setup,
                    test_cursor_calculate_initial,
-                   e_sqlitedb_cursor_fixture_teardown);
-       g_test_add ("/EbSdbCursor/Calculate/MoveForward", EbSdbCursorFixture, &ascending_closure,
-                   e_sqlitedb_cursor_fixture_setup,
+                   e_sqlite_cursor_fixture_teardown);
+       g_test_add ("/EbSqlCursor/Calculate/MoveForward", EbSqlCursorFixture, &ascending_closure,
+                   e_sqlite_cursor_fixture_setup,
                    test_cursor_calculate_move_forward,
-                   e_sqlitedb_cursor_fixture_teardown);
-       g_test_add ("/EbSdbCursor/Calculate/MoveBackwards", EbSdbCursorFixture, &ascending_closure,
-                   e_sqlitedb_cursor_fixture_setup,
+                   e_sqlite_cursor_fixture_teardown);
+       g_test_add ("/EbSqlCursor/Calculate/MoveBackwards", EbSqlCursorFixture, &ascending_closure,
+                   e_sqlite_cursor_fixture_setup,
                    test_cursor_calculate_move_backwards,
-                   e_sqlitedb_cursor_fixture_teardown);
-       g_test_add ("/EbSdbCursor/Calculate/BackAndForth", EbSdbCursorFixture, &ascending_closure,
-                   e_sqlitedb_cursor_fixture_setup,
+                   e_sqlite_cursor_fixture_teardown);
+       g_test_add ("/EbSqlCursor/Calculate/BackAndForth", EbSqlCursorFixture, &ascending_closure,
+                   e_sqlite_cursor_fixture_setup,
                    test_cursor_calculate_back_and_forth,
-                   e_sqlitedb_cursor_fixture_teardown);
-       g_test_add ("/EbSdbCursor/Calculate/AlphabeticTarget", EbSdbCursorFixture, &ascending_closure,
-                   e_sqlitedb_cursor_fixture_setup,
+                   e_sqlite_cursor_fixture_teardown);
+       g_test_add ("/EbSqlCursor/Calculate/AlphabeticTarget", EbSqlCursorFixture, &ascending_closure,
+                   e_sqlite_cursor_fixture_setup,
                    test_cursor_calculate_partial_target,
-                   e_sqlitedb_cursor_fixture_teardown);
-       g_test_add ("/EbSdbCursor/Calculate/AfterModification", EbSdbCursorFixture, &ascending_closure,
-                   e_sqlitedb_cursor_fixture_setup,
+                   e_sqlite_cursor_fixture_teardown);
+       g_test_add ("/EbSqlCursor/Calculate/AfterModification", EbSqlCursorFixture, &ascending_closure,
+                   e_sqlite_cursor_fixture_setup,
                    test_cursor_calculate_after_modification,
-                   e_sqlitedb_cursor_fixture_teardown);
+                   e_sqlite_cursor_fixture_teardown);
 
-       g_test_add ("/EbSdbCursor/Calculate/Filtered/Initial", EbSdbCursorFixture, &ascending_closure,
-                   e_sqlitedb_cursor_fixture_filtered_setup,
+       g_test_add ("/EbSqlCursor/Calculate/Filtered/Initial", EbSqlCursorFixture, &ascending_closure,
+                   e_sqlite_cursor_fixture_filtered_setup,
                    test_cursor_calculate_filtered_initial,
-                   e_sqlitedb_cursor_fixture_teardown);
-       g_test_add ("/EbSdbCursor/Calculate/Filtered/MoveForward", EbSdbCursorFixture, &ascending_closure,
-                   e_sqlitedb_cursor_fixture_filtered_setup,
+                   e_sqlite_cursor_fixture_teardown);
+       g_test_add ("/EbSqlCursor/Calculate/Filtered/MoveForward", EbSqlCursorFixture, &ascending_closure,
+                   e_sqlite_cursor_fixture_filtered_setup,
                    test_cursor_calculate_filtered_move_forward,
-                   e_sqlitedb_cursor_fixture_teardown);
-       g_test_add ("/EbSdbCursor/Calculate/Filtered/MoveBackwards", EbSdbCursorFixture, &ascending_closure,
-                   e_sqlitedb_cursor_fixture_filtered_setup,
+                   e_sqlite_cursor_fixture_teardown);
+       g_test_add ("/EbSqlCursor/Calculate/Filtered/MoveBackwards", EbSqlCursorFixture, &ascending_closure,
+                   e_sqlite_cursor_fixture_filtered_setup,
                    test_cursor_calculate_filtered_move_backwards,
-                   e_sqlitedb_cursor_fixture_teardown);
-       g_test_add ("/EbSdbCursor/Calculate/Filtered/AlphabeticTarget", EbSdbCursorFixture, 
&ascending_closure,
-                   e_sqlitedb_cursor_fixture_filtered_setup,
+                   e_sqlite_cursor_fixture_teardown);
+       g_test_add ("/EbSqlCursor/Calculate/Filtered/AlphabeticTarget", EbSqlCursorFixture, 
&ascending_closure,
+                   e_sqlite_cursor_fixture_filtered_setup,
                    test_cursor_calculate_filtered_partial_target,
-                   e_sqlitedb_cursor_fixture_teardown);
-       g_test_add ("/EbSdbCursor/Calculate/Filtered/AfterModification", EbSdbCursorFixture, 
&ascending_closure,
-                   e_sqlitedb_cursor_fixture_filtered_setup,
+                   e_sqlite_cursor_fixture_teardown);
+       g_test_add ("/EbSqlCursor/Calculate/Filtered/AfterModification", EbSqlCursorFixture, 
&ascending_closure,
+                   e_sqlite_cursor_fixture_filtered_setup,
                    test_cursor_calculate_filtered_after_modification,
-                   e_sqlitedb_cursor_fixture_teardown);
+                   e_sqlite_cursor_fixture_teardown);
 
-       g_test_add ("/EbSdbCursor/Calculate/Descending/Initial", EbSdbCursorFixture, &descending_closure,
-                   e_sqlitedb_cursor_fixture_setup,
+       g_test_add ("/EbSqlCursor/Calculate/Descending/Initial", EbSqlCursorFixture, &descending_closure,
+                   e_sqlite_cursor_fixture_setup,
                    test_cursor_calculate_initial,
-                   e_sqlitedb_cursor_fixture_teardown);
-       g_test_add ("/EbSdbCursor/Calculate/Descending/MoveForward", EbSdbCursorFixture, &descending_closure,
-                   e_sqlitedb_cursor_fixture_setup,
+                   e_sqlite_cursor_fixture_teardown);
+       g_test_add ("/EbSqlCursor/Calculate/Descending/MoveForward", EbSqlCursorFixture, &descending_closure,
+                   e_sqlite_cursor_fixture_setup,
                    test_cursor_calculate_descending_move_forward,
-                   e_sqlitedb_cursor_fixture_teardown);
-       g_test_add ("/EbSdbCursor/Calculate/Descending/MoveBackwards", EbSdbCursorFixture, 
&descending_closure,
-                   e_sqlitedb_cursor_fixture_setup,
+                   e_sqlite_cursor_fixture_teardown);
+       g_test_add ("/EbSqlCursor/Calculate/Descending/MoveBackwards", EbSqlCursorFixture, 
&descending_closure,
+                   e_sqlite_cursor_fixture_setup,
                    test_cursor_calculate_descending_move_backwards,
-                   e_sqlitedb_cursor_fixture_teardown);
-       g_test_add ("/EbSdbCursor/Calculate/Descending/BackAndForth", EbSdbCursorFixture, &descending_closure,
-                   e_sqlitedb_cursor_fixture_setup,
+                   e_sqlite_cursor_fixture_teardown);
+       g_test_add ("/EbSqlCursor/Calculate/Descending/BackAndForth", EbSqlCursorFixture, &descending_closure,
+                   e_sqlite_cursor_fixture_setup,
                    test_cursor_calculate_back_and_forth,
-                   e_sqlitedb_cursor_fixture_teardown);
-       g_test_add ("/EbSdbCursor/Calculate/Descending/AlphabeticTarget", EbSdbCursorFixture, 
&descending_closure,
-                   e_sqlitedb_cursor_fixture_setup,
+                   e_sqlite_cursor_fixture_teardown);
+       g_test_add ("/EbSqlCursor/Calculate/Descending/AlphabeticTarget", EbSqlCursorFixture, 
&descending_closure,
+                   e_sqlite_cursor_fixture_setup,
                    test_cursor_calculate_descending_partial_target,
-                   e_sqlitedb_cursor_fixture_teardown);
-       g_test_add ("/EbSdbCursor/Calculate/Descending/AfterModification", EbSdbCursorFixture, 
&descending_closure,
-                   e_sqlitedb_cursor_fixture_setup,
+                   e_sqlite_cursor_fixture_teardown);
+       g_test_add ("/EbSqlCursor/Calculate/Descending/AfterModification", EbSqlCursorFixture, 
&descending_closure,
+                   e_sqlite_cursor_fixture_setup,
                    test_cursor_calculate_descending_after_modification,
-                   e_sqlitedb_cursor_fixture_teardown);
+                   e_sqlite_cursor_fixture_teardown);
 
-       return e_test_server_utils_run ();
+       return g_test_run ();
 }
diff --git a/tests/libedata-book/test-sqlite-cursor-change-locale.c 
b/tests/libedata-book/test-sqlite-cursor-change-locale.c
index ba23074..6f74609 100644
--- a/tests/libedata-book/test-sqlite-cursor-change-locale.c
+++ b/tests/libedata-book/test-sqlite-cursor-change-locale.c
@@ -6,47 +6,83 @@
 
 #include "data-test-utils.h"
 
+struct {
+       gboolean empty_book;
+       gboolean store_vcards;
+       const gchar *path;
+} params[] = {
+       { FALSE, TRUE,  "/EbSdbCursor/DefaultSummary/StoreVCards" },
+       { FALSE, FALSE, "/EbSdbCursor/DefaultSummary/NoVCards" },
+       { FALSE, TRUE,  "/EbSdbCursor/EmptySummary/StoreVCards" },
+       { FALSE, FALSE, "/EbSdbCursor/EmptySummary/NoVCards" }
+};
+
 gint
 main (gint argc,
       gchar **argv)
 {
        StepData *data;
+       gint i;
 
 #if !GLIB_CHECK_VERSION (2, 35, 1)
        g_type_init ();
 #endif
        g_test_init (&argc, &argv, NULL);
 
-       g_assert (g_setenv ("MIGRATION_TEST_SOURCE_NAME", "migration-test-source", TRUE));
-
-       data = step_test_new ("/EbSdbCursor/ChangeLocale/POSIX", "POSIX");
-       step_test_add_assertion (data, 5, 11, 2,  6,  3,  8);
-       step_test_add_assertion (data, 5, 1,  5,  4,  7,  15);
-       step_test_add_assertion (data, 5, 17, 16, 18, 10, 14);
-       step_test_add_assertion (data, 5, 12, 13, 9,  19, 20);
-       step_test_add (data, FALSE);
-
-       data = step_test_new ("/EbSdbCursor/ChangeLocale/en_US", "en_US.UTF-8");
-       step_test_add_assertion (data, 5, 11, 1,  2,  5,  6);
-       step_test_add_assertion (data, 5, 4,  3,  7,  8,  15);
-       step_test_add_assertion (data, 5, 17, 16, 18, 10, 14);
-       step_test_add_assertion (data, 5, 12, 13, 9,  19, 20);
-       step_test_add (data, FALSE);
-
-       data = step_test_new ("/EbSdbCursor/ChangeLocale/fr_CA", "fr_CA.UTF-8");
-       step_test_add_assertion (data, 5, 11, 1,  2,  5,  6);
-       step_test_add_assertion (data, 5, 4,  3,  7,  8,  15);
-       step_test_add_assertion (data, 5, 17, 16, 18, 10, 14);
-       step_test_add_assertion (data, 5, 13, 12, 9,  19, 20);
-       step_test_add (data, FALSE);
-
-       data = step_test_new ("/EbSdbCursor/ChangeLocale/de_DE", "de_DE.UTF-8");
-       step_test_add_assertion (data, 5, 11, 1,  2,  5,  6);
-       step_test_add_assertion (data, 5, 7,  8,  4,  3,  15);
-       step_test_add_assertion (data, 5, 17, 16, 18, 10, 14);
-       step_test_add_assertion (data, 5, 12, 13, 9,  20, 19);
-       step_test_add (data, FALSE);
+       for (i = 0; i < G_N_ELEMENTS (params); i++) {
+
+               data = step_test_new (params[i].path, "/ChangeLocale/POSIX/en_US", "POSIX",
+                                     params[i].store_vcards, params[i].empty_book);
+               step_test_add_assertion (data, 5, 11, 2,  6,  3,  8);
+               step_test_add_assertion (data, 5, 1,  5,  4,  7,  15);
+               step_test_add_assertion (data, 5, 17, 16, 18, 10, 14);
+               step_test_add_assertion (data, 5, 12, 13, 9,  19, 20);
+
+               step_test_change_locale (data, "en_US.UTF-8", 0);
+               step_test_add_assertion (data, 5, 11, 1,  2,  5,  6);
+               step_test_add_assertion (data, 5, 4,  3,  7,  8,  15);
+               step_test_add_assertion (data, 5, 17, 16, 18, 10, 14);
+               step_test_add_assertion (data, 5, 12, 13, 9,  19, 20);
+               step_test_add (data, FALSE);
+
+               data = step_test_new (params[i].path, "/ChangeLocale/en_US/fr_CA", "en_US.UTF-8",
+                                     params[i].store_vcards, params[i].empty_book);
+               step_test_add_assertion (data, 5, 11, 1,  2,  5,  6);
+               step_test_add_assertion (data, 5, 4,  3,  7,  8,  15);
+               step_test_add_assertion (data, 5, 17, 16, 18, 10, 14);
+               step_test_add_assertion (data, 5, 12, 13, 9,  19, 20);
+
+               step_test_change_locale (data, "fr_CA.UTF-8", 0);
+               step_test_add_assertion (data, 5, 11, 1,  2,  5,  6);
+               step_test_add_assertion (data, 5, 4,  3,  7,  8,  15);
+               step_test_add_assertion (data, 5, 17, 16, 18, 10, 14);
+               step_test_add_assertion (data, 5, 13, 12, 9,  19, 20);
+               step_test_add (data, FALSE);
+
+               data = step_test_new (params[i].path, "/ChangeLocale/fr_CA/de_DE", "fr_CA.UTF-8",
+                                     params[i].store_vcards, params[i].empty_book);
+               step_test_add_assertion (data, 5, 11, 1,  2,  5,  6);
+               step_test_add_assertion (data, 5, 4,  3,  7,  8,  15);
+               step_test_add_assertion (data, 5, 17, 16, 18, 10, 14);
+               step_test_add_assertion (data, 5, 13, 12, 9,  19, 20);
+
+               /* When changing from fr_CA to de_DE, two numbers change:
+                *
+                * sorted-5:
+                *    049-2459-4393 is now parsed with the national number as 4924594393
+                *
+                * sorted-4:
+                *    12 245999 is now parsed with national number 12245999 instead of 2245999
+                *
+                */
+               step_test_change_locale (data, "de_DE.UTF-8", 2);
+               step_test_add_assertion (data, 5, 11, 1,  2,  5,  6);
+               step_test_add_assertion (data, 5, 7,  8,  4,  3,  15);
+               step_test_add_assertion (data, 5, 17, 16, 18, 10, 14);
+               step_test_add_assertion (data, 5, 12, 13, 9,  20, 19);
+               step_test_add (data, FALSE);
+       }
 
        /* On this case, we want to delete the work directory and start afresh */
-       return e_test_server_utils_run ();
+       return g_test_run ();
 }
diff --git a/tests/libedata-book/test-sqlite-cursor-move-by-de-DE.c 
b/tests/libedata-book/test-sqlite-cursor-move-by-de-DE.c
index e1e6a98..78a598b 100644
--- a/tests/libedata-book/test-sqlite-cursor-move-by-de-DE.c
+++ b/tests/libedata-book/test-sqlite-cursor-move-by-de-DE.c
@@ -6,41 +6,61 @@
 
 #include "data-test-utils.h"
 
+struct {
+       gboolean empty_book;
+       gboolean store_vcards;
+       const gchar *path;
+} params[] = {
+       { FALSE, TRUE,  "/EbSdbCursor/DefaultSummary/StoreVCards" },
+       { FALSE, FALSE, "/EbSdbCursor/DefaultSummary/NoVCards" },
+       { FALSE, TRUE,  "/EbSdbCursor/EmptySummary/StoreVCards" },
+       { FALSE, FALSE, "/EbSdbCursor/EmptySummary/NoVCards" }
+};
+
 gint
 main (gint argc,
       gchar **argv)
 {
        StepData *data;
+       gint i;
 
 #if !GLIB_CHECK_VERSION (2, 35, 1)
        g_type_init ();
 #endif
        g_test_init (&argc, &argv, NULL);
 
-       data = step_test_new ("/EbSdbCursor/de_DE/Move/Forward", "de_DE.UTF-8");
-       step_test_add_assertion (data, 5, 11, 1, 2, 5, 6);
-       step_test_add_assertion (data, 6, 7, 8, 4, 3, 15, 17);
-       step_test_add (data, FALSE);
+       for (i = 0; i < G_N_ELEMENTS (params); i++) {
+
+               data = step_test_new (params[i].path, "/de_DE/Move/Forward", "de_DE.UTF-8",
+                                     params[i].store_vcards, params[i].empty_book);
+               step_test_add_assertion (data, 5, 11, 1, 2, 5, 6);
+               step_test_add_assertion (data, 6, 7, 8, 4, 3, 15, 17);
+               step_test_add (data, FALSE);
 
-       data = step_test_new ("/EbSdbCursor/de_DE/Move/ForwardOnNameless", "de_DE.UTF-8");
-       step_test_add_assertion (data, 1, 11);
-       step_test_add_assertion (data, 3, 1, 2, 5);
-       step_test_add (data, FALSE);
+               data = step_test_new (params[i].path, "/de_DE/Move/ForwardOnNameless", "de_DE.UTF-8",
+                                     params[i].store_vcards, params[i].empty_book);
+               step_test_add_assertion (data, 1, 11);
+               step_test_add_assertion (data, 3, 1, 2, 5);
+               step_test_add (data, FALSE);
 
-       data = step_test_new ("/EbSdbCursor/de_DE/Move/Backwards", "de_DE.UTF-8");
-       step_test_add_assertion (data, -5, 19, 20, 9, 13, 12);
-       step_test_add_assertion (data, -8, 14, 10, 18, 16, 17, 15, 3, 4);
-       step_test_add (data, FALSE);
+               data = step_test_new (params[i].path, "/de_DE/Move/Backwards", "de_DE.UTF-8",
+                                     params[i].store_vcards, params[i].empty_book);
+               step_test_add_assertion (data, -5, 19, 20, 9, 13, 12);
+               step_test_add_assertion (data, -8, 14, 10, 18, 16, 17, 15, 3, 4);
+               step_test_add (data, FALSE);
 
-       data = step_test_new ("/EbSdbCursor/de_DE/Filtered/Move/Forward", "de_DE.UTF-8");
-       step_test_add_assertion (data, 5, 11, 1, 2, 5, 8);
-       step_test_add_assertion (data, 8, 3, 17, 16, 18, 10, 14, 12, 9);
-       step_test_add (data, TRUE);
+               data = step_test_new (params[i].path, "/de_DE/Filtered/Move/Forward", "de_DE.UTF-8",
+                                     params[i].store_vcards, params[i].empty_book);
+               step_test_add_assertion (data, 5, 11, 1, 2, 5, 8);
+               step_test_add_assertion (data, 8, 3, 17, 16, 18, 10, 14, 12, 9);
+               step_test_add (data, TRUE);
 
-       data = step_test_new ("/EbSdbCursor/de_DE/Filtered/Move/Backwards", "de_DE.UTF-8");
-       step_test_add_assertion (data, -5, 9, 12, 14, 10, 18);
-       step_test_add_assertion (data, -8, 16, 17, 3, 8, 5, 2, 1, 11);
-       step_test_add (data, TRUE);
+               data = step_test_new (params[i].path, "/de_DE/Filtered/Move/Backwards", "de_DE.UTF-8",
+                                     params[i].store_vcards, params[i].empty_book);
+               step_test_add_assertion (data, -5, 9, 12, 14, 10, 18);
+               step_test_add_assertion (data, -8, 16, 17, 3, 8, 5, 2, 1, 11);
+               step_test_add (data, TRUE);
+       }
 
-       return e_test_server_utils_run ();
+       return g_test_run ();
 }
diff --git a/tests/libedata-book/test-sqlite-cursor-move-by-en-US.c 
b/tests/libedata-book/test-sqlite-cursor-move-by-en-US.c
index 233b10d..afec8ba 100644
--- a/tests/libedata-book/test-sqlite-cursor-move-by-en-US.c
+++ b/tests/libedata-book/test-sqlite-cursor-move-by-en-US.c
@@ -6,55 +6,77 @@
 
 #include "data-test-utils.h"
 
+struct {
+       gboolean empty_book;
+       gboolean store_vcards;
+       const gchar *path;
+} params[] = {
+       { FALSE, TRUE,  "/EbSdbCursor/DefaultSummary/StoreVCards" },
+       { FALSE, FALSE, "/EbSdbCursor/DefaultSummary/NoVCards" },
+       { FALSE, TRUE,  "/EbSdbCursor/EmptySummary/StoreVCards" },
+       { FALSE, FALSE, "/EbSdbCursor/EmptySummary/NoVCards" }
+};
+
 gint
 main (gint argc,
       gchar **argv)
 {
        StepData *data;
+       gint i;
 
 #if !GLIB_CHECK_VERSION (2, 35, 1)
        g_type_init ();
 #endif
        g_test_init (&argc, &argv, NULL);
 
-       data = step_test_new ("/EbSdbCursor/en_US/Move/Forward", "en_US.UTF-8");
-       step_test_add_assertion (data, 5, 11, 1, 2, 5, 6);
-       step_test_add_assertion (data, 6, 4, 3, 7, 8, 15, 17);
-       step_test_add (data, FALSE);
-
-       data = step_test_new ("/EbSdbCursor/en_US/Move/ForwardOnNameless", "en_US.UTF-8");
-       step_test_add_assertion (data, 1, 11);
-       step_test_add_assertion (data, 3, 1, 2, 5);
-       step_test_add (data, FALSE);
-
-       data = step_test_new ("/EbSdbCursor/en_US/Move/Backwards", "en_US.UTF-8");
-       step_test_add_assertion (data, -5, 20, 19, 9, 13, 12);
-       step_test_add_assertion (data, -8, 14, 10, 18, 16, 17, 15, 8, 7);
-       step_test_add (data, FALSE);
-
-       data = step_test_new ("/EbSdbCursor/en_US/Filtered/Move/Forward", "en_US.UTF-8");
-       step_test_add_assertion (data, 5, 11, 1, 2, 5, 3);
-       step_test_add_assertion (data, 8, 8, 17, 16, 18, 10, 14, 12, 9);
-       step_test_add (data, TRUE);
-
-       data = step_test_new ("/EbSdbCursor/en_US/Filtered/Move/Backwards", "en_US.UTF-8");
-       step_test_add_assertion (data, -5, 9, 12, 14, 10, 18);
-       step_test_add_assertion (data, -8, 16, 17, 8, 3, 5, 2, 1, 11);
-       step_test_add (data, TRUE);
-
-       data = step_test_new_full ("/EbSdbCursor/en_US/Move/Descending/Forward", "en_US.UTF-8",
-                                     E_BOOK_CURSOR_SORT_DESCENDING);
-       step_test_add_assertion (data, 5, 20, 19, 9,  13, 12);
-       step_test_add_assertion (data, 5, 14, 10, 18, 16, 17);
-       step_test_add_assertion (data, 5, 15, 8,  7,  3,  4);
-       step_test_add_assertion (data, 5, 6,  5,  2,  1,  11);
-       step_test_add (data, FALSE);
-
-       data = step_test_new_full ("/EbSdbCursor/en_US/Move/Descending/Backwards", "en_US.UTF-8",
-                                     E_BOOK_CURSOR_SORT_DESCENDING);
-       step_test_add_assertion (data, -10, 11, 1,  2,  5,  6,  4,  3,  7,  8, 15);
-       step_test_add_assertion (data, -10, 17, 16, 18, 10, 14, 12, 13, 9, 19, 20);
-       step_test_add (data, FALSE);
-
-       return e_test_server_utils_run ();
+       for (i = 0; i < G_N_ELEMENTS (params); i++) {
+
+               data = step_test_new (params[i].path, "/en_US/Move/Forward", "en_US.UTF-8",
+                                     params[i].store_vcards, params[i].empty_book);
+               step_test_add_assertion (data, 5, 11, 1, 2, 5, 6);
+               step_test_add_assertion (data, 6, 4, 3, 7, 8, 15, 17);
+               step_test_add (data, FALSE);
+
+               data = step_test_new (params[i].path, "/en_US/Move/ForwardOnNameless", "en_US.UTF-8",
+                                     params[i].store_vcards, params[i].empty_book);
+               step_test_add_assertion (data, 1, 11);
+               step_test_add_assertion (data, 3, 1, 2, 5);
+               step_test_add (data, FALSE);
+
+               data = step_test_new (params[i].path, "/en_US/Move/Backwards", "en_US.UTF-8",
+                                     params[i].store_vcards, params[i].empty_book);
+               step_test_add_assertion (data, -5, 20, 19, 9, 13, 12);
+               step_test_add_assertion (data, -8, 14, 10, 18, 16, 17, 15, 8, 7);
+               step_test_add (data, FALSE);
+
+               data = step_test_new (params[i].path, "/en_US/Filtered/Move/Forward", "en_US.UTF-8",
+                                     params[i].store_vcards, params[i].empty_book);
+               step_test_add_assertion (data, 5, 11, 1, 2, 5, 3);
+               step_test_add_assertion (data, 8, 8, 17, 16, 18, 10, 14, 12, 9);
+               step_test_add (data, TRUE);
+
+               data = step_test_new (params[i].path, "/en_US/Filtered/Move/Backwards", "en_US.UTF-8",
+                                     params[i].store_vcards, params[i].empty_book);
+               step_test_add_assertion (data, -5, 9, 12, 14, 10, 18);
+               step_test_add_assertion (data, -8, 16, 17, 8, 3, 5, 2, 1, 11);
+               step_test_add (data, TRUE);
+
+               data = step_test_new_full (params[i].path, "/en_US/Move/Descending/Forward", "en_US.UTF-8",
+                                          params[i].store_vcards, params[i].empty_book,
+                                          E_BOOK_CURSOR_SORT_DESCENDING);
+               step_test_add_assertion (data, 5, 20, 19, 9,  13, 12);
+               step_test_add_assertion (data, 5, 14, 10, 18, 16, 17);
+               step_test_add_assertion (data, 5, 15, 8,  7,  3,  4);
+               step_test_add_assertion (data, 5, 6,  5,  2,  1,  11);
+               step_test_add (data, FALSE);
+
+               data = step_test_new_full (params[i].path, "/en_US/Move/Descending/Backwards", "en_US.UTF-8",
+                                          params[i].store_vcards, params[i].empty_book,
+                                          E_BOOK_CURSOR_SORT_DESCENDING);
+               step_test_add_assertion (data, -10, 11, 1,  2,  5,  6,  4,  3,  7,  8, 15);
+               step_test_add_assertion (data, -10, 17, 16, 18, 10, 14, 12, 13, 9, 19, 20);
+               step_test_add (data, FALSE);
+       }
+
+       return g_test_run ();
 }
diff --git a/tests/libedata-book/test-sqlite-cursor-move-by-fr-CA.c 
b/tests/libedata-book/test-sqlite-cursor-move-by-fr-CA.c
index 6b1b1a1..3bf20d2 100644
--- a/tests/libedata-book/test-sqlite-cursor-move-by-fr-CA.c
+++ b/tests/libedata-book/test-sqlite-cursor-move-by-fr-CA.c
@@ -6,41 +6,62 @@
 
 #include "data-test-utils.h"
 
+struct {
+       gboolean empty_book;
+       gboolean store_vcards;
+       const gchar *path;
+} params[] = {
+       { FALSE, TRUE,  "/EbSdbCursor/DefaultSummary/StoreVCards" },
+       { FALSE, FALSE, "/EbSdbCursor/DefaultSummary/NoVCards" },
+       { FALSE, TRUE,  "/EbSdbCursor/EmptySummary/StoreVCards" },
+       { FALSE, FALSE, "/EbSdbCursor/EmptySummary/NoVCards" }
+};
+
 gint
 main (gint argc,
       gchar **argv)
 {
        StepData *data;
+       gint i;
 
 #if !GLIB_CHECK_VERSION (2, 35, 1)
        g_type_init ();
 #endif
        g_test_init (&argc, &argv, NULL);
 
-       data = step_test_new ("/EbSdbCursor/fr_CA/Move/Forward", "fr_CA.UTF-8");
-       step_test_add_assertion (data, 5, 11, 1, 2, 5, 6);
-       step_test_add_assertion (data, 6, 4, 3, 7, 8, 15, 17);
-       step_test_add (data, FALSE);
 
-       data = step_test_new ("/EbSdbCursor/fr_CA/Move/ForwardOnNameless", "fr_CA.UTF-8");
-       step_test_add_assertion (data, 1, 11);
-       step_test_add_assertion (data, 3, 1, 2, 5);
-       step_test_add (data, FALSE);
+       for (i = 0; i < G_N_ELEMENTS (params); i++) {
+
+               data = step_test_new (params[i].path, "/fr_CA/Move/Forward", "fr_CA.UTF-8",
+                                     params[i].store_vcards, params[i].empty_book);
+               step_test_add_assertion (data, 5, 11, 1, 2, 5, 6);
+               step_test_add_assertion (data, 6, 4, 3, 7, 8, 15, 17);
+               step_test_add (data, FALSE);
+
+               data = step_test_new (params[i].path, "/fr_CA/Move/ForwardOnNameless", "fr_CA.UTF-8",
+                                     params[i].store_vcards, params[i].empty_book);
+               step_test_add_assertion (data, 1, 11);
+               step_test_add_assertion (data, 3, 1, 2, 5);
+               step_test_add (data, FALSE);
 
-       data = step_test_new ("/EbSdbCursor/fr_CA/Move/Backwards", "fr_CA.UTF-8");
-       step_test_add_assertion (data, -5, 20, 19, 9, 12, 13);
-       step_test_add_assertion (data, -8, 14, 10, 18, 16, 17, 15, 8, 7);
-       step_test_add (data, FALSE);
+               data = step_test_new (params[i].path, "/fr_CA/Move/Backwards", "fr_CA.UTF-8",
+                                     params[i].store_vcards, params[i].empty_book);
+               step_test_add_assertion (data, -5, 20, 19, 9, 12, 13);
+               step_test_add_assertion (data, -8, 14, 10, 18, 16, 17, 15, 8, 7);
+               step_test_add (data, FALSE);
 
-       data = step_test_new ("/EbSdbCursor/fr_CA/Filtered/Move/Forward", "fr_CA.UTF-8");
-       step_test_add_assertion (data, 5, 11, 1, 2, 5, 3);
-       step_test_add_assertion (data, 8, 8, 17, 16, 18, 10, 14, 12, 9);
-       step_test_add (data, TRUE);
+               data = step_test_new (params[i].path, "/fr_CA/Filtered/Move/Forward", "fr_CA.UTF-8",
+                                     params[i].store_vcards, params[i].empty_book);
+               step_test_add_assertion (data, 5, 11, 1, 2, 5, 3);
+               step_test_add_assertion (data, 8, 8, 17, 16, 18, 10, 14, 12, 9);
+               step_test_add (data, TRUE);
 
-       data = step_test_new ("/EbSdbCursor/fr_CA/Filtered/Move/Backwards", "fr_CA.UTF-8");
-       step_test_add_assertion (data, -5, 9, 12, 14, 10, 18);
-       step_test_add_assertion (data, -8, 16, 17, 8, 3, 5, 2, 1, 11);
-       step_test_add (data, TRUE);
+               data = step_test_new (params[i].path, "/fr_CA/Filtered/Move/Backwards", "fr_CA.UTF-8",
+                                     params[i].store_vcards, params[i].empty_book);
+               step_test_add_assertion (data, -5, 9, 12, 14, 10, 18);
+               step_test_add_assertion (data, -8, 16, 17, 8, 3, 5, 2, 1, 11);
+               step_test_add (data, TRUE);
+       }
 
-       return e_test_server_utils_run ();
+       return g_test_run ();
 }
diff --git a/tests/libedata-book/test-sqlite-cursor-move-by-posix.c 
b/tests/libedata-book/test-sqlite-cursor-move-by-posix.c
index 314dad0..dc40d85 100644
--- a/tests/libedata-book/test-sqlite-cursor-move-by-posix.c
+++ b/tests/libedata-book/test-sqlite-cursor-move-by-posix.c
@@ -6,41 +6,61 @@
 
 #include "data-test-utils.h"
 
+struct {
+       gboolean empty_book;
+       gboolean store_vcards;
+       const gchar *path;
+} params[] = {
+       { FALSE, TRUE,  "/EbSdbCursor/DefaultSummary/StoreVCards" },
+       { FALSE, FALSE, "/EbSdbCursor/DefaultSummary/NoVCards" },
+       { FALSE, TRUE,  "/EbSdbCursor/EmptySummary/StoreVCards" },
+       { FALSE, FALSE, "/EbSdbCursor/EmptySummary/NoVCards" }
+};
+
 gint
 main (gint argc,
       gchar **argv)
 {
        StepData *data;
+       gint i;
 
 #if !GLIB_CHECK_VERSION (2, 35, 1)
        g_type_init ();
 #endif
        g_test_init (&argc, &argv, NULL);
 
-       data = step_test_new ("/EbSdbCursor/POSIX/Move/Forward", "POSIX");
-       step_test_add_assertion (data, 5, 11, 2, 6, 3, 8);
-       step_test_add_assertion (data, 6, 1,  5,  4,  7,  15, 17);
-       step_test_add (data, FALSE);
+       for (i = 0; i < G_N_ELEMENTS (params); i++) {
+
+               data = step_test_new (params[i].path, "/POSIX/Move/Forward", "POSIX",
+                                     params[i].store_vcards, params[i].empty_book);
+               step_test_add_assertion (data, 5, 11, 2, 6, 3, 8);
+               step_test_add_assertion (data, 6, 1,  5,  4,  7,  15, 17);
+               step_test_add (data, FALSE);
 
-       data = step_test_new ("/EbSdbCursor/POSIX/Move/ForwardOnNameless", "POSIX");
-       step_test_add_assertion (data, 1, 11);
-       step_test_add_assertion (data, 3, 2, 6, 3);
-       step_test_add (data, FALSE);
+               data = step_test_new (params[i].path, "/POSIX/Move/ForwardOnNameless", "POSIX",
+                                     params[i].store_vcards, params[i].empty_book);
+               step_test_add_assertion (data, 1, 11);
+               step_test_add_assertion (data, 3, 2, 6, 3);
+               step_test_add (data, FALSE);
 
-       data = step_test_new ("/EbSdbCursor/POSIX/Move/Backwards", "POSIX");
-       step_test_add_assertion (data, -5, 20, 19, 9, 13, 12);
-       step_test_add_assertion (data, -12, 14, 10, 18, 16, 17, 15, 7, 4, 5, 1, 8, 3);
-       step_test_add (data, FALSE);
+               data = step_test_new (params[i].path, "/POSIX/Move/Backwards", "POSIX",
+                                     params[i].store_vcards, params[i].empty_book);
+               step_test_add_assertion (data, -5, 20, 19, 9, 13, 12);
+               step_test_add_assertion (data, -12, 14, 10, 18, 16, 17, 15, 7, 4, 5, 1, 8, 3);
+               step_test_add (data, FALSE);
 
-       data = step_test_new ("/EbSdbCursor/POSIX/Filtered/Move/Forward", "POSIX");
-       step_test_add_assertion (data, 5, 11, 2, 3, 8, 1);
-       step_test_add_assertion (data, 8, 5, 17, 16, 18, 10, 14, 12, 9);
-       step_test_add (data, TRUE);
+               data = step_test_new (params[i].path, "/POSIX/Filtered/Move/Forward", "POSIX",
+                                     params[i].store_vcards, params[i].empty_book);
+               step_test_add_assertion (data, 5, 11, 2, 3, 8, 1);
+               step_test_add_assertion (data, 8, 5, 17, 16, 18, 10, 14, 12, 9);
+               step_test_add (data, TRUE);
 
-       data = step_test_new ("/EbSdbCursor/POSIX/Filtered/Move/Backwards", "POSIX");
-       step_test_add_assertion (data, -5, 9, 12, 14, 10, 18);
-       step_test_add_assertion (data, -8, 16, 17, 5, 1, 8, 3, 2, 11);
-       step_test_add (data, TRUE);
+               data = step_test_new (params[i].path, "/POSIX/Filtered/Move/Backwards", "POSIX",
+                                     params[i].store_vcards, params[i].empty_book);
+               step_test_add_assertion (data, -5, 9, 12, 14, 10, 18);
+               step_test_add_assertion (data, -8, 16, 17, 5, 1, 8, 3, 2, 11);
+               step_test_add (data, TRUE);
+       }
 
-       return e_test_server_utils_run ();
+       return g_test_run ();
 }
diff --git a/tests/libedata-book/test-sqlite-cursor-set-sexp.c 
b/tests/libedata-book/test-sqlite-cursor-set-sexp.c
index d0f3dbe..739fa76 100644
--- a/tests/libedata-book/test-sqlite-cursor-set-sexp.c
+++ b/tests/libedata-book/test-sqlite-cursor-set-sexp.c
@@ -6,30 +6,10 @@
 
 #include "data-test-utils.h"
 
-static EbSdbCursorClosure book_closure = { { E_TEST_SERVER_ADDRESS_BOOK, 
e_sqlitedb_cursor_fixture_setup_book, 0 }, FALSE };
+static EbSqlCursorClosure book_closure = { { FALSE, NULL }, NULL, E_BOOK_CURSOR_SORT_ASCENDING };
 
 static void
-test_cursor_sexp_invalid (EbSdbCursorFixture *fixture,
-                         gconstpointer  user_data)
-{
-       GError *error = NULL;
-       EBookQuery *query;
-       gchar *sexp = NULL;
-
-       query = e_book_query_field_test (E_CONTACT_NICKNAME, E_BOOK_QUERY_BEGINS_WITH, "Kung Fu");
-       sexp = e_book_query_to_string (query);
-       e_book_query_unref (query);
-
-       if (e_book_backend_sqlitedb_cursor_set_sexp (((ESqliteDBFixture *) fixture)->ebsdb,
-                                                    fixture->cursor, sexp, &error))
-               g_error ("Succeeded in setting non-summarized field in the cursor query expression");
-
-       g_assert (error);
-       g_assert (g_error_matches (error, E_BOOK_SDB_ERROR, E_BOOK_SDB_ERROR_INVALID_QUERY));
-}
-
-static void
-test_cursor_sexp_calculate_position (EbSdbCursorFixture *fixture,
+test_cursor_sexp_calculate_position (EbSqlCursorFixture *fixture,
                                     gconstpointer  user_data)
 {
        GError *error = NULL;
@@ -37,14 +17,14 @@ test_cursor_sexp_calculate_position (EbSdbCursorFixture *fixture,
        gint    position = 0, total = 0;
        gchar *sexp = NULL;
        GSList *results = NULL, *node;
-       EbSdbSearchData *data;
+       EbSqlSearchData *data;
 
        /* Set the cursor to point exactly to 'blackbirds', which is the 12th contact in en_US */
-       if (!e_book_backend_sqlitedb_cursor_step (((ESqliteDBFixture *) fixture)->ebsdb,
-                                                 fixture->cursor,
-                                                 EBSDB_CURSOR_STEP_MOVE | EBSDB_CURSOR_STEP_FETCH,
-                                                 EBSDB_CURSOR_ORIGIN_BEGIN,
-                                                 12, &results, &error))
+       if (!e_book_sqlite_cursor_step (((EbSqlFixture *) fixture)->ebsql,
+                                       fixture->cursor,
+                                       EBSQL_CURSOR_STEP_MOVE | EBSQL_CURSOR_STEP_FETCH,
+                                       EBSQL_CURSOR_ORIGIN_BEGIN,
+                                       12, &results, NULL, &error))
                g_error ("Error fetching cursor results: %s", error->message);
 
        /* Ensure we moved to the right contact */
@@ -52,12 +32,12 @@ test_cursor_sexp_calculate_position (EbSdbCursorFixture *fixture,
        g_assert (node);
        data = node->data;
        g_assert_cmpstr (data->uid, ==, "sorted-16");
-       g_slist_foreach (results, (GFunc)e_book_backend_sqlitedb_search_data_free, NULL);
+       g_slist_foreach (results, (GFunc)e_book_sqlite_search_data_free, NULL);
        g_slist_free (results);
 
        /* Check position */
-       if (!e_book_backend_sqlitedb_cursor_calculate (((ESqliteDBFixture *) fixture)->ebsdb,
-                                                      fixture->cursor, &total, &position, &error))
+       if (!e_book_sqlite_cursor_calculate (((EbSqlFixture *) fixture)->ebsql,
+                                            fixture->cursor, &total, &position, NULL, &error))
                g_error ("Error calculating cursor: %s", error->message);
 
        /* blackbird is at position 12 in an unfiltered en_US locale */
@@ -69,13 +49,13 @@ test_cursor_sexp_calculate_position (EbSdbCursorFixture *fixture,
        sexp = e_book_query_to_string (query);
        e_book_query_unref (query);
 
-       if (!e_book_backend_sqlitedb_cursor_set_sexp (((ESqliteDBFixture *) fixture)->ebsdb,
-                                                     fixture->cursor, sexp, &error))
+       if (!e_book_sqlite_cursor_set_sexp (((EbSqlFixture *) fixture)->ebsql,
+                                           fixture->cursor, sexp, &error))
                g_error ("Failed to set sexp: %s", error->message);
 
        /* Check new position after modified sexp */
-       if (!e_book_backend_sqlitedb_cursor_calculate (((ESqliteDBFixture *) fixture)->ebsdb,
-                                                      fixture->cursor, &total, &position, &error))
+       if (!e_book_sqlite_cursor_calculate (((EbSqlFixture *) fixture)->ebsql,
+                                            fixture->cursor, &total, &position, NULL, &error))
                g_error ("Error calculating cursor: %s", error->message);
 
        /* 'blackbird' is now at position 8 out of 13, with a filtered set of contacts in en_US locale */
@@ -84,30 +64,30 @@ test_cursor_sexp_calculate_position (EbSdbCursorFixture *fixture,
 }
 
 static void
-test_cursor_sexp_and_step (EbSdbCursorFixture *fixture,
+test_cursor_sexp_and_step (EbSqlCursorFixture *fixture,
                           gconstpointer  user_data)
 {
        GError *error = NULL;
        EBookQuery *query;
        gchar *sexp = NULL;
        GSList *results = NULL, *node;
-       EbSdbSearchData *data;
+       EbSqlSearchData *data;
 
        /* Set new sexp, only contacts with .com email addresses */
        query = e_book_query_field_test (E_CONTACT_EMAIL, E_BOOK_QUERY_ENDS_WITH, ".com");
        sexp = e_book_query_to_string (query);
        e_book_query_unref (query);
 
-       if (!e_book_backend_sqlitedb_cursor_set_sexp (((ESqliteDBFixture *) fixture)->ebsdb,
-                                                     fixture->cursor, sexp, &error))
+       if (!e_book_sqlite_cursor_set_sexp (((EbSqlFixture *) fixture)->ebsql,
+                                           fixture->cursor, sexp, &error))
                g_error ("Failed to set sexp: %s", error->message);
 
        /* Step 6 results from the beginning of the filtered list, gets up to contact 'sorted-8' */
-       if (!e_book_backend_sqlitedb_cursor_step (((ESqliteDBFixture *) fixture)->ebsdb,
-                                                 fixture->cursor,
-                                                 EBSDB_CURSOR_STEP_MOVE | EBSDB_CURSOR_STEP_FETCH,
-                                                 EBSDB_CURSOR_ORIGIN_BEGIN,
-                                                 6, &results, &error))
+       if (!e_book_sqlite_cursor_step (((EbSqlFixture *) fixture)->ebsql,
+                                       fixture->cursor,
+                                       EBSQL_CURSOR_STEP_MOVE | EBSQL_CURSOR_STEP_FETCH,
+                                       EBSQL_CURSOR_ORIGIN_BEGIN,
+                                       6, &results, NULL, &error))
                g_error ("Error fetching cursor results: %s", error->message);
 
        /* Ensure we moved to the right contact */
@@ -115,16 +95,16 @@ test_cursor_sexp_and_step (EbSdbCursorFixture *fixture,
        g_assert (node);
        data = node->data;
        g_assert_cmpstr (data->uid, ==, "sorted-8");
-       g_slist_foreach (results, (GFunc)e_book_backend_sqlitedb_search_data_free, NULL);
+       g_slist_foreach (results, (GFunc)e_book_sqlite_search_data_free, NULL);
        g_slist_free (results);
        results = NULL;
 
        /* Step 6 results more, gets up to contact 'sorted-12' */
-       if (!e_book_backend_sqlitedb_cursor_step (((ESqliteDBFixture *) fixture)->ebsdb,
-                                                 fixture->cursor,
-                                                 EBSDB_CURSOR_STEP_MOVE | EBSDB_CURSOR_STEP_FETCH,
-                                                 EBSDB_CURSOR_ORIGIN_CURRENT,
-                                                 6, &results, &error))
+       if (!e_book_sqlite_cursor_step (((EbSqlFixture *) fixture)->ebsql,
+                                       fixture->cursor,
+                                       EBSQL_CURSOR_STEP_MOVE | EBSQL_CURSOR_STEP_FETCH,
+                                       EBSQL_CURSOR_ORIGIN_CURRENT,
+                                       6, &results, NULL, &error))
                g_error ("Error fetching cursor results: %s", error->message);
 
        /* Ensure we moved to the right contact */
@@ -132,7 +112,7 @@ test_cursor_sexp_and_step (EbSdbCursorFixture *fixture,
        g_assert (node);
        data = node->data;
        g_assert_cmpstr (data->uid, ==, "sorted-12");
-       g_slist_foreach (results, (GFunc)e_book_backend_sqlitedb_search_data_free, NULL);
+       g_slist_foreach (results, (GFunc)e_book_sqlite_search_data_free, NULL);
        g_slist_free (results);
 }
 
@@ -145,19 +125,15 @@ main (gint argc,
 #endif
        g_test_init (&argc, &argv, NULL);
 
-       g_test_add ("/EbSdbCursor/SetSexp/Invalid", EbSdbCursorFixture, &book_closure,
-                   e_sqlitedb_cursor_fixture_setup,
-                   test_cursor_sexp_invalid,
-                   e_sqlitedb_cursor_fixture_teardown);
-       g_test_add ("/EbSdbCursor/SetSexp/CalculatePosition", EbSdbCursorFixture, &book_closure,
-                   e_sqlitedb_cursor_fixture_setup,
+       g_test_add ("/EbSqlCursor/SetSexp/CalculatePosition", EbSqlCursorFixture, &book_closure,
+                   e_sqlite_cursor_fixture_setup,
                    test_cursor_sexp_calculate_position,
-                   e_sqlitedb_cursor_fixture_teardown);
-       g_test_add ("/EbSdbCursor/SetSexp/Step", EbSdbCursorFixture, &book_closure,
-                   e_sqlitedb_cursor_fixture_setup,
+                   e_sqlite_cursor_fixture_teardown);
+       g_test_add ("/EbSqlCursor/SetSexp/Step", EbSqlCursorFixture, &book_closure,
+                   e_sqlite_cursor_fixture_setup,
                    test_cursor_sexp_and_step,
-                   e_sqlitedb_cursor_fixture_teardown);
+                   e_sqlite_cursor_fixture_teardown);
 
 
-       return e_test_server_utils_run ();
+       return g_test_run ();
 }
diff --git a/tests/libedata-book/test-sqlite-cursor-set-target.c 
b/tests/libedata-book/test-sqlite-cursor-set-target.c
index c26ed75..c2c5fbd 100644
--- a/tests/libedata-book/test-sqlite-cursor-set-target.c
+++ b/tests/libedata-book/test-sqlite-cursor-set-target.c
@@ -6,24 +6,22 @@
 
 #include "data-test-utils.h"
 
-static EbSdbCursorClosure book_closure = { { E_TEST_SERVER_ADDRESS_BOOK, 
e_sqlitedb_cursor_fixture_setup_book, 0 }, FALSE };
-
 /*****************************************************
  *          Expect the same results twice            *
  *****************************************************/
 static void
-test_cursor_set_target_reset_cursor (EbSdbCursorFixture *fixture,
+test_cursor_set_target_reset_cursor (EbSqlCursorFixture *fixture,
                                     gconstpointer  user_data)
 {
        GSList *results = NULL;
        GError *error = NULL;
 
        /* First batch */
-       if (e_book_backend_sqlitedb_cursor_step (((ESqliteDBFixture *) fixture)->ebsdb,
-                                                fixture->cursor,
-                                                EBSDB_CURSOR_STEP_MOVE | EBSDB_CURSOR_STEP_FETCH,
-                                                EBSDB_CURSOR_ORIGIN_BEGIN,
-                                                5, &results, &error) < 0)
+       if (e_book_sqlite_cursor_step (((EbSqlFixture *) fixture)->ebsql,
+                                      fixture->cursor,
+                                      EBSQL_CURSOR_STEP_MOVE | EBSQL_CURSOR_STEP_FETCH,
+                                      EBSQL_CURSOR_ORIGIN_BEGIN,
+                                      5, &results, NULL, &error) < 0)
                g_error ("Error fetching cursor results: %s", error->message);
 
        print_results (results);
@@ -38,16 +36,16 @@ test_cursor_set_target_reset_cursor (EbSdbCursorFixture *fixture,
                               "sorted-6",
                               NULL);
 
-       g_slist_foreach (results, (GFunc)e_book_backend_sqlitedb_search_data_free, NULL);
+       g_slist_foreach (results, (GFunc)e_book_sqlite_search_data_free, NULL);
        g_slist_free (results);
        results = NULL;
 
        /* Second batch reset (same results) */
-       if (e_book_backend_sqlitedb_cursor_step (((ESqliteDBFixture *) fixture)->ebsdb,
-                                                fixture->cursor,
-                                                EBSDB_CURSOR_STEP_MOVE | EBSDB_CURSOR_STEP_FETCH,
-                                                EBSDB_CURSOR_ORIGIN_BEGIN,
-                                                5, &results, &error) < 0)
+       if (e_book_sqlite_cursor_step (((EbSqlFixture *) fixture)->ebsql,
+                                      fixture->cursor,
+                                      EBSQL_CURSOR_STEP_MOVE | EBSQL_CURSOR_STEP_FETCH,
+                                      EBSQL_CURSOR_ORIGIN_BEGIN,
+                                      5, &results, NULL, &error) < 0)
                g_error ("Error fetching cursor results: %s", error->message);
 
        print_results (results);
@@ -62,7 +60,7 @@ test_cursor_set_target_reset_cursor (EbSdbCursorFixture *fixture,
                               "sorted-6",
                               NULL);
 
-       g_slist_foreach (results, (GFunc)e_book_backend_sqlitedb_search_data_free, NULL);
+       g_slist_foreach (results, (GFunc)e_book_sqlite_search_data_free, NULL);
        g_slist_free (results);
 }
 
@@ -70,7 +68,7 @@ test_cursor_set_target_reset_cursor (EbSdbCursorFixture *fixture,
  * Expect results with family name starting with 'C' *
  *****************************************************/
 static void
-test_cursor_set_target_c_next_results (EbSdbCursorFixture *fixture,
+test_cursor_set_target_c_next_results (EbSqlCursorFixture *fixture,
                                       gconstpointer  user_data)
 {
        GSList *results = NULL;
@@ -80,20 +78,20 @@ test_cursor_set_target_c_next_results (EbSdbCursorFixture *fixture,
        const gchar *const *labels;
 
        /* First verify our test... in en_US locale the label 'C' should exist with the index 3 */
-       collator = e_book_backend_sqlitedb_ref_collator (((ESqliteDBFixture *) fixture)->ebsdb);
+       collator = e_book_sqlite_ref_collator (((EbSqlFixture *) fixture)->ebsql);
        labels = e_collator_get_index_labels (collator, &n_labels, NULL, NULL, NULL);
        g_assert_cmpstr (labels[3], ==, "C");
        e_collator_unref (collator);
 
        /* Set the cursor at the start of family names beginning with 'C' */
-       e_book_backend_sqlitedb_cursor_set_target_alphabetic_index (((ESqliteDBFixture *) fixture)->ebsdb,
-                                                                   fixture->cursor, 3);
-
-       if (e_book_backend_sqlitedb_cursor_step (((ESqliteDBFixture *) fixture)->ebsdb,
-                                                fixture->cursor,
-                                                EBSDB_CURSOR_STEP_MOVE | EBSDB_CURSOR_STEP_FETCH,
-                                                EBSDB_CURSOR_ORIGIN_CURRENT,
-                                                5, &results, &error) < 0)
+       e_book_sqlite_cursor_set_target_alphabetic_index (((EbSqlFixture *) fixture)->ebsql,
+                                                         fixture->cursor, 3);
+
+       if (e_book_sqlite_cursor_step (((EbSqlFixture *) fixture)->ebsql,
+                                      fixture->cursor,
+                                      EBSQL_CURSOR_STEP_MOVE | EBSQL_CURSOR_STEP_FETCH,
+                                      EBSQL_CURSOR_ORIGIN_CURRENT,
+                                      5, &results, NULL, &error) < 0)
                g_error ("Error fetching cursor results: %s", error->message);
 
        print_results (results);
@@ -108,7 +106,7 @@ test_cursor_set_target_c_next_results (EbSdbCursorFixture *fixture,
                               "sorted-9",
                               NULL);
 
-       g_slist_foreach (results, (GFunc)e_book_backend_sqlitedb_search_data_free, NULL);
+       g_slist_foreach (results, (GFunc)e_book_sqlite_search_data_free, NULL);
        g_slist_free (results);
 }
 
@@ -116,7 +114,7 @@ test_cursor_set_target_c_next_results (EbSdbCursorFixture *fixture,
  *       Expect results before the letter 'C'        *
  *****************************************************/
 static void
-test_cursor_set_target_c_prev_results (EbSdbCursorFixture *fixture,
+test_cursor_set_target_c_prev_results (EbSqlCursorFixture *fixture,
                                       gconstpointer  user_data)
 {
        GSList *results = NULL;
@@ -126,20 +124,20 @@ test_cursor_set_target_c_prev_results (EbSdbCursorFixture *fixture,
        const gchar *const *labels;
 
        /* First verify our test... in en_US locale the label 'C' should exist with the index 3 */
-       collator = e_book_backend_sqlitedb_ref_collator (((ESqliteDBFixture *) fixture)->ebsdb);
+       collator = e_book_sqlite_ref_collator (((EbSqlFixture *) fixture)->ebsql);
        labels = e_collator_get_index_labels (collator, &n_labels, NULL, NULL, NULL);
        g_assert_cmpstr (labels[3], ==, "C");
        e_collator_unref (collator);
 
        /* Set the cursor at the start of family names beginning with 'C' */
-       e_book_backend_sqlitedb_cursor_set_target_alphabetic_index (((ESqliteDBFixture *) fixture)->ebsdb,
-                                                                   fixture->cursor, 3);
-
-       if (e_book_backend_sqlitedb_cursor_step (((ESqliteDBFixture *) fixture)->ebsdb,
-                                                fixture->cursor, 
-                                                EBSDB_CURSOR_STEP_MOVE | EBSDB_CURSOR_STEP_FETCH,
-                                                EBSDB_CURSOR_ORIGIN_CURRENT,
-                                                -5, &results, &error) < 0)
+       e_book_sqlite_cursor_set_target_alphabetic_index (((EbSqlFixture *) fixture)->ebsql,
+                                                         fixture->cursor, 3);
+
+       if (e_book_sqlite_cursor_step (((EbSqlFixture *) fixture)->ebsql,
+                                      fixture->cursor, 
+                                      EBSQL_CURSOR_STEP_MOVE | EBSQL_CURSOR_STEP_FETCH,
+                                      EBSQL_CURSOR_ORIGIN_CURRENT,
+                                      -5, &results, NULL, &error) < 0)
                g_error ("Error fetching cursor results: %s", error->message);
 
        print_results (results);
@@ -154,31 +152,59 @@ test_cursor_set_target_c_prev_results (EbSdbCursorFixture *fixture,
                               "sorted-8",
                               NULL);
 
-       g_slist_foreach (results, (GFunc)e_book_backend_sqlitedb_search_data_free, NULL);
+       g_slist_foreach (results, (GFunc)e_book_sqlite_search_data_free, NULL);
        g_slist_free (results);
 }
 
+static EbSqlCursorClosure closures[] = {
+       { { FALSE, NULL }, NULL, E_BOOK_CURSOR_SORT_ASCENDING },
+       { { TRUE, NULL }, NULL, E_BOOK_CURSOR_SORT_ASCENDING },
+       { { FALSE, setup_empty_book }, NULL, E_BOOK_CURSOR_SORT_ASCENDING },
+       { { TRUE, setup_empty_book }, NULL, E_BOOK_CURSOR_SORT_ASCENDING }
+};
+
+static const gchar *prefixes[] = {
+       "/EBookSqlite/DefaultSummary/StoreVCards",
+       "/EBookSqlite/DefaultSummary/NoVCards",
+       "/EBookSqlite/EmptySummary/StoreVCards",
+       "/EBookSqlite/EmptrySummary/NoVCards"
+};
+
 gint
 main (gint argc,
       gchar **argv)
 {
+       gint i;
+
 #if !GLIB_CHECK_VERSION (2, 35, 1)
        g_type_init ();
 #endif
        g_test_init (&argc, &argv, NULL);
 
-       g_test_add ("/EbSdbCursor/SetTarget/ResetCursor", EbSdbCursorFixture, &book_closure,
-                   e_sqlitedb_cursor_fixture_setup,
-                   test_cursor_set_target_reset_cursor,
-                   e_sqlitedb_cursor_fixture_teardown);
-       g_test_add ("/EbSdbCursor/SetTarget/Alphabetic/C/NextResults", EbSdbCursorFixture, &book_closure,
-                   e_sqlitedb_cursor_fixture_setup,
-                   test_cursor_set_target_c_next_results,
-                   e_sqlitedb_cursor_fixture_teardown);
-       g_test_add ("/EbSdbCursor/SetTarget/Alphabetic/C/PreviousResults", EbSdbCursorFixture, &book_closure,
-                   e_sqlitedb_cursor_fixture_setup,
-                   test_cursor_set_target_c_prev_results,
-                   e_sqlitedb_cursor_fixture_teardown);
-
-       return e_test_server_utils_run ();
+       for (i = 0; i < G_N_ELEMENTS (closures); i++) {
+               gchar *path;
+
+               path = g_strconcat (prefixes[i], "/SetTarget/ResetCursor", NULL);
+               g_test_add (path, EbSqlCursorFixture, &closures[i],
+                           e_sqlite_cursor_fixture_setup,
+                           test_cursor_set_target_reset_cursor,
+                           e_sqlite_cursor_fixture_teardown);
+               g_free (path);
+
+               path = g_strconcat (prefixes[i], "/SetTarget/Alphabetic/C/NextResults", NULL);
+               g_test_add (path, EbSqlCursorFixture, &closures[i],
+                           e_sqlite_cursor_fixture_setup,
+                           test_cursor_set_target_c_next_results,
+                           e_sqlite_cursor_fixture_teardown);
+               g_free (path);
+
+               path = g_strconcat (prefixes[i], "/SetTarget/Alphabetic/C/PreviousResults", NULL);
+               g_test_add (path, EbSqlCursorFixture, &closures[i],
+                           e_sqlite_cursor_fixture_setup,
+                           test_cursor_set_target_c_prev_results,
+                           e_sqlite_cursor_fixture_teardown);
+               g_free (path);
+       }
+
+       return g_test_run ();
 }
diff --git a/tests/libedata-book/test-sqlite-get-contact.c b/tests/libedata-book/test-sqlite-get-contact.c
index 6736567..4a73f00 100644
--- a/tests/libedata-book/test-sqlite-get-contact.c
+++ b/tests/libedata-book/test-sqlite-get-contact.c
@@ -6,28 +6,21 @@
 
 #include "data-test-utils.h"
 
-static ETestServerClosure book_closure = { E_TEST_SERVER_ADDRESS_BOOK, NULL, 0 };
-
 static void
-test_get_contact (ESqliteDBFixture *fixture,
-                 gconstpointer     user_data)
+test_get_contact (EbSqlFixture   *fixture,
+                 gconstpointer   user_data)
 {
-       EBookClient *book_client;
        EContact *contact = NULL;
-       EContact *other;
+       EContact *other = NULL;
        GError *error = NULL;
 
-       book_client = E_TEST_SERVER_UTILS_SERVICE (fixture, EBookClient);
-
-       if (!add_contact_from_test_case_verify (book_client, "simple-1", &contact)) {
-               g_error ("Failed to get contact");
-       }
-
-       other = e_book_backend_sqlitedb_get_contact (fixture->ebsdb, SQLITEDB_FOLDER_ID,
-                                                    (const gchar *)e_contact_get_const (contact, 
E_CONTACT_UID),
-                                                    NULL, NULL, &error);
+       add_contact_from_test_case (fixture, "simple-1", &contact);
 
-       if (!other)
+       if (!e_book_sqlite_get_contact (fixture->ebsql,
+                                       (const gchar *)e_contact_get_const (contact, E_CONTACT_UID),
+                                       FALSE,  
+                                       &other,
+                                       &error))
                g_error ("Failed to get contact with uid '%s': %s",
                         (const gchar *)e_contact_get_const (contact, E_CONTACT_UID),
                         error->message);
@@ -36,10 +29,26 @@ test_get_contact (ESqliteDBFixture *fixture,
        g_object_unref (other);
 }
 
+static EbSqlClosure closures[] = {
+       { FALSE, NULL },
+       { TRUE, NULL },
+       { FALSE, setup_empty_book },
+       { TRUE, setup_empty_book }
+};
+
+static const gchar *paths[] = {
+       "/EBookSqlite/DefaultSummary/StoreVCards/GetContact",
+       "/EBookSqlite/DefaultSummary/NoVCards/GetContact",
+       "/EBookSqlite/EmptySummary/StoreVCards/GetContact",
+       "/EBookSqlite/EmptrySummary/NoVCards/GetContact"
+};
+
 gint
 main (gint argc,
       gchar **argv)
 {
+       gint i;
+
 #if !GLIB_CHECK_VERSION (2, 35, 1)
        g_type_init ();
 #endif
@@ -49,8 +58,9 @@ main (gint argc,
        g_assert (g_setenv ("LC_ALL", "en_US.UTF-8", TRUE));
        setlocale (LC_ALL, "");
 
-       g_test_add ("/EBookBackendSqliteDB/GetContact", ESqliteDBFixture, &book_closure,
-                   e_sqlitedb_fixture_setup, test_get_contact, e_sqlitedb_fixture_teardown);
+       for (i = 0; i < G_N_ELEMENTS (closures); i++)
+               g_test_add (paths[i], EbSqlFixture, &closures[i],
+                           e_sqlite_fixture_setup, test_get_contact, e_sqlite_fixture_teardown);
 
-       return e_test_server_utils_run ();
+       return g_test_run ();
 }


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