diff --git a/CHANGELOG.md b/CHANGELOG.md index b8784df..76d61ea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Deprecated ### Security +## [1.2.3] - 2024-05-12 + +### Added +- Aggiunta configurazione datasource di default per il database H2 +- Aggiunta configurazione datasource per PostgreSQL profilo di produzione +- Aggiunta configurazione per i secrets K8s per la connessione al database PostgreSQL +- Aggiunte le dipeendenze Quarkus per PostgreSQL + +### Changed +- Aggiornamento docker-compose.yml per aggiungere il servizio PostgreSQL +- Aggiornamento file README.md con le istruzioni per l'esecuzione dell'applicazione con PostgreSQL + +### Fixed +- Fix docker-compose.yml per l'esecuzione dell'applicazione con PostgreSQL nel caso in cui il container di PostgreSQL sia eseguito su host con sistema operativo Linux + ## [1.2.2] - 2024-05-11 ### Changed diff --git a/README.md b/README.md index 1bb25e0..e976910 100644 --- a/README.md +++ b/README.md @@ -53,6 +53,8 @@ Le estensioni Quarkus utilizzate per l'implementazione del progetto sono le segu - io.quarkus:quarkus-arc ✔ - io.quarkus:quarkus-rest ✔ - io.quarkus:quarkus-rest-jackson ✔ +- io.quarkus:quarkus-jdbc-h2 ✔ +- io.quarkus:quarkus-jdbc-postgresql ✔ ## Esecuzione dell'applicazione in Docker Vorresti eseguire l'applicazione in un container e testare il funzionamento dell'applicazione fin da subito? @@ -61,6 +63,11 @@ l'applicazione in un container utilizzando Docker Compose o Podman Compose. Ecco come fare utilizzando [Podman Compose](https://docs.podman.io/en/latest/markdown/podman-compose.1.html) (non cambia nel caso di [Docker Compose](https://docs.docker.com/compose/)): +> Dalla release [1.2.3](https://github.com/amusarra/eventbus-logging-filter-jaxrs/releases/tag/v1.2.3) del progetto, il file `docker-compose.yml` è stato aggiornato aggiungendo il servizio di PostgreSQL. + +A seguire il comando per avviare l'applicazione Quarkus in un container (compresi i servizi di supporto come MongoDB, +AMQP, ecc.). + ```shell script # Tramite Podman Compose (alternativa a Docker Compose) podman-compose -f src/main/docker/docker-compose.yml up -d @@ -444,6 +451,7 @@ Console 13 - Esecuzione dello scenario di Load Testing con Taurus - Simplified Hibernate ORM with Panache ([guide](https://quarkus.io/guides/hibernate-orm-panache)): Simplify your persistence layer with Panache - Configura data sources in Quarkus ([guide](https://quarkus.io/guides/datasource)): - Connect to a H2 database using JDBC + - Connect to a PostgreSQL database using JDBC ## Team Tools diff --git a/pom.xml b/pom.xml index 1ebe21d..67da55c 100644 --- a/pom.xml +++ b/pom.xml @@ -1,276 +1,272 @@ - - 4.0.0 - it.dontesta.eventbus - eventbus-logging-filter-jaxrs - 1.2.2 - - eventbus-logging-filter-jaxrs - Event Bus Logging Filter JAX-RS - https://amusarra.github.io/eventbus-logging-filter-jaxrs-docs - - Antonio Musarra's Blog - https://www.dontesta.it - - - - - MIT License - https://opensource.org/license/mit - - - - - - amusarra - Antonio Musarra - antonio.musarra@gmail.com - https://www.dontesta.it - +1 - - IT Senior Consultant - Senior Software Architect - - Antonio Musarra's Blog - https://www.dontesta.it - - - - - 3.12.1 - 21 - 3.0.1 - UTF-8 - UTF-8 - quarkus-bom - io.quarkus.platform - 3.10.0 - true - 3.2.5 - amusarra-github - https://sonarcloud.io - target/jacoco-report/jacoco.xml - - - - - - ${quarkus.platform.group-id} - ${quarkus.platform.artifact-id} - ${quarkus.platform.version} - pom - import - - - ${quarkus.platform.group-id} - quarkus-camel-bom - ${quarkus.platform.version} - pom - import - - - - + + 4.0.0 + it.dontesta.eventbus + eventbus-logging-filter-jaxrs + 1.2.3 + eventbus-logging-filter-jaxrs + Event Bus Logging Filter JAX-RS + https://amusarra.github.io/eventbus-logging-filter-jaxrs-docs + + Antonio Musarra's Blog + https://www.dontesta.it + + + + MIT License + https://opensource.org/license/mit + + + + + amusarra + Antonio Musarra + antonio.musarra@gmail.com + https://www.dontesta.it + Antonio Musarra's Blog + https://www.dontesta.it + + IT Senior Consultant + Senior Software Architect + + +1 + + + + scm:git:git@github.com:amusarra/eventbus-logging-filter-jaxrs.git + scm:git:git@github.com:amusarra/eventbus-logging-filter-jaxrs.git + scm:git:git@github.com:amusarra/eventbus-logging-filter-jaxrs.git + + + 3.12.1 + 21 + 3.0.1 + UTF-8 + UTF-8 + quarkus-bom + io.quarkus.platform + 3.10.0 + true + target/jacoco-report/jacoco.xml + https://sonarcloud.io + amusarra-github + 3.2.5 + + - - io.quarkus - quarkus-vertx - - - io.quarkus - quarkus-arc - - - io.quarkus - quarkus-rest - - - io.quarkus - quarkus-hibernate-validator - - - io.quarkus - quarkus-rest-jackson - - - io.quarkus - quarkus-mongodb-client - - - io.quarkus - quarkus-messaging-amqp - - - io.quarkus - quarkus-openshift - - - io.quarkus - quarkus-smallrye-health - - - io.quarkus - quarkus-hibernate-orm-panache - - - io.quarkus - quarkus-jdbc-h2 - - - io.quarkus - quarkus-jacoco - test - - - io.quarkus - quarkus-junit5 - test - - - io.quarkus - quarkus-junit5-mockito - test - - - io.rest-assured - rest-assured - test - + + ${quarkus.platform.group-id} + ${quarkus.platform.artifact-id} + ${quarkus.platform.version} + pom + import + + + ${quarkus.platform.group-id} + quarkus-camel-bom + ${quarkus.platform.version} + pom + import + - - - - - ${quarkus.platform.group-id} - quarkus-maven-plugin - ${quarkus.platform.version} - true - - - - build - generate-code - generate-code-tests - - - - - - maven-compiler-plugin - ${compiler-plugin.version} - - - -parameters - - - - - maven-surefire-plugin - ${surefire-plugin.version} - - - org.jboss.logmanager.LogManager - ${maven.home} - - - - - maven-failsafe-plugin - ${surefire-plugin.version} - - - - integration-test - verify - - - - - - ${project.build.directory}/${project.build.finalName}-runner - org.jboss.logmanager.LogManager - ${maven.home} - - - - - org.codehaus.mojo - properties-maven-plugin - 1.2.1 - - - initialize - - read-project-properties - - - - ${project.basedir}/src/main/resources/application.properties - - - - - - - org.codehaus.mojo - keytool-maven-plugin - 1.7 - - - generate-resources - - generateKeyPair - - - ${project.build.outputDirectory}/${quarkus.http.ssl.certificate.key-store-file} - cn=${project.artifactId}, ou=${project.groupId}, o=dontesta.it, c=IT - ${quarkus.http.ssl.certificate.key-store-password} - ${quarkus.http.ssl.certificate.key-store-password} - ${project.artifactId} - SAN=DNS:localhost - SHA256withRSA - 365 - true - RSA - 4096 - true - - - - - - org.apache.maven.plugins - maven-release-plugin - ${maven.release.plugin.version} - - true - deploy - true - v@{project.version} - false - - - - - - scm:git:git@github.com:amusarra/eventbus-logging-filter-jaxrs.git - scm:git:git@github.com:amusarra/eventbus-logging-filter-jaxrs.git - scm:git:git@github.com:amusarra/eventbus-logging-filter-jaxrs.git - HEAD - - - - native - - - native - - - - false - true - false - - - + + + + io.quarkus + quarkus-vertx + + + io.quarkus + quarkus-arc + + + io.quarkus + quarkus-rest + + + io.quarkus + quarkus-hibernate-validator + + + io.quarkus + quarkus-rest-jackson + + + io.quarkus + quarkus-mongodb-client + + + io.quarkus + quarkus-messaging-amqp + + + io.quarkus + quarkus-openshift + + + io.quarkus + quarkus-smallrye-health + + + io.quarkus + quarkus-hibernate-orm-panache + + + io.quarkus + quarkus-jdbc-h2 + + + io.quarkus + quarkus-jdbc-postgresql + + + io.quarkus + quarkus-jacoco + test + + + io.quarkus + quarkus-junit5 + test + + + io.quarkus + quarkus-junit5-mockito + test + + + io.rest-assured + rest-assured + test + + + + + + ${quarkus.platform.group-id} + quarkus-maven-plugin + ${quarkus.platform.version} + true + + + + build + generate-code + generate-code-tests + + + + + + maven-compiler-plugin + ${compiler-plugin.version} + + + -parameters + + + + + maven-surefire-plugin + ${surefire-plugin.version} + + + org.jboss.logmanager.LogManager + ${maven.home} + + + + + maven-failsafe-plugin + ${surefire-plugin.version} + + + + integration-test + verify + + + + + + ${project.build.directory}/${project.build.finalName}-runner + org.jboss.logmanager.LogManager + ${maven.home} + + + + + org.codehaus.mojo + properties-maven-plugin + 1.2.1 + + + initialize + + read-project-properties + + + + ${project.basedir}/src/main/resources/application.properties + + + + + + + org.codehaus.mojo + keytool-maven-plugin + 1.7 + + + generate-resources + + generateKeyPair + + + ${project.build.outputDirectory}/${quarkus.http.ssl.certificate.key-store-file} + cn=${project.artifactId}, ou=${project.groupId}, o=dontesta.it, c=IT + ${quarkus.http.ssl.certificate.key-store-password} + ${quarkus.http.ssl.certificate.key-store-password} + ${project.artifactId} + SAN=DNS:localhost + SHA256withRSA + 365 + true + RSA + 4096 + true + + + + + + maven-release-plugin + ${maven.release.plugin.version} + + true + deploy + true + v@{project.version} + false + + + + + + + native + + + native + + + + false + false + true + + + diff --git a/src/main/docker/docker-compose.yml b/src/main/docker/docker-compose.yml index 0686d38..51c61e1 100644 --- a/src/main/docker/docker-compose.yml +++ b/src/main/docker/docker-compose.yml @@ -13,7 +13,8 @@ networks: # Define the services # 1. MongoDB # 2. Artemis -# 3. Logging Filter +# 3. Postgres +# 4. Logging Filter services: mongodb: image: docker.io/library/mongo:4.4 @@ -39,11 +40,37 @@ services: - "5445:5445" - "5672:5672" + # See https://hub.docker.com/_/postgres for more details about the + # environment variables used to configure the PostgreSQL database. + postgres: + image: postgres:16.3 + container_name: postgres + restart: always + # set shared memory limit when using docker-compose + shm_size: 128mb + networks: + - logging_filter_network + environment: + - POSTGRES_USER=quarkus + - POSTGRES_PASSWORD=quarkus + - POSTGRES_DB=quarkus + ports: + - "5432:5432" + volumes: + - postgres_data:/var/lib/postgresql@14/data:rw + adminer: + image: adminer + restart: always + ports: + - "8090:8080" + # The environment variables are used to configure the connection to the # Artemis message broker and the MongoDB database. # Se the application.properties file for more details about the names of the # environment variables. logging-filter: + # Use the following image if you want to use the pre-built image from Docker Hub: + # docker.io/amusarra/eventbus-logging-filter-jaxrs:latest image: docker.io/amusarra/eventbus-logging-filter-jaxrs:latest container_name: logging-filter networks: @@ -54,6 +81,9 @@ services: - AMQP_USERNAME=artemis - AMQP_PASSWORD=artemis - MONGODB_CONNECTION_URL=mongodb://mongodb:27017/audit + - DB_USERNAME=quarkus + - DB_PASSWORD=quarkus + - DB_URL=jdbc:postgresql://postgres:5432/quarkus ports: - "8080:8080" - "8443:8443" @@ -66,8 +96,11 @@ services: depends_on: - artemis - mongodb + - postgres # Define the volumes volumes: mongodb_data: driver: local + postgres_data: + driver: local diff --git a/src/main/kubernetes/common.yml b/src/main/kubernetes/common.yml index 1a41674..84817e5 100644 --- a/src/main/kubernetes/common.yml +++ b/src/main/kubernetes/common.yml @@ -25,3 +25,20 @@ metadata: data: mongodb-connection-url: bW9uZ29kYjovL21vbmdvOjI3MDE3L2F1ZGl0Cg== type: Opaque +--- +kind: Secret +apiVersion: v1 +metadata: + name: db-username-password +data: + db-password: cXVhcmt1cwo= + db-username: cXVhcmt1cwo= +type: Opaque +--- +kind: Secret +apiVersion: v1 +metadata: + name: db-connection-url +data: + db-url: amRiYzpwb3N0Z3Jlc3FsOi8vcG9zdGdyZXNxbDo1NDMyL3F1YXJrdXNfZXZlbnRfYnVzCg== +type: Opaque \ No newline at end of file diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index fc7d70e..b793332 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -101,6 +101,11 @@ quarkus.openshift.base-jvm-image=registry.access.redhat.com/ubi9/openjdk-21:1.18 # -Dcom.sun.management.jmxremote.local.only=false this option allows remote JMX connections quarkus.openshift.env.vars.java-opts=-Xms100M -Xmx500M -XX:+UseG1GC -XX:+UnlockExperimentalVMOptions -XX:MaxGCPauseMillis=200 -XX:InitiatingHeapOccupancyPercent=45 -XX:G1ReservePercent=10 -XX:ConcGCThreads=4 -XX:G1NewSizePercent=5 -XX:G1MaxNewSizePercent=60 -XX:ParallelGCThreads=4 -XX:+ExitOnOutOfMemoryError -Dcom.sun.management.jmxremote.port=9091 -Dcom.sun.management.jmxremote.rmi.port=9091 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.local.only=false +## +## This section configure the Datasource extension +## +quarkus.datasource.db-kind=h2 + ## ## This section configure the Hibernate ORM extension ## @@ -168,6 +173,14 @@ mp.messaging.outgoing.http-response-out.address=http-response %prod.amqp-password=${AMQP_PASSWORD} # Configure the mongoDB client for a single instance on localhost -# are privided by the Secret. +# are provided by the Secret. # See the src/kubernetes/common.yaml file for more details. %prod.quarkus.mongodb.connection-string=${MONGODB_CONNECTION_URL} + +# Configure the datasource for the production profile +%prod.quarkus.datasource.db-kind=postgresql +%prod.quarkus.datasource.username=${DB_USERNAME} +%prod.quarkus.datasource.password=${DB_PASSWORD} + +%prod.quarkus.datasource.jdbc.url=${DB_URL} +%prod.quarkus.datasource.jdbc.max-size=20 \ No newline at end of file diff --git a/src/test/java/it/dontesta/eventbus/consumers/events/handlers/queue/incoming/AmqpConsumerTest.java b/src/test/java/it/dontesta/eventbus/consumers/events/handlers/queue/incoming/AmqpConsumerTest.java new file mode 100644 index 0000000..cdf4fb0 --- /dev/null +++ b/src/test/java/it/dontesta/eventbus/consumers/events/handlers/queue/incoming/AmqpConsumerTest.java @@ -0,0 +1,57 @@ +package it.dontesta.eventbus.consumers.events.handlers.queue.incoming; + +import io.quarkus.test.junit.QuarkusTest; +import io.vertx.core.json.JsonObject; +import org.eclipse.microprofile.reactive.messaging.Message; +import org.jboss.logging.Logger; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.MockitoAnnotations; + +import java.util.concurrent.CompletableFuture; + +import static org.mockito.Mockito.*; + +@QuarkusTest +class AmqpConsumerTest { + + @Mock + Logger log; + + @Mock + Message message; + + @InjectMocks + AmqpConsumer amqpConsumer; + + @BeforeEach + public void setup() { + MockitoAnnotations.openMocks(this); + } + + @Test + void testConsumeHttpRequest() { + JsonObject jsonObject = new JsonObject(); + when(message.getPayload()).thenReturn(jsonObject); + when(message.ack()).thenReturn(CompletableFuture.completedFuture(null)); + + amqpConsumer.consumeHttpRequest(message); + + verify(log, times(1)).debug("Received HTTP request message: " + jsonObject); + verify(message, times(1)).ack(); + } + + @Test + void testConsumeHttpResponse() { + JsonObject jsonObject = new JsonObject(); + when(message.getPayload()).thenReturn(jsonObject); + when(message.ack()).thenReturn(CompletableFuture.completedFuture(null)); + + amqpConsumer.consumeHttpResponse(message); + + verify(log, times(1)).debug("Received HTTP response message: " + jsonObject); + verify(message, times(1)).ack(); + } +} \ No newline at end of file diff --git a/src/test/java/it/dontesta/eventbus/orm/panache/repository/PanacheRepositoryMockedTest.java b/src/test/java/it/dontesta/eventbus/orm/panache/repository/PanacheRepositoryMockedTest.java index 7927818..45ac8b2 100644 --- a/src/test/java/it/dontesta/eventbus/orm/panache/repository/PanacheRepositoryMockedTest.java +++ b/src/test/java/it/dontesta/eventbus/orm/panache/repository/PanacheRepositoryMockedTest.java @@ -52,6 +52,10 @@ void testOwnerRepository() { Mockito.verify(ownerRepository).findOrderedByName(); Mockito.verify(ownerRepository, Mockito.atLeastOnce()).findById(Mockito.any()); Mockito.verifyNoMoreInteractions(ownerRepository); + + // Mock the delete method + ownerRepository.delete(owner); + Mockito.verify(ownerRepository, Mockito.times(1)).delete(owner); } @Test @@ -95,5 +99,10 @@ void testHorseRepository() { Mockito.verify(horseRepository).findOrderedByName(); Mockito.verify(horseRepository, Mockito.atLeastOnce()).findById(Mockito.any()); Mockito.verifyNoMoreInteractions(horseRepository); + + // Mock the delete method + horseRepository.delete(horse); + Mockito.verify(horseRepository, Mockito.times(1)).delete(horse); + } } diff --git a/src/test/java/it/dontesta/eventbus/ws/resources/endpoint/CookieTrackingCodeTest.java b/src/test/java/it/dontesta/eventbus/ws/resources/endpoint/CookieTrackingCodeTest.java index 463bbe5..147cd28 100644 --- a/src/test/java/it/dontesta/eventbus/ws/resources/endpoint/CookieTrackingCodeTest.java +++ b/src/test/java/it/dontesta/eventbus/ws/resources/endpoint/CookieTrackingCodeTest.java @@ -5,8 +5,6 @@ import io.quarkus.test.junit.QuarkusTest; import io.restassured.http.ContentType; -import io.vertx.mutiny.core.eventbus.EventBus; -import jakarta.inject.Inject; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.junit.jupiter.api.Test; diff --git a/src/test/java/it/dontesta/eventbus/ws/resources/endpoint/repository/v1/HorseRepositoryResourcesTest.java b/src/test/java/it/dontesta/eventbus/ws/resources/endpoint/repository/v1/HorseRepositoryResourcesTest.java index 1d21d1e..605d0fb 100644 --- a/src/test/java/it/dontesta/eventbus/ws/resources/endpoint/repository/v1/HorseRepositoryResourcesTest.java +++ b/src/test/java/it/dontesta/eventbus/ws/resources/endpoint/repository/v1/HorseRepositoryResourcesTest.java @@ -81,6 +81,30 @@ void testCreateHorse() { .body("name", is("Santos XVVI")); } + @Test + @Order(5) + void testCreateHorseWithId() { + String json = """ + { + "id": 100, + "name": "Santos XVVI", + "coat": "Gray", + "breed": "Pura Raza Española - PRE", + "sex": "M", + "dateOfBirth": "2024-05-01", + "owners": [{"id": 3}] + } + """; + + given() + .contentType(ContentType.JSON) + .body(json) + .when().post("/api/rest/repository/horse/v1") + .then() + .statusCode(422) + .body("error", is("Id was invalidly set on request.")); + } + @Test @Order(6) void testUpdateHorse() { @@ -106,6 +130,52 @@ void testUpdateHorse() { @Test @Order(7) + void testUpdateHorseNotFoundId() { + String json = """ + { + "name": "Whisper updated", + "coat": "Gray", + "breed": "Pura Raza Española - PRE", + "sex": "M", + "dateOfBirth": "2024-05-01", + "owners": [{"id": 3}] + } + """; + + given() + .contentType(ContentType.JSON) + .body(json) + .when().put("/api/rest/repository/horse/v1/100") + .then() + .statusCode(Response.Status.NOT_FOUND.getStatusCode()) + .body("error", is("Horse with id of 100 not found")); + } + + @Test + @Order(8) + void testUpdateHorseNewOwnerId() { + String json = """ + { + "name": "Whisper updated", + "coat": "Gray", + "breed": "Pura Raza Española - PRE", + "sex": "M", + "dateOfBirth": "2024-05-01", + "owners": [{"id": 1}, {"id": 3}] + } + """; + + given() + .contentType(ContentType.JSON) + .body(json) + .when().put("/api/rest/repository/horse/v1/1") + .then() + .statusCode(Response.Status.OK.getStatusCode()) + .body("name", is("Whisper updated")); + } + + @Test + @Order(9) void testDeleteHorseByIdSuccess() { given() .when().delete("/api/rest/repository/horse/v1/1") @@ -114,7 +184,7 @@ void testDeleteHorseByIdSuccess() { } @Test - @Order(8) + @Order(9) void testDeleteHorseByIdNotFound() { given() .when().delete("/api/rest/repository/horse/v1/100") diff --git a/src/test/java/it/dontesta/eventbus/ws/resources/endpoint/repository/v1/OwnerRepositoryResourcesTest.java b/src/test/java/it/dontesta/eventbus/ws/resources/endpoint/repository/v1/OwnerRepositoryResourcesTest.java index 54e35e4..b1eb433 100644 --- a/src/test/java/it/dontesta/eventbus/ws/resources/endpoint/repository/v1/OwnerRepositoryResourcesTest.java +++ b/src/test/java/it/dontesta/eventbus/ws/resources/endpoint/repository/v1/OwnerRepositoryResourcesTest.java @@ -86,6 +86,33 @@ void testCreateOwner() { @Test @Order(6) + void testCreateOwnerWithId() { + String json = """ + { + "id": 1, + "name": "Rossella", + "surname": "Germanà", + "email": "rossella.germana@dontesta.it", + "phoneNumber": "987654321", + "address": "Via Palermo 1", + "city": "Catania", + "state": "CT", + "zipCode": "95100", + "country": "Italy" + } + """; + + given() + .contentType(ContentType.JSON) + .body(json) + .when().post("/api/rest/repository/owner/v1") + .then() + .statusCode(422) + .body("error", is("Id was invalidly set on request.")); + } + + @Test + @Order(7) void testUpdateOwner() { String json = """ { @@ -110,13 +137,75 @@ void testUpdateOwner() { .statusCode(Response.Status.OK.getStatusCode()) .body("name", is("John Updated 3")); } + @Test + @Order(8) + void testUpdateOwnerWithoutId() { + String json = """ + { + "name": "John Updated 3", + "surname": "Doe", + "email": "john2.doe@dontesta.it", + "phoneNumber": "123456789", + "address": "Via Roma 3", + "city": "Rome", + "state": "RM", + "zipCode": "00100", + "country": "Italy" + } + """; + + given() + .contentType(ContentType.JSON) + .body(json) + .when().put("/api/rest/repository/owner/v1") + .then() + .statusCode(Response.Status.BAD_REQUEST.getStatusCode()) + .body("error", is("Owner ID was not set on request.")); + } @Test - @Order(7) + @Order(9) + void testUpdateOwnerNotFoundId() { + String json = """ + { + "id": 100, + "name": "John Updated 3", + "surname": "Doe", + "email": "john2.doe@dontesta.it", + "phoneNumber": "123456789", + "address": "Via Roma 3", + "city": "Rome", + "state": "RM", + "zipCode": "00100", + "country": "Italy" + } + """; + + given() + .contentType(ContentType.JSON) + .body(json) + .when().put("/api/rest/repository/owner/v1") + .then() + .statusCode(Response.Status.NOT_FOUND.getStatusCode()) + .body("error", is("Owner with id of 100 not found")); + } + + @Test + @Order(10) void testDeleteOwnerByIdNotFound() { given() .when().delete("/api/rest/repository/owner/v1/100") .then() .statusCode(Response.Status.NOT_FOUND.getStatusCode()); } + + @Test + @Order(11) + void testDeleteOwnerByIdSuccess() { + given() + .when().delete("/api/rest/repository/owner/v1/1") + .then() + .statusCode(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode()); + } + }