From a349b7e92b038d1c555019697d16a2acf8fccd9f Mon Sep 17 00:00:00 2001 From: Seth Pal Date: Sun, 19 Nov 2023 01:02:42 +0530 Subject: [PATCH] latest code latest code --- notificationservice/Dockerfile | 2 +- notificationservice/docker-compose.yml | 5 + notificationservice/pom.xml | 296 +++++++++--------- .../NotificationserviceApplication.java | 81 +++-- .../config/TwilioConfig.java | 14 +- .../consumer/RabbitMQJsonConsumner.java | 13 +- .../NotificationHistoryController.java | 3 +- .../repositories/UserContactRepository.java | 12 + .../services/RabbitMQJsonProducerService.java | 4 +- .../services/SendEmailService.java | 4 +- .../services/SendSMSService.java | 8 +- .../services/UserService.java | 27 ++ .../thirdpartyClients/UserDtoClient.java | 17 + .../thirdpartyClients/UserServiceClient.java | 45 +++ .../src/main/resources/application.properties | 132 ++++---- .../NotificationserviceApplicationTests.java | 38 +-- 16 files changed, 418 insertions(+), 283 deletions(-) create mode 100644 notificationservice/docker-compose.yml create mode 100644 notificationservice/src/main/java/com/sepal/notificationservice/repositories/UserContactRepository.java create mode 100644 notificationservice/src/main/java/com/sepal/notificationservice/services/UserService.java create mode 100644 notificationservice/src/main/java/com/sepal/notificationservice/thirdpartyClients/UserDtoClient.java create mode 100644 notificationservice/src/main/java/com/sepal/notificationservice/thirdpartyClients/UserServiceClient.java diff --git a/notificationservice/Dockerfile b/notificationservice/Dockerfile index a23aef3..7ce521e 100644 --- a/notificationservice/Dockerfile +++ b/notificationservice/Dockerfile @@ -1,5 +1,5 @@ FROM openjdk:19 -FROM mysql:8 +#FROM mysql:8 LABEL authors="Seth Pal" EXPOSE 8080 ADD target/notification-app.jar notification-app.jar diff --git a/notificationservice/docker-compose.yml b/notificationservice/docker-compose.yml new file mode 100644 index 0000000..00b6ad2 --- /dev/null +++ b/notificationservice/docker-compose.yml @@ -0,0 +1,5 @@ +rabbitmq: + image: rabbitmq:management + ports: + - "5672:5672" + - "15672:15672" \ No newline at end of file diff --git a/notificationservice/pom.xml b/notificationservice/pom.xml index 706a45d..deb1444 100644 --- a/notificationservice/pom.xml +++ b/notificationservice/pom.xml @@ -1,148 +1,148 @@ - - - 4.0.0 - - org.springframework.boot - spring-boot-starter-parent - 3.1.3 - - - com.sepal - notificationservice - 0.0.1-SNAPSHOT - notificationservice - Notification Service using Spring Boot and RabbitMQ - - 19 - - - - org.springframework.boot - spring-boot-starter-amqp - - - org.springframework.boot - spring-boot-starter-web - - - - org.projectlombok - lombok - true - - - org.springframework.boot - spring-boot-starter-test - - - - com.h2database - h2 - runtime - - - - org.springframework.amqp - spring-rabbit-test - - - - org.springframework.boot - spring-boot-starter-mail - - - - - - com.twilio.sdk - twilio - 9.14.0 - - - - - org.springframework.boot - spring-boot-starter-data-jpa - - - org.springframework.boot - spring-boot-starter-jdbc - - - - org.springframework.boot - spring-boot-starter-data-jdbc - - - - org.flywaydb - flyway-mysql - 9.22.2 - - - - org.springframework.boot - spring-boot-devtools - runtime - true - - - com.mysql - mysql-connector-j - runtime - - - org.springframework.boot - spring-boot-configuration-processor - true - - - - org.springframework.boot - spring-boot-starter-actuator - - - - org.springdoc - springdoc-openapi-starter-webmvc-ui - 2.2.0 - - - - org.assertj - assertj-core - 3.24.2 - test - - - - - org.hamcrest - hamcrest - 2.2 - test - - - - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - - org.projectlombok - lombok - - - - - - notification-app - - - + + + 4.0.0 + + org.springframework.boot + spring-boot-starter-parent + 3.1.3 + + + com.sepal + notificationservice + 0.0.1-SNAPSHOT + notificationservice + Notification Service using Spring Boot and RabbitMQ + + 19 + + + + org.springframework.boot + spring-boot-starter-amqp + + + org.springframework.boot + spring-boot-starter-web + + + + org.projectlombok + lombok + true + + + org.springframework.boot + spring-boot-starter-test + + + + com.h2database + h2 + runtime + + + + org.springframework.amqp + spring-rabbit-test + + + + org.springframework.boot + spring-boot-starter-mail + + + + + + com.twilio.sdk + twilio + 9.14.0 + + + + + org.springframework.boot + spring-boot-starter-data-jpa + + + org.springframework.boot + spring-boot-starter-jdbc + + + + org.springframework.boot + spring-boot-starter-data-jdbc + + + + org.flywaydb + flyway-mysql + 9.22.2 + + + + org.springframework.boot + spring-boot-devtools + runtime + true + + + com.mysql + mysql-connector-j + runtime + + + org.springframework.boot + spring-boot-configuration-processor + true + + + + org.springframework.boot + spring-boot-starter-actuator + + + + org.springdoc + springdoc-openapi-starter-webmvc-ui + 2.2.0 + + + + org.assertj + assertj-core + 3.24.2 + test + + + + + org.hamcrest + hamcrest + 2.2 + test + + + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + org.projectlombok + lombok + + + + + + notification-app + + + diff --git a/notificationservice/src/main/java/com/sepal/notificationservice/NotificationserviceApplication.java b/notificationservice/src/main/java/com/sepal/notificationservice/NotificationserviceApplication.java index f158b28..3df148c 100644 --- a/notificationservice/src/main/java/com/sepal/notificationservice/NotificationserviceApplication.java +++ b/notificationservice/src/main/java/com/sepal/notificationservice/NotificationserviceApplication.java @@ -1,33 +1,48 @@ -package com.sepal.notificationservice; - - -import com.twilio.Twilio; -import jakarta.annotation.PostConstruct; -import lombok.RequiredArgsConstructor; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; - -import com.sepal.notificationservice.config.TwilioConfig; -import org.springframework.context.annotation.Configuration; - -@SpringBootApplication() -@Configuration -public class NotificationserviceApplication { - - @Value("${twilio.accountSID}") - private String accountSSID; - - @Value("${twilio.authToken}") - private String auth; - public static void main(String[] args) { - SpringApplication.run(NotificationserviceApplication.class, args); - } - - @PostConstruct - public void setup() - { - - Twilio.init(accountSSID,auth); - } -} +package com.sepal.notificationservice; + + +import com.twilio.Twilio; +import jakarta.annotation.PostConstruct; +import lombok.RequiredArgsConstructor; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +import com.sepal.notificationservice.config.TwilioConfig; +import org.springframework.context.annotation.Configuration; + +import java.util.Base64; + +@SpringBootApplication +@Configuration +public class NotificationserviceApplication { + + @Value("${twilio.accountSID}") + private String accountSSID; + + @Value("${twilio.authToken}") + private String auth; + + public static void main(String[] args) { + SpringApplication.run(NotificationserviceApplication.class, args); + } + + @PostConstruct + public void setup() + { + Twilio.init(decodeValue(accountSSID),decodeValue(auth)); + } + public String decodeValue(String encodedValue) + { + byte[] decodedBytes = Base64.getDecoder().decode(encodedValue); + return new String(decodedBytes); + } + + public String encodeValue(String encodedValue) { + String BasicBase64format + = Base64.getEncoder() + .encodeToString(encodedValue.getBytes()); + return BasicBase64format; + } +} diff --git a/notificationservice/src/main/java/com/sepal/notificationservice/config/TwilioConfig.java b/notificationservice/src/main/java/com/sepal/notificationservice/config/TwilioConfig.java index ebd6ac4..bf2fecf 100644 --- a/notificationservice/src/main/java/com/sepal/notificationservice/config/TwilioConfig.java +++ b/notificationservice/src/main/java/com/sepal/notificationservice/config/TwilioConfig.java @@ -1,14 +1,8 @@ package com.sepal.notificationservice.config; - -import com.twilio.Twilio; -import jakarta.annotation.PostConstruct; import lombok.Data; -import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.context.annotation.Configuration; -import org.springframework.stereotype.Component; import org.springframework.stereotype.Service; - import java.util.Base64; @Service @@ -23,11 +17,19 @@ public class TwilioConfig { private String fromNumber; private String toNumber="+919538965414"; + public String decodeValue(String encodedValue) { byte[] decodedBytes = Base64.getDecoder().decode(encodedValue); return new String(decodedBytes); } + public String encodeValue(String encodedValue) { + String BasicBase64format + = Base64.getEncoder() + .encodeToString(encodedValue.getBytes()); + return BasicBase64format; + } + } diff --git a/notificationservice/src/main/java/com/sepal/notificationservice/consumer/RabbitMQJsonConsumner.java b/notificationservice/src/main/java/com/sepal/notificationservice/consumer/RabbitMQJsonConsumner.java index 68a7067..1f31726 100644 --- a/notificationservice/src/main/java/com/sepal/notificationservice/consumer/RabbitMQJsonConsumner.java +++ b/notificationservice/src/main/java/com/sepal/notificationservice/consumer/RabbitMQJsonConsumner.java @@ -11,6 +11,7 @@ import com.sepal.notificationservice.repositories.UserRepository; import com.sepal.notificationservice.services.SendEmailService; import com.sepal.notificationservice.services.SendSMSService; +import com.sepal.notificationservice.services.UserService; import lombok.Data; import lombok.RequiredArgsConstructor; import org.slf4j.Logger; @@ -49,16 +50,22 @@ public class RabbitMQJsonConsumner { @Autowired private NotificationRepository notificationRepository; + @Autowired + private UserService userService; + public RabbitMQJsonConsumner(SendEmailService sendEmailService , SendSMSService sendSMSService , UserRepository userRepository - , NotificationRepository notificationRepository) + , NotificationRepository notificationRepository + ,UserService userService + ) { this.sendEmailService = sendEmailService; this.userRepository = userRepository; this.notificationRepository = notificationRepository; this.sendSMSService = sendSMSService; + this.userService=userService; } //Consumer is subscribed to the Queue @@ -78,7 +85,8 @@ For that user id I will fetch the user contact (email address and mobile number) Optional userOptional; userOptional = userRepository.findById(Long.valueOf(notificationDto.getUserid())); - + //below line need to enable once the User Service is working fine + //userDto=userService.getUserById(Long.valueOf(notificationDto.getUserid())); //Check if user is present in DB or not if(userOptional.isEmpty()){ notificationStatus= String.valueOf(Status.FAILED); @@ -100,7 +108,6 @@ For that user id I will fetch the user contact (email address and mobile number) notification.setStatus((Status.DELIVERED)); notification.setUser_id(notificationDto.getUserid()); notificationRepository.save(notification); - notificationStatus = String.valueOf(Status.DELIVERED); } diff --git a/notificationservice/src/main/java/com/sepal/notificationservice/controllers/NotificationHistoryController.java b/notificationservice/src/main/java/com/sepal/notificationservice/controllers/NotificationHistoryController.java index 0ca58bf..fec729a 100644 --- a/notificationservice/src/main/java/com/sepal/notificationservice/controllers/NotificationHistoryController.java +++ b/notificationservice/src/main/java/com/sepal/notificationservice/controllers/NotificationHistoryController.java @@ -3,6 +3,7 @@ import com.sepal.notificationservice.dtos.NotificationHistoryResponseDto; import com.sepal.notificationservice.services.NotificationHistoryService; import lombok.RequiredArgsConstructor; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; @@ -15,7 +16,7 @@ @RequiredArgsConstructor @RequestMapping("/api/v1") public class NotificationHistoryController { - //@Autowired + @Autowired NotificationHistoryService notificationHistoryService; public NotificationHistoryController(NotificationHistoryService notificationHistoryService) { diff --git a/notificationservice/src/main/java/com/sepal/notificationservice/repositories/UserContactRepository.java b/notificationservice/src/main/java/com/sepal/notificationservice/repositories/UserContactRepository.java new file mode 100644 index 0000000..3cf2878 --- /dev/null +++ b/notificationservice/src/main/java/com/sepal/notificationservice/repositories/UserContactRepository.java @@ -0,0 +1,12 @@ +package com.sepal.notificationservice.repositories; + +import com.sepal.notificationservice.models.UserContact; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +@Repository + +public interface UserContactRepository extends JpaRepository { + + +} diff --git a/notificationservice/src/main/java/com/sepal/notificationservice/services/RabbitMQJsonProducerService.java b/notificationservice/src/main/java/com/sepal/notificationservice/services/RabbitMQJsonProducerService.java index 87427d7..a3a9b61 100644 --- a/notificationservice/src/main/java/com/sepal/notificationservice/services/RabbitMQJsonProducerService.java +++ b/notificationservice/src/main/java/com/sepal/notificationservice/services/RabbitMQJsonProducerService.java @@ -15,7 +15,7 @@ public class RabbitMQJsonProducerService { - //private static final Logger LOGGER= LoggerFactory.getLogger(RabbitMQJsonProducerService.class); + private static final Logger LOGGER= LoggerFactory.getLogger(RabbitMQJsonProducerService.class); @Value("${rabbitmq.exchange.name}") private String exchange; @Value("${rabbitmq.json.routing.key}") @@ -32,7 +32,7 @@ public RabbitMQJsonProducerService(RabbitTemplate rabbitTemplate) { public String sendJsonMessage(NotificationRequestDto user) { String message="Notification sent to registered email and mobile, kindly check your email/mobile"; - //LOGGER.info(String.format(message+"--> %s", user.toString())); + LOGGER.info(String.format(message+"--> %s", user.toString())); rabbitTemplate.convertAndSend(exchange,jsonRoutingKey,user); return message; } diff --git a/notificationservice/src/main/java/com/sepal/notificationservice/services/SendEmailService.java b/notificationservice/src/main/java/com/sepal/notificationservice/services/SendEmailService.java index d3cffc1..d004ff1 100644 --- a/notificationservice/src/main/java/com/sepal/notificationservice/services/SendEmailService.java +++ b/notificationservice/src/main/java/com/sepal/notificationservice/services/SendEmailService.java @@ -19,7 +19,7 @@ @EnableAutoConfiguration public class SendEmailService { - // private static final Logger LOGGER= LoggerFactory.getLogger(SendEmailService.class); + private static final Logger LOGGER= LoggerFactory.getLogger(SendEmailService.class); @Autowired private JavaMailSender mailSender; @@ -38,7 +38,7 @@ public NotificationResponseDto sendEmail( message.setSubject(subject); message.setText(body); mailSender.send(message); - // LOGGER.info("Mail Sent Successfully........."+mailSender); + LOGGER.info("Mail Sent Successfully........."+mailSender); notificationResponseDto.setStatus(String.valueOf(Status.DELIVERED)); }catch(Exception ex) { diff --git a/notificationservice/src/main/java/com/sepal/notificationservice/services/SendSMSService.java b/notificationservice/src/main/java/com/sepal/notificationservice/services/SendSMSService.java index e827785..b653956 100644 --- a/notificationservice/src/main/java/com/sepal/notificationservice/services/SendSMSService.java +++ b/notificationservice/src/main/java/com/sepal/notificationservice/services/SendSMSService.java @@ -16,22 +16,22 @@ public class SendSMSService { @Autowired TwilioConfig twilioConfig; - //private static final Logger LOGGER= LoggerFactory.getLogger(SendSMSService.class); + private static final Logger LOGGER= LoggerFactory.getLogger(SendSMSService.class); public NotificationResponseDto sendSMS(String to, String sms) { NotificationResponseDto notificationResponseDto=new NotificationResponseDto(); try { Message message = Message .creator(new PhoneNumber(to) - , new PhoneNumber(twilioConfig.decodeValue(twilioConfig.getFromNumber())) + , new PhoneNumber(twilioConfig.getFromNumber()) , sms) .create(); notificationResponseDto.setStatus(String.valueOf(Status.DELIVERED)); - //LOGGER.info("SMS Sent successfully....." + message.getStatus()); + LOGGER.info("SMS Sent successfully....." + message.getStatus()); }catch (Exception ex) { notificationResponseDto.setStatus(String.valueOf(Status.FAILED)); - // LOGGER.error("Kindly check if you mobile number is in verified account.....Error-->" + ex.getMessage()); + LOGGER.error("Kindly check if you mobile number is in verified account.....Error-->" + ex.getMessage()); } return notificationResponseDto; } diff --git a/notificationservice/src/main/java/com/sepal/notificationservice/services/UserService.java b/notificationservice/src/main/java/com/sepal/notificationservice/services/UserService.java new file mode 100644 index 0000000..4ea4e5f --- /dev/null +++ b/notificationservice/src/main/java/com/sepal/notificationservice/services/UserService.java @@ -0,0 +1,27 @@ +package com.sepal.notificationservice.services; + +import com.sepal.notificationservice.dtos.UserDto; +import com.sepal.notificationservice.thirdpartyClients.UserDtoClient; +import com.sepal.notificationservice.thirdpartyClients.UserServiceClient; +import org.springframework.stereotype.Service; + +@Service +public class UserService { + private UserServiceClient userServiceClient; + public UserService(UserServiceClient userServiceClient) { + this.userServiceClient = userServiceClient; + } + + public UserDto getUserById(Long id) { + + UserDto userDto =new UserDto(); + UserDtoClient userDtoClient=new UserDtoClient(); + userDtoClient=userServiceClient.getProductById(id); + userDto.setUserid(id); + userDto.setEmail(userDtoClient.getEmail()); + userDto.setMobile(userDtoClient.getPhone()); + return userDto; + } + + +} diff --git a/notificationservice/src/main/java/com/sepal/notificationservice/thirdpartyClients/UserDtoClient.java b/notificationservice/src/main/java/com/sepal/notificationservice/thirdpartyClients/UserDtoClient.java new file mode 100644 index 0000000..370e248 --- /dev/null +++ b/notificationservice/src/main/java/com/sepal/notificationservice/thirdpartyClients/UserDtoClient.java @@ -0,0 +1,17 @@ +package com.sepal.notificationservice.thirdpartyClients; + +import jakarta.persistence.ManyToMany; +import lombok.Data; + +import java.util.HashSet; +import java.util.Set; + +@Data +public class UserDtoClient { + + private String name = ""; + private String email = ""; + private String phone = ""; + private String password=""; + private Set roles = new HashSet<>(); +} diff --git a/notificationservice/src/main/java/com/sepal/notificationservice/thirdpartyClients/UserServiceClient.java b/notificationservice/src/main/java/com/sepal/notificationservice/thirdpartyClients/UserServiceClient.java new file mode 100644 index 0000000..5f3a316 --- /dev/null +++ b/notificationservice/src/main/java/com/sepal/notificationservice/thirdpartyClients/UserServiceClient.java @@ -0,0 +1,45 @@ +package com.sepal.notificationservice.thirdpartyClients; + + +import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.web.client.RestTemplateBuilder; +import org.springframework.data.crossstore.ChangeSetPersister; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Service; +import org.springframework.web.client.RestTemplate; + +@Service +public class UserServiceClient { + + private RestTemplateBuilder restTemplateBuilder; + @Value("${user.api.url}") + private String userApiUrl; + + @Value("${user.api.path}") + private String userApiPath; + private String userAPIBasePath; + private String specificUserPath; + + public UserServiceClient(RestTemplateBuilder restTemplateBuilder, + @Value("${user.api.url}") String userApiUrl, + @Value("${user.api.path}") String userApiPath) { + this.restTemplateBuilder = restTemplateBuilder; + this.userAPIBasePath=userApiUrl+userApiPath; + this.specificUserPath = userApiUrl+userApiPath + "/{id}"; + } + + public UserDtoClient getProductById(Long id) { + RestTemplate restTemplate = restTemplateBuilder.build(); + ResponseEntity response = + restTemplate.getForEntity(specificUserPath, UserDtoClient.class, id); + + UserDtoClient userDtoClient = response.getBody(); + + if (userDtoClient == null) { + + return new UserDtoClient(); + } + return userDtoClient; + } + +} diff --git a/notificationservice/src/main/resources/application.properties b/notificationservice/src/main/resources/application.properties index 6ba458a..962673d 100644 --- a/notificationservice/src/main/resources/application.properties +++ b/notificationservice/src/main/resources/application.properties @@ -1,64 +1,68 @@ -server.port=8000 -logging.level.org.springframework.test.context.cache=debug -#Springboot Autoconfiguration for spring AMQP(Advance Message Queue Protocol) -spring.rabbitmq.host=localhost -spring.rabbitmq.port=5672 -spring.rabbitmq.username=guest -spring.rabbitmq.password=guest -spring.rabbitmq.connection-timeout=10000 -rabbitmq.queue.name=notification_queue -rabbitmq.queue.json.name=notification_json_queue -rabbitmq.exchange.name=notication_exchange -rabbitmq.routing.key=notification_routing_key -rabbitmq.json.routing.key=notification_json_routing_key - -#Database configuration - -server.error.include-stacktrace=never - -#spring.jpa.hibernate.ddl-auto=update -#spring.datasource.url=jdbc:mysql://localhost:3306/notificationservice -#spring.datasource.username=notificationservice -#spring.datasource.password=Aabb@3344 -#spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver -#spring.jpa.show-sql=true - - -# H2 DB configuration - -spring.datasource.url=jdbc:h2:file:/data/demo -#spring.datasource.url=jdbc:h2:mem:testdb -spring.datasource.driverClassName=org.h2.Driver -spring.datasource.username=sa -spring.datasource.password=password -spring.jpa.database-platform=org.hibernate.dialect.H2Dialect -#spring.jpa.defer-datasource-initialization=true -spring.h2.console.enabled=true -spring.h2.console.path=/h2-console -spring.h2.console.settings.trace=false -spring.h2.console.settings.web-allow-others=false - - - - -#Email configs - -spring.mail.host=smtp.gmail.com -spring.mail.port=587 -spring.mail.username=tpulse385@gmail.com -spring.mail.password=spgmpvsnilovjvtd -spring.mail.properties.mail.smtp.auth=true -spring.mail.properties.mail.smtp.starttls.required=true -spring.mail.properties.mail.smtp.starttls.enable=true -spring.mail.subject=Notification Alert - -#Twilio configs for mobile sms -twilio.accountSID=QUM1NTI3ZGIwODM4ZDZhNmViYzI0MjA2ZDlhMmM4NWU0ZQ== -twilio.authToken=ZWUwODQxZGU5OWVmZTAzZDkzMDY2YWUzYjFlMDg2ZDI= -twilio.fromNumber=KzEyNTY4MjYxMjM0 - - -#Swagger Config - -springdoc.api-docs.path=/api-docs -springdoc.swagger-ui.path=/swagger-ui-custom.html +server.port=8000 +logging.level.org.springframework.test.context.cache=debug +#Springboot Autoconfiguration for spring AMQP(Advance Message Queue Protocol) +spring.rabbitmq.host=172.26.224.1 +spring.rabbitmq.port=5672 +spring.rabbitmq.username=guest +spring.rabbitmq.password=guest +spring.rabbitmq.connection-timeout=10000 +rabbitmq.queue.name=notification_queue +rabbitmq.queue.json.name=notification_json_queue +rabbitmq.exchange.name=notication_exchange +rabbitmq.routing.key=notification_routing_key +rabbitmq.json.routing.key=notification_json_routing_key + +#Database configuration + +server.error.include-stacktrace=never +#root/admin123 +spring.jpa.hibernate.ddl-auto=update +#spring.datasource.url=jdbc:mysql://localhost:3306/notificationservice +#spring.datasource.username=notificationservice +#spring.datasource.password=Aabb@3344 +#spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver +#spring.jpa.show-sql=true + + +# H2 DB configuration + +#spring.datasource.url=jdbc:h2:file:/data/demo +spring.datasource.url=jdbc:h2:mem:sepal;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE +spring.datasource.driverClassName=org.h2.Driver +spring.datasource.username=sa +spring.datasource.password=password +spring.jpa.database-platform=org.hibernate.dialect.H2Dialect +#spring.jpa.defer-datasource-initialization=true +spring.h2.console.enabled=true +spring.h2.console.path=/h2-console +#spring.h2.console.settings.trace=false +spring.h2.console.settings.web-allow-others=true + + + + +#Email configs + +spring.mail.host=smtp.gmail.com +spring.mail.port=587 +spring.mail.username=tpulse385@gmail.com +spring.mail.password=spgmpvsnilovjvtd +spring.mail.properties.mail.smtp.auth=true +spring.mail.properties.mail.smtp.starttls.required=true +spring.mail.properties.mail.smtp.starttls.enable=true +spring.mail.subject=Notification Alert + +#Twilio configs for mobile sms +twilio.accountSID=QUM1NTI3ZGIwODM4ZDZhNmViYzI0MjA2ZDlhMmM4NWU0ZQ== +twilio.authToken=MjliODA3N2ExNDEwNDA3NGQ4ZWYwNmNhNWE3YzE5YWY= +twilio.fromNumber=+12568261234 + + +#Swagger Config + +springdoc.api-docs.path=/api-docs +springdoc.swagger-ui.path=/swagger-ui-custom.html + + +user.api.url=http://localhost:8001 +user.api.path=/users diff --git a/notificationservice/src/test/java/com/sepal/notificationservice/NotificationserviceApplicationTests.java b/notificationservice/src/test/java/com/sepal/notificationservice/NotificationserviceApplicationTests.java index f25d894..2ce784e 100644 --- a/notificationservice/src/test/java/com/sepal/notificationservice/NotificationserviceApplicationTests.java +++ b/notificationservice/src/test/java/com/sepal/notificationservice/NotificationserviceApplicationTests.java @@ -1,19 +1,19 @@ -package com.sepal.notificationservice; - -import com.sun.mail.handlers.handler_base; -import org.junit.jupiter.api.Test; -import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; - - -@WebMvcTest(handler_base.class) -class NotificationserviceApplicationTests { - - @Test - void contextLoads() - { - - } - - - -} +package com.sepal.notificationservice; + +import com.sun.mail.handlers.handler_base; +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; + +import java.util.Base64; + + +@WebMvcTest(handler_base.class) +class NotificationserviceApplicationTests { + + @Test + void contextLoads() + { + + } + +}