gs_error_t * hc_func_copy_content(gs_grid_storage_t *hc, struct hc_url_s *url, const char *source) { gs_error_t *e = NULL; gs_container_t *c = NULL; c = gs_get_storage_container(hc, hc_url_get(url, HCURL_REFERENCE), NULL, 0, &e); if(NULL != c) { hc_copy_content(c, source, hc_url_get(url, HCURL_PATH), &e); gs_container_free(c); } return e; }
/* static void test_delete_content_property(gs_grid_storage_t * gs) { gs_error_t **err = NULL; gchar **result = NULL; char *nameRef = test_init(gs, "Ref_linked", NULL); char *nameCont = gen_random(7); gs_container_t *container = container_init(gs, nameCont); hc_ul_content_from_file(gs, nameCont, "Content", "file_test.txt", err); gs_content_t *nameContent = gs_get_content_from_path(container, "Content", err); char *props[] = { "key1=value1", "key2=value2", NULL }; char *propDel[] = { "key1", NULL }; hc_set_content_property(nameContent, props, err); hc_delete_content_property(nameContent, propDel, err); g_assert_true(err == NULL); hc_get_content_properties(nameContent, &result, err); g_assert_true(err == NULL); if (result == NULL) g_test_fail(); else g_assert_true(strcmp(result[0], "key2=value2") == 0); gs_content_free(nameContent); test_end(gs, nameRef, container); } */ static void test_copy_content(gs_grid_storage_t * gs) { gs_error_t **err = NULL; char *nameRef = test_init(gs, "Ref_linked", NULL); char *nameCont = gen_random(7); gs_container_t *container = container_init(gs, nameCont); hc_ul_content_from_file(gs, nameCont, "Content", "file_test.txt", err); gs_content_t *nameContent = gs_get_content_from_path(container, "Content", err); hc_copy_content(container, "Content", "Content_copy", err); g_assert_true(err == NULL); gs_content_t *nameContent2 = gs_get_content_from_path(container, "Content_copy", err); g_assert_true(nameContent != NULL); gs_content_free(nameContent); gs_content_free(nameContent2); test_end(gs, nameRef, container); }