Beispiel #1
0
static void
test_set_content_property_again(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 *content = gs_get_content_from_path(container, "Content", err);

	char *props = "key1=value1";
	char *props2 = "key1=value2";

	hc_set_content_property(content, &props, err);
	hc_set_content_property(content, &props2, err);
	g_assert_true(err == NULL);

	hc_get_content_properties(content, &result, err);
	if (strcmp(result[0], "key1=value2"))
		g_test_fail();

	gs_content_free(content);
	test_end(gs, nameRef, container);
}
Beispiel #2
0
static void
test_get_content_properties(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);

	hc_get_content_properties(nameContent, &result, err);
	g_assert_true(err == NULL);

	gs_content_free(nameContent);
	test_end(gs, nameRef, container);
}
Beispiel #3
0
gs_error_t *
hc_func_get_content_properties(gs_grid_storage_t *hc, struct hc_url_s *url, char ***result)
{
	gs_error_t *e = NULL;
	gs_container_t *c = NULL;
	gs_content_t *content = NULL;

	c = gs_get_storage_container(hc, hc_url_get(url, HCURL_REFERENCE), NULL, 0, &e);
	if (NULL != c) {
		if (hc_url_has(url, HCURL_PATH)) {
			content = gs_get_content_from_path_and_version (c,
					hc_url_get(url, HCURL_PATH), hc_url_get(url, HCURL_VERSION),
					&e);
			if(NULL != content) {
				hc_get_content_properties(content,result,&e);
				gs_content_free(content);
			}
		} else {
			e = hc_get_container_global_properties(c, result);
		}
		gs_container_free(c);
	}
	return e;
}
Beispiel #4
0
static void
test_set_content_property_wrong(gs_grid_storage_t * gs)	// to be improved
{
	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 *content = gs_get_content_from_path(container, "Content", err);

	char *props[] = { "wrong_property" };

	hc_set_content_property(content, props, err);
	if (err == NULL)
		g_test_fail();

	hc_get_content_properties(content, &result, err);

	gs_content_free(content);
	test_end(gs, nameRef, container);
}