2 This file is part of GNUnet.
3 Copyright (C) 2013-2016 GNUnet e.V.
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
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 Affero General Public License for more details.
15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
18 SPDX-License-Identifier: AGPL3.0-or-later
21 * @file peerstore/test_peerstore_api_watch.c
22 * @brief testcase for peerstore watch functionality
25 #include "gnunet_util_lib.h"
26 #include "gnunet_testing_lib.h"
27 #include "gnunet_peerstore_service.h"
32 static struct GNUNET_PEERSTORE_Handle *h;
34 static char *ss = "test_peerstore_api_watch";
36 static char *k = "test_peerstore_api_watch_key";
38 static char *val = "test_peerstore_api_watch_val";
43 const struct GNUNET_PEERSTORE_Record *record,
46 GNUNET_assert (NULL == emsg);
47 GNUNET_assert (0 == strcmp (val,
48 (char *) record->value));
50 GNUNET_PEERSTORE_disconnect (h,
52 GNUNET_SCHEDULER_shutdown ();
58 const struct GNUNET_CONFIGURATION_Handle *cfg,
59 struct GNUNET_TESTING_Peer *peer)
61 struct GNUNET_PeerIdentity p;
63 h = GNUNET_PEERSTORE_connect (cfg);
64 GNUNET_assert (NULL != h);
68 GNUNET_PEERSTORE_watch (h,
74 GNUNET_PEERSTORE_store (h,
80 GNUNET_TIME_UNIT_FOREVER_ABS,
81 GNUNET_PEERSTORE_STOREOPTION_REPLACE,
92 GNUNET_TESTING_service_run ("test-gnunet-peerstore",
94 "test_peerstore_api_data.conf",
101 /* end of test_peerstore_api_watch.c */