adding DSN to csql.conf based on the cache test mode
[csql.git] / test / cache / CacheVerify / test002.ksh
blob548b2702f715e46241caa87ddf922c7753645d81
1 #!/bin/sh
2 # Test Case
3 # 2. Create table t1 with primary key in mysql. Cache the table in csql.
4 # Check for user authentication:
5 # $ cacheverify [-U username] [-P password] -t t1
6 # by entering
7 # a. correct username correct password - should pass
8 # b. correct username wrong password - should return error
9 # c. wrong username correct password - should return error
10 # d. wrong username wrong password - should return error
12 #Run this test only under csql/test or on this directory.
13 #Otherwise, it may fail
15 input=${PWD}/cache/CacheVerify/inputtest4.sql
16 REL_PATH=.
17 if [ -s "$input" ]
18 then
19 REL_PATH=${PWD}/cache/CacheVerify
21 cp $CSQL_CONFIG_FILE /tmp/csql.conf
22 echo DSN=$DSN >>$CSQL_CONFIG_FILE
23 isql $DSN < ${REL_PATH}/inputtest4.sql >/dev/null 2>&1
24 if [ $? -ne 0 ]
25 then
26 cp /tmp/csql.conf $CSQL_CONFIG_FILE
27 exit 1;
30 rm -f /tmp/csql/csqltable.conf
31 touch /tmp/csql/csqltable.conf
32 #$CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/inputtest4.sql > /dev/null 2>&1
33 $CSQL_INSTALL_ROOT/bin/cachetable -t t1 > /dev/null 2>&1
34 if [ $? -ne 0 ]
35 then
36 cp /tmp/csql.conf $CSQL_CONFIG_FILE
37 exit 1;
41 # check with correct username and correct password
42 $CSQL_INSTALL_ROOT/bin/cacheverify -U root -P manager -t t1 > /dev/null 2>&1
43 if [ $? -ne 0 ]
44 then
45 cp /tmp/csql.conf $CSQL_CONFIG_FILE
46 exit 2;
49 # correct username and wrong password
50 $CSQL_INSTALL_ROOT/bin/cacheverify -U root -P MANAGER -t t1 > /dev/null 2>&1
51 if [ $? -eq 0 ]
52 then
53 cp /tmp/csql.conf $CSQL_CONFIG_FILE
54 exit 3;
57 # wrong username and correct password
58 $CSQL_INSTALL_ROOT/bin/cacheverify -U ROOT -P manager -t t1 > /dev/null 2>&1
59 if [ $? -eq 0 ]
60 then
61 cp /tmp/csql.conf $CSQL_CONFIG_FILE
62 exit 4;
65 #wrong username and wrong password
66 $CSQL_INSTALL_ROOT/bin/cacheverify -U ROOT -P MANAGER -t t1 > /dev/null 2>&1
67 if [ $? -eq 0 ]
68 then
69 cp /tmp/csql.conf $CSQL_CONFIG_FILE
70 exit 5;
73 rm -f /tmp/csql/csqltable.conf
74 touch /tmp/csql/csqltable.conf
75 $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/drop.sql > /dev/null 2>&1
76 isql $DSN < ${REL_PATH}/drop.sql >/dev/null 2>&1
78 cp /tmp/csql.conf $CSQL_CONFIG_FILE
79 exit 0;