generated from BUMETCS673/GroupProjectTemplate
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/BUMETCS673/project-teamfirst
- Loading branch information
Showing
101 changed files
with
2,867 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Details on RabbitMQ and Springboot set up. | ||
## In step 1, need to access docker desktop and import the RabbitMQ, which is done via a search and then use of terminal to load that image. | ||
See screenshots to ensure you choose the right RabbitMQ management tool. | ||
## There are 2 steps associated with the terminal, the first of which is to pull the appropriate RabbitMQ version, and the 2nd is to run the RabbitMQ version to get to the RabbitMQ log in. | ||
Once in RabbitMQ there are some quick exchange and queue set up and binding you can do to ensure you understand the relationships between Exchange and one, or many queues. In our project I have set up 2 queues, one being for JSON messages. | ||
Many of the code that is used in this is from the Spring AMQP site, and there are screenshots too of how I have set up the message converters etc. | ||
At different stages of setting up Producer, Consumer classes, i simply tested the output and connection to RabbitMQ, and it was working. The url is: http://localhost:8080/api/v1/publish when I had completed the task. At one point I simply sent message of "spring alert works" and that was a message that showed up in the Queue between Producer and consumer. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Group 1 Project | ||
This is the currently the repo for the notification service that Team 1 will be building in support of the general classroom management system that the class as a whole is building. | ||
There is no code yet, but in the docs/ directory there are supporting documents describing the design work we have done so far. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
This folder contains all source code and test code. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Read Me First | ||
The following was discovered as part of building this project: | ||
|
||
* The original package name 'edu.bu.metcs673-notification-service' is invalid and this project uses 'edu.bu.metcs673_notification_service' instead. | ||
|
||
# Getting Started | ||
|
||
### Reference Documentation | ||
For further reference, please consider the following sections: | ||
|
||
* [Official Gradle documentation](https://docs.gradle.org) | ||
* [Spring Boot Gradle Plugin Reference Guide](https://docs.spring.io/spring-boot/docs/3.2.6/gradle-plugin/reference/html/) | ||
* [Create an OCI image](https://docs.spring.io/spring-boot/docs/3.2.6/gradle-plugin/reference/html/#build-image) | ||
* [Spring Web](https://docs.spring.io/spring-boot/docs/3.2.6/reference/htmlsingle/index.html#web) | ||
* [Spring for RabbitMQ](https://docs.spring.io/spring-boot/docs/3.2.6/reference/htmlsingle/index.html#messaging.amqp) | ||
|
||
### Guides | ||
The following guides illustrate how to use some features concretely: | ||
|
||
* [Building a RESTful Web Service](https://spring.io/guides/gs/rest-service/) | ||
* [Serving Web Content with Spring MVC](https://spring.io/guides/gs/serving-web-content/) | ||
* [Building REST services with Spring](https://spring.io/guides/tutorials/rest/) | ||
* [Messaging with RabbitMQ](https://spring.io/guides/gs/messaging-rabbitmq/) | ||
|
||
### Additional Links | ||
These additional references should also help you: | ||
|
||
* [Gradle Build Scans – insights for your project's build](https://scans.gradle.com#gradle) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
# Notification Service | ||
|
||
This is a notification service built with Spring Boot and RabbitMQ. The service demonstrates the use of the Observer design pattern to send notifications via a RabbitMQ Fanout Exchange. | ||
|
||
## Prerequisites | ||
|
||
- Java 11 or higher | ||
- RabbitMQ server | ||
- Docker (optional, for running RabbitMQ) | ||
|
||
## Getting Started | ||
|
||
### Local running RabbitMQ(MacOS) | ||
install RabbitMQ server with: | ||
``` | ||
brew install rabbitmq | ||
``` | ||
start a local RabbitMQ node: | ||
``` | ||
brew services start rabbitmq | ||
``` | ||
stop a running node: | ||
``` | ||
brew services stop rabbitmq | ||
``` | ||
|
||
### Running RabbitMQ with Docker | ||
|
||
If you don't have RabbitMQ installed, you can run it using Docker: | ||
|
||
```bash | ||
docker run -d --name rabbitmq -p 5672:5672 -p 15672:15672 rabbitmq:3-management | ||
``` | ||
Access the RabbitMQ management console at http://localhost:15672 with the default username and password (guest/guest) | ||
|
||
### Clone repository | ||
``` | ||
git clone https://github.com/yourusername/notification-service.git | ||
cd notification-service | ||
``` | ||
|
||
### Build & run the application | ||
1.Build the application | ||
``` | ||
./gradlew build | ||
``` | ||
2.Run the application | ||
``` | ||
./gradlew bootRun | ||
``` | ||
### Testing | ||
Use API client like Postman to send a POST request to /send-notification endpoint: | ||
|
||
URL: http://localhost:8081/send-notification | ||
Method: POST | ||
Body: | ||
Key:"message" | ||
Value:"Hello World" | ||
|
||
Check the logs of your Spring Boot application to see the received notifications |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
plugins { | ||
id 'java' | ||
id 'org.springframework.boot' version '3.2.6' | ||
id 'io.spring.dependency-management' version '1.1.5' | ||
} | ||
|
||
group = 'edu.bu' | ||
version = '0.0.1-SNAPSHOT' | ||
|
||
java { | ||
sourceCompatibility = '17' | ||
} | ||
|
||
repositories { | ||
mavenCentral() | ||
} | ||
|
||
dependencies { | ||
implementation 'org.springframework.boot:spring-boot-starter-amqp' | ||
implementation 'org.springframework.boot:spring-boot-starter-web' | ||
testImplementation 'org.springframework.boot:spring-boot-starter-test' | ||
testImplementation 'org.springframework.amqp:spring-rabbit-test' | ||
testRuntimeOnly 'org.junit.platform:junit-platform-launcher' | ||
} | ||
|
||
tasks.named('test') { | ||
useJUnitPlatform() | ||
} |
Binary file added
BIN
+818 Bytes
...asses/java/main/edu/bu/metcs673_notification_service/NotificationServiceApplication.class
Binary file not shown.
Binary file added
BIN
+1.77 KB
.../build/classes/java/main/edu/bu/metcs673_notification_service/config/RabbitMQConfig.class
Binary file not shown.
Binary file added
BIN
+1.43 KB
...es/java/main/edu/bu/metcs673_notification_service/controller/NotificationController.class
Binary file not shown.
Binary file added
BIN
+1.3 KB
...main/edu/bu/metcs673_notification_service/observerpattern/EmailNotificationObserver.class
Binary file not shown.
Binary file added
BIN
+255 Bytes
...java/main/edu/bu/metcs673_notification_service/observerpattern/NotificationObserver.class
Binary file not shown.
Binary file added
BIN
+1.53 KB
.../java/main/edu/bu/metcs673_notification_service/observerpattern/NotificationSubject.class
Binary file not shown.
Binary file added
BIN
+1.01 KB
...sses/java/main/edu/bu/metcs673_notification_service/publisher/NotificationPublisher.class
Binary file not shown.
Binary file added
BIN
+1.32 KB
...es/java/main/edu/bu/metcs673_notification_service/subscriber/NotificationSubscriber.class
Binary file not shown.
Binary file added
BIN
+616 Bytes
.../java/test/edu/bu/metcs673_notification_service/NotificationServiceApplicationTests.class
Binary file not shown.
Binary file added
BIN
+8.12 KB
...73-notification-service/build/libs/metcs673-notification-service-0.0.1-SNAPSHOT-plain.jar
Binary file not shown.
Binary file added
BIN
+21.6 MB
...metcs673-notification-service/build/libs/metcs673-notification-service-0.0.1-SNAPSHOT.jar
Binary file not shown.
121 changes: 121 additions & 0 deletions
121
...est/classes/edu.bu.metcs673_notification_service.NotificationServiceApplicationTests.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> | ||
<meta http-equiv="x-ua-compatible" content="IE=edge"/> | ||
<title>Test results - NotificationServiceApplicationTests</title> | ||
<link href="../css/base-style.css" rel="stylesheet" type="text/css"/> | ||
<link href="../css/style.css" rel="stylesheet" type="text/css"/> | ||
<script src="../js/report.js" type="text/javascript"></script> | ||
</head> | ||
<body> | ||
<div id="content"> | ||
<h1>NotificationServiceApplicationTests</h1> | ||
<div class="breadcrumbs"> | ||
<a href="../index.html">all</a> > | ||
<a href="../packages/edu.bu.metcs673_notification_service.html">edu.bu.metcs673_notification_service</a> > NotificationServiceApplicationTests</div> | ||
<div id="summary"> | ||
<table> | ||
<tr> | ||
<td> | ||
<div class="summaryGroup"> | ||
<table> | ||
<tr> | ||
<td> | ||
<div class="infoBox" id="tests"> | ||
<div class="counter">1</div> | ||
<p>tests</p> | ||
</div> | ||
</td> | ||
<td> | ||
<div class="infoBox" id="failures"> | ||
<div class="counter">0</div> | ||
<p>failures</p> | ||
</div> | ||
</td> | ||
<td> | ||
<div class="infoBox" id="ignored"> | ||
<div class="counter">0</div> | ||
<p>ignored</p> | ||
</div> | ||
</td> | ||
<td> | ||
<div class="infoBox" id="duration"> | ||
<div class="counter">0.511s</div> | ||
<p>duration</p> | ||
</div> | ||
</td> | ||
</tr> | ||
</table> | ||
</div> | ||
</td> | ||
<td> | ||
<div class="infoBox success" id="successRate"> | ||
<div class="percent">100%</div> | ||
<p>successful</p> | ||
</div> | ||
</td> | ||
</tr> | ||
</table> | ||
</div> | ||
<div id="tabs"> | ||
<ul class="tabLinks"> | ||
<li> | ||
<a href="#tab0">Tests</a> | ||
</li> | ||
<li> | ||
<a href="#tab1">Standard output</a> | ||
</li> | ||
</ul> | ||
<div id="tab0" class="tab"> | ||
<h2>Tests</h2> | ||
<table> | ||
<thead> | ||
<tr> | ||
<th>Test</th> | ||
<th>Duration</th> | ||
<th>Result</th> | ||
</tr> | ||
</thead> | ||
<tr> | ||
<td class="success">contextLoads()</td> | ||
<td class="success">0.511s</td> | ||
<td class="success">passed</td> | ||
</tr> | ||
</table> | ||
</div> | ||
<div id="tab1" class="tab"> | ||
<h2>Standard output</h2> | ||
<span class="code"> | ||
<pre>21:51:44.582 [Test worker] INFO org.springframework.test.context.support.AnnotationConfigContextLoaderUtils -- Could not detect default configuration classes for test class [edu.bu.metcs673_notification_service.NotificationServiceApplicationTests]: NotificationServiceApplicationTests does not declare any static, non-private, non-final, nested classes annotated with @Configuration. | ||
21:51:44.630 [Test worker] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper -- Found @SpringBootConfiguration edu.bu.metcs673_notification_service.NotificationServiceApplication for test class edu.bu.metcs673_notification_service.NotificationServiceApplicationTests | ||
|
||
. ____ _ __ _ _ | ||
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \ | ||
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \ | ||
\\/ ___)| |_)| | | | | || (_| | ) ) ) ) | ||
' |____| .__|_| |_|_| |_\__, | / / / / | ||
=========|_|==============|___/=/_/_/_/ | ||
:: Spring Boot :: (v3.2.6) | ||
|
||
2024-05-27T21:51:44.794-04:00 INFO 66733 --- [metcs673-notification-service] [ Test worker] .b.m.NotificationServiceApplicationTests : Starting NotificationServiceApplicationTests using Java 17.0.11 with PID 66733 (started by lishenxiao in /Users/lishenxiao/Dropbox/My Mac (Shenxiao’s MacBook Pro)/Desktop/BU Courses/CS 673 Software Engineering/project/metcs673-notification-service) | ||
2024-05-27T21:51:44.795-04:00 INFO 66733 --- [metcs673-notification-service] [ Test worker] .b.m.NotificationServiceApplicationTests : No active profile set, falling back to 1 default profile: "default" | ||
2024-05-27T21:51:45.444-04:00 INFO 66733 --- [metcs673-notification-service] [ Test worker] o.s.a.r.c.CachingConnectionFactory : Attempting to connect to: [localhost:5672] | ||
2024-05-27T21:51:45.474-04:00 INFO 66733 --- [metcs673-notification-service] [ Test worker] o.s.a.r.c.CachingConnectionFactory : Created new connection: rabbitConnectionFactory#14924f41:0/SimpleConnection@5a05dd30 [delegate=amqp://guest@127.0.0.1:5672/, localPort=56251] | ||
2024-05-27T21:51:45.502-04:00 INFO 66733 --- [metcs673-notification-service] [ Test worker] .b.m.NotificationServiceApplicationTests : Started NotificationServiceApplicationTests in 0.802 seconds (process running for 1.392) | ||
</pre> | ||
</span> | ||
</div> | ||
</div> | ||
<div id="footer"> | ||
<p> | ||
<div> | ||
<label class="hidden" id="label-for-line-wrapping-toggle" for="line-wrapping-toggle">Wrap lines | ||
<input id="line-wrapping-toggle" type="checkbox" autocomplete="off"/> | ||
</label> | ||
</div>Generated by | ||
<a href="http://www.gradle.org">Gradle 8.7</a> at May 27, 2024, 9:51:46 PM</p> | ||
</div> | ||
</div> | ||
</body> | ||
</html> |
Oops, something went wrong.