Skip to content

Commit a4594de

Browse files
authored
Merge pull request #18 from cs102-project/checkpt-two
Code Written Until Checkpt. 2 (Backend + Auth/Login)
2 parents 053b591 + 1b25624 commit a4594de

File tree

104 files changed

+21216
-924
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

104 files changed

+21216
-924
lines changed

.classpath

Lines changed: 49 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,49 @@
1-
<?xml version="1.0" encoding="UTF-8"?>
2-
<classpath>
3-
<classpathentry kind="src" output="target/classes" path="src/main/java">
4-
<attributes>
5-
<attribute name="optional" value="true"/>
6-
<attribute name="maven.pomderived" value="true"/>
7-
</attributes>
8-
</classpathentry>
9-
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
10-
<attributes>
11-
<attribute name="maven.pomderived" value="true"/>
12-
</attributes>
13-
</classpathentry>
14-
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
15-
<attributes>
16-
<attribute name="optional" value="true"/>
17-
<attribute name="maven.pomderived" value="true"/>
18-
<attribute name="test" value="true"/>
19-
</attributes>
20-
</classpathentry>
21-
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11">
22-
<attributes>
23-
<attribute name="maven.pomderived" value="true"/>
24-
</attributes>
25-
</classpathentry>
26-
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
27-
<attributes>
28-
<attribute name="maven.pomderived" value="true"/>
29-
</attributes>
30-
</classpathentry>
31-
<classpathentry kind="src" path="target/generated-sources/annotations">
32-
<attributes>
33-
<attribute name="optional" value="true"/>
34-
<attribute name="maven.pomderived" value="true"/>
35-
<attribute name="ignore_optional_problems" value="true"/>
36-
<attribute name="m2e-apt" value="true"/>
37-
</attributes>
38-
</classpathentry>
39-
<classpathentry kind="src" output="target/test-classes" path="target/generated-test-sources/test-annotations">
40-
<attributes>
41-
<attribute name="optional" value="true"/>
42-
<attribute name="maven.pomderived" value="true"/>
43-
<attribute name="ignore_optional_problems" value="true"/>
44-
<attribute name="m2e-apt" value="true"/>
45-
<attribute name="test" value="true"/>
46-
</attributes>
47-
</classpathentry>
48-
<classpathentry kind="output" path="target/classes"/>
49-
</classpath>
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<classpath>
3+
<classpathentry kind="src" output="target/classes" path="src/main/java">
4+
<attributes>
5+
<attribute name="optional" value="true"/>
6+
<attribute name="maven.pomderived" value="true"/>
7+
</attributes>
8+
</classpathentry>
9+
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
10+
<attributes>
11+
<attribute name="maven.pomderived" value="true"/>
12+
</attributes>
13+
</classpathentry>
14+
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
15+
<attributes>
16+
<attribute name="optional" value="true"/>
17+
<attribute name="maven.pomderived" value="true"/>
18+
<attribute name="test" value="true"/>
19+
</attributes>
20+
</classpathentry>
21+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11">
22+
<attributes>
23+
<attribute name="maven.pomderived" value="true"/>
24+
</attributes>
25+
</classpathentry>
26+
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
27+
<attributes>
28+
<attribute name="maven.pomderived" value="true"/>
29+
</attributes>
30+
</classpathentry>
31+
<classpathentry kind="src" path="target/generated-sources/annotations">
32+
<attributes>
33+
<attribute name="optional" value="true"/>
34+
<attribute name="maven.pomderived" value="true"/>
35+
<attribute name="ignore_optional_problems" value="true"/>
36+
<attribute name="m2e-apt" value="true"/>
37+
</attributes>
38+
</classpathentry>
39+
<classpathentry kind="src" output="target/test-classes" path="target/generated-test-sources/test-annotations">
40+
<attributes>
41+
<attribute name="optional" value="true"/>
42+
<attribute name="maven.pomderived" value="true"/>
43+
<attribute name="ignore_optional_problems" value="true"/>
44+
<attribute name="m2e-apt" value="true"/>
45+
<attribute name="test" value="true"/>
46+
</attributes>
47+
</classpathentry>
48+
<classpathentry kind="output" path="target/classes"/>
49+
</classpath>

.gitignore

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,4 +363,10 @@ local.properties
363363

