add completion callback for overlay topology configure functions
[oweals/gnunet.git] / src / namestore / test_namestore_api_remove.c
index 85ecb4a294a2761d26429002d05156179f02b8ef..8583e69c99730195535acf3a19dc83e7d1db695e 100644 (file)
@@ -24,7 +24,7 @@
 #include "platform.h"
 #include "gnunet_common.h"
 #include "gnunet_namestore_service.h"
-#include "gnunet_testing_lib-new.h"
+#include "gnunet_testing_lib.h"
 #include "namestore.h"
 #include "gnunet_signatures.h"
 
@@ -42,7 +42,7 @@
 
 #define TEST_REMOVE_RECORD_DATA 'b'
 
-#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 10)
+#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 100)
 
 
 static struct GNUNET_NAMESTORE_Handle * nsh;
@@ -74,11 +74,12 @@ static void
 endbadly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
   if (nsh != NULL)
-    GNUNET_NAMESTORE_disconnect (nsh, GNUNET_YES);
+    GNUNET_NAMESTORE_disconnect (nsh);
   nsh = NULL;
   if (privkey != NULL)
     GNUNET_CRYPTO_rsa_key_free (privkey);
   privkey = NULL;
+  GNUNET_free_non_null (s_name);
   res = 1;
 }
 
@@ -100,8 +101,9 @@ end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
     GNUNET_CRYPTO_rsa_key_free (privkey);
   privkey = NULL;
   if (nsh != NULL)
-    GNUNET_NAMESTORE_disconnect (nsh, GNUNET_YES);
+    GNUNET_NAMESTORE_disconnect (nsh);
   nsh = NULL;
+  GNUNET_free_non_null (s_name);
 }
 
 
@@ -220,14 +222,14 @@ create_record (unsigned int count)
   struct GNUNET_NAMESTORE_RecordData * rd;
 
   rd = GNUNET_malloc (count * sizeof (struct GNUNET_NAMESTORE_RecordData));
-  rd[0].expiration_time = GNUNET_TIME_absolute_get().abs_value;
+  rd[0].expiration_time = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_HOURS).abs_value;
   rd[0].record_type = 0;
   rd[0].data_size = TEST_REMOVE_RECORD_DATALEN;
   rd[0].data = GNUNET_malloc(TEST_REMOVE_RECORD_DATALEN);
   memset ((char *) rd[0].data, TEST_RECORD_DATA, TEST_RECORD_DATALEN);
   for (c = 1; c < count; c++)
   {
-    rd[c].expiration_time = 0;
+    rd[c].expiration_time = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_HOURS).abs_value;
     rd[c].record_type = TEST_RECORD_TYPE;
     rd[c].data_size = TEST_RECORD_DATALEN;
     rd[c].data = GNUNET_malloc(TEST_RECORD_DATALEN);
@@ -240,7 +242,8 @@ create_record (unsigned int count)
 
 static void
 run (void *cls, 
-     const struct GNUNET_CONFIGURATION_Handle *cfg)
+     const struct GNUNET_CONFIGURATION_Handle *cfg,
+     struct GNUNET_TESTING_Peer *peer)
 {
   size_t rd_ser_len;
   char *hostkey_file;
@@ -258,7 +261,7 @@ run (void *cls,
   GNUNET_CRYPTO_rsa_key_get_public(privkey, &pubkey);
 
   /* create record */
-  s_name = "dummy.dummy.gnunet";
+  s_name = GNUNET_NAMESTORE_normalize_string ("DUMMY.dummy.gnunet");
   s_rd = create_record (RECORDS);
 
   rd_ser_len = GNUNET_NAMESTORE_records_get_size(RECORDS, s_rd);