1 /* $Id: t13.c,v 1.9 2006-08-14 10:40:22 adam Exp $
2 Copyright (C) 1995-2006
5 This file is part of the Zebra server.
7 Zebra is free software; you can redistribute it and/or modify it under
8 the terms of the GNU General Public License as published by the Free
9 Software Foundation; either version 2, or (at your option) any later
12 Zebra is distributed in the hope that it will be useful, but WITHOUT ANY
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
27 #include <idzebra/api.h>
29 static void tst_res(void)
31 Res default_res; /* default resources */
32 Res temp_res; /* temporary resources */
38 default_res = res_open(0, 0); /* completely empty */
39 YAZ_CHECK(default_res);
41 res_set(default_res, "name1", "value1");
43 temp_res = res_open(0, 0); /* completely empty */
46 zs = zebra_start_res(0, default_res, temp_res);
49 zh = zebra_open(zs, 0);
52 YAZ_CHECK(zebra_select_database(zh, "Default") == ZEBRA_OK);
54 /* run this a few times so we can see leaks easier */
55 for (i = 0; i<10; i++)
57 /* we should find the name1 from default_res */
58 val = zebra_get_resource(zh, "name1", 0);
59 YAZ_CHECK(val && !strcmp(val, "value1"));
61 /* make local override */
62 res_set(temp_res, "name1", "value2");
63 res_set(temp_res, "name4", "value4");
65 /* we should find the name1 from temp_res */
66 val = zebra_get_resource(zh, "name1", 0);
67 YAZ_CHECK(val && !strcmp(val, "value2"));
69 val = zebra_get_resource(zh, "name4", 0);
70 YAZ_CHECK(val && !strcmp(val, "value4"));
78 res_close(default_res);
81 static void tst_no_config(void)
83 static char *xml_buf = "<gils><title>myx</title></gils>";
88 zs = zebra_start_res(0, 0, 0);
91 zh = zebra_open(zs, 0);
94 YAZ_CHECK_EQ(zebra_select_database(zh, "Default"), ZEBRA_OK);
96 YAZ_CHECK_EQ(zebra_init(zh), ZEBRA_OK);
98 zebra_set_resource(zh, "profilePath", "${srcdir:-.}/../../tab");
100 YAZ_CHECK_EQ(zebra_insert_record(zh /* handle */,
101 "grs.sgml" /* record type */,
102 &sysno, 0 /* match */,
104 xml_buf, strlen(xml_buf),
105 0 /* force_update */),
112 static void tst(int argc, char **argv)
114 tl_start_log(argc, argv);
123 * indent-tabs-mode: nil
125 * vim: shiftwidth=4 tabstop=8 expandtab