This is an automated email from the ASF dual-hosted git repository.
porcelli pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-kie-kogito-apps.git
The following commit(s) were added to refs/heads/main by this push:
new 538f33c4a [incubator-kie-issues#1607] Fix JPA mappings for PostgresQL
jsonb columns. (#2140)
538f33c4a is described below
commit 538f33c4a6a6e9c564cd172b32d7632cd792b1a0
Author: Pere Fernández <[email protected]>
AuthorDate: Wed Nov 6 16:09:30 2024 +0100
[incubator-kie-issues#1607] Fix JPA mappings for PostgresQL jsonb columns.
(#2140)
---
.../java/org/kie/kogito/index/test/TestUtils.java | 144 ++++++++++++-
.../storage/AbstractProcessInstanceStorageIT.java | 149 ++++++++++++-
.../storage/AbstractUserTaskInstanceStorageIT.java | 233 ++++++++++++++++++++-
.../data-index-storage-jpa/pom.xml | 7 +-
.../src/main/resources/META-INF/orm.xml | 34 ---
.../data-index/ansi/V1.33.0__data_index_create.sql | 6 +-
.../ansi/V1.44.0__data_index_definitions.sql | 24 +--
.../V1.45.0.0__data_index_node_definitions.sql | 22 +-
...1.45.0.2__data_index_definitions_add_colums.sql | 14 +-
.../kogito/index/jdbc/H2QuarkusTestProfile.java | 17 +-
.../index/jdbc/PostgreSQLQuarkusTestProfile.java | 17 +-
...bEntityQueryIT.java => H2JobEntityQueryIT.java} | 9 +-
....java => H2ProcessDefinitionEntityQueryIT.java} | 9 +-
...IT.java => H2ProcessInstanceEntityQueryIT.java} | 9 +-
...T.java => H2UserTaskInstanceEntityQueryIT.java} | 9 +-
...ueryIT.java => PostgreSQLJobEntityQueryIT.java} | 11 +-
... PostgreSQLProcessDefinitionEntityQueryIT.java} | 11 +-
...=> PostgreSQLProcessInstanceEntityQueryIT.java} | 11 +-
...> PostgreSQLUserTaskInstanceEntityQueryIT.java} | 11 +-
.../{JobStorageIT.java => H2JobStorageIT.java} | 10 +-
...geIT.java => H2ProcessDefinitionStorageIT.java} | 10 +-
...rageIT.java => H2ProcessInstanceStorageIT.java} | 10 +-
...ageIT.java => H2UserTaskInstanceStorageIT.java} | 10 +-
...bStorageIT.java => PostgreSQLJobStorageIT.java} | 11 +-
...a => PostgreSQLProcessDefinitionStorageIT.java} | 11 +-
.../PostgreSQLProcessInstanceStorageIT.java} | 11 +-
...va => PostgreSQLUserTaskInstanceStorageIT.java} | 11 +-
.../src/test/resources/application.properties | 14 +-
.../storage/ProcessInstanceStorageIT.java | 2 +
.../src/test/resources/application.properties | 3 +-
.../jpa/converter/JsonBinaryConverter.java | 8 +-
.../src/main/resources/application.properties | 0
.../db/jobs-service/ansi/V2.0.0__Create_Tables.sql | 4 +-
.../src/main/resources/application.properties | 0
...1.5.0__kogito_apps_create_kogito_data_cache.sql | 2 +-
35 files changed, 702 insertions(+), 162 deletions(-)
diff --git
a/data-index/data-index-storage/data-index-storage-api/src/test/java/org/kie/kogito/index/test/TestUtils.java
b/data-index/data-index-storage/data-index-storage-api/src/test/java/org/kie/kogito/index/test/TestUtils.java
index 57c05f049..59ee7601a 100644
---
a/data-index/data-index-storage/data-index-storage-api/src/test/java/org/kie/kogito/index/test/TestUtils.java
+++
b/data-index/data-index-storage/data-index-storage-api/src/test/java/org/kie/kogito/index/test/TestUtils.java
@@ -18,21 +18,16 @@
*/
package org.kie.kogito.index.test;
+import java.net.URI;
import java.time.Instant;
import java.time.ZoneOffset;
import java.time.ZonedDateTime;
import java.time.temporal.ChronoUnit;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.UUID;
+import java.util.*;
import org.apache.commons.lang3.RandomStringUtils;
-import org.kie.kogito.event.process.ProcessInstanceStateDataEvent;
-import org.kie.kogito.event.process.ProcessInstanceStateEventBody;
-import org.kie.kogito.event.process.ProcessInstanceVariableDataEvent;
-import org.kie.kogito.event.process.ProcessInstanceVariableEventBody;
+import org.kie.kogito.event.process.*;
+import org.kie.kogito.event.usertask.*;
import org.kie.kogito.index.model.Attachment;
import org.kie.kogito.index.model.Comment;
import org.kie.kogito.index.model.Job;
@@ -88,6 +83,137 @@ public class TestUtils {
return event;
}
+ public static ProcessInstanceNodeDataEvent
createProcessInstanceNodeDataEvent(String processInstance, String processId,
String nodeDefinitionId, String nodeInstanceId, String nodeName,
+ String nodeType, int eventType) {
+
+ ProcessInstanceNodeEventBody body =
ProcessInstanceNodeEventBody.create()
+ .processId(processId)
+ .processInstanceId(processInstance)
+ .nodeDefinitionId(nodeDefinitionId)
+ .nodeInstanceId(nodeInstanceId)
+ .nodeName(nodeName)
+ .nodeType(nodeType)
+ .eventDate(new Date())
+ .eventType(eventType)
+ .build();
+
+ ProcessInstanceNodeDataEvent event = new
ProcessInstanceNodeDataEvent();
+ event.setKogitoProcessId(processId);
+ event.setKogitoProcessInstanceId(processInstance);
+ event.setData(body);
+
+ return event;
+ }
+
+ public static ProcessInstanceErrorDataEvent
createProcessInstanceErrorDataEvent(String processInstance, String processId,
String userId, String errorMessage, String nodeDefinitionId,
+ String nodeInstanceId) {
+ ProcessInstanceErrorEventBody body =
ProcessInstanceErrorEventBody.create()
+ .eventDate(new Date())
+ .eventUser(userId)
+ .processId(processId)
+ .processInstanceId(processInstance)
+ .errorMessage(errorMessage)
+ .nodeDefinitionId(nodeDefinitionId)
+ .nodeInstanceId(nodeInstanceId)
+ .build();
+
+ ProcessInstanceErrorDataEvent event = new
ProcessInstanceErrorDataEvent();
+ event.setKogitoProcessInstanceId(processInstance);
+ event.setKogitoProcessId(processId);
+ event.setData(body);
+ return event;
+ }
+
+ public static UserTaskInstanceStateDataEvent
createUserTaskStateEvent(String taskId, String taskName, String
processInstanceId, String processId, String state) {
+ UserTaskInstanceStateEventBody body =
UserTaskInstanceStateEventBody.create()
+ .userTaskInstanceId(taskId)
+ .userTaskName(taskName)
+ .state(state)
+ .processInstanceId(processInstanceId)
+ .build();
+
+ UserTaskInstanceStateDataEvent event = new
UserTaskInstanceStateDataEvent();
+
+ event.setKogitoUserTaskInstanceId(taskId);
+ event.setKogitoProcessInstanceId(processInstanceId);
+ event.setKogitoProcessId(processId);
+
+ event.setData(body);
+
+ return event;
+ }
+
+ public static UserTaskInstanceCommentDataEvent
createUserTaskCommentEvent(String taskId, String processInstanceId, String
processId, String commentId, String comment, String userId,
+ int eventType) {
+
+ UserTaskInstanceCommentEventBody body =
UserTaskInstanceCommentEventBody.create()
+ .commentId(commentId)
+ .eventUser(userId)
+ .commentContent(comment)
+ .eventDate(new Date())
+ .eventType(eventType)
+ .userTaskInstanceId(taskId)
+ .build();
+
+ UserTaskInstanceCommentDataEvent event = new
UserTaskInstanceCommentDataEvent();
+ event.setKogitoUserTaskInstanceId(taskId);
+ event.setKogitoProcessInstanceId(processInstanceId);
+ event.setKogitoProcessId(processId);
+ event.setData(body);
+ return event;
+ }
+
+ public static UserTaskInstanceAttachmentDataEvent
createUserTaskAttachmentEvent(String taskId, String processInstanceId, String
processId, String attachmentId, String attachmentName,
+ URI attachmentURI, String userId, int eventType) {
+
+ UserTaskInstanceAttachmentEventBody body =
UserTaskInstanceAttachmentEventBody.create()
+ .attachmentId(attachmentId)
+ .eventUser(userId)
+ .attachmentName(attachmentName)
+ .attachmentURI(attachmentURI)
+ .eventDate(new Date())
+ .eventType(eventType)
+ .userTaskInstanceId(taskId)
+ .build();
+
+ UserTaskInstanceAttachmentDataEvent event = new
UserTaskInstanceAttachmentDataEvent();
+ event.setKogitoUserTaskInstanceId(taskId);
+ event.setKogitoProcessInstanceId(processInstanceId);
+ event.setKogitoProcessId(processId);
+ event.setData(body);
+ return event;
+ }
+
+ public static UserTaskInstanceAssignmentDataEvent
createUserTaskAssignmentEvent(String taskId, String processInstanceId, String
processId, String assignmentType, String... users) {
+ UserTaskInstanceAssignmentEventBody body =
UserTaskInstanceAssignmentEventBody.create()
+ .users(users)
+ .assignmentType(assignmentType)
+ .build();
+
+ UserTaskInstanceAssignmentDataEvent event = new
UserTaskInstanceAssignmentDataEvent();
+ event.setKogitoUserTaskInstanceId(taskId);
+ event.setKogitoProcessInstanceId(processInstanceId);
+ event.setKogitoProcessId(processId);
+ event.setData(body);
+ return event;
+ }
+
+ public static UserTaskInstanceVariableDataEvent
createUserTaskVariableEvent(String taskId, String processInstanceId, String
processId, String variableName, Object variableValue,
+ String variableType) {
+ UserTaskInstanceVariableEventBody body =
UserTaskInstanceVariableEventBody.create()
+ .variableName(variableName)
+ .variableValue(variableValue)
+ .variableType(variableType)
+ .build();
+
+ UserTaskInstanceVariableDataEvent event = new
UserTaskInstanceVariableDataEvent();
+ event.setKogitoUserTaskInstanceId(taskId);
+ event.setKogitoProcessInstanceId(processInstanceId);
+ event.setKogitoProcessId(processId);
+ event.setData(body);
+ return event;
+ }
+
public static ProcessInstance createProcessInstance(String
processInstanceId,
String processId,
String rootProcessInstanceId,
diff --git
a/data-index/data-index-storage/data-index-storage-jpa-common/src/test/java/org/kie/kogito/index/jpa/storage/AbstractProcessInstanceStorageIT.java
b/data-index/data-index-storage/data-index-storage-jpa-common/src/test/java/org/kie/kogito/index/jpa/storage/AbstractProcessInstanceStorageIT.java
index 1ea09ce49..b60f7ed30 100644
---
a/data-index/data-index-storage/data-index-storage-jpa-common/src/test/java/org/kie/kogito/index/jpa/storage/AbstractProcessInstanceStorageIT.java
+++
b/data-index/data-index-storage/data-index-storage-jpa-common/src/test/java/org/kie/kogito/index/jpa/storage/AbstractProcessInstanceStorageIT.java
@@ -20,29 +20,158 @@ package org.kie.kogito.index.jpa.storage;
import java.util.UUID;
-import org.apache.commons.lang3.RandomStringUtils;
+import org.assertj.core.api.Assertions;
import org.junit.jupiter.api.Test;
-import org.kie.kogito.index.jpa.model.ProcessInstanceEntityRepository;
+import org.kie.kogito.event.process.ProcessInstanceNodeEventBody;
+import org.kie.kogito.index.model.ProcessInstance;
import org.kie.kogito.index.model.ProcessInstanceState;
import org.kie.kogito.index.test.TestUtils;
import jakarta.inject.Inject;
+import jakarta.transaction.Transactional;
public abstract class AbstractProcessInstanceStorageIT {
+ private static final String PROCESS_ID = "travels";
+ private static final String TRAVELER_NAME = "John";
+ private static final String TRAVELER_LAST_NAME = "Doe";
@Inject
- ProcessInstanceEntityRepository repository;
+ ProcessInstanceEntityStorage storage;
@Test
- public void testProcessInstanceEntity() {
+ @Transactional
+ public void testProcessInstanceStateEvent() {
+ String processInstanceId = createNewProcessInstance();
+
+ ProcessInstance processInstance = storage.get(processInstanceId);
+ Assertions.assertThat(processInstance)
+ .isNotNull()
+ .hasFieldOrPropertyWithValue("id", processInstanceId)
+ .hasFieldOrPropertyWithValue("processId", PROCESS_ID)
+ .hasFieldOrPropertyWithValue("state",
ProcessInstanceState.ACTIVE.ordinal())
+ .hasFieldOrPropertyWithValue("rootProcessInstanceId", null)
+ .hasFieldOrPropertyWithValue("rootProcessId", null)
+ .hasFieldOrPropertyWithValue("variables", null);
+
+
storage.indexState(TestUtils.createProcessInstanceEvent(processInstanceId,
PROCESS_ID, null, null, ProcessInstanceState.COMPLETED.ordinal()));
+
+ processInstance = storage.get(processInstanceId);
+ Assertions.assertThat(processInstance)
+ .isNotNull()
+ .hasFieldOrPropertyWithValue("id", processInstanceId)
+ .hasFieldOrPropertyWithValue("processId", PROCESS_ID)
+ .hasFieldOrPropertyWithValue("state",
ProcessInstanceState.COMPLETED.ordinal())
+ .hasFieldOrPropertyWithValue("rootProcessInstanceId", null)
+ .hasFieldOrPropertyWithValue("rootProcessId", null)
+ .hasFieldOrPropertyWithValue("variables", null);
+ }
+
+ @Test
+ @Transactional
+ public void testProcessInstanceErrorEvent() {
+ String processInstanceId = createNewProcessInstance();
+
+ ProcessInstance processInstance = storage.get(processInstanceId);
+
+ Assertions.assertThat(processInstance.getError())
+ .isNull();
+
+ String nodeDefinitionId = UUID.randomUUID().toString();
+
storage.indexError(TestUtils.createProcessInstanceErrorDataEvent(processInstanceId,
PROCESS_ID, TRAVELER_NAME, "This is really wrong", nodeDefinitionId,
UUID.randomUUID().toString()));
+
+ processInstance = storage.get(processInstanceId);
+
+ Assertions.assertThat(processInstance.getError())
+ .isNotNull()
+ .hasFieldOrPropertyWithValue("nodeDefinitionId",
nodeDefinitionId)
+ .hasFieldOrPropertyWithValue("message", "This is really
wrong");
+ }
+
+ @Test
+ @Transactional
+ public void testProcessInstanceNodeEvent() {
+ String processInstanceId = createNewProcessInstance();
+
+ ProcessInstance processInstance = storage.get(processInstanceId);
+
+ Assertions.assertThat(processInstance.getNodes())
+ .isEmpty();
+
+ String nodeDefinitionId = UUID.randomUUID().toString();
+ String nodeInstanceId = UUID.randomUUID().toString();
+
+
storage.indexNode(TestUtils.createProcessInstanceNodeDataEvent(processInstanceId,
PROCESS_ID, nodeDefinitionId, nodeInstanceId, "nodeName", "BoundaryEventNode",
+ ProcessInstanceNodeEventBody.EVENT_TYPE_ENTER));
+
+ processInstance = storage.get(processInstanceId);
+
+ Assertions.assertThat(processInstance.getNodes())
+ .hasSize(1);
+
+ Assertions.assertThat(processInstance.getNodes().get(0))
+ .hasNoNullFieldsOrPropertiesExcept("exit")
+ .hasFieldOrPropertyWithValue("name", "nodeName")
+ .hasFieldOrPropertyWithValue("type", "BoundaryEventNode")
+ .hasFieldOrPropertyWithValue("definitionId", nodeDefinitionId)
+ .hasFieldOrPropertyWithValue("nodeId", nodeDefinitionId)
+ .hasFieldOrPropertyWithValue("id", nodeInstanceId);
+
+
storage.indexNode(TestUtils.createProcessInstanceNodeDataEvent(processInstanceId,
PROCESS_ID, nodeDefinitionId, nodeInstanceId, "nodeName", "BoundaryEventNode",
+ ProcessInstanceNodeEventBody.EVENT_TYPE_EXIT));
+
+ processInstance = storage.get(processInstanceId);
+
+ Assertions.assertThat(processInstance.getNodes())
+ .hasSize(1);
+
+ Assertions.assertThat(processInstance.getNodes().get(0))
+ .hasNoNullFieldsOrProperties()
+ .hasFieldOrPropertyWithValue("name", "nodeName")
+ .hasFieldOrPropertyWithValue("type", "BoundaryEventNode")
+ .hasFieldOrPropertyWithValue("definitionId", nodeDefinitionId)
+ .hasFieldOrPropertyWithValue("nodeId", nodeDefinitionId)
+ .hasFieldOrPropertyWithValue("id", nodeInstanceId);
+ }
+
+ @Test
+ @Transactional
+ public void testProcessInstanceVariableEvent() {
+ String processInstanceId = createNewProcessInstance();
+
+ ProcessInstance processInstance = storage.get(processInstanceId);
+
+ Assertions.assertThat(processInstance.getVariables())
+ .isNull();
+
+
storage.indexVariable(TestUtils.createProcessInstanceVariableEvent(processInstanceId,
PROCESS_ID, TRAVELER_NAME, TRAVELER_LAST_NAME));
+
+ processInstance = storage.get(processInstanceId);
+
+ Assertions.assertThatObject(processInstance.getVariables())
+ .isNotNull()
+ .extracting(jsonNodes ->
jsonNodes.at("/traveller/firstName").asText(), jsonNodes ->
jsonNodes.at("/traveller/lastName").asText())
+ .contains(TRAVELER_NAME, TRAVELER_LAST_NAME);
+ }
+
+ private String createNewProcessInstance() {
String processInstanceId = UUID.randomUUID().toString();
- TestUtils
- .createProcessInstance(processInstanceId,
RandomStringUtils.randomAlphabetic(5), UUID.randomUUID().toString(),
- RandomStringUtils.randomAlphabetic(10),
ProcessInstanceState.ACTIVE.ordinal(), 0L);
- TestUtils
- .createProcessInstance(processInstanceId,
RandomStringUtils.randomAlphabetic(5), UUID.randomUUID().toString(),
- RandomStringUtils.randomAlphabetic(10),
ProcessInstanceState.COMPLETED.ordinal(), 1000L);
+ Assertions.assertThat(storage.get(processInstanceId))
+ .isNull();
+
+
storage.indexState(TestUtils.createProcessInstanceEvent(processInstanceId,
PROCESS_ID, null, null, ProcessInstanceState.ACTIVE.ordinal()));
+
+ ProcessInstance processInstance = storage.get(processInstanceId);
+ Assertions.assertThat(processInstance)
+ .isNotNull()
+ .hasFieldOrPropertyWithValue("id", processInstanceId)
+ .hasFieldOrPropertyWithValue("processId", PROCESS_ID)
+ .hasFieldOrPropertyWithValue("state",
ProcessInstanceState.ACTIVE.ordinal())
+ .hasFieldOrPropertyWithValue("rootProcessInstanceId", null)
+ .hasFieldOrPropertyWithValue("rootProcessId", null)
+ .hasFieldOrPropertyWithValue("variables", null);
+
+ return processInstanceId;
}
}
diff --git
a/data-index/data-index-storage/data-index-storage-jpa-common/src/test/java/org/kie/kogito/index/jpa/storage/AbstractUserTaskInstanceStorageIT.java
b/data-index/data-index-storage/data-index-storage-jpa-common/src/test/java/org/kie/kogito/index/jpa/storage/AbstractUserTaskInstanceStorageIT.java
index 9b8c0056c..d44d53495 100644
---
a/data-index/data-index-storage/data-index-storage-jpa-common/src/test/java/org/kie/kogito/index/jpa/storage/AbstractUserTaskInstanceStorageIT.java
+++
b/data-index/data-index-storage/data-index-storage-jpa-common/src/test/java/org/kie/kogito/index/jpa/storage/AbstractUserTaskInstanceStorageIT.java
@@ -18,19 +18,226 @@
*/
package org.kie.kogito.index.jpa.storage;
-import java.util.UUID;
+import java.net.URI;
+import java.util.*;
import org.apache.commons.lang3.RandomStringUtils;
+import org.assertj.core.api.Assertions;
import org.junit.jupiter.api.Test;
+import org.kie.kogito.event.usertask.UserTaskInstanceAttachmentEventBody;
+import org.kie.kogito.index.jpa.model.UserTaskInstanceEntity;
import org.kie.kogito.index.jpa.model.UserTaskInstanceEntityRepository;
+import org.kie.kogito.index.model.UserTaskInstance;
+import org.kie.kogito.index.storage.UserTaskInstanceStorage;
import org.kie.kogito.index.test.TestUtils;
import jakarta.inject.Inject;
+import jakarta.transaction.Transactional;
public abstract class AbstractUserTaskInstanceStorageIT {
+ private static final String PROCESS_INSTANCE_ID =
"87daz3446-2386-4056-91dc-dbc3804d157c";
+ private static final String PROCESS_ID = "travels";
+ private static final String TASK_NAME = "HR Interview";
+
+ @Inject
+ UserTaskInstanceStorage storage;
+
@Inject
- UserTaskInstanceEntityRepository repository;
+ UserTaskInstanceEntityRepository userTaskInstanceRepository;
+
+ @Test
+ @Transactional
+ public void testUserTaskStateEvent() {
+ String taskId = createUserTaskInstance();
+
+ storage.indexState(TestUtils.createUserTaskStateEvent(taskId,
TASK_NAME, PROCESS_INSTANCE_ID, PROCESS_ID, "Completed"));
+
+ UserTaskInstance task = storage.get(taskId);
+
+ Assertions.assertThat(task)
+ .isNotNull()
+ .hasFieldOrPropertyWithValue("id", taskId)
+ .hasFieldOrPropertyWithValue("name", TASK_NAME)
+ .hasFieldOrPropertyWithValue("processId", PROCESS_ID)
+ .hasFieldOrPropertyWithValue("processInstanceId",
PROCESS_INSTANCE_ID)
+ .hasFieldOrPropertyWithValue("state", "Completed");
+ }
+
+ @Test
+ @Transactional
+ public void testUserTaskAssignmentEvents() {
+
+ String taskId = createUserTaskInstance();
+
+ UserTaskInstance task = storage.get(taskId);
+
+ Assertions.assertThat(task)
+ .hasFieldOrPropertyWithValue("potentialUsers", null)
+ .hasFieldOrPropertyWithValue("potentialGroups", null)
+ .hasFieldOrPropertyWithValue("adminGroups", null)
+ .hasFieldOrPropertyWithValue("adminUsers", null)
+ .hasFieldOrPropertyWithValue("excludedUsers", null);
+
+
storage.indexAssignment(TestUtils.createUserTaskAssignmentEvent(taskId,
PROCESS_INSTANCE_ID, PROCESS_ID, "USER_OWNERS", "John"));
+
storage.indexAssignment(TestUtils.createUserTaskAssignmentEvent(taskId,
PROCESS_INSTANCE_ID, PROCESS_ID, "USER_GROUPS", "user-group"));
+
storage.indexAssignment(TestUtils.createUserTaskAssignmentEvent(taskId,
PROCESS_INSTANCE_ID, PROCESS_ID, "ADMIN_GROUPS", "administrators"));
+
storage.indexAssignment(TestUtils.createUserTaskAssignmentEvent(taskId,
PROCESS_INSTANCE_ID, PROCESS_ID, "ADMIN_USERS", "super-user"));
+
storage.indexAssignment(TestUtils.createUserTaskAssignmentEvent(taskId,
PROCESS_INSTANCE_ID, PROCESS_ID, "USERS_EXCLUDED", "excluded-user"));
+
+ task = storage.get(taskId);
+
+ Assertions.assertThat(task.getPotentialUsers())
+ .containsExactly("John");
+ Assertions.assertThat(task.getPotentialGroups())
+ .containsExactly("user-group");
+ Assertions.assertThat(task.getAdminGroups())
+ .containsExactly("administrators");
+ Assertions.assertThat(task.getAdminUsers())
+ .containsExactly("super-user");
+ Assertions.assertThat(task.getExcludedUsers())
+ .containsExactly("excluded-user");
+ }
+
+ @Transactional
+ @Test
+ public void testUserTaskVariableEvents() {
+ String taskId = createUserTaskInstance();
+
+ UserTaskInstance task = storage.get(taskId);
+
+ Assertions.assertThat(task.getInputs())
+ .isNull();
+ Assertions.assertThat(task.getOutputs())
+ .isNull();
+
+ Map<String, Object> person = new HashMap<>();
+ person.put("firstName", "John");
+ person.put("lastName", "Doe");
+
+ storage.indexVariable(TestUtils.createUserTaskVariableEvent(taskId,
PROCESS_INSTANCE_ID, PROCESS_ID, "person", person, "INPUT"));
+
+ task = storage.get(taskId);
+
+ Assertions.assertThatObject(task.getInputs())
+ .isNotNull()
+ .extracting(jsonNodes ->
jsonNodes.at("/person/firstName").asText(), jsonNodes ->
jsonNodes.at("/person/lastName").asText())
+ .contains("John", "Doe");
+
+ Assertions.assertThat(task.getOutputs())
+ .isNull();
+
+ person = new HashMap<>();
+ person.put("age", 50);
+ person.put("married", true);
+
+ storage.indexVariable(TestUtils.createUserTaskVariableEvent(taskId,
PROCESS_INSTANCE_ID, PROCESS_ID, "person", person, "OUTPUT"));
+
+ task = storage.get(taskId);
+
+ Assertions.assertThatObject(task.getOutputs())
+ .isNotNull()
+ .extracting(jsonNodes -> jsonNodes.at("/person/age").asInt(),
jsonNodes -> jsonNodes.at("/person/married").asBoolean())
+ .contains(50, true);
+ }
+
+ @Transactional
+ @Test
+ public void testUserTaskCommentEvents() {
+ String taskId = createUserTaskInstance();
+
+ UserTaskInstance task = storage.get(taskId);
+
+ Assertions.assertThat(task.getComments())
+ .isEmpty();
+
+ String commentId = UUID.randomUUID().toString();
+ storage.indexComment(
+ TestUtils.createUserTaskCommentEvent(taskId,
PROCESS_INSTANCE_ID, PROCESS_ID, commentId, "this is a comment", "John",
UserTaskInstanceAttachmentEventBody.EVENT_TYPE_ADDED));
+
+ task = storage.get(taskId);
+
+ Assertions.assertThat(task.getComments())
+ .hasSize(1);
+
+ Assertions.assertThat(task.getComments().get(0))
+ .hasNoNullFieldsOrProperties()
+ .hasFieldOrPropertyWithValue("id", commentId)
+ .hasFieldOrPropertyWithValue("content", "this is a comment")
+ .hasFieldOrPropertyWithValue("updatedBy", "John");
+
+ storage.indexComment(
+ TestUtils.createUserTaskCommentEvent(taskId,
PROCESS_INSTANCE_ID, PROCESS_ID, commentId, "this is an updated comment",
"John", UserTaskInstanceAttachmentEventBody.EVENT_TYPE_CHANGE));
+
+ task = storage.get(taskId);
+
+ Assertions.assertThat(task.getComments())
+ .hasSize(1);
+
+ Assertions.assertThat(task.getComments().get(0))
+ .hasNoNullFieldsOrProperties()
+ .hasFieldOrPropertyWithValue("id", commentId)
+ .hasFieldOrPropertyWithValue("content", "this is an updated
comment")
+ .hasFieldOrPropertyWithValue("updatedBy", "John");
+
+ storage.indexComment(
+ TestUtils.createUserTaskCommentEvent(taskId,
PROCESS_INSTANCE_ID, PROCESS_ID, commentId, "this is an updated comment",
"John", UserTaskInstanceAttachmentEventBody.EVENT_TYPE_DELETED));
+
+ task = storage.get(taskId);
+
+ Assertions.assertThat(task.getComments())
+ .hasSize(0);
+ }
+
+ @Transactional
+ @Test
+ public void testUserTaskAttachmentEvents() {
+ String taskId = createUserTaskInstance();
+
+ UserTaskInstance task = storage.get(taskId);
+
+ Assertions.assertThat(task.getAttachments())
+ .isEmpty();
+
+ String attachmentId = UUID.randomUUID().toString();
+
storage.indexAttachment(TestUtils.createUserTaskAttachmentEvent(taskId,
PROCESS_INSTANCE_ID, PROCESS_ID, attachmentId, "Attachment-1",
URI.create("http://localhost:8080/my-doc.txt"), "John",
+ UserTaskInstanceAttachmentEventBody.EVENT_TYPE_ADDED));
+
+ task = storage.get(taskId);
+
+ Assertions.assertThat(task.getAttachments())
+ .hasSize(1);
+
+ Assertions.assertThat(task.getAttachments().get(0))
+ .hasNoNullFieldsOrProperties()
+ .hasFieldOrPropertyWithValue("id", attachmentId)
+ .hasFieldOrPropertyWithValue("name", "Attachment-1")
+ .hasFieldOrPropertyWithValue("content",
"http://localhost:8080/my-doc.txt")
+ .hasFieldOrPropertyWithValue("updatedBy", "John");
+
+
storage.indexAttachment(TestUtils.createUserTaskAttachmentEvent(taskId,
PROCESS_INSTANCE_ID, PROCESS_ID, attachmentId, "Attachment-1.2",
URI.create("http://localhost:8080/my-doc2.txt"),
+ "John",
UserTaskInstanceAttachmentEventBody.EVENT_TYPE_CHANGE));
+
+ task = storage.get(taskId);
+
+ Assertions.assertThat(task.getAttachments())
+ .hasSize(1);
+
+ Assertions.assertThat(task.getAttachments().get(0))
+ .hasNoNullFieldsOrProperties()
+ .hasFieldOrPropertyWithValue("id", attachmentId)
+ .hasFieldOrPropertyWithValue("name", "Attachment-1.2")
+ .hasFieldOrPropertyWithValue("content",
"http://localhost:8080/my-doc2.txt")
+ .hasFieldOrPropertyWithValue("updatedBy", "John");
+
+
storage.indexAttachment(TestUtils.createUserTaskAttachmentEvent(taskId,
PROCESS_INSTANCE_ID, PROCESS_ID, attachmentId, "Attachment-1",
URI.create("http://localhost:8080/my-doc2.txt"), "John",
+ UserTaskInstanceAttachmentEventBody.EVENT_TYPE_DELETED));
+
+ task = storage.get(taskId);
+
+ Assertions.assertThat(task.getAttachments())
+ .hasSize(0);
+ }
@Test
public void testUserTaskInstanceEntity() {
@@ -46,4 +253,26 @@ public abstract class AbstractUserTaskInstanceStorageIT {
RandomStringUtils.randomAlphabetic(10), "Completed",
1000L);
}
+ private String createUserTaskInstance() {
+ String taskId = UUID.randomUUID().toString();
+
+ storage.indexState(TestUtils.createUserTaskStateEvent(taskId,
TASK_NAME, PROCESS_INSTANCE_ID, PROCESS_ID, "InProgress"));
+
+ UserTaskInstance task = storage.get(taskId);
+
+ Assertions.assertThat(task)
+ .isNotNull()
+ .hasFieldOrPropertyWithValue("id", taskId)
+ .hasFieldOrPropertyWithValue("name", TASK_NAME)
+ .hasFieldOrPropertyWithValue("processId", PROCESS_ID)
+ .hasFieldOrPropertyWithValue("processInstanceId",
PROCESS_INSTANCE_ID)
+ .hasFieldOrPropertyWithValue("state", "InProgress");
+
+ // Initializing comments and attachments just for the test
+ UserTaskInstanceEntity taskInstanceEntity =
userTaskInstanceRepository.findById(taskId);
+ taskInstanceEntity.setComments(new ArrayList<>());
+ taskInstanceEntity.setAttachments(new ArrayList<>());
+
+ return taskId;
+ }
}
diff --git a/data-index/data-index-storage/data-index-storage-jpa/pom.xml
b/data-index/data-index-storage/data-index-storage-jpa/pom.xml
index 393cc0901..7db734cf5 100644
--- a/data-index/data-index-storage/data-index-storage-jpa/pom.xml
+++ b/data-index/data-index-storage/data-index-storage-jpa/pom.xml
@@ -38,7 +38,7 @@
<path.to.script.folder>src/main/resources/${path.to.flyway.location}</path.to.script.folder>
<path.to.migration.scripts.source>${path.to.postgresql.storage}/${path.to.script.folder}</path.to.migration.scripts.source>
<path.to.migration.scripts.target>target/classes/${path.to.flyway.location}</path.to.migration.scripts.target>
- <java.module.name>org.kie.kogito.index.jpa</java.module.name>
+ <java.module.name>org.kie.kogito.index.jpa</java.module.name>
</properties>
<dependencies>
@@ -60,6 +60,11 @@
<artifactId>quarkus-test-h2</artifactId>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-jdbc-postgresql</artifactId>
+ <scope>test</scope>
+ </dependency>
<dependency>
<groupId>org.kie.kogito</groupId>
<artifactId>data-index-storage-api</artifactId>
diff --git
a/data-index/data-index-storage/data-index-storage-jpa/src/main/resources/META-INF/orm.xml
b/data-index/data-index-storage/data-index-storage-jpa/src/main/resources/META-INF/orm.xml
deleted file mode 100644
index 2e9789c75..000000000
---
a/data-index/data-index-storage/data-index-storage-jpa/src/main/resources/META-INF/orm.xml
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<entity-mappings xmlns="http://xmlns.jcp.org/xml/ns/persistence/orm"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence/orm
http://xmlns.jcp.org/xml/ns/persistence/orm_2_2.xsd"
- version="2.2">
- <entity class="org.kie.kogito.index.jpa.model.ProcessInstanceEntity"
metadata-complete="false">
- <attributes>
- <basic name="variables">
- <column name="variables" column-definition="blob"/>
- <convert
converter="org.kie.kogito.index.jdbc.JsonBinaryConverter"/>
- </basic>
- </attributes>
- </entity>
- <entity class="org.kie.kogito.index.jpa.model.UserTaskInstanceEntity"
metadata-complete="false">
- <attributes>
- <basic name="inputs">
- <column name="inputs" column-definition="blob"/>
- <convert
converter="org.kie.kogito.index.jdbc.JsonBinaryConverter"/>
- </basic>
- <basic name="outputs">
- <column name="outputs" column-definition="blob"/>
- <convert
converter="org.kie.kogito.index.jdbc.JsonBinaryConverter"/>
- </basic>
- </attributes>
- </entity>
- <entity class="org.kie.kogito.persistence.postgresql.model.CacheEntity"
metadata-complete="false">
- <attributes>
- <basic name="value">
- <column name="json_value" column-definition="blob"/>
- <convert
converter="org.kie.kogito.index.jdbc.JsonBinaryConverter"/>
- </basic>
- </attributes>
- </entity>
- </entity-mappings>
\ No newline at end of file
diff --git
a/data-index/data-index-storage/data-index-storage-jpa/src/main/resources/kie-flyway/db/data-index/ansi/V1.33.0__data_index_create.sql
b/data-index/data-index-storage/data-index-storage-jpa/src/main/resources/kie-flyway/db/data-index/ansi/V1.33.0__data_index_create.sql
index 564a9c72e..3aa01f1e8 100644
---
a/data-index/data-index-storage/data-index-storage-jpa/src/main/resources/kie-flyway/db/data-index/ansi/V1.33.0__data_index_create.sql
+++
b/data-index/data-index-storage/data-index-storage-jpa/src/main/resources/kie-flyway/db/data-index/ansi/V1.33.0__data_index_create.sql
@@ -98,7 +98,7 @@ create table processes
root_process_instance_id varchar(255),
start_time timestamp,
state integer,
- variables varbinary(max),
+ variables varchar(max),
CONSTRAINT processes_pk PRIMARY KEY (id),
CONSTRAINT processes_variables_json CHECK (variables IS JSON)
);
@@ -124,10 +124,10 @@ create table tasks
completed timestamp,
description varchar(255),
endpoint varchar(255),
- inputs varbinary(max),
+ inputs varchar(max),
last_update timestamp,
name varchar(255),
- outputs varbinary(max),
+ outputs varchar(max),
priority varchar(255),
process_id varchar(255),
process_instance_id varchar(255),
diff --git
a/data-index/data-index-storage/data-index-storage-jpa/src/main/resources/kie-flyway/db/data-index/ansi/V1.44.0__data_index_definitions.sql
b/data-index/data-index-storage/data-index-storage-jpa/src/main/resources/kie-flyway/db/data-index/ansi/V1.44.0__data_index_definitions.sql
index 4f361d57c..2dbdee38e 100644
---
a/data-index/data-index-storage/data-index-storage-jpa/src/main/resources/kie-flyway/db/data-index/ansi/V1.44.0__data_index_definitions.sql
+++
b/data-index/data-index-storage/data-index-storage-jpa/src/main/resources/kie-flyway/db/data-index/ansi/V1.44.0__data_index_definitions.sql
@@ -19,28 +19,28 @@
create table definitions
(
- id varchar2(255) not null,
- version varchar2(255) not null,
- name varchar2(255),
+ id varchar(255) not null,
+ version varchar(255) not null,
+ name varchar(255),
source bytea,
- type varchar2(255),
- endpoint varchar2(255),
+ type varchar(255),
+ endpoint varchar(255),
primary key (id, version)
);
create table definitions_addons
(
- process_id varchar2(255) not null,
- process_version varchar2(255) not null,
- addon varchar2(255) not null,
+ process_id varchar(255) not null,
+ process_version varchar(255) not null,
+ addon varchar(255) not null,
primary key (process_id, process_version, addon)
);
create table definitions_roles
(
- process_id varchar2(255) not null,
- process_version varchar2(255) not null,
- role varchar2(255) not null,
+ process_id varchar(255) not null,
+ process_version varchar(255) not null,
+ role varchar(255) not null,
primary key (process_id, process_version, role)
);
@@ -57,4 +57,4 @@ alter table definitions_roles
on delete cascade;
alter table processes
- add column version varchar2(255);
\ No newline at end of file
+ add column version varchar(255);
\ No newline at end of file
diff --git
a/data-index/data-index-storage/data-index-storage-jpa/src/main/resources/kie-flyway/db/data-index/ansi/V1.45.0.0__data_index_node_definitions.sql
b/data-index/data-index-storage/data-index-storage-jpa/src/main/resources/kie-flyway/db/data-index/ansi/V1.45.0.0__data_index_node_definitions.sql
index 7bce973a3..e318e7d5f 100644
---
a/data-index/data-index-storage/data-index-storage-jpa/src/main/resources/kie-flyway/db/data-index/ansi/V1.45.0.0__data_index_node_definitions.sql
+++
b/data-index/data-index-storage/data-index-storage-jpa/src/main/resources/kie-flyway/db/data-index/ansi/V1.45.0.0__data_index_node_definitions.sql
@@ -19,22 +19,22 @@
create table definitions_nodes
(
- id varchar2(255) not null,
- name varchar2(255),
- type varchar2(255),
- unique_id varchar2(255),
- process_id varchar2(255) not null,
- process_version varchar2(255) not null,
+ id varchar(255) not null,
+ name varchar(255),
+ type varchar(255),
+ unique_id varchar(255),
+ process_id varchar(255) not null,
+ process_version varchar(255) not null,
primary key (id, process_id, process_version)
);
create table definitions_nodes_metadata
(
- node_id varchar2(255) not null,
- process_id varchar2(255) not null,
- process_version varchar2(255) not null,
- value varchar2(255),
- key varchar2(255) not null,
+ node_id varchar(255) not null,
+ process_id varchar(255) not null,
+ process_version varchar(255) not null,
+ value varchar(255),
+ key varchar(255) not null,
primary key (node_id, process_id, process_version, key)
);
diff --git
a/data-index/data-index-storage/data-index-storage-jpa/src/main/resources/kie-flyway/db/data-index/ansi/V1.45.0.2__data_index_definitions_add_colums.sql
b/data-index/data-index-storage/data-index-storage-jpa/src/main/resources/kie-flyway/db/data-index/ansi/V1.45.0.2__data_index_definitions_add_colums.sql
index 8abae1b55..30dad9ca8 100644
---
a/data-index/data-index-storage/data-index-storage-jpa/src/main/resources/kie-flyway/db/data-index/ansi/V1.45.0.2__data_index_definitions_add_colums.sql
+++
b/data-index/data-index-storage/data-index-storage-jpa/src/main/resources/kie-flyway/db/data-index/ansi/V1.45.0.2__data_index_definitions_add_colums.sql
@@ -19,18 +19,18 @@
create table definitions_annotations
(
- value varchar2(255) not null,
- process_id varchar2(255) not null,
- process_version varchar2(255) not null,
+ value varchar(255) not null,
+ process_id varchar(255) not null,
+ process_version varchar(255) not null,
primary key (value, process_id, process_version)
);
create table definitions_metadata
(
- process_id varchar2(255) not null,
- process_version varchar2(255) not null,
- value varchar2(255),
- key varchar2(255) not null,
+ process_id varchar(255) not null,
+ process_version varchar(255) not null,
+ value varchar(255),
+ key varchar(255) not null,
primary key (process_id, process_version, key)
);
diff --git
a/persistence-commons/persistence-commons-jpa/src/main/resources/kie-flyway/db/persistence-commons/ansi/V1.5.0__kogito_apps_create_kogito_data_cache.sql
b/data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/H2QuarkusTestProfile.java
similarity index 77%
copy from
persistence-commons/persistence-commons-jpa/src/main/resources/kie-flyway/db/persistence-commons/ansi/V1.5.0__kogito_apps_create_kogito_data_cache.sql
copy to
data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/H2QuarkusTestProfile.java
index 3b6a41389..b42ab3699 100644
---
a/persistence-commons/persistence-commons-jpa/src/main/resources/kie-flyway/db/persistence-commons/ansi/V1.5.0__kogito_apps_create_kogito_data_cache.sql
+++
b/data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/H2QuarkusTestProfile.java
@@ -17,9 +17,14 @@
* under the License.
*/
-create table if not exists kogito_data_cache (
- key varchar(255) not null,
- name varchar(255) not null,
- json_value varbinary(max),
- primary key (key, name)
-);
\ No newline at end of file
+package org.kie.kogito.index.jdbc;
+
+import io.quarkus.test.junit.QuarkusTestProfile;
+
+public class H2QuarkusTestProfile implements QuarkusTestProfile {
+
+ @Override
+ public String getConfigProfile() {
+ return "test-h2";
+ }
+}
diff --git
a/persistence-commons/persistence-commons-jpa/src/main/resources/kie-flyway/db/persistence-commons/ansi/V1.5.0__kogito_apps_create_kogito_data_cache.sql
b/data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/PostgreSQLQuarkusTestProfile.java
similarity index 75%
copy from
persistence-commons/persistence-commons-jpa/src/main/resources/kie-flyway/db/persistence-commons/ansi/V1.5.0__kogito_apps_create_kogito_data_cache.sql
copy to
data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/PostgreSQLQuarkusTestProfile.java
index 3b6a41389..4445c0f4f 100644
---
a/persistence-commons/persistence-commons-jpa/src/main/resources/kie-flyway/db/persistence-commons/ansi/V1.5.0__kogito_apps_create_kogito_data_cache.sql
+++
b/data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/PostgreSQLQuarkusTestProfile.java
@@ -17,9 +17,14 @@
* under the License.
*/
-create table if not exists kogito_data_cache (
- key varchar(255) not null,
- name varchar(255) not null,
- json_value varbinary(max),
- primary key (key, name)
-);
\ No newline at end of file
+package org.kie.kogito.index.jdbc;
+
+import io.quarkus.test.junit.QuarkusTestProfile;
+
+public class PostgreSQLQuarkusTestProfile implements QuarkusTestProfile {
+
+ @Override
+ public String getConfigProfile() {
+ return "test-postgresql";
+ }
+}
diff --git
a/data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/query/JobEntityQueryIT.java
b/data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/query/H2JobEntityQueryIT.java
similarity index 75%
copy from
data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/query/JobEntityQueryIT.java
copy to
data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/query/H2JobEntityQueryIT.java
index a99c7eeab..88aa60b86 100644
---
a/data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/query/JobEntityQueryIT.java
+++
b/data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/query/H2JobEntityQueryIT.java
@@ -18,14 +18,19 @@
*/
package org.kie.kogito.index.jdbc.query;
+import org.kie.kogito.index.jdbc.H2QuarkusTestProfile;
import org.kie.kogito.index.jpa.query.AbstractJobEntityQueryIT;
+import io.quarkus.test.TestTransaction;
import io.quarkus.test.common.QuarkusTestResource;
import io.quarkus.test.h2.H2DatabaseTestResource;
import io.quarkus.test.junit.QuarkusTest;
+import io.quarkus.test.junit.TestProfile;
@QuarkusTest
-@QuarkusTestResource(H2DatabaseTestResource.class)
-class JobEntityQueryIT extends AbstractJobEntityQueryIT {
+@TestTransaction
+@QuarkusTestResource(value = H2DatabaseTestResource.class,
restrictToAnnotatedClass = true)
+@TestProfile(H2QuarkusTestProfile.class)
+class H2JobEntityQueryIT extends AbstractJobEntityQueryIT {
}
diff --git
a/data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/query/ProcessDefinitionEntityQueryIT.java
b/data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/query/H2ProcessDefinitionEntityQueryIT.java
similarity index 74%
copy from
data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/query/ProcessDefinitionEntityQueryIT.java
copy to
data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/query/H2ProcessDefinitionEntityQueryIT.java
index c99803b83..704c46164 100644
---
a/data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/query/ProcessDefinitionEntityQueryIT.java
+++
b/data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/query/H2ProcessDefinitionEntityQueryIT.java
@@ -18,14 +18,19 @@
*/
package org.kie.kogito.index.jdbc.query;
+import org.kie.kogito.index.jdbc.H2QuarkusTestProfile;
import org.kie.kogito.index.jpa.query.AbstractProcessDefinitionEntityQueryIT;
+import io.quarkus.test.TestTransaction;
import io.quarkus.test.common.QuarkusTestResource;
import io.quarkus.test.h2.H2DatabaseTestResource;
import io.quarkus.test.junit.QuarkusTest;
+import io.quarkus.test.junit.TestProfile;
@QuarkusTest
-@QuarkusTestResource(H2DatabaseTestResource.class)
-class ProcessDefinitionEntityQueryIT extends
AbstractProcessDefinitionEntityQueryIT {
+@TestTransaction
+@QuarkusTestResource(value = H2DatabaseTestResource.class,
restrictToAnnotatedClass = true)
+@TestProfile(H2QuarkusTestProfile.class)
+class H2ProcessDefinitionEntityQueryIT extends
AbstractProcessDefinitionEntityQueryIT {
}
diff --git
a/data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/query/ProcessInstanceEntityQueryIT.java
b/data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/query/H2ProcessInstanceEntityQueryIT.java
similarity index 75%
copy from
data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/query/ProcessInstanceEntityQueryIT.java
copy to
data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/query/H2ProcessInstanceEntityQueryIT.java
index 10bd679b5..c68e22d9d 100644
---
a/data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/query/ProcessInstanceEntityQueryIT.java
+++
b/data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/query/H2ProcessInstanceEntityQueryIT.java
@@ -18,15 +18,20 @@
*/
package org.kie.kogito.index.jdbc.query;
+import org.kie.kogito.index.jdbc.H2QuarkusTestProfile;
import org.kie.kogito.index.jpa.query.AbstractProcessInstanceEntityQueryIT;
+import io.quarkus.test.TestTransaction;
import io.quarkus.test.common.QuarkusTestResource;
import io.quarkus.test.h2.H2DatabaseTestResource;
import io.quarkus.test.junit.QuarkusTest;
+import io.quarkus.test.junit.TestProfile;
@QuarkusTest
-@QuarkusTestResource(H2DatabaseTestResource.class)
-class ProcessInstanceEntityQueryIT extends
AbstractProcessInstanceEntityQueryIT {
+@TestTransaction
+@QuarkusTestResource(value = H2DatabaseTestResource.class,
restrictToAnnotatedClass = true)
+@TestProfile(H2QuarkusTestProfile.class)
+class H2ProcessInstanceEntityQueryIT extends
AbstractProcessInstanceEntityQueryIT {
@Override
protected Boolean isDateTimeAsLong() {
diff --git
a/data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/query/UserTaskInstanceEntityQueryIT.java
b/data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/query/H2UserTaskInstanceEntityQueryIT.java
similarity index 74%
copy from
data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/query/UserTaskInstanceEntityQueryIT.java
copy to
data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/query/H2UserTaskInstanceEntityQueryIT.java
index abaffc874..79e6ea184 100644
---
a/data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/query/UserTaskInstanceEntityQueryIT.java
+++
b/data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/query/H2UserTaskInstanceEntityQueryIT.java
@@ -18,14 +18,19 @@
*/
package org.kie.kogito.index.jdbc.query;
+import org.kie.kogito.index.jdbc.H2QuarkusTestProfile;
import org.kie.kogito.index.jpa.query.AbstractUserTaskInstanceEntityQueryIT;
+import io.quarkus.test.TestTransaction;
import io.quarkus.test.common.QuarkusTestResource;
import io.quarkus.test.h2.H2DatabaseTestResource;
import io.quarkus.test.junit.QuarkusTest;
+import io.quarkus.test.junit.TestProfile;
@QuarkusTest
-@QuarkusTestResource(H2DatabaseTestResource.class)
-class UserTaskInstanceEntityQueryIT extends
AbstractUserTaskInstanceEntityQueryIT {
+@TestTransaction
+@QuarkusTestResource(value = H2DatabaseTestResource.class,
restrictToAnnotatedClass = true)
+@TestProfile(H2QuarkusTestProfile.class)
+class H2UserTaskInstanceEntityQueryIT extends
AbstractUserTaskInstanceEntityQueryIT {
}
diff --git
a/data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/query/JobEntityQueryIT.java
b/data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/query/PostgreSQLJobEntityQueryIT.java
similarity index 69%
rename from
data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/query/JobEntityQueryIT.java
rename to
data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/query/PostgreSQLJobEntityQueryIT.java
index a99c7eeab..049b7596d 100644
---
a/data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/query/JobEntityQueryIT.java
+++
b/data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/query/PostgreSQLJobEntityQueryIT.java
@@ -18,14 +18,19 @@
*/
package org.kie.kogito.index.jdbc.query;
+import org.kie.kogito.index.jdbc.PostgreSQLQuarkusTestProfile;
import org.kie.kogito.index.jpa.query.AbstractJobEntityQueryIT;
+import org.kie.kogito.testcontainers.quarkus.PostgreSqlQuarkusTestResource;
+import io.quarkus.test.TestTransaction;
import io.quarkus.test.common.QuarkusTestResource;
-import io.quarkus.test.h2.H2DatabaseTestResource;
import io.quarkus.test.junit.QuarkusTest;
+import io.quarkus.test.junit.TestProfile;
@QuarkusTest
-@QuarkusTestResource(H2DatabaseTestResource.class)
-class JobEntityQueryIT extends AbstractJobEntityQueryIT {
+@TestTransaction
+@QuarkusTestResource(value = PostgreSqlQuarkusTestResource.class,
restrictToAnnotatedClass = true)
+@TestProfile(PostgreSQLQuarkusTestProfile.class)
+class PostgreSQLJobEntityQueryIT extends AbstractJobEntityQueryIT {
}
diff --git
a/data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/query/ProcessDefinitionEntityQueryIT.java
b/data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/query/PostgreSQLProcessDefinitionEntityQueryIT.java
similarity index 68%
rename from
data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/query/ProcessDefinitionEntityQueryIT.java
rename to
data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/query/PostgreSQLProcessDefinitionEntityQueryIT.java
index c99803b83..55d756025 100644
---
a/data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/query/ProcessDefinitionEntityQueryIT.java
+++
b/data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/query/PostgreSQLProcessDefinitionEntityQueryIT.java
@@ -18,14 +18,19 @@
*/
package org.kie.kogito.index.jdbc.query;
+import org.kie.kogito.index.jdbc.PostgreSQLQuarkusTestProfile;
import org.kie.kogito.index.jpa.query.AbstractProcessDefinitionEntityQueryIT;
+import org.kie.kogito.testcontainers.quarkus.PostgreSqlQuarkusTestResource;
+import io.quarkus.test.TestTransaction;
import io.quarkus.test.common.QuarkusTestResource;
-import io.quarkus.test.h2.H2DatabaseTestResource;
import io.quarkus.test.junit.QuarkusTest;
+import io.quarkus.test.junit.TestProfile;
@QuarkusTest
-@QuarkusTestResource(H2DatabaseTestResource.class)
-class ProcessDefinitionEntityQueryIT extends
AbstractProcessDefinitionEntityQueryIT {
+@TestTransaction
+@QuarkusTestResource(value = PostgreSqlQuarkusTestResource.class,
restrictToAnnotatedClass = true)
+@TestProfile(PostgreSQLQuarkusTestProfile.class)
+class PostgreSQLProcessDefinitionEntityQueryIT extends
AbstractProcessDefinitionEntityQueryIT {
}
diff --git
a/data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/query/ProcessInstanceEntityQueryIT.java
b/data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/query/PostgreSQLProcessInstanceEntityQueryIT.java
similarity index 70%
rename from
data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/query/ProcessInstanceEntityQueryIT.java
rename to
data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/query/PostgreSQLProcessInstanceEntityQueryIT.java
index 10bd679b5..13fddcf9c 100644
---
a/data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/query/ProcessInstanceEntityQueryIT.java
+++
b/data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/query/PostgreSQLProcessInstanceEntityQueryIT.java
@@ -18,15 +18,20 @@
*/
package org.kie.kogito.index.jdbc.query;
+import org.kie.kogito.index.jdbc.PostgreSQLQuarkusTestProfile;
import org.kie.kogito.index.jpa.query.AbstractProcessInstanceEntityQueryIT;
+import org.kie.kogito.testcontainers.quarkus.PostgreSqlQuarkusTestResource;
+import io.quarkus.test.TestTransaction;
import io.quarkus.test.common.QuarkusTestResource;
-import io.quarkus.test.h2.H2DatabaseTestResource;
import io.quarkus.test.junit.QuarkusTest;
+import io.quarkus.test.junit.TestProfile;
@QuarkusTest
-@QuarkusTestResource(H2DatabaseTestResource.class)
-class ProcessInstanceEntityQueryIT extends
AbstractProcessInstanceEntityQueryIT {
+@TestTransaction
+@QuarkusTestResource(value = PostgreSqlQuarkusTestResource.class,
restrictToAnnotatedClass = true)
+@TestProfile(PostgreSQLQuarkusTestProfile.class)
+class PostgreSQLProcessInstanceEntityQueryIT extends
AbstractProcessInstanceEntityQueryIT {
@Override
protected Boolean isDateTimeAsLong() {
diff --git
a/data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/query/UserTaskInstanceEntityQueryIT.java
b/data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/query/PostgreSQLUserTaskInstanceEntityQueryIT.java
similarity index 68%
rename from
data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/query/UserTaskInstanceEntityQueryIT.java
rename to
data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/query/PostgreSQLUserTaskInstanceEntityQueryIT.java
index abaffc874..1574f3833 100644
---
a/data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/query/UserTaskInstanceEntityQueryIT.java
+++
b/data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/query/PostgreSQLUserTaskInstanceEntityQueryIT.java
@@ -18,14 +18,19 @@
*/
package org.kie.kogito.index.jdbc.query;
+import org.kie.kogito.index.jdbc.PostgreSQLQuarkusTestProfile;
import org.kie.kogito.index.jpa.query.AbstractUserTaskInstanceEntityQueryIT;
+import org.kie.kogito.testcontainers.quarkus.PostgreSqlQuarkusTestResource;
+import io.quarkus.test.TestTransaction;
import io.quarkus.test.common.QuarkusTestResource;
-import io.quarkus.test.h2.H2DatabaseTestResource;
import io.quarkus.test.junit.QuarkusTest;
+import io.quarkus.test.junit.TestProfile;
@QuarkusTest
-@QuarkusTestResource(H2DatabaseTestResource.class)
-class UserTaskInstanceEntityQueryIT extends
AbstractUserTaskInstanceEntityQueryIT {
+@TestTransaction
+@QuarkusTestResource(value = PostgreSqlQuarkusTestResource.class,
restrictToAnnotatedClass = true)
+@TestProfile(PostgreSQLQuarkusTestProfile.class)
+class PostgreSQLUserTaskInstanceEntityQueryIT extends
AbstractUserTaskInstanceEntityQueryIT {
}
diff --git
a/data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/storage/JobStorageIT.java
b/data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/storage/H2JobStorageIT.java
similarity index 79%
copy from
data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/storage/JobStorageIT.java
copy to
data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/storage/H2JobStorageIT.java
index 88c5db0fb..3a6815e46 100644
---
a/data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/storage/JobStorageIT.java
+++
b/data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/storage/H2JobStorageIT.java
@@ -18,14 +18,16 @@
*/
package org.kie.kogito.index.jdbc.storage;
+import org.kie.kogito.index.jdbc.H2QuarkusTestProfile;
import org.kie.kogito.index.jpa.storage.AbstractJobStorageIT;
-import io.quarkus.test.common.QuarkusTestResource;
-import io.quarkus.test.h2.H2DatabaseTestResource;
+import io.quarkus.test.TestTransaction;
import io.quarkus.test.junit.QuarkusTest;
+import io.quarkus.test.junit.TestProfile;
@QuarkusTest
-@QuarkusTestResource(H2DatabaseTestResource.class)
-public class JobStorageIT extends AbstractJobStorageIT {
+@TestTransaction
+@TestProfile(H2QuarkusTestProfile.class)
+public class H2JobStorageIT extends AbstractJobStorageIT {
}
diff --git
a/data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/storage/ProcessDefinitionStorageIT.java
b/data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/storage/H2ProcessDefinitionStorageIT.java
similarity index 78%
copy from
data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/storage/ProcessDefinitionStorageIT.java
copy to
data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/storage/H2ProcessDefinitionStorageIT.java
index b0369d836..ab110245e 100644
---
a/data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/storage/ProcessDefinitionStorageIT.java
+++
b/data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/storage/H2ProcessDefinitionStorageIT.java
@@ -18,14 +18,16 @@
*/
package org.kie.kogito.index.jdbc.storage;
+import org.kie.kogito.index.jdbc.H2QuarkusTestProfile;
import org.kie.kogito.index.jpa.storage.AbstractProcessDefinitionStorageIT;
-import io.quarkus.test.common.QuarkusTestResource;
-import io.quarkus.test.h2.H2DatabaseTestResource;
+import io.quarkus.test.TestTransaction;
import io.quarkus.test.junit.QuarkusTest;
+import io.quarkus.test.junit.TestProfile;
@QuarkusTest
-@QuarkusTestResource(H2DatabaseTestResource.class)
-class ProcessDefinitionStorageIT extends AbstractProcessDefinitionStorageIT {
+@TestTransaction
+@TestProfile(H2QuarkusTestProfile.class)
+class H2ProcessDefinitionStorageIT extends AbstractProcessDefinitionStorageIT {
}
diff --git
a/data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/storage/ProcessInstanceStorageIT.java
b/data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/storage/H2ProcessInstanceStorageIT.java
similarity index 77%
rename from
data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/storage/ProcessInstanceStorageIT.java
rename to
data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/storage/H2ProcessInstanceStorageIT.java
index 9f40d5092..3b73dd3fb 100644
---
a/data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/storage/ProcessInstanceStorageIT.java
+++
b/data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/storage/H2ProcessInstanceStorageIT.java
@@ -18,13 +18,15 @@
*/
package org.kie.kogito.index.jdbc.storage;
+import org.kie.kogito.index.jdbc.H2QuarkusTestProfile;
import org.kie.kogito.index.jpa.storage.AbstractProcessInstanceStorageIT;
-import io.quarkus.test.common.QuarkusTestResource;
-import io.quarkus.test.h2.H2DatabaseTestResource;
+import io.quarkus.test.TestTransaction;
import io.quarkus.test.junit.QuarkusTest;
+import io.quarkus.test.junit.TestProfile;
@QuarkusTest
-@QuarkusTestResource(H2DatabaseTestResource.class)
-public class ProcessInstanceStorageIT extends AbstractProcessInstanceStorageIT
{
+@TestTransaction
+@TestProfile(H2QuarkusTestProfile.class)
+public class H2ProcessInstanceStorageIT extends
AbstractProcessInstanceStorageIT {
}
diff --git
a/data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/storage/UserTaskInstanceStorageIT.java
b/data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/storage/H2UserTaskInstanceStorageIT.java
similarity index 77%
copy from
data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/storage/UserTaskInstanceStorageIT.java
copy to
data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/storage/H2UserTaskInstanceStorageIT.java
index 4a6b9921e..b8b5105c6 100644
---
a/data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/storage/UserTaskInstanceStorageIT.java
+++
b/data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/storage/H2UserTaskInstanceStorageIT.java
@@ -18,13 +18,15 @@
*/
package org.kie.kogito.index.jdbc.storage;
+import org.kie.kogito.index.jdbc.H2QuarkusTestProfile;
import org.kie.kogito.index.jpa.storage.AbstractUserTaskInstanceStorageIT;
-import io.quarkus.test.common.QuarkusTestResource;
-import io.quarkus.test.h2.H2DatabaseTestResource;
+import io.quarkus.test.TestTransaction;
import io.quarkus.test.junit.QuarkusTest;
+import io.quarkus.test.junit.TestProfile;
@QuarkusTest
-@QuarkusTestResource(H2DatabaseTestResource.class)
-public class UserTaskInstanceStorageIT extends
AbstractUserTaskInstanceStorageIT {
+@TestTransaction
+@TestProfile(H2QuarkusTestProfile.class)
+public class H2UserTaskInstanceStorageIT extends
AbstractUserTaskInstanceStorageIT {
}
diff --git
a/data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/storage/JobStorageIT.java
b/data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/storage/PostgreSQLJobStorageIT.java
similarity index 69%
rename from
data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/storage/JobStorageIT.java
rename to
data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/storage/PostgreSQLJobStorageIT.java
index 88c5db0fb..df8d35248 100644
---
a/data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/storage/JobStorageIT.java
+++
b/data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/storage/PostgreSQLJobStorageIT.java
@@ -18,14 +18,19 @@
*/
package org.kie.kogito.index.jdbc.storage;
+import org.kie.kogito.index.jdbc.PostgreSQLQuarkusTestProfile;
import org.kie.kogito.index.jpa.storage.AbstractJobStorageIT;
+import org.kie.kogito.testcontainers.quarkus.PostgreSqlQuarkusTestResource;
+import io.quarkus.test.TestTransaction;
import io.quarkus.test.common.QuarkusTestResource;
-import io.quarkus.test.h2.H2DatabaseTestResource;
import io.quarkus.test.junit.QuarkusTest;
+import io.quarkus.test.junit.TestProfile;
@QuarkusTest
-@QuarkusTestResource(H2DatabaseTestResource.class)
-public class JobStorageIT extends AbstractJobStorageIT {
+@TestTransaction
+@QuarkusTestResource(value = PostgreSqlQuarkusTestResource.class,
restrictToAnnotatedClass = true)
+@TestProfile(PostgreSQLQuarkusTestProfile.class)
+public class PostgreSQLJobStorageIT extends AbstractJobStorageIT {
}
diff --git
a/data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/storage/ProcessDefinitionStorageIT.java
b/data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/storage/PostgreSQLProcessDefinitionStorageIT.java
similarity index 68%
rename from
data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/storage/ProcessDefinitionStorageIT.java
rename to
data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/storage/PostgreSQLProcessDefinitionStorageIT.java
index b0369d836..31c2f1109 100644
---
a/data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/storage/ProcessDefinitionStorageIT.java
+++
b/data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/storage/PostgreSQLProcessDefinitionStorageIT.java
@@ -18,14 +18,19 @@
*/
package org.kie.kogito.index.jdbc.storage;
+import org.kie.kogito.index.jdbc.PostgreSQLQuarkusTestProfile;
import org.kie.kogito.index.jpa.storage.AbstractProcessDefinitionStorageIT;
+import org.kie.kogito.testcontainers.quarkus.PostgreSqlQuarkusTestResource;
+import io.quarkus.test.TestTransaction;
import io.quarkus.test.common.QuarkusTestResource;
-import io.quarkus.test.h2.H2DatabaseTestResource;
import io.quarkus.test.junit.QuarkusTest;
+import io.quarkus.test.junit.TestProfile;
@QuarkusTest
-@QuarkusTestResource(H2DatabaseTestResource.class)
-class ProcessDefinitionStorageIT extends AbstractProcessDefinitionStorageIT {
+@TestTransaction
+@QuarkusTestResource(value = PostgreSqlQuarkusTestResource.class,
restrictToAnnotatedClass = true)
+@TestProfile(PostgreSQLQuarkusTestProfile.class)
+class PostgreSQLProcessDefinitionStorageIT extends
AbstractProcessDefinitionStorageIT {
}
diff --git
a/data-index/data-index-storage/data-index-storage-postgresql/src/test/java/org/kie/kogito/index/postgresql/storage/ProcessInstanceStorageIT.java
b/data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/storage/PostgreSQLProcessInstanceStorageIT.java
similarity index 70%
copy from
data-index/data-index-storage/data-index-storage-postgresql/src/test/java/org/kie/kogito/index/postgresql/storage/ProcessInstanceStorageIT.java
copy to
data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/storage/PostgreSQLProcessInstanceStorageIT.java
index 0ad8baf9b..19c7e6123 100644
---
a/data-index/data-index-storage/data-index-storage-postgresql/src/test/java/org/kie/kogito/index/postgresql/storage/ProcessInstanceStorageIT.java
+++
b/data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/storage/PostgreSQLProcessInstanceStorageIT.java
@@ -16,15 +16,20 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.kie.kogito.index.postgresql.storage;
+package org.kie.kogito.index.jdbc.storage;
+import org.kie.kogito.index.jdbc.PostgreSQLQuarkusTestProfile;
import org.kie.kogito.index.jpa.storage.AbstractProcessInstanceStorageIT;
import org.kie.kogito.testcontainers.quarkus.PostgreSqlQuarkusTestResource;
+import io.quarkus.test.TestTransaction;
import io.quarkus.test.common.QuarkusTestResource;
import io.quarkus.test.junit.QuarkusTest;
+import io.quarkus.test.junit.TestProfile;
@QuarkusTest
-@QuarkusTestResource(PostgreSqlQuarkusTestResource.class)
-public class ProcessInstanceStorageIT extends AbstractProcessInstanceStorageIT
{
+@TestTransaction
+@QuarkusTestResource(value = PostgreSqlQuarkusTestResource.class,
restrictToAnnotatedClass = true)
+@TestProfile(PostgreSQLQuarkusTestProfile.class)
+public class PostgreSQLProcessInstanceStorageIT extends
AbstractProcessInstanceStorageIT {
}
diff --git
a/data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/storage/UserTaskInstanceStorageIT.java
b/data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/storage/PostgreSQLUserTaskInstanceStorageIT.java
similarity index 68%
rename from
data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/storage/UserTaskInstanceStorageIT.java
rename to
data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/storage/PostgreSQLUserTaskInstanceStorageIT.java
index 4a6b9921e..f0284db9f 100644
---
a/data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/storage/UserTaskInstanceStorageIT.java
+++
b/data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/storage/PostgreSQLUserTaskInstanceStorageIT.java
@@ -18,13 +18,18 @@
*/
package org.kie.kogito.index.jdbc.storage;
+import org.kie.kogito.index.jdbc.PostgreSQLQuarkusTestProfile;
import org.kie.kogito.index.jpa.storage.AbstractUserTaskInstanceStorageIT;
+import org.kie.kogito.testcontainers.quarkus.PostgreSqlQuarkusTestResource;
+import io.quarkus.test.TestTransaction;
import io.quarkus.test.common.QuarkusTestResource;
-import io.quarkus.test.h2.H2DatabaseTestResource;
import io.quarkus.test.junit.QuarkusTest;
+import io.quarkus.test.junit.TestProfile;
@QuarkusTest
-@QuarkusTestResource(H2DatabaseTestResource.class)
-public class UserTaskInstanceStorageIT extends
AbstractUserTaskInstanceStorageIT {
+@TestTransaction
+@QuarkusTestResource(value = PostgreSqlQuarkusTestResource.class,
restrictToAnnotatedClass = true)
+@TestProfile(PostgreSQLQuarkusTestProfile.class)
+public class PostgreSQLUserTaskInstanceStorageIT extends
AbstractUserTaskInstanceStorageIT {
}
diff --git
a/data-index/data-index-storage/data-index-storage-jpa/src/test/resources/application.properties
b/data-index/data-index-storage/data-index-storage-jpa/src/test/resources/application.properties
index a5b6fe745..eb83483fe 100644
---
a/data-index/data-index-storage/data-index-storage-jpa/src/test/resources/application.properties
+++
b/data-index/data-index-storage/data-index-storage-jpa/src/test/resources/application.properties
@@ -21,13 +21,19 @@
kogito.apps.persistence.type=jdbc
kie.flyway.enabled=true
-# Data source
-quarkus.datasource.db-kind=h2
-quarkus.datasource.jdbc.url=jdbc:h2:tcp://localhost/mem:test;NON_KEYWORDS=VALUE,KEY
+# Data sources
+%test-postgresql.quarkus.datasource.db-kind=postgresql
+%test-postgresql.quarkus.datasource.devservices.enabled=false
+%test-h2.quarkus.datasource.db-kind=h2
+%test-h2.quarkus.datasource.username=kogito
+%test-h2.quarkus.datasource.jdbc.url=jdbc:h2:mem:default;NON_KEYWORDS=VALUE,KEY
+
# Hibernate
quarkus.hibernate-orm.physical-naming-strategy=org.hibernate.boot.model.naming.CamelCaseToUnderscoresNamingStrategy
quarkus.hibernate-orm.jdbc.timezone=UTC
-quarkus.hibernate-orm.log.sql=true
+# Enforcing flush to ensure data is correctly stored in DB
+quarkus.hibernate-orm.flush.mode=always
+
# Disabling Security for tests
quarkus.oidc.enabled=false
diff --git
a/data-index/data-index-storage/data-index-storage-postgresql/src/test/java/org/kie/kogito/index/postgresql/storage/ProcessInstanceStorageIT.java
b/data-index/data-index-storage/data-index-storage-postgresql/src/test/java/org/kie/kogito/index/postgresql/storage/ProcessInstanceStorageIT.java
index 0ad8baf9b..0ac176627 100644
---
a/data-index/data-index-storage/data-index-storage-postgresql/src/test/java/org/kie/kogito/index/postgresql/storage/ProcessInstanceStorageIT.java
+++
b/data-index/data-index-storage/data-index-storage-postgresql/src/test/java/org/kie/kogito/index/postgresql/storage/ProcessInstanceStorageIT.java
@@ -21,10 +21,12 @@ package org.kie.kogito.index.postgresql.storage;
import org.kie.kogito.index.jpa.storage.AbstractProcessInstanceStorageIT;
import org.kie.kogito.testcontainers.quarkus.PostgreSqlQuarkusTestResource;
+import io.quarkus.test.TestTransaction;
import io.quarkus.test.common.QuarkusTestResource;
import io.quarkus.test.junit.QuarkusTest;
@QuarkusTest
+@TestTransaction
@QuarkusTestResource(PostgreSqlQuarkusTestResource.class)
public class ProcessInstanceStorageIT extends AbstractProcessInstanceStorageIT
{
}
diff --git
a/data-index/data-index-storage/data-index-storage-postgresql/src/test/resources/application.properties
b/data-index/data-index-storage/data-index-storage-postgresql/src/test/resources/application.properties
index b5637dfd6..a91fc1a37 100644
---
a/data-index/data-index-storage/data-index-storage-postgresql/src/test/resources/application.properties
+++
b/data-index/data-index-storage/data-index-storage-postgresql/src/test/resources/application.properties
@@ -25,8 +25,7 @@ quarkus.datasource.username=kogito
quarkus.datasource.password=kogito
quarkus.datasource.jdbc.url=jdbc:postgresql://localhost:5432/kogito
# Hibernate
-quarkus.hibernate-orm.database.generation=drop-and-create
-quarkus.hibernate-orm.database.generation.halt-on-error=true
+
quarkus.hibernate-orm.physical-naming-strategy=org.hibernate.boot.model.naming.CamelCaseToUnderscoresNamingStrategy
quarkus.hibernate-orm.jdbc.timezone=UTC
quarkus.hibernate-orm.log.sql=true
diff --git
a/jobs-service/jobs-service-storage-jpa/src/main/java/org/kie/kogito/jobs/service/repository/jpa/converter/JsonBinaryConverter.java
b/jobs-service/jobs-service-storage-jpa/src/main/java/org/kie/kogito/jobs/service/repository/jpa/converter/JsonBinaryConverter.java
index b269ab9ea..924fae07f 100644
---
a/jobs-service/jobs-service-storage-jpa/src/main/java/org/kie/kogito/jobs/service/repository/jpa/converter/JsonBinaryConverter.java
+++
b/jobs-service/jobs-service-storage-jpa/src/main/java/org/kie/kogito/jobs/service/repository/jpa/converter/JsonBinaryConverter.java
@@ -27,19 +27,19 @@ import com.fasterxml.jackson.databind.node.ObjectNode;
import jakarta.persistence.AttributeConverter;
-public class JsonBinaryConverter implements AttributeConverter<ObjectNode,
byte[]> {
+public class JsonBinaryConverter implements AttributeConverter<ObjectNode,
String> {
@Override
- public byte[] convertToDatabaseColumn(ObjectNode attribute) {
+ public String convertToDatabaseColumn(ObjectNode attribute) {
try {
- return attribute == null ? null :
ObjectMapperFactory.get().writeValueAsBytes(attribute);
+ return attribute == null ? null :
ObjectMapperFactory.get().writeValueAsString(attribute);
} catch (IOException e) {
throw new UncheckedIOException(e);
}
}
@Override
- public ObjectNode convertToEntityAttribute(byte[] dbData) {
+ public ObjectNode convertToEntityAttribute(String dbData) {
try {
return dbData == null ? null :
ObjectMapperFactory.get().readValue(dbData, ObjectNode.class);
} catch (IOException e) {
diff --git
a/persistence-commons/persistence-commons-postgresql/src/main/resources/application.properties
b/jobs-service/jobs-service-storage-jpa/src/main/resources/application.properties
similarity index 100%
copy from
persistence-commons/persistence-commons-postgresql/src/main/resources/application.properties
copy to
jobs-service/jobs-service-storage-jpa/src/main/resources/application.properties
diff --git
a/jobs-service/jobs-service-storage-jpa/src/main/resources/kie-flyway/db/jobs-service/ansi/V2.0.0__Create_Tables.sql
b/jobs-service/jobs-service-storage-jpa/src/main/resources/kie-flyway/db/jobs-service/ansi/V2.0.0__Create_Tables.sql
index b48a32a95..eaf988097 100644
---
a/jobs-service/jobs-service-storage-jpa/src/main/resources/kie-flyway/db/jobs-service/ansi/V2.0.0__Create_Tables.sql
+++
b/jobs-service/jobs-service-storage-jpa/src/main/resources/kie-flyway/db/jobs-service/ansi/V2.0.0__Create_Tables.sql
@@ -27,8 +27,8 @@ create table job_details
execution_counter integer,
scheduled_id varchar(40),
priority integer,
- recipient varbinary(max),
- trigger varbinary(max),
+ recipient varchar(max),
+ trigger varchar(max),
fire_time timestamp,
execution_timeout bigint,
execution_timeout_unit varchar(40),
diff --git
a/persistence-commons/persistence-commons-postgresql/src/main/resources/application.properties
b/persistence-commons/persistence-commons-jpa-base/src/main/resources/application.properties
similarity index 100%
rename from
persistence-commons/persistence-commons-postgresql/src/main/resources/application.properties
rename to
persistence-commons/persistence-commons-jpa-base/src/main/resources/application.properties
diff --git
a/persistence-commons/persistence-commons-jpa/src/main/resources/kie-flyway/db/persistence-commons/ansi/V1.5.0__kogito_apps_create_kogito_data_cache.sql
b/persistence-commons/persistence-commons-jpa/src/main/resources/kie-flyway/db/persistence-commons/ansi/V1.5.0__kogito_apps_create_kogito_data_cache.sql
index 3b6a41389..bf660066a 100644
---
a/persistence-commons/persistence-commons-jpa/src/main/resources/kie-flyway/db/persistence-commons/ansi/V1.5.0__kogito_apps_create_kogito_data_cache.sql
+++
b/persistence-commons/persistence-commons-jpa/src/main/resources/kie-flyway/db/persistence-commons/ansi/V1.5.0__kogito_apps_create_kogito_data_cache.sql
@@ -20,6 +20,6 @@
create table if not exists kogito_data_cache (
key varchar(255) not null,
name varchar(255) not null,
- json_value varbinary(max),
+ json_value varchar(max),
primary key (key, name)
);
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]