From 0da85e6d57a6b52d257f4b409ecb83490bb8c7c3 Mon Sep 17 00:00:00 2001 From: Tobias Hund Date: Fri, 13 Jan 2023 21:12:08 +0100 Subject: [PATCH 1/4] modularize commons package --- build.gradle | 2 ++ modules/commons/build.gradle | 13 +++++++++++++ .../commons/application/ApplicationComponent.java | 0 .../commons/application/IntegrationEvent.java | 0 .../exception/UnauthenticatedException.java | 0 .../modules/commons/core/ImpossibleException.java | 0 .../commons/core/NotImplementedYetException.java | 0 .../prox/modules/commons/domain/AggregateRoot.java | 0 .../commons/domain/AuditedAggregateRoot.java | 0 .../modules/commons/domain/DomainComponent.java | 0 .../prox/modules/commons/domain/DomainEvent.java | 0 .../modules/commons/domain/ReadOnlyRepository.java | 0 .../modules/commons/domain/ReferenceObject.java | 0 .../infrastructure/InfrastructureComponent.java | 0 .../commons/domain/AuditedAggregateRootTest.java | 0 settings.gradle | 2 ++ .../domain/lecturer/events/LecturerTagged.java | 1 - .../usecase/SetTagCollectionHandler.java | 2 -- .../tagcollection/events/TagCollectionCreated.java | 2 -- .../SpringSecurityAuthenticationFacadeImplTest.java | 1 - 20 files changed, 17 insertions(+), 6 deletions(-) create mode 100644 modules/commons/build.gradle rename {src => modules/commons/src}/main/java/de/innovationhub/prox/modules/commons/application/ApplicationComponent.java (100%) rename {src => modules/commons/src}/main/java/de/innovationhub/prox/modules/commons/application/IntegrationEvent.java (100%) rename {src => modules/commons/src}/main/java/de/innovationhub/prox/modules/commons/application/exception/UnauthenticatedException.java (100%) rename {src => modules/commons/src}/main/java/de/innovationhub/prox/modules/commons/core/ImpossibleException.java (100%) rename {src => modules/commons/src}/main/java/de/innovationhub/prox/modules/commons/core/NotImplementedYetException.java (100%) rename {src => modules/commons/src}/main/java/de/innovationhub/prox/modules/commons/domain/AggregateRoot.java (100%) rename {src => modules/commons/src}/main/java/de/innovationhub/prox/modules/commons/domain/AuditedAggregateRoot.java (100%) rename {src => modules/commons/src}/main/java/de/innovationhub/prox/modules/commons/domain/DomainComponent.java (100%) rename {src => modules/commons/src}/main/java/de/innovationhub/prox/modules/commons/domain/DomainEvent.java (100%) rename {src => modules/commons/src}/main/java/de/innovationhub/prox/modules/commons/domain/ReadOnlyRepository.java (100%) rename {src => modules/commons/src}/main/java/de/innovationhub/prox/modules/commons/domain/ReferenceObject.java (100%) rename {src => modules/commons/src}/main/java/de/innovationhub/prox/modules/commons/infrastructure/InfrastructureComponent.java (100%) rename {src => modules/commons/src}/test/java/de/innovationhub/prox/modules/commons/domain/AuditedAggregateRootTest.java (100%) diff --git a/build.gradle b/build.gradle index eacb62f3..502c8677 100644 --- a/build.gradle +++ b/build.gradle @@ -30,6 +30,8 @@ springBoot { dependencies { annotationProcessor "org.springframework.boot:spring-boot-configuration-processor" + implementation project(":modules:commons") + implementation "com.google.code.findbugs:annotations:3.0.1u2" implementation 'org.springframework.boot:spring-boot-starter-actuator' diff --git a/modules/commons/build.gradle b/modules/commons/build.gradle new file mode 100644 index 00000000..403b51d5 --- /dev/null +++ b/modules/commons/build.gradle @@ -0,0 +1,13 @@ +plugins { + id 'java' + id "java-conventions" + id 'org.springframework.boot' version '3.0.1' + id 'io.spring.dependency-management' version '1.1.0' +} + +dependencies { + implementation 'org.springframework.data:spring-data-commons' + implementation 'org.springframework.data:spring-data-jpa' + implementation 'jakarta.persistence:jakarta.persistence-api' + +} \ No newline at end of file diff --git a/src/main/java/de/innovationhub/prox/modules/commons/application/ApplicationComponent.java b/modules/commons/src/main/java/de/innovationhub/prox/modules/commons/application/ApplicationComponent.java similarity index 100% rename from src/main/java/de/innovationhub/prox/modules/commons/application/ApplicationComponent.java rename to modules/commons/src/main/java/de/innovationhub/prox/modules/commons/application/ApplicationComponent.java diff --git a/src/main/java/de/innovationhub/prox/modules/commons/application/IntegrationEvent.java b/modules/commons/src/main/java/de/innovationhub/prox/modules/commons/application/IntegrationEvent.java similarity index 100% rename from src/main/java/de/innovationhub/prox/modules/commons/application/IntegrationEvent.java rename to modules/commons/src/main/java/de/innovationhub/prox/modules/commons/application/IntegrationEvent.java diff --git a/src/main/java/de/innovationhub/prox/modules/commons/application/exception/UnauthenticatedException.java b/modules/commons/src/main/java/de/innovationhub/prox/modules/commons/application/exception/UnauthenticatedException.java similarity index 100% rename from src/main/java/de/innovationhub/prox/modules/commons/application/exception/UnauthenticatedException.java rename to modules/commons/src/main/java/de/innovationhub/prox/modules/commons/application/exception/UnauthenticatedException.java diff --git a/src/main/java/de/innovationhub/prox/modules/commons/core/ImpossibleException.java b/modules/commons/src/main/java/de/innovationhub/prox/modules/commons/core/ImpossibleException.java similarity index 100% rename from src/main/java/de/innovationhub/prox/modules/commons/core/ImpossibleException.java rename to modules/commons/src/main/java/de/innovationhub/prox/modules/commons/core/ImpossibleException.java diff --git a/src/main/java/de/innovationhub/prox/modules/commons/core/NotImplementedYetException.java b/modules/commons/src/main/java/de/innovationhub/prox/modules/commons/core/NotImplementedYetException.java similarity index 100% rename from src/main/java/de/innovationhub/prox/modules/commons/core/NotImplementedYetException.java rename to modules/commons/src/main/java/de/innovationhub/prox/modules/commons/core/NotImplementedYetException.java diff --git a/src/main/java/de/innovationhub/prox/modules/commons/domain/AggregateRoot.java b/modules/commons/src/main/java/de/innovationhub/prox/modules/commons/domain/AggregateRoot.java similarity index 100% rename from src/main/java/de/innovationhub/prox/modules/commons/domain/AggregateRoot.java rename to modules/commons/src/main/java/de/innovationhub/prox/modules/commons/domain/AggregateRoot.java diff --git a/src/main/java/de/innovationhub/prox/modules/commons/domain/AuditedAggregateRoot.java b/modules/commons/src/main/java/de/innovationhub/prox/modules/commons/domain/AuditedAggregateRoot.java similarity index 100% rename from src/main/java/de/innovationhub/prox/modules/commons/domain/AuditedAggregateRoot.java rename to modules/commons/src/main/java/de/innovationhub/prox/modules/commons/domain/AuditedAggregateRoot.java diff --git a/src/main/java/de/innovationhub/prox/modules/commons/domain/DomainComponent.java b/modules/commons/src/main/java/de/innovationhub/prox/modules/commons/domain/DomainComponent.java similarity index 100% rename from src/main/java/de/innovationhub/prox/modules/commons/domain/DomainComponent.java rename to modules/commons/src/main/java/de/innovationhub/prox/modules/commons/domain/DomainComponent.java diff --git a/src/main/java/de/innovationhub/prox/modules/commons/domain/DomainEvent.java b/modules/commons/src/main/java/de/innovationhub/prox/modules/commons/domain/DomainEvent.java similarity index 100% rename from src/main/java/de/innovationhub/prox/modules/commons/domain/DomainEvent.java rename to modules/commons/src/main/java/de/innovationhub/prox/modules/commons/domain/DomainEvent.java diff --git a/src/main/java/de/innovationhub/prox/modules/commons/domain/ReadOnlyRepository.java b/modules/commons/src/main/java/de/innovationhub/prox/modules/commons/domain/ReadOnlyRepository.java similarity index 100% rename from src/main/java/de/innovationhub/prox/modules/commons/domain/ReadOnlyRepository.java rename to modules/commons/src/main/java/de/innovationhub/prox/modules/commons/domain/ReadOnlyRepository.java diff --git a/src/main/java/de/innovationhub/prox/modules/commons/domain/ReferenceObject.java b/modules/commons/src/main/java/de/innovationhub/prox/modules/commons/domain/ReferenceObject.java similarity index 100% rename from src/main/java/de/innovationhub/prox/modules/commons/domain/ReferenceObject.java rename to modules/commons/src/main/java/de/innovationhub/prox/modules/commons/domain/ReferenceObject.java diff --git a/src/main/java/de/innovationhub/prox/modules/commons/infrastructure/InfrastructureComponent.java b/modules/commons/src/main/java/de/innovationhub/prox/modules/commons/infrastructure/InfrastructureComponent.java similarity index 100% rename from src/main/java/de/innovationhub/prox/modules/commons/infrastructure/InfrastructureComponent.java rename to modules/commons/src/main/java/de/innovationhub/prox/modules/commons/infrastructure/InfrastructureComponent.java diff --git a/src/test/java/de/innovationhub/prox/modules/commons/domain/AuditedAggregateRootTest.java b/modules/commons/src/test/java/de/innovationhub/prox/modules/commons/domain/AuditedAggregateRootTest.java similarity index 100% rename from src/test/java/de/innovationhub/prox/modules/commons/domain/AuditedAggregateRootTest.java rename to modules/commons/src/test/java/de/innovationhub/prox/modules/commons/domain/AuditedAggregateRootTest.java diff --git a/settings.gradle b/settings.gradle index 9a0ff753..8e02cd92 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1 +1,3 @@ rootProject.name = "prox-backend" + +include("modules:commons") \ No newline at end of file diff --git a/src/main/java/de/innovationhub/prox/modules/profile/domain/lecturer/events/LecturerTagged.java b/src/main/java/de/innovationhub/prox/modules/profile/domain/lecturer/events/LecturerTagged.java index 0d11cd09..99034cea 100644 --- a/src/main/java/de/innovationhub/prox/modules/profile/domain/lecturer/events/LecturerTagged.java +++ b/src/main/java/de/innovationhub/prox/modules/profile/domain/lecturer/events/LecturerTagged.java @@ -2,7 +2,6 @@ import de.innovationhub.prox.modules.commons.domain.DomainEvent; import java.util.Collection; -import java.util.List; import java.util.UUID; public record LecturerTagged( diff --git a/src/main/java/de/innovationhub/prox/modules/tag/application/tagcollection/usecase/SetTagCollectionHandler.java b/src/main/java/de/innovationhub/prox/modules/tag/application/tagcollection/usecase/SetTagCollectionHandler.java index a229fc42..e987a7c3 100644 --- a/src/main/java/de/innovationhub/prox/modules/tag/application/tagcollection/usecase/SetTagCollectionHandler.java +++ b/src/main/java/de/innovationhub/prox/modules/tag/application/tagcollection/usecase/SetTagCollectionHandler.java @@ -4,9 +4,7 @@ import de.innovationhub.prox.modules.tag.domain.tag.TagRepository; import de.innovationhub.prox.modules.tag.domain.tagcollection.TagCollection; import de.innovationhub.prox.modules.tag.domain.tagcollection.TagCollectionRepository; -import java.util.ArrayList; import java.util.Collection; -import java.util.List; import java.util.UUID; import java.util.stream.StreamSupport; import lombok.RequiredArgsConstructor; diff --git a/src/main/java/de/innovationhub/prox/modules/tag/domain/tagcollection/events/TagCollectionCreated.java b/src/main/java/de/innovationhub/prox/modules/tag/domain/tagcollection/events/TagCollectionCreated.java index 39fdc79b..b32aebf4 100644 --- a/src/main/java/de/innovationhub/prox/modules/tag/domain/tagcollection/events/TagCollectionCreated.java +++ b/src/main/java/de/innovationhub/prox/modules/tag/domain/tagcollection/events/TagCollectionCreated.java @@ -1,9 +1,7 @@ package de.innovationhub.prox.modules.tag.domain.tagcollection.events; import de.innovationhub.prox.modules.commons.domain.DomainEvent; -import de.innovationhub.prox.modules.tag.domain.tag.Tag; import de.innovationhub.prox.modules.tag.domain.tagcollection.TagCollection; -import java.util.List; import java.util.UUID; public record TagCollectionCreated(UUID id) implements DomainEvent { diff --git a/src/test/java/de/innovationhub/prox/modules/user/application/user/SpringSecurityAuthenticationFacadeImplTest.java b/src/test/java/de/innovationhub/prox/modules/user/application/user/SpringSecurityAuthenticationFacadeImplTest.java index d9fddd1b..f1f608c8 100644 --- a/src/test/java/de/innovationhub/prox/modules/user/application/user/SpringSecurityAuthenticationFacadeImplTest.java +++ b/src/test/java/de/innovationhub/prox/modules/user/application/user/SpringSecurityAuthenticationFacadeImplTest.java @@ -7,7 +7,6 @@ import de.innovationhub.prox.AbstractIntegrationTest; import de.innovationhub.prox.modules.commons.application.exception.UnauthenticatedException; -import de.innovationhub.prox.modules.user.application.user.SpringSecurityAuthenticationFacadeImpl; import de.innovationhub.prox.modules.user.domain.user.ProxUserRepository; import java.util.Collection; import org.junit.jupiter.api.Test; From 3ae8565deaf0d1e497f1545daead4a2dac51bfad Mon Sep 17 00:00:00 2001 From: Tobias Hund Date: Fri, 13 Jan 2023 21:18:28 +0100 Subject: [PATCH 2/4] introduce spring conventions --- build.gradle | 9 +------- buildSrc/build.gradle | 2 ++ .../src/main/groovy/spring-conventions.gradle | 23 +++++++++++++++++++ modules/commons/build.gradle | 3 +-- modules/profile/build.gradle | 12 ++++++++++ 5 files changed, 39 insertions(+), 10 deletions(-) create mode 100644 buildSrc/src/main/groovy/spring-conventions.gradle create mode 100644 modules/profile/build.gradle diff --git a/build.gradle b/build.gradle index 502c8677..4282b312 100644 --- a/build.gradle +++ b/build.gradle @@ -1,6 +1,5 @@ plugins { - id 'org.springframework.boot' version '3.0.1' - id 'io.spring.dependency-management' version '1.1.0' + id 'spring-conventions' id 'java' id "java-conventions" id "mapstruct-conventions" @@ -23,13 +22,7 @@ ext { set('springdocVersion', "2.0.2") } -springBoot { - buildInfo() -} - dependencies { - annotationProcessor "org.springframework.boot:spring-boot-configuration-processor" - implementation project(":modules:commons") implementation "com.google.code.findbugs:annotations:3.0.1u2" diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle index 3317bed1..345cf603 100644 --- a/buildSrc/build.gradle +++ b/buildSrc/build.gradle @@ -14,4 +14,6 @@ dependencies { implementation "io.ebean:ebean-gradle-plugin:13.11.1" implementation "com.google.cloud.tools:jib-gradle-plugin:3.3.1" implementation "net.researchgate:gradle-release:3.0.2" + implementation "org.springframework.boot:spring-boot-gradle-plugin:3.0.1" + implementation "io.spring.gradle:dependency-management-plugin:1.1.0" } \ No newline at end of file diff --git a/buildSrc/src/main/groovy/spring-conventions.gradle b/buildSrc/src/main/groovy/spring-conventions.gradle new file mode 100644 index 00000000..f00cce2e --- /dev/null +++ b/buildSrc/src/main/groovy/spring-conventions.gradle @@ -0,0 +1,23 @@ +plugins { + id 'java' + id 'org.springframework.boot' + id 'io.spring.dependency-management' +} + +ext { + set('springCloudVersion', "2022.0.0") +} + +springBoot { + buildInfo() +} + +dependencies { + annotationProcessor "org.springframework.boot:spring-boot-configuration-processor" +} + +dependencyManagement { + imports { + mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}" + } +} \ No newline at end of file diff --git a/modules/commons/build.gradle b/modules/commons/build.gradle index 403b51d5..c83fae42 100644 --- a/modules/commons/build.gradle +++ b/modules/commons/build.gradle @@ -1,8 +1,7 @@ plugins { id 'java' id "java-conventions" - id 'org.springframework.boot' version '3.0.1' - id 'io.spring.dependency-management' version '1.1.0' + id 'spring-conventions' } dependencies { diff --git a/modules/profile/build.gradle b/modules/profile/build.gradle new file mode 100644 index 00000000..c83fae42 --- /dev/null +++ b/modules/profile/build.gradle @@ -0,0 +1,12 @@ +plugins { + id 'java' + id "java-conventions" + id 'spring-conventions' +} + +dependencies { + implementation 'org.springframework.data:spring-data-commons' + implementation 'org.springframework.data:spring-data-jpa' + implementation 'jakarta.persistence:jakarta.persistence-api' + +} \ No newline at end of file From 41770c80f4a5d130894ef3c949a92d696a23e090 Mon Sep 17 00:00:00 2001 From: Tobias Hund Date: Fri, 13 Jan 2023 22:42:17 +0100 Subject: [PATCH 3/4] modularize infrastructural dependencies --- build.gradle | 15 ++++------- .../src/main/groovy/spring-conventions.gradle | 7 +++++ .../groovy/testcontainers-conventions.gradle | 13 ++++++++++ infrastructure/aws/build.gradle | 16 ++++++++++++ .../prox/infra/aws}/AwsConfig.java | 5 +++- .../aws}/AwsConfigurationProperties.java | 2 +- .../prox/infra/aws/s3}/S3StorageProvider.java | 3 ++- .../prox/infra/aws/s3}/StorageProvider.java | 2 +- .../s3/storage/AbstractLocalStackTest.java | 26 +++++++++++++++++++ .../S3StorageProviderIntegrationTest.java | 17 ++++++++---- .../aws/src/test/resources/application.yml | 8 ++++++ infrastructure/cache/build.gradle | 16 ++++++++++++ .../prox/infra/cache}/CacheConfig.java | 2 +- infrastructure/keycloak/build.gradle | 17 ++++++++++++ .../prox/infra/keycloak}/KeycloakConfig.java | 5 +++- .../KeycloakGrantedAuthoritiesConverter.java | 2 +- infrastructure/rabbitmq/build.gradle | 13 ++++++++++ .../prox/infra/rabbitmq}/MessagingConfig.java | 2 +- settings.gradle | 9 ++++++- .../prox/config/SecurityConfig.java | 1 + .../KeycloakGroupAddedEventListener.java | 2 +- .../lecturer/LecturerFacadeImpl.java | 2 +- .../commands/SetLecturerAvatarHandler.java | 2 +- .../web/dto/LecturerDtoAssembler.java | 2 +- .../organization/OrganizationFacadeImpl.java | 2 +- .../commands/SetOrganizationLogoHandler.java | 2 +- .../web/dto/OrganizationDtoAssembler.java | 2 +- .../tag/application/tag/TagFacadeImpl.java | 2 +- .../KeycloakLeveragedProxUserRepository.java | 2 +- .../KeycloakVerifyEmailEventListener.java | 2 +- .../usecase/command/AssignProfessorGroup.java | 2 +- ...roupAddedEventListenerIntegrationTest.java | 2 +- .../SetLecturerAvatarHandlerTest.java | 2 +- .../SetOrganizationLogoHandlerTest.java | 2 +- 34 files changed, 171 insertions(+), 38 deletions(-) create mode 100644 buildSrc/src/main/groovy/testcontainers-conventions.gradle create mode 100644 infrastructure/aws/build.gradle rename {src/main/java/de/innovationhub/prox/infra/storage => infrastructure/aws/src/main/java/de/innovationhub/prox/infra/aws}/AwsConfig.java (86%) rename {src/main/java/de/innovationhub/prox/infra/storage => infrastructure/aws/src/main/java/de/innovationhub/prox/infra/aws}/AwsConfigurationProperties.java (88%) rename {src/main/java/de/innovationhub/prox/infra/storage => infrastructure/aws/src/main/java/de/innovationhub/prox/infra/aws/s3}/S3StorageProvider.java (90%) rename {src/main/java/de/innovationhub/prox/infra/storage => infrastructure/aws/src/main/java/de/innovationhub/prox/infra/aws/s3}/StorageProvider.java (80%) create mode 100644 infrastructure/aws/src/test/java/de/innovationhub/prox/infra/aws/s3/storage/AbstractLocalStackTest.java rename {src/test/java/de/innovationhub/prox/infra => infrastructure/aws/src/test/java/de/innovationhub/prox/infra/aws/s3}/storage/S3StorageProviderIntegrationTest.java (70%) create mode 100644 infrastructure/aws/src/test/resources/application.yml create mode 100644 infrastructure/cache/build.gradle rename {src/main/java/de/innovationhub/prox/config => infrastructure/cache/src/main/java/de/innovationhub/prox/infra/cache}/CacheConfig.java (96%) create mode 100644 infrastructure/keycloak/build.gradle rename {src/main/java/de/innovationhub/prox/config => infrastructure/keycloak/src/main/java/de/innovationhub/prox/infra/keycloak}/KeycloakConfig.java (86%) rename {src/main/java/de/innovationhub/prox/config => infrastructure/keycloak/src/main/java/de/innovationhub/prox/infra/keycloak}/KeycloakGrantedAuthoritiesConverter.java (96%) create mode 100644 infrastructure/rabbitmq/build.gradle rename {src/main/java/de/innovationhub/prox/config => infrastructure/rabbitmq/src/main/java/de/innovationhub/prox/infra/rabbitmq}/MessagingConfig.java (97%) diff --git a/build.gradle b/build.gradle index 4282b312..6143766f 100644 --- a/build.gradle +++ b/build.gradle @@ -5,6 +5,7 @@ plugins { id "mapstruct-conventions" id "jib-conventions" id "release-conventions" + id 'testcontainers-conventions' } group = 'de.innovationhub.prox' @@ -16,7 +17,6 @@ repositories { } ext { - set('testcontainersVersion', "1.17.4") set('restassuredVersion', "5.3.0") set('springCloudVersion', "2022.0.0") set('springdocVersion', "2.0.2") @@ -24,6 +24,10 @@ ext { dependencies { implementation project(":modules:commons") + implementation project(":infrastructure:keycloak") + implementation project(":infrastructure:cache") + implementation project(":infrastructure:rabbitmq") + implementation project(":infrastructure:aws") implementation "com.google.code.findbugs:annotations:3.0.1u2" @@ -57,13 +61,11 @@ dependencies { runtimeOnly 'org.postgresql:postgresql' testImplementation 'org.awaitility:awaitility:4.2.0' - testImplementation 'org.springframework.boot:spring-boot-starter-test' testImplementation 'org.springframework.amqp:spring-rabbit-test' testImplementation 'org.springframework.security:spring-security-test' testImplementation("io.rest-assured:rest-assured:${restassuredVersion}") testImplementation("io.rest-assured:json-path:${restassuredVersion}") testImplementation("io.rest-assured:spring-mock-mvc:${restassuredVersion}") - testImplementation 'org.testcontainers:junit-jupiter' testImplementation 'org.testcontainers:postgresql' testImplementation 'org.testcontainers:rabbitmq' testImplementation 'org.testcontainers:localstack' @@ -79,13 +81,6 @@ dependencies { } } -dependencyManagement { - imports { - mavenBom "org.testcontainers:testcontainers-bom:${testcontainersVersion}" - mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}" - } -} - tasks.named('test') { useJUnitPlatform() } diff --git a/buildSrc/src/main/groovy/spring-conventions.gradle b/buildSrc/src/main/groovy/spring-conventions.gradle index f00cce2e..6ea3c820 100644 --- a/buildSrc/src/main/groovy/spring-conventions.gradle +++ b/buildSrc/src/main/groovy/spring-conventions.gradle @@ -14,6 +14,13 @@ springBoot { dependencies { annotationProcessor "org.springframework.boot:spring-boot-configuration-processor" + + implementation 'org.springframework.boot:spring-boot-starter' + // TODO: We might place them elswhere + implementation 'io.swagger.core.v3:swagger-annotations:2.2.8' + + + testImplementation 'org.springframework.boot:spring-boot-starter-test' } dependencyManagement { diff --git a/buildSrc/src/main/groovy/testcontainers-conventions.gradle b/buildSrc/src/main/groovy/testcontainers-conventions.gradle new file mode 100644 index 00000000..bded1235 --- /dev/null +++ b/buildSrc/src/main/groovy/testcontainers-conventions.gradle @@ -0,0 +1,13 @@ +plugins { + id 'java' +} + +dependencies { + testImplementation 'org.testcontainers:junit-jupiter' +} + +dependencyManagement { + imports { + mavenBom "org.testcontainers:testcontainers-bom:1.17.4" + } +} \ No newline at end of file diff --git a/infrastructure/aws/build.gradle b/infrastructure/aws/build.gradle new file mode 100644 index 00000000..cd24612f --- /dev/null +++ b/infrastructure/aws/build.gradle @@ -0,0 +1,16 @@ +plugins { + id 'java' + id 'java-conventions' + id 'spring-conventions' + id 'testcontainers-conventions' +} + +repositories { + mavenCentral() +} + +dependencies { + implementation "com.amazonaws:aws-java-sdk-s3:1.12.380" + implementation "org.springframework.boot:spring-boot-starter" + testImplementation 'org.testcontainers:localstack' +} \ No newline at end of file diff --git a/src/main/java/de/innovationhub/prox/infra/storage/AwsConfig.java b/infrastructure/aws/src/main/java/de/innovationhub/prox/infra/aws/AwsConfig.java similarity index 86% rename from src/main/java/de/innovationhub/prox/infra/storage/AwsConfig.java rename to infrastructure/aws/src/main/java/de/innovationhub/prox/infra/aws/AwsConfig.java index 3d6f6e12..6f639739 100644 --- a/src/main/java/de/innovationhub/prox/infra/storage/AwsConfig.java +++ b/infrastructure/aws/src/main/java/de/innovationhub/prox/infra/aws/AwsConfig.java @@ -1,4 +1,4 @@ -package de.innovationhub.prox.infra.storage; +package de.innovationhub.prox.infra.aws; import com.amazonaws.auth.AWSCredentials; import com.amazonaws.auth.AWSStaticCredentialsProvider; @@ -7,6 +7,7 @@ import com.amazonaws.services.s3.AmazonS3Client; import com.amazonaws.services.s3.AmazonS3ClientBuilder; import lombok.RequiredArgsConstructor; +import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -16,12 +17,14 @@ public class AwsConfig { private final AwsConfigurationProperties config; @Bean + @ConditionalOnMissingBean public AWSCredentials awsCredentials() { return new BasicAWSCredentials(config.credentials().accessKey(), config.credentials() .secretKey()); } @Bean + @ConditionalOnMissingBean public AmazonS3Client s3(AWSCredentials credentials) { return (AmazonS3Client) AmazonS3ClientBuilder .standard() diff --git a/src/main/java/de/innovationhub/prox/infra/storage/AwsConfigurationProperties.java b/infrastructure/aws/src/main/java/de/innovationhub/prox/infra/aws/AwsConfigurationProperties.java similarity index 88% rename from src/main/java/de/innovationhub/prox/infra/storage/AwsConfigurationProperties.java rename to infrastructure/aws/src/main/java/de/innovationhub/prox/infra/aws/AwsConfigurationProperties.java index 381e7535..ba21a751 100644 --- a/src/main/java/de/innovationhub/prox/infra/storage/AwsConfigurationProperties.java +++ b/infrastructure/aws/src/main/java/de/innovationhub/prox/infra/aws/AwsConfigurationProperties.java @@ -1,4 +1,4 @@ -package de.innovationhub.prox.infra.storage; +package de.innovationhub.prox.infra.aws; import org.springframework.boot.context.properties.ConfigurationProperties; diff --git a/src/main/java/de/innovationhub/prox/infra/storage/S3StorageProvider.java b/infrastructure/aws/src/main/java/de/innovationhub/prox/infra/aws/s3/S3StorageProvider.java similarity index 90% rename from src/main/java/de/innovationhub/prox/infra/storage/S3StorageProvider.java rename to infrastructure/aws/src/main/java/de/innovationhub/prox/infra/aws/s3/S3StorageProvider.java index bef84cb5..2f32fbb4 100644 --- a/src/main/java/de/innovationhub/prox/infra/storage/S3StorageProvider.java +++ b/infrastructure/aws/src/main/java/de/innovationhub/prox/infra/aws/s3/S3StorageProvider.java @@ -1,8 +1,9 @@ -package de.innovationhub.prox.infra.storage; +package de.innovationhub.prox.infra.aws.s3; import com.amazonaws.services.s3.AmazonS3Client; import com.amazonaws.services.s3.model.ObjectMetadata; import com.amazonaws.services.s3.model.PutObjectRequest; +import de.innovationhub.prox.infra.aws.AwsConfigurationProperties; import java.io.ByteArrayInputStream; import org.springframework.stereotype.Component; diff --git a/src/main/java/de/innovationhub/prox/infra/storage/StorageProvider.java b/infrastructure/aws/src/main/java/de/innovationhub/prox/infra/aws/s3/StorageProvider.java similarity index 80% rename from src/main/java/de/innovationhub/prox/infra/storage/StorageProvider.java rename to infrastructure/aws/src/main/java/de/innovationhub/prox/infra/aws/s3/StorageProvider.java index ee6bddf2..d9bcf62f 100644 --- a/src/main/java/de/innovationhub/prox/infra/storage/StorageProvider.java +++ b/infrastructure/aws/src/main/java/de/innovationhub/prox/infra/aws/s3/StorageProvider.java @@ -1,4 +1,4 @@ -package de.innovationhub.prox.infra.storage; +package de.innovationhub.prox.infra.aws.s3; import java.io.IOException; diff --git a/infrastructure/aws/src/test/java/de/innovationhub/prox/infra/aws/s3/storage/AbstractLocalStackTest.java b/infrastructure/aws/src/test/java/de/innovationhub/prox/infra/aws/s3/storage/AbstractLocalStackTest.java new file mode 100644 index 00000000..99cc155c --- /dev/null +++ b/infrastructure/aws/src/test/java/de/innovationhub/prox/infra/aws/s3/storage/AbstractLocalStackTest.java @@ -0,0 +1,26 @@ +package de.innovationhub.prox.infra.aws.s3.storage; + +import org.springframework.test.context.DynamicPropertyRegistry; +import org.springframework.test.context.DynamicPropertySource; +import org.testcontainers.containers.localstack.LocalStackContainer; +import org.testcontainers.containers.localstack.LocalStackContainer.Service; +import org.testcontainers.utility.DockerImageName; + +public class AbstractLocalStackTest { + + static LocalStackContainer localStack = new LocalStackContainer( + DockerImageName.parse("localstack/localstack:1.3")) + .withServices(LocalStackContainer.Service.S3); + + static { + localStack.start(); + } + + @DynamicPropertySource + static void setLocalStack(DynamicPropertyRegistry registry) { + registry.add("cloud.aws.credentials.accessKey", () -> localStack.getAccessKey()); + registry.add("cloud.aws.credentials.secretKey", () -> localStack.getSecretKey()); + registry.add("cloud.aws.region", () -> localStack.getRegion()); + registry.add("cloud.aws.s3.endpoint", () -> localStack.getEndpointOverride(Service.S3)); + } +} diff --git a/src/test/java/de/innovationhub/prox/infra/storage/S3StorageProviderIntegrationTest.java b/infrastructure/aws/src/test/java/de/innovationhub/prox/infra/aws/s3/storage/S3StorageProviderIntegrationTest.java similarity index 70% rename from src/test/java/de/innovationhub/prox/infra/storage/S3StorageProviderIntegrationTest.java rename to infrastructure/aws/src/test/java/de/innovationhub/prox/infra/aws/s3/storage/S3StorageProviderIntegrationTest.java index 5a4e508f..0001cd58 100644 --- a/src/test/java/de/innovationhub/prox/infra/storage/S3StorageProviderIntegrationTest.java +++ b/infrastructure/aws/src/test/java/de/innovationhub/prox/infra/aws/s3/storage/S3StorageProviderIntegrationTest.java @@ -1,23 +1,30 @@ -package de.innovationhub.prox.infra.storage; +package de.innovationhub.prox.infra.aws.s3.storage; import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertArrayEquals; import com.amazonaws.services.s3.AmazonS3; -import de.innovationhub.prox.AbstractIntegrationTest; +import de.innovationhub.prox.infra.aws.AwsConfig; +import de.innovationhub.prox.infra.aws.AwsConfigurationProperties; +import de.innovationhub.prox.infra.aws.s3.S3StorageProvider; import java.io.IOException; import java.util.UUID; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.ContextConfiguration; // TODO: We probably do not need to spin up spring boot at all. Re-evaluate test slices -class S3StorageProviderIntegrationTest extends AbstractIntegrationTest { +@SpringBootTest +@ContextConfiguration(classes = {S3StorageProvider.class, AwsConfig.class}) +@EnableConfigurationProperties(AwsConfigurationProperties.class) +class S3StorageProviderIntegrationTest extends AbstractLocalStackTest { + @Autowired S3StorageProvider s3StorageProvider; - @Autowired AmazonS3 s3Client; - @Autowired AwsConfigurationProperties config; diff --git a/infrastructure/aws/src/test/resources/application.yml b/infrastructure/aws/src/test/resources/application.yml new file mode 100644 index 00000000..559bb532 --- /dev/null +++ b/infrastructure/aws/src/test/resources/application.yml @@ -0,0 +1,8 @@ +cloud: + aws: + region: eu-central-1 + credentials: + access-key: ${AWS_ACCESS_KEY:} + secret-key: ${AWS_SECRET_KEY:} + s3: + bucket: ${AWS_S3_BUCKET:prox} \ No newline at end of file diff --git a/infrastructure/cache/build.gradle b/infrastructure/cache/build.gradle new file mode 100644 index 00000000..3edf204b --- /dev/null +++ b/infrastructure/cache/build.gradle @@ -0,0 +1,16 @@ +plugins { + id 'java' + id 'java-conventions' + id 'spring-conventions' + id 'testcontainers-conventions' +} + +repositories { + mavenCentral() +} + +dependencies { + implementation 'org.springframework.boot:spring-boot-starter-cache' + implementation 'org.springframework.boot:spring-boot-starter-data-redis' + implementation 'com.github.ben-manes.caffeine:caffeine' +} \ No newline at end of file diff --git a/src/main/java/de/innovationhub/prox/config/CacheConfig.java b/infrastructure/cache/src/main/java/de/innovationhub/prox/infra/cache/CacheConfig.java similarity index 96% rename from src/main/java/de/innovationhub/prox/config/CacheConfig.java rename to infrastructure/cache/src/main/java/de/innovationhub/prox/infra/cache/CacheConfig.java index 5341bdc7..da04bc78 100644 --- a/src/main/java/de/innovationhub/prox/config/CacheConfig.java +++ b/infrastructure/cache/src/main/java/de/innovationhub/prox/infra/cache/CacheConfig.java @@ -1,4 +1,4 @@ -package de.innovationhub.prox.config; +package de.innovationhub.prox.infra.cache; import com.github.benmanes.caffeine.cache.Caffeine; import java.util.List; diff --git a/infrastructure/keycloak/build.gradle b/infrastructure/keycloak/build.gradle new file mode 100644 index 00000000..83136e06 --- /dev/null +++ b/infrastructure/keycloak/build.gradle @@ -0,0 +1,17 @@ +plugins { + id 'java' + id 'java-library' + id 'java-conventions' + id 'spring-conventions' +} + +repositories { + mavenCentral() +} + +dependencies { + api "org.keycloak:keycloak-server-spi-private:20.0.2" + api "org.keycloak:keycloak-admin-client:20.0.2" + implementation 'org.springframework.boot:spring-boot-starter-security' + implementation 'org.springframework.boot:spring-boot-starter-oauth2-resource-server' +} \ No newline at end of file diff --git a/src/main/java/de/innovationhub/prox/config/KeycloakConfig.java b/infrastructure/keycloak/src/main/java/de/innovationhub/prox/infra/keycloak/KeycloakConfig.java similarity index 86% rename from src/main/java/de/innovationhub/prox/config/KeycloakConfig.java rename to infrastructure/keycloak/src/main/java/de/innovationhub/prox/infra/keycloak/KeycloakConfig.java index eef6dbfa..234183b8 100644 --- a/src/main/java/de/innovationhub/prox/config/KeycloakConfig.java +++ b/infrastructure/keycloak/src/main/java/de/innovationhub/prox/infra/keycloak/KeycloakConfig.java @@ -1,4 +1,4 @@ -package de.innovationhub.prox.config; +package de.innovationhub.prox.infra.keycloak; import static org.keycloak.OAuth2Constants.CLIENT_CREDENTIALS; @@ -7,6 +7,7 @@ import org.keycloak.admin.client.KeycloakBuilder; import org.keycloak.admin.client.resource.RealmResource; import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -27,6 +28,7 @@ public class KeycloakConfig { private String realm; @Bean + @ConditionalOnMissingBean public Keycloak keycloak() { return KeycloakBuilder.builder() .grantType(CLIENT_CREDENTIALS) @@ -38,6 +40,7 @@ public Keycloak keycloak() { } @Bean + @ConditionalOnMissingBean public RealmResource realmResource(Keycloak keycloak) { return keycloak.realm(realm); } diff --git a/src/main/java/de/innovationhub/prox/config/KeycloakGrantedAuthoritiesConverter.java b/infrastructure/keycloak/src/main/java/de/innovationhub/prox/infra/keycloak/KeycloakGrantedAuthoritiesConverter.java similarity index 96% rename from src/main/java/de/innovationhub/prox/config/KeycloakGrantedAuthoritiesConverter.java rename to infrastructure/keycloak/src/main/java/de/innovationhub/prox/infra/keycloak/KeycloakGrantedAuthoritiesConverter.java index 30f4a097..809912eb 100644 --- a/src/main/java/de/innovationhub/prox/config/KeycloakGrantedAuthoritiesConverter.java +++ b/infrastructure/keycloak/src/main/java/de/innovationhub/prox/infra/keycloak/KeycloakGrantedAuthoritiesConverter.java @@ -1,4 +1,4 @@ -package de.innovationhub.prox.config; +package de.innovationhub.prox.infra.keycloak; import java.util.Collection; diff --git a/infrastructure/rabbitmq/build.gradle b/infrastructure/rabbitmq/build.gradle new file mode 100644 index 00000000..ba39d1b9 --- /dev/null +++ b/infrastructure/rabbitmq/build.gradle @@ -0,0 +1,13 @@ +plugins { + id 'java' + id 'java-conventions' + id 'spring-conventions' +} + +repositories { + mavenCentral() +} + +dependencies { + implementation 'org.springframework.boot:spring-boot-starter-amqp' +} \ No newline at end of file diff --git a/src/main/java/de/innovationhub/prox/config/MessagingConfig.java b/infrastructure/rabbitmq/src/main/java/de/innovationhub/prox/infra/rabbitmq/MessagingConfig.java similarity index 97% rename from src/main/java/de/innovationhub/prox/config/MessagingConfig.java rename to infrastructure/rabbitmq/src/main/java/de/innovationhub/prox/infra/rabbitmq/MessagingConfig.java index ef887cd0..57120f48 100644 --- a/src/main/java/de/innovationhub/prox/config/MessagingConfig.java +++ b/infrastructure/rabbitmq/src/main/java/de/innovationhub/prox/infra/rabbitmq/MessagingConfig.java @@ -1,4 +1,4 @@ -package de.innovationhub.prox.config; +package de.innovationhub.prox.infra.rabbitmq; import org.springframework.amqp.core.Binding; import org.springframework.amqp.core.BindingBuilder; diff --git a/settings.gradle b/settings.gradle index 8e02cd92..c9fe72d6 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,3 +1,10 @@ rootProject.name = "prox-backend" -include("modules:commons") \ No newline at end of file +include("modules:commons") +// include("modules:tag") +// include("modules:user") + +include("infrastructure:aws") +include("infrastructure:cache") +include("infrastructure:keycloak") +include("infrastructure:rabbitmq") \ No newline at end of file diff --git a/src/main/java/de/innovationhub/prox/config/SecurityConfig.java b/src/main/java/de/innovationhub/prox/config/SecurityConfig.java index ce55d2b2..f427a7b5 100644 --- a/src/main/java/de/innovationhub/prox/config/SecurityConfig.java +++ b/src/main/java/de/innovationhub/prox/config/SecurityConfig.java @@ -1,5 +1,6 @@ package de.innovationhub.prox.config; +import de.innovationhub.prox.infra.keycloak.KeycloakGrantedAuthoritiesConverter; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.http.HttpMethod; diff --git a/src/main/java/de/innovationhub/prox/modules/profile/application/lecturer/KeycloakGroupAddedEventListener.java b/src/main/java/de/innovationhub/prox/modules/profile/application/lecturer/KeycloakGroupAddedEventListener.java index 2232dfdc..89127a84 100644 --- a/src/main/java/de/innovationhub/prox/modules/profile/application/lecturer/KeycloakGroupAddedEventListener.java +++ b/src/main/java/de/innovationhub/prox/modules/profile/application/lecturer/KeycloakGroupAddedEventListener.java @@ -2,7 +2,7 @@ import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; -import de.innovationhub.prox.config.MessagingConfig; +import de.innovationhub.prox.infra.rabbitmq.MessagingConfig; import de.innovationhub.prox.modules.commons.application.ApplicationComponent; import de.innovationhub.prox.modules.profile.application.lecturer.usecase.commands.CreateLecturerHandler; import java.util.UUID; diff --git a/src/main/java/de/innovationhub/prox/modules/profile/application/lecturer/LecturerFacadeImpl.java b/src/main/java/de/innovationhub/prox/modules/profile/application/lecturer/LecturerFacadeImpl.java index 57699a08..7fffa40f 100644 --- a/src/main/java/de/innovationhub/prox/modules/profile/application/lecturer/LecturerFacadeImpl.java +++ b/src/main/java/de/innovationhub/prox/modules/profile/application/lecturer/LecturerFacadeImpl.java @@ -1,6 +1,6 @@ package de.innovationhub.prox.modules.profile.application.lecturer; -import de.innovationhub.prox.config.CacheConfig; +import de.innovationhub.prox.infra.cache.CacheConfig; import de.innovationhub.prox.modules.commons.application.ApplicationComponent; import de.innovationhub.prox.modules.profile.application.lecturer.usecase.queries.FindAllLecturerByIdsHandler; import de.innovationhub.prox.modules.profile.application.lecturer.usecase.queries.FindLecturerHandler; diff --git a/src/main/java/de/innovationhub/prox/modules/profile/application/lecturer/usecase/commands/SetLecturerAvatarHandler.java b/src/main/java/de/innovationhub/prox/modules/profile/application/lecturer/usecase/commands/SetLecturerAvatarHandler.java index e8233199..1993730b 100644 --- a/src/main/java/de/innovationhub/prox/modules/profile/application/lecturer/usecase/commands/SetLecturerAvatarHandler.java +++ b/src/main/java/de/innovationhub/prox/modules/profile/application/lecturer/usecase/commands/SetLecturerAvatarHandler.java @@ -1,6 +1,6 @@ package de.innovationhub.prox.modules.profile.application.lecturer.usecase.commands; -import de.innovationhub.prox.infra.storage.StorageProvider; +import de.innovationhub.prox.infra.aws.s3.StorageProvider; import de.innovationhub.prox.modules.commons.application.ApplicationComponent; import de.innovationhub.prox.modules.profile.application.lecturer.exception.LecturerNotFoundException; import de.innovationhub.prox.modules.profile.domain.lecturer.LecturerRepository; diff --git a/src/main/java/de/innovationhub/prox/modules/profile/application/lecturer/web/dto/LecturerDtoAssembler.java b/src/main/java/de/innovationhub/prox/modules/profile/application/lecturer/web/dto/LecturerDtoAssembler.java index 9d8d1352..f262a1c1 100644 --- a/src/main/java/de/innovationhub/prox/modules/profile/application/lecturer/web/dto/LecturerDtoAssembler.java +++ b/src/main/java/de/innovationhub/prox/modules/profile/application/lecturer/web/dto/LecturerDtoAssembler.java @@ -1,6 +1,6 @@ package de.innovationhub.prox.modules.profile.application.lecturer.web.dto; -import de.innovationhub.prox.infra.storage.StorageProvider; +import de.innovationhub.prox.infra.aws.s3.StorageProvider; import de.innovationhub.prox.modules.profile.application.lecturer.LecturerPermissionEvaluator; import de.innovationhub.prox.modules.profile.domain.lecturer.Lecturer; import de.innovationhub.prox.modules.tag.contract.TagFacade; diff --git a/src/main/java/de/innovationhub/prox/modules/profile/application/organization/OrganizationFacadeImpl.java b/src/main/java/de/innovationhub/prox/modules/profile/application/organization/OrganizationFacadeImpl.java index a91bba1a..db7b10e0 100644 --- a/src/main/java/de/innovationhub/prox/modules/profile/application/organization/OrganizationFacadeImpl.java +++ b/src/main/java/de/innovationhub/prox/modules/profile/application/organization/OrganizationFacadeImpl.java @@ -1,6 +1,6 @@ package de.innovationhub.prox.modules.profile.application.organization; -import de.innovationhub.prox.config.CacheConfig; +import de.innovationhub.prox.infra.cache.CacheConfig; import de.innovationhub.prox.modules.commons.application.ApplicationComponent; import de.innovationhub.prox.modules.profile.application.organization.usecase.queries.FindOrganizationHandler; import de.innovationhub.prox.modules.profile.contract.OrganizationFacade; diff --git a/src/main/java/de/innovationhub/prox/modules/profile/application/organization/usecase/commands/SetOrganizationLogoHandler.java b/src/main/java/de/innovationhub/prox/modules/profile/application/organization/usecase/commands/SetOrganizationLogoHandler.java index d57010c3..c421106d 100644 --- a/src/main/java/de/innovationhub/prox/modules/profile/application/organization/usecase/commands/SetOrganizationLogoHandler.java +++ b/src/main/java/de/innovationhub/prox/modules/profile/application/organization/usecase/commands/SetOrganizationLogoHandler.java @@ -1,6 +1,6 @@ package de.innovationhub.prox.modules.profile.application.organization.usecase.commands; -import de.innovationhub.prox.infra.storage.StorageProvider; +import de.innovationhub.prox.infra.aws.s3.StorageProvider; import de.innovationhub.prox.modules.commons.application.ApplicationComponent; import de.innovationhub.prox.modules.profile.application.organization.exception.OrganizationNotFoundException; import de.innovationhub.prox.modules.profile.domain.organization.OrganizationRepository; diff --git a/src/main/java/de/innovationhub/prox/modules/profile/application/organization/web/dto/OrganizationDtoAssembler.java b/src/main/java/de/innovationhub/prox/modules/profile/application/organization/web/dto/OrganizationDtoAssembler.java index fcea65f8..f81b11ed 100644 --- a/src/main/java/de/innovationhub/prox/modules/profile/application/organization/web/dto/OrganizationDtoAssembler.java +++ b/src/main/java/de/innovationhub/prox/modules/profile/application/organization/web/dto/OrganizationDtoAssembler.java @@ -1,6 +1,6 @@ package de.innovationhub.prox.modules.profile.application.organization.web.dto; -import de.innovationhub.prox.infra.storage.StorageProvider; +import de.innovationhub.prox.infra.aws.s3.StorageProvider; import de.innovationhub.prox.modules.profile.application.organization.OrganizationPermissionEvaluator; import de.innovationhub.prox.modules.profile.domain.organization.Membership; import de.innovationhub.prox.modules.profile.domain.organization.Organization; diff --git a/src/main/java/de/innovationhub/prox/modules/tag/application/tag/TagFacadeImpl.java b/src/main/java/de/innovationhub/prox/modules/tag/application/tag/TagFacadeImpl.java index cbc30e2e..354ec936 100644 --- a/src/main/java/de/innovationhub/prox/modules/tag/application/tag/TagFacadeImpl.java +++ b/src/main/java/de/innovationhub/prox/modules/tag/application/tag/TagFacadeImpl.java @@ -1,6 +1,6 @@ package de.innovationhub.prox.modules.tag.application.tag; -import de.innovationhub.prox.config.CacheConfig; +import de.innovationhub.prox.infra.cache.CacheConfig; import de.innovationhub.prox.modules.commons.application.ApplicationComponent; import de.innovationhub.prox.modules.tag.application.tag.usecase.queries.FindTagByIdsHandler; import de.innovationhub.prox.modules.tag.application.tag.usecase.queries.FindTagByNameHandler; diff --git a/src/main/java/de/innovationhub/prox/modules/user/application/user/KeycloakLeveragedProxUserRepository.java b/src/main/java/de/innovationhub/prox/modules/user/application/user/KeycloakLeveragedProxUserRepository.java index f4f6e4c0..ada6fcb8 100644 --- a/src/main/java/de/innovationhub/prox/modules/user/application/user/KeycloakLeveragedProxUserRepository.java +++ b/src/main/java/de/innovationhub/prox/modules/user/application/user/KeycloakLeveragedProxUserRepository.java @@ -1,6 +1,6 @@ package de.innovationhub.prox.modules.user.application.user; -import de.innovationhub.prox.config.CacheConfig; +import de.innovationhub.prox.infra.cache.CacheConfig; import de.innovationhub.prox.modules.commons.application.ApplicationComponent; import de.innovationhub.prox.modules.user.domain.user.ProxUser; import de.innovationhub.prox.modules.user.domain.user.ProxUserRepository; diff --git a/src/main/java/de/innovationhub/prox/modules/user/application/user/KeycloakVerifyEmailEventListener.java b/src/main/java/de/innovationhub/prox/modules/user/application/user/KeycloakVerifyEmailEventListener.java index f7b64282..bef2e907 100644 --- a/src/main/java/de/innovationhub/prox/modules/user/application/user/KeycloakVerifyEmailEventListener.java +++ b/src/main/java/de/innovationhub/prox/modules/user/application/user/KeycloakVerifyEmailEventListener.java @@ -1,6 +1,6 @@ package de.innovationhub.prox.modules.user.application.user; -import de.innovationhub.prox.config.MessagingConfig; +import de.innovationhub.prox.infra.rabbitmq.MessagingConfig; import de.innovationhub.prox.modules.commons.application.ApplicationComponent; import de.innovationhub.prox.modules.user.application.user.usecase.command.AssignProfessorGroup; import java.util.List; diff --git a/src/main/java/de/innovationhub/prox/modules/user/application/user/usecase/command/AssignProfessorGroup.java b/src/main/java/de/innovationhub/prox/modules/user/application/user/usecase/command/AssignProfessorGroup.java index 9f9ca8dd..024f3df9 100644 --- a/src/main/java/de/innovationhub/prox/modules/user/application/user/usecase/command/AssignProfessorGroup.java +++ b/src/main/java/de/innovationhub/prox/modules/user/application/user/usecase/command/AssignProfessorGroup.java @@ -1,6 +1,6 @@ package de.innovationhub.prox.modules.user.application.user.usecase.command; -import de.innovationhub.prox.config.KeycloakConfig; +import de.innovationhub.prox.infra.keycloak.KeycloakConfig; import de.innovationhub.prox.modules.commons.application.ApplicationComponent; import java.util.Objects; import lombok.RequiredArgsConstructor; diff --git a/src/test/java/de/innovationhub/prox/modules/profile/application/lecturer/KeycloakGroupAddedEventListenerIntegrationTest.java b/src/test/java/de/innovationhub/prox/modules/profile/application/lecturer/KeycloakGroupAddedEventListenerIntegrationTest.java index 396d0752..3682ea0c 100644 --- a/src/test/java/de/innovationhub/prox/modules/profile/application/lecturer/KeycloakGroupAddedEventListenerIntegrationTest.java +++ b/src/test/java/de/innovationhub/prox/modules/profile/application/lecturer/KeycloakGroupAddedEventListenerIntegrationTest.java @@ -5,7 +5,7 @@ import static org.mockito.Mockito.when; import de.innovationhub.prox.AbstractIntegrationTest; -import de.innovationhub.prox.config.MessagingConfig; +import de.innovationhub.prox.infra.rabbitmq.MessagingConfig; import de.innovationhub.prox.modules.profile.domain.lecturer.LecturerRepository; import de.innovationhub.prox.modules.user.contract.user.ProxUserView; import de.innovationhub.prox.modules.user.contract.user.UserFacade; diff --git a/src/test/java/de/innovationhub/prox/modules/profile/application/lecturer/usecase/commands/SetLecturerAvatarHandlerTest.java b/src/test/java/de/innovationhub/prox/modules/profile/application/lecturer/usecase/commands/SetLecturerAvatarHandlerTest.java index 73996228..e5ed22a9 100644 --- a/src/test/java/de/innovationhub/prox/modules/profile/application/lecturer/usecase/commands/SetLecturerAvatarHandlerTest.java +++ b/src/test/java/de/innovationhub/prox/modules/profile/application/lecturer/usecase/commands/SetLecturerAvatarHandlerTest.java @@ -9,7 +9,7 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -import de.innovationhub.prox.infra.storage.StorageProvider; +import de.innovationhub.prox.infra.aws.s3.StorageProvider; import de.innovationhub.prox.modules.profile.domain.lecturer.Lecturer; import de.innovationhub.prox.modules.profile.domain.lecturer.LecturerRepository; import de.innovationhub.prox.modules.user.contract.user.AuthenticationFacade; diff --git a/src/test/java/de/innovationhub/prox/modules/profile/application/organization/usecase/commands/SetOrganizationLogoHandlerTest.java b/src/test/java/de/innovationhub/prox/modules/profile/application/organization/usecase/commands/SetOrganizationLogoHandlerTest.java index 5faa7e41..827f4472 100644 --- a/src/test/java/de/innovationhub/prox/modules/profile/application/organization/usecase/commands/SetOrganizationLogoHandlerTest.java +++ b/src/test/java/de/innovationhub/prox/modules/profile/application/organization/usecase/commands/SetOrganizationLogoHandlerTest.java @@ -9,7 +9,7 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -import de.innovationhub.prox.infra.storage.StorageProvider; +import de.innovationhub.prox.infra.aws.s3.StorageProvider; import de.innovationhub.prox.modules.profile.OrganizationFixtures; import de.innovationhub.prox.modules.profile.domain.organization.Organization; import de.innovationhub.prox.modules.profile.domain.organization.OrganizationRepository; From 09f6bd3013190a578c98c2d8940f75f065b2d995 Mon Sep 17 00:00:00 2001 From: Tobias Hund Date: Fri, 13 Jan 2023 22:52:15 +0100 Subject: [PATCH 4/4] fix build --- build.gradle | 4 ++++ buildSrc/src/main/groovy/spring-conventions.gradle | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/build.gradle b/build.gradle index 6143766f..d5e0af83 100644 --- a/build.gradle +++ b/build.gradle @@ -81,6 +81,10 @@ dependencies { } } +bootJar { + enabled = true +} + tasks.named('test') { useJUnitPlatform() } diff --git a/buildSrc/src/main/groovy/spring-conventions.gradle b/buildSrc/src/main/groovy/spring-conventions.gradle index 6ea3c820..01c811d1 100644 --- a/buildSrc/src/main/groovy/spring-conventions.gradle +++ b/buildSrc/src/main/groovy/spring-conventions.gradle @@ -12,6 +12,14 @@ springBoot { buildInfo() } +bootJar { + enabled = false +} + +jar { + enabled = true +} + dependencies { annotationProcessor "org.springframework.boot:spring-boot-configuration-processor"