-more debug messages
[oweals/gnunet.git] / src / namestore / test_namestore_api.c
index 55601390a3249174d40873104acc313ce82e040d..23c87d4f0daf0129cfcbb2dec386bd72317f7065 100644 (file)
 #include "gnunet_testing_lib-new.h"
 
 #define TEST_RECORD_TYPE 1234
+
 #define TEST_RECORD_DATALEN 123
+
 #define TEST_RECORD_DATA 'a'
 
 #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 10)
 
+
 static struct GNUNET_NAMESTORE_Handle *nsh;
 
 static GNUNET_SCHEDULER_TaskIdentifier endbadly_task;
@@ -55,7 +58,7 @@ 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)
@@ -81,7 +84,7 @@ end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
 
   if (nsh != NULL)
   {
-    GNUNET_NAMESTORE_disconnect (nsh, GNUNET_YES);
+    GNUNET_NAMESTORE_disconnect (nsh);
     nsh = NULL;
   }
   res = 0;
@@ -117,34 +120,16 @@ put_cont (void *cls, int32_t success, const char *emsg)
 }
 
 
-static void
-delete_existing_db (const struct GNUNET_CONFIGURATION_Handle *cfg)
-{
-  char *afsdir;
-
-  if (GNUNET_OK ==
-      GNUNET_CONFIGURATION_get_value_filename (cfg, "namestore-sqlite",
-                                               "FILENAME", &afsdir))
-  {
-    if (GNUNET_OK == GNUNET_DISK_file_test (afsdir))
-      if (GNUNET_OK == GNUNET_DISK_file_test (afsdir))
-        if (GNUNET_OK == GNUNET_DISK_directory_remove(afsdir))
-          GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Deleted existing database `%s' \n", afsdir);
-   GNUNET_free (afsdir);
-  }
-}
-
-
 static void
 run (void *cls, 
-     const struct GNUNET_CONFIGURATION_Handle *cfg)
+     const struct GNUNET_CONFIGURATION_Handle *cfg,
+     struct GNUNET_TESTING_Peer *peer)
 {
   struct GNUNET_CRYPTO_RsaSignature signature;
   struct GNUNET_NAMESTORE_RecordData rd;
   char *hostkey_file;
   const char * name = "dummy.dummy.gnunet";
 
-  delete_existing_db(cfg);
   endbadly_task = GNUNET_SCHEDULER_add_delayed(TIMEOUT,endbadly, NULL);
 
   GNUNET_asprintf(&hostkey_file,"zonefiles%s%s",DIR_SEPARATOR_STR,
@@ -156,7 +141,7 @@ run (void *cls,
   GNUNET_CRYPTO_rsa_key_get_public(privkey, &pubkey);
   GNUNET_CRYPTO_short_hash (&pubkey, sizeof (pubkey), &zone);
   memset (&signature, '\0', sizeof (signature));
-  rd.expiration = GNUNET_TIME_absolute_get();
+  rd.expiration_time = GNUNET_TIME_absolute_get().abs_value;
   rd.record_type = TEST_RECORD_TYPE;
   rd.data_size = TEST_RECORD_DATALEN;
   rd.data = GNUNET_malloc(TEST_RECORD_DATALEN);