This commit is contained in:
2025-10-02 15:28:53 -04:00
parent 980c1dc049
commit 1e078ef500
15 changed files with 35 additions and 6 deletions

9
.vscode/launch.json vendored
View File

@@ -1,6 +1,13 @@
{
"version": "0.2.0",
"configurations": [
{
"type": "java",
"name": "TestAccountLoad",
"request": "launch",
"mainClass": "lodge.TestAccountLoad",
"projectName": "reservationsystem"
},
{
"type": "java",
"name": "TestReservations",
@@ -14,7 +21,7 @@
"request": "launch",
"mainClass": "lodge.TestMainFx",
"projectName": "reservationsystem",
"vmArgs": " --module-path ./libs:. --add-modules ALL-MODULE-PATH --enable-native-access=javafx.web,javafx.controls,javafx.graphics -Dcom.sun.management.jmxremote=false -Djava.awt.headless=true -XX:+DisableAttachMechanism",
"vmArgs": " --module-path .;${workspaceFolder}/libs;${workspaceFolder}/libs/win32 --add-modules ALL-MODULE-PATH --enable-native-access=javafx.web,javafx.controls,javafx.graphics -Dcom.sun.management.jmxremote=false -Djava.awt.headless=true -XX:+DisableAttachMechanism",
"cwd": "${workspaceFolder}",
"console": "integratedTerminal"
},

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -5,6 +5,9 @@
package lodge;
import java.util.ArrayList;
import java.util.List;
import lodge.datamodel.Account;
import lodge.datamodel.Address;
import lodge.datamodel.EmailAddress;
@@ -30,23 +33,42 @@ public final class TestAccountLoad {
// memory
mgr.UpdateAccount(acct);
}
final static Address findIventory(List<Address> propertyIventory, String street) {
Address inventory = propertyIventory
.stream()
.filter((Address inv) -> {
return inv.getStreet().equals("10 wilco ave");
}).findFirst().orElse(null);
return inventory;
}
public static void main(String[] args) throws Exception {
// Configure data repository
AccomodationManager mgr = new AccomodationManager(AccomodationManager.getRepositoryConfig.getPath());
List<Address> propertyIventory = new ArrayList<Address>();
propertyIventory.add(new Address("10 wilco ave", "wilco", "WY", "82801"));
propertyIventory.add(new Address("30 Amstadam ave", "New York", "NY", "12010"));
propertyIventory.add(new Address("400 hotel ave", "Maryland City", "MD", "20723"));
// 3. Add new account object to the list managed by Manager (if account object
// already exists on add action with the same account number, it is considered
// an error)
Test_AddAccount(mgr, mgr.newAccount("701-456-7890",
new Address("10 wilco ave", "wilco", "WY", "82801"),
new EmailAddress("wilco@wyommin.net")));
Test_AddAccount(mgr, mgr.newAccount("701-456-7890",
new Address("10 wilco ave", "wilco", "WY", "82801"),
findIventory(propertyIventory, "10 wilco ave"),
new EmailAddress("wilco@wyommin.net")));
System.out.println("Account already exists in list, so add attempt should fail:");
mgr.showAccountList();
Test_AddAccount(mgr, mgr.newAccount("701-456-7890",
findIventory(propertyIventory, "10 wilco ave"),
new EmailAddress("wilco@wyommin.net")));
System.out.println("Program Completed.");
}
}

View File

@@ -1 +1 @@
{ "Account":{"account_number": "A45098176","phone_number": "701-456-7890","mailing_address": { "Address":{"street": "10 wilco ave","city": "wilco","state": "WY","zip": "82801"}},"email_address": { "EmailAddress":{"email": "wilco@wyommin.net"}},"reservations":[{"CabinReservation":{"reservation_number":"R0535276622"}},{"HouseReservation":{"reservation_number":"R0499811708"}}]}}
{ "Account":{"account_number": "A45098176","phone_number": "701-456-7890","mailing_address": { "Address":{"street": "10 wilco ave","city": "wilco","state": "WY","zip": "82801"}},"email_address": { "EmailAddress":{"email": "wilco@wyommin.net"}},"reservations":[]}}