diff --git a/jobs-service/jobs-service-inmemory/pom.xml b/jobs-service/jobs-service-inmemory/pom.xml index 83c1814aa3..fd9fd06ea6 100644 --- a/jobs-service/jobs-service-inmemory/pom.xml +++ b/jobs-service/jobs-service-inmemory/pom.xml @@ -16,7 +16,7 @@ org.kie.kogito - jobs-service-postgresql + jobs-service-postgresql-common io.quarkiverse.embedded.postgresql diff --git a/jobs-service/jobs-service-inmemory/src/main/resources/application.properties b/jobs-service/jobs-service-inmemory/src/main/resources/application.properties index 8d5183fd5d..7809001877 100644 --- a/jobs-service/jobs-service-inmemory/src/main/resources/application.properties +++ b/jobs-service/jobs-service-inmemory/src/main/resources/application.properties @@ -16,4 +16,5 @@ quarkus.datasource.db-kind=postgresql quarkus.flyway.migrate-at-start=true -quarkus.datasource.health.enabled=true \ No newline at end of file +quarkus.datasource.health.enabled=true +quarkus.flyway.locations=db/jobs-service \ No newline at end of file diff --git a/jobs-service/jobs-service-postgresql-common/pom.xml b/jobs-service/jobs-service-postgresql-common/pom.xml new file mode 100644 index 0000000000..2ba7d21b63 --- /dev/null +++ b/jobs-service/jobs-service-postgresql-common/pom.xml @@ -0,0 +1,85 @@ + + + 4.0.0 + + org.kie.kogito + jobs-service + 1.40.1-SNAPSHOT + + + jobs-service-postgresql-common + Kogito Apps :: Jobs Service :: PostgreSQL + Jobs Service (Timers and Async Jobs) PostgreSQL Common + + + + org.kie.kogito + jobs-service-common + + + io.quarkus + quarkus-reactive-pg-client + + + io.quarkus + quarkus-jdbc-postgresql + + + io.quarkus + quarkus-flyway + + + org.kie.kogito + jobs-service-common + test-jar + test + + + org.kie.kogito + kogito-quarkus-test-utils + test + + + io.quarkus + quarkus-junit5 + test + + + org.mockito + mockito-junit-jupiter + test + + + org.mockito + mockito-core + test + + + org.assertj + assertj-core + test + + + org.awaitility + awaitility + test + + + io.rest-assured + rest-assured + test + + + org.keycloak + keycloak-core + test + + + com.github.tomakehurst + wiremock-jre8 + test + + + \ No newline at end of file diff --git a/jobs-service/jobs-service-postgresql/src/main/java/org/kie/kogito/jobs/service/repository/postgresql/PostgreSqlJobRepository.java b/jobs-service/jobs-service-postgresql-common/src/main/java/org/kie/kogito/jobs/service/repository/postgresql/PostgreSqlJobRepository.java similarity index 100% rename from jobs-service/jobs-service-postgresql/src/main/java/org/kie/kogito/jobs/service/repository/postgresql/PostgreSqlJobRepository.java rename to jobs-service/jobs-service-postgresql-common/src/main/java/org/kie/kogito/jobs/service/repository/postgresql/PostgreSqlJobRepository.java diff --git a/jobs-service/jobs-service-postgresql/src/main/java/org/kie/kogito/jobs/service/repository/postgresql/PostgreSqlJobServiceManagementRepository.java b/jobs-service/jobs-service-postgresql-common/src/main/java/org/kie/kogito/jobs/service/repository/postgresql/PostgreSqlJobServiceManagementRepository.java similarity index 100% rename from jobs-service/jobs-service-postgresql/src/main/java/org/kie/kogito/jobs/service/repository/postgresql/PostgreSqlJobServiceManagementRepository.java rename to jobs-service/jobs-service-postgresql-common/src/main/java/org/kie/kogito/jobs/service/repository/postgresql/PostgreSqlJobServiceManagementRepository.java diff --git a/jobs-service/jobs-service-postgresql-common/src/main/resources/META-INF/beans.xml b/jobs-service/jobs-service-postgresql-common/src/main/resources/META-INF/beans.xml new file mode 100644 index 0000000000..e69de29bb2 diff --git a/jobs-service/jobs-service-postgresql-common/src/main/resources/application.properties b/jobs-service/jobs-service-postgresql-common/src/main/resources/application.properties new file mode 100644 index 0000000000..b48dada46c --- /dev/null +++ b/jobs-service/jobs-service-postgresql-common/src/main/resources/application.properties @@ -0,0 +1,16 @@ +# +# Copyright 2021 Red Hat, Inc. and/or its affiliates. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +quarkus.datasource.db-kind=postgresql diff --git a/jobs-service/jobs-service-postgresql/src/main/resources/db/jobs-service/V2.0.0__Create_Table.sql b/jobs-service/jobs-service-postgresql-common/src/main/resources/db/jobs-service/V2.0.0__Create_Table.sql similarity index 100% rename from jobs-service/jobs-service-postgresql/src/main/resources/db/jobs-service/V2.0.0__Create_Table.sql rename to jobs-service/jobs-service-postgresql-common/src/main/resources/db/jobs-service/V2.0.0__Create_Table.sql diff --git a/jobs-service/jobs-service-postgresql/src/main/resources/db/jobs-service/V2.0.1__job_details_increase_job_id_size.sql b/jobs-service/jobs-service-postgresql-common/src/main/resources/db/jobs-service/V2.0.1__job_details_increase_job_id_size.sql similarity index 100% rename from jobs-service/jobs-service-postgresql/src/main/resources/db/jobs-service/V2.0.1__job_details_increase_job_id_size.sql rename to jobs-service/jobs-service-postgresql-common/src/main/resources/db/jobs-service/V2.0.1__job_details_increase_job_id_size.sql diff --git a/jobs-service/jobs-service-postgresql/src/main/resources/db/jobs-service/V2.0.2__job_details_add_fire_time_col.sql b/jobs-service/jobs-service-postgresql-common/src/main/resources/db/jobs-service/V2.0.2__job_details_add_fire_time_col.sql similarity index 100% rename from jobs-service/jobs-service-postgresql/src/main/resources/db/jobs-service/V2.0.2__job_details_add_fire_time_col.sql rename to jobs-service/jobs-service-postgresql-common/src/main/resources/db/jobs-service/V2.0.2__job_details_add_fire_time_col.sql diff --git a/jobs-service/jobs-service-postgresql/src/main/resources/db/jobs-service/V2.0.3__Create_Table_Management.sql b/jobs-service/jobs-service-postgresql-common/src/main/resources/db/jobs-service/V2.0.3__Create_Table_Management.sql similarity index 100% rename from jobs-service/jobs-service-postgresql/src/main/resources/db/jobs-service/V2.0.3__Create_Table_Management.sql rename to jobs-service/jobs-service-postgresql-common/src/main/resources/db/jobs-service/V2.0.3__Create_Table_Management.sql diff --git a/jobs-service/jobs-service-postgresql/src/main/resources/db/jobs-service/V3.0.0__Create_Jobs_Table_V2.sql b/jobs-service/jobs-service-postgresql-common/src/main/resources/db/jobs-service/V3.0.0__Create_Jobs_Table_V2.sql similarity index 100% rename from jobs-service/jobs-service-postgresql/src/main/resources/db/jobs-service/V3.0.0__Create_Jobs_Table_V2.sql rename to jobs-service/jobs-service-postgresql-common/src/main/resources/db/jobs-service/V3.0.0__Create_Jobs_Table_V2.sql diff --git a/jobs-service/jobs-service-postgresql/src/main/resources/db/jobs-service/V3.0.1__Migrate_Jobs_v1_to_v2_Table.sql b/jobs-service/jobs-service-postgresql-common/src/main/resources/db/jobs-service/V3.0.1__Migrate_Jobs_v1_to_v2_Table.sql similarity index 100% rename from jobs-service/jobs-service-postgresql/src/main/resources/db/jobs-service/V3.0.1__Migrate_Jobs_v1_to_v2_Table.sql rename to jobs-service/jobs-service-postgresql-common/src/main/resources/db/jobs-service/V3.0.1__Migrate_Jobs_v1_to_v2_Table.sql diff --git a/jobs-service/jobs-service-postgresql/src/main/resources/db/jobs-service/V3.0.2__Add_Execution_Timeout_Col.sql b/jobs-service/jobs-service-postgresql-common/src/main/resources/db/jobs-service/V3.0.2__Add_Execution_Timeout_Col.sql similarity index 100% rename from jobs-service/jobs-service-postgresql/src/main/resources/db/jobs-service/V3.0.2__Add_Execution_Timeout_Col.sql rename to jobs-service/jobs-service-postgresql-common/src/main/resources/db/jobs-service/V3.0.2__Add_Execution_Timeout_Col.sql diff --git a/jobs-service/jobs-service-postgresql/src/test/java/org/kie/kogito/jobs/service/messaging/PostgreSqlCallbackResource.java b/jobs-service/jobs-service-postgresql-common/src/test/java/org/kie/kogito/jobs/service/messaging/PostgreSqlCallbackResource.java similarity index 100% rename from jobs-service/jobs-service-postgresql/src/test/java/org/kie/kogito/jobs/service/messaging/PostgreSqlCallbackResource.java rename to jobs-service/jobs-service-postgresql-common/src/test/java/org/kie/kogito/jobs/service/messaging/PostgreSqlCallbackResource.java diff --git a/jobs-service/jobs-service-postgresql/src/test/java/org/kie/kogito/jobs/service/messaging/PostgreSqlEventSupportTestProfile.java b/jobs-service/jobs-service-postgresql-common/src/test/java/org/kie/kogito/jobs/service/messaging/PostgreSqlEventSupportTestProfile.java similarity index 100% rename from jobs-service/jobs-service-postgresql/src/test/java/org/kie/kogito/jobs/service/messaging/PostgreSqlEventSupportTestProfile.java rename to jobs-service/jobs-service-postgresql-common/src/test/java/org/kie/kogito/jobs/service/messaging/PostgreSqlEventSupportTestProfile.java diff --git a/jobs-service/jobs-service-postgresql/src/test/java/org/kie/kogito/jobs/service/messaging/PostgreSqlMessagingApiTest.java b/jobs-service/jobs-service-postgresql-common/src/test/java/org/kie/kogito/jobs/service/messaging/PostgreSqlMessagingApiTest.java similarity index 100% rename from jobs-service/jobs-service-postgresql/src/test/java/org/kie/kogito/jobs/service/messaging/PostgreSqlMessagingApiTest.java rename to jobs-service/jobs-service-postgresql-common/src/test/java/org/kie/kogito/jobs/service/messaging/PostgreSqlMessagingApiTest.java diff --git a/jobs-service/jobs-service-postgresql/src/test/java/org/kie/kogito/jobs/service/repository/postgresql/PostgreSqlJobRepositoryExecutionTest.java b/jobs-service/jobs-service-postgresql-common/src/test/java/org/kie/kogito/jobs/service/repository/postgresql/PostgreSqlJobRepositoryExecutionTest.java similarity index 100% rename from jobs-service/jobs-service-postgresql/src/test/java/org/kie/kogito/jobs/service/repository/postgresql/PostgreSqlJobRepositoryExecutionTest.java rename to jobs-service/jobs-service-postgresql-common/src/test/java/org/kie/kogito/jobs/service/repository/postgresql/PostgreSqlJobRepositoryExecutionTest.java diff --git a/jobs-service/jobs-service-postgresql/src/test/java/org/kie/kogito/jobs/service/repository/postgresql/PostgreSqlJobRepositoryTest.java b/jobs-service/jobs-service-postgresql-common/src/test/java/org/kie/kogito/jobs/service/repository/postgresql/PostgreSqlJobRepositoryTest.java similarity index 100% rename from jobs-service/jobs-service-postgresql/src/test/java/org/kie/kogito/jobs/service/repository/postgresql/PostgreSqlJobRepositoryTest.java rename to jobs-service/jobs-service-postgresql-common/src/test/java/org/kie/kogito/jobs/service/repository/postgresql/PostgreSqlJobRepositoryTest.java diff --git a/jobs-service/jobs-service-postgresql/src/test/java/org/kie/kogito/jobs/service/repository/postgresql/PostgreSqlJobServiceManagementRepositoryTest.java b/jobs-service/jobs-service-postgresql-common/src/test/java/org/kie/kogito/jobs/service/repository/postgresql/PostgreSqlJobServiceManagementRepositoryTest.java similarity index 100% rename from jobs-service/jobs-service-postgresql/src/test/java/org/kie/kogito/jobs/service/repository/postgresql/PostgreSqlJobServiceManagementRepositoryTest.java rename to jobs-service/jobs-service-postgresql-common/src/test/java/org/kie/kogito/jobs/service/repository/postgresql/PostgreSqlJobServiceManagementRepositoryTest.java diff --git a/jobs-service/jobs-service-postgresql/src/test/java/org/kie/kogito/jobs/service/resource/KeycloakPostgreSqlJobResourceTest.java b/jobs-service/jobs-service-postgresql-common/src/test/java/org/kie/kogito/jobs/service/resource/KeycloakPostgreSqlJobResourceTest.java similarity index 100% rename from jobs-service/jobs-service-postgresql/src/test/java/org/kie/kogito/jobs/service/resource/KeycloakPostgreSqlJobResourceTest.java rename to jobs-service/jobs-service-postgresql-common/src/test/java/org/kie/kogito/jobs/service/resource/KeycloakPostgreSqlJobResourceTest.java diff --git a/jobs-service/jobs-service-postgresql/src/test/java/org/kie/kogito/jobs/service/resource/KeycloakQuarkusTestProfile.java b/jobs-service/jobs-service-postgresql-common/src/test/java/org/kie/kogito/jobs/service/resource/KeycloakQuarkusTestProfile.java similarity index 100% rename from jobs-service/jobs-service-postgresql/src/test/java/org/kie/kogito/jobs/service/resource/KeycloakQuarkusTestProfile.java rename to jobs-service/jobs-service-postgresql-common/src/test/java/org/kie/kogito/jobs/service/resource/KeycloakQuarkusTestProfile.java diff --git a/jobs-service/jobs-service-postgresql/src/test/java/org/kie/kogito/jobs/service/resource/PostgreSqlJobResourceTest.java b/jobs-service/jobs-service-postgresql-common/src/test/java/org/kie/kogito/jobs/service/resource/PostgreSqlJobResourceTest.java similarity index 100% rename from jobs-service/jobs-service-postgresql/src/test/java/org/kie/kogito/jobs/service/resource/PostgreSqlJobResourceTest.java rename to jobs-service/jobs-service-postgresql-common/src/test/java/org/kie/kogito/jobs/service/resource/PostgreSqlJobResourceTest.java diff --git a/jobs-service/jobs-service-postgresql/src/test/java/org/kie/kogito/jobs/service/resource/v2/PostgreSqlJobResourceV2Test.java b/jobs-service/jobs-service-postgresql-common/src/test/java/org/kie/kogito/jobs/service/resource/v2/PostgreSqlJobResourceV2Test.java similarity index 100% rename from jobs-service/jobs-service-postgresql/src/test/java/org/kie/kogito/jobs/service/resource/v2/PostgreSqlJobResourceV2Test.java rename to jobs-service/jobs-service-postgresql-common/src/test/java/org/kie/kogito/jobs/service/resource/v2/PostgreSqlJobResourceV2Test.java diff --git a/jobs-service/jobs-service-postgresql/src/test/java/org/kie/kogito/jobs/service/resource/v2/http/recipient/PostgreSqlHttpRecipientPayloadTypesTest.java b/jobs-service/jobs-service-postgresql-common/src/test/java/org/kie/kogito/jobs/service/resource/v2/http/recipient/PostgreSqlHttpRecipientPayloadTypesTest.java similarity index 100% rename from jobs-service/jobs-service-postgresql/src/test/java/org/kie/kogito/jobs/service/resource/v2/http/recipient/PostgreSqlHttpRecipientPayloadTypesTest.java rename to jobs-service/jobs-service-postgresql-common/src/test/java/org/kie/kogito/jobs/service/resource/v2/http/recipient/PostgreSqlHttpRecipientPayloadTypesTest.java diff --git a/jobs-service/jobs-service-postgresql/src/test/java/org/kie/kogito/jobs/service/resource/v2/sink/recipient/PostgreSqlSinkRecipientPayloadTypesTest.java b/jobs-service/jobs-service-postgresql-common/src/test/java/org/kie/kogito/jobs/service/resource/v2/sink/recipient/PostgreSqlSinkRecipientPayloadTypesTest.java similarity index 100% rename from jobs-service/jobs-service-postgresql/src/test/java/org/kie/kogito/jobs/service/resource/v2/sink/recipient/PostgreSqlSinkRecipientPayloadTypesTest.java rename to jobs-service/jobs-service-postgresql-common/src/test/java/org/kie/kogito/jobs/service/resource/v2/sink/recipient/PostgreSqlSinkRecipientPayloadTypesTest.java diff --git a/jobs-service/jobs-service-postgresql/src/test/resources/application.properties b/jobs-service/jobs-service-postgresql-common/src/test/resources/application.properties similarity index 97% rename from jobs-service/jobs-service-postgresql/src/test/resources/application.properties rename to jobs-service/jobs-service-postgresql-common/src/test/resources/application.properties index bd23357919..cc0fa898d2 100644 --- a/jobs-service/jobs-service-postgresql/src/test/resources/application.properties +++ b/jobs-service/jobs-service-postgresql-common/src/test/resources/application.properties @@ -21,6 +21,7 @@ quarkus.oidc.tenant-enabled=false quarkus.datasource.db-kind=postgresql quarkus.flyway.migrate-at-start=true quarkus.flyway.clean-at-start=true +quarkus.flyway.locations=db/jobs-service # Outgoing events for the event based API integration tests %events-support.mp.messaging.outgoing.kogito-job-service-job-request-events-emitter.connector=smallrye-kafka diff --git a/jobs-service/jobs-service-postgresql/pom.xml b/jobs-service/jobs-service-postgresql/pom.xml index 7b1001daaf..0a33fec0fb 100644 --- a/jobs-service/jobs-service-postgresql/pom.xml +++ b/jobs-service/jobs-service-postgresql/pom.xml @@ -16,71 +16,7 @@ org.kie.kogito - jobs-service-common - - - io.quarkus - quarkus-reactive-pg-client - - - io.quarkus - quarkus-jdbc-postgresql - - - io.quarkus - quarkus-flyway - - - - org.kie.kogito - jobs-service-common - test-jar - test - - - org.kie.kogito - kogito-quarkus-test-utils - test - - - io.quarkus - quarkus-junit5 - test - - - org.mockito - mockito-junit-jupiter - test - - - org.mockito - mockito-core - test - - - org.assertj - assertj-core - test - - - org.awaitility - awaitility - test - - - io.rest-assured - rest-assured - test - - - org.keycloak - keycloak-core - test - - - com.github.tomakehurst - wiremock-jre8 - test + jobs-service-postgresql-common diff --git a/jobs-service/kogito-addons-jobs-service/kogito-addons-quarkus-jobs-service-embedded/runtime/pom.xml b/jobs-service/kogito-addons-jobs-service/kogito-addons-quarkus-jobs-service-embedded/runtime/pom.xml index 151478adf2..6976a0a48f 100644 --- a/jobs-service/kogito-addons-jobs-service/kogito-addons-quarkus-jobs-service-embedded/runtime/pom.xml +++ b/jobs-service/kogito-addons-jobs-service/kogito-addons-quarkus-jobs-service-embedded/runtime/pom.xml @@ -28,9 +28,14 @@ io.quarkus.http quarkus-http-core + + + io.quarkiverse.embedded.postgresql + quarkus-embedded-postgresql + org.kie.kogito - jobs-service-inmemory + jobs-service-postgresql-common diff --git a/jobs-service/pom.xml b/jobs-service/pom.xml index ef6d165f52..08917e7443 100644 --- a/jobs-service/pom.xml +++ b/jobs-service/pom.xml @@ -18,6 +18,7 @@ jobs-service-internal-api jobs-recipients jobs-service-common + jobs-service-postgresql-common jobs-service-postgresql jobs-service-inmemory kogito-addons-jobs-service @@ -45,6 +46,11 @@ jobs-service-internal-api ${project.version} + + org.kie.kogito + jobs-service-postgresql-common + ${project.version} + org.kie.kogito job-recipient-common-http