improve setup instructions and fix Swagger UI #2

Merged
hsh-michaelhoennig merged 11 commits from TP-202307-README-Ubuntu-instructions into master 2024-01-02 15:27:16 +01:00
5 changed files with 29 additions and 10 deletions

View File

@ -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) (see instructions below to install and run in Docker)
- Java JDK at least recent enough to run Gradle - Java JDK at least recent enough to run Gradle
(JDK 17.x will be automatically installed by Gradle toolchain support) (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*. 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 cd your-hsadmin-ng-directory
gradle wrapper # downloads the configured Gradle version into the project source .aliases # creates some comfortable bash aliases, e.g. 'gw'='./gradlew'
source .aliases # creates some comforable 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 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 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 gw bootRun # compiles and runs the application on localhost:8080
# the following command should reply with "pong": # 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. 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 ### Spotless Code Formatting
Code formatting for Java is checked via *spotless*. Code formatting for Java is checked via *spotless*.
@ -576,7 +594,7 @@ Summary for Debian-based Linux systems:
sudo apt-get -y install podman sudo apt-get -y install podman
``` ```
2Then start it like this: Then start it like this:
```shell ```shell
systemctl --user enable --now podman.socket 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 2. Now You Can Run the Tests
```shell ```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 #### Use IntelliJ IDEA Run the Tests Against the Podman Daemon

View File

@ -67,6 +67,7 @@ dependencies {
implementation 'org.apache.commons:commons-text:1.10.0' implementation 'org.apache.commons:commons-text:1.10.0'
implementation 'org.modelmapper:modelmapper:3.1.0' implementation 'org.modelmapper:modelmapper:3.1.0'
implementation 'org.iban4j:iban4j:3.2.3-RELEASE' implementation 'org.iban4j:iban4j:3.2.3-RELEASE'
implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.2.0'
compileOnly 'org.projectlombok:lombok' compileOnly 'org.projectlombok:lombok'
testCompileOnly 'org.projectlombok:lombok' testCompileOnly 'org.projectlombok:lombok'

View File

@ -51,7 +51,7 @@ public class HsOfficeRelationshipController implements HsOfficeRelationshipsApi
final HsOfficeRelationshipTypeResource relationshipType) { final HsOfficeRelationshipTypeResource relationshipType) {
context.define(currentUser, assumedRoles); context.define(currentUser, assumedRoles);
final var entities = relationshipRepo.findRelationshipRelatedToPersonUuid(personUuid, final var entities = relationshipRepo.findRelationshipRelatedToPersonUuidAndRelationshipType(personUuid,
mapper.map(relationshipType, HsOfficeRelationshipType.class)); mapper.map(relationshipType, HsOfficeRelationshipType.class));
final var resources = mapper.mapList(entities, HsOfficeRelationshipResource.class, final var resources = mapper.mapList(entities, HsOfficeRelationshipResource.class,

View File

@ -12,8 +12,8 @@ public interface HsOfficeRelationshipRepository extends Repository<HsOfficeRelat
Optional<HsOfficeRelationshipEntity> findByUuid(UUID id); Optional<HsOfficeRelationshipEntity> findByUuid(UUID id);
default List<HsOfficeRelationshipEntity> findRelationshipRelatedToPersonUuid(@NotNull UUID personUuid, HsOfficeRelationshipType relationshipType) { default List<HsOfficeRelationshipEntity> findRelationshipRelatedToPersonUuidAndRelationshipType(@NotNull UUID personUuid, HsOfficeRelationshipType relationshipType) {
return findRelationshipRelatedToPersonUuid(personUuid, relationshipType.toString()); return findRelationshipRelatedToPersonUuidAndRelationshipTypeString(personUuid, relationshipType.toString());
} }
@Query(value = """ @Query(value = """
@ -27,7 +27,7 @@ public interface HsOfficeRelationshipRepository extends Repository<HsOfficeRelat
WHERE (:relationshipType IS NULL OR p.relType = cast(:relationshipType AS HsOfficeRelationshipType)) WHERE (:relationshipType IS NULL OR p.relType = cast(:relationshipType AS HsOfficeRelationshipType))
AND ( p.relAnchorUuid = :personUuid OR p.relHolderUuid = :personUuid) AND ( p.relAnchorUuid = :personUuid OR p.relHolderUuid = :personUuid)
""", nativeQuery = true) """, nativeQuery = true)
List<HsOfficeRelationshipEntity> findRelationshipRelatedToPersonUuid(@NotNull UUID personUuid, String relationshipType); List<HsOfficeRelationshipEntity> findRelationshipRelatedToPersonUuidAndRelationshipTypeString(@NotNull UUID personUuid, String relationshipType);
HsOfficeRelationshipEntity save(final HsOfficeRelationshipEntity entity); HsOfficeRelationshipEntity save(final HsOfficeRelationshipEntity entity);

View File

@ -4,7 +4,7 @@ spring:
platform: postgres platform: postgres
datasource: 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 url-local: jdbc:postgresql://localhost:5432/postgres
username: postgres username: postgres
password: password password: password