diff --git a/apps-integration-tests/integration-tests-data-index-service/integration-tests-data-index-service-common/src/test/java/org/kie/kogito/index/AbstractProcessDataIndexIT.java b/apps-integration-tests/integration-tests-data-index-service/integration-tests-data-index-service-common/src/test/java/org/kie/kogito/index/AbstractProcessDataIndexIT.java index a5c910067a..64bfe4f2cb 100644 --- a/apps-integration-tests/integration-tests-data-index-service/integration-tests-data-index-service-common/src/test/java/org/kie/kogito/index/AbstractProcessDataIndexIT.java +++ b/apps-integration-tests/integration-tests-data-index-service/integration-tests-data-index-service-common/src/test/java/org/kie/kogito/index/AbstractProcessDataIndexIT.java @@ -308,10 +308,10 @@ public void testProcessGatewayAPI() throws IOException { .statusCode(200) .body("data.ProcessInstances[0].nodeDefinitions", notNullValue()) .body("data.ProcessInstances[0].nodeDefinitions.size()", is(4)) - .body("data.ProcessInstances[0].nodeDefinitions[0].id", is("1")) + .body("data.ProcessInstances[0].nodeDefinitions[0].id", is("_8B62D3CA-5D03-4B2B-832B-126469288BB4")) .body("data.ProcessInstances[0].nodeDefinitions[0].name", is("First Line Approval")) .body("data.ProcessInstances[0].nodeDefinitions[0].type", is("HumanTaskNode")) - .body("data.ProcessInstances[0].nodeDefinitions[0].uniqueId", is("1")) + .body("data.ProcessInstances[0].nodeDefinitions[0].uniqueId", is("_8B62D3CA-5D03-4B2B-832B-126469288BB4")) .body("data.ProcessInstances[0].nodeDefinitions[0].metadata.UniqueId", is("_8B62D3CA-5D03-4B2B-832B-126469288BB4")) .body("data.ProcessInstances[0].nodes.size()", is(2)) .body("data.ProcessInstances[0].nodes.name", hasItem("First Line Approval")) diff --git a/data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-common/src/main/java/org/kie/kogito/app/audit/jpa/JPADataAuditStore.java b/data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-common/src/main/java/org/kie/kogito/app/audit/jpa/JPADataAuditStore.java index 0793672cf4..a8a4f89b0b 100644 --- a/data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-common/src/main/java/org/kie/kogito/app/audit/jpa/JPADataAuditStore.java +++ b/data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-common/src/main/java/org/kie/kogito/app/audit/jpa/JPADataAuditStore.java @@ -56,6 +56,7 @@ import org.kie.kogito.event.process.ProcessInstanceNodeEventBody; import org.kie.kogito.event.process.ProcessInstanceSLADataEvent; 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.usertask.UserTaskInstanceAssignmentDataEvent; import org.kie.kogito.event.usertask.UserTaskInstanceAttachmentDataEvent; @@ -64,7 +65,6 @@ import org.kie.kogito.event.usertask.UserTaskInstanceDeadlineDataEvent; import org.kie.kogito.event.usertask.UserTaskInstanceStateDataEvent; import org.kie.kogito.event.usertask.UserTaskInstanceVariableDataEvent; -import org.kie.kogito.internal.process.runtime.KogitoProcessInstance; import org.kie.kogito.jobs.service.model.ScheduledJob; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -95,29 +95,17 @@ public void storeProcessInstanceDataEvent(DataAuditContext context, ProcessInsta log.setRoles(event.getData().getRoles()); EntityManager entityManager = context.getContext(); - switch (event.getData().getState()) { - case KogitoProcessInstance.STATE_ACTIVE: + switch (event.getData().getEventType()) { + case ProcessInstanceStateEventBody.EVENT_TYPE_STARTED: log.setEventType(ProcessStateLogType.ACTIVE); entityManager.persist(log); break; - case KogitoProcessInstance.STATE_ABORTED: - log.setEventType(ProcessStateLogType.ABORTED); - entityManager.persist(log); - break; - case KogitoProcessInstance.STATE_COMPLETED: + case ProcessInstanceStateEventBody.EVENT_TYPE_ENDED: log.setEventType(ProcessStateLogType.COMPLETED); entityManager.persist(log); break; - case KogitoProcessInstance.STATE_PENDING: - log.setEventType(ProcessStateLogType.PENDING); - entityManager.persist(log); - break; - case KogitoProcessInstance.STATE_SUSPENDED: - log.setEventType(ProcessStateLogType.SUSPENDING); - entityManager.persist(log); - break; - case KogitoProcessInstance.STATE_ERROR: - log.setEventType(ProcessStateLogType.ERROR); + case ProcessInstanceStateEventBody.EVENT_TYPE_MIGRATED: + log.setEventType(ProcessStateLogType.MIGRATED); entityManager.persist(log); break; } diff --git a/data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-common/src/main/java/org/kie/kogito/app/audit/jpa/model/ProcessInstanceStateLog.java b/data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-common/src/main/java/org/kie/kogito/app/audit/jpa/model/ProcessInstanceStateLog.java index 88bb581399..abb8608064 100644 --- a/data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-common/src/main/java/org/kie/kogito/app/audit/jpa/model/ProcessInstanceStateLog.java +++ b/data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-common/src/main/java/org/kie/kogito/app/audit/jpa/model/ProcessInstanceStateLog.java @@ -52,13 +52,9 @@ public class ProcessInstanceStateLog extends AbstractProcessInstanceLog { public enum ProcessStateLogType { ACTIVE, - STARTED, COMPLETED, - ABORTED, + MIGRATED, SLA_VIOLATION, - PENDING, - SUSPENDING, - ERROR } @Id diff --git a/data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-common/src/main/resources/db/data-audit/h2/V1.2.0__Add migration event type.sql b/data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-common/src/main/resources/db/data-audit/h2/V1.2.0__Add migration event type.sql new file mode 100644 index 0000000000..17b5a8cdeb --- /dev/null +++ b/data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-common/src/main/resources/db/data-audit/h2/V1.2.0__Add migration event type.sql @@ -0,0 +1,2 @@ +ALTER TABLE Process_Instance_State_Log DROP CONSTRAINT Process_Instance_State_Log_event_type_check; +ALTER TABLE Process_Instance_State_Log ADD CONSTRAINT Process_Instance_State_Log_event_type_check CHECK (event_type IN ( 'ACTIVE','COMPLETED','SLA_VIOLATION', 'MIGRATED' )); \ No newline at end of file diff --git a/data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-common/src/main/resources/db/data-audit/postgresql/V1.2.0__Add migration event type.sql b/data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-common/src/main/resources/db/data-audit/postgresql/V1.2.0__Add migration event type.sql new file mode 100644 index 0000000000..17b5a8cdeb --- /dev/null +++ b/data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-common/src/main/resources/db/data-audit/postgresql/V1.2.0__Add migration event type.sql @@ -0,0 +1,2 @@ +ALTER TABLE Process_Instance_State_Log DROP CONSTRAINT Process_Instance_State_Log_event_type_check; +ALTER TABLE Process_Instance_State_Log ADD CONSTRAINT Process_Instance_State_Log_event_type_check CHECK (event_type IN ( 'ACTIVE','COMPLETED','SLA_VIOLATION', 'MIGRATED' )); \ No newline at end of file diff --git a/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-common/runtime/src/main/java/org/kie/kogito/index/addon/api/KogitoAddonRuntimeClientImpl.java b/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-common/runtime/src/main/java/org/kie/kogito/index/addon/api/KogitoAddonRuntimeClientImpl.java index 39cd248378..697dcfd1e0 100644 --- a/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-common/runtime/src/main/java/org/kie/kogito/index/addon/api/KogitoAddonRuntimeClientImpl.java +++ b/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-common/runtime/src/main/java/org/kie/kogito/index/addon/api/KogitoAddonRuntimeClientImpl.java @@ -157,7 +157,7 @@ public CompletableFuture> getProcessDefinitionNodes(String serviceURL List nodes = ((KogitoWorkflowProcess) ((AbstractProcess) process).get()).getNodesRecursively(); List list = nodes.stream().map(n -> { Node data = new Node(); - data.setId(String.valueOf(n.getId())); + data.setId(n.getId().toExternalFormat()); data.setUniqueId(((org.jbpm.workflow.core.Node) n).getUniqueId()); data.setMetadata(n.getMetaData() == null ? null : mapMetadata(n)); data.setType(n.getClass().getSimpleName()); diff --git a/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-infinispan/integration-tests-process/src/test/java/org/kie/kogito/addons/quarkus/data/index/it/InfinispanQuarkusAddonDataIndexPersistenceIT.java b/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-infinispan/integration-tests-process/src/test/java/org/kie/kogito/addons/quarkus/data/index/it/InfinispanQuarkusAddonDataIndexPersistenceIT.java index e085a08b21..551bb02edf 100644 --- a/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-infinispan/integration-tests-process/src/test/java/org/kie/kogito/addons/quarkus/data/index/it/InfinispanQuarkusAddonDataIndexPersistenceIT.java +++ b/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-infinispan/integration-tests-process/src/test/java/org/kie/kogito/addons/quarkus/data/index/it/InfinispanQuarkusAddonDataIndexPersistenceIT.java @@ -63,10 +63,10 @@ void testDataIndexAddon() { .body("data.ProcessDefinitions[0].addons", hasItem("infinispan-persistence")) .body("data.ProcessDefinitions[0].source", is(not(emptyOrNullString()))) .body("data.ProcessDefinitions[0].nodes.size()", is(2)) - .body("data.ProcessDefinitions[0].nodes[0].id", is("1")) + .body("data.ProcessDefinitions[0].nodes[0].id", is("_B3241ACF-97BE-443B-A49F-964AB3DD006C")) .body("data.ProcessDefinitions[0].nodes[0].name", is("End")) .body("data.ProcessDefinitions[0].nodes[0].type", is("EndNode")) - .body("data.ProcessDefinitions[0].nodes[0].uniqueId", is("1")) + .body("data.ProcessDefinitions[0].nodes[0].uniqueId", is("_B3241ACF-97BE-443B-A49F-964AB3DD006C")) .body("data.ProcessDefinitions[0].nodes[0].metadata.UniqueId", is("_B3241ACF-97BE-443B-A49F-964AB3DD006C")); given().contentType(ContentType.JSON) diff --git a/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-infinispan/integration-tests-sw/src/test/java/org/kie/kogito/addons/quarkus/data/index/it/InfinispanQuarkusAddonDataIndexPersistenceIT.java b/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-infinispan/integration-tests-sw/src/test/java/org/kie/kogito/addons/quarkus/data/index/it/InfinispanQuarkusAddonDataIndexPersistenceIT.java index 7d18859b37..6fe5043bb8 100644 --- a/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-infinispan/integration-tests-sw/src/test/java/org/kie/kogito/addons/quarkus/data/index/it/InfinispanQuarkusAddonDataIndexPersistenceIT.java +++ b/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-infinispan/integration-tests-sw/src/test/java/org/kie/kogito/addons/quarkus/data/index/it/InfinispanQuarkusAddonDataIndexPersistenceIT.java @@ -68,7 +68,7 @@ void testDataIndexAddon() { .body("data.ProcessDefinitions[0].nodes[0].name", is("Start")) .body("data.ProcessDefinitions[0].nodes[0].type", is("StartNode")) .body("data.ProcessDefinitions[0].nodes[0].uniqueId", is("1")) - .body("data.ProcessDefinitions[0].nodes[0].metadata.UniqueId", is("_jbpm-unique-0")) + .body("data.ProcessDefinitions[0].nodes[0].metadata.UniqueId", is("1")) .extract().path("data.ProcessDefinitions[0].source"); assertThat(JsonPath.from(source).getString("id")).isEqualTo("greet"); diff --git a/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-mongodb/integration-tests-process/src/test/java/org/kie/kogito/addons/quarkus/data/index/it/MongoQuarkusAddonDataIndexPersistenceIT.java b/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-mongodb/integration-tests-process/src/test/java/org/kie/kogito/addons/quarkus/data/index/it/MongoQuarkusAddonDataIndexPersistenceIT.java index cd1e5bad7b..8307d5b6f4 100644 --- a/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-mongodb/integration-tests-process/src/test/java/org/kie/kogito/addons/quarkus/data/index/it/MongoQuarkusAddonDataIndexPersistenceIT.java +++ b/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-mongodb/integration-tests-process/src/test/java/org/kie/kogito/addons/quarkus/data/index/it/MongoQuarkusAddonDataIndexPersistenceIT.java @@ -63,10 +63,10 @@ void testDataIndexAddon() { .body("data.ProcessDefinitions[0].addons", hasItem("mongodb-persistence")) .body("data.ProcessDefinitions[0].source", is(not(emptyOrNullString()))) .body("data.ProcessDefinitions[0].nodes.size()", is(2)) - .body("data.ProcessDefinitions[0].nodes[0].id", is("1")) + .body("data.ProcessDefinitions[0].nodes[0].id", is("_B3241ACF-97BE-443B-A49F-964AB3DD006C")) .body("data.ProcessDefinitions[0].nodes[0].name", is("End")) .body("data.ProcessDefinitions[0].nodes[0].type", is("EndNode")) - .body("data.ProcessDefinitions[0].nodes[0].uniqueId", is("1")) + .body("data.ProcessDefinitions[0].nodes[0].uniqueId", is("_B3241ACF-97BE-443B-A49F-964AB3DD006C")) .body("data.ProcessDefinitions[0].nodes[0].metadata.UniqueId", is("_B3241ACF-97BE-443B-A49F-964AB3DD006C")); given().contentType(ContentType.JSON) diff --git a/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-mongodb/integration-tests-sw/src/test/java/org/kie/kogito/addons/quarkus/data/index/it/MongoQuarkusAddonDataIndexPersistenceIT.java b/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-mongodb/integration-tests-sw/src/test/java/org/kie/kogito/addons/quarkus/data/index/it/MongoQuarkusAddonDataIndexPersistenceIT.java index 12c95e8117..4de29fe8c7 100644 --- a/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-mongodb/integration-tests-sw/src/test/java/org/kie/kogito/addons/quarkus/data/index/it/MongoQuarkusAddonDataIndexPersistenceIT.java +++ b/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-mongodb/integration-tests-sw/src/test/java/org/kie/kogito/addons/quarkus/data/index/it/MongoQuarkusAddonDataIndexPersistenceIT.java @@ -68,7 +68,7 @@ void testDataIndexAddon() { .body("data.ProcessDefinitions[0].nodes[0].name", is("Start")) .body("data.ProcessDefinitions[0].nodes[0].type", is("StartNode")) .body("data.ProcessDefinitions[0].nodes[0].uniqueId", is("1")) - .body("data.ProcessDefinitions[0].nodes[0].metadata.UniqueId", is("_jbpm-unique-0")) + .body("data.ProcessDefinitions[0].nodes[0].metadata.UniqueId", is("1")) .extract().path("data.ProcessDefinitions[0].source"); assertThat(JsonPath.from(source).getString("id")).isEqualTo("greet"); diff --git a/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-postgresql/integration-tests-process/src/test/java/org/kie/kogito/addons/quarkus/data/index/it/PostgreSQLQuarkusAddonDataIndexPersistenceIT.java b/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-postgresql/integration-tests-process/src/test/java/org/kie/kogito/addons/quarkus/data/index/it/PostgreSQLQuarkusAddonDataIndexPersistenceIT.java index f45b83f670..9264581958 100644 --- a/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-postgresql/integration-tests-process/src/test/java/org/kie/kogito/addons/quarkus/data/index/it/PostgreSQLQuarkusAddonDataIndexPersistenceIT.java +++ b/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-postgresql/integration-tests-process/src/test/java/org/kie/kogito/addons/quarkus/data/index/it/PostgreSQLQuarkusAddonDataIndexPersistenceIT.java @@ -67,10 +67,10 @@ void testDataIndexAddon() { .body("data.ProcessDefinitions[0].addons", hasItem("jdbc-persistence")) .body("data.ProcessDefinitions[0].source", is(not(emptyOrNullString()))) .body("data.ProcessDefinitions[0].nodes.size()", is(2)) - .body("data.ProcessDefinitions[0].nodes[0].id", is("1")) + .body("data.ProcessDefinitions[0].nodes[0].id", is("_B3241ACF-97BE-443B-A49F-964AB3DD006C")) .body("data.ProcessDefinitions[0].nodes[0].name", is("End")) .body("data.ProcessDefinitions[0].nodes[0].type", is("EndNode")) - .body("data.ProcessDefinitions[0].nodes[0].uniqueId", is("1")) + .body("data.ProcessDefinitions[0].nodes[0].uniqueId", is("_B3241ACF-97BE-443B-A49F-964AB3DD006C")) .body("data.ProcessDefinitions[0].nodes[0].metadata.UniqueId", is("_B3241ACF-97BE-443B-A49F-964AB3DD006C")); given().contentType(ContentType.JSON) diff --git a/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-postgresql/integration-tests-sw/src/test/java/org/kie/kogito/addons/quarkus/data/index/it/PostgreSQLQuarkusAddonDataIndexPersistenceIT.java b/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-postgresql/integration-tests-sw/src/test/java/org/kie/kogito/addons/quarkus/data/index/it/PostgreSQLQuarkusAddonDataIndexPersistenceIT.java index c0857d9510..4d80904935 100644 --- a/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-postgresql/integration-tests-sw/src/test/java/org/kie/kogito/addons/quarkus/data/index/it/PostgreSQLQuarkusAddonDataIndexPersistenceIT.java +++ b/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-postgresql/integration-tests-sw/src/test/java/org/kie/kogito/addons/quarkus/data/index/it/PostgreSQLQuarkusAddonDataIndexPersistenceIT.java @@ -74,7 +74,7 @@ void testDataIndexAddon() { .body("data.ProcessDefinitions[0].nodes[0].name", is("Start")) .body("data.ProcessDefinitions[0].nodes[0].type", is("StartNode")) .body("data.ProcessDefinitions[0].nodes[0].uniqueId", is("1")) - .body("data.ProcessDefinitions[0].nodes[0].metadata.UniqueId", is("_jbpm-unique-0")) + .body("data.ProcessDefinitions[0].nodes[0].metadata.UniqueId", is("1")) .extract().path("data.ProcessDefinitions[0].source"); assertThat(JsonPath.from(source).getString("id")).isEqualTo("greet"); diff --git a/jitexecutor/jitexecutor-dmn/src/test/java/org/kie/kogito/jitexecutor/dmn/DMN15Test.java b/jitexecutor/jitexecutor-dmn/src/test/java/org/kie/kogito/jitexecutor/dmn/DMN15Test.java index 4e2ddf2fa6..a581ae7436 100644 --- a/jitexecutor/jitexecutor-dmn/src/test/java/org/kie/kogito/jitexecutor/dmn/DMN15Test.java +++ b/jitexecutor/jitexecutor-dmn/src/test/java/org/kie/kogito/jitexecutor/dmn/DMN15Test.java @@ -61,13 +61,23 @@ public static void setup() { } @Test - void unnamedImport() throws IOException { - String URI1 = "valid_models/DMNv1_5/Importing_EmptyNamed_Model.dmn"; - String URI2 = "valid_models/DMNv1_5/Imported_Model_Unamed.dmn"; - ResourceWithURI model1 = new ResourceWithURI(URI1, getModelFromIoUtils(URI1)); - ResourceWithURI model2 = new ResourceWithURI(URI2, getModelFromIoUtils(URI2)); + void unnamedImportWithHrefNamespace() throws IOException { + commonUnnamedImport("valid_models/DMNv1_5/Importing_EmptyNamed_Model_With_Href_Namespace.dmn", + "valid_models/DMNv1_5/Imported_Model_Unamed.dmn"); + } + + @Test + void unnamedImportWithoutHrefNamespace() throws IOException { + commonUnnamedImport("valid_models/DMNv1_5/Importing_EmptyNamed_Model_Without_Href_Namespace.dmn", + "valid_models/DMNv1_5/Imported_Model_Unamed.dmn"); + } + + private void commonUnnamedImport(String importingModelRef, String importedModelRef) throws IOException { + ResourceWithURI model1 = new ResourceWithURI(importingModelRef, getModelFromIoUtils(importingModelRef)); + ResourceWithURI model2 = new ResourceWithURI(importedModelRef, getModelFromIoUtils(importedModelRef)); - JITDMNPayload jitdmnpayload = new JITDMNPayload(URI1, List.of(model1, model2), Collections.EMPTY_MAP); + JITDMNPayload jitdmnpayload = new JITDMNPayload(importingModelRef, List.of(model1, model2), + Collections.EMPTY_MAP); given() .contentType(ContentType.JSON) .body(jitdmnpayload) @@ -79,7 +89,7 @@ void unnamedImport() throws IOException { String response = given() .contentType(ContentType.JSON) - .body(new MultipleResourcesPayload(URI1, List.of(model1, model2))) + .body(new MultipleResourcesPayload(importingModelRef, List.of(model1, model2))) .when() .post("/jitdmn/validate") .then() @@ -92,7 +102,7 @@ void unnamedImport() throws IOException { Map context = Map.of("A Person", Map.of("name", "John", "age", 47)); - jitdmnpayload = new JITDMNPayload(URI1, List.of(model1, model2), context); + jitdmnpayload = new JITDMNPayload(importingModelRef, List.of(model1, model2), context); given() .contentType(ContentType.JSON) .body(jitdmnpayload) diff --git a/jobs-service/kogito-addons-jobs-service/kogito-addons-quarkus-jobs/src/main/java/org/kie/kogito/jobs/embedded/EmbeddedJobExecutor.java b/jobs-service/kogito-addons-jobs-service/kogito-addons-quarkus-jobs/src/main/java/org/kie/kogito/jobs/embedded/EmbeddedJobExecutor.java index bbc84c1135..347eedcb69 100644 --- a/jobs-service/kogito-addons-jobs-service/kogito-addons-quarkus-jobs/src/main/java/org/kie/kogito/jobs/embedded/EmbeddedJobExecutor.java +++ b/jobs-service/kogito-addons-jobs-service/kogito-addons-quarkus-jobs/src/main/java/org/kie/kogito/jobs/embedded/EmbeddedJobExecutor.java @@ -18,6 +18,8 @@ */ package org.kie.kogito.jobs.embedded; +import java.util.Optional; + import org.kie.kogito.Application; import org.kie.kogito.Model; import org.kie.kogito.jobs.service.api.Recipient; @@ -53,12 +55,21 @@ public Uni execute(JobDetails jobDetails) { RecipientInstance recipientModel = (RecipientInstance) jobDetails.getRecipient(); InVMRecipient recipient = (InVMRecipient) recipientModel.getRecipient(); String timerId = recipient.getPayload().getData().timerId(); - String processId = recipient.getPayload().getData().processId(); - Process process = processes.processById(processId); String processInstanceId = recipient.getPayload().getData().processInstanceId(); + Optional> process = processes.processByProcessInstanceId(processInstanceId); + if (process.isEmpty()) { + return Uni.createFrom().item( + JobExecutionResponse.builder() + .code("401") + .jobId(jobDetails.getId()) + .now() + .message("job does not belong to this container") + .build()); + } + Integer limit = jobDetails.getRetries(); - TriggerJobCommand command = new TriggerJobCommand(processInstanceId, correlationId, timerId, limit, process, application.unitOfWorkManager()); + TriggerJobCommand command = new TriggerJobCommand(processInstanceId, correlationId, timerId, limit, process.get(), application.unitOfWorkManager()); return Uni.createFrom().item(command::execute) .onFailure() diff --git a/kogito-apps-build-parent/pom.xml b/kogito-apps-build-parent/pom.xml index bdaa224b08..b3b66c2c02 100644 --- a/kogito-apps-build-parent/pom.xml +++ b/kogito-apps-build-parent/pom.xml @@ -70,7 +70,7 @@ 6.2.13.Final 2.3.1 1.10.0 - 2.0.0 + 2.2.0 1.5.5.Final 1.5.0 19.0 diff --git a/pom.xml b/pom.xml index 79026f8a88..12ce381108 100644 --- a/pom.xml +++ b/pom.xml @@ -22,6 +22,7 @@ + 4.0.0