364364
### Eclipse Patch ###
365365
# Spring Boot Tooling
366-
.sts4-cache/
366+
.sts4-cache/
367+
368+
# Ignore built react files in src, build them locally instead
369+
src/main/resources/static/**
370+
371+
.vscode
372+
.classpath

Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
FROM openjdk:11.0.10-jdk-buster
2+
RUN apt-get -y update && apt-get -y install zip
23
RUN useradd spring
3-
USER spring:spring
4+
#USER spring:spring
5+
COPY --chown=spring:spring labconnect-dummyfs /dummy
46
ARG JAR_FILE=target/*.jar
57
COPY ${JAR_FILE} /app/app.jar
68
ENTRYPOINT [ "java", "-jar", "/app/app.jar" ]

doc/checkpoint1-readme.txt

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
LabConnect
2+
3+
Group Members:
4+
Borga Haktan Bilen 22002733
5+
Vedat Eren Arıcan 22002643
6+
Berkan Şahin 22003211
7+
Berk Çakar 22003021
8+
Alp Ertan 22003912
9+
10+
Description:
11+
LabConnect facilitates communication between students, TA's, tutors,
12+
and instructors. In the background, it is mainly a web application
13+
(If sensible/necessary, it may possibly be ported to Android) that aims
14+
to assist CS introductory courses in terms of organization and communication.
15+
Proposed ideas for features include priority queuing for TA zoom rooms among many other
16+
enhancements to TA/instructor productivity. For example, those who have completed their labs
17+
can be tested using pre-defined (by TA or instructor) unit tests, if students pass the
18+
tests successfully then they will be ordered by the number of visits to TA
19+
in the same session, in order to decrease waiting times for the students
20+
who are waiting from the beginning, and to optimize the process in general.
21+
TA's can also use the system to see previous versions of each student's code
22+
in a more practical way, similar to real version control managers in spirit.
23+
The style guidelines put forth by the instructors can be enforced automatically by parsing
24+
the student's sent code files. Much of the repetitive work that course
25+
staff need to do can be reduced substantially by automated actions,
26+
allowing TA's to allocate time for more hands-on help towards students.
27+
The student experience can be improved further by adding helpful
28+
features such as personal notes for students and so on.
29+
30+
Current Status:
31+
Testing logic (Unit test and style checker) was implemented, as well as the general
32+
I/O infrastructure for files needing persistent storage. Assignment, submission,
33+
and user type model classes were also implemented.
34+
35+
Further Development:
36+
The only "business logic" needing implementation is the Live Session logic.
37+
Once unit classes are complete, Repository classes for DB queries must be written
38+
(most of the heavy lifting is already done by Spring Data) and a REST API should be
39+
provided for manipulating the model classes. After this, frontend code will be written based
40+
on the UI report and the REST API provided by the backend.
41+
42+
Contributions:
43+
Berkan Şahin -> Model Classes (Unit & Style Testing Logic) + Docker Composition
44+
Berk Çakar -> Style Checker (Regex Logic and Checker Classes)
45+
Borga Haktan Bilen -> Model Classes + Style Checker Classes
46+
Alp Ertan -> Unit Test related classes (Exceptions) + Style Checker Classes
47+
Vedat Eren Arıcan -> TestResult + Style Checker (Regex Logic) + Code clean-up/refactoring

labconnect-dummyfs/CompanyTester.java

Lines changed: 160 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,160 @@
1+
import java.util.Scanner;
2+
3+
import company.*;
4+
5+
/**
6+
* A tester class for object inside the company package
7+
*
8+
* @author Berkan Şahin
9+
* @version 09.03.2021
10+
*/
11+
public class CompanyTester {
12+
public static void main(String[] args) {
13+
14+
Scanner scan = new Scanner("1 2 3 4 5 6 7 8 0");
15+
16+
// Constants
17+
final int INIT_ITEMS = 1;
18+
final int INIT_PEOPLE = 2;
19+
final int GIVE_ITEMS_TO_CUSTOMERS = 3;
20+
final int SEND_FEW_ITEMS = 4;
21+
final int OVERWHELM_EMPLOYEES = 5;
22+
final int DELIVER_ITEMS = 6;
23+
final int TERMINATE_CONTRACT = 7;
24+
final int EMPTY_HANDS = 8;
25+
final int EXIT_TEST = 0;
26+
27+
// Variables
28+
Item food = null;
29+
Item clothes = null;
30+
Item furniture = null;
31+
Item letter = null;
32+
Item books = null;
33+
Item napkins = null;
34+
Item photos = null;
35+
Item highlighters = null;
36+
Item resistors = null;
37+
Item mirror = null;
38+
Item dumbell = null;
39+
Customer bob = null;
40+
Customer alice = null;
41+
Employee chad = null;
42+
Employee mary = null;
43+
Company company;
44+
int choice;
45+
46+
// Program Code
47+
48+
company = new Company(3, 5);
49+
50+
do {
51+
System.out.println();
52+
System.out.println(company);
53+
54+
System.out.println("--- OPTIONS ---");
55+
System.out.printf("%d - Initialize several items%n", INIT_ITEMS);
56+
System.out.printf("%d - Initialize two customers and two employees%n", INIT_PEOPLE);
57+
System.out.printf("%d - Put items in Alice and Bob's hands%n", GIVE_ITEMS_TO_CUSTOMERS);
58+
System.out.printf("%d - Alice and Bob try to send each other a single item%n", SEND_FEW_ITEMS);
59+
System.out.printf("%d - Bob sends 10 items, overwhelming the company%n", OVERWHELM_EMPLOYEES);
60+
System.out.printf("%d - Deliver all items currently held by the company%n", DELIVER_ITEMS);
61+
System.out.printf("%d - Terminate an employee's contract%n", TERMINATE_CONTRACT);
62+
System.out.printf("%d - Empty the customers' hands%n", EMPTY_HANDS);
63+
System.out.printf("%d - Exit the program%n", EXIT_TEST);
64+
System.out.print("[Your choice]> ");
65+
66+
choice = scan.nextInt();
67+
68+
System.out.println();
69+
70+
switch (choice) {
71+
72+
case EXIT_TEST:
73+
break;
74+
75+
case INIT_ITEMS:
76+
food = new Item(3, "Food");
77+
clothes = new Item(1, "Clothes");
78+
furniture = new Item(63, "Furniture");
79+
letter = new Item(0.02, "Letters");
80+
books = new Item(0.5, "Books");
81+
napkins = new Item(0.7, "Napkins");
82+
photos = new Item(0.07, "Some Photographs");
83+
highlighters = new Item(1.3, "120 pack of highlighters");
84+
resistors = new Item(0.33, "7 330 ohm resistors");
85+
mirror = new Item(4.2, "Mirror");
86+
dumbell = new Item(10, "5 kg dumbell set");
87+
break;
88+
89+
case INIT_PEOPLE:
90+
bob = new Customer("Bob");
91+
alice = new Customer("Alice");
92+
chad = new Employee(314, "Chad");
93+
mary = new Employee(3, "Mary");
94+
95+
bob.setPos(-1, 3);
96+
alice.setPos(2, -3);
97+
chad.setPos(3, 4);
98+
mary.setPos(1, 1);
99+
100+
company.addCustomer(bob);
101+
company.addCustomer(alice);
102+
company.addEmployee(chad);
103+
company.addEmployee(mary);
104+
105+
case GIVE_ITEMS_TO_CUSTOMERS:
106+
bob.setCurrentItem(letter);
107+
alice.setCurrentItem(photos);
108+
break;
109+
110+
case SEND_FEW_ITEMS:
111+
if (alice.sendItem(company, mirror, bob)) {
112+
System.out.println("Alice could send an item.");
113+
} else {
114+
System.out.println("Alice should wait as all employees are unavailable right now.");
115+
}
116+
117+
if (bob.sendItem(company, highlighters, alice)) {
118+
System.out.println("Bob could send an item.");
119+
} else {
120+
System.out.println("Bob should wait as all employees are unavailable right now.");
121+
}
122+
123+
break;
124+
125+
case OVERWHELM_EMPLOYEES:
126+
bob.sendItem(company, food, alice);
127+
bob.sendItem(company, furniture, alice);
128+
bob.sendItem(company, dumbell, alice);
129+
bob.sendItem(company, napkins, alice);
130+
bob.sendItem(company, resistors, alice);
131+
bob.sendItem(company, highlighters, alice);
132+
bob.sendItem(company, photos, alice);
133+
bob.sendItem(company, books, alice);
134+
bob.sendItem(company, clothes, alice);
135+
bob.sendItem(company, letter, alice);
136+
break;
137+
138+
case DELIVER_ITEMS:
139+
company.deliverPackages();
140+
break;
141+
142+
case EMPTY_HANDS:
143+
alice.setCurrentItem(null);
144+
bob.setCurrentItem(null);
145+
break;
146+
147+
case TERMINATE_CONTRACT:
148+
company.terminateContract(0);
149+
break;
150+
151+
default:
152+
System.out.println("Invalid option! Try again.");
153+
}
154+
155+
} while (choice != 0);
156+
157+
scan.close();
158+
System.out.println("Bye!");
159+
}
160+
}

0 commit comments

Comments
 (0)