[evolution-kolab/ek-wip-porting] tests/integration: build fixes for Camel API changes



commit b2955df323d3b1e90b7189d36b2577aea3d883c2
Author: Christian Hilberg <hilberg kernelconcepts de>
Date:   Fri Dec 9 11:57:26 2011 +0100

    tests/integration: build fixes for Camel API changes
    
    * replaced CamelException by GError
    * added GCancellable* args where needed (for the tests, these
      are NULL since we won't cancel the tests)
    * added LIBADD libs to enable local build
    * pending: rewrite for CamelSettings (user/passwd disabled
      currently)
    * disabled unused "test-camel-kolab-imapx-provider"
    * disabled unused "test-kolab-util-ldap"

 .../test-camel-kolab-imapx-provider.c              |   15 ++--
 src/tests/integration/libekolab/Makefile.am        |   16 +++-
 .../integration/libekolab/test-kolab-mail-access.c |   81 +++++++++++---------
 .../libekolab/test-kolab-util-cal-freebusy.c       |   67 ++++++++++------
 .../integration/libekolab/test-kolab-util-http.c   |   52 +++++++++----
 .../integration/libekolab/test-kolab-util-ldap.c   |   21 +++--
 6 files changed, 159 insertions(+), 93 deletions(-)
---
diff --git a/src/tests/integration/libcamelkolab/test-camel-kolab-imapx-provider.c b/src/tests/integration/libcamelkolab/test-camel-kolab-imapx-provider.c
index 8ecf3d4..da2fb74 100644
--- a/src/tests/integration/libcamelkolab/test-camel-kolab-imapx-provider.c
+++ b/src/tests/integration/libcamelkolab/test-camel-kolab-imapx-provider.c
@@ -12,12 +12,12 @@
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
- * 
+ *
  * 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
  * Lesser 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
@@ -48,6 +48,9 @@
 gint
 main (gint argc, gchar *argv [])
 {
+	(void)argc;
+	(void)argv;
+#if 0
 	CamelSession *session = NULL;
 	CamelException *ex;
 	gchar *uri = NULL;
@@ -71,7 +74,7 @@ main (gint argc, gchar *argv [])
 		g_debug ("could not create new session object");
 		return 0;
 	}
-	
+
 	camel_session_construct (session, "/tmp/test-camel-imapx");
 
 	service = camel_session_get_service (session,
@@ -89,7 +92,7 @@ main (gint argc, gchar *argv [])
 		}
 		return 0;
 	}
