2 This file is part of GNUnet.
3 (C) 2005, 2006, 2008, 2009 Christian Grothoff (and other contributing authors)
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.
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.
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.
22 * @file fs/test_fs_namespace_list_updateable.c
23 * @brief Test for fs_namespace_list_updateable.c
24 * @author Christian Grothoff
27 #include "gnunet_util_lib.h"
28 #include "gnunet_testing_lib-new.h"
29 #include "gnunet_fs_service.h"
32 static struct GNUNET_FS_Handle *fs;
36 static struct GNUNET_FS_Namespace *ns;
38 static struct GNUNET_CONTAINER_MetaData *meta;
40 static struct GNUNET_FS_Uri *uri_this;
42 static struct GNUNET_FS_Uri *uri_next;
44 static struct GNUNET_FS_BlockOptions bo;
48 progress_cb (void *cls, const struct GNUNET_FS_ProgressInfo *event)
58 GNUNET_FS_uri_destroy (uri_this);
60 GNUNET_FS_uri_destroy (uri_next);
62 GNUNET_FS_namespace_delete (ns, GNUNET_NO);
64 GNUNET_CONTAINER_meta_data_destroy (meta);
69 check_next (void *cls, const char *last_id,
70 const struct GNUNET_FS_Uri *last_uri,
71 const struct GNUNET_CONTAINER_MetaData *last_meta,
74 GNUNET_break (0 == strcmp (last_id, "next"));
75 GNUNET_break (0 == strcmp (next_id, "future"));
81 check_this_next (void *cls, const char *last_id,
82 const struct GNUNET_FS_Uri *last_uri,
83 const struct GNUNET_CONTAINER_MetaData *last_meta,
86 GNUNET_break (0 == strcmp (last_id, "this"));
87 GNUNET_break (0 == strcmp (next_id, "next"));
90 GNUNET_FS_namespace_list_updateable (ns, next_id, &check_next, NULL);
95 sks_cont_next (void *cls, const struct GNUNET_FS_Uri *uri, const char *emsg)
97 GNUNET_assert (NULL == emsg);
99 GNUNET_FS_namespace_list_updateable (ns, NULL, &check_this_next, NULL);
104 check_this (void *cls, const char *last_id,
105 const struct GNUNET_FS_Uri *last_uri,
106 const struct GNUNET_CONTAINER_MetaData *last_meta,
109 GNUNET_break (0 == strcmp (last_id, "this"));
110 GNUNET_break (0 == strcmp (next_id, "next"));
116 sks_cont_this (void *cls, const struct GNUNET_FS_Uri *uri, const char *emsg)
118 GNUNET_assert (NULL == emsg);
120 GNUNET_FS_namespace_list_updateable (ns, NULL, &check_this, NULL);
121 GNUNET_FS_publish_sks (fs, ns, "next", "future", meta, uri_next, &bo,
122 GNUNET_FS_PUBLISH_OPTION_NONE, &sks_cont_next, NULL);
130 ns = GNUNET_FS_namespace_create (fs, "testNamespace");
131 GNUNET_assert (NULL != ns);
132 bo.content_priority = 1;
133 bo.anonymity_level = 1;
134 bo.replication_level = 0;
136 GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_MINUTES);
137 meta = GNUNET_CONTAINER_meta_data_create ();
141 ("gnunet://fs/chk/C282GG70GKK41O4551011DO413KFBVTVMQG1OG30I0K4045N0G41HAPB82G680A02JRVVFO8URVRU2F159011DO41000000022RG820.RNVVVVOOLCLK065B5D04HTNVNSIB2AI022RG8200HSLK1CO1000ATQ98824DMA2032LIMG50CG0K057NVUVG200000H000004400000.42",
145 ("gnunet://fs/chk/C282GG70GKK41O4551011DO413KFBVTVMQG1OG30I0K4045N0G41HAPB82G680A02JRVVFO8URVRU2F159011DO41000000022RG820.RNVVVVOOLCLK065B5D04HTNVNSIB2AI022RG8200HSLK1CO1000ATQ98824DMA2032LIMG50CG0K057NVUVG200000H000004400000.43",
147 GNUNET_FS_publish_sks (fs, ns, "this", "next", meta, uri_this, &bo,
148 GNUNET_FS_PUBLISH_OPTION_NONE, &sks_cont_this, NULL);
154 const struct GNUNET_CONFIGURATION_Handle *cfg,
155 struct GNUNET_TESTING_Peer *peer)
157 fs = GNUNET_FS_start (cfg, "test-fs-namespace", &progress_cb, NULL,
158 GNUNET_FS_FLAGS_NONE, GNUNET_FS_OPTIONS_END);
164 main (int argc, char *argv[])
166 if (0 != GNUNET_TESTING_peer_run ("test-fs-namespace-list-updateable",
167 "test_fs_namespace_data.conf",
175 /* end of test_fs_namespace_list_updateable.c */