Skip to content

Commit 673fc6b

Browse files
committed
Merge branch 'test-updated-merge' of https://github.com/CS3219-AY2324S1/ay2324s1-course-assessment-g16 into test-updated-merge
2 parents d1381a6 + e3cc23c commit 673fc6b

File tree

24 files changed

+675
-1085
lines changed

24 files changed

+675
-1085
lines changed

CollaborationService/README.md

Lines changed: 54 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
### Features
44

55
- startCollaboration : server socket events
6-
- getQuestionById
6+
- getCollaborationHistory
77

88
### Table of Contents:
99

@@ -23,26 +23,27 @@
2323

2424
#### Listening port
2525

26-
http://localhost:3002
26+
http://localhost:3005
2727

2828

2929
#### Start the microservice on local machine by:
3030

31-
1. Navigate to peerprep directory.
31+
1. Navigate to Collaboration directory.
3232

33-
2. Uncomment localhost addresses and comment the docker addresses for the services in the `peer-prep\src\backend\collaboration-service\config\config.js` file as below:
33+
2. Uncomment localhost addresses and comment the docker addresses for the services in the `CollaborationService\config\config.js` file as below:
3434

3535
```
36-
mongodbUri: 'mongodb://127.0.0.1:27017/peer-prep',
37-
//mongodbUri: 'mongodb://mongo_db:27017/peer-prep',
36+
// mongodbUri: "mongodb://collaboration-service-database:27017",
37+
// mongodbUri: "mongodb://127.0.0.1:27021/peer-prep",
38+
mongodbUri: "mongodb://127.0.0.1:27017/peer-prep",
3839
```
3940

4041
3. Initiate connection of local MongoDB service to address `mongodb://localhost:27017/peer-prep`.
4142

4243
4. Start the microservice in terminal using commands:
4344

4445
```
45-
cd peer-prep\src\backend\collaboration-service
46+
cd CollaborationService
4647
npm install
4748
npm start
4849
```
@@ -53,7 +54,7 @@ npm start
5354
5455
> node server.js
5556
56-
Collaboration service listening on port 3002
57+
Collaboration service listening on port 3005
5758
MongoDB Connected: 127.0.0.1
5859
```
5960

@@ -108,95 +109,101 @@ Sample data for MatchedPair collection:
108109

109110
2. Add events to listen include:
110111

111-
- cleared
112112
- join
113113
- user-joined
114+
- init-timer
115+
- system-terminate
114116
- init-code
117+
- recv-question
115118
- code-changed
116-
- time-exceeded
119+
- language-changed
120+
- cleared
121+
- time-extended
117122
- notify-terminate
118123
- user-disconnected
124+
- success-reconnected
119125
- user-reconnected
120-
- successfully-reconnected
121-
- system-terminated
122-
- time-extended
123-
- update-time
124126

125127
3. Connect clients to server:
126128

127-
Url 1: http://localhost:3002?sessionId=123c44c9-9bc3-402f-ba56-689eb0d2774d&userId=Gc2Bz9Nl8Wx4
129+
Url 1: http://localhost:3005?sessionId=123c44c9-9bc3-402f-ba56-689eb0d2774d&userId=Gc2Bz9Nl8Wx4
128130

129-
Url 2: http://localhost:3002?sessionId=123c44c9-9bc3-402f-ba56-689eb0d2774d&userId=PxJ3lVtWz8Kq
131+
Url 2: http://localhost:3005?sessionId=123c44c9-9bc3-402f-ba56-689eb0d2774d&userId=PxJ3lVtWz8Kq
130132

131133
4. Test events using the message panel:
132134

133-
- update-code: (line not saved in MongoDB)
135+
- update-code:
134136

135137
Arg1 : number
136138

137139
Arg2 : string
138140

139-
- change-line: (line saved in MongoDB)
141+
- update-language:
142+
143+
Arg1: codes -> { line: Number,
144+
code: String,
145+
lastModifier: String }
146+
147+
- clear
148+
149+
- extend-time
150+
151+
- user-terminate:
140152

141153
Arg1 : number
142154

143155
Arg2 : string
156+
157+
- ack-terminate:
144158

145-
- user-terminate: (line saved in MongoDB)
146-
147-
Arg1 : number
148-
159+
Arg1 : number
160+
149161
Arg2 : string
150162

151-
- extend-time
152-
- clear
153163
- reconnect
164+
165+
- disconnect
166+
167+
Note:
168+
169+
> For other test, please refer to the project report appendix.
154170
155171

156172
#### Jest testing
157173

158174
**Note**:
175+
Testing is done on the initialization steps and the `getCollaborationHistory` function.
159176

160-
> Collections setup is required as above section, modifications to database data are expected.
161-
162-
1. Two terminal windows are required for Jest testing.
177+
1. Test the service using terminal commands:
163178

164-
2. Initiate the collaboration service in first window by:
165-
166-
```
167-
cd peer-prep\src\backend\collaboration-service
168-
npm start
169179
```
170-
171-
3. Test the service in the other window using terminal commands:
172-
173-
```
174-
cd peer-prep\src\backend\collaboration-service
180+
cd CollaborationService
175181
npm test
176182
```
177183

178-
4. Quit the server after finished testing using `Ctrl+C`.
184+
2. Quit the server after finished testing using `Ctrl+C`.
179185

180186

181187
#### Running in Docker
182188

183189
**Note**:
184190

185-
> Please delete the containers for other microservices.
191+
> Please ensure that there are no active container of the required services.
186192
187-
1. Navigate to peerprep directory.
193+
1. Navigate to CollaborationService directory.
188194

189-
2. Comment local database address and uncomment the docker address for the service in the `peer-prep\src\backend\collaboration-service\config\config.js` file as below:
195+
2. Comment local database address and uncomment the docker address for the service in the `CollaborationService\config\config.js` file as below:
190196

191-
```
192-
//mongodbUri: 'mongodb://127.0.0.1:27017/peer-prep',
193-
mongodbUri: 'mongodb://mongo_db:27017/peer-prep',
197+
```
198+
mongodbUri: "mongodb://collaboration-service-database:27017",
199+
// mongodbUri: "mongodb://127.0.0.1:27021/peer-prep",
200+
// mongodbUri: "mongodb://127.0.0.1:27017/peer-prep",
194201
```
195202

196203
3. Start the microservice in terminal using commands:
197204

198205
```
199-
cd peer-prep\src\backend\collaboration-service
206+
cd CollaborationService
200207
docker-compose up --build
201208
```
202209

@@ -205,8 +212,8 @@ docker-compose up --build
205212
```
206213
207214
> node server.js
208-
> Collaboration service listening on port 3002
209-
> MongoDB Connected: mongo_db
215+
> Collaboration service listening on port 3005
216+
> MongoDB Connected: collaboration-service-database
210217
```
211218

212219
5. End collaboration service in terminal using `Ctrl+C` twice.

CollaborationService/client-side/client.js

Lines changed: 0 additions & 152 deletions
This file was deleted.

CollaborationService/client-side/index.html

Lines changed: 0 additions & 32 deletions
This file was deleted.

0 commit comments

Comments
 (0)