# HG changeset patch # User melunko # Date 1168462238 0 # Node ID 09623a8c3172db046eba4afc3f3f5375b5800113 # Parent ef26dbeb7a5bb36f82a0544d2d36ee2d52091d16 [svn r255] added test_connection diff -r ef26dbeb7a5b -r 09623a8c3172 gmyth/tests/gmyth_test_connection.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gmyth/tests/gmyth_test_connection.c Wed Jan 10 20:50:38 2007 +0000 @@ -0,0 +1,57 @@ +#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 (socket, + gmyth_backend_info_get_hostname (backend_info), + gmyth_backend_info_get_port (backend_info)) == TRUE) { + g_debug ("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 (query, backend_info) == 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_mysql_connection1 (backend_info); +} + + + +