Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
a8173b4
Update README.md
priesthj Jan 29, 2025
11a9f08
Update README.md
ramseygc Jan 29, 2025
38854a5
Update README.md
1997Naim Jan 29, 2025
eeca254
add login system unit tests and test cases, as well as some rough dra…
astrobowie Mar 27, 2025
a333363
add recording of test code running
astrobowie Mar 27, 2025
461f6cd
Merge pull request #1 from priesthj/main
priesthj Mar 27, 2025
105e678
add sprint 2 files, including pdf of new test cases, test footage, an…
astrobowie Apr 10, 2025
e504777
Merge branch 'ramseygc:main' into main
priesthj Apr 22, 2025
1bc9045
Merge pull request #2 from priesthj/main
priesthj Apr 22, 2025
5a7be6e
add front end work-in-progress to sprint 3
ramseygc Apr 22, 2025
dc01066
update jsp versions unifying styles and changing website name to Gluc…
ramseygc Apr 22, 2025
4cee231
add specified encoding to project file
astrobowie Apr 22, 2025
0c9ecff
Merge branch 'main' of https://github.com/ramseygc/AssignmentRepoDemo
priesthj Apr 22, 2025
076e15d
change starting point for website to login from the registration page
priesthj Apr 22, 2025
315cbb8
add logout session termination among other short fixes
priesthj Apr 22, 2025
f3be6b4
fix issues with buttons going back to login and edit mealtimes issues…
ramseygc Apr 22, 2025
83b4bbe
fix lingering login errors from last push
priesthj Apr 22, 2025
c897a53
update jsp versions unifying styles and changing website name to Gluc…
ramseygc Apr 22, 2025
6626645
add nonfunctional draft of the administrative data overview and user …
priesthj Apr 22, 2025
4c6c347
fixing style in input data page, fix view data for users, work in pro…
ramseygc Apr 23, 2025
fff080a
fixed error when logging in under a new username that i registered. c…
ramseygc Apr 24, 2025
69b0740
fix issue with admin data view not displaying data
priesthj Apr 27, 2025
bce4b79
add stylization to the input data page
priesthj Apr 27, 2025
1741996
add password change page
priesthj Apr 27, 2025
f67af52
add test case pdf and uml class diagram
astrobowie Apr 28, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions Authentication.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import static org.junit.Assert.*;
import org.junit.Before;
import org.junit.Test;

public class Authentication {

private UserService userService;

@Before
public void setup() {
userService = new UserService();
userService.register("alice", "Secret123");
}

@Test
public void testSuccessfulAuthentication() {
assertTrue(userService.authenticate("alice", "Secret123"));
}

@Test
public void testAuthenticationWithInvalidUsername() {
assertFalse(userService.authenticate("bob", "Secret123"));
}

@Test
public void testAuthenticationWithWrongPassword() {
assertFalse(userService.authenticate("alice", "WrongPass"));
}

@Test
public void testAuthenticationWithEmptyFields() {
assertFalse(userService.authenticate("", ""));
}

@Test
public void testAuthenticationAfterRegistration() {
userService.register("newuser", "NewPass456");
assertTrue(userService.authenticate("newuser", "NewPass456"));
}
}
Binary file added Junit_code_for_cmsc_355.mp4
Binary file not shown.
Binary file added Login_Test_Cases.xlsx
Binary file not shown.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
My groupmembers are:
- Hunter
- Griffin Ramsey
- Naimul Naim
- XXXX
- XXXX
- XXXX
- XXXX


------------------ Fill in some information about your project under this ------------------
Binary file added Sprint 2/PreDev4Recording.zip
Binary file not shown.
Binary file added Sprint 2/Test Case manual - Sheet1.pdf
Binary file not shown.
Binary file added Sprint 2/medication-monitor.zip
Binary file not shown.
Binary file added Sprint 3/Test Case manual - Sheet1.pdf
Binary file not shown.
Empty file removed Sprint 3/TestCasesPlaceholder.txt
Empty file.
Binary file added Sprint 3/UML Class Diagrams.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file removed Sprint 3/UMLDiagrams.txt
Empty file.
Empty file removed Sprint 3/codePlaceHolder.txt
Empty file.
69 changes: 69 additions & 0 deletions Sprint 3/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.medmon</groupId>
<artifactId>medication-monitor</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>

