common.h added to support AbsSqlConnection and AbsSqlStatement creations
[csql.git] / test / cache / Bidirectional / test005.ksh
blob052ef2abc561602d72be27453ee906ae7a49f26a
1 #!/bin/sh
2 # Test Case
4 #Bi-directional mutiple cache node test
5 #Two Cache Node and t1 and t2 table to be cached
6 # insert operation in target database
8 input=${PWD}/cache/Bidirectional/mysqlcreatelogtable.sql
10 REL_PATH=.
11 if [ -s "$input" ]
12 then
13 REL_PATH=${PWD}/cache/Bidirectional
16 rm -f /tmp/csql.conf
17 cp $REL_PATH/csql.conf /tmp
18 export CSQL_CONFIG_FILE=/tmp/csql.conf
19 echo DSN=$DSN >>$CSQL_CONFIG_FILE
21 isql $DSN < $REL_PATH/mysqlcreatelogtable.sql >/dev/null 2>&1
22 if [ $? -ne 0 ]
23 then
24 echo "DSN is not set for target db"
25 exit 1
28 echo table csql_log_int is created with records in target db
30 isql $DSN < $REL_PATH/create.sql >/dev/null 2>&1
31 rm -f /tmp/csql/csqltable.conf /tmp/csql/csql.db
32 touch /tmp/csql/csqltable.conf /tmp/csql/csql.db
33 isql $DSN < $REL_PATH/trigger.sql >/dev/null
34 isql $DSN < $REL_PATH/trigger1.sql >/dev/null
37 for (( a=1; a<3; a++ ))
39 echo "1:t$a NULL NULL NULL"
40 done >> /tmp/csql/csqltable.conf
42 $CSQL_INSTALL_ROOT/bin/csqlserver -c >/dev/null 2>&1 &
43 pid=$!
44 sleep 5
45 echo "server 1 started"
47 echo "cache node 2"
48 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/select.sql
49 if [ $? -ne 0 ]
50 then
51 echo "unable to locate cache 1"
52 exit 2
54 mkdir /tmp/log/csql1 >/dev/null 2>&1
55 mkdir /tmp/csql1 >/dev/null 2>&1
56 rm -f /tmp/csql1/csqltable.conf /tmp/csql1/csql.db
57 touch /tmp/csql1/csqltable.conf /tmp/csql1/csql.db
59 rm -f /tmp/csql1.conf
60 cp $REL_PATH/conf/csql.conf /tmp/csql1.conf
61 export CSQL_CONFIG_FILE=/tmp/csql1.conf
62 echo DSN=$DSN >>$CSQL_CONFIG_FILE
65 for (( a=1; a<3; a++ ))
67 echo "1:t$a NULL NULL NULL"
68 done >> /tmp/csql1/csqltable.conf
70 $CSQL_INSTALL_ROOT/bin/csqlserver -c >/dev/null 2>&1 &
71 pid1=$!
72 sleep 5
73 echo "server 2 started"
75 echo "cache node 1"
76 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/select.sql
77 if [ $? -ne 0 ]
78 then
79 echo "unable to locate cache 1"
80 exit 4
83 isql $DSN < ${REL_PATH}/insert.sql >/dev/null 2>&1
84 sleep 15
85 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/select.sql
87 export CSQL_CONFIG_FILE=/tmp/csql.conf
88 echo "cache node 2"
89 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/select.sql
91 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop.sql > /dev/null 2>&1
92 isql $DSN < ${REL_PATH}/drop.sql >/dev/null 2>&1
93 rm -f /tmp/csql/csqltable.conf /tmp/csql/csql.db
94 touch /tmp/csql/csqltable.conf /tmp/csql/csql.db
95 rm -f /tmp/csql1/csqltable.conf /tmp/csql1/csql.db
96 touch /tmp/csql1/csqltable.conf /tmp/csql1/csql.db
98 kill -2 $pid
99 ipcrm -M 4000 -M 4500
100 kill -2 $pid1
101 ipcrm -M 5000 -M 5500
102 exit 0;