aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/namestore/Makefile.am59
-rw-r--r--src/namestore/gnunet-service-namestore.c3
-rw-r--r--src/namestore/test_namestore_api.c72
-rw-r--r--src/namestore/test_namestore_api.conf30
4 files changed, 140 insertions, 24 deletions
diff --git a/src/namestore/Makefile.am b/src/namestore/Makefile.am
index 3dead06dc..5e7f1cbfd 100644
--- a/src/namestore/Makefile.am
+++ b/src/namestore/Makefile.am
@@ -17,29 +17,31 @@ if USE_COVERAGE
17endif 17endif
18 18
19 19
20#lib_LTLIBRARIES = \ 20check_PROGRAMS = \
21# libgnunetnamestore.la 21 test_namestore_api
22# 22
23#libgnunetnamestore_la_SOURCES = \ 23lib_LTLIBRARIES = \
24# namestore_api.c namestore.h 24 libgnunetnamestore.la
25#libgnunetnamestore_la_LIBADD = \ 25
26# $(top_builddir)/src/statistics/libgnunetstatistics.la \ 26libgnunetnamestore_la_SOURCES = \
27# $(top_builddir)/src/util/libgnunetutil.la \ 27 namestore_api.c namestore.h
28# $(GN_LIBINTL) 28libgnunetnamestore_la_LIBADD = \
29#libgnunetnamestore_la_LDFLAGS = \ 29 $(top_builddir)/src/statistics/libgnunetstatistics.la \
30# $(GN_LIB_LDFLAGS) $(WINFLAGS) \ 30 $(top_builddir)/src/util/libgnunetutil.la \
31# -version-info 0:0:0 31 $(GN_LIBINTL)
32# 32libgnunetnamestore_la_LDFLAGS = \
33 33 $(GN_LIB_LDFLAGS) $(WINFLAGS) \
34#bin_PROGRAMS = \ 34 -version-info 0:0:0
35# gnunet-service-namestore 35
36# 36bin_PROGRAMS = \
37#gnunet_service_namestore_SOURCES = \ 37 gnunet-service-namestore
38# gnunet-service-namestore.c 38
39#gnunet_service_namestore_LDADD = \ 39gnunet_service_namestore_SOURCES = \
40# $(top_builddir)/src/statistics/libgnunetstatistics.la \ 40 gnunet-service-namestore.c
41# $(top_builddir)/src/util/libgnunetutil.la \ 41gnunet_service_namestore_LDADD = \
42# $(GN_LIBINTL) 42 $(top_builddir)/src/statistics/libgnunetstatistics.la \
43 $(top_builddir)/src/util/libgnunetutil.la \
44 $(GN_LIBINTL)
43 45
44if HAVE_SQLITE 46if HAVE_SQLITE
45 SQLITE_PLUGIN = libgnunet_plugin_namestore_sqlite.la 47 SQLITE_PLUGIN = libgnunet_plugin_namestore_sqlite.la
@@ -56,3 +58,14 @@ libgnunet_plugin_namestore_sqlite_la_LIBADD = \
56libgnunet_plugin_namestore_sqlite_la_LDFLAGS = \ 58libgnunet_plugin_namestore_sqlite_la_LDFLAGS = \
57 $(GN_PLUGIN_LDFLAGS) 59 $(GN_PLUGIN_LDFLAGS)
58 60
61
62test_namestore_api_SOURCES = \
63 test_namestore_api.c
64test_namestore_api_LDADD = \
65 $(top_builddir)/src/util/libgnunetutil.la \
66 $(top_builddir)/src/namestore/libgnunetnamestore.la
67
68EXTRADIST = \
69 test_namestore_api.conf
70
71 \ No newline at end of file
diff --git a/src/namestore/gnunet-service-namestore.c b/src/namestore/gnunet-service-namestore.c
index b04154f04..8e7946246 100644
--- a/src/namestore/gnunet-service-namestore.c
+++ b/src/namestore/gnunet-service-namestore.c
@@ -28,6 +28,7 @@
28#include "gnunet_service_lib.h" 28#include "gnunet_service_lib.h"
29#include "gnunet_namestore_service.h" 29#include "gnunet_namestore_service.h"
30 30
31
31/** 32/**
32 * Task run during shutdown. 33 * Task run during shutdown.
33 * 34 *
@@ -56,7 +57,7 @@ run (void *cls, struct GNUNET_SERVER_Handle *server,
56 /* FIXME: add handlers here! */ 57 /* FIXME: add handlers here! */
57 {NULL, NULL, 0, 0} 58 {NULL, NULL, 0, 0}
58 }; 59 };
59 /* FIXME: do setup here */ 60
60 GNUNET_SERVER_add_handlers (server, handlers); 61 GNUNET_SERVER_add_handlers (server, handlers);
61 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &cleanup_task, 62 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &cleanup_task,
62 NULL); 63 NULL);
diff --git a/src/namestore/test_namestore_api.c b/src/namestore/test_namestore_api.c
new file mode 100644
index 000000000..c15a4e7d1
--- /dev/null
+++ b/src/namestore/test_namestore_api.c
@@ -0,0 +1,72 @@
1/*
2 This file is part of GNUnet.
3 (C) 2009 Christian Grothoff (and other contributing authors)
4
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your
8 option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
19*/
20/**
21 * @file namestore/test_namestore_api.c
22 * @brief testcase for namestore_api.c
23 */
24#include "platform.h"
25#include "gnunet_common.h"
26#include "gnunet_namestore_service.h"
27
28#define VERBOSE GNUNET_EXTRA_LOGGING
29
30static int res;
31
32static void
33run (void *cls, char *const *args, const char *cfgfile,
34 const struct GNUNET_CONFIGURATION_Handle *cfg)
35{
36
37 res = 0;
38}
39
40static int
41check ()
42{
43 static char *const argv[] = { "test-namestore-api",
44 "-c",
45 "test_namestore_api.conf",
46#if VERBOSE
47 "-L", "DEBUG",
48#endif
49 NULL
50 };
51 static struct GNUNET_GETOPT_CommandLineOption options[] = {
52 GNUNET_GETOPT_OPTION_END
53 };
54
55 res = 1;
56 GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1, argv, "test-namestore-api",
57 "nohelp", options, &run, &res);
58 return res;
59}
60
61int
62main (int argc, char *argv[])
63{
64 int ret;
65
66
67 ret = check ();
68
69 return ret;
70}
71
72/* end of test_namestore_api.c */
diff --git a/src/namestore/test_namestore_api.conf b/src/namestore/test_namestore_api.conf
new file mode 100644
index 000000000..c73a15498
--- /dev/null
+++ b/src/namestore/test_namestore_api.conf
@@ -0,0 +1,30 @@
1[namestore]
2AUTOSTART = YES
3UNIXPATH = /tmp/gnunet-service-namestore.sock
4UNIX_MATCH_UID = YES
5UNIX_MATCH_GID = YES
6# PORT = 2099
7HOSTNAME = localhost
8HOME = $SERVICEHOME
9CONFIG = $DEFAULTCONFIG
10BINARY = gnunet-service-namestore
11ACCEPT_FROM = 127.0.0.1;
12ACCEPT_FROM6 = ::1;
13DATABASE = sqlite
14
15[namestore-sqlite]
16FILENAME = $SERVICEHOME/namestore/sqlite.db
17
18[namestore-postgres]
19CONFIG = connect_timeout=10; dbname=gnunet
20
21[namestore-mysql]
22DATABASE = gnunet
23CONFIG = ~/.my.cnf
24# USER = gnunet
25# PASSWORD =
26# HOST = localhost
27# PORT = 3306
28
29
30