<properties>
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<dependencies>
<dependency>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
<version>5.0.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.10.1</version>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>11.0.15</version>
<configuration>
<webApp>
<contextPath>/</contextPath>
</webApp>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<echo message="-------------------------------------------------" />
<echo message="To access the GlucoTracker website:" />
<echo message=" http://localhost:8080/login.jsp" />
<echo message="" />
<echo message="To stop the server:" />
<echo message=" Press CTRL + C in this terminal" />
<echo message="-------------------------------------------------" />
</target>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
50 changes: 50 additions & 0 deletions Sprint 3/src/main/java/monitoring/Account.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package monitoring;

public class Account {
private String firstName;
private String lastName;
private String username;
private String email;
private String dob;
private String password;
private String userType;

public Account(String firstName, String lastName, String username, String email, String dob, String password, String userType) {
this.firstName = firstName;
this.lastName = lastName;
this.username = username;
this.email = email;
this.dob = dob;
this.password = password;
this.userType = userType;
}

public String getUsername() {
return username;
}

public String getEmail() {
return email;
}

public String getDob() {
return dob;
}

public String getFullName() {
return firstName + " " + lastName;
}

public String getPassword() {
return password;
}

public void setPassword(String newPass){
this.password = newPass;
return;
}

public String getUserType() {
return userType;
}
}
29 changes: 29 additions & 0 deletions Sprint 3/src/main/java/monitoring/Entry.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package monitoring;

public class Entry {
private String username;
private String date;
private int carbs;
private int glucose;
private double insulinUnits;

public String getUsername() {
return username;
}

public String getDate() {
return date;
}

public int getCarbs() {
return carbs;
}

public int getGlucose() {
return glucose;
}

public double getUnits() {
return insulinUnits;
}
}
52 changes: 52 additions & 0 deletions Sprint 3/src/main/java/monitoring/MealtimeEditor.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
package monitoring;

import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;

import java.io.*;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.Map;

public class MealtimeEditor {
private static final String MEALTIME_FILE = "src/main/resources/mealtimes.json";
private final Gson gson = new Gson();

// Loads the entire mealtime file as a Map<username, Map<meal, Map<time/ratio, value>>>
private Map<String, Map<String, Map<String, String>>> loadMealtimes() {
try (Reader reader = new FileReader(MEALTIME_FILE)) {
Type type = new TypeToken<Map<String, Map<String, Map<String, String>>>>() {}.getType();
Map<String, Map<String, Map<String, String>>> mealtimes = gson.fromJson(reader, type);
return (mealtimes != null) ? mealtimes : new HashMap<>();
} catch (IOException e) {
return new HashMap<>();
}
}

// Saves the full structure back to file
private void saveMealtimes(Map<String, Map<String, Map<String, String>>> mealtimes) {
try (Writer writer = new FileWriter(MEALTIME_FILE)) {
gson.toJson(mealtimes, writer);
} catch (IOException e) {
e.printStackTrace();
}
}

public void updateMealtime(String username, String meal, String time, int carbToUnitRatio) {
Map<String, Map<String, Map<String, String>>> mealtimes = loadMealtimes();
mealtimes.putIfAbsent(username, new HashMap<>());
Map<String, Map<String, String>> userMeals = mealtimes.get(username);

Map<String, String> mealData = new HashMap<>();
mealData.put("time", time);
mealData.put("carbToUnitRatio", String.valueOf(carbToUnitRatio));
userMeals.put(meal.toLowerCase(), mealData);

saveMealtimes(mealtimes);
}

public Map<String, Map<String, String>> getUserMeals(String username) {
Map<String, Map<String, Map<String, String>>> mealtimes = loadMealtimes();
return mealtimes.getOrDefault(username, new HashMap<>());
}
}
Loading