curl_json plugin: Refactor the way trees/keys are stored.
[collectd.git] / src / curl_json_test.c
index 1e4d3b3..4b98466 100644 (file)
@@ -47,13 +47,14 @@ static cj_t *test_setup(char *json, char *key_path) {
   db->curl = (void *)cj_avl_create();
 
   cj_key_t *key = calloc(1, sizeof(*key));
-  key->magic = CJ_KEY_MAGIC;
   key->path = strdup(key_path);
   key->type = strdup("MAGIC");
 
   assert(cj_append_key(db, key) == 0);
 
-  db->state[0].tree = db->tree;
+  db->state[0].entry = &(cj_tree_entry_t){
+      .type = TREE, .tree = db->tree,
+  };
 
   cj_curl_callback(json, strlen(json), 1, db);
 #if HAVE_YAJL_V2
@@ -62,6 +63,8 @@ static cj_t *test_setup(char *json, char *key_path) {
   yajl_parse_complete(db->yajl);
 #endif
 
+  db->state[0].entry = NULL;
+
   return db;
 }