To compile the project, open a terminal in the project root directory and run:
javac -cp .:lib/junit-4.13.2.jar:lib/hamcrest-core-1.3.jar -d bin src/*/*.javaTo run the server:
java -cp bin server.MarketplaceServerMainTo run the command-line client:
java -cp bin client.MarketplaceClientMainTo run the GUI client:
java -cp bin gui.MarketplaceClientGUITo run all JUnit tests:
java -cp bin:lib/junit-4.13.2.jar:lib/hamcrest-core-1.3.jar org.junit.runner.JUnitCore database.DatabaseTest database.DatabaseDataTest database.ItemTest database.MessageTest database.PaymentProcessorTest database.TransactionTest database.TransactionResultTest database.UserTest server.MarketplaceServerTest client.MarketplaceClientTestTo run a specific test class (ex. UserTest):
java -cp bin:lib/junit-4.13.2.jar:lib/hamcrest-core-1.3.jar org.junit.runner.JUnitCore database.UserTest-
Starting the Server
- Run the server using the command provided above
- The server will start and display "Server started on port 8080"
-
Connecting to the Server
- Run the client using the command provided above
- The client will attempt to connect to the server
- If successful, it will display "Connected to server"
-
User Registration
- Select option 1 to register a new user
- Enter a username and password
- The client will display "Registration successful" or an error message
-
User Login
- Select option 2 to login
- Enter your username and password
- The client will display "Login successful" or "Invalid username or password"
-
Adding Items
- After logging in, select option 3 to add an item
- Enter the title, description, and price
- The client will display "Item added successfully" with the item ID
-
Searching Items
- Select option 4 to search for items
- Enter a search query
- The client will display a list of matching items
-
Buying Items
- Select option 5 to buy an item
- Enter the item ID
- The client will display "Payment processed successfully" or an error message
-
Viewing User Items
- Select option 6 to view your listed items
- The client will display a list of your items
-
Sending Messages
- Select option 7 to send a message
- Enter the recipient username, message content, and related item ID
- The client will display "Message sent successfully" or an error message
-
Viewing Messages
- Select option 8 to view your messages
- The client will display a list of messages sent to or from you
-
Viewing Transactions
- Select option 9 to view your transactions
- The client will display a list of your buying and selling transactions
-
Checking Balance
- Select option 10 to check your balance
- The client will display your current balance
-
Deleting Items
- Select option 11 to delete an item
- Enter the ID of the item to delete
- The client will display a confirmation or error message
-
Deleting Account
- Select option 12 to delete your account
- Confirm the deletion
- The client will display a success message or error message
-
Logging Out
- Select option 13 to logout
- The client will display "Logout successful"
-
Exiting the Client
- Select option 14 to exit
- The client will disconnect from the server and exit
-
GUI Client Testing
- Run the GUI client using the command provided above
- Enter server host and port when prompted
- Use the login screen to register or login
- Navigate between marketplace items, user items, messages, and account tabs
- Test all functions including buying, selling, sending messages, and account management
-
Multiple Clients
- Run multiple client instances simultaneously
- Each client should be able to interact with the server independently
- Test concurrent actions like multiple users trying to buy the same item
-
Server Persistence
- After shutting down the server and restarting it, all data should persist
- Users should be able to login with existing credentials
- Previously listed items should still be available
| Team Member | Submission Responsibility |
|---|---|
| Justin Zheng | Submitted Vocareum workspace |
Functionality:
- User account with username, password, and balance
Testing:
- Username, password, and balance logic tested
Relationships:
- Managed by Database, used by PaymentProcessor
Functionality:
- Marketplace item with id, title, description, price, seller, and sold status
Testing:
- All fields and sold status tested
Relationships:
- Managed by Database, referenced in Transaction and Message
Functionality:
- Message between users about an item
Testing:
- All fields and timestamp tested
Relationships:
- Managed by Database
Functionality:
- Buyer/seller transaction for an item
Testing:
- All fields and timestamp tested
Relationships:
- Created by PaymentProcessor, stored in Database
Functionality:
- Result of a payment attempt
Testing:
- Success/failure and item ID tested
Relationships:
- Returned by PaymentProcessor
Functionality:
- Handles payments and updates balances
Testing:
- Payment logic and error cases tested
Relationships:
- Uses Database, creates Transactions
Functionality:
- Stores users, items, messages, and transactions
Testing:
- CRUD and persistence tested
Relationships:
- Used by all server logic
Functionality:
- Serializable container for all marketplace data
Testing:
- Data integrity tested
Relationships:
- Used for persistence
Functionality:
- Server for client connections and marketplace operations
Testing:
- Startup, shutdown, and command handling tested
Relationships:
- Uses Database, implements MarketplaceServerInterface
Functionality:
- Client for connecting to the server and performing actions
Testing:
- Connection, command, and error handling tested
Relationships:
- Implements MarketplaceClientInterface
Functionality:
- Command-line interface for the client
Testing:
- Manual testing of user commands
Relationships:
- Uses MarketplaceClient
Functionality:
- Main class to initialize and run the server
Testing:
- Manual testing of server startup and shutdown
Relationships:
- Uses MarketplaceServer
Functionality:
- GUI interface for the client with navigation between panels
Testing:
- Manual testing of GUI components and interactions
Relationships:
- Uses MarketplaceClient, manages GUI panels
Functionality:
- Login and registration UI panel
Testing:
- Manual testing of authentication flow
Relationships:
- Used by MarketplaceClientGUI, implements LoginPanelInterface
Functionality:
- Main dashboard panel with tabs for different functionality areas
Testing:
- Manual testing of navigation and data display
Relationships:
- Used by MarketplaceClientGUI, implements DashboardPanelInterface
Functionality:
- Panel for viewing, searching, adding, buying and managing items
Testing:
- Manual testing of item management operations
Relationships:
- Used by DashboardPanel, implements ItemsPanelInterface
Functionality:
- Panel for viewing balance, transaction history, and account management
Testing:
- Manual testing of account operations and balance display
Relationships:
- Used by DashboardPanel, implements AccountPanelInterface
Functionality:
- Panel for viewing and sending messages
Testing:
- Manual testing of messaging functionality
Relationships:
- Used by DashboardPanel, implements MessagesPanelInterface
- UserInterface: User account methods
- ItemInterface: Item properties
- MessageInterface: Message properties
- TransactionInterface: Transaction properties
- TransactionResultInterface: Transaction result
- PaymentProcessorInterface: Payment processing
- DatabaseInterface: Database operations
- DatabaseDataInterface: Data container
- MarketplaceServerInterface: Server operations
- MarketplaceClientInterface: Client operations
- MarketplaceClientGUIInterface: GUI client operations
- LoginPanelInterface: Login UI operations
- DashboardPanelInterface: Dashboard UI operations
- ItemsPanelInterface: Item management UI operations
- AccountPanelInterface: Account management UI operations
- MessagesPanelInterface: Messaging UI operations