-	
+
 	camel_service_connect (service, ex);
 	if (ex) {
 		g_debug ("connect failed: %s",
@@ -103,8 +106,8 @@ main (gint argc, gchar *argv [])
 	camel_folder_refresh_info (folder, NULL);
 
 	while (1); /* never reached */
-
-	return 0;
+#endif
+	return -1;
 }
 
 /*---------------------------------------------------------------------------*/
diff --git a/src/tests/integration/libekolab/Makefile.am b/src/tests/integration/libekolab/Makefile.am
index deccea8..b934dd5 100644
--- a/src/tests/integration/libekolab/Makefile.am
+++ b/src/tests/integration/libekolab/Makefile.am
@@ -17,8 +17,19 @@ test_kolab_mail_access_CFLAGS = \
 	$(ADD_CFLAGS)
 
 test_kolab_mail_access_LDADD =            \
-	$(GLIB_LIBS)            \
-	$(KOLAB_LIB_EKOLABBACKEND)
+	$(CAMEL_LIBS) \
+	$(SQLITE_LIBS) \
+	$(EDS_LIBS) \
+	$(GLIB_LIBS) \
+	$(ICAL_LIBS) \
+	$(KOLAB_LIB_CAMEL) \
+	$(KOLAB_LIB_EKOLAB) \
+	$(KOLAB_LIB_EKOLABBACKEND) \
+	$(KOLAB_LIB_EKOLABUTIL) \
+	$(KOLAB_LIB_EKOLABCONVEVOLUTION) \
+	$(KOLAB_LIB_EKOLABCONVKOLAB) \
+	$(KOLAB_LIB_EKOLABCONVSTRUCTS) \
+	$(KOLAB_LIB_EKOLABCONV)
 
 test_kolab_util_ldap_SOURCES = \
 	test-kolab-util-ldap.c
@@ -87,4 +98,3 @@ EXTRA_DIST = \
 	test-kolab-mail-access.conf
 
 ## File created by the gnome-build tools
-
diff --git a/src/tests/integration/libekolab/test-kolab-mail-access.c b/src/tests/integration/libekolab/test-kolab-mail-access.c
index 0f435b7..89bea5c 100644
--- a/src/tests/integration/libekolab/test-kolab-mail-access.c
+++ b/src/tests/integration/libekolab/test-kolab-mail-access.c
@@ -12,17 +12,17 @@
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
- * 
+ *
  * 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
  * Lesser 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
  */
- 
+
 /*----------------------------------------------------------------------------*/
 
 #define _GNU_SOURCE
@@ -74,11 +74,11 @@ kolab_itest_koma_ksettings_envset (KolabSettingsHandler *ksettings,
 	g_return_val_if_fail (err == NULL || *err == NULL, FALSE);
 
 	key_file = g_key_file_new ();
-	
+
 	config = g_strdup (TESTCASE ".conf");
 	g_return_val_if_fail (g_key_file_load_from_file (key_file, config, G_KEY_FILE_NONE, NULL), FALSE);
 	g_free (config);
-	
+
 	servername = g_key_file_get_string (key_file, TESTCASE, "servername", NULL);
 	imapport = g_key_file_get_integer (key_file, TESTCASE, "imapport", NULL);
 	username = g_key_file_get_string (key_file, AUTH, "username", NULL);
@@ -87,7 +87,7 @@ kolab_itest_koma_ksettings_envset (KolabSettingsHandler *ksettings,
 	tls_variant = g_key_file_get_integer (key_file, SECURITY, "tls_variant", NULL);
 
 	g_key_file_free (key_file);
-	
+
 	g_assert (servername != NULL);
 	g_assert (imapport > 0);
 	g_assert (username != NULL);
@@ -113,7 +113,7 @@ kolab_itest_koma_ksettings_envset (KolabSettingsHandler *ksettings,
 		g_propagate_error (err, tmp_err);
 		return FALSE;
 	}
-	
+
 	ok = kolab_settings_handler_set_char_field (ksettings,
 	                                            KOLAB_SETTINGS_HANDLER_CHAR_FIELD_KOLAB_USER_NAME,
 	                                            username,
@@ -149,7 +149,7 @@ kolab_itest_koma_ksettings_envset (KolabSettingsHandler *ksettings,
 		g_propagate_error (err, tmp_err);
 		return FALSE;
 	}
-	
+
 	return TRUE;
 }
 
@@ -198,6 +198,7 @@ test_kolab_mail_access_retrieve_store (KolabMailAccess *kmailaccess,
 			kmh = kolab_mail_access_get_handle (kmailaccess,
 			                                    uid,
 			                                    sourcename,
+			                                    NULL,
 			                                    &tmp_err);
 			if (tmp_err != NULL) {
 				g_warning ("%s: %s",
@@ -210,6 +211,7 @@ test_kolab_mail_access_retrieve_store (KolabMailAccess *kmailaccess,
 			r_ok = kolab_mail_access_retrieve_handle (kmailaccess,
 			                                          kmh,
 			                                          TRUE, /* bulk operation */
+			                                          NULL,
 			                                          &tmp_err);
 			if (! r_ok) {
 				g_warning ("%s: %s",
@@ -220,27 +222,28 @@ test_kolab_mail_access_retrieve_store (KolabMailAccess *kmailaccess,
 			}
 
 			switch (context) {
-				case KOLAB_FOLDER_CONTEXT_CALENDAR:
-					ecalcomp = kolab_mail_handle_get_ecalcomponent (kmh);
-					timezone = kolab_mail_handle_get_timezone (kmh);
-					kmh_s = kolab_mail_handle_new_from_ecalcomponent (ecalcomp,
-					                                                  timezone);
-					g_object_unref (ecalcomp);
-					if (timezone != NULL)
-						g_object_unref (timezone);
-					break;
-				case KOLAB_FOLDER_CONTEXT_CONTACT:
-					econtact = kolab_mail_handle_get_econtact (kmh);
-					kmh_s = kolab_mail_handle_new_from_econtact (econtact);
-					g_object_unref (econtact);
-					break;
-				default:
-					g_assert_not_reached();
+			case KOLAB_FOLDER_CONTEXT_CALENDAR:
+				ecalcomp = kolab_mail_handle_get_ecalcomponent (kmh);
+				timezone = kolab_mail_handle_get_timezone (kmh);
+				kmh_s = kolab_mail_handle_new_from_ecalcomponent (ecalcomp,
+				                                                  timezone);
+				g_object_unref (ecalcomp);
+				if (timezone != NULL)
+					g_object_unref (timezone);
+				break;
+			case KOLAB_FOLDER_CONTEXT_CONTACT:
+				econtact = kolab_mail_handle_get_econtact (kmh);
+				kmh_s = kolab_mail_handle_new_from_econtact (econtact);
+				g_object_unref (econtact);
+				break;
+			default:
+				g_assert_not_reached();
 			}
 
 			s_ok = kolab_mail_access_store_handle (kmailaccess,
 			                                       kmh_s,
 			                                       sourcename,
+			                                       NULL,
 			                                       &tmp_err);
 			if (! s_ok) {
 				g_warning ("%s: %s",
@@ -249,7 +252,7 @@ test_kolab_mail_access_retrieve_store (KolabMailAccess *kmailaccess,
 				tmp_err = NULL;
 			}
 
-skip:
+		skip:
 			uids_lst_ptr = g_list_next (uids_lst_ptr);
 		}
 
@@ -276,7 +279,7 @@ test_kolab_mail_access (KolabFolderContextID context)
 		goto test_part_cleanup;
 
 	/* create settings handler object */
-	ksettings = KOLAB_SETTINGS_HANDLER (g_object_new (KOLAB_TYPE_SETTINGS_HANDLER, NULL));	
+	ksettings = KOLAB_SETTINGS_HANDLER (g_object_new (KOLAB_TYPE_SETTINGS_HANDLER, NULL));
 
 	/* configure settings */
 	ok = kolab_settings_handler_configure (ksettings,
@@ -284,7 +287,7 @@ test_kolab_mail_access (KolabFolderContextID context)
 	                                       &tmp_err);
 	if (! ok)
 		goto test_part_cleanup;
-		
+
 	ok = kolab_settings_handler_bringup (ksettings, &tmp_err);
 	if (! ok)
 		goto test_part_cleanup;
@@ -302,13 +305,16 @@ test_kolab_mail_access (KolabFolderContextID context)
 		goto test_part_cleanup;
 
 	/* test operational mode switching configured->offline */
-	ok = kolab_mail_access_bringup (kmailaccess, &tmp_err);
+	ok = kolab_mail_access_bringup (kmailaccess,
+	                                NULL,
+	                                &tmp_err);
 	if (! ok)
 		goto test_part_cleanup;
 
 	/* test operational mode switching offline->online */
 	ok = kolab_mail_access_set_opmode (kmailaccess,
 	                                   KOLAB_MAIL_ACCESS_OPMODE_ONLINE,
+	                                   NULL,
 	                                   &tmp_err);
 	if (! ok)
 		goto test_part_cleanup;
@@ -323,19 +329,22 @@ test_kolab_mail_access (KolabFolderContextID context)
 	/* test operational mode switching online->offline */
 	ok = kolab_mail_access_set_opmode (kmailaccess,
 	                                   KOLAB_MAIL_ACCESS_OPMODE_OFFLINE,
+	                                   NULL,
 	                                   &tmp_err);
 	if (! ok)
 		goto test_part_cleanup;
-	
+
 	/* shutdown subsystems */
-	ok = kolab_mail_access_shutdown (kmailaccess, &tmp_err);
+	ok = kolab_mail_access_shutdown (kmailaccess,
+	                                 NULL,
+	                                 &tmp_err);
 	if (! ok)
 		goto test_part_cleanup;
-	
+
 	ok = kolab_settings_handler_shutdown (ksettings, &tmp_err);
 
-test_part_cleanup:
-	
+ test_part_cleanup:
+
 	if (kmailaccess != NULL)
 		g_object_unref (kmailaccess);
 	if (ksettings != NULL)
@@ -347,7 +356,7 @@ test_part_cleanup:
 		tmp_err = NULL;
 		rval = FALSE;
 	}
-	
+
 	/* shut down camel */
 	ok = kolab_util_camel_shutdown (&tmp_err);
 	if (! ok) {
@@ -374,7 +383,7 @@ main (gint argc, gchar **argv)
 
 	/* init glib */
 	kolab_util_glib_init ();
-	
+
 	pid = fork();
 	if (pid == -1) {
 		g_warning ("%s: could not fork()", __func__);
@@ -389,7 +398,7 @@ main (gint argc, gchar **argv)
 			chldexit = WEXITSTATUS (status);
 			if (chldexit != EXIT_SUCCESS) {
 				g_warning ("%s: child process exited unsuccessfully (code %i)",
-					   __func__, chldexit);
+				           __func__, chldexit);
 				return EXIT_FAILURE;
 			}
 		}
diff --git a/src/tests/integration/libekolab/test-kolab-util-cal-freebusy.c b/src/tests/integration/libekolab/test-kolab-util-cal-freebusy.c
index c5135de..524993e 100644
--- a/src/tests/integration/libekolab/test-kolab-util-cal-freebusy.c
+++ b/src/tests/integration/libekolab/test-kolab-util-cal-freebusy.c
@@ -12,17 +12,17 @@
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
- * 
+ *
  * 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
  * Lesser 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
  */
- 
+
 /*----------------------------------------------------------------------------*/
 
 #define _GNU_SOURCE
@@ -73,6 +73,8 @@ typedef struct _KolabITestFB {
 static void
 kolab_itest_fb_init (KolabITestFB *kitfb, GKeyFile *key_file)
 {
+	GError *tmp_err = NULL;
+
 	kitfb->out_fn = g_key_file_get_string (key_file,
 	                                       TESTCASE,
 	                                       kitfb->out_cfgkey,
@@ -86,13 +88,14 @@ kolab_itest_fb_init (KolabITestFB *kitfb, GKeyFile *key_file)
 	/* open filestreams */
 	kitfb->out_fs = camel_kolab_stream_new_filestream (kitfb->out_fn,
 	                                                   O_RDWR|O_CREAT|O_TRUNC,
-	                                                   0600);
-	g_assert (kitfb->out_fs != NULL);
+	                                                   0600,
+	                                                   &tmp_err);
+	g_assert (kitfb->out_fs != NULL); /* means tmp_err is NULL */
 	/* TODO use this for result comparison
-	kitfb->cmp_fs = camel_kolab_stream_new_filestream (kitfb->cmp_fn,
-	                                                   O_RD,
-	                                                   NULL);
-	g_assert (kitfb->cmp_fs != NULL);
+	 * kitfb->cmp_fs = camel_kolab_stream_new_filestream (kitfb->cmp_fn,
+	 *                                                    O_RD,
+	 *                                                    NULL);
+	 *  g_assert (kitfb->cmp_fs != NULL);
 	*/
 }
 
@@ -140,14 +143,14 @@ test_kolab_util_cal_freebusy (void)
 
 	kitfb[FBL_XFB].out_cfgkey = g_strdup ("xfb_out_fn");
 	kitfb[FBL_XFB].cmp_cfgkey = g_strdup ("xfb_cmp_fn");
-	
+
 	/* init subsystems */
 	kolab_util_glib_init ();
 	kolab_util_http_init ();
 	/* libcamel
 	 *
 	 * Curl init may configure the underlying SSL lib,
-	 * but as far as SSL goes, we want Camel to rule here 
+	 * but as far as SSL goes, we want Camel to rule here
 	 *
 	 * TODO check whether Camel session needs to be
 	 *      initialized before or after libcurl
@@ -162,18 +165,18 @@ test_kolab_util_cal_freebusy (void)
 
 	/* get config */
 	key_file = g_key_file_new ();
-	
+
 	config = g_strdup (TESTCASE ".conf");
 	g_return_val_if_fail (g_key_file_load_from_file (key_file, config, G_KEY_FILE_NONE, NULL), FALSE);
 
 	for (ii = 0; ii < KOLABCONV_FB_LASTTYPE; ii++)
 		kolab_itest_fb_init (&(kitfb[ii]), key_file);
-		
+
 	url_string = g_key_file_get_string (key_file, TESTCASE, "url", NULL);
 	username = g_key_file_get_string (key_file, AUTH, "username", NULL);
 	password = g_key_file_get_string (key_file, AUTH, "password", NULL);
-	pkcs11pin = g_key_file_get_string (key_file, SECURITY, "pkcs11pin", NULL);	
-	
+	pkcs11pin = g_key_file_get_string (key_file, SECURITY, "pkcs11pin", NULL);
+
 	g_return_val_if_fail (url_string != NULL, FALSE);
 	g_return_val_if_fail (username != NULL, FALSE);
 	g_return_val_if_fail (password != NULL, FALSE);
@@ -182,12 +185,18 @@ test_kolab_util_cal_freebusy (void)
 	/* create KolabHttpJob */
 	job = kolab_http_job_new ();
 	job->pkcs11pin = pkcs11pin;
-	
+
 	/* create CamelURL object */
 	job->url = camel_url_new (url_string, 0);
 	g_assert (job->url != NULL);
+
+	/* FIXME rewrite this for CamelSettings */
+	g_error ("%s: FIXME rewrite this for CamelSettings", __func__);
+#if 0
 	camel_url_set_user (job->url, username);
 	camel_url_set_passwd (job->url, password);
+#endif
+
 	g_free (url_string);
 	g_free (username);
 	g_free (password);
@@ -221,31 +230,41 @@ test_kolab_util_cal_freebusy (void)
 			/* write to file */
 			obytes = camel_stream_write (kitfb[ii].out_fs,
 			                             calobj,
-			                             nbytes);
-			g_debug ("%s: wrote %d bytes", __func__, obytes);
+			                             nbytes,
+			                             NULL,
+			                             &tmp_err);
+			if (tmp_err == NULL) {
+				g_debug ("%s: wrote %d bytes", __func__, obytes);
+			} else {
+				/* TODO break test execution here */
+				g_warning ("%s: %s",
+				           __func__, tmp_err->message);
+				g_free (tmp_err);
+				tmp_err = NULL;
+			}
 			g_free (calobj);
 		}
 		kolab_cal_util_fb_ecalcomp_free (ecalcomp);
 		/* TODO check result file */
 	}
-	
+
 	/* cleanup */
 	for (ii = 0; ii < KOLABCONV_FB_LASTTYPE; ii++)
 		kolab_itest_fb_uninit (&(kitfb[ii]));
-	
+
 	kolab_http_job_free (job);
 	g_key_file_free (key_file);
 	g_free (config);
-	
+
 	/* shutdown subsystems */
 	kolab_util_glib_shutdown ();
 	kolab_util_http_shutdown ();
 
 	/* libcamel */
 	/* ATTN camel_shutdown () currently segfaults when NSS
-         *      is using openCryptoki infrastructure. Be sure
+	 *      is using openCryptoki infrastructure. Be sure
 	 *      to call camel_kolab_session_shutdown() only
-         *      after all other libs have been shut down
+	 *      after all other libs have been shut down
 	 */
 	ok = kolab_util_camel_shutdown (&tmp_err);
 	if (! ok) {
@@ -269,7 +288,7 @@ main (gint argc, gchar **argv)
 	ok = test_kolab_util_cal_freebusy ();
 	if (! ok)
 		return EXIT_FAILURE;
-	
+
 	return EXIT_SUCCESS;
 }
 
diff --git a/src/tests/integration/libekolab/test-kolab-util-http.c b/src/tests/integration/libekolab/test-kolab-util-http.c
index 597045d..0c589aa 100644
--- a/src/tests/integration/libekolab/test-kolab-util-http.c
+++ b/src/tests/integration/libekolab/test-kolab-util-http.c
@@ -12,17 +12,17 @@
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
- * 
+ *
  * 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
  * Lesser 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
  */
- 
+
 /*----------------------------------------------------------------------------*/
 
 #define _GNU_SOURCE
@@ -67,14 +67,14 @@ test_kolab_util_http (void)
 	GKeyFile* key_file = NULL;
 	gboolean ok = FALSE;
 	GError *tmp_err = NULL;
-	
+
 	/* init subsystems */
 	kolab_util_glib_init ();
 	kolab_util_http_init ();
 	/* libcamel
 	 *
 	 * Curl init may configure the underlying SSL lib,
-	 * but as far as SSL goes, we want Camel to rule here 
+	 * but as far as SSL goes, we want Camel to rule here
 	 *
 	 * TODO check whether Camel session needs to be
 	 *      initialized before or after libcurl
@@ -89,7 +89,7 @@ test_kolab_util_http (void)
 
 	/* get config */
 	key_file = g_key_file_new ();
-	
+
 	config = g_strdup (TESTCASE ".conf");
 	g_return_val_if_fail (g_key_file_load_from_file (key_file, config, G_KEY_FILE_NONE, NULL), FALSE);
 
@@ -99,7 +99,7 @@ test_kolab_util_http (void)
 	username = g_key_file_get_string (key_file, AUTH, "username", NULL);
 	password = g_key_file_get_string (key_file, AUTH, "password", NULL);
 	pkcs11pin = g_key_file_get_string (key_file, SECURITY, "pkcs11pin", NULL);
-	
+
 	g_return_val_if_fail (outfilename != NULL, FALSE);
 	g_return_val_if_fail (cmpfilename != NULL, FALSE);
 	g_return_val_if_fail (url_string  != NULL, FALSE);
@@ -110,20 +110,32 @@ test_kolab_util_http (void)
 	/* create KolabHttpJob */
 	job = kolab_http_job_new ();
 	job->pkcs11pin = pkcs11pin;
-	
+
 	/* create CamelURL object */
 	job->url = camel_url_new (url_string, 0);
 	g_assert (job->url != NULL);
+
+	/* FIXME rewrite this for CamelSettings */
+	g_error ("%s: FIXME rewrite this for CamelSettings", __func__);
+#if 0
 	camel_url_set_user (job->url, username);
 	camel_url_set_passwd (job->url, password);
+#endif
+
 	g_free (url_string);
 	g_free (username);
 	g_free (password);
-	
+
 	/* open filestream */
 	file_stream = camel_kolab_stream_new_filestream (outfilename,
 	                                                 O_RDWR|O_CREAT|O_TRUNC,
-	                                                 0600);
+	                                                 0600,
+	                                                 &tmp_err);
+	if (tmp_err != NULL) {
+		g_warning ("%s: %s",
+		           __func__, tmp_err->message);
+		g_error_free (tmp_err);
+	}
 	g_return_val_if_fail (file_stream != NULL, FALSE);
 
 	/* allocate buffer for data from HTTP GET */
@@ -136,13 +148,21 @@ test_kolab_util_http (void)
 	/* write data to file */
 	nbytes = camel_stream_write (file_stream,
 	                             (gchar*)job->buffer->data,
-	                             (gsize)job->buffer->len);
+	                             (gsize)job->buffer->len,
+	                             NULL,
+	                             &tmp_err);
+	if (tmp_err != NULL) {
+		g_warning ("%s: %s",
+		           __func__, tmp_err->message);
+		g_error_free (tmp_err);
+		tmp_err = NULL;
+	}
 	g_debug ("%s: %d bytes written", __func__, nbytes);
-	
+
 	/* TODO check result file
 	 *      (should return EXIT_FAILURE if unsuccessful)
 	 */
-	
+
 	/* cleanup */
 	kolab_http_job_free (job);
 	camel_kolab_stream_free (file_stream);
@@ -157,9 +177,9 @@ test_kolab_util_http (void)
 
 	/* libcamel */
 	/* ATTN camel_shutdown () currently segfaults when NSS
-         *      is using openCryptoki infrastructure. Be sure
+	 *      is using openCryptoki infrastructure. Be sure
 	 *      to call camel_kolab_session_shutdown() only
-         *      after all other libs have been shut down
+	 *      after all other libs have been shut down
 	 */
 	ok = kolab_util_camel_shutdown (&tmp_err);
 	if (! ok) {
@@ -183,7 +203,7 @@ main (gint argc, gchar** argv)
 	ok = test_kolab_util_http ();
 	if (! ok)
 		return EXIT_FAILURE;
-	
+
 	return EXIT_SUCCESS;
 }
 
diff --git a/src/tests/integration/libekolab/test-kolab-util-ldap.c b/src/tests/integration/libekolab/test-kolab-util-ldap.c
index c06467b..6306df0 100644
--- a/src/tests/integration/libekolab/test-kolab-util-ldap.c
+++ b/src/tests/integration/libekolab/test-kolab-util-ldap.c
@@ -12,12 +12,12 @@
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
- * 
+ *
  * 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
  * Lesser General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU Lesser General Public
  * License along with main.c; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor Boston, MA 02110-1301,  USA
@@ -40,8 +40,11 @@
 #include <sys/stat.h>
 #include <fcntl.h>
 
-gint main (void) 
+gint main (gint argc, gchar *argv[])
 {
+	(void)argc;
+	(void)argv;
+#if 0
 	gchar *config;
 	gchar *url_string;
 	gchar *encryption_mode;
@@ -77,7 +80,7 @@ gint main (void)
 		kolab_util_ldap_set_pkcs11pin (ldap_test_obj, pkcs11pin);
 		g_free (pkcs11pin);
 	}
-		
+
 	kolab_util_ldap_set_encryption_mode (ldap_test_obj,
 	                                     parse_ldap_encryption_mode (encryption_mode));
 
@@ -85,17 +88,17 @@ gint main (void)
 	g_assert (username != NULL);
 	password = g_key_file_get_string (key_file, AUTH, "password", NULL);
 	g_assert (password != NULL);
-	
+
 	kolab_util_ldap_set_credentials(ldap_test_obj, username, password);
-	
+
 	g_free (username);
 	g_free (password);
 
 
 	kolab_util_ldap_set_searchurl (ldap_test_obj, url_string);
-	
+
 	nbytes = kolab_util_ldap_get (ldap_test_obj);
-	
+
 	g_debug ("LDAP access returned bytes: %d", nbytes);
 
 	g_object_unref (ldap_test_obj);
@@ -104,4 +107,6 @@ gint main (void)
 	g_free(url_string);
 
 	return 0;
+#endif
+	return -1;
 }



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