[evolution-data-server/openismus-work-3-8] Adding data migration regression tests for the file backend.



commit de2a2d4222049e553ae5b7faebbcb5d3c7e64327
Author: Tristan Van Berkom <tristanvb openismus com>
Date:   Wed Sep 25 19:54:07 2013 +0200

    Adding data migration regression tests for the file backend.

 configure.ac                                       |   19 +
 tests/Makefile.am                                  |    2 +-
 tests/book-migration/Makefile.am                   |   58 +++
 tests/book-migration/db/3.0/Makefile.am            |   10 +
 tests/book-migration/db/3.0/addressbook.db.summary |  Bin 0 -> 2208 bytes
 tests/book-migration/db/3.0/addressbook.dump       |   49 +++
 tests/book-migration/db/3.2/Makefile.am            |   10 +
 tests/book-migration/db/3.2/addressbook.dump       |   49 +++
 tests/book-migration/db/3.2/contacts.db            |  Bin 0 -> 15360 bytes
 tests/book-migration/db/3.4/Makefile.am            |   10 +
 tests/book-migration/db/3.4/addressbook.dump       |   50 +++
 tests/book-migration/db/3.4/contacts.db            |  Bin 0 -> 15360 bytes
 tests/book-migration/db/3.6/Makefile.am            |   10 +
 tests/book-migration/db/3.6/addressbook.dump       |   50 +++
 tests/book-migration/db/3.6/contacts.db            |  Bin 0 -> 15360 bytes
 tests/book-migration/db/3.8/contacts.db            |  Bin 0 -> 23552 bytes
 tests/book-migration/db/Makefile.am                |    3 +
 tests/book-migration/setup-migration-test.c        |  296 ++++++++++++++++
 tests/book-migration/test-migration.c              |  374 ++++++++++++++++++++
 tests/book-migration/vcards/migrate-1.vcf          |    6 +
 tests/book-migration/vcards/migrate-10.vcf         |    6 +
 tests/book-migration/vcards/migrate-11.vcf         |    6 +
 tests/book-migration/vcards/migrate-12.vcf         |    7 +
 tests/book-migration/vcards/migrate-13.vcf         |    6 +
 tests/book-migration/vcards/migrate-14.vcf         |    6 +
 tests/book-migration/vcards/migrate-15.vcf         |    6 +
 tests/book-migration/vcards/migrate-16.vcf         |    6 +
 tests/book-migration/vcards/migrate-17.vcf         |    6 +
 tests/book-migration/vcards/migrate-18.vcf         |    6 +
 tests/book-migration/vcards/migrate-19.vcf         |    6 +
 tests/book-migration/vcards/migrate-2.vcf          |    7 +
 tests/book-migration/vcards/migrate-20.vcf         |    6 +
 tests/book-migration/vcards/migrate-3.vcf          |    7 +
 tests/book-migration/vcards/migrate-4.vcf          |    6 +
 tests/book-migration/vcards/migrate-5.vcf          |    6 +
 tests/book-migration/vcards/migrate-6.vcf          |    5 +
 tests/book-migration/vcards/migrate-7.vcf          |    5 +
 tests/book-migration/vcards/migrate-8.vcf          |    6 +
 tests/book-migration/vcards/migrate-9.vcf          |    6 +
 39 files changed, 1110 insertions(+), 1 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index efe4be1..eeb6cff 100644
--- a/configure.ac
+++ b/configure.ac
@@ -605,6 +605,19 @@ AC_SUBST(DB_CFLAGS)
 AC_SUBST(DB_LIBS)
 
 dnl ******************************
+dnl db_load checking
+dnl ******************************
+have_db_load=no
+AC_PATH_PROG(DB_LOAD, [db_load])
+if test -z "$DB_LOAD"; then
+   AC_MSG_WARN([db_load not found, some unit tests will not be run.])
+else
+   have_db_load=yes
+fi
+
+AM_CONDITIONAL(HAVE_DB_LOAD, test x"$have_db_load" = "xyes")
+
+dnl ******************************
 dnl iconv checking
 dnl ******************************
 have_iconv="no"
@@ -1771,6 +1784,12 @@ tests/libebook/Makefile
 tests/libebook-contacts/Makefile
 tests/libebook/client/Makefile
 tests/libebook/vcard/Makefile
+tests/book-migration/Makefile
+tests/book-migration/db/Makefile
+tests/book-migration/db/3.0/Makefile
+tests/book-migration/db/3.2/Makefile
+tests/book-migration/db/3.4/Makefile
+tests/book-migration/db/3.6/Makefile
 tests/libecal/Makefile
 tests/libecal/client/Makefile
 tests/libedata-cal/Makefile
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 7287065..01d4af8 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,4 +1,4 @@
-SUBDIRS = test-server-utils libedataserver libebook-contacts libedata-book libebook libecal libedata-cal
+SUBDIRS = test-server-utils libedataserver libebook-contacts libedata-book libebook book-migration libecal 
libedata-cal
 
 if HAVE_GTK
 SUBDIRS += cursor-example
