diff --git a/README.md b/README.md index 1106e9da..a3a1c6e5 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,6 @@ To be able to build and run the Java Spring Boot application, you need the follo (see instructions below to install and run in Docker) - Java JDK at least recent enough to run Gradle (JDK 17.x will be automatically installed by Gradle toolchain support) -- Gradle in some not too outdated version (7.4 will be installed via wrapper) You also might need an IDE (e.g. *IntelliJ IDEA* or *Eclipse* or *VS Code* with *[STS](https://spring.io/tools)* and a GUI Frontend for *PostgreSQL* like *Postbird*. @@ -62,12 +61,16 @@ If you have at least Docker, the Java JDK and Gradle installed in appropriate ve cd your-hsadmin-ng-directory - gradle wrapper # downloads the configured Gradle version into the project - source .aliases # creates some comforable bash aliases, e.g. 'gw'='./gradlew' + source .aliases # creates some comfortable bash aliases, e.g. 'gw'='./gradlew' + gw # initially downloads the configured Gradle version into the project gw test # compiles and runs unit- and integration-tests + # if the container has not been built yet, run this: pg-sql-run # downloads + runs PostgreSQL in a Docker container on localhost:5432 + # if the container has been built already, run this: + pg-sql-start + gw bootRun # compiles and runs the application on localhost:8080 # the following command should reply with "pong": @@ -418,6 +421,21 @@ Underneath of rbac and hs, the structure is business oriented, NOT technical / l Some of these rules are checked with *ArchUnit* unit tests. +### Run Tests from Command Line + +Run all tests which have not yet been passed with the current source code: + +```shell +gw test +``` + +Force running all tests: + +```shell +gw cleanTest test +``` + + ### Spotless Code Formatting Code formatting for Java is checked via *spotless*. @@ -576,7 +594,7 @@ Summary for Debian-based Linux systems: sudo apt-get -y install podman ``` -2Then start it like this: +Then start it like this: ```shell systemctl --user enable --now podman.socket @@ -607,7 +625,7 @@ we need to register a shutdown-hook in the test source code. 2. Now You Can Run the Tests ```shell -gw clean test # gw is from the .aliases file +gw test # gw is from the .aliases file ``` #### Use IntelliJ IDEA Run the Tests Against the Podman Daemon diff --git a/build.gradle b/build.gradle index 29ad0e23..1be9d95f 100644 --- a/build.gradle +++ b/build.gradle @@ -67,6 +67,7 @@ dependencies { implementation 'org.apache.commons:commons-text:1.10.0' implementation 'org.modelmapper:modelmapper:3.1.0' implementation 'org.iban4j:iban4j:3.2.3-RELEASE' + implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.2.0' compileOnly 'org.projectlombok:lombok' testCompileOnly 'org.projectlombok:lombok' diff --git a/src/main/java/net/hostsharing/hsadminng/hs/office/relationship/HsOfficeRelationshipController.java b/src/main/java/net/hostsharing/hsadminng/hs/office/relationship/HsOfficeRelationshipController.java index 3d6332e3..98c6bccf 100644 --- a/src/main/java/net/hostsharing/hsadminng/hs/office/relationship/HsOfficeRelationshipController.java +++ b/src/main/java/net/hostsharing/hsadminng/hs/office/relationship/HsOfficeRelationshipController.java @@ -51,7 +51,7 @@ public class HsOfficeRelationshipController implements HsOfficeRelationshipsApi final HsOfficeRelationshipTypeResource relationshipType) { context.define(currentUser, assumedRoles); - final var entities = relationshipRepo.findRelationshipRelatedToPersonUuid(personUuid, + final var entities = relationshipRepo.findRelationshipRelatedToPersonUuidAndRelationshipType(personUuid, mapper.map(relationshipType, HsOfficeRelationshipType.class)); final var resources = mapper.mapList(entities, HsOfficeRelationshipResource.class, diff --git a/src/main/java/net/hostsharing/hsadminng/hs/office/relationship/HsOfficeRelationshipRepository.java b/src/main/java/net/hostsharing/hsadminng/hs/office/relationship/HsOfficeRelationshipRepository.java index 8b9e10fe..d34caa8c 100644 --- a/src/main/java/net/hostsharing/hsadminng/hs/office/relationship/HsOfficeRelationshipRepository.java +++ b/src/main/java/net/hostsharing/hsadminng/hs/office/relationship/HsOfficeRelationshipRepository.java @@ -12,8 +12,8 @@ public interface HsOfficeRelationshipRepository extends Repository findByUuid(UUID id); - default List findRelationshipRelatedToPersonUuid(@NotNull UUID personUuid, HsOfficeRelationshipType relationshipType) { - return findRelationshipRelatedToPersonUuid(personUuid, relationshipType.toString()); + default List findRelationshipRelatedToPersonUuidAndRelationshipType(@NotNull UUID personUuid, HsOfficeRelationshipType relationshipType) { + return findRelationshipRelatedToPersonUuidAndRelationshipTypeString(personUuid, relationshipType.toString()); } @Query(value = """ @@ -27,7 +27,7 @@ public interface HsOfficeRelationshipRepository extends Repository findRelationshipRelatedToPersonUuid(@NotNull UUID personUuid, String relationshipType); + List findRelationshipRelatedToPersonUuidAndRelationshipTypeString(@NotNull UUID personUuid, String relationshipType); HsOfficeRelationshipEntity save(final HsOfficeRelationshipEntity entity); diff --git a/src/test/resources/application.yml b/src/test/resources/application.yml index 9915854e..a4f570f9 100644 --- a/src/test/resources/application.yml +++ b/src/test/resources/application.yml @@ -4,7 +4,7 @@ spring: platform: postgres datasource: - url: jdbc:tc:postgresql:13.7-bullseye:///spring_boot_testcontainers + url: jdbc:tc:postgresql:15.5-bookworm:///spring_boot_testcontainers url-local: jdbc:postgresql://localhost:5432/postgres username: postgres password: password