-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Remove hardcoded messages from `LoggingAspect`. - Switch naming between `SmsService` and `OtpService`. - Delete `InMemoryVerificationService` since Redis implementation is much better. - Delete `CollectionConfig` class as it is never used with Redis implementation. - Upgrade `validateUserToken` method to inform user of "invalid token" error before "expired token" error. - Give Model and DTO classes a simpler names. - Add test hook in pre-commit. - Add CI workflow pipeline.
- Loading branch information
1 parent
ee4f8be
commit 1fa23d5
Showing
26 changed files
with
244 additions
and
214 deletions.
There are no files selected for viewing
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,70 @@ | ||
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time | ||
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven | ||
|
||
# This workflow uses actions that are not certified by GitHub. | ||
# They are provided by a third-party and are governed by | ||
# separate terms of service, privacy policy, and support | ||
# documentation. | ||
|
||
name: CI | ||
on: | ||
push: | ||
branches: [ "master" ] | ||
pull_request: | ||
branches: [ "master" ] | ||
|
||
jobs: | ||
Build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up JDK 21 | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: '21' | ||
distribution: 'temurin' | ||
cache: maven | ||
|
||
# Build | ||
- name: Building | ||
run: mvn -B package | ||
|
||
Test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up JDK 21 | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: '21' | ||
distribution: 'temurin' | ||
cache: maven | ||
|
||
# # Install Docker Compose | ||
# - name: Install Docker Compose | ||
# run: | | ||
# sudo apt-get update | ||
# sudo apt-get install docker-compose -y | ||
|
||
# Install Docker | ||
- name: Install Docker | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install docker.io -y | ||
sudo systemctl start docker | ||
sudo systemctl enable docker | ||
sudo usermod -aG docker $USER | ||
# Test | ||
- name: Testing | ||
run: mvn test | ||
|
||
Code-Quality: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: nikitasavinov/checkstyle-action@0.6.0 | ||
with: | ||
checkstyle_config: config/checkstyle/sun_checks_custom.xml |
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
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
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
22 changes: 0 additions & 22 deletions
22
src/main/java/com/ittovative/otpservice/config/CollectionsConfig.java
This file was deleted.
Oops, something went wrong.
8 changes: 8 additions & 0 deletions
8
src/main/java/com/ittovative/otpservice/config/RedisConfig.java
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
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
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
22 changes: 0 additions & 22 deletions
22
src/main/java/com/ittovative/otpservice/config/VerificationConfig.java
This file was deleted.
Oops, something went wrong.
9 changes: 3 additions & 6 deletions
9
src/main/java/com/ittovative/otpservice/constant/ApiResponseConstant.java
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 |
---|---|---|
@@ -1,15 +1,12 @@ | ||
package com.ittovative.otpservice.constant; | ||
|
||
import static com.ittovative.otpservice.constant.ExceptionConstant.UTILITY_CLASS_INSTANTIATION; | ||
|
||
public final class ApiResponseConstant { | ||
public static final String OTP_SENT = "OTP sent successfully!"; | ||
public static final String TOKEN_VERIFIED = "Token verified successfully!"; | ||
public static final String VALIDATION_ERROR = "Validation error!"; | ||
public static final String INVALID_PHONE_NUMBER_FORMAT = | ||
"Invalid phone number format! (only digits, plus-sign and dashes are allowed)."; | ||
public static final String INVALID_TOKEN_FORMAT = "Token must be a 6-digit number!"; | ||
public static final String INVALID_TOKEN = "Invalid token!"; | ||
public static final String TOKEN_EXPIRED = "Token has expired!"; | ||
|
||
private ApiResponseConstant() { | ||
throw new IllegalStateException(UTILITY_CLASS_INSTANTIATION); | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
src/main/java/com/ittovative/otpservice/constant/AspectConstant.java
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,13 @@ | ||
package com.ittovative.otpservice.constant; | ||
|
||
import static com.ittovative.otpservice.constant.ExceptionConstant.UTILITY_CLASS_INSTANTIATION; | ||
|
||
public final class AspectConstant { | ||
public static final String BEFORE_MESSAGE = "Executing ===> {}.{} with arguments: [{}]"; | ||
public static final String AFTER_RETURN_MESSAGE = "Finished ===> {}.{} with arguments: [{}] and returned {}"; | ||
public static final String AFTER_THROW_MESSAGE = "Exception {} in ===> {}.{} with arguments: [{}]"; | ||
|
||
private AspectConstant() { | ||
throw new IllegalStateException(UTILITY_CLASS_INSTANTIATION); | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
src/main/java/com/ittovative/otpservice/constant/ExceptionConstant.java
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,16 @@ | ||
package com.ittovative.otpservice.constant; | ||
|
||
public final class ExceptionConstant { | ||
public static final String UTILITY_CLASS_INSTANTIATION = "Utility class should not be instantiated!"; | ||
public static final String VALIDATION_ERROR = "Validation error!"; | ||
public static final String INVALID_PHONE_NUMBER_FORMAT = | ||
"Invalid phone number format! (only digits, plus-sign and dashes are allowed)."; | ||
public static final String INVALID_TOKEN_FORMAT = "Token must be a 6-digit number!"; | ||
public static final String INVALID_TOKEN = "Invalid token!"; | ||
public static final String TOKEN_EXPIRED = "Token has expired!"; | ||
|
||
|
||
private ExceptionConstant() { | ||
throw new IllegalStateException(UTILITY_CLASS_INSTANTIATION); | ||
} | ||
} |
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
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
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
Oops, something went wrong.