-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest-server9.sh
executable file
·84 lines (61 loc) · 2.76 KB
/
test-server9.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#/bin/bash
if [ $# -ne 2 ]
then
echo "Usage: `basename $0` server-prog port"
exit 1
fi
SERVER=$1
PORT=$2
echo "Start Test 9"
#echo Killing Server if any
PID=`ps | grep IRCServer | awk '{ print $1;}'`
kill -9 $PID 2> /dev/null
sleep 2
#Start server in the background
rm -f password.txt
$SERVER $PORT > talk-server.out &
sleep 1
echo Add Users
./TestIRCServer localhost $PORT "ADD-USER superman clarkkent"
./TestIRCServer localhost $PORT "ADD-USER spiderman peterpark"
./TestIRCServer localhost $PORT "ADD-USER aquaman xyz"
./TestIRCServer localhost $PORT "ADD-USER mary poppins"
echo Create Room
./TestIRCServer localhost $PORT "CREATE-ROOM superman clarkkent java-programming"
echo Create Room
./TestIRCServer localhost $PORT "CREATE-ROOM spiderman peterpark c-programming"
echo Enter room
./TestIRCServer localhost $PORT "ENTER-ROOM superman clarkkent java-programming"
./TestIRCServer localhost $PORT "ENTER-ROOM aquaman xyz java-programming"
./TestIRCServer localhost $PORT "ENTER-ROOM spiderman peterpark c-programming"
./TestIRCServer localhost $PORT "ENTER-ROOM aquaman xyz c-programming"
./TestIRCServer localhost $PORT "ENTER-ROOM mary poppins c-programming"
echo Print users in room
./TestIRCServer localhost $PORT "GET-USERS-IN-ROOM superman clarkkent java-programming"
./TestIRCServer localhost $PORT "GET-USERS-IN-ROOM mary poppins c-programming"
echo Enter another user
./TestIRCServer localhost $PORT "ENTER-ROOM spiderman peterpark c-programming"
echo Print users in room
./TestIRCServer localhost $PORT "GET-USERS-IN-ROOM spiderman peterpark c-programming"
echo Send message
./TestIRCServer localhost $PORT "SEND-MESSAGE mary poppins c-programming Hi everybody!"
./TestIRCServer localhost $PORT "SEND-MESSAGE mary poppins c-programming Welcome to the talk program!"
echo Send message
./TestIRCServer localhost $PORT "SEND-MESSAGE superman clarkkent java-programming Welcome to java-programming!"
./TestIRCServer localhost $PORT "SEND-MESSAGE aquaman xyz java-programming Java is based on C++!"
echo Get messages
./TestIRCServer localhost $PORT "GET-MESSAGES superman clarkkent 0 java-programming"
echo Get messages
./TestIRCServer localhost $PORT "GET-MESSAGES mary poppins 0 c-programming"
echo Send message
./TestIRCServer localhost $PORT "SEND-MESSAGE spiderman peterpark c-programming Hi Mary!"
./TestIRCServer localhost $PORT "SEND-MESSAGE spiderman peterpark c-programming Here I am working on cs240"
echo Get messages from 0
./TestIRCServer localhost $PORT "GET-MESSAGES mary poppins 0 c-programming"
./TestIRCServer localhost $PORT "LEAVE-ROOM mary poppins c-programming"
echo Get messages from 2
./TestIRCServer localhost $PORT "GET-MESSAGES superman clarkkent 2 java-programming"
# Kill server
echo Killing Server
PID=`ps | grep IRCServer | awk '{ print $1;}'`
kill -9 $PID