Skip to content

Commit e8f9d6b

Browse files
Merge branch 'develop'
2 parents bdcab2a + c2c410e commit e8f9d6b

24 files changed

+786
-82
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
/build/
33
!gradle/wrapper/gradle-wrapper.jar
44
/bin/
5+
server/gitruler.jar
6+
server/mark/
57

68
### STS ###
79
.apt_generated

.travis.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@ before_script:
99
- cat src/main/resources/application.yml
1010

1111
script:
12-
- if [[ $TRAVIS_BRANCH =~ ^(feature|bug).*$ ]]; then gradle checkWithoutJacoco -i; else gradle check -i; fi
12+
- if [[ $TRAVIS_BRANCH =~ ^(feature|bug).*$ ]]; then gradle checkWithoutJacoco -i; else gradle check -i; fi
13+
- shellcheck server/*.sh

_docs/deployment-instructions.md

+43-12
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,14 @@
33
## Requirements
44

55
You will need the following to run this application:
6-
1. Server running MySQL version 14.14
7-
1. Server running Java version 1.8
8-
9-
## Installation
10-
11-
Setup the MySQL database.
12-
13-
```bash
14-
mysql -u USERNAME -h HOSTNAME -P PORT -p -e "create database groupthree"
15-
```
6+
1. Server running MySQL version 14.14 (database)
7+
1. Server running Java version 1.8 (web application)
8+
1. Server running Ubuntu, Java version 1.8 and MySQL version 14.14 (marking server)
169

1710
## Configure GitLab OAuth2
1811

1912
Follow the instructions provided on this [website](https://docs.gitlab.com/ee/integration/oauth_provider.html). Set the callback URL to `http://{DOMAIN_NAME}/login/oauth2/code/gitlab`, replacing {DOMAIN_NAME} with the appropriate domain name. Tick the `api` scope box.
2013

21-
2214
## Configure application.yml
2315

2416
This file contains the properties of the deployment of the application.
@@ -77,8 +69,47 @@ jasypt:
7769
password: {ENCRYPTION_PASSWORD}
7870
```
7971
80-
## Run the application
72+
## Installation
73+
74+
1. Setup the MySQL database on the database server.
75+
76+
```bash
77+
mysql -u USERNAME -h HOSTNAME -P PORT -p -e "create database groupthree"
78+
```
79+
80+
1. Download the `co2015-1819-group-03-0.0.2-SNAPSHOT.war` from [Releases](https://github.com/UOL-CS/co2015-1819-group-03/releases) and place in web server.
81+
1. Download the `server` folder from the repository and place in marking server.
82+
1. Download the `gitruler.jar` from [Releases](https://github.com/UOL-CS/co2015-1819-group-03/releases) and place in the `server` folder.
83+
84+
## Configure mysql.cnf
85+
86+
This file contains the properties for the MySQL database connection.
87+
88+
Replace the following with the MySQL configuration details used when setting up the MySQL database above:
89+
90+
`USERNAME` = Username for the sql server
91+
`PASSWORD` = Password for the sql server
92+
`DATABASE` = Name of the database ("groupthree" used above)
93+
`HOSTNAME` = Hostname of the sql server e.g. mysql.mcscw3.le.ac.uk
94+
`PORT` = Port of the sql server e.g. 3306
95+
96+
```cnf
97+
[client]
98+
user=USERNAME
99+
password=PASSWORD
100+
database=DATABASE_NAME
101+
host=HOSTNAME
102+
port=PORT
103+
```
104+
105+
## Running the web application
81106

82107
```bash
83108
java -jar /path/to/co2015-1819-group-03-0.0.2-SNAPSHOT.war --spring.config.location=file:relative/path/to/application.yml
84109
```
110+
111+
## Running the marking server
112+
113+
```bash
114+
./gitruler-server.sh /path/to/mysql.cnf
115+
```
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Display submission feedback
2+
3+
| Test | Expected Result | Actual Result |
4+
|----------------------------------------------------------------|--------------------------------------------------------------------------|---------------|
5+
| Manually add job to job queue and run server | Server marks exercise with score being 0 and all crosses on feedback | Pass |
6+
| Complete exercise and click submit button | Server marks exercise with expected feedback output | Pass |
7+
| (With no exercises attempted) click on submit button and view attempts tab after marking successful | One exercise should be displayed with feedback card shown | Pass |
8+
| (With 5 exercises attempted) click on submit button and view attempts tab after marking successful | 6 exercises should be displayed with latest attempt also showing feedback card. All other attempts' feedback card is collapsed | Pass |
9+
| Manually add attempt with all span colours in feedback e.g. `<span style="color:#8be9fd;">Cyan</span>` etc | Colours are displayed correctly and output is legible | Pass |
10+
| Click on an attempt multiple times | Drop down icon toggles between up and down state (up when feedback expanded, down when feedback collapsed) | Pass |
11+
| Click on another attempt | Feedback card for current open attempt collapses and feedback card, for the attempt clicked on, opens | Pass |
12+
| Check icons displayed correctly | Cross, tick, up arrow and down arrow display as intended | Pass |
13+
| Manually add attempt with feedback containing escape characters | Escape characters are printed out | Pass |
14+
| Manually add attempt with feedback of size 65kb | Successfully adds row to attempt table | Pass |
15+
| Manually add attempt with feedback of size 70kb | Fails to add row to attempt table | Pass |
16+
| Manually add attempt with feedback that is empty | Successfully adds row to attempt table (shows empty feedback card in attempts tab) | Pass |
17+
| Manually add attempt with feedback containing UTF-8 3 byte characters (e.g. ä) | Successfully adds row to attempt table | Pass |
18+
| Manually add attempt with feedback containing UTF-8 4 byte characters (e.g. ☃) | Successfully adds row to attempt table | Fail - Does not add row to attempt table (mySQL ERROR 1366) |
19+
| Check padding around the feedback card | Padding around feedback card is as intended | Pass |
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Display submission mark
2+
3+
| Test | Expected Result | Actual Result |
4+
|----------------------------------------------------------------|--------------------------------------------------------------------------|---------------|
5+
| Click on attempts tab when attempts list is empty | Message "No attempts available." is displayed | Pass |
6+
| Click on attempts tab when attempts list is not empty | All attempts of the exercise for the user are displayed | Pass |
7+
| Click on attempts tab | Switches view to new tab | Pass |
8+
| Click on attempts tab, after job has been marked | Attempt number and score are displayed with the correct values | Fail - Attempt number is the id of the row instead of the actual attempt number for the exercise |
9+
| When submit button is clicked check if server marks submission | Server adds new row to attempt table and removes marked job from job queue | Pass |
10+
| When submit button is clicked without completing the exercise | Score 0 is displayed for that attempt | Pass |
11+
| When multiple exercises are submitted, the appropriate number of jobs are added to the server job queue | Same number of jobs are marked (rows added to attempt table and removed from job queue) | Pass |
12+
| When exercise is completed and submit button is clicked, the correct values are displayed | Server adds new row to attempt table and removes marked job from job queue | Pass |
13+
| Manually add a job to the job queue when the server is in sleep state | Server wakes up after around a minute and marks the new job in the queue | Pass |
14+
| Manually add a job to the job queue when the server is in wake state and another job is in the queue | Server marks the manually added job after it finishes marking the previous one | Pass |
15+
| Manually add 25 jobs to the job queue | Server marks all 25 jobs consecutively and goes into sleep state | Pass |
16+
| Manually add job with incorrect repository link | Server fails to mark repository and removes row from job queue | Pass |
17+
| Manually add job to the job queue, but delete the forked repository before starting the server | Server fails to mark repository and removes row from job queue | Pass |
18+
| Multiple users using the service click on submit button for different exercises at different times | Server successfully marks the given exercise for the correct user | Pass |
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Submit Exercise
2+
3+
| Test | Expected Result | Actual Result |
4+
|----------------------------------------------------------------|--------------------------------------------------------------------------|---------------|
5+
| Click on Submit button and alert box shows success | When Submit button is selected an alert box showing success is displayed | Pass |
6+
| Click on Submit button and view job queue | Job queue has been updated and contains expected values | Pass |
7+
| Click on Submit button and remove hidden link input tag via chrome inspector | When Submit button is selected an error page is shown | Pass |
8+
| Click on Submit button and remove hidden csrf input tag via chrome inspector | When Submit button is selected an error page is shown | Pass |
9+
| Click on Submit button in two different tabs | Success message shown and job queue updated | Pass |
10+
| Check if Submit button alignment is as intended | Alignment of the submit button is correct | Pass |
11+
| On different browsers such as Chrome, Firefox and Safari, check CSS is correct | CSS is correct on all browsers tested | Pass |
12+
| Delete repo from gitlab then click submit button | Adds job to job queue and returns success message | Pass |

_docs/sprint-4/sprint-planning.md

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Sprint Planning
2+
3+
At university we held our sprint planning meeting which was timeboxed to 2 hours where Product Owner, Scrum master and the rest of Scrum team were present. This meeting began with the Product Owner briefing the rest of the scrum team the current stories in the product backlog and what stories will be aimed to be achieved by the end of sprint. In addition, we also discussed our estimates for our stories, using the poker planning technique, and ensuring we think of the technical challenges of our stories. We discussed this as we really underestimated the level of difficulty in terms of the technical aspects of the story completed in the previous sprint.
4+
5+
## Spring Goal
6+
7+
The sprint goal we have set for this sprint is to complete the key aspect of the system, that being marking the solution to an exercise, resulting in a mark and feedback that will be shown to the user.
+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Sprint Restrospective
2+
3+
The sprint retrospective was timeboxed to 45 minutes and all the members of the scrum team were present. In this sprint the real focus was on the core functionality of our application that being the submission, marking and feedback of the exercises completed by users. Completing these stories was a real challenge for the scrum team as we had to find a way to submit the solution of an exercise as an attempt to be marked by the system and eventually provide user with the proper feedback. After many obstacles, we overcame our challenges and completed 3 user stories (and many bug fixes) in this sprint and now our application has its main functionality implemented. During the time of the sprint, we learned that our user story estimations still were not as accurate as we had anticipated. We believe that this will improve as we grow and get more experience. We also learnt that we should ask the client more valuable and precise questions that will allow us to visualise what the client wants.

server/gitruler-server.sh

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
#!/bin/bash
2+
3+
if [ "$#" -ne 1 ]; then
4+
echo "Usage: ./gitruler-server.sh /path/to/mysql.cnf"
5+
exit 1
6+
fi
7+
8+
if [ ! -f "$1" ]; then
9+
echo "Usage: ./gitruler-server.sh /path/to/mysql.cnf"
10+
exit 1
11+
fi
12+
13+
cloneDir=mark
14+
mysqlcommand="mysql --defaults-file=$1 -e"
15+
16+
echo "[Server starting]"
17+
18+
while true; do
19+
while [[ $($mysqlcommand "SELECT COUNT(*) FROM queue;" -sN) -gt 0 ]]; do
20+
eval "$mysqlcommand 'SELECT * FROM queue;' -sN" | while read -r id exId link userId; do
21+
echo "[Starting Job $id]"
22+
rm -rf "$cloneDir"
23+
if git clone --quiet "$link" "$cloneDir"; then
24+
echo "[Clone successful]"
25+
26+
output=$(java -jar gitruler.jar -w -r $cloneDir)
27+
28+
feedback=$(echo "$output" | head -n -1 | sed -e "s/'/\\\\'/g" | tr -d '\n')
29+
score=$(echo "$output" | tail -1)
30+
31+
if $mysqlcommand "INSERT INTO attempt VALUES (0, '$feedback', $score, $exId, $userId);"; then
32+
echo "[Row insertion successful]"
33+
else
34+
echo "[Row insertion failed]"
35+
fi
36+
37+
else
38+
echo "[Clone failed]"
39+
fi
40+
41+
if eval "$mysqlcommand 'DELETE FROM queue WHERE id=$id;' -sN"; then
42+
echo "[Row deletion successful]"
43+
else
44+
echo "[Row deletion failed]"
45+
fi
46+
47+
done
48+
done
49+
echo "[Server sleeping]"
50+
sleep 60
51+
echo "[Server wake]"
52+
done
53+
54+
55+
56+

server/mysql.cnf

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[client]
2+
user=USERNAME
3+
password=PASSWORD
4+
database=DATABASE_NAME
5+
host=HOSTNAME
6+
port=PORT

src/main/java/groupthree/gitruler/GitrulerApplication.java

+50-25
Original file line numberDiff line numberDiff line change
@@ -31,32 +31,57 @@ public static void main(String[] args) {
3131
*/
3232
@EventListener
3333
public void appReady(ApplicationReadyEvent event) {
34-
35-
String[] themes = { "sugarsweets", "heatwave", "daisygarden", "seascape", "summerwarmth",
36-
"bythepool", "duskfalling", "frogideas", "berrypie" };
3734

38-
String[] repositories = {
39-
"https://gitlab.com/gitlab-org/gitlab-ce",
40-
"https://gitlab.com/gitlab-org/gitlab-runner",
41-
"https://gitlab.com/inkscape/inkscape",
42-
"https://gitlab.com/gnachman/iterm2",
43-
"https://gitlab.com/gitlab-org/omnibus-gitlab",
44-
"https://gitlab.com/tortoisegit/tortoisegit"
45-
};
46-
47-
Exercise ex;
48-
49-
for (int i = 1; i <= 6; i++) {
50-
ex = new Exercise();
51-
ex.setName("Exercise " + i);
52-
ex.setDescription("Lorem ipsum dolor sit amet, consectetur adipiscing elit. "
53-
+ "Aenean mattis vel purus et sagittis nullam.");
54-
ex.setTheme(themes[new Random().nextInt(9)]);
55-
ex.setPoint((new Random().nextInt(41) + 10) * 10);
56-
ex.setRepository(repositories[i - 1]);
57-
58-
exRepo.save(ex);
59-
}
35+
Exercise ex = new Exercise();
36+
ex.setName("Section A");
37+
ex.setDescription("Configuring git, committing updates to tracked "
38+
+ "files and pushing changes to origin.");
39+
ex.setTheme("bythepool");
40+
ex.setPoint(30);
41+
ex.setRepository("https://gitlab.com/BrandonRNeath/gitruler-a-1");
42+
exRepo.save(ex);
43+
44+
ex = new Exercise();
45+
ex.setName("Section B");
46+
ex.setDescription("Tracking a new file, staging specific files for a commit "
47+
+ "and checking the repository status.");
48+
ex.setTheme("heatwave");
49+
ex.setPoint(100);
50+
ex.setRepository("https://gitlab.com/BrandonRNeath/gitruler-b-1");
51+
exRepo.save(ex);
52+
53+
ex = new Exercise();
54+
ex.setName("Section C");
55+
ex.setDescription("Ignoring moving and removing files in git.");
56+
ex.setTheme("sugarsweets");
57+
ex.setPoint(100);
58+
ex.setRepository("https://gitlab.com/BrandonRNeath/gitruler-section-c");
59+
exRepo.save(ex);
60+
61+
ex = new Exercise();
62+
ex.setName("Section D");
63+
ex.setDescription("Tagging and using git to view a log of commits "
64+
+ "and differences between versions.");
65+
ex.setTheme("duskfalling");
66+
ex.setPoint(100);
67+
ex.setRepository("https://gitlab.com/BrandonRNeath/gitruler-d-1");
68+
exRepo.save(ex);
69+
70+
ex = new Exercise();
71+
ex.setName("Section E");
72+
ex.setDescription("Branching and merging and resolving merge conflicts.");
73+
ex.setTheme("bythepool");
74+
ex.setPoint(100);
75+
ex.setRepository("https://gitlab.com/BrandonRNeath/gitruler-e-1");
76+
exRepo.save(ex);
77+
78+
ex = new Exercise();
79+
ex.setName("Practice A-E");
80+
ex.setDescription("Practice all the skills that you learned from previous exercises.");
81+
ex.setTheme("sugarsweets");
82+
ex.setPoint(100);
83+
ex.setRepository("https://gitlab.com/BrandonRNeath/gitruler-practice-a-e");
84+
exRepo.save(ex);
6085

6186
}
6287

0 commit comments

Comments
 (0)