Skip to content

Commit ec9186a

Browse files
committed
Merge branch 'main' into features/CICD-Workflow
2 parents 5014b13 + e696e4a commit ec9186a

File tree

63 files changed

+5924
-1245
lines changed

Some content is hidden

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

63 files changed

+5924
-1245
lines changed

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,14 @@ build/
3636
.env
3737
env.local.sh
3838
env.pooler.sh
39+
.env.prod.sh
40+
41+
.DS_Store
42+
43+
### Client build artifacts ###
44+
client/node_modules/
45+
client/dist/
46+
client/.cache/
3947

4048
### Output.json ###
4149
output.json

README.md

Lines changed: 82 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,25 @@ From the terminal, run the following CLI commands:
4848
## OR
4949
mvn checkstyle:check
5050
```
51+
52+
# End-to-End Testing
53+
---------------------------------------------------------------------
54+
- **Live E2E against real Supabase + DB (opt-in):**
55+
Requires environment variables for your real stack (`SPRING_DATASOURCE_URL`, `SPRING_DATASOURCE_USERNAME`, `SPRING_DATASOURCE_PASSWORD`, `SUPABASE_URL`, `SUPABASE_ANON_KEY`, `SUPABASE_JWT_SECRET`, `SUPABASE_STORAGE_BUCKET`). Runs only when `LIVE_E2E=true` is set to avoid accidental external calls.
56+
```bash
57+
LIVE_E2E=true mvn -Dtest=dev.coms4156.project.metadetect.e2e.ClientServiceLiveE2eTest test
58+
```
59+
This flow signs up a unique email, logs in via Supabase Auth, uploads `Spaghetti.png` from `src/test/resources/mock-images/Spaghetti.png`, lists images, and deletes the upload—exercising real DB/storage paths. If signup/login fail (e.g., Supabase creds misconfigured), the test will skip with the upstream error text to avoid red builds while still surfacing the root cause.
60+
61+
- **Manual Pulse checklist (against a running backend):**
62+
1. Start MetaDetect (`mvn spring-boot:run`) with valid Supabase env vars loaded.
63+
2. Open http://localhost:8080/ (Pulse landing page served from `src/main/resources/static`).
64+
3. Submit the **Join Pulse** form with a fresh email/password; confirm the Supabase JSON response shows your email.
65+
4. Log in with the same credentials; verify the response shows tokens and the UI saves the token banner.
66+
5. Navigate to Pulse Studio (auto-redirect or http://localhost:8080/compose.html) and upload a sample image (e.g., `src/test/resources/mock-images/Spaghetti.png`) with a caption/labels.
67+
6. Confirm the feed shows your new post and that the signed URL preview loads.
68+
7. Delete the post from the feed; ensure the API returns 204 and the card disappears.
69+
8. (Optional) Watch the AI banner on the card; it polls `/api/analyze/{imageId}` and should flip to **AI generated** once the backend marks the analysis `DONE`.
5170
## How to Run
5271
---------------------------------------------------------------------
5372

@@ -73,8 +92,39 @@ From the terminal, run the following CLI commands:
7392

7493
---
7594

95+
## Client Demo (Pulse)
96+
---------------------------------------------------------------------
97+
`client/` contains a lightweight social-style demo called **Pulse** that exercises the `/auth/signup` and `/auth/login` endpoints.
98+
99+
1. Start the MetaDetect backend (see steps above) so `http://localhost:8080` is available.
100+
2. Run a tiny static server from the project root:
101+
```bash
102+
python3 -m http.server 4173 --directory client
103+
```
104+
3. Visit http://localhost:4173 in your browser. Submit either form to see the live API response in the right panel. After a successful login the client automatically routes you to the Pulse Studio page.
105+
106+
### Targeting another deployment
107+
- Edit `client/config.js` and change `apiBaseUrl` to the host of any MetaDetect instance (e.g., a staging URL or a tunnel).
108+
- The badge in the form header reflects the active base URL so you always know which backend you are exercising.
109+
110+
### What the demo covers
111+
- **Sign up**: posts `{ email, password }` to `/auth/signup` and surfaces the raw Supabase JSON for convenient debugging.
112+
- **Log in**: posts the same shape to `/auth/login`, displaying access/refresh tokens if enabled in your Supabase project.
113+
- Responses can be copied to the clipboard for quickly pasting into tools like Swagger or HTTP clients.
114+
115+
### Pulse Studio — create/delete posts
116+
- Open http://localhost:4173/compose.html in the same static server session.
117+
- After logging in, the access token is automatically saved to your browser and reused by the Studio page.
118+
- Use the composer to upload images via `/api/images/upload`, add captions/hashtags (mapped to the `note` + `labels` fields), and delete posts inline via `/api/images/{id}`.
119+
- The feed retrieves your existing uploads with `/api/images` and pulls signed URLs per asset so you can actually preview the media.
120+
- Each card automatically runs `/api/analyze/{imageId}` and labels posts with an **AI generated** banner whenever the backend reports `status=DONE`.
121+
- Tokens stay hidden in the UI for safety; log in again from Pulse if you need to refresh credentials.
122+
123+
---
124+
76125
## Running the Application with Docker
77126
---------------------------------------------------------------------
127+
STILL UNDER DEVELOPMENT - PUSH TO ITERATION 2 - Sulay has been working very hard on this and it's good for next iteration
78128

