diff -r 28c358053693 -r 8aa32fa19a8f branches/gmyth-0.1b/tests/gmyth_test_connection.c --- a/branches/gmyth-0.1b/tests/gmyth_test_connection.c Wed Feb 14 23:06:17 2007 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,74 +0,0 @@ -#include - -#include "gmyth_uri.h" -#include "gmyth_backendinfo.h" -#include "gmyth_socket.h" -#include "gmyth_query.h" - -static gboolean -test_backend_connection1 (GMythBackendInfo *backend_info) -{ - GMythSocket *socket = gmyth_socket_new (); - if (gmyth_socket_connect_with_timeout (socket, - gmyth_backend_info_get_hostname (backend_info), - gmyth_backend_info_get_port (backend_info), 4) == TRUE) { - g_debug ("Socket connection success"); - return TRUE; - } else { - g_debug ("Connection failed"); - return FALSE; - } -} - -static gboolean -test_backend_connection2 (GMythBackendInfo *backend_info) -{ - GMythSocket *socket = gmyth_socket_new (); - if (gmyth_socket_connect_to_backend (socket, - gmyth_backend_info_get_hostname (backend_info), - gmyth_backend_info_get_port (backend_info), TRUE) == TRUE) { - - - g_debug ("Backend socket connection success"); - return TRUE; - } else { - g_debug ("Connection failed"); - return FALSE; - } -} - -static gboolean -test_mysql_connection1 (GMythBackendInfo *backend_info) -{ - GMythQuery *query = gmyth_query_new (); - - if (gmyth_query_connect_with_timeout (query, backend_info, 3) == TRUE) { - g_debug ("Mysql connection success"); - return TRUE; - } else { - g_debug ("Mysql connection failed"); - return FALSE; - } - -} - - -int -main (int args, const char **argv) -{ - const char* uri = argv[1]; - - GMythBackendInfo *backend_info; - g_type_init (); - //g_thread_init (NULL); - - backend_info = gmyth_backend_info_new_with_uri (argv[1]); - - test_backend_connection1 (backend_info); - test_backend_connection2 (backend_info); - test_mysql_connection1 (backend_info); -} - - - -