diff --git a/tests/book-migration/Makefile.am b/tests/book-migration/Makefile.am
new file mode 100644
index 0000000..224c4e0
--- /dev/null
+++ b/tests/book-migration/Makefile.am
@@ -0,0 +1,58 @@
+SUBDIRS = db
+
+noinst_PROGRAMS =                                              \
+       setup-migration-test                                    \
+       $(TESTS)                                                \
+       $(NULL)
+
+TEST_CPPFLAGS =                                                        \
+       $(AM_CPPFLAGS)                                          \
+       -I$(top_srcdir)                                         \
+       -I$(top_builddir)                                       \
+       -I$(top_srcdir)/addressbook                             \
+       -I$(top_builddir)/addressbook                           \
+       -I$(top_srcdir)/calendar                                \
+       -I$(top_builddir)/calendar                              \
+       -I$(top_srcdir)/tests/test-server-utils                 \
+       -I$(top_builddir)/tests/test-server-utils               \
+       -I$(top_srcdir)/tests/libebook/client                   \
+       -I$(top_builddir)/tests/libebook/client                 \
+       -I$(top_srcdir)/private                                 \
+       -I$(top_builddir)/private                               \
+       -DEDS_TEST_WORK_DIR=\""$(abs_top_builddir)/tests/test-server-utils/cache"\" \
+       -DEDS_TEST_BOOKS=\""$(abs_top_builddir)/tests/book-migration/db"\" \
+       $(EVOLUTION_ADDRESSBOOK_CFLAGS)                         \
+       $(CAMEL_CFLAGS)                                         \
+       $(NULL)
+
+# If db_load is detected at configure time, then we've built
+# an addressbook.db to test the migration from 3.6 -> Current.
+#
+# Instead of committing a BDB file directly which might have
+# compatibility issues, we use a text dump (for SQLite we
+# rely on compatilbility).
+if HAVE_DB_LOAD
+TEST_CPPFLAGS += -DTEST_VERSIONS_WITH_BDB
+endif
+
+TEST_LIBS =                            \
+       $(top_builddir)/addressbook/libebook/libebook-1.2.la    \
+       $(top_builddir)/tests/test-server-utils/libetestserverutils.la  \
+       $(top_builddir)/tests/libebook/client/libclient-test-utils.la   \
+       $(top_builddir)/private/libedbus-private.la             \
+       $(EVOLUTION_ADDRESSBOOK_LIBS)                           \
+       $(CAMEL_LIBS)                                           \
+       $(NULL)
+
+# Should be kept ordered approximately from least to most difficult/complex
+TESTS =                                                                \
+       test-migration                                  \
+       $(NULL)
+
+test_migration_LDADD=$(TEST_LIBS)
+test_migration_CPPFLAGS=$(TEST_CPPFLAGS)
+
+setup_migration_test_LDADD=$(TEST_LIBS)
+setup_migration_test_CPPFLAGS=$(TEST_CPPFLAGS)
+
+-include $(top_srcdir)/git.mk
diff --git a/tests/book-migration/db/3.0/Makefile.am b/tests/book-migration/db/3.0/Makefile.am
new file mode 100644
index 0000000..a718ce7
--- /dev/null
+++ b/tests/book-migration/db/3.0/Makefile.am
@@ -0,0 +1,10 @@
+
+GENERATED_DBS = addressbook.db
+
+# Use db_load with our BDB dump text file
+noinst_DATA = $(GENERATED_DBS)
+CLEANFILES = $(GENERATED_DBS)
+
+%.db: %.dump
+       $(AM_V_GEN) $(DB_LOAD) -f $< $@
+
diff --git a/tests/book-migration/db/3.0/addressbook.db.summary 
b/tests/book-migration/db/3.0/addressbook.db.summary
new file mode 100644
index 0000000..ee0d9e4
Binary files /dev/null and b/tests/book-migration/db/3.0/addressbook.db.summary differ
diff --git a/tests/book-migration/db/3.0/addressbook.dump b/tests/book-migration/db/3.0/addressbook.dump
new file mode 100644
index 0000000..2569ba7
--- /dev/null
+++ b/tests/book-migration/db/3.0/addressbook.dump
@@ -0,0 +1,49 @@
+VERSION=3
+format=bytevalue
+type=hash
+h_nelem=21
+db_pagesize=4096
+HEADER=END
+ 5041532d44422d56455253494f4e00
+ 302e3200
+ 7061732d69642d3532343546394333303030303030303000
+ 
424547494e3a56434152440d0a56455253494f4e3a332e300d0a5549443a7061732d69642d353234354639433330303030303030300d0a4e3a6261643b4669727374204e616d650d0a54454c3b545950453d484f4d453a2b312d3232312d353432333738390d0a454d41494c3b545950453d686f6d652c776f726b3a6d69636865616c406a61636b736f6e2e636f6d0d0a464e3a4669727374204e616d65206261640d0a582d45564f4c5554494f4e2d46494c452d41533a6261645c2c204669727374204e616d650d0a5245563a323031332d30392d32375432313a33333a35355a0d0a454e443a564341524400
+ 7061732d69642d3532343546394333303030303030303200
+ 
424547494e3a56434152440d0a56455253494f4e3a332e300d0a5549443a7061732d69642d353234354639433330303030303030320d0a4e3a4dc3bc6c6c65723b4669727374204e616d650d0a54454c3b545950453d484f4d453a3531342d3834352d383433360d0a454d41494c3b545950453d686f6d652c776f726b3a70696e6b40706f6e792e6e65740d0a464e3a4669727374204e616d65204dc3bc6c6c65720d0a582d45564f4c5554494f4e2d46494c452d41533a4dc3bc6c6c65725c2c204669727374204e616d650d0a5245563a323031332d30392d32375432313a33333a35355a0d0a454e443a564341524400
+ 7061732d69642d3532343546394333303030303030303400
+ 
424547494e3a56434152440d0a56455253494f4e3a332e300d0a5549443a7061732d69642d353234354639433330303030303030340d0a4e3a4261643b4669727374204e616d650d0a54454c3b545950453d484f4d453a373635343332310d0a454d41494c3a6a616e6574406a61636b736f6e2e636f6d0d0a454d41494c3a6a616e6e79406a61636b736f6e2e636f6d0d0a464e3a4669727374204e616d65204261640d0a582d45564f4c5554494f4e2d46494c452d41533a4261645c2c204669727374204e616d650d0a5245563a323031332d30392d32375432313a33333a35355a0d0a454e443a564341524400
+ 7061732d69642d3532343546394333303030303030303600
+ 
424547494e3a56434152440d0a56455253494f4e3a332e300d0a5549443a7061732d69642d353234354639433330303030303030360d0a4e3a63c3b474653b4669727374204e616d650d0a54454c3b545950453d484f4d453a3531342d3834352d383433360d0a454d41494c3b545950453d686f6d652c776f726b3a70696e6b40706f6e792e6f72670d0a464e3a4669727374204e616d652063c3b474650d0a582d45564f4c5554494f4e2d46494c452d41533a63c3b474655c2c204669727374204e616d650d0a5245563a323031332d30392d32375432313a33333a35355a0d0a454e443a564341524400
+ 7061732d69642d3532343546394333303030303030303800
+ 
424547494e3a56434152440d0a56455253494f4e3a332e300d0a5549443a7061732d69642d353234354639433330303030303030380d0a4e3a62c3a4643b4669727374204e616d650d0a54454c3b545950453d484f4d453a2b363636363636360d0a454d41494c3b545950453d686f6d652c776f726b3ae69591e591bd4062726f776e2e636f6d0d0a464e3a4669727374204e616d652062c3a4640d0a582d45564f4c5554494f4e2d46494c452d41533a62c3a4645c2c204669727374204e616d650d0a5245563a323031332d30392d32375432313a33333a35355a0d0a454e443a564341524400
+ 7061732d69642d3532343546394333303030303030304200
+ 
424547494e3a56434152440d0a56455253494f4e3a332e300d0a5549443a7061732d69642d353234354639433330303030303030420d0a4e3a42c3a4643b4669727374204e616d650d0a54454c3b545950453d484f4d453a61736b204a656e6e7920666f72204c6973612773206e756d6265720d0a464e3a4669727374204e616d652042c3a4640d0a582d45564f4c5554494f4e2d46494c452d41533a42c3a4645c2c204669727374204e616d650d0a5245563a323031332d30392d32375432313a33333a35355a0d0a454e443a564341524400
+ 7061732d69642d3532343546394333303030303030304400
+ 
424547494e3a56434152440d0a56455253494f4e3a332e300d0a5549443a7061732d69642d353234354639433330303030303030440d0a4e3a433b4669727374204e616d650d0a54454c3b545950453d484f4d453a2b312d3232312d353432333738390d0a454d41494c3b545950453d686f6d652c776f726b3a6d6973746572406a61636b736f6e2e636f6d0d0a464e3a4669727374204e616d6520430d0a582d45564f4c5554494f4e2d46494c452d41533a435c2c204669727374204e616d650d0a5245563a323031332d30392d32375432313a33333a35355a0d0a454e443a564341524400
+ 7061732d69642d3532343546394333303030303030304600
+ 
424547494e3a56434152440d0a56455253494f4e3a332e300d0a5549443a7061732d69642d353234354639433330303030303030460d0a4e3a42c3a4743b4669727374204e616d650d0a54454c3b545950453d484f4d453a2b33312d3232312d353432333738390d0a454d41494c3b545950453d686f6d652c776f726b3a707572706c6540706f6e792e636f6d0d0a464e3a4669727374204e616d652042c3a4740d0a582d45564f4c5554494f4e2d46494c452d41533a42c3a4745c2c204669727374204e616d650d0a5245563a323031332d30392d32375432313a33333a35355a0d0a454e443a564341524400
+ 7061732d69642d3532343546394333303030303030313100
+ 
424547494e3a56434152440d0a56455253494f4e3a332e300d0a5549443a7061732d69642d353234354639433330303030303031310d0a4e3a626c61636b2d626972643b4669727374204e616d650d0a54454c3b545950453d484f4d453a3531342d3834352d383433360d0a454d41494c3b545950453d686f6d652c776f726b3a70696e6b40706f6e792e6f72670d0a464e3a4669727374204e616d6520626c61636b2d626972640d0a582d45564f4c5554494f4e2d46494c452d41533a626c61636b2d626972645c2c204669727374204e616d650d0a5245563a323031332d30392d32375432313a33333a35355a0d0a454e443a564341524400
+ 7061732d69642d3532343546394333303030303030313300
+ 
424547494e3a56434152440d0a56455253494f4e3a332e300d0a5549443a7061732d69642d353234354639433330303030303031330d0a4e3a626c61636b62697264733b4669727374204e616d650d0a54454c3b545950453d484f4d453a3531342d3834352d383433360d0a454d41494c3b545950453d686f6d652c776f726b3a70696e6b40706f6e792e636f6d0d0a464e3a4669727374204e616d6520626c61636b62697264730d0a582d45564f4c5554494f4e2d46494c452d41533a626c61636b62697264735c2c204669727374204e616d650d0a5245563a323031332d30392d32375432313a33333a35355a0d0a454e443a564341524400
+ 7061732d69642d3532343546394333303030303030303100
+ 
424547494e3a56434152440d0a56455253494f4e3a332e300d0a5549443a7061732d69642d353234354639433330303030303030310d0a4e3a4261743b4669727374204e616d650d0a54454c3b545950453d484f4d453a2b393939393939390d0a454d41494c3b545950453d776f726b3a626f6262794062726f776e2e6f72670d0a454d41494c3b545950453d686f6d652c776f726b3a626f6262794062726f776e2e636f6d0d0a464e3a4669727374204e616d65204261740d0a582d45564f4c5554494f4e2d46494c452d41533a4261745c2c204669727374204e616d650d0a5245563a323031332d30392d32375432313a33333a35355a0d0a454e443a564341524400
+ 7061732d69642d3532343546394333303030303030303300
+ 
424547494e3a56434152440d0a56455253494f4e3a332e300d0a5549443a7061732d69642d353234354639433330303030303030330d0a464e3a5965204e616d656c657373204f6e650d0a54454c3b545950453d484f4d453a2b312d3232312d353432333738390d0a454d41494c3b545950453d686f6d652c776f726b3a6e616d65406c6573732e636f6d0d0a5245563a323031332d30392d32375432313a33333a35355a0d0a454e443a564341524400
+ 7061732d69642d3532343546394333303030303030303500
+ 
424547494e3a56434152440d0a56455253494f4e3a332e300d0a5549443a7061732d69642d353234354639433330303030303030350d0a4e3a63c3b474c3a93b4669727374204e616d650d0a54454c3b545950453d484f4d453a3531342d3834352d383433360d0a454d41494c3b545950453d686f6d652c776f726b3a6a696d406d6f727269736f6e2e636f6d0d0a464e3a4669727374204e616d652063c3b474c3a90d0a582d45564f4c5554494f4e2d46494c452d41533a63c3b474c3a95c2c204669727374204e616d650d0a5245563a323031332d30392d32375432313a33333a35355a0d0a454e443a564341524400
+ 7061732d69642d3532343546394333303030303030303700
+ 
424547494e3a56434152440d0a56455253494f4e3a332e300d0a5549443a7061732d69642d353234354639433330303030303030370d0a4e3a626c61636b2d62697264733b4669727374204e616d650d0a54454c3b545950453d484f4d453a3531342d3834352d383433360d0a454d41494c3b545950453d686f6d652c776f726b3a70696e6b40706f6e792e636f6d0d0a464e3a4669727374204e616d6520626c61636b2d62697264730d0a582d45564f4c5554494f4e2d46494c452d41533a626c61636b2d62697264735c2c204669727374204e616d650d0a5245563a323031332d30392d32375432313a33333a35355a0d0a454e443a564341524400
+ 7061732d69642d3532343546394333303030303030303900
+ 
424547494e3a56434152440d0a56455253494f4e3a332e300d0a5549443a7061732d69642d353234354639433330303030303030390d0a4e3a636f74653b4669727374204e616d650d0a54454c3b545950453d484f4d453a3531342d3834352d383433360d0a454d41494c3b545950453d686f6d652c776f726b3a70696e6b40706f6e792e636f6d0d0a464e3a4669727374204e616d6520636f74650d0a582d45564f4c5554494f4e2d46494c452d41533a636f74655c2c204669727374204e616d650d0a5245563a323031332d30392d32375432313a33333a35355a0d0a454e443a564341524400
+ 7061732d69642d3532343546394333303030303030304100
+ 
424547494e3a56434152440d0a56455253494f4e3a332e300d0a5549443a7061732d69642d353234354639433330303030303030410d0a4e3a62c3a4743b4669727374204e616d650d0a54454c3b545950453d484f4d453a2b34392d38392d373838382039390d0a464e3a4669727374204e616d652062c3a4740d0a582d45564f4c5554494f4e2d46494c452d41533a62c3a4745c2c204669727374204e616d650d0a5245563a323031332d30392d32375432313a33333a35355a0d0a454e443a564341524400
+ 7061732d69642d3532343546394333303030303030304300
+ 
424547494e3a56434152440d0a56455253494f4e3a332e300d0a5549443a7061732d69642d353234354639433330303030303030430d0a4e3a636f74c3a93b4669727374204e616d650d0a54454c3b545950453d484f4d453a3531342d3834352d383433360d0a454d41494c3b545950453d686f6d652c776f726b3a70696e6b40706f6e792e636f6d0d0a464e3a4669727374204e616d6520636f74c3a90d0a582d45564f4c5554494f4e2d46494c452d41533a636f74c3a95c2c204669727374204e616d650d0a5245563a323031332d30392d32375432313a33333a35355a0d0a454e443a564341524400
+ 7061732d69642d3532343546394333303030303030304500
+ 
424547494e3a56434152440d0a56455253494f4e3a332e300d0a5549443a7061732d69642d353234354639433330303030303030450d0a4e3a4d7566666c65723b4669727374204e616d650d0a54454c3b545950453d484f4d453a3531342d3834352d383433360d0a454d41494c3b545950453d686f6d652c776f726b3a70696e6b40706f6e792e6e65740d0a464e3a4669727374204e616d65204d7566666c65720d0a582d45564f4c5554494f4e2d46494c452d41533a4d7566666c65725c2c204669727374204e616d650d0a5245563a323031332d30392d32375432313a33333a35355a0d0a454e443a564341524400
+ 7061732d69642d3532343546394333303030303030313000
+ 
424547494e3a56434152440d0a56455253494f4e3a332e300d0a5549443a7061732d69642d353234354639433330303030303031300d0a4e3a626c61636b626972643b4669727374204e616d650d0a54454c3b545950453d484f4d453a3531342d3834352d383433360d0a454d41494c3b545950453d686f6d652c776f726b3a70696e6b40706f6e792e636f6d0d0a464e3a4669727374204e616d6520626c61636b626972640d0a582d45564f4c5554494f4e2d46494c452d41533a626c61636b626972645c2c204669727374204e616d650d0a5245563a323031332d30392d32375432313a33333a35355a0d0a454e443a564341524400
+ 7061732d69642d3532343546394333303030303030313200
+ 
424547494e3a56434152440d0a56455253494f4e3a332e300d0a5549443a7061732d69642d353234354639433330303030303031320d0a4e3a6261743b4669727374204e616d650d0a54454c3b545950453d776f726b2c707265663a2b393939393939390d0a454d41494c3ae8ada6e5af9f4062726f776e2e6f72670d0a464e3a4669727374204e616d65206261740d0a582d45564f4c5554494f4e2d46494c452d41533a6261745c2c204669727374204e616d650d0a5245563a323031332d30392d32375432313a33333a35355a0d0a454e443a564341524400
+DATA=END
diff --git a/tests/book-migration/db/3.2/Makefile.am b/tests/book-migration/db/3.2/Makefile.am
new file mode 100644
index 0000000..a718ce7
--- /dev/null
+++ b/tests/book-migration/db/3.2/Makefile.am
@@ -0,0 +1,10 @@
+
+GENERATED_DBS = addressbook.db
+
+# Use db_load with our BDB dump text file
+noinst_DATA = $(GENERATED_DBS)
+CLEANFILES = $(GENERATED_DBS)
+
+%.db: %.dump
+       $(AM_V_GEN) $(DB_LOAD) -f $< $@
+
diff --git a/tests/book-migration/db/3.2/addressbook.dump b/tests/book-migration/db/3.2/addressbook.dump
new file mode 100644
index 0000000..191cfa8
--- /dev/null
+++ b/tests/book-migration/db/3.2/addressbook.dump
@@ -0,0 +1,49 @@
+VERSION=3
+format=bytevalue
+type=hash
+h_nelem=21
+db_pagesize=4096
+HEADER=END
+ 5041532d44422d56455253494f4e00
+ 302e3200
+ 7061732d69642d3532343546443033303030303030303000
+ 
424547494e3a56434152440d0a56455253494f4e3a332e300d0a5549443a7061732d69642d353234354644303330303030303030300d0a4e3a6261643b4669727374204e616d650d0a54454c3b545950453d484f4d453a2b312d3232312d353432333738390d0a454d41494c3b545950453d686f6d652c776f726b3a6d69636865616c406a61636b736f6e2e636f6d0d0a5245563a323031332d30392d32375432313a34373a34375a0d0a454e443a564341524400
+ 7061732d69642d3532343546443033303030303030303200
+ 
424547494e3a56434152440d0a56455253494f4e3a332e300d0a5549443a7061732d69642d353234354644303330303030303030320d0a4e3a4dc3bc6c6c65723b4669727374204e616d650d0a54454c3b545950453d484f4d453a3531342d3834352d383433360d0a454d41494c3b545950453d686f6d652c776f726b3a70696e6b40706f6e792e6e65740d0a5245563a323031332d30392d32375432313a34373a34375a0d0a454e443a564341524400
+ 7061732d69642d3532343546443033303030303030303400
+ 
424547494e3a56434152440d0a56455253494f4e3a332e300d0a5549443a7061732d69642d353234354644303330303030303030340d0a4e3a4261643b4669727374204e616d650d0a54454c3b545950453d484f4d453a373635343332310d0a454d41494c3a6a616e6574406a61636b736f6e2e636f6d0d0a454d41494c3a6a616e6e79406a61636b736f6e2e636f6d0d0a5245563a323031332d30392d32375432313a34373a34375a0d0a454e443a564341524400
+ 7061732d69642d3532343546443033303030303030303600
+ 
424547494e3a56434152440d0a56455253494f4e3a332e300d0a5549443a7061732d69642d353234354644303330303030303030360d0a4e3a63c3b474653b4669727374204e616d650d0a54454c3b545950453d484f4d453a3531342d3834352d383433360d0a454d41494c3b545950453d686f6d652c776f726b3a70696e6b40706f6e792e6f72670d0a5245563a323031332d30392d32375432313a34373a34375a0d0a454e443a564341524400
+ 7061732d69642d3532343546443033303030303030303800
+ 
424547494e3a56434152440d0a56455253494f4e3a332e300d0a5549443a7061732d69642d353234354644303330303030303030380d0a4e3a62c3a4643b4669727374204e616d650d0a54454c3b545950453d484f4d453a2b363636363636360d0a454d41494c3b545950453d686f6d652c776f726b3ae69591e591bd4062726f776e2e636f6d0d0a5245563a323031332d30392d32375432313a34373a34375a0d0a454e443a564341524400
+ 7061732d69642d3532343546443033303030303030304200
+ 
424547494e3a56434152440d0a56455253494f4e3a332e300d0a5549443a7061732d69642d353234354644303330303030303030420d0a4e3a42c3a4643b4669727374204e616d650d0a54454c3b545950453d484f4d453a61736b204a656e6e7920666f72204c6973612773206e756d6265720d0a5245563a323031332d30392d32375432313a34373a34375a0d0a454e443a564341524400
+ 7061732d69642d3532343546443034303030303030304500
+ 
424547494e3a56434152440d0a56455253494f4e3a332e300d0a5549443a7061732d69642d353234354644303430303030303030450d0a4e3a4d7566666c65723b4669727374204e616d650d0a54454c3b545950453d484f4d453a3531342d3834352d383433360d0a454d41494c3b545950453d686f6d652c776f726b3a70696e6b40706f6e792e6e65740d0a5245563a323031332d30392d32375432313a34373a34385a0d0a454e443a564341524400
+ 7061732d69642d3532343546443034303030303030313000
+ 
424547494e3a56434152440d0a56455253494f4e3a332e300d0a5549443a7061732d69642d353234354644303430303030303031300d0a4e3a626c61636b626972643b4669727374204e616d650d0a54454c3b545950453d484f4d453a3531342d3834352d383433360d0a454d41494c3b545950453d686f6d652c776f726b3a70696e6b40706f6e792e636f6d0d0a5245563a323031332d30392d32375432313a34373a34385a0d0a454e443a564341524400
+ 7061732d69642d3532343546443034303030303030313200
+ 
424547494e3a56434152440d0a56455253494f4e3a332e300d0a5549443a7061732d69642d353234354644303430303030303031320d0a4e3a6261743b4669727374204e616d650d0a54454c3b545950453d776f726b2c707265663a2b393939393939390d0a454d41494c3ae8ada6e5af9f4062726f776e2e6f72670d0a5245563a323031332d30392d32375432313a34373a34385a0d0a454e443a564341524400
+ 7061732d69642d3532343546443033303030303030303100
+ 
424547494e3a56434152440d0a56455253494f4e3a332e300d0a5549443a7061732d69642d353234354644303330303030303030310d0a4e3a4261743b4669727374204e616d650d0a54454c3b545950453d484f4d453a2b393939393939390d0a454d41494c3b545950453d776f726b3a626f6262794062726f776e2e6f72670d0a454d41494c3b545950453d686f6d652c776f726b3a626f6262794062726f776e2e636f6d0d0a5245563a323031332d30392d32375432313a34373a34375a0d0a454e443a564341524400
+ 7061732d69642d3532343546443033303030303030303300
+ 
424547494e3a56434152440d0a56455253494f4e3a332e300d0a5549443a7061732d69642d353234354644303330303030303030330d0a464e3a5965204e616d656c657373204f6e650d0a54454c3b545950453d484f4d453a2b312d3232312d353432333738390d0a454d41494c3b545950453d686f6d652c776f726b3a6e616d65406c6573732e636f6d0d0a5245563a323031332d30392d32375432313a34373a34375a0d0a454e443a564341524400
+ 7061732d69642d3532343546443033303030303030303500
+ 
424547494e3a56434152440d0a56455253494f4e3a332e300d0a5549443a7061732d69642d353234354644303330303030303030350d0a4e3a63c3b474c3a93b4669727374204e616d650d0a54454c3b545950453d484f4d453a3531342d3834352d383433360d0a454d41494c3b545950453d686f6d652c776f726b3a6a696d406d6f727269736f6e2e636f6d0d0a5245563a323031332d30392d32375432313a34373a34375a0d0a454e443a564341524400
+ 7061732d69642d3532343546443033303030303030303700
+ 
424547494e3a56434152440d0a56455253494f4e3a332e300d0a5549443a7061732d69642d353234354644303330303030303030370d0a4e3a626c61636b2d62697264733b4669727374204e616d650d0a54454c3b545950453d484f4d453a3531342d3834352d383433360d0a454d41494c3b545950453d686f6d652c776f726b3a70696e6b40706f6e792e636f6d0d0a5245563a323031332d30392d32375432313a34373a34375a0d0a454e443a564341524400
+ 7061732d69642d3532343546443033303030303030303900
+ 
424547494e3a56434152440d0a56455253494f4e3a332e300d0a5549443a7061732d69642d353234354644303330303030303030390d0a4e3a636f74653b4669727374204e616d650d0a54454c3b545950453d484f4d453a3531342d3834352d383433360d0a454d41494c3b545950453d686f6d652c776f726b3a70696e6b40706f6e792e636f6d0d0a5245563a323031332d30392d32375432313a34373a34375a0d0a454e443a564341524400
+ 7061732d69642d3532343546443033303030303030304100
+ 
424547494e3a56434152440d0a56455253494f4e3a332e300d0a5549443a7061732d69642d353234354644303330303030303030410d0a4e3a62c3a4743b4669727374204e616d650d0a54454c3b545950453d484f4d453a2b34392d38392d373838382039390d0a5245563a323031332d30392d32375432313a34373a34375a0d0a454e443a564341524400
+ 7061732d69642d3532343546443033303030303030304300
+ 
424547494e3a56434152440d0a56455253494f4e3a332e300d0a5549443a7061732d69642d353234354644303330303030303030430d0a4e3a636f74c3a93b4669727374204e616d650d0a54454c3b545950453d484f4d453a3531342d3834352d383433360d0a454d41494c3b545950453d686f6d652c776f726b3a70696e6b40706f6e792e636f6d0d0a5245563a323031332d30392d32375432313a34373a34375a0d0a454e443a564341524400
+ 7061732d69642d3532343546443034303030303030304400
+ 
424547494e3a56434152440d0a56455253494f4e3a332e300d0a5549443a7061732d69642d353234354644303430303030303030440d0a4e3a433b4669727374204e616d650d0a54454c3b545950453d484f4d453a2b312d3232312d353432333738390d0a454d41494c3b545950453d686f6d652c776f726b3a6d6973746572406a61636b736f6e2e636f6d0d0a5245563a323031332d30392d32375432313a34373a34385a0d0a454e443a564341524400
+ 7061732d69642d3532343546443034303030303030304600
+ 
424547494e3a56434152440d0a56455253494f4e3a332e300d0a5549443a7061732d69642d353234354644303430303030303030460d0a4e3a42c3a4743b4669727374204e616d650d0a54454c3b545950453d484f4d453a2b33312d3232312d353432333738390d0a454d41494c3b545950453d686f6d652c776f726b3a707572706c6540706f6e792e636f6d0d0a5245563a323031332d30392d32375432313a34373a34385a0d0a454e443a564341524400
+ 7061732d69642d3532343546443034303030303030313100
+ 
424547494e3a56434152440d0a56455253494f4e3a332e300d0a5549443a7061732d69642d353234354644303430303030303031310d0a4e3a626c61636b2d626972643b4669727374204e616d650d0a54454c3b545950453d484f4d453a3531342d3834352d383433360d0a454d41494c3b545950453d686f6d652c776f726b3a70696e6b40706f6e792e6f72670d0a5245563a323031332d30392d32375432313a34373a34385a0d0a454e443a564341524400
+ 7061732d69642d3532343546443034303030303030313300
+ 
424547494e3a56434152440d0a56455253494f4e3a332e300d0a5549443a7061732d69642d353234354644303430303030303031330d0a4e3a626c61636b62697264733b4669727374204e616d650d0a54454c3b545950453d484f4d453a3531342d3834352d383433360d0a454d41494c3b545950453d686f6d652c776f726b3a70696e6b40706f6e792e636f6d0d0a5245563a323031332d30392d32375432313a34373a34385a0d0a454e443a564341524400
+DATA=END
diff --git a/tests/book-migration/db/3.2/contacts.db b/tests/book-migration/db/3.2/contacts.db
new file mode 100644
index 0000000..34abc23
Binary files /dev/null and b/tests/book-migration/db/3.2/contacts.db differ
diff --git a/tests/book-migration/db/3.4/Makefile.am b/tests/book-migration/db/3.4/Makefile.am
new file mode 100644
index 0000000..a718ce7
--- /dev/null
+++ b/tests/book-migration/db/3.4/Makefile.am
@@ -0,0 +1,10 @@
+
+GENERATED_DBS = addressbook.db
+
+# Use db_load with our BDB dump text file
+noinst_DATA = $(GENERATED_DBS)
+CLEANFILES = $(GENERATED_DBS)
+
+%.db: %.dump
+       $(AM_V_GEN) $(DB_LOAD) -f $< $@
+
diff --git a/tests/book-migration/db/3.4/addressbook.dump b/tests/book-migration/db/3.4/addressbook.dump
new file mode 100644
index 0000000..aadafcb
--- /dev/null
+++ b/tests/book-migration/db/3.4/addressbook.dump
@@ -0,0 +1,50 @@
+VERSION=3
+format=bytevalue
+type=hash
+db_pagesize=4096
+HEADER=END
+ 5041532d44422d56455253494f4e00
+ 302e3200
+ 7061732d69642d3532343630313846303030303030303100
+ 
424547494e3a56434152440d0a56455253494f4e3a332e300d0a5549443a7061732d69642d353234363031384630303030303030310d0a4e3a4261743b4669727374204e616d650d0a54454c3b545950453d484f4d453a2b393939393939390d0a454d41494c3b545950453d776f726b3a626f6262794062726f776e2e6f72670d0a454d41494c3b545950453d686f6d652c776f726b3a626f6262794062726f776e2e636f6d0d0a5245563a323031332d30392d32375432323a30373a31315a0d0a454e443a564341524400
+ 7061732d69642d3532343630313930303030303030303400
+ 
424547494e3a56434152440d0a56455253494f4e3a332e300d0a5549443a7061732d69642d353234363031393030303030303030340d0a4e3a4261643b4669727374204e616d650d0a54454c3b545950453d484f4d453a373635343332310d0a454d41494c3a6a616e6574406a61636b736f6e2e636f6d0d0a454d41494c3a6a616e6e79406a61636b736f6e2e636f6d0d0a5245563a323031332d30392d32375432323a30373a31325a0d0a454e443a564341524400
+ 7061732d69642d3532343630313930303030303030303600
+ 
424547494e3a56434152440d0a56455253494f4e3a332e300d0a5549443a7061732d69642d353234363031393030303030303030360d0a4e3a63c3b474653b4669727374204e616d650d0a54454c3b545950453d484f4d453a3531342d3834352d383433360d0a454d41494c3b545950453d686f6d652c776f726b3a70696e6b40706f6e792e6f72670d0a5245563a323031332d30392d32375432323a30373a31325a0d0a454e443a564341524400
+ 7061732d69642d3532343630313930303030303030303800
+ 
424547494e3a56434152440d0a56455253494f4e3a332e300d0a5549443a7061732d69642d353234363031393030303030303030380d0a4e3a62c3a4643b4669727374204e616d650d0a54454c3b545950453d484f4d453a2b363636363636360d0a454d41494c3b545950453d686f6d652c776f726b3ae69591e591bd4062726f776e2e636f6d0d0a5245563a323031332d30392d32375432323a30373a31325a0d0a454e443a564341524400
+ 7061732d69642d3532343630313930303030303030304200
+ 
424547494e3a56434152440d0a56455253494f4e3a332e300d0a5549443a7061732d69642d353234363031393030303030303030420d0a4e3a42c3a4643b4669727374204e616d650d0a54454c3b545950453d484f4d453a61736b204a656e6e7920666f72204c6973612773206e756d6265720d0a5245563a323031332d30392d32375432323a30373a31325a0d0a454e443a564341524400
+ 7061732d69642d3532343630313930303030303030304400
+ 
424547494e3a56434152440d0a56455253494f4e3a332e300d0a5549443a7061732d69642d353234363031393030303030303030440d0a4e3a433b4669727374204e616d650d0a54454c3b545950453d484f4d453a2b312d3232312d353432333738390d0a454d41494c3b545950453d686f6d652c776f726b3a6d6973746572406a61636b736f6e2e636f6d0d0a5245563a323031332d30392d32375432323a30373a31325a0d0a454e443a564341524400
+ 7061732d69642d3532343630313931303030303030304500
+ 
424547494e3a56434152440d0a56455253494f4e3a332e300d0a5549443a7061732d69642d353234363031393130303030303030450d0a4e3a4d7566666c65723b4669727374204e616d650d0a54454c3b545950453d484f4d453a3531342d3834352d383433360d0a454d41494c3b545950453d686f6d652c776f726b3a70696e6b40706f6e792e6e65740d0a5245563a323031332d30392d32375432323a30373a31335a0d0a454e443a564341524400
+ 7061732d69642d3532343630313931303030303030313000
+ 
424547494e3a56434152440d0a56455253494f4e3a332e300d0a5549443a7061732d69642d353234363031393130303030303031300d0a4e3a626c61636b626972643b4669727374204e616d650d0a54454c3b545950453d484f4d453a3531342d3834352d383433360d0a454d41494c3b545950453d686f6d652c776f726b3a70696e6b40706f6e792e636f6d0d0a5245563a323031332d30392d32375432323a30373a31335a0d0a454e443a564341524400
+ 7061732d69642d3532343630313931303030303030313200
+ 
424547494e3a56434152440d0a56455253494f4e3a332e300d0a5549443a7061732d69642d353234363031393130303030303031320d0a4e3a6261743b4669727374204e616d650d0a54454c3b545950453d776f726b2c707265663a2b393939393939390d0a454d41494c3ae8ada6e5af9f4062726f776e2e6f72670d0a5245563a323031332d30392d32375432323a30373a31335a0d0a454e443a564341524400
+ 5041532d44422d5245564953494f4e00
+ 323031332d30392d32375432323a30373a31335a2832302900
+ 7061732d69642d3532343630313846303030303030303000
+ 
424547494e3a56434152440d0a56455253494f4e3a332e300d0a5549443a7061732d69642d353234363031384630303030303030300d0a4e3a6261643b4669727374204e616d650d0a54454c3b545950453d484f4d453a2b312d3232312d353432333738390d0a454d41494c3b545950453d686f6d652c776f726b3a6d69636865616c406a61636b736f6e2e636f6d0d0a5245563a323031332d30392d32375432323a30373a31315a0d0a454e443a564341524400
+ 7061732d69642d3532343630313846303030303030303200
+ 
424547494e3a56434152440d0a56455253494f4e3a332e300d0a5549443a7061732d69642d353234363031384630303030303030320d0a4e3a4dc3bc6c6c65723b4669727374204e616d650d0a54454c3b545950453d484f4d453a3531342d3834352d383433360d0a454d41494c3b545950453d686f6d652c776f726b3a70696e6b40706f6e792e6e65740d0a5245563a323031332d30392d32375432323a30373a31315a0d0a454e443a564341524400
+ 7061732d69642d3532343630313930303030303030303300
+ 
424547494e3a56434152440d0a56455253494f4e3a332e300d0a5549443a7061732d69642d353234363031393030303030303030330d0a464e3a5965204e616d656c657373204f6e650d0a54454c3b545950453d484f4d453a2b312d3232312d353432333738390d0a454d41494c3b545950453d686f6d652c776f726b3a6e616d65406c6573732e636f6d0d0a5245563a323031332d30392d32375432323a30373a31325a0d0a454e443a564341524400
+ 7061732d69642d3532343630313930303030303030303500
+ 
424547494e3a56434152440d0a56455253494f4e3a332e300d0a5549443a7061732d69642d353234363031393030303030303030350d0a4e3a63c3b474c3a93b4669727374204e616d650d0a54454c3b545950453d484f4d453a3531342d3834352d383433360d0a454d41494c3b545950453d686f6d652c776f726b3a6a696d406d6f727269736f6e2e636f6d0d0a5245563a323031332d30392d32375432323a30373a31325a0d0a454e443a564341524400
+ 7061732d69642d3532343630313930303030303030303700
+ 
424547494e3a56434152440d0a56455253494f4e3a332e300d0a5549443a7061732d69642d353234363031393030303030303030370d0a4e3a626c61636b2d62697264733b4669727374204e616d650d0a54454c3b545950453d484f4d453a3531342d3834352d383433360d0a454d41494c3b545950453d686f6d652c776f726b3a70696e6b40706f6e792e636f6d0d0a5245563a323031332d30392d32375432323a30373a31325a0d0a454e443a564341524400
+ 7061732d69642d3532343630313930303030303030303900
+ 
424547494e3a56434152440d0a56455253494f4e3a332e300d0a5549443a7061732d69642d353234363031393030303030303030390d0a4e3a636f74653b4669727374204e616d650d0a54454c3b545950453d484f4d453a3531342d3834352d383433360d0a454d41494c3b545950453d686f6d652c776f726b3a70696e6b40706f6e792e636f6d0d0a5245563a323031332d30392d32375432323a30373a31325a0d0a454e443a564341524400
+ 7061732d69642d3532343630313930303030303030304100
+ 
424547494e3a56434152440d0a56455253494f4e3a332e300d0a5549443a7061732d69642d353234363031393030303030303030410d0a4e3a62c3a4743b4669727374204e616d650d0a54454c3b545950453d484f4d453a2b34392d38392d373838382039390d0a5245563a323031332d30392d32375432323a30373a31325a0d0a454e443a564341524400
+ 7061732d69642d3532343630313930303030303030304300
+ 
424547494e3a56434152440d0a56455253494f4e3a332e300d0a5549443a7061732d69642d353234363031393030303030303030430d0a4e3a636f74c3a93b4669727374204e616d650d0a54454c3b545950453d484f4d453a3531342d3834352d383433360d0a454d41494c3b545950453d686f6d652c776f726b3a70696e6b40706f6e792e636f6d0d0a5245563a323031332d30392d32375432323a30373a31325a0d0a454e443a564341524400
+ 7061732d69642d3532343630313931303030303030304600
+ 
424547494e3a56434152440d0a56455253494f4e3a332e300d0a5549443a7061732d69642d353234363031393130303030303030460d0a4e3a42c3a4743b4669727374204e616d650d0a54454c3b545950453d484f4d453a2b33312d3232312d353432333738390d0a454d41494c3b545950453d686f6d652c776f726b3a707572706c6540706f6e792e636f6d0d0a5245563a323031332d30392d32375432323a30373a31335a0d0a454e443a564341524400
+ 7061732d69642d3532343630313931303030303030313100
+ 
424547494e3a56434152440d0a56455253494f4e3a332e300d0a5549443a7061732d69642d353234363031393130303030303031310d0a4e3a626c61636b2d626972643b4669727374204e616d650d0a54454c3b545950453d484f4d453a3531342d3834352d383433360d0a454d41494c3b545950453d686f6d652c776f726b3a70696e6b40706f6e792e6f72670d0a5245563a323031332d30392d32375432323a30373a31335a0d0a454e443a564341524400
+ 7061732d69642d3532343630313931303030303030313300
+ 
424547494e3a56434152440d0a56455253494f4e3a332e300d0a5549443a7061732d69642d353234363031393130303030303031330d0a4e3a626c61636b62697264733b4669727374204e616d650d0a54454c3b545950453d484f4d453a3531342d3834352d383433360d0a454d41494c3b545950453d686f6d652c776f726b3a70696e6b40706f6e792e636f6d0d0a5245563a323031332d30392d32375432323a30373a31335a0d0a454e443a564341524400
+DATA=END
diff --git a/tests/book-migration/db/3.4/contacts.db b/tests/book-migration/db/3.4/contacts.db
new file mode 100644
index 0000000..20c20e9
Binary files /dev/null and b/tests/book-migration/db/3.4/contacts.db differ
diff --git a/tests/book-migration/db/3.6/Makefile.am b/tests/book-migration/db/3.6/Makefile.am
new file mode 100644
index 0000000..a718ce7
--- /dev/null
+++ b/tests/book-migration/db/3.6/Makefile.am
@@ -0,0 +1,10 @@
+
+GENERATED_DBS = addressbook.db
+
+# Use db_load with our BDB dump text file
+noinst_DATA = $(GENERATED_DBS)
+CLEANFILES = $(GENERATED_DBS)
+
+%.db: %.dump
+       $(AM_V_GEN) $(DB_LOAD) -f $< $@
+
diff --git a/tests/book-migration/db/3.6/addressbook.dump b/tests/book-migration/db/3.6/addressbook.dump
new file mode 100644
index 0000000..a83fbcf
--- /dev/null
+++ b/tests/book-migration/db/3.6/addressbook.dump
@@ -0,0 +1,50 @@
+VERSION=3
+format=bytevalue
+type=hash
+db_pagesize=4096
+HEADER=END
+ 5041532d44422d56455253494f4e00
+ 302e3200
+ 7061732d69642d3532343630344438303030303030303000
+ 
424547494e3a56434152440d0a56455253494f4e3a332e300d0a5549443a7061732d69642d353234363034443830303030303030300d0a4e3a6261643b4669727374204e616d650d0a54454c3b545950453d484f4d453a2b312d3232312d353432333738390d0a454d41494c3b545950453d686f6d652c776f726b3a6d69636865616c406a61636b736f6e2e636f6d0d0a5245563a323031332d30392d32375432323a32313a31325a0d0a454e443a564341524400
+ 7061732d69642d3532343630344438303030303030303200
+ 
424547494e3a56434152440d0a56455253494f4e3a332e300d0a5549443a7061732d69642d353234363034443830303030303030320d0a4e3a4dc3bc6c6c65723b4669727374204e616d650d0a54454c3b545950453d484f4d453a3531342d3834352d383433360d0a454d41494c3b545950453d686f6d652c776f726b3a70696e6b40706f6e792e6e65740d0a5245563a323031332d30392d32375432323a32313a31325a0d0a454e443a564341524400
+ 7061732d69642d3532343630344438303030303030303400
+ 
424547494e3a56434152440d0a56455253494f4e3a332e300d0a5549443a7061732d69642d353234363034443830303030303030340d0a4e3a4261643b4669727374204e616d650d0a54454c3b545950453d484f4d453a373635343332310d0a454d41494c3a6a616e6574406a61636b736f6e2e636f6d0d0a454d41494c3a6a616e6e79406a61636b736f6e2e636f6d0d0a5245563a323031332d30392d32375432323a32313a31325a0d0a454e443a564341524400
+ 7061732d69642d3532343630344438303030303030303600
+ 
424547494e3a56434152440d0a56455253494f4e3a332e300d0a5549443a7061732d69642d353234363034443830303030303030360d0a4e3a63c3b474653b4669727374204e616d650d0a54454c3b545950453d484f4d453a3531342d3834352d383433360d0a454d41494c3b545950453d686f6d652c776f726b3a70696e6b40706f6e792e6f72670d0a5245563a323031332d30392d32375432323a32313a31325a0d0a454e443a564341524400
+ 7061732d69642d3532343630344438303030303030303800
+ 
424547494e3a56434152440d0a56455253494f4e3a332e300d0a5549443a7061732d69642d353234363034443830303030303030380d0a4e3a62c3a4643b4669727374204e616d650d0a54454c3b545950453d484f4d453a2b363636363636360d0a454d41494c3b545950453d686f6d652c776f726b3ae69591e591bd4062726f776e2e636f6d0d0a5245563a323031332d30392d32375432323a32313a31325a0d0a454e443a564341524400
+ 7061732d69642d3532343630344438303030303030304200
+ 
424547494e3a56434152440d0a56455253494f4e3a332e300d0a5549443a7061732d69642d353234363034443830303030303030420d0a4e3a42c3a4643b4669727374204e616d650d0a54454c3b545950453d484f4d453a61736b204a656e6e7920666f72204c6973612773206e756d6265720d0a5245563a323031332d30392d32375432323a32313a31325a0d0a454e443a564341524400
+ 7061732d69642d3532343630344438303030303030304400
+ 
424547494e3a56434152440d0a56455253494f4e3a332e300d0a5549443a7061732d69642d353234363034443830303030303030440d0a4e3a433b4669727374204e616d650d0a54454c3b545950453d484f4d453a2b312d3232312d353432333738390d0a454d41494c3b545950453d686f6d652c776f726b3a6d6973746572406a61636b736f6e2e636f6d0d0a5245563a323031332d30392d32375432323a32313a31325a0d0a454e443a564341524400
+ 7061732d69642d3532343630344438303030303030304600
+ 
424547494e3a56434152440d0a56455253494f4e3a332e300d0a5549443a7061732d69642d353234363034443830303030303030460d0a4e3a42c3a4743b4669727374204e616d650d0a54454c3b545950453d484f4d453a2b33312d3232312d353432333738390d0a454d41494c3b545950453d686f6d652c776f726b3a707572706c6540706f6e792e636f6d0d0a5245563a323031332d30392d32375432323a32313a31325a0d0a454e443a564341524400
+ 7061732d69642d3532343630344438303030303030313100
+ 
424547494e3a56434152440d0a56455253494f4e3a332e300d0a5549443a7061732d69642d353234363034443830303030303031310d0a4e3a626c61636b2d626972643b4669727374204e616d650d0a54454c3b545950453d484f4d453a3531342d3834352d383433360d0a454d41494c3b545950453d686f6d652c776f726b3a70696e6b40706f6e792e6f72670d0a5245563a323031332d30392d32375432323a32313a31325a0d0a454e443a564341524400
+ 7061732d69642d3532343630344438303030303030313300
+ 
424547494e3a56434152440d0a56455253494f4e3a332e300d0a5549443a7061732d69642d353234363034443830303030303031330d0a4e3a626c61636b62697264733b4669727374204e616d650d0a54454c3b545950453d484f4d453a3531342d3834352d383433360d0a454d41494c3b545950453d686f6d652c776f726b3a70696e6b40706f6e792e636f6d0d0a5245563a323031332d30392d32375432323a32313a31325a0d0a454e443a564341524400
+ 5041532d44422d5245564953494f4e00
+ 323031332d30392d32375432323a32313a31325a28312900
+ 7061732d69642d3532343630344438303030303030303100
+ 
424547494e3a56434152440d0a56455253494f4e3a332e300d0a5549443a7061732d69642d353234363034443830303030303030310d0a4e3a4261743b4669727374204e616d650d0a54454c3b545950453d484f4d453a2b393939393939390d0a454d41494c3b545950453d776f726b3a626f6262794062726f776e2e6f72670d0a454d41494c3b545950453d686f6d652c776f726b3a626f6262794062726f776e2e636f6d0d0a5245563a323031332d30392d32375432323a32313a31325a0d0a454e443a564341524400
+ 7061732d69642d3532343630344438303030303030303300
+ 
424547494e3a56434152440d0a56455253494f4e3a332e300d0a5549443a7061732d69642d353234363034443830303030303030330d0a464e3a5965204e616d656c657373204f6e650d0a54454c3b545950453d484f4d453a2b312d3232312d353432333738390d0a454d41494c3b545950453d686f6d652c776f726b3a6e616d65406c6573732e636f6d0d0a5245563a323031332d30392d32375432323a32313a31325a0d0a454e443a564341524400
+ 7061732d69642d3532343630344438303030303030303500
+ 
424547494e3a56434152440d0a56455253494f4e3a332e300d0a5549443a7061732d69642d353234363034443830303030303030350d0a4e3a63c3b474c3a93b4669727374204e616d650d0a54454c3b545950453d484f4d453a3531342d3834352d383433360d0a454d41494c3b545950453d686f6d652c776f726b3a6a696d406d6f727269736f6e2e636f6d0d0a5245563a323031332d30392d32375432323a32313a31325a0d0a454e443a564341524400
+ 7061732d69642d3532343630344438303030303030303700
+ 
424547494e3a56434152440d0a56455253494f4e3a332e300d0a5549443a7061732d69642d353234363034443830303030303030370d0a4e3a626c61636b2d62697264733b4669727374204e616d650d0a54454c3b545950453d484f4d453a3531342d3834352d383433360d0a454d41494c3b545950453d686f6d652c776f726b3a70696e6b40706f6e792e636f6d0d0a5245563a323031332d30392d32375432323a32313a31325a0d0a454e443a564341524400
+ 7061732d69642d3532343630344438303030303030303900
+ 
424547494e3a56434152440d0a56455253494f4e3a332e300d0a5549443a7061732d69642d353234363034443830303030303030390d0a4e3a636f74653b4669727374204e616d650d0a54454c3b545950453d484f4d453a3531342d3834352d383433360d0a454d41494c3b545950453d686f6d652c776f726b3a70696e6b40706f6e792e636f6d0d0a5245563a323031332d30392d32375432323a32313a31325a0d0a454e443a564341524400
+ 7061732d69642d3532343630344438303030303030304100
+ 
424547494e3a56434152440d0a56455253494f4e3a332e300d0a5549443a7061732d69642d353234363034443830303030303030410d0a4e3a62c3a4743b4669727374204e616d650d0a54454c3b545950453d484f4d453a2b34392d38392d373838382039390d0a5245563a323031332d30392d32375432323a32313a31325a0d0a454e443a564341524400
+ 7061732d69642d3532343630344438303030303030304300
+ 
424547494e3a56434152440d0a56455253494f4e3a332e300d0a5549443a7061732d69642d353234363034443830303030303030430d0a4e3a636f74c3a93b4669727374204e616d650d0a54454c3b545950453d484f4d453a3531342d3834352d383433360d0a454d41494c3b545950453d686f6d652c776f726b3a70696e6b40706f6e792e636f6d0d0a5245563a323031332d30392d32375432323a32313a31325a0d0a454e443a564341524400
+ 7061732d69642d3532343630344438303030303030304500
+ 
424547494e3a56434152440d0a56455253494f4e3a332e300d0a5549443a7061732d69642d353234363034443830303030303030450d0a4e3a4d7566666c65723b4669727374204e616d650d0a54454c3b545950453d484f4d453a3531342d3834352d383433360d0a454d41494c3b545950453d686f6d652c776f726b3a70696e6b40706f6e792e6e65740d0a5245563a323031332d30392d32375432323a32313a31325a0d0a454e443a564341524400
+ 7061732d69642d3532343630344438303030303030313000
+ 
424547494e3a56434152440d0a56455253494f4e3a332e300d0a5549443a7061732d69642d353234363034443830303030303031300d0a4e3a626c61636b626972643b4669727374204e616d650d0a54454c3b545950453d484f4d453a3531342d3834352d383433360d0a454d41494c3b545950453d686f6d652c776f726b3a70696e6b40706f6e792e636f6d0d0a5245563a323031332d30392d32375432323a32313a31325a0d0a454e443a564341524400
+ 7061732d69642d3532343630344438303030303030313200
+ 
424547494e3a56434152440d0a56455253494f4e3a332e300d0a5549443a7061732d69642d353234363034443830303030303031320d0a4e3a6261743b4669727374204e616d650d0a54454c3b545950453d776f726b2c707265663a2b393939393939390d0a454d41494c3ae8ada6e5af9f4062726f776e2e6f72670d0a5245563a323031332d30392d32375432323a32313a31325a0d0a454e443a564341524400
+DATA=END
diff --git a/tests/book-migration/db/3.6/contacts.db b/tests/book-migration/db/3.6/contacts.db
new file mode 100644
index 0000000..341da03
Binary files /dev/null and b/tests/book-migration/db/3.6/contacts.db differ
diff --git a/tests/book-migration/db/3.8/contacts.db b/tests/book-migration/db/3.8/contacts.db
new file mode 100644
index 0000000..e9ef88a
Binary files /dev/null and b/tests/book-migration/db/3.8/contacts.db differ
diff --git a/tests/book-migration/db/Makefile.am b/tests/book-migration/db/Makefile.am
new file mode 100644
index 0000000..9238264
--- /dev/null
+++ b/tests/book-migration/db/Makefile.am
@@ -0,0 +1,3 @@
+if HAVE_DB_LOAD
+SUBDIRS = 3.0 3.2 3.4 3.6
+endif
diff --git a/tests/book-migration/setup-migration-test.c b/tests/book-migration/setup-migration-test.c
new file mode 100644
index 0000000..9e86b93
--- /dev/null
+++ b/tests/book-migration/setup-migration-test.c
@@ -0,0 +1,296 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2013 Intel Corporation
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU Lesser General Public
+ * License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ * Authors: Tristan Van Berkom <tristanvb openismus com>
+ */
+
+#include <glib.h>
+
+#include <libedataserver/eds-version.h>
+
+#if EDS_CHECK_VERSION(3,6,0)
+#  include <libebook/libebook.h>
+#else
+#  include <libebook/e-contact.h>
+#  include <libebook/e-book.h>
+#endif
+
+#if EDS_CHECK_VERSION(3,6,0)
+typedef EBookClient Book;
+#else
+typedef EBook Book;
+#endif
+
+static Book *create_book  (const gchar *book_id);
+static void  add_contacts (Book *book, GSList *contacts);
+
+/********************************************************
+ *            Loading contacts from directory           *
+ ********************************************************/
+static EContact *
+contact_from_file (const gchar *vcard_file)
+{
+       EContact *contact;
+       GError *error;
+       gchar *vcard = NULL;
+
+       if (!g_file_get_contents (vcard_file, &vcard, NULL, &error))
+               g_error ("Failed to load vcard: %s", error->message);
+
+       contact = e_contact_new_from_vcard (vcard);
+       g_free (vcard);
+
+       return contact;
+}
+
+static GSList *
+load_contacts (const gchar *vcard_directory)
+{
+       GDir *dir;
+       GError *error = NULL;
+       const gchar *filename;
+       GSList *contacts = NULL;
+
+       dir = g_dir_open (vcard_directory, 0, &error);
+       if (!dir)
+               g_error ("Failed to open vcard directory '%s': %s", vcard_directory, error->message);
+
+       while ((filename = g_dir_read_name (dir)) != NULL) {
+
+               if (g_str_has_suffix (filename, ".vcf")) {
+                       gchar *fullpath = g_build_filename (vcard_directory, filename, NULL);
+                       EContact *contact;
+
+                       contact = contact_from_file (fullpath);
+                       contacts = g_slist_prepend (contacts, contact);
+
+                       g_free (fullpath);
+               }
+       }
+
+       g_dir_close (dir);
+
+       return g_slist_reverse (contacts);
+}
+
+/********************************************************
+ *                   Creating the Book                  *
+ ********************************************************/
+#if EDS_CHECK_VERSION(3,6,0)
+
+typedef struct {
+       GMainLoop *loop;
+       const gchar *book_id;
+       EBookClient *book;
+} SourceAddedData;
+
+static void
+source_added (ESourceRegistry *registry,
+             ESource *source,
+             gpointer data)
+{
+       SourceAddedData *added_data = (SourceAddedData *)data;
+       GError *error = NULL;
+
+       if (g_strcmp0 (e_source_get_uid (source), added_data->book_id) != 0)
+               return;
+
+       /* Open the address book */
+#if EDS_CHECK_VERSION(3,8,0)
+       added_data->book = (EBookClient *)e_book_client_connect_sync (source, NULL, &error);
+#else
+       /* With 3.6 it's a bit more tricky */
+       added_data->book = e_book_client_new (source, &error);
+       if (added_data->book &&
+           !e_client_open_sync (E_CLIENT (added_data->book), FALSE, NULL, &error))
+               g_error ("Failed to open addressbook: %s", error->message);
+#endif
+
+       if (!added_data->book)
+               g_error ("Failed to create addressbook: %s", error->message);
+
+       if (added_data->loop)
+               g_main_loop_quit (added_data->loop);
+}
+
+static gboolean
+create_source_timeout (gpointer user_data)
+{
+       g_error ("Timed out while waiting for ESource creation from the registry");
+
+       return FALSE;
+}
+
+static EBookClient *
+create_book (const gchar *book_id)
+{
+       ESourceRegistry *registry;
+       ESource *scratch;
+       ESourceBackend *backend = NULL;
+       GError  *error = NULL;
+       SourceAddedData data = { NULL, NULL, NULL };
+
+       g_return_val_if_fail (book_id != NULL, NULL);
+
+       data.loop = g_main_loop_new (NULL, FALSE);
+
+       registry = e_source_registry_new_sync (NULL, &error);
+       if (!registry)
+               g_error ("Unable to create the registry: %s", error->message);
+
+       /* Listen to the registry for our added source */
+       data.book_id = book_id;
+       g_signal_connect (registry, "source-added",
+                         G_CALLBACK (source_added), &data);
+
+       /* Now create a scratch source for our addressbook */
+       scratch = e_source_new_with_uid (book_id, NULL, &error);
+       if (!scratch)
+               g_error ("Failed to create scratch source: %s", error->message);
+
+       /* Ensure the new ESource will be a local addressbook source */
+       backend = e_source_get_extension (scratch, E_SOURCE_EXTENSION_ADDRESS_BOOK);
+       e_source_backend_set_backend_name (backend, "local");
+
+       /* Commit the source to the registry */
+       if (!e_source_registry_commit_source_sync (registry, scratch, NULL, &error))
+               g_error ("Unable to add new addressbook source to the registry: %s", error->message);
+
+       g_object_unref (scratch);
+
+       if (data.book == NULL) {
+               g_timeout_add (20 * 1000, create_source_timeout, NULL);
+               g_main_loop_run (data.loop);
+
+               /* By now we aborted or we have an addressbook created */
+               g_assert (data.book != NULL);
+       }
+
+       g_main_loop_unref (data.loop);
+       g_object_unref (registry);
+
+       return data.book;
+}
+
+#else
+
+static EBook *
+create_book (const gchar *book_id)
+{
+       EBook *book;
+       GError *error = NULL;
+
+       book = e_book_new_from_uri (book_id, &error);
+
+       if (!book)
+               g_error ("Error creating book: %s", error->message);
+
+        if (!e_book_open (book, FALSE, &error))
+               g_error ("Error opening book: %s", error->message);
+
+       return book;
+}
+
+#endif
+
+
+/********************************************************
+ *                   Adding the Contacts                *
+ ********************************************************/
+#if EDS_CHECK_VERSION(3,6,0)
+
+static void
+add_contacts (Book   *book,
+             GSList *contacts)
+{
+       GError *error = NULL;
+
+       if (!e_book_client_add_contacts_sync (book, contacts, NULL, NULL, &error))
+               g_error ("Failed to add contacts: %s", error->message);
+}
+
+#else
+
+static void
+add_contacts (Book   *book,
+             GSList *contacts)
+{
+       GError *error = NULL;
+       GSList *l;
+
+       for (l = contacts; l; l = l->next) {
+               EContact *contact = l->data;
+
+               if (!e_book_add_contact (book, contact, &error))
+                       g_error ("Failed to add a contact: %s", error->message);
+       }
+}
+
+#endif
+
+/********************************************************
+ *                   Options and main()                 *
+ ********************************************************/
+static gchar *book_id = NULL;
+static gchar *contacts_directory = NULL;
+
+static GOptionEntry option_entries[] = {
+       {"book-id", 'b', 0, G_OPTION_ARG_STRING, &book_id,
+        "The book identifier string", NULL },
+       {"contacts-directory", 'd', 0, G_OPTION_ARG_FILENAME, &contacts_directory,
+        "The directory from where to read the contact files", NULL },
+       { NULL }
+};
+
+gint
+main (gint argc, gchar *argv[])
+{
+       GOptionContext *option_context;
+       GOptionGroup *option_group;
+       GError *error = NULL;
+       GSList *contacts;
+       Book *book;
+
+       option_context = g_option_context_new (NULL);
+       g_option_context_set_summary (option_context,
+                                     "Populate a database for migration tests.");
+
+       option_group = g_option_group_new ("setup migration test",
+                                          "Setup Migration options",
+                                          "Setup Migration options", NULL, NULL);
+       g_option_group_add_entries (option_group, option_entries);
+       g_option_context_set_main_group (option_context, option_group);
+
+       if (!g_option_context_parse (option_context, &argc, &argv, &error))
+               g_error ("Failed to parse program arguments: %s", error->message);
+
+       if (!book_id || !contacts_directory)
+               g_error ("Must provide the book identifier and contacts directory\n%s",
+                        g_option_context_get_help (option_context, TRUE, NULL));
+
+       contacts = load_contacts (contacts_directory);
+
+       book = create_book (book_id);
+       add_contacts (book, contacts);
+
+       g_object_unref (book);
+
+       g_slist_free_full (contacts, g_object_unref);
+
+       return 0;
+}
diff --git a/tests/book-migration/test-migration.c b/tests/book-migration/test-migration.c
new file mode 100644
index 0000000..b82528b
--- /dev/null
+++ b/tests/book-migration/test-migration.c
@@ -0,0 +1,374 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2013 Intel Corporation
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU Lesser General Public
+ * License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ * Authors: Tristan Van Berkom <tristanvb openismus com>
+ */
+
+#include <config.h>
+
+#include <stdlib.h>
+#include <libebook/libebook.h>
+
+#include "client-test-utils.h"
+#include "e-test-server-utils.h"
+
+typedef struct {
+       ETestServerFixture parent_fixture;
+} MigrationFixture;
+
+typedef struct {
+       ETestServerClosure  parent;
+       gchar              *version;
+} MigrationClosure;
+
+typedef void ( *MigrationTestFunc) (MigrationFixture *fixture,
+                                   gconstpointer     user_data);
+
+static const gchar *arbitrary_vcard = 
+       "BEGIN:VCARD\n"
+       "UID:arbitrary-vcard\n"
+       "FN:Bobby Brown\n"
+       "TEL;HOME:+9999999\n"
+       "EMAIL;TYPE=work:bobby brown org\n"
+       "EMAIL;TYPE=home,work:bobby brown com\n"
+       "END:VCARD\n";
+
+/***********************************************************
+ *                         Fixture                         *
+ ***********************************************************/
+static void
+setup_migration_sandbox (const gchar *version)
+{
+       gchar *dest_dir, *dest_bdb, *dest;
+       gchar *src_dir, *src_bdb, *src;
+       GFile *src_file, *dest_file;
+       GError *error = NULL;
+
+       dest_dir  = g_build_filename (EDS_TEST_WORK_DIR, "evolution", "addressbook", version, NULL);
+       dest_bdb  = g_build_filename (dest_dir, "addressbook.db", NULL);
+       dest      = g_build_filename (dest_dir, "contacts.db", NULL);
+
+       src_dir   = g_build_filename (EDS_TEST_BOOKS, version, NULL);
+       src_bdb   = g_build_filename (src_dir, "addressbook.db", NULL);
+       src       = g_build_filename (src_dir, "contacts.db", NULL);
+
+       /* Create the directory for the database files */
+       g_assert (g_mkdir_with_parents (dest_dir, 0755) == 0);
+
+       /* If there is a BDB for this version, copy it over */
+       if (g_file_test (src_bdb, G_FILE_TEST_IS_REGULAR)) {
+               src_file = g_file_new_for_path (src_bdb);
+               dest_file = g_file_new_for_path (dest_bdb);
+
+               if (!g_file_copy (src_file, dest_file,
+                                 G_FILE_COPY_OVERWRITE,
+                                 NULL, NULL, NULL, &error))
+                       g_error ("Failed to setup sandbox for %s migration test: %s",
+                                version, error->message);
+
+               g_object_unref (src_file);
+               g_object_unref (dest_file);
+       }
+
+       /* Setup the contacts.db for migration */
+       if (g_file_test (src, G_FILE_TEST_IS_REGULAR)) {
+               src_file = g_file_new_for_path (src);
+               dest_file = g_file_new_for_path (dest);
+
+               if (!g_file_copy (src_file, dest_file,
+                                 G_FILE_COPY_OVERWRITE,
+                                 NULL, NULL, NULL, &error))
+                       g_error ("Failed to setup sandbox for %s migration test: %s",
+                                version, error->message);
+
+               g_object_unref (src_file);
+               g_object_unref (dest_file);
+       }
+
+       g_free (dest_dir);
+       g_free (dest_bdb);
+       g_free (dest);
+
+       g_free (src_dir);
+       g_free (src_bdb);
+       g_free (src);
+}
+
+static void
+migration_fixture_setup (MigrationFixture *fixture,
+                        gconstpointer     user_data)
+{
+       ETestServerFixture *parent = (ETestServerFixture *)fixture;
+       MigrationClosure   *closure = (MigrationClosure *)user_data;
+
+       parent->source_name = g_strdup (closure->version);
+
+       setup_migration_sandbox (closure->version);
+
+       e_test_server_utils_setup ((ETestServerFixture *)parent, user_data);
+}
+
+static void
+migration_fixture_teardown (MigrationFixture *fixture,
+                           gconstpointer     user_data)
+{
+       e_test_server_utils_teardown ((ETestServerFixture *)fixture, user_data);
+}
+
+
+/***********************************************************
+ *                          Tests                          *
+ ***********************************************************/
+static void
+test_open (MigrationFixture *fixture,
+          gconstpointer     user_data)
+{
+       
+}
+
+static void
+test_fetch_contacts (MigrationFixture *fixture,
+                    gconstpointer     user_data)
+{
+       EBookClient *book_client;
+       GSList *contacts = NULL;
+       GError *error = NULL;
+
+       book_client = E_TEST_SERVER_UTILS_SERVICE (fixture, EBookClient);
+
+       if (!e_book_client_get_contacts_sync (book_client,
+                                             "",
+                                             &contacts,
+                                             NULL, &error))
+               g_error ("Failed to fetch contacts: %s", error->message);
+
+       /* Assert some more things related to the actually expected contacts here... */
+       g_assert_cmpint (g_slist_length (contacts), ==, 20);
+
+       g_slist_free_full (contacts, g_object_unref);
+}
+
+static void
+test_add_remove_contact (MigrationFixture *fixture,
+                        gconstpointer     user_data)
+{
+       EBookClient *book_client;
+       EContact *contact = NULL;
+       GError *error = NULL;
+
+       book_client = E_TEST_SERVER_UTILS_SERVICE (fixture, EBookClient);
+
+       contact = e_contact_new_from_vcard (arbitrary_vcard);
+
+       if (!e_book_client_add_contact_sync (book_client, contact, NULL, NULL, &error))
+               g_error ("Failed to add contact: %s", error->message);
+
+       if (!e_book_client_remove_contact_sync (book_client, contact, NULL, &error))
+               g_error ("Failed to remove contact: %s", error->message);
+
+       g_object_unref (contact);
+}
+
+static GSList *
+test_query (EBookClient *book_client,
+           gint         expected_results,
+           EBookQuery  *query)
+{
+       GSList *contacts = NULL;
+       GError *error = NULL;
+       gchar *sexp;
+
+       sexp = e_book_query_to_string (query);
+
+       if (!e_book_client_get_contacts_sync (book_client, sexp,
+                                             &contacts, NULL, &error))
+               g_error ("Failed to fetch contacts: %s", error->message);
+
+       g_free (sexp);
+       e_book_query_unref (query);
+
+       g_assert_cmpint (g_slist_length (contacts), ==, expected_results);
+
+       return contacts;
+}
+
+static void
+test_query_email (MigrationFixture *fixture,
+                 gconstpointer     user_data)
+{
+       EBookClient *book_client;
+       GSList *contacts = NULL;
+
+       book_client = E_TEST_SERVER_UTILS_SERVICE (fixture, EBookClient);
+
+       contacts = test_query (book_client, 13,
+                              e_book_query_field_test (
+                                      E_CONTACT_EMAIL,
+                                      E_BOOK_QUERY_ENDS_WITH,
+                                      ".com"));
+
+       g_slist_free_full (contacts, g_object_unref);
+}
+
+static void
+test_query_name (MigrationFixture *fixture,
+                 gconstpointer     user_data)
+{
+       EBookClient *book_client;
+       GSList *contacts = NULL;
+
+       book_client = E_TEST_SERVER_UTILS_SERVICE (fixture, EBookClient);
+
+       contacts = test_query (book_client, 4,
+                              e_book_query_field_test (
+                                      E_CONTACT_FULL_NAME,
+                                      E_BOOK_QUERY_CONTAINS,
+                                      "cote"));
+
+       g_slist_free_full (contacts, g_object_unref);
+}
+
+static void
+test_query_phone (MigrationFixture *fixture,
+                 gconstpointer     user_data)
+{
+       EBookClient *book_client;
+       GSList *contacts = NULL;
+
+       book_client = E_TEST_SERVER_UTILS_SERVICE (fixture, EBookClient);
+
+       contacts = test_query (book_client, 4,
+                              e_book_query_field_test (
+                                      E_CONTACT_TEL,
+                                      E_BOOK_QUERY_CONTAINS,
+                                      "221"));
+
+       g_slist_free_full (contacts, g_object_unref);
+}
+
+/***********************************************************
+ *                          Main                           *
+ ***********************************************************/
+static GList *
+list_migration_sandboxes (void)
+{
+       GDir *dir;
+       GError *error = NULL;
+       const gchar *filename;
+       GList *sandboxes = NULL;
+
+       dir = g_dir_open (EDS_TEST_BOOKS, 0, &error);
+       if (!dir)
+               g_error ("Failed to open migration sandbox directory '%s': %s",
+                        EDS_TEST_BOOKS, error->message);
+
+       while ((filename = g_dir_read_name (dir)) != NULL) {
+
+               gchar *fullpath = g_build_filename (EDS_TEST_BOOKS, filename, NULL);
+
+               if (g_file_test (fullpath, G_FILE_TEST_IS_DIR)) {
+
+#if defined (TEST_VERSIONS_WITH_BDB)
+                       sandboxes = g_list_prepend (sandboxes, g_strdup (filename));
+#else
+                       /* We allow compilation of EDS on a system without the db_load utility, if this
+                        * is the case then we skip the migration tests from versions of EDS where we
+                        * used Berkeley DB
+                        */
+                       gchar *old_bdb = g_build_filename (EDS_TEST_BOOKS, filename, "addressbook.dump", 
NULL);
+
+                       if (!g_file_test (old_bdb, G_FILE_TEST_EXISTS))
+                               sandboxes = g_list_prepend (sandboxes, g_strdup (filename));
+
+                       g_free (old_bdb);
+#endif
+               }
+
+               g_free (fullpath);
+       }
+
+       g_dir_close (dir);
+
+       return sandboxes;
+}
+
+static void
+migration_closure_free (MigrationClosure *closure)
+{
+       g_free (closure->version);
+       g_slice_free (MigrationClosure, closure);
+}
+
+static void
+add_test (const gchar *version,
+         const gchar *test_name,
+         MigrationTestFunc test_func)
+{
+       MigrationClosure *closure;
+       gchar *path;
+
+       closure = g_slice_new0 (MigrationClosure);
+
+       closure->parent.type = E_TEST_SERVER_ADDRESS_BOOK;
+       closure->parent.destroy_closure_func = (GDestroyNotify)migration_closure_free;
+       closure->parent.keep_work_directory = TRUE;
+       closure->version = g_strdup (version);
+
+       path = g_strdup_printf ("/Migration/From-%s/%s",
+                               version, test_name);
+
+       g_test_add (path, MigrationFixture, closure,
+                   migration_fixture_setup,
+                   test_func,
+                   migration_fixture_teardown);
+
+       g_free (path);
+}
+
+gint
+main (gint argc,
+      gchar **argv)
+{
+       GList *sandboxes, *l;
+       gint ret;
+
+#if !GLIB_CHECK_VERSION (2, 35, 1)
+       g_type_init ();
+#endif
+       g_test_init (&argc, &argv, NULL);
+       g_test_bug_base ("http://bugzilla.gnome.org/";);
+
+       sandboxes = list_migration_sandboxes ();
+
+       for (l = sandboxes; l; l = l->next) {
+               gchar *version = l->data;
+
+               add_test (version, "Open", test_open);
+               add_test (version, "FetchContacts", test_fetch_contacts);
+               add_test (version, "AddRemoveContact", test_add_remove_contact);
+               add_test (version, "Query/FullName", test_query_name);
+               add_test (version, "Query/Phone", test_query_phone);
+               add_test (version, "Query/Email", test_query_email);
+       }
+
+       g_list_free_full (sandboxes, g_free);
+
+       ret = e_test_server_utils_run ();
+
+       return ret;
+}
diff --git a/tests/book-migration/vcards/migrate-1.vcf b/tests/book-migration/vcards/migrate-1.vcf
new file mode 100644
index 0000000..bd4fdbf
--- /dev/null
+++ b/tests/book-migration/vcards/migrate-1.vcf
@@ -0,0 +1,6 @@
+BEGIN:VCARD
+UID:sorted-1
+N:bad;First Name
+TEL;HOME:+1-221-5423789
+EMAIL;TYPE=home,work:micheal jackson com
+END:VCARD
diff --git a/tests/book-migration/vcards/migrate-10.vcf b/tests/book-migration/vcards/migrate-10.vcf
new file mode 100644
index 0000000..3fbb99b
--- /dev/null
+++ b/tests/book-migration/vcards/migrate-10.vcf
@@ -0,0 +1,6 @@
+BEGIN:VCARD
+UID:sorted-10
+N:C;First Name
+TEL;HOME:+1-221-5423789
+EMAIL;TYPE=home,work:mister jackson com
+END:VCARD
diff --git a/tests/book-migration/vcards/migrate-11.vcf b/tests/book-migration/vcards/migrate-11.vcf
new file mode 100644
index 0000000..b820cc8
--- /dev/null
+++ b/tests/book-migration/vcards/migrate-11.vcf
@@ -0,0 +1,6 @@
+BEGIN:VCARD
+UID:sorted-11
+FN:Ye Nameless One
+TEL;HOME:+1-221-5423789
+EMAIL;TYPE=home,work:name less com
+END:VCARD
diff --git a/tests/book-migration/vcards/migrate-12.vcf b/tests/book-migration/vcards/migrate-12.vcf
new file mode 100644
index 0000000..b600d03
--- /dev/null
+++ b/tests/book-migration/vcards/migrate-12.vcf
@@ -0,0 +1,7 @@
+BEGIN:VCARD
+UID:sorted-12
+N:coté;First Name
+TEL;HOME:514-845-8436
+EMAIL;TYPE=home,work:pink pony com
+END:VCARD
+
diff --git a/tests/book-migration/vcards/migrate-13.vcf b/tests/book-migration/vcards/migrate-13.vcf
new file mode 100644
index 0000000..a13875c
--- /dev/null
+++ b/tests/book-migration/vcards/migrate-13.vcf
@@ -0,0 +1,6 @@
+BEGIN:VCARD
+UID:sorted-13
+N:côte;First Name
+TEL;HOME:514-845-8436
+EMAIL;TYPE=home,work:pink pony org
+END:VCARD
diff --git a/tests/book-migration/vcards/migrate-14.vcf b/tests/book-migration/vcards/migrate-14.vcf
new file mode 100644
index 0000000..cd803b5
--- /dev/null
+++ b/tests/book-migration/vcards/migrate-14.vcf
@@ -0,0 +1,6 @@
+BEGIN:VCARD
+UID:sorted-14
+N:cote;First Name
+TEL;HOME:514-845-8436
+EMAIL;TYPE=home,work:pink pony com
+END:VCARD
diff --git a/tests/book-migration/vcards/migrate-15.vcf b/tests/book-migration/vcards/migrate-15.vcf
new file mode 100644
index 0000000..403bc70
--- /dev/null
+++ b/tests/book-migration/vcards/migrate-15.vcf
@@ -0,0 +1,6 @@
+BEGIN:VCARD
+UID:sorted-15
+N:black-bird;First Name
+TEL;HOME:514-845-8436
+EMAIL;TYPE=home,work:pink pony org
+END:VCARD
diff --git a/tests/book-migration/vcards/migrate-16.vcf b/tests/book-migration/vcards/migrate-16.vcf
new file mode 100644
index 0000000..6e845db
--- /dev/null
+++ b/tests/book-migration/vcards/migrate-16.vcf
@@ -0,0 +1,6 @@
+BEGIN:VCARD
+UID:sorted-16
+N:blackbird;First Name
+TEL;HOME:514-845-8436
+EMAIL;TYPE=home,work:pink pony com
+END:VCARD
diff --git a/tests/book-migration/vcards/migrate-17.vcf b/tests/book-migration/vcards/migrate-17.vcf
new file mode 100644
index 0000000..5f62f4d
--- /dev/null
+++ b/tests/book-migration/vcards/migrate-17.vcf
@@ -0,0 +1,6 @@
+BEGIN:VCARD
+UID:sorted-17
+N:black-birds;First Name
+TEL;HOME:514-845-8436
+EMAIL;TYPE=home,work:pink pony com
+END:VCARD
diff --git a/tests/book-migration/vcards/migrate-18.vcf b/tests/book-migration/vcards/migrate-18.vcf
new file mode 100644
index 0000000..c3c3b69
--- /dev/null
+++ b/tests/book-migration/vcards/migrate-18.vcf
@@ -0,0 +1,6 @@
+BEGIN:VCARD
+UID:sorted-18
+N:blackbirds;First Name
+TEL;HOME:514-845-8436
+EMAIL;TYPE=home,work:pink pony com
+END:VCARD
diff --git a/tests/book-migration/vcards/migrate-19.vcf b/tests/book-migration/vcards/migrate-19.vcf
new file mode 100644
index 0000000..2971aa2
--- /dev/null
+++ b/tests/book-migration/vcards/migrate-19.vcf
@@ -0,0 +1,6 @@
+BEGIN:VCARD
+UID:sorted-19
+N:Muffler;First Name
+TEL;HOME:514-845-8436
+EMAIL;TYPE=home,work:pink pony net
+END:VCARD
diff --git a/tests/book-migration/vcards/migrate-2.vcf b/tests/book-migration/vcards/migrate-2.vcf
new file mode 100644
index 0000000..9a9b8a2
--- /dev/null
+++ b/tests/book-migration/vcards/migrate-2.vcf
@@ -0,0 +1,7 @@
+BEGIN:VCARD
+UID:sorted-2
+N:Bad;First Name
+TEL;HOME:7654321
+EMAIL:janet jackson com
+EMAIL:janny jackson com
+END:VCARD
diff --git a/tests/book-migration/vcards/migrate-20.vcf b/tests/book-migration/vcards/migrate-20.vcf
new file mode 100644
index 0000000..2d4c8ee
--- /dev/null
+++ b/tests/book-migration/vcards/migrate-20.vcf
@@ -0,0 +1,6 @@
+BEGIN:VCARD
+UID:sorted-20
+N:Müller;First Name
+TEL;HOME:514-845-8436
+EMAIL;TYPE=home,work:pink pony net
+END:VCARD
diff --git a/tests/book-migration/vcards/migrate-3.vcf b/tests/book-migration/vcards/migrate-3.vcf
new file mode 100644
index 0000000..5f75eeb
--- /dev/null
+++ b/tests/book-migration/vcards/migrate-3.vcf
@@ -0,0 +1,7 @@
+BEGIN:VCARD
+UID:sorted-3
+N:Bat;First Name
+TEL;HOME:+9999999
+EMAIL;TYPE=work:bobby brown org
+EMAIL;TYPE=home,work:bobby brown com
+END:VCARD
diff --git a/tests/book-migration/vcards/migrate-4.vcf b/tests/book-migration/vcards/migrate-4.vcf
new file mode 100644
index 0000000..e2fb999
--- /dev/null
+++ b/tests/book-migration/vcards/migrate-4.vcf
@@ -0,0 +1,6 @@
+BEGIN:VCARD
+UID:sorted-4
+N:bat;First Name
+TEL;TYPE=work,pref:+9999999
+EMAIL:警察 brown org
+END:VCARD
diff --git a/tests/book-migration/vcards/migrate-5.vcf b/tests/book-migration/vcards/migrate-5.vcf
new file mode 100644
index 0000000..10360d6
--- /dev/null
+++ b/tests/book-migration/vcards/migrate-5.vcf
@@ -0,0 +1,6 @@
+BEGIN:VCARD
+UID:sorted-5
+N:bäd;First Name
+TEL;HOME:+6666666
+EMAIL;TYPE=home,work:救命 brown com
+END:VCARD
diff --git a/tests/book-migration/vcards/migrate-6.vcf b/tests/book-migration/vcards/migrate-6.vcf
new file mode 100644
index 0000000..2af7b7d
--- /dev/null
+++ b/tests/book-migration/vcards/migrate-6.vcf
@@ -0,0 +1,5 @@
+BEGIN:VCARD
+UID:sorted-6
+N:Bäd;First Name
+TEL;HOME:ask Jenny for Lisa's number
+END:VCARD
diff --git a/tests/book-migration/vcards/migrate-7.vcf b/tests/book-migration/vcards/migrate-7.vcf
new file mode 100644
index 0000000..4a9c3e6
--- /dev/null
+++ b/tests/book-migration/vcards/migrate-7.vcf
@@ -0,0 +1,5 @@
+BEGIN:VCARD
+UID:sorted-7
+N:bät;First Name
+TEL;HOME:+49-89-7888 99
+END:VCARD
diff --git a/tests/book-migration/vcards/migrate-8.vcf b/tests/book-migration/vcards/migrate-8.vcf
new file mode 100644
index 0000000..456181e
--- /dev/null
+++ b/tests/book-migration/vcards/migrate-8.vcf
@@ -0,0 +1,6 @@
+BEGIN:VCARD
+UID:sorted-8
+N:Bät;First Name
+TEL;HOME:+31-221-5423789
+EMAIL;TYPE=home,work:purple pony com
+END:VCARD
diff --git a/tests/book-migration/vcards/migrate-9.vcf b/tests/book-migration/vcards/migrate-9.vcf
new file mode 100644
index 0000000..a5ed36b
--- /dev/null
+++ b/tests/book-migration/vcards/migrate-9.vcf
@@ -0,0 +1,6 @@
+BEGIN:VCARD
+UID:sorted-9
+N:côté;First Name
+TEL;HOME:514-845-8436
+EMAIL;TYPE=home,work:jim morrison com
+END:VCARD


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