79129
### 🐳 What is Docker?
80130
Docker packages your application and its dependencies into a container so that it runs identically across any environment. It’s a portable and lightweight runtime environment — ideal for ensuring consistent deployments.
@@ -283,6 +333,8 @@ Cd in to code directory
283333
Ran to generate report:
284334
$HOME/pmd-bin-7.16.0/bin/pmd check -d src/main/java,src/test/java -R rulesets/java/quickstart.xml -f text -r pmd-report.txt
285335

336+
You can also run `mvn clean verify` to run pmd and test
337+
286338

287339

288340
## MetaDetect Endpoints
@@ -476,32 +528,38 @@ I used PMD to perform static analysis on my codebase, see below for the most rec
476528

477529
![Screenshot of PMD analysis report](reports/pmd-report.png)
478530

531+
## Proof of Multiple Test Users in DB
532+
We tested with two users uploading the same exact image to see if it caused conflicts, there were no conflicts and images were store sperately within DB.
479533

480-
## Continuous Integration Report
481-
---------------------------------------------------------------------
482-
This repository using GitHub Actions to perform continous integration, to view the latest results go to the following link: https://github.com/Jalen-Stephens/AdvanceJavaStudentEngineers/actions
534+
![Screenshot of DB Table](reports/two-users-proof.jpg)
483535

484-
Click on the latest job on the top under "X workflow runs" then Click 'build' under jobs finally click the drop down next to all the action items to read the logs made during their execution.
536+
## Proof of Images stored in Supabase Bucket
537+
Wanted to show proof of Objects stored in DB.
485538

486-
## CI Reports (JaCoCo + PMD)
487-
This project generates automated code coverage (JaCoCo) and static analysis (PMD) reports as part of the CI pipeline. To run these reports locally:
539+
![Screenshot of DB Bucket with Image](reports/objects-stored-DB.jpg)
488540

489-
```bash
490-
# Run unit tests
491-
mvn clean test
541+
## Proof of API Testing using Postman
542+
Used Postman and Curl to Test our API routes
492543

493-
# Generate JaCoCo coverage and PMD analysis reports
494-
mvn jacoco:report pmd:pmd pmd:check
544+
![Screenshot of Postman Testing](reports/api-testing.png)
495545

496-
# Convert HTML reports to PNG snapshots
497-
bash scripts/html_to_png.sh
498-
```
546+
## Proof of Self-Documenting Code
547+
Had a Ticket Dedicated to Going through each file and Ensuring there was javadocs and inline comments:
548+
[[Chore] - Write JavaDoc comments for all non-trivial code #35](https://github.com/users/Jalen-Stephens/projects/5/views/1?pane=issue&itemId=135291288&issue=Jalen-Stephens%7CAdvanceJavaStudentEngineers%7C35)
499549

500-
The generated PNG reports will be saved to:
501-
- `/reports/jacoco.png` - JaCoCo code coverage report
502-
- `/reports/pmd.png` - PMD static analysis report
550+
## Documentation of AI Resources
551+
Where AI was used it was heavily documented in the [citations.md](https://github.com/Jalen-Stephens/AdvanceJavaStudentEngineers/blob/main/citations.md)
552+
553+
## Project Management Tool
554+
We used [Github Projects Kanban Board](https://github.com/users/Jalen-Stephens/projects/5) to Track development.
555+
556+
## Continuous Integration Report
557+
---------------------------------------------------------------------
558+
This repository using GitHub Actions to perform continous integration, to view the latest results go to the following link: [AdvanceJavaStudentEngineers/actions](https://github.com/Jalen-Stephens/AdvanceJavaStudentEngineers/actions)
559+
560+
Click on the latest job on the top under "X workflow runs" then Click 'build' under jobs finally click the drop down next to all the action items to read the logs made during their execution.
503561

504-
These reports are automatically uploaded as GitHub Actions artifacts named "ci-reports" on every push and pull request.
562+
STILL UNDER DEVELOPMENT - PUSH TO ITERATION 2 - Sulay has been working very hard on this and it's good for next iteration
505563

506564
## Tools used
507565
---------------------------------------------------------------------
@@ -526,4 +584,9 @@ This section includes notes on tools and technologies used in building this proj
526584
* We use the open-source c2patool to scrape manifest metadata for determining the usage of AI in generating an image.
527585
* Coalition for Content Provenance and Authenticity (C2PA). *c2patool (Version 0.23.4)*.
528586
* Content Authenticity Initiative, Adobe Systems, 2024.
529-
* Available at: https://github.com/contentauth/c2pa-rs
587+
* Available at: https://github.com/contentauth/c2pa-rs
588+
* Supabase (Postgres SQL)
589+
* We use Supabase as our main Database
590+
* It has built in Authentication
591+
* We use tables to track metadata of images
592+
* Then we use S3 Buckets to store the physical Images within Supabase

0 commit comments

Comments
 (0)