Added a test case for bug #447
[idzebra-moved-to-github.git] / test / api / t14.c
1 /* $Id: t14.c,v 1.1 2005-12-15 13:28:46 adam Exp $
2    Copyright (C) 2004-2005
3    Index Data ApS
4
5 This file is part of the Zebra server.
6
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
10 version.
11
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
15 for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with Zebra; see the file LICENSE.zebra.  If not, write to the
19 Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
20 02111-1307, USA.
21 */
22
23 #include "testlib.h"
24
25 static void create_search_drop(ZebraHandle zh)
26 {
27     const char *rec = "<gils><title>some</title></gils>";
28     const char *opaque_id = "9";
29     ZEBRA_RES res;
30
31     res = zebra_create_database (zh, "Default");
32     TL_ASSERT(res == ZEBRA_OK);
33
34 #if 0
35     /* probably bug #447 .. but we don't know */
36     res = zebra_admin_exchange_record (
37         zh, rec, strlen(rec),
38         opaque_id, strlen(opaque_id),
39         1); /* insert */
40
41     TL_ASSERT(res == ZEBRA_FAIL);
42 #endif
43
44     res = zebra_admin_exchange_record (
45         zh, rec, strlen(rec),
46         opaque_id, strlen(opaque_id),
47         4); /* update/insert */
48
49     TL_ASSERT(res == ZEBRA_OK);
50     do_query(__LINE__, zh, "@attr 1=4 some", 1);
51
52     zebra_drop_database(zh, "Default");
53
54     do_query_x(__LINE__, zh, "@attr 1=4 some", 0, 109);
55
56 }
57
58 int main(int argc, char **argv)
59 {
60     ZebraService zs = start_up("zebra.cfg", argc, argv);
61     ZebraHandle zh = zebra_open(zs, 0);
62     ZEBRA_RES res;
63
64     res = zebra_select_database(zh, "Default");
65     TL_ASSERT(res == ZEBRA_OK);
66
67     zebra_init(zh);
68
69     create_search_drop(zh);
70 #if 0
71     /* bug #447 */
72     create_search_drop(zh);
73 #endif
74
75     return close_down(zh, zs, 0);
76 }
77
78