Added check which creates many databases.
authorAdam Dickmeiss <adam@indexdata.dk>
Mon, 9 May 2005 13:22:44 +0000 (13:22 +0000)
committerAdam Dickmeiss <adam@indexdata.dk>
Mon, 9 May 2005 13:22:44 +0000 (13:22 +0000)
test/api/Makefile.am
test/api/t12.c [new file with mode: 0644]

index 0e6922c..8d86499 100644 (file)
@@ -1,9 +1,9 @@
-# $Id: Makefile.am,v 1.28 2005-05-02 09:05:22 adam Exp $
+# $Id: Makefile.am,v 1.29 2005-05-09 13:22:44 adam Exp $
 
 noinst_PROGRAMS = testclient
 testclient_SOURCES = testclient.c 
 
-simpletests = t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t11
+simpletests = t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12
 safaritests = safari1
 check_PROGRAMS = $(simpletests) $(safaritests)
 TESTS = $(check_PROGRAMS)
@@ -25,6 +25,7 @@ t8_SOURCES = t8.c
 t9_SOURCES = t9.c rankingrecords.h
 t10_SOURCES = t10.c rankingrecords.h
 t11_SOURCES = t11.c
+t12_SOURCES = t12.c
 
 safari1_SOURCES = safari1.c testlib.c
 
diff --git a/test/api/t12.c b/test/api/t12.c
new file mode 100644 (file)
index 0000000..f20264a
--- /dev/null
@@ -0,0 +1,71 @@
+/* $Id: t12.c,v 1.1 2005-05-09 13:22:44 adam Exp $
+   Copyright (C) 1995-2005
+   Index Data ApS
+
+This file is part of the Zebra server.
+
+Zebra is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 2, or (at your option) any later
+version.
+
+Zebra is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Zebra; see the file LICENSE.zebra.  If not, write to the
+Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA.
+*/
+
+/** Create many databases */
+
+#include "testlib.h"
+
+int main(int argc, char **argv)
+{
+    int i;
+    int no_db = 140;
+    ZebraService zs = start_up(0, argc, argv);
+    ZebraHandle zh = zebra_open(zs);
+
+    zebra_select_database(zh, "Default");
+    zebra_init(zh);
+    zebra_close(zh);
+
+    zh = zebra_open (zs);
+    
+    zebra_begin_trans (zh, 1);
+    for (i = 0; i<no_db; i++)
+    {
+       char dbstr[20];
+       char rec_buf[100];
+
+       sprintf(dbstr, "%d", i);
+       zebra_select_database(zh, dbstr);
+    
+       sprintf(rec_buf, "<gils><title>title %d</title></gils>\n", i);
+       zebra_add_record (zh, rec_buf, strlen(rec_buf));
+
+    }
+    zebra_end_trans(zh);
+    zebra_close(zh);
+    zh = zebra_open(zs);
+    for (i = 0; i<=no_db; i++)
+    {
+       char dbstr[20];
+       char querystr[50];
+       sprintf(dbstr, "%d", i);
+       zebra_select_database(zh, dbstr);
+
+       sprintf(querystr, "@attr 1=4 %d", i);
+       if (i == no_db)
+           do_query_x(__LINE__, zh, querystr, 0, 109);
+       else
+           do_query(__LINE__, zh, querystr, 1);
+    }
+
+    return close_down(zh, zs, 0);
+}