Commit ec8e3381 authored by Dan Winship's avatar Dan Winship

Removed; these are ancient. Camel regression tests are in camel/tests now.

	* tests/*: Removed; these are ancient. Camel regression tests are
	in camel/tests now.

svn path=/trunk/; revision=22980
parent 119a6854
......@@ -10,6 +10,9 @@
* notes/*: Removed; never finished and no one is working on it.
* tests/*: Removed; these are ancient. Camel regression tests are
in camel/tests now.
* configure.in (E_UTIL_{CFLAGS,LIBS}): Remove soup-2.0 since
e-proxy is gone.
(EVOLUTION_MAIL_{CFLAGS,LIBS}): Remove soup-2.0 since the mailer
......
test1
test2
test3
test4
test5
test6
test7
test8
test9
test10
test11
test12
test13
Makefile.in
Makefile
.deps
.libs
.pure
mail1.test
mail2.test
test-formatter
test-movemail
test-url
# process this file with automake to create Makefile.in
INCLUDES = -I$(top_srcdir)/intl -I$(top_srcdir) -I$(top_srcdir)/camel \
-I$(includedir) -I$(top_srcdir)/camel/providers/pop3 \
-I$(top_srcdir)/camel/providers/mbox -I$(top_srcdir)/camel/providers/nntp \
-DG_LOG_DOMAIN=\"evolution-tests\"
LDADD = \
$(top_builddir)/camel/libcamel.la \
$(top_builddir)/e-util/libeutil.la \
$(GNOME_LIBDIR) \
$(GNOMEUI_LIBS) $(INTLLIBS) $(EXTRA_GNOME_LIBS)
# $(BONOBO_LIBS)
#test4_LDADD = \
# $(top_builddir)/camel/libcamel.la \
# $(top_builddir)/camel/providers/MH/libcamelmh.la \
# $(GNOME_LIBDIR) \
# $(GNOMEUI_LIBS) $(INTLLIBS) $(PTHREAD_LIB)
#test11_LDADD = \
# $(LDADD) \
# $(top_builddir)/filter/libfilter.la \
# $(top_builddir)/libibex/libibex.a
#test9_LDADD = \
# $(top_builddir)/camel/libcamel.la \
# $(top_builddir)/camel/providers/mbox/libcamelmbox.la \
# $(top_builddir)/libibex/libibex.la \
# $(GNOME_LIBDIR) \
# $(GNOMEUI_LIBS) $(INTLLIBS) $(EXTRA_GNOME_LIBS)
test14_LDADD = \
$(top_builddir)/camel/providers/vee/libcamelvee.la \
$(top_builddir)/camel/libcamel.la \
$(GNOME_LIBDIR) \
$(GNOMEUI_LIBS) $(INTLLIBS) $(EXTRA_GNOME_LIBS)
#test12_LDADD = \
# $(top_builddir)/camel/libcamel.la \
# $(top_builddir)/camel/providers/nntp/libcamelnntp.la \
# $(top_builddir)/libibex/libibex.la \
# $(GNOME_LIBDIR) \
# $(GNOMEUI_LIBS) $(INTLLIBS) $(EXTRA_GNOME_LIBS)
test_movemail_LDADD = \
$(top_builddir)/camel/libcamel.la \
$(top_builddir)/e-util/libeutil.la \
$(GNOME_LIBDIR) \
$(GNOMEUI_LIBS) $(INTLLIBS) $(EXTRA_GNOME_LIBS)
THREAD_RELATED_TESTS=test8
noinst_PROGRAMS = \
test1 \
test2 \
test10 \
test11 \
test13 \
test14 \
test-movemail \
test-url \
$(THREAD_RELATED_TESTS)
# test3 \
# test12 \
# test-formatter
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
#include <camel.h>
#include <e-util/e-setup.h>
static char *
auth_callback (char *prompt, gboolean secret, CamelService *service,
char *item, CamelException *ex)
{
char buf[80];
printf ("%s\n", prompt);
if (secret)
printf ("(Warning: your input will be displayed)\n");
if (fgets (buf, sizeof (buf), stdin) == NULL) {
camel_exception_set (ex, CAMEL_EXCEPTION_USER_CANCEL,
"User cancelled input.");
return NULL;
}
return g_strdup (buf);
}
extern char *evolution_folders_dir;
int main (int argc, char **argv)
{
CamelSession *session;
CamelException *ex;
CamelStore *store, *outstore;
CamelFolder *folder, *outfolder;
int nmsgs, i;
CamelMimeMessage *msg;
char *url;
gboolean delete = FALSE;
gtk_init (&argc, &argv);
camel_init ();
if (argc == 3) {
if (!strcmp (argv[1], "--delete") ||
!strcmp (argv[1], "-d")) {
delete = TRUE;
argc--;
argv++;
}
}
if (argc != 2) {
fprintf (stderr, "Usage: test-movemail [--delete] url\n");
exit (1);
}
e_setup_base_dir ();
session = camel_session_new (auth_callback);
ex = camel_exception_new ();
store = camel_session_get_store (session, argv[1], ex);
if (!store) {
fprintf(stderr, "Could not open store %s:\n%s\n", argv[1],
camel_exception_get_description (ex));
exit (1);
}
camel_service_connect_with_url (CAMEL_SERVICE (store), argv[1], ex);
if (camel_exception_get_id (ex) != CAMEL_EXCEPTION_NONE) {
printf ("Couldn't connect to %s:\n%s\n", argv[1],
camel_exception_get_description (ex));
exit (1);
}
folder = camel_store_get_folder (store, "inbox", ex);
if (!folder) {
fprintf(stderr, "Could not get inbox:\n%s\n",
camel_exception_get_description (ex));
exit (1);
}
camel_folder_open (folder, FOLDER_OPEN_READ, ex);
if (camel_exception_get_id (ex) != CAMEL_EXCEPTION_NONE) {
printf ("Couldn't open folder: %s\n",
camel_exception_get_description (ex));
exit (1);
}
nmsgs = camel_folder_get_message_count (folder, ex);
if (camel_exception_get_id (ex) != CAMEL_EXCEPTION_NONE) {
printf ("Couldn't get message count: %s\n",
camel_exception_get_description (ex));
exit (1);
}
printf ("Inbox contains %d messages.\n", nmsgs);
#ifdef DISPLAY_ONLY
stdout_stream = camel_stream_fs_new_with_fd (1);
#else
url = g_strdup_printf ("mbox://%s", evolution_folders_dir);
outstore = camel_session_get_store (session, url, ex);
g_free (url);
if (camel_exception_get_id (ex) != CAMEL_EXCEPTION_NONE) {
printf ("Couldn't open output store: %s\n",
camel_exception_get_description (ex));
exit (1);
}
outfolder = camel_store_get_folder (outstore, "inbox", ex);
if (camel_exception_get_id (ex) != CAMEL_EXCEPTION_NONE) {
printf ("Couldn't make output folder: %s\n",
camel_exception_get_description (ex));
exit (1);
}
camel_folder_open (outfolder, FOLDER_OPEN_WRITE, ex);
if (camel_exception_get_id (ex) != CAMEL_EXCEPTION_NONE) {
printf ("Couldn't open output folder: %s\n",
camel_exception_get_description (ex));
exit (1);
}
#endif
for (i = 1; i <= nmsgs; i++) {
msg = camel_folder_get_message_by_number (folder, i, ex);
if (camel_exception_get_id (ex) != CAMEL_EXCEPTION_NONE) {
printf ("Couldn't get message: %s\n",
camel_exception_get_description (ex));
exit (1);
}
#ifdef DISPLAY_ONLY
camel_data_wrapper_write_to_stream (CAMEL_DATA_WRAPPER (msg),
stdout_stream);
#else
camel_folder_append_message (outfolder, msg, ex);
if (camel_exception_get_id (ex) != CAMEL_EXCEPTION_NONE) {
printf ("Couldn't write message: %s\n",
camel_exception_get_description (ex));
exit (1);
}
if (delete) {
camel_folder_delete_message_by_number (folder, i, ex);
if (camel_exception_get_id (ex) !=
CAMEL_EXCEPTION_NONE) {
printf ("Couldn't delete message: %s\n",
camel_exception_get_description (ex));
exit (1);
}
}
#endif
}
#ifndef DISPLAY_ONLY
camel_folder_close (outfolder, FALSE, ex);
#endif
camel_folder_close (folder, TRUE, ex);
camel_service_disconnect (CAMEL_SERVICE (store), ex);
if (camel_exception_get_id (ex) != CAMEL_EXCEPTION_NONE) {
printf ("Couldn't disconnect: %s\n",
camel_exception_get_description (ex));
exit (1);
}
return 0;
}
void
gratuitous_dependency_generator()
{
xmlSetProp();
}
#include <camel.h>
int main (int argc, char **argv)
{
CamelURL *url;
CamelException *ex;
if (argc != 2) {
fprintf (stderr, "Usage: test-url URL\n");
exit (1);
}
ex = camel_exception_new ();
url = camel_url_new (argv[1], ex);
if (!url) {
fprintf (stderr, "Could not parse URL:\n%s",
camel_exception_get_description (ex));
exit (1);
}
printf ("URL : %s\n\n", camel_url_to_string (url, TRUE));
printf ("Protocol: %s\n", url->protocol);
if (url->user)
printf ("User : %s\n", url->user);
if (url->authmech)
printf ("Authmech: %s\n", url->authmech);
if (url->passwd)
printf ("Password: %s\n", url->passwd);
if (url->host)
printf ("Host : %s\n", url->host);
if (url->port)
printf ("Port : %d\n", url->port);
if (url->path)
printf ("Path : %s\n", url->path);
return 0;
}
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
#include <stdio.h>
#include "camel-mime-message.h"
#include "camel-multipart.h"
#include "camel-stream.h"
#include "camel-stream-fs.h"
#include "camel-data-wrapper.h"
#include "camel.h"
int
main (int argc, char**argv)
{
CamelMimeMessage *message;
CamelMultipart *multipart;
CamelMimePart *body_part;
CamelMimePart *attachment_part;
CamelStream *attachment_stream;
CamelStream *stream;
CamelException *ex = camel_exception_new ();
gtk_init (&argc, &argv);
camel_init ();
if (argc < 2) {
attachment_stream = NULL;
} else {
if (argc == 2) {
attachment_stream = camel_stream_fs_new_with_name (argv[1], O_RDONLY, 0, ex);
if (attachment_stream == NULL) {
fprintf (stderr, "Cannot open `%s': %s\n",
argv[1],
camel_exception_get_description (ex));
return 1;
}
} else {
fprintf (stderr, "Usage: %s [<attachment>]\n",
argv[0]);
return 1;
}
}
message = camel_mime_message_new ();
camel_mime_part_set_description (CAMEL_MIME_PART (message), "a test");
camel_medium_add_header (CAMEL_MEDIUM (message), "X-test1", "the value of a test");
camel_medium_add_header (CAMEL_MEDIUM (message), "X-test2", "the value of another test");
/*camel_mime_part_add_content_language (CAMEL_MIME_PART (message), g_string_new ("es-ca"));*/
camel_mime_message_set_date (message, CAMEL_MESSAGE_DATE_CURRENT, 0);
camel_mime_message_set_subject (message, g_strdup ("A test message"));
camel_mime_message_set_reply_to (message, g_strdup ("toto@toto.com"));
camel_mime_message_set_from (message, g_strdup ("Bertrand.Guiheneuf@aful.org"));
camel_mime_message_add_recipient (message, CAMEL_RECIPIENT_TYPE_TO,
"Franck DeChamps", "franck.dechamps@alseve.fr");
camel_mime_message_add_recipient (message, CAMEL_RECIPIENT_TYPE_TO,
NULL, "mc@alseve.fr");
camel_mime_message_add_recipient (message, CAMEL_RECIPIENT_TYPE_TO,
"Richo", "richard.lengagne@inria.fr");
camel_mime_message_add_recipient (message, CAMEL_RECIPIENT_TYPE_CC,
"Frank", "Francois.fleuret@inria.fr");
camel_mime_message_add_recipient (message, CAMEL_RECIPIENT_TYPE_CC,
NULL, "maury@justmagic.com");
camel_mime_message_add_recipient (message, CAMEL_RECIPIENT_TYPE_BCC,
"Bertie", "Bertrand.Guiheneuf@aful.org");
multipart = camel_multipart_new ();
body_part = camel_mime_part_new ();
camel_mime_part_set_content (CAMEL_MIME_PART (body_part), "This is a test.\nThis is only a test.\n",
strlen("This is a test.\nThis is only a test.\n"), "text/plain");
camel_multipart_add_part (multipart, body_part);
if (attachment_stream == NULL) {
attachment_part = NULL;
} else {
CamelDataWrapper *attachment_wrapper;
/*CamelDataWrapper *stream_wrapper;
stream_wrapper = camel_stream_data_wrapper_new
(attachment_stream);
attachment_part = camel_mime_body_part_new ();
camel_mime_part_set_encoding (CAMEL_MIME_PART (attachment_part),
CAMEL_MIME_PART_ENCODING_BASE64);
camel_medium_set_content_object (CAMEL_MEDIUM (attachment_part),
stream_wrapper);
camel_multipart_add_part (multipart, attachment_part);
gtk_object_unref (GTK_OBJECT (stream_wrapper));*/
attachment_wrapper = camel_data_wrapper_new ();
camel_data_wrapper_construct_from_stream (attachment_wrapper,
attachment_stream);
attachment_part = camel_mime_part_new ();
camel_mime_part_set_encoding (CAMEL_MIME_PART (attachment_part),
CAMEL_MIME_PART_ENCODING_BASE64);
camel_medium_set_content_object (CAMEL_MEDIUM (attachment_part),
attachment_wrapper);
camel_multipart_add_part (multipart, attachment_part);
}
camel_medium_set_content_object (CAMEL_MEDIUM (message), CAMEL_DATA_WRAPPER (multipart));
stream = camel_stream_fs_new_with_name ("mail1.test", O_WRONLY|O_TRUNC|O_CREAT, 0600, ex);
if (!stream) {
printf ("Could not open output file: %s\n",
camel_exception_get_description (ex));
exit(2);
}
camel_data_wrapper_write_to_stream (CAMEL_DATA_WRAPPER (message),
stream, ex);
camel_stream_flush (stream, ex);
gtk_object_unref (GTK_OBJECT (stream));
if (camel_exception_is_set (ex)) {
printf ("Oops. Failed. %s\n",
camel_exception_get_description (ex));
exit (1);
}
gtk_object_unref (GTK_OBJECT (message));
gtk_object_unref (GTK_OBJECT (multipart));
gtk_object_unref (GTK_OBJECT (body_part));
if (attachment_part != NULL)
gtk_object_unref (GTK_OBJECT (attachment_part));
printf ("Test1 finished\n");
return 1;
}
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
#include "camel.h"
#include "camel-mbox-folder.h"
#include "camel-exception.h"
#include "md5-utils.h"
#include <sys/types.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <glib.h>
static CamelMimeMessage *
create_sample_mime_message ()
{
CamelMimeMessage *message;
CamelMimePart *body_part;
CamelMultipart *multipart;
message = camel_mime_message_new ();
camel_mime_part_set_description (CAMEL_MIME_PART (message), "a test");
camel_medium_add_header (CAMEL_MEDIUM (message), "X-test1", "the value of a test");
camel_medium_add_header (CAMEL_MEDIUM (message), "X-test2", "the value of another test");
camel_mime_message_set_date (message, time(0), 200);
camel_mime_message_set_subject (message, "A test message");
camel_mime_message_set_reply_to (message, "toto@toto.com");
camel_mime_message_set_from (message, "Bertrand.Guiheneuf@aful.org");
camel_mime_message_add_recipient (message, CAMEL_RECIPIENT_TYPE_TO,
"Franck DeChamps", "franck.dechamps@alseve.fr");
camel_mime_message_add_recipient (message, CAMEL_RECIPIENT_TYPE_TO,
NULL, "mc@alseve.fr");
camel_mime_message_add_recipient (message, CAMEL_RECIPIENT_TYPE_TO,
"Richo", "richard.lengagne@inria.fr");
camel_mime_message_add_recipient (message, CAMEL_RECIPIENT_TYPE_CC,
"Frank", "Francois.fleuret@inria.fr");
camel_mime_message_add_recipient (message, CAMEL_RECIPIENT_TYPE_CC,
NULL, "maury@justmagic.com");
camel_mime_message_add_recipient (message, CAMEL_RECIPIENT_TYPE_BCC,
"Bertie", "Bertrand.Guiheneuf@aful.org");
multipart = camel_multipart_new ();
body_part = camel_mime_part_new ();
camel_mime_part_set_content (CAMEL_MIME_PART (body_part), "This is a test.\nThis is only a test.\n",
strlen("This is a test.\nThis is only a test.\n"), "text/plain");
camel_multipart_add_part (multipart, body_part);
camel_medium_set_content_object (CAMEL_MEDIUM (message), CAMEL_DATA_WRAPPER (multipart));
return message;
}
static char *
auth_callback(char *prompt, gboolean secret,
CamelService *service, char *item,
CamelException *ex)
{
printf ("auth_callback called: %s\n", prompt);
return NULL;
}
int
main (int argc, char**argv)
{
CamelSession *session;
CamelException *ex;
CamelStore *store;
gchar *store_url = "mbox:///tmp/evmail";
CamelFolder *folder;
CamelMimeMessage *message;
GList *uid_list;
gtk_init (&argc, &argv);
camel_init ();
ex = camel_exception_new ();
session = camel_session_new (auth_callback);
store = camel_session_get_store (session, store_url, ex);
if (camel_exception_get_id (ex)) {
printf ("Exception caught in camel_session_get_store\n"
"Full description : %s\n", camel_exception_get_description (ex));
return -1;
}
folder = camel_store_get_folder (store, "Inbox", ex);
if (camel_exception_get_id (ex)) {
printf ("Exception caught in camel_store_get_folder\n"
"Full description : %s\n", camel_exception_get_description (ex));
return -1;
}
camel_folder_open (folder, FOLDER_OPEN_RW, ex);
if (camel_exception_get_id (ex)) {
printf ("Exception caught when trying to open the folder\n"
"Full description : %s\n", camel_exception_get_description (ex));
return -1;
}
message = create_sample_mime_message ();
camel_folder_append_message (folder, message, ex);
if (camel_exception_get_id (ex)) {
printf ("Exception caught when trying to append a message to the folder\n"
"Full description : %s\n", camel_exception_get_description (ex));
return -1;
}
uid_list = camel_folder_get_uid_list (folder, ex);
camel_folder_get_message_by_uid (folder, (gchar *)uid_list->data, ex);
camel_folder_close (folder, FALSE, ex);
return 1;
}
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
Test search api
*/
#include <camel/camel.h>
#include <camel/camel-exception.h>
#include <camel/camel-folder.h>
#include <camel/md5-utils.h>
#include <sys/types.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <glib.h>
static char *
auth_callback(char *prompt, gboolean secret,
CamelService *service, char *item,
CamelException *ex)
{
printf ("auth_callback called: %s\n", prompt);
return NULL;
}
int
main (int argc, char**argv)
{
CamelSession *session;
CamelException *ex;
CamelStore *store;
gchar *store_url = "mbox:///tmp/evmail";
CamelFolder *folder, *outbox;
GList *n, *matches;
gtk_init (&argc, &argv);
camel_init ();
ex = camel_exception_new ();
session = camel_session_new (auth_callback);
camel_provider_load (session, "../camel/providers/mbox/.libs/libcamelmbox.so.0", ex);
if (camel_exception_get_id (ex)) {
printf ("Exceptions suck: %s\n", camel_exception_get_description (ex));
return 1;
}
store = camel_session_get_store (session, store_url, ex);
if (camel_exception_get_id (ex)) {
printf ("Exception caught in camel_session_get_store\n"
"Full description : %s\n", camel_exception_get_description (ex));
return -1;
}
printf("get folder\n");
folder = camel_store_get_folder (store, "Inbox", ex);
if (camel_exception_get_id (ex)) {
printf ("Exception caught in camel_store_get_folder\n"
"Full description : %s\n", camel_exception_get_description (ex));
return -1;
}
printf("open folder\n");
camel_folder_open (folder, FOLDER_OPEN_READ, ex);
if (camel_exception_get_id (ex)) {
printf ("Exception caught when trying to open the folder\n"
"Full description : %s\n", camel_exception_get_description (ex));
return -1;
}
printf("create output folder ...\n");
outbox = camel_store_get_folder (store, "Gnome", ex);
if (!camel_folder_exists(outbox, ex)) {
camel_folder_create(outbox, ex);
}
camel_folder_open (outbox, FOLDER_OPEN_WRITE, ex);
printf("Search for messages\n");
matches = camel_folder_search_by_expression (folder,
/* "(match-all (header-contains \"subject\" \"gnome\"))",*/
"(body-contains \"gnome\")",
ex);
printf("search found matches:\n");
n = matches;
while (n) {
CamelMimeMessage *m;
printf("uid: %s\n", (char *) n->data);
m = camel_folder_get_message_by_uid(folder, n->data, ex);
if (camel_exception_get_id (ex)) {
printf ("Cannot get message\n"
"Full description : %s\n", camel_exception_get_description (ex));
camel_exception_init(ex);
} else {
#if 1
camel_folder_append_message(outbox, m, ex);
if (camel_exception_get_id (ex)) {
printf ("Cannot save message\n"
"Full description : %s\n", camel_exception_get_description (ex));
}
printf("Removing matching message from source folder?\n");
camel_mime_message_set_flags(m, CAMEL_MESSAGE_DELETED, CAMEL_MESSAGE_DELETED);
/* camel_mime_message_set_flags(m, CAMEL_MESSAGE_ANSWERED, CAMEL_MESSAGE_ANSWERED);*/
#endif
}
if (m)
gtk_object_unref(m);
n = g_list_next(n);
}
camel_folder_close (outbox, TRUE, ex);
camel_folder_close (folder, TRUE, ex);
gtk_object_unref((GtkObject *)outbox);
gtk_object_unref((GtkObject *)folder);
return 0;
}
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
#include <stdio.h>
#include "camel.h"
#include "camel-nntp-store.h"
#include "camel-session.h"
#include "camel-exception.h"
static char*
authenticator (char *prompt, gboolean secret, CamelService *service, char *item,
CamelException *ex)
{
}
static void
print_name(gpointer data, gpointer foo)
{
printf ("%s\n", (char*)data);
}
int
main (int argc, char **argv)
{
CamelSession *session;
CamelException *ex;
CamelStore *store;
CamelFolder *n_p_m_a;
GList *groups;
const gchar *news_url = "news://news.mozilla.org";
gtk_init (&argc, &argv);
camel_init ();