From 597e58e9186c1c634b8ffe22a4051e08ad7c0fa9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Borja=20Paz=20Rodr=C3=ADguez?= Date: Wed, 17 Nov 2021 00:18:31 +0100 Subject: [PATCH 1/3] fix: Correct test --- .../authenticate/AuthenticateUserCommandHandlerShould.java | 3 ++- .../test/tv/codely/backoffice/auth/domain/AuthUserMother.java | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/backoffice/test/tv/codely/backoffice/auth/application/authenticate/AuthenticateUserCommandHandlerShould.java b/src/backoffice/test/tv/codely/backoffice/auth/application/authenticate/AuthenticateUserCommandHandlerShould.java index a37020e9..c9630991 100644 --- a/src/backoffice/test/tv/codely/backoffice/auth/application/authenticate/AuthenticateUserCommandHandlerShould.java +++ b/src/backoffice/test/tv/codely/backoffice/auth/application/authenticate/AuthenticateUserCommandHandlerShould.java @@ -46,7 +46,8 @@ void throw_an_exception_when_the_user_does_not_exist() { void throw_an_exception_when_the_password_does_not_math() { assertThrows(InvalidAuthCredentials.class, () -> { AuthenticateUserCommand command = AuthenticateUserCommandMother.random(); - AuthUser authUser = AuthUserMother.withUsername(command.username()); + AuthUser authUser = AuthUserMother.withUsernameAndPassword(command.username(), + command.password().concat("๐Ÿ‘Ž")); shouldSearch(authUser.username(), authUser); diff --git a/src/backoffice/test/tv/codely/backoffice/auth/domain/AuthUserMother.java b/src/backoffice/test/tv/codely/backoffice/auth/domain/AuthUserMother.java index 14e26c9b..6030f9bd 100644 --- a/src/backoffice/test/tv/codely/backoffice/auth/domain/AuthUserMother.java +++ b/src/backoffice/test/tv/codely/backoffice/auth/domain/AuthUserMother.java @@ -15,7 +15,7 @@ public static AuthUser fromCommand(AuthenticateUserCommand command) { return create(AuthUsernameMother.create(command.username()), AuthPasswordMother.create(command.password())); } - public static AuthUser withUsername(String username) { - return create(AuthUsernameMother.create(username), AuthPasswordMother.random()); + public static AuthUser withUsernameAndPassword(String username, String password) { + return create(AuthUsernameMother.create(username), AuthPasswordMother.create(password)); } } From 2ec5335a53eec601133147fe942ccca365db3cb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Borja=20Paz=20Rodr=C3=ADguez?= Date: Wed, 17 Nov 2021 00:19:28 +0100 Subject: [PATCH 2/3] feat: Improve CI workflow and fix gradle warnings --- .github/workflows/ci.yml | 17 +++++++++++------ build.gradle | 6 +++--- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ca7ca075..df003039 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,24 +1,29 @@ name: CI -on: [push] +on: + push: + branches: + - master + pull_request: jobs: build: - + name: ๐Ÿง‘โ€๐Ÿ”ฌ Test project runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 + - name: โฌ‡๏ธ Checkout project + uses: actions/checkout@v2 - - name: Start all the environment + - name: ๐Ÿ Start all the environment run: docker-compose up -d - - name: Wait for the environment to get up + - name: โฑ๏ธ Wait for the environment to get up run: | while ! make ping-mysql &>/dev/null; do echo "Waiting for database connection..." sleep 2 done - - name: Run the tests + - name: ๐Ÿงช Run the tests run: make test diff --git a/build.gradle b/build.gradle index 89279d81..11cc881c 100644 --- a/build.gradle +++ b/build.gradle @@ -38,7 +38,7 @@ allprojects { implementation 'org.springframework.boot:spring-boot-starter-amqp' implementation 'org.elasticsearch.client:elasticsearch-rest-client:6.8.5' implementation 'org.elasticsearch.client:elasticsearch-rest-high-level-client:6.8.4' - runtime 'mysql:mysql-connector-java:8.0.18' + runtimeOnly 'mysql:mysql-connector-java:8.0.18' // Test testImplementation 'org.junit.jupiter:junit-jupiter-api:5.5.2' @@ -136,8 +136,8 @@ sourceSets { apply plugin: 'application' bootJar { - baseName = 'java-ddd-skeleton' - version = '0.0.1' + archiveBaseName = 'java-ddd-skeleton' + archiveVersion = '0.0.1' } mainClassName = 'tv.codely.apps.Starter' From 087f6e749ed40620eef620ab4dcd2e6a180f0710 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Borja=20Paz=20Rodr=C3=ADguez?= Date: Wed, 17 Nov 2021 00:24:42 +0100 Subject: [PATCH 3/3] fix: Correct typo in test name --- .../authenticate/AuthenticateUserCommandHandlerShould.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backoffice/test/tv/codely/backoffice/auth/application/authenticate/AuthenticateUserCommandHandlerShould.java b/src/backoffice/test/tv/codely/backoffice/auth/application/authenticate/AuthenticateUserCommandHandlerShould.java index c9630991..7b2e0eed 100644 --- a/src/backoffice/test/tv/codely/backoffice/auth/application/authenticate/AuthenticateUserCommandHandlerShould.java +++ b/src/backoffice/test/tv/codely/backoffice/auth/application/authenticate/AuthenticateUserCommandHandlerShould.java @@ -43,7 +43,7 @@ void throw_an_exception_when_the_user_does_not_exist() { } @Test - void throw_an_exception_when_the_password_does_not_math() { + void throw_an_exception_when_the_password_does_not_match() { assertThrows(InvalidAuthCredentials.class, () -> { AuthenticateUserCommand command = AuthenticateUserCommandMother.random(); AuthUser authUser = AuthUserMother.withUsernameAndPassword(command.username(),