diff --git a/.husky/pre-commit b/.husky/pre-commit old mode 100755 new mode 100644 diff --git a/apps-integration-tests/integration-tests-data-index-service/integration-tests-data-index-service-quarkus/pom.xml b/apps-integration-tests/integration-tests-data-index-service/integration-tests-data-index-service-quarkus/pom.xml index 1eed8a595a..5773846b3f 100644 --- a/apps-integration-tests/integration-tests-data-index-service/integration-tests-data-index-service-quarkus/pom.xml +++ b/apps-integration-tests/integration-tests-data-index-service/integration-tests-data-index-service-quarkus/pom.xml @@ -34,28 +34,28 @@ - org.kie.kogito - kogito-quarkus + org.jbpm + jbpm-with-drools-quarkus - org.kie.kogito - kogito-addons-quarkus-process-management + org.kie + kie-addons-quarkus-process-management - org.kie.kogito - kogito-addons-quarkus-task-management + org.jbpm + jbpm-addons-quarkus-task-management - org.kie.kogito - kogito-addons-quarkus-process-svg + org.kie + kie-addons-quarkus-process-svg - org.kie.kogito - kogito-addons-quarkus-source-files + org.kie + kie-addons-quarkus-source-files - org.kie.kogito - kogito-addons-quarkus-events-process + org.kie + kie-addons-quarkus-events-process io.quarkus @@ -70,8 +70,8 @@ integration-tests-data-index-service-common - org.kie.kogito - kogito-addons-quarkus-persistence-filesystem + org.kie + kie-addons-quarkus-persistence-filesystem io.quarkus diff --git a/apps-integration-tests/integration-tests-data-index-service/integration-tests-data-index-service-quarkus/src/test/java/org/kie/kogito/index/oracle/AbstractProcessDataIndexOracleIT.java b/apps-integration-tests/integration-tests-data-index-service/integration-tests-data-index-service-quarkus/src/test/java/org/kie/kogito/index/oracle/AbstractProcessDataIndexOracleIT.java deleted file mode 100644 index fd5d48fccd..0000000000 --- a/apps-integration-tests/integration-tests-data-index-service/integration-tests-data-index-service-quarkus/src/test/java/org/kie/kogito/index/oracle/AbstractProcessDataIndexOracleIT.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.kogito.index.oracle; - -import org.kie.kogito.index.AbstractProcessDataIndexIT; -import org.kie.kogito.test.quarkus.QuarkusTestProperty; - -import static org.kie.kogito.index.test.Constants.KOGITO_DATA_INDEX_SERVICE_URL; - -public abstract class AbstractProcessDataIndexOracleIT extends AbstractProcessDataIndexIT { - - @QuarkusTestProperty(name = KOGITO_DATA_INDEX_SERVICE_URL) - String dataIndex; - - @Override - public String getDataIndexURL() { - return dataIndex; - } - - @Override - public boolean validateDomainData() { - return false; - } -} diff --git a/apps-integration-tests/integration-tests-data-index-service/integration-tests-data-index-service-quarkus/src/test/java/org/kie/kogito/index/oracle/ProcessDataIndexOracleHttpIT.java b/apps-integration-tests/integration-tests-data-index-service/integration-tests-data-index-service-quarkus/src/test/java/org/kie/kogito/index/oracle/ProcessDataIndexOracleHttpIT.java deleted file mode 100644 index d323cbc6e0..0000000000 --- a/apps-integration-tests/integration-tests-data-index-service/integration-tests-data-index-service-quarkus/src/test/java/org/kie/kogito/index/oracle/ProcessDataIndexOracleHttpIT.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.kogito.index.oracle; - -import org.kie.kogito.index.quarkus.http.OracleHttpTestProfile; - -import io.quarkus.test.junit.QuarkusIntegrationTest; -import io.quarkus.test.junit.TestProfile; - -@QuarkusIntegrationTest -@TestProfile(OracleHttpTestProfile.class) -public class ProcessDataIndexOracleHttpIT extends AbstractProcessDataIndexOracleIT { -} diff --git a/apps-integration-tests/integration-tests-data-index-service/integration-tests-data-index-service-quarkus/src/test/java/org/kie/kogito/index/oracle/ProcessDataIndexOracleKafkaIT.java b/apps-integration-tests/integration-tests-data-index-service/integration-tests-data-index-service-quarkus/src/test/java/org/kie/kogito/index/oracle/ProcessDataIndexOracleKafkaIT.java deleted file mode 100644 index bfcd0a7486..0000000000 --- a/apps-integration-tests/integration-tests-data-index-service/integration-tests-data-index-service-quarkus/src/test/java/org/kie/kogito/index/oracle/ProcessDataIndexOracleKafkaIT.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.kogito.index.oracle; - -import org.kie.kogito.index.quarkus.kafka.OracleKafkaTestProfile; - -import io.quarkus.test.junit.QuarkusIntegrationTest; -import io.quarkus.test.junit.TestProfile; - -@QuarkusIntegrationTest -@TestProfile(OracleKafkaTestProfile.class) -public class ProcessDataIndexOracleKafkaIT extends AbstractProcessDataIndexOracleIT { -} diff --git a/apps-integration-tests/integration-tests-data-index-service/integration-tests-data-index-service-quarkus/src/test/java/org/kie/kogito/index/quarkus/http/OracleHttpTestProfile.java b/apps-integration-tests/integration-tests-data-index-service/integration-tests-data-index-service-quarkus/src/test/java/org/kie/kogito/index/quarkus/http/OracleHttpTestProfile.java deleted file mode 100644 index e8bc357953..0000000000 --- a/apps-integration-tests/integration-tests-data-index-service/integration-tests-data-index-service-quarkus/src/test/java/org/kie/kogito/index/quarkus/http/OracleHttpTestProfile.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.kogito.index.quarkus.http; - -import java.util.Arrays; -import java.util.List; - -import org.kie.kogito.index.test.quarkus.http.DataIndexOracleHttpQuarkusTestResource; -import org.kie.kogito.index.test.quarkus.http.KogitoServiceRandomPortQuarkusHttpTestResource; - -import io.quarkus.test.junit.QuarkusTestProfile; - -public class OracleHttpTestProfile implements QuarkusTestProfile { - - @Override - public List testResources() { - return Arrays.asList(new TestResourceEntry(KogitoServiceRandomPortQuarkusHttpTestResource.class), - new TestResourceEntry(DataIndexOracleHttpQuarkusTestResource.class)); - } - -} diff --git a/apps-integration-tests/integration-tests-data-index-service/integration-tests-data-index-service-quarkus/src/test/java/org/kie/kogito/index/quarkus/kafka/OracleKafkaTestProfile.java b/apps-integration-tests/integration-tests-data-index-service/integration-tests-data-index-service-quarkus/src/test/java/org/kie/kogito/index/quarkus/kafka/OracleKafkaTestProfile.java deleted file mode 100644 index 4e129fb0f0..0000000000 --- a/apps-integration-tests/integration-tests-data-index-service/integration-tests-data-index-service-quarkus/src/test/java/org/kie/kogito/index/quarkus/kafka/OracleKafkaTestProfile.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.kogito.index.quarkus.kafka; - -import java.util.Arrays; -import java.util.List; - -import org.kie.kogito.index.test.quarkus.kafka.DataIndexOracleQuarkusKafkaTestResource; - -import io.quarkus.test.junit.QuarkusTestProfile; - -public class OracleKafkaTestProfile implements QuarkusTestProfile { - - @Override - public List testResources() { - return Arrays.asList(new TestResourceEntry(KogitoServiceRandomPortQuarkusKafkaTestResource.class), - new TestResourceEntry(DataIndexOracleQuarkusKafkaTestResource.class)); - } - -} diff --git a/apps-integration-tests/integration-tests-data-index-service/integration-tests-data-index-service-springboot/pom.xml b/apps-integration-tests/integration-tests-data-index-service/integration-tests-data-index-service-springboot/pom.xml index 63ef8eb11d..9540d3e3ea 100644 --- a/apps-integration-tests/integration-tests-data-index-service/integration-tests-data-index-service-springboot/pom.xml +++ b/apps-integration-tests/integration-tests-data-index-service/integration-tests-data-index-service-springboot/pom.xml @@ -50,32 +50,32 @@ - org.kie.kogito - kogito-spring-boot-starter + org.jbpm + jbpm-with-drools-spring-boot-starter org.kie.kogito integration-tests-data-index-service-common - org.kie.kogito - kogito-addons-springboot-events-process-kafka + org.kie + kie-addons-springboot-events-process-kafka - org.kie.kogito - kogito-addons-springboot-process-management + org.kie + kie-addons-springboot-process-management - org.kie.kogito - kogito-addons-springboot-task-management + org.jbpm + jbpm-addons-springboot-task-management - org.kie.kogito - kogito-addons-springboot-process-svg + org.kie + kie-addons-springboot-process-svg - org.kie.kogito - kogito-addons-springboot-persistence-filesystem + org.kie + kie-addons-springboot-persistence-filesystem io.rest-assured diff --git a/apps-integration-tests/integration-tests-data-index-service/integration-tests-data-index-service-springboot/src/test/java/org/kie/kogito/index/ProcessDataIndexOracleIT.java b/apps-integration-tests/integration-tests-data-index-service/integration-tests-data-index-service-springboot/src/test/java/org/kie/kogito/index/ProcessDataIndexOracleIT.java deleted file mode 100644 index 9f9278ce26..0000000000 --- a/apps-integration-tests/integration-tests-data-index-service/integration-tests-data-index-service-springboot/src/test/java/org/kie/kogito/index/ProcessDataIndexOracleIT.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.kogito.index; - -import org.junit.jupiter.api.BeforeEach; -import org.kie.kogito.KogitoApplication; -import org.kie.kogito.index.spring.DataIndexOracleSpringTestResource; -import org.kie.kogito.index.spring.KogitoServiceRandomPortSpringTestResource; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.web.server.LocalServerPort; -import org.springframework.test.annotation.DirtiesContext; -import org.springframework.test.context.ContextConfiguration; - -import io.restassured.RestAssured; - -import static org.kie.kogito.index.test.Constants.KOGITO_DATA_INDEX_SERVICE_URL; - -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = { KogitoApplication.class }) -@ContextConfiguration(initializers = { KogitoServiceRandomPortSpringTestResource.class, DataIndexOracleSpringTestResource.class }) -@DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_CLASS) -public class ProcessDataIndexOracleIT extends SpringBootAbstractProcessInstanceIT { - - @LocalServerPort - private int httpPort; - - @Value("${" + KOGITO_DATA_INDEX_SERVICE_URL + "}") - private String dataIndexUrl; - - @Override - public String getDataIndexURL() { - return dataIndexUrl; - } - - @Override - public boolean validateDomainData() { - return false; - } - - @BeforeEach - public void setup() { - RestAssured.port = httpPort; - } - -} diff --git a/apps-integration-tests/integration-tests-data-index-service/integration-tests-data-index-service-springboot/src/test/java/org/kie/kogito/index/spring/DataIndexOracleSpringTestResource.java b/apps-integration-tests/integration-tests-data-index-service/integration-tests-data-index-service-springboot/src/test/java/org/kie/kogito/index/spring/DataIndexOracleSpringTestResource.java deleted file mode 100644 index fd8d1ef41c..0000000000 --- a/apps-integration-tests/integration-tests-data-index-service/integration-tests-data-index-service-springboot/src/test/java/org/kie/kogito/index/spring/DataIndexOracleSpringTestResource.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.kogito.index.spring; - -import java.util.HashMap; -import java.util.Map; - -import org.kie.kogito.index.test.quarkus.kafka.DataIndexOracleKafkaResource; -import org.kie.kogito.test.resources.ConditionalSpringBootTestResource; - -import static org.kie.kogito.index.test.Constants.KOGITO_DATA_INDEX_SERVICE_URL; - -public class DataIndexOracleSpringTestResource extends ConditionalSpringBootTestResource { - public DataIndexOracleSpringTestResource() { - super(new DataIndexOracleKafkaResource()); - } - - @Override - protected Map getProperties() { - Map properties = new HashMap<>(); - properties.put(KOGITO_DATA_INDEX_SERVICE_URL, "http://localhost:" + getTestResource().getMappedPort()); - properties.putAll(getTestResource().getProperties()); - return properties; - } - -} diff --git a/apps-integration-tests/integration-tests-jobs-service/integration-tests-jobs-service-quarkus/integration-tests-jobs-service-quarkus-embedded/pom.xml b/apps-integration-tests/integration-tests-jobs-service/integration-tests-jobs-service-quarkus/integration-tests-jobs-service-quarkus-embedded/pom.xml index 4d304aee63..03a22af448 100644 --- a/apps-integration-tests/integration-tests-jobs-service/integration-tests-jobs-service-quarkus/integration-tests-jobs-service-quarkus-embedded/pom.xml +++ b/apps-integration-tests/integration-tests-jobs-service/integration-tests-jobs-service-quarkus/integration-tests-jobs-service-quarkus-embedded/pom.xml @@ -34,12 +34,12 @@ - org.kie.kogito + org.kie kogito-addons-quarkus-jobs-service-embedded - org.kie.kogito - kogito-quarkus-processes + org.jbpm + jbpm-quarkus true @@ -56,8 +56,8 @@ quarkus-resteasy-jackson - org.kie.kogito - kogito-addons-quarkus-messaging + org.kie + kie-addons-quarkus-messaging io.quarkus diff --git a/apps-integration-tests/integration-tests-jobs-service/integration-tests-jobs-service-quarkus/integration-tests-jobs-service-quarkus-knative-eventing/pom.xml b/apps-integration-tests/integration-tests-jobs-service/integration-tests-jobs-service-quarkus/integration-tests-jobs-service-quarkus-knative-eventing/pom.xml index 2a4cc602c7..41abed1197 100644 --- a/apps-integration-tests/integration-tests-jobs-service/integration-tests-jobs-service-quarkus/integration-tests-jobs-service-quarkus-knative-eventing/pom.xml +++ b/apps-integration-tests/integration-tests-jobs-service/integration-tests-jobs-service-quarkus/integration-tests-jobs-service-quarkus-knative-eventing/pom.xml @@ -34,12 +34,12 @@ - org.kie.kogito + org.kie kogito-addons-quarkus-jobs-knative-eventing - org.kie.kogito - kogito-quarkus-processes + org.jbpm + jbpm-quarkus org.kie.kogito diff --git a/apps-integration-tests/integration-tests-jobs-service/integration-tests-jobs-service-quarkus/integration-tests-jobs-service-quarkus-management/pom.xml b/apps-integration-tests/integration-tests-jobs-service/integration-tests-jobs-service-quarkus/integration-tests-jobs-service-quarkus-management/pom.xml index d0b8765d74..fa721e7630 100644 --- a/apps-integration-tests/integration-tests-jobs-service/integration-tests-jobs-service-quarkus/integration-tests-jobs-service-quarkus-management/pom.xml +++ b/apps-integration-tests/integration-tests-jobs-service/integration-tests-jobs-service-quarkus/integration-tests-jobs-service-quarkus-management/pom.xml @@ -34,12 +34,12 @@ - org.kie.kogito + org.kie kogito-addons-quarkus-jobs-management - org.kie.kogito - kogito-quarkus-processes + org.jbpm + jbpm-quarkus org.kie.kogito @@ -54,8 +54,8 @@ quarkus-resteasy-jackson - org.kie.kogito - kogito-addons-quarkus-messaging + org.kie + kie-addons-quarkus-messaging io.quarkus diff --git a/apps-integration-tests/integration-tests-jobs-service/integration-tests-jobs-service-quarkus/integration-tests-jobs-service-quarkus-messaging/pom.xml b/apps-integration-tests/integration-tests-jobs-service/integration-tests-jobs-service-quarkus/integration-tests-jobs-service-quarkus-messaging/pom.xml index 5865aec33e..41fac3c77e 100644 --- a/apps-integration-tests/integration-tests-jobs-service/integration-tests-jobs-service-quarkus/integration-tests-jobs-service-quarkus-messaging/pom.xml +++ b/apps-integration-tests/integration-tests-jobs-service/integration-tests-jobs-service-quarkus/integration-tests-jobs-service-quarkus-messaging/pom.xml @@ -34,12 +34,12 @@ - org.kie.kogito + org.kie kogito-addons-quarkus-jobs-messaging - org.kie.kogito - kogito-quarkus-processes + org.jbpm + jbpm-quarkus org.kie.kogito @@ -54,12 +54,12 @@ quarkus-resteasy-jackson - org.kie.kogito - kogito-addons-quarkus-events-process + org.kie + kie-addons-quarkus-events-process - org.kie.kogito - kogito-addons-quarkus-messaging + org.kie + kie-addons-quarkus-messaging io.quarkus @@ -67,8 +67,8 @@ - org.kie.kogito - kogito-addons-quarkus-persistence-filesystem + org.kie + kie-addons-quarkus-persistence-filesystem org.kie.kogito diff --git a/apps-integration-tests/integration-tests-jobs-service/integration-tests-jobs-service-springboot/pom.xml b/apps-integration-tests/integration-tests-jobs-service/integration-tests-jobs-service-springboot/pom.xml index 3367ba036d..5ee3f0acb4 100644 --- a/apps-integration-tests/integration-tests-jobs-service/integration-tests-jobs-service-springboot/pom.xml +++ b/apps-integration-tests/integration-tests-jobs-service/integration-tests-jobs-service-springboot/pom.xml @@ -48,15 +48,15 @@ - org.kie.kogito - kogito-spring-boot-starter + org.jbpm + jbpm-with-drools-spring-boot-starter - org.kie.kogito - kogito-addons-springboot-process-management + org.kie + kie-addons-springboot-process-management - org.kie.kogito + org.kie kogito-addons-springboot-jobs-management diff --git a/apps-integration-tests/integration-tests-trusty-service/integration-tests-trusty-service-quarkus/pom.xml b/apps-integration-tests/integration-tests-trusty-service/integration-tests-trusty-service-quarkus/pom.xml index 760f3580b7..ea3863b225 100644 --- a/apps-integration-tests/integration-tests-trusty-service/integration-tests-trusty-service-quarkus/pom.xml +++ b/apps-integration-tests/integration-tests-trusty-service/integration-tests-trusty-service-quarkus/pom.xml @@ -36,12 +36,12 @@ - org.kie.kogito - kogito-quarkus + org.jbpm + jbpm-with-drools-quarkus - org.kie.kogito - kogito-addons-quarkus-tracing-decision + org.kie + kie-addons-quarkus-tracing-decision diff --git a/apps-integration-tests/integration-tests-trusty-service/integration-tests-trusty-service-springboot/pom.xml b/apps-integration-tests/integration-tests-trusty-service/integration-tests-trusty-service-springboot/pom.xml index 0008c4e9b7..ccc4b93310 100644 --- a/apps-integration-tests/integration-tests-trusty-service/integration-tests-trusty-service-springboot/pom.xml +++ b/apps-integration-tests/integration-tests-trusty-service/integration-tests-trusty-service-springboot/pom.xml @@ -56,12 +56,12 @@ - org.kie.kogito - kogito-spring-boot-starter + org.jbpm + jbpm-with-drools-spring-boot-starter - org.kie.kogito - kogito-addons-springboot-tracing-decision + org.kie + kie-addons-springboot-tracing-decision diff --git a/data-audit/README.md b/data-audit/README.md index a137058a37..4e323cb9f8 100644 --- a/data-audit/README.md +++ b/data-audit/README.md @@ -93,13 +93,13 @@ org.kie.kogito.app.audit.spi.GraphQLSchemaQueryProvider: this allow the subsyste You need to add two different dependencies to your project (collocated service) - org.kie.kogito - kogito-addons-data-audit- + org.kie + kogito-addons--data-audit ${version} - org.kie.kogito - kogito-addons-data-audit-jpa- + org.kie + kogito-addons--data-audit-jpa ${version} @@ -114,5 +114,5 @@ Each implementation might require additional dependencies. In our case for using quarkus-jdbc-h2 -No additional configuration is requires besides the default datasource use by the application already. +No additional configuration is required besides the default datasource use by the application already. diff --git a/data-audit/data-audit-quarkus-service/pom.xml b/data-audit/data-audit-quarkus-service/pom.xml index 100c84c385..2744fd74b2 100644 --- a/data-audit/data-audit-quarkus-service/pom.xml +++ b/data-audit/data-audit-quarkus-service/pom.xml @@ -26,8 +26,8 @@ data-audit-common-service - org.kie.kogito - kogito-addons-data-audit-quarkus + org.kie + kogito-addons-quarkus-data-audit org.kie.kogito diff --git a/data-audit/kogito-addons-data-audit-jpa/data-audit-quarkus-jpa-service/pom.xml b/data-audit/kogito-addons-data-audit-jpa/data-audit-quarkus-jpa-service/pom.xml index d34150ab7c..4bc72e655f 100644 --- a/data-audit/kogito-addons-data-audit-jpa/data-audit-quarkus-jpa-service/pom.xml +++ b/data-audit/kogito-addons-data-audit-jpa/data-audit-quarkus-jpa-service/pom.xml @@ -5,7 +5,7 @@ 4.0.0 kogito-addons-data-audit-jpa - org.kie.kogito + org.kie 999-SNAPSHOT @@ -25,8 +25,8 @@ - org.kie.kogito - kogito-addons-data-audit-jpa-quarkus + org.kie + kogito-addons-quarkus-data-audit-jpa diff --git a/data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-common/pom.xml b/data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-common/pom.xml index 35312a2c2b..66545078e5 100644 --- a/data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-common/pom.xml +++ b/data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-common/pom.xml @@ -4,7 +4,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - org.kie.kogito + org.kie kogito-addons-data-audit-jpa 999-SNAPSHOT diff --git a/data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-quarkus/pom.xml b/data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-quarkus/pom.xml index 9529ca01b0..399b092b3d 100644 --- a/data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-quarkus/pom.xml +++ b/data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-quarkus/pom.xml @@ -4,12 +4,13 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 + org.kie kogito-addons-data-audit-jpa - org.kie.kogito 999-SNAPSHOT - kogito-addons-data-audit-jpa-quarkus + org.kie + kogito-addons-quarkus-data-audit-jpa Kogito Apps :: Data Audit :: JPA :: Quarkus @@ -21,7 +22,7 @@ - org.kie.kogito + org.kie kogito-addons-data-audit-jpa-common diff --git a/data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-springboot/pom.xml b/data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-springboot/pom.xml index d3f5204c18..111ab46888 100644 --- a/data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-springboot/pom.xml +++ b/data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-springboot/pom.xml @@ -4,13 +4,13 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 + org.kie kogito-addons-data-audit-jpa - org.kie.kogito 999-SNAPSHOT - - kogito-addons-data-audit-jpa-springboot + org.kie + kogito-addons-springboot-data-audit-jpa Kogito Apps :: Data Audit :: JPA :: SpringBoot @@ -24,7 +24,7 @@ data-audit-common - org.kie.kogito + org.kie kogito-addons-data-audit-jpa-common diff --git a/data-audit/kogito-addons-data-audit-jpa/pom.xml b/data-audit/kogito-addons-data-audit-jpa/pom.xml index 1f7e867c75..8e9a5fb802 100644 --- a/data-audit/kogito-addons-data-audit-jpa/pom.xml +++ b/data-audit/kogito-addons-data-audit-jpa/pom.xml @@ -10,6 +10,8 @@ pom + + org.kie kogito-addons-data-audit-jpa Kogito Apps :: Data Audit :: JPA diff --git a/data-audit/kogito-addons-data-audit-quarkus/pom.xml b/data-audit/kogito-addons-data-audit-quarkus/pom.xml index aa46eb153d..4bebd27896 100644 --- a/data-audit/kogito-addons-data-audit-quarkus/pom.xml +++ b/data-audit/kogito-addons-data-audit-quarkus/pom.xml @@ -9,8 +9,8 @@ 999-SNAPSHOT - kogito-addons-data-audit-quarkus - + org.kie + kogito-addons-quarkus-data-audit Kogito Apps :: Data Audit :: Quarkus @@ -114,8 +114,8 @@ - org.kie.kogito - kogito-addons-data-audit-jpa-quarkus + org.kie + kogito-addons-quarkus-data-audit-jpa test diff --git a/data-audit/kogito-addons-data-audit-springboot/pom.xml b/data-audit/kogito-addons-data-audit-springboot/pom.xml index cb1258b40b..762fad23c2 100644 --- a/data-audit/kogito-addons-data-audit-springboot/pom.xml +++ b/data-audit/kogito-addons-data-audit-springboot/pom.xml @@ -9,7 +9,8 @@ 999-SNAPSHOT - kogito-addons-data-audit-springboot + org.kie + kogito-addons-springboot-data-audit Kogito Apps :: Data Audit :: SpringBoot @@ -73,8 +74,8 @@ - org.kie.kogito - kogito-addons-data-audit-jpa-springboot + org.kie + kogito-addons-springboot-data-audit-jpa diff --git a/data-index/README.md b/data-index/README.md index 3e4e7521ab..e555ede1a8 100644 --- a/data-index/README.md +++ b/data-index/README.md @@ -1,4 +1,92 @@ -## Kogito Data Index Service +# Kogito Data Index Service + +Data Index is a subsystem/component responsible to store a snapshot of the last state of the process instance state. + +The system supports two different types of deployment: +* Compact Architecture: as component deployed within the application +* Distributed Architecture: as component deployed independently as service + +Due to the nature of the system it support different types of storage + +* postgresql +* infinispan +* mongodb +* jpa + +At present for compact configuration it only support quarkus runtime. For distributed supports both runtimes quarkus and springboot. + + +## Compact architecture + +The next dependency is added for quarkus and being able to use in-vm transport tier. +The same dependency is used to specify the storage of the data index and the transport tier at the same time. + + + + + org.kie + kogito-addons-quarkus-data-index-persistence-postgresql + + + + +As this dependency will include the storage as well and the in-vm transport. + + + + + org.kie + kogito-addons-quarkus-data-index-persistence- + + + +where storage can be: +* infinispan +* mongodb +* postgresql + +Current system + +![data-index](docs/data-index.png "Data Index") + + +The concepts to understand the above picture are: +* Transport: the medium used to transfer events between the runtime and the data index service. The transport is http in distributed environments, or in-vm for compact architecture. +* Storage: the persistence tier of the data index component. +* Data index: the main component responsible for creating/updating the data index, and for providing query capabilities. + + +## Querying + +Data index support queries through graphQL (basic.schema.graphqls). For using the endpoint you just need to explore in your deployment the URI: + +http://localhost:8080//graphql-ui/ + +to start working with the queries defined by the schema aforementioned. + +## Distributed deployment + +For distributed you need to specify and addons you will need to deploy the data index as service and include the event publisher + + + + + org.kie.kogito + kogito-addons-springboot-events-process-kafka + + + + +or for quarkus + + + + org.kie.kogito + kogito-addons-quarkus-events-process-kafka + + + + +More information about the Data Index images in here: +[https://github.com/apache/incubator-kie-kogito-images?tab=readme-ov-file#kogito-data-index-component-images](https://github.com/apache/incubator-kie-kogito-images?tab=readme-ov-file#kogito-data-index-component-images) -Documentation: -https://github.com/kiegroup/kogito-runtimes/wiki/Data-Index-Service diff --git a/data-index/data-index-common/pom.xml b/data-index/data-index-common/pom.xml index b11b7d92e4..2bb8c27e15 100644 --- a/data-index/data-index-common/pom.xml +++ b/data-index/data-index-common/pom.xml @@ -45,6 +45,10 @@ org.kie.kogito kogito-events-core + + com.graphql-java + graphql-java + io.quarkus quarkus-jackson diff --git a/data-index/data-index-common/src/main/java/org/kie/kogito/index/CommonUtils.java b/data-index/data-index-common/src/main/java/org/kie/kogito/index/CommonUtils.java index ba47c72d44..3bc4b724db 100644 --- a/data-index/data-index-common/src/main/java/org/kie/kogito/index/CommonUtils.java +++ b/data-index/data-index-common/src/main/java/org/kie/kogito/index/CommonUtils.java @@ -22,6 +22,7 @@ public class CommonUtils { + public static final int ERROR_STATE = 5; private static final Set finalStates = Set.of("Completed", "Aborted"); public static boolean isTaskCompleted(String status) { diff --git a/data-index/data-index-graphql/src/main/java/org/kie/kogito/index/graphql/DateTimeCoercing.java b/data-index/data-index-common/src/main/java/org/kie/kogito/index/api/DateTimeCoercing.java similarity index 96% rename from data-index/data-index-graphql/src/main/java/org/kie/kogito/index/graphql/DateTimeCoercing.java rename to data-index/data-index-common/src/main/java/org/kie/kogito/index/api/DateTimeCoercing.java index 3b72407932..621bf6d716 100644 --- a/data-index/data-index-graphql/src/main/java/org/kie/kogito/index/graphql/DateTimeCoercing.java +++ b/data-index/data-index-common/src/main/java/org/kie/kogito/index/api/DateTimeCoercing.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.kie.kogito.index.graphql; +package org.kie.kogito.index.api; import graphql.schema.Coercing; diff --git a/data-index/data-index-graphql/src/main/java/org/kie/kogito/index/graphql/DefaultDateTimeCoercing.java b/data-index/data-index-common/src/main/java/org/kie/kogito/index/api/DefaultDateTimeCoercing.java similarity index 98% rename from data-index/data-index-graphql/src/main/java/org/kie/kogito/index/graphql/DefaultDateTimeCoercing.java rename to data-index/data-index-common/src/main/java/org/kie/kogito/index/api/DefaultDateTimeCoercing.java index 9bdde6dce1..95fba82147 100644 --- a/data-index/data-index-graphql/src/main/java/org/kie/kogito/index/graphql/DefaultDateTimeCoercing.java +++ b/data-index/data-index-common/src/main/java/org/kie/kogito/index/api/DefaultDateTimeCoercing.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.kie.kogito.index.graphql; +package org.kie.kogito.index.api; import java.time.DateTimeException; import java.time.Instant; diff --git a/data-index/data-index-common/src/main/java/org/kie/kogito/index/json/JsonUtils.java b/data-index/data-index-common/src/main/java/org/kie/kogito/index/json/JsonUtils.java index c1d6a4c8c0..8dbf880581 100644 --- a/data-index/data-index-common/src/main/java/org/kie/kogito/index/json/JsonUtils.java +++ b/data-index/data-index-common/src/main/java/org/kie/kogito/index/json/JsonUtils.java @@ -20,10 +20,14 @@ import org.kie.kogito.event.process.ProcessInstanceDataEvent; import org.kie.kogito.event.usertask.UserTaskInstanceDataEvent; +import org.kie.kogito.jackson.utils.JsonObjectUtils; +import org.kie.kogito.jackson.utils.MergeUtils; +import org.kie.kogito.jackson.utils.ObjectMapperFactory; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.module.SimpleModule; +import com.fasterxml.jackson.databind.node.ObjectNode; import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; import io.cloudevents.jackson.JsonFormat; @@ -50,4 +54,20 @@ public static ObjectMapper configure(ObjectMapper objectMapper) { objectMapper.registerModule(module); return objectMapper; } + + public static ObjectNode mergeVariable(String variableName, Object variableValue, ObjectNode variables) { + return (ObjectNode) MergeUtils.merge(createObjectNode(variableName, variableValue), variables); + } + + private static ObjectNode createObjectNode(String variableName, Object variableValue) { + int indexOf = variableName.indexOf('.'); + ObjectNode result = ObjectMapperFactory.get().createObjectNode(); + if (indexOf == -1) { + result.set(variableName, JsonObjectUtils.fromValue(variableValue)); + } else { + String name = variableName.substring(0, indexOf); + result.set(name, createObjectNode(variableName.substring(indexOf + 1), variableValue)); + } + return result; + } } diff --git a/data-index/data-index-common/src/main/java/org/kie/kogito/index/service/IndexingService.java b/data-index/data-index-common/src/main/java/org/kie/kogito/index/service/IndexingService.java index 4e9c733f3e..2802fe8f94 100644 --- a/data-index/data-index-common/src/main/java/org/kie/kogito/index/service/IndexingService.java +++ b/data-index/data-index-common/src/main/java/org/kie/kogito/index/service/IndexingService.java @@ -41,7 +41,7 @@ import org.kie.kogito.event.usertask.UserTaskInstanceStateDataEvent; import org.kie.kogito.event.usertask.UserTaskInstanceVariableDataEvent; import org.kie.kogito.index.model.Job; -import org.kie.kogito.index.model.ProcessDefinition; +import org.kie.kogito.index.model.ProcessDefinitionKey; import org.kie.kogito.index.storage.DataIndexStorageService; import org.kie.kogito.index.storage.ProcessInstanceStorage; import org.kie.kogito.index.storage.UserTaskInstanceStorage; @@ -92,9 +92,8 @@ public void indexProcessInstanceEvent(ProcessInstanceDataEvent event) { //retry in case of rare but possible race condition during the insert for the first registry @Retry(maxRetries = 3, delay = 300, jitter = 100, retryOn = ConcurrentModificationException.class) public void indexProcessDefinition(ProcessDefinitionDataEvent definitionDataEvent) { - ProcessDefinition definition = ProcessDefinitionHelper - .merge(manager.getProcessDefinitionStorage().get(ProcessDefinition.toKey(definitionDataEvent.getKogitoProcessId(), definitionDataEvent.getData().getVersion())), definitionDataEvent); - manager.getProcessDefinitionStorage().put(definition.getKey(), definition); + ProcessDefinitionKey key = new ProcessDefinitionKey(definitionDataEvent.getKogitoProcessId(), definitionDataEvent.getData().getVersion()); + manager.getProcessDefinitionStorage().put(key, ProcessDefinitionHelper.merge(manager.getProcessDefinitionStorage().get(key), definitionDataEvent)); } //retry in case of rare but possible race condition during the insert for the first registry diff --git a/data-index/data-index-common/src/test/java/org/kie/kogito/index/json/JsonUtilsTest.java b/data-index/data-index-common/src/test/java/org/kie/kogito/index/json/JsonUtilsTest.java new file mode 100644 index 0000000000..c814d9c879 --- /dev/null +++ b/data-index/data-index-common/src/test/java/org/kie/kogito/index/json/JsonUtilsTest.java @@ -0,0 +1,48 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.kie.kogito.index.json; + +import org.junit.jupiter.api.Test; +import org.kie.kogito.jackson.utils.ObjectMapperFactory; + +import com.fasterxml.jackson.databind.node.ObjectNode; + +import static org.assertj.core.api.Assertions.assertThat; + +public class JsonUtilsTest { + + @Test + void testMergeWithDot() { + ObjectNode expected = ObjectMapperFactory.get().createObjectNode().set("key", ObjectMapperFactory.get().createObjectNode().put("user1", "manolo")); + assertThat(JsonUtils.mergeVariable("key.user1", "manolo", null)).isEqualTo(expected); + } + + @Test + void testSimpleMerge() { + ObjectNode expected = ObjectMapperFactory.get().createObjectNode().put("user1", "manolo"); + assertThat(JsonUtils.mergeVariable("user1", "manolo", null)).isEqualTo(expected); + } + + @Test + void testComplexMergeWithDot() { + ObjectNode expected = ObjectMapperFactory.get().createObjectNode().set("key", ObjectMapperFactory.get().createObjectNode().put("user1", "manolo").put("user2", "pepe")); + assertThat(JsonUtils.mergeVariable("key.user1", "manolo", ObjectMapperFactory.get().createObjectNode().set("key", ObjectMapperFactory.get().createObjectNode().put("user2", "pepe")))) + .isEqualTo(expected); + } +} diff --git a/data-index/data-index-graphql/src/main/java/org/kie/kogito/index/graphql/AbstractGraphQLSchemaManager.java b/data-index/data-index-graphql/src/main/java/org/kie/kogito/index/graphql/AbstractGraphQLSchemaManager.java index bcb759c63e..6dd81262b1 100644 --- a/data-index/data-index-graphql/src/main/java/org/kie/kogito/index/graphql/AbstractGraphQLSchemaManager.java +++ b/data-index/data-index-graphql/src/main/java/org/kie/kogito/index/graphql/AbstractGraphQLSchemaManager.java @@ -34,6 +34,7 @@ import org.kie.kogito.index.model.Job; import org.kie.kogito.index.model.Node; import org.kie.kogito.index.model.ProcessDefinition; +import org.kie.kogito.index.model.ProcessDefinitionKey; import org.kie.kogito.index.model.ProcessInstance; import org.kie.kogito.index.model.UserTaskInstance; import org.kie.kogito.index.service.DataIndexServiceException; @@ -137,7 +138,7 @@ public String getProcessInstanceServiceUrl(DataFetchingEnvironment env) { public ProcessDefinition getProcessDefinition(DataFetchingEnvironment env) { ProcessInstance source = env.getSource(); - return cacheService.getProcessDefinitionStorage().get(ProcessDefinition.toKey(source.getProcessId(), source.getVersion())); + return cacheService.getProcessDefinitionStorage().get(new ProcessDefinitionKey(source.getProcessId(), source.getVersion())); } protected String getServiceUrl(String endpoint, String processId) { @@ -188,7 +189,7 @@ protected Collection getProcessInstancesValues(DataFetchingEnvi return executeAdvancedQueryForCache(cacheService.getProcessInstanceStorage(), env); } - protected List executeAdvancedQueryForCache(StorageFetcher cache, DataFetchingEnvironment env) { + protected List executeAdvancedQueryForCache(StorageFetcher cache, DataFetchingEnvironment env) { Objects.requireNonNull(cache, "Cache not found"); String inputTypeName = ((GraphQLNamedType) env.getFieldDefinition().getArgument("where").getType()).getName(); @@ -231,7 +232,7 @@ public CompletableFuture getProcessInstanceDiagram(DataFetchingEnvironme public CompletableFuture getProcessInstanceSource(DataFetchingEnvironment env) { ProcessInstance pi = env.getSource(); - ProcessDefinition pd = cacheService.getProcessDefinitionStorage().get(ProcessDefinition.toKey(pi.getProcessId(), pi.getVersion())); + ProcessDefinition pd = cacheService.getProcessDefinitionStorage().get(new ProcessDefinitionKey(pi.getProcessId(), pi.getVersion())); if (pd == null) { return dataIndexApiExecutor.getProcessDefinitionSourceFileContent(getServiceUrl(pi.getEndpoint(), pi.getProcessId()), pi.getProcessId()); } else { @@ -241,7 +242,7 @@ public CompletableFuture getProcessInstanceSource(DataFetchingEnvironmen public CompletableFuture> getProcessInstanceNodes(DataFetchingEnvironment env) { ProcessInstance pi = env.getSource(); - ProcessDefinition pd = cacheService.getProcessDefinitionStorage().get(ProcessDefinition.toKey(pi.getProcessId(), pi.getVersion())); + ProcessDefinition pd = cacheService.getProcessDefinitionStorage().get(new ProcessDefinitionKey(pi.getProcessId(), pi.getVersion())); if (pd == null) { return dataIndexApiExecutor.getProcessDefinitionNodes(getServiceUrl(pi.getEndpoint(), pi.getProcessId()), pi.getProcessId()); } else { diff --git a/data-index/data-index-graphql/src/main/java/org/kie/kogito/index/graphql/GraphQLScalarTypeProducer.java b/data-index/data-index-graphql/src/main/java/org/kie/kogito/index/graphql/GraphQLScalarTypeProducer.java index 84f5744804..e84698c831 100644 --- a/data-index/data-index-graphql/src/main/java/org/kie/kogito/index/graphql/GraphQLScalarTypeProducer.java +++ b/data-index/data-index-graphql/src/main/java/org/kie/kogito/index/graphql/GraphQLScalarTypeProducer.java @@ -18,6 +18,8 @@ */ package org.kie.kogito.index.graphql; +import org.kie.kogito.index.api.DateTimeCoercing; + import graphql.schema.GraphQLScalarType; import jakarta.enterprise.context.ApplicationScoped; import jakarta.enterprise.inject.Produces; diff --git a/data-index/data-index-graphql/src/main/java/org/kie/kogito/index/graphql/PostgreSqlDateTimeCoercing.java b/data-index/data-index-graphql/src/main/java/org/kie/kogito/index/graphql/PostgreSqlDateTimeCoercing.java deleted file mode 100644 index e4001bb797..0000000000 --- a/data-index/data-index-graphql/src/main/java/org/kie/kogito/index/graphql/PostgreSqlDateTimeCoercing.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.kogito.index.graphql; - -import java.time.ZonedDateTime; - -import io.quarkus.arc.properties.IfBuildProperty; - -import graphql.language.StringValue; -import jakarta.enterprise.context.ApplicationScoped; - -import static org.kie.kogito.persistence.api.factory.Constants.PERSISTENCE_TYPE_PROPERTY; - -@ApplicationScoped -@IfBuildProperty(name = PERSISTENCE_TYPE_PROPERTY, stringValue = "postgresql") -public class PostgreSqlDateTimeCoercing extends DefaultDateTimeCoercing implements DateTimeCoercing { - - @Override - public Object parseValue(Object input) { - return input == null ? null : getZonedDateTime((String) input); - } - - private ZonedDateTime getZonedDateTime(String input) { - return parseDateTime(input); - } - - @Override - public Object parseLiteral(Object input) { - if (input instanceof StringValue) { - return getZonedDateTime(((StringValue) input).getValue()); - } else { - return null; - } - } -} diff --git a/data-index/data-index-graphql/src/test/java/org/kie/kogito/index/graphql/DateTimeScalarTypeProducerTest.java b/data-index/data-index-graphql/src/test/java/org/kie/kogito/index/graphql/DateTimeScalarTypeProducerTest.java index 224e45fce3..4558cffd97 100644 --- a/data-index/data-index-graphql/src/test/java/org/kie/kogito/index/graphql/DateTimeScalarTypeProducerTest.java +++ b/data-index/data-index-graphql/src/test/java/org/kie/kogito/index/graphql/DateTimeScalarTypeProducerTest.java @@ -19,6 +19,7 @@ package org.kie.kogito.index.graphql; import org.junit.jupiter.api.Test; +import org.kie.kogito.index.api.DefaultDateTimeCoercing; import graphql.schema.GraphQLScalarType; diff --git a/data-index/data-index-graphql/src/test/java/org/kie/kogito/index/graphql/DefaultDateTimeCoercingTest.java b/data-index/data-index-graphql/src/test/java/org/kie/kogito/index/graphql/DefaultDateTimeCoercingTest.java index 46aa657512..0f60f439e9 100644 --- a/data-index/data-index-graphql/src/test/java/org/kie/kogito/index/graphql/DefaultDateTimeCoercingTest.java +++ b/data-index/data-index-graphql/src/test/java/org/kie/kogito/index/graphql/DefaultDateTimeCoercingTest.java @@ -25,6 +25,7 @@ import java.time.temporal.ChronoUnit; import org.junit.jupiter.api.Test; +import org.kie.kogito.index.api.DefaultDateTimeCoercing; import graphql.language.StringValue; import graphql.schema.CoercingSerializeException; diff --git a/data-index/data-index-service/data-index-service-common/src/test/java/org/kie/kogito/index/service/graphql/query/GraphQLQueryMapperTest.java b/data-index/data-index-service/data-index-service-common/src/test/java/org/kie/kogito/index/service/graphql/query/GraphQLQueryMapperTest.java index ebcca023fd..6caec6c860 100644 --- a/data-index/data-index-service/data-index-service-common/src/test/java/org/kie/kogito/index/service/graphql/query/GraphQLQueryMapperTest.java +++ b/data-index/data-index-service/data-index-service-common/src/test/java/org/kie/kogito/index/service/graphql/query/GraphQLQueryMapperTest.java @@ -28,7 +28,7 @@ import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; -import org.kie.kogito.index.graphql.DefaultDateTimeCoercing; +import org.kie.kogito.index.api.DefaultDateTimeCoercing; import org.kie.kogito.index.graphql.GraphQLScalarTypeProducer; import org.kie.kogito.index.graphql.query.GraphQLQueryParser; import org.kie.kogito.index.graphql.query.GraphQLQueryParserRegistry; diff --git a/data-index/data-index-service/data-index-service-oracle/pom.xml b/data-index/data-index-service/data-index-service-oracle/pom.xml deleted file mode 100644 index 1177d01818..0000000000 --- a/data-index/data-index-service/data-index-service-oracle/pom.xml +++ /dev/null @@ -1,145 +0,0 @@ - - - - - data-index-service - org.kie.kogito - 999-SNAPSHOT - - 4.0.0 - - data-index-service-oracle - Kogito Apps :: Data Index Service with Oracle - - - org.kie.kogito.index.service.oracle - - - - - org.kie.kogito - data-index-service-common - - - org.kie.kogito - data-index-storage-oracle - - - io.quarkus - quarkus-smallrye-reactive-messaging-kafka - - - io.quarkus - quarkus-container-image-jib - - - io.quarkus - quarkus-flyway - - - - org.kie.kogito - data-index-test-utils - test - - - org.kie.kogito - data-index-service-common - test-jar - test - - - io.quarkus - quarkus-junit5 - test - - - io.rest-assured - rest-assured - test - - - org.mockito - mockito-junit-jupiter - test - - - org.assertj - assertj-core - test - - - org.kie.kogito - kogito-quarkus-test-utils - test - - - org.keycloak - keycloak-core - test - - - org.awaitility - awaitility - test - - - io.smallrye.reactive - smallrye-reactive-messaging-in-memory - test - - - - - - - io.quarkus - quarkus-maven-plugin - - true - - - - - build - - - - - - org.apache.maven.plugins - maven-failsafe-plugin - - - integration-test - - integration-test - verify - - - - - - - \ No newline at end of file diff --git a/data-index/data-index-service/data-index-service-oracle/src/main/resources/application.properties b/data-index/data-index-service/data-index-service-oracle/src/main/resources/application.properties deleted file mode 100644 index 6ee6ffb0cd..0000000000 --- a/data-index/data-index-service/data-index-service-oracle/src/main/resources/application.properties +++ /dev/null @@ -1,39 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - -#Data Index -kogito.apps.persistence.type=oracle -kogito.data-index.domain-indexing=false -kogito.data-index.blocking=true - -#Kafka -quarkus.kafka.health.enabled=true - -quarkus.datasource.db-kind=oracle - -#Hibernate -quarkus.hibernate-orm.jdbc.timezone=UTC -quarkus.hibernate-orm.physical-naming-strategy=org.hibernate.boot.model.naming.CamelCaseToUnderscoresNamingStrategy -# Normalizing timezones storage as Hibernate ORM 5 for backwards compatibility. -quarkus.hibernate-orm.mapping.timezone.default-storage=normalize - -#Container image -quarkus.container-image.build=${quarkus.build.image:true} -quarkus.container-image.group=org.kie.kogito -quarkus.jib.jvm-arguments=-Dquarkus.http.port=8080 diff --git a/data-index/data-index-service/data-index-service-oracle/src/test/docker/docker-compose.yml b/data-index/data-index-service/data-index-service-oracle/src/test/docker/docker-compose.yml deleted file mode 100644 index 25578f35ed..0000000000 --- a/data-index/data-index-service/data-index-service-oracle/src/test/docker/docker-compose.yml +++ /dev/null @@ -1,71 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - -version: "3" - -networks: - default: - driver: bridge - enable_ipv6: false - ipam: - config: - - subnet: 172.16.57.0/24 - -services: - zookeeper: - image: strimzi/kafka:0.20.1-kafka-2.6.0 - container_name: data-index-zookeeper - command: [ - "sh", "-c", - "bin/zookeeper-server-start.sh config/zookeeper.properties" - ] - ports: - - "2181:2181" - environment: - LOG_DIR: "/tmp/logs" - - kafka: - image: strimzi/kafka:0.20.1-kafka-2.6.0 - container_name: data-index-kafka - command: [ - "sh", "-c", - "bin/kafka-server-start.sh config/server.properties --override inter.broker.listener.name=$${KAFKA_INTER_BROKER_LISTENER_NAME} --override listener.security.protocol.map=$${KAFKA_LISTENER_SECURITY_PROTOCOL_MAP} --override listeners=$${KAFKA_LISTENERS} --override advertised.listeners=$${KAFKA_ADVERTISED_LISTENERS} --override zookeeper.connect=$${KAFKA_ZOOKEEPER_CONNECT}" - ] - depends_on: - - zookeeper - ports: - - "9092:9092" - environment: - KAFKA_BROKER_ID: 0 - KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181 - KAFKA_LISTENERS: INTERNAL://kafka:29092,EXTERNAL://kafka:9092 - KAFKA_ADVERTISED_LISTENERS: INTERNAL://kafka:29092,EXTERNAL://localhost:9092 - KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: INTERNAL:PLAINTEXT,EXTERNAL:PLAINTEXT - KAFKA_INTER_BROKER_LISTENER_NAME: INTERNAL - KAFKA_AUTO_CREATE_TOPICS_ENABLE: "true" - KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1 - LOG_DIR: "/tmp/logs" - - oracle: - image: gvenzl/oracle-xe:21.3.0-slim - container_name: data-index-oracle - environment: - ORACLE_PASSWORD: test - ports: - - 1521:1521 diff --git a/data-index/data-index-service/data-index-service-oracle/src/test/java/org/kie/kogito/index/service/graphql/OracleDateTimeCoercingTest.java b/data-index/data-index-service/data-index-service-oracle/src/test/java/org/kie/kogito/index/service/graphql/OracleDateTimeCoercingTest.java deleted file mode 100644 index 92148ad792..0000000000 --- a/data-index/data-index-service/data-index-service-oracle/src/test/java/org/kie/kogito/index/service/graphql/OracleDateTimeCoercingTest.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.kogito.index.service.graphql; - -import java.time.ZonedDateTime; - -import org.junit.jupiter.api.Test; -import org.kie.kogito.index.graphql.OracleDateTimeCoercing; - -import graphql.language.StringValue; -import graphql.schema.CoercingSerializeException; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.fail; - -public class OracleDateTimeCoercingTest { - - OracleDateTimeCoercing dateTimeCoercing = new OracleDateTimeCoercing(); - - @Test - public void testParseValueAsZonedDateTime() { - assertThat(dateTimeCoercing.parseValue(null)).isNull(); - assertThat(dateTimeCoercing.parseValue("2019-11-20T03:14:03.075Z")) - .isEqualTo(ZonedDateTime.parse("2019-11-20T03:14:03.075Z")); - } - - @Test - public void testParseLiteral() { - assertThat(dateTimeCoercing.parseLiteral(null)).isNull(); - assertThat(dateTimeCoercing.parseLiteral(new StringValue("2019-11-20T03:14:03.075Z"))) - .isEqualTo(ZonedDateTime.parse("2019-11-20T03:14:03.075Z")); - } - - @Test - public void testSerializeInvalidString() { - try { - dateTimeCoercing.serialize("test"); - fail("Method should throw CoercingSerializeException"); - } catch (CoercingSerializeException ex) { - assertThat(ex.getMessage()) - .isEqualTo("Invalid ISO-8601 value : 'test'. because of : 'Text 'test' could not be parsed at index 0'"); - } - } - - @Test - public void testSerializeNull() { - try { - dateTimeCoercing.serialize(null); - fail("Method should throw CoercingSerializeException"); - } catch (CoercingSerializeException ex) { - assertThat(ex.getMessage()) - .isEqualTo("Expected something we can convert to 'java.time.ZonedDateTime' but was 'null'."); - } - } - - @Test - public void testSerializeInvalidType() { - try { - dateTimeCoercing.serialize(1); - fail("Method should throw CoercingSerializeException"); - } catch (CoercingSerializeException ex) { - assertThat(ex.getMessage()) - .isEqualTo("Expected something we can convert to 'java.time.ZonedDateTime' but was 'java.lang.Integer'."); - } - } - - @Test - public void testSerializeString() { - String result = dateTimeCoercing.serialize("2019-08-20T19:26:02.092+00:00"); - assertThat(result).isEqualTo("2019-08-20T19:26:02.092Z"); - } - -} diff --git a/data-index/data-index-service/data-index-service-oracle/src/test/java/org/kie/kogito/index/service/messaging/OracleMessagingLoadKafkaIT.java b/data-index/data-index-service/data-index-service-oracle/src/test/java/org/kie/kogito/index/service/messaging/OracleMessagingLoadKafkaIT.java deleted file mode 100644 index c36e54f125..0000000000 --- a/data-index/data-index-service/data-index-service-oracle/src/test/java/org/kie/kogito/index/service/messaging/OracleMessagingLoadKafkaIT.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.kogito.index.service.messaging; - -import org.junit.jupiter.api.Disabled; -import org.kie.kogito.index.service.test.KafkaMessageTestProfile; - -import io.quarkus.test.junit.QuarkusTest; -import io.quarkus.test.junit.TestProfile; - -@QuarkusTest -@TestProfile(KafkaMessageTestProfile.class) -@Disabled -class OracleMessagingLoadKafkaIT extends AbstractMessagingLoadKafkaIT { - -} diff --git a/data-index/data-index-service/data-index-service-oracle/src/test/java/org/kie/kogito/index/service/test/InMemoryMessageTestProfile.java b/data-index/data-index-service/data-index-service-oracle/src/test/java/org/kie/kogito/index/service/test/InMemoryMessageTestProfile.java deleted file mode 100644 index 27bfc31fb6..0000000000 --- a/data-index/data-index-service/data-index-service-oracle/src/test/java/org/kie/kogito/index/service/test/InMemoryMessageTestProfile.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.kogito.index.service.test; - -import java.util.Arrays; -import java.util.List; - -import org.kie.kogito.testcontainers.quarkus.OracleSqlQuarkusTestResource; - -import io.quarkus.test.junit.QuarkusTestProfile; - -public class InMemoryMessageTestProfile implements QuarkusTestProfile { - - @Override - public List testResources() { - return Arrays.asList( - new TestResourceEntry(InMemoryMessagingTestResource.class), - new TestResourceEntry(OracleSqlQuarkusTestResource.class)); - } -} diff --git a/data-index/data-index-service/data-index-service-oracle/src/test/java/org/kie/kogito/index/service/test/KafkaMessageTestProfile.java b/data-index/data-index-service/data-index-service-oracle/src/test/java/org/kie/kogito/index/service/test/KafkaMessageTestProfile.java deleted file mode 100644 index babcab6b20..0000000000 --- a/data-index/data-index-service/data-index-service-oracle/src/test/java/org/kie/kogito/index/service/test/KafkaMessageTestProfile.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.kogito.index.service.test; - -import java.util.Arrays; -import java.util.List; - -import org.kie.kogito.testcontainers.quarkus.KafkaQuarkusTestResource; -import org.kie.kogito.testcontainers.quarkus.OracleSqlQuarkusTestResource; - -import io.quarkus.test.junit.QuarkusTestProfile; - -public class KafkaMessageTestProfile implements QuarkusTestProfile { - - @Override - public List testResources() { - return Arrays.asList( - new TestResourceEntry(OracleSqlQuarkusTestResource.class), - new TestResourceEntry(KafkaQuarkusTestResource.class)); - } - - @Override - public String getConfigProfile() { - return "kafka-events-support"; - } -} diff --git a/data-index/data-index-service/data-index-service-oracle/src/test/java/org/kie/kogito/index/service/test/KeycloakTestProfile.java b/data-index/data-index-service/data-index-service-oracle/src/test/java/org/kie/kogito/index/service/test/KeycloakTestProfile.java deleted file mode 100644 index f171568214..0000000000 --- a/data-index/data-index-service/data-index-service-oracle/src/test/java/org/kie/kogito/index/service/test/KeycloakTestProfile.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.kogito.index.service.test; - -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.kie.kogito.testcontainers.quarkus.KeycloakQuarkusTestResource; -import org.kie.kogito.testcontainers.quarkus.OracleSqlQuarkusTestResource; - -import io.quarkus.test.junit.QuarkusTestProfile; - -import static java.util.Collections.singletonMap; -import static org.kie.kogito.testcontainers.quarkus.KeycloakQuarkusTestResource.KOGITO_OIDC_TENANTS; - -public class KeycloakTestProfile implements QuarkusTestProfile { - - @Override - public Map getConfigOverrides() { - Map config = new HashMap<>(); - config.put("quarkus.http.auth.policy.role-policy1.roles-allowed", "confidential"); - config.put("quarkus.http.auth.permission.roles1.paths", "/*"); - config.put("quarkus.http.auth.permission.roles1.policy", "role-policy1"); - return config; - } - - @Override - public String getConfigProfile() { - return "keycloak-test"; - } - - @Override - public List testResources() { - Map args = singletonMap(KOGITO_OIDC_TENANTS, "web-app-tenant"); - return Arrays.asList( - new TestResourceEntry(OracleSqlQuarkusTestResource.class), - new TestResourceEntry(InMemoryMessagingTestResource.class), - new TestResourceEntry(KeycloakQuarkusTestResource.class, args)); - } - -} diff --git a/data-index/data-index-service/data-index-service-oracle/src/test/resources/application.properties b/data-index/data-index-service/data-index-service-oracle/src/test/resources/application.properties deleted file mode 100644 index 1e250e5239..0000000000 --- a/data-index/data-index-service/data-index-service-oracle/src/test/resources/application.properties +++ /dev/null @@ -1,63 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - -#Data Index -kogito.apps.persistence.type=oracle -kogito.data-index.domain-indexing=false -kogito.data-index.blocking=true -kogito.data-index.vertx-graphql.ui.path=/graphiql -kogito.data-index.vertx-graphql.ui.tenant=web-app-tenant - -#Flyway -quarkus.flyway.migrate-at-start=true -quarkus.flyway.baseline-on-migrate=true - -# Kafka -kafka.bootstrap.servers=localhost:9092 -# Persistence -quarkus.datasource.db-kind=oracle -quarkus.datasource.username=test -quarkus.datasource.password=test -quarkus.datasource.jdbc.url=jdbc:oracle://localhost:1521/XEPDB1 - -#Hibernate -quarkus.hibernate-orm.jdbc.timezone=UTC -quarkus.hibernate-orm.database.generation.halt-on-error=true -quarkus.hibernate-orm.physical-naming-strategy=org.hibernate.boot.model.naming.CamelCaseToUnderscoresNamingStrategy - -# Security -quarkus.oidc.enabled=false -quarkus.oidc.tenant-enabled=false -quarkus.oidc.auth-server-url=none - -# Keycloak oidc -%keycloak-test.quarkus.oidc.enabled=true -%keycloak-test.quarkus.oidc.tenant-enabled=true -#%keycloak-test.quarkus.oidc.auth-server-url=http://localhost:8281/auth/realms/kogito -%keycloak-test.quarkus.oidc.client-id=kogito-app -%keycloak-test.quarkus.oidc.credentials.secret=secret -%keycloak-test.quarkus.oidc.application-type=service - -#%keycloak-test.quarkus.oidc.web-app-tenant.auth-server-url=http://localhost:8281/auth/realms/kogito -%keycloak-test.quarkus.oidc.web-app-tenant.client-id=kogito-app -%keycloak-test.quarkus.oidc.web-app-tenant.credentials.secret=secret -%keycloak-test.quarkus.oidc.web-app-tenant.application-type=web-app - -# Not using Dev service in test, but rather org.kie.kogito.testcontainers.quarkus.KeycloakQuarkusTestResource -quarkus.keycloak.devservices.enabled=false diff --git a/data-index/data-index-service/data-index-service-postgresql/src/main/resources/application.properties b/data-index/data-index-service/data-index-service-postgresql/src/main/resources/application.properties index ac4d1958d9..10ce0cd969 100644 --- a/data-index/data-index-service/data-index-service-postgresql/src/main/resources/application.properties +++ b/data-index/data-index-service/data-index-service-postgresql/src/main/resources/application.properties @@ -39,9 +39,3 @@ quarkus.hibernate-orm.physical-naming-strategy=org.hibernate.boot.model.naming.C quarkus.container-image.build=${quarkus.build.image:true} quarkus.container-image.group=org.kie.kogito quarkus.jib.jvm-arguments=-Dquarkus.http.port=8080 - -quarkus.log.console.enable=true -quarkus.log.console.level=INFO -quarkus.log.level=INFO -quarkus.log.category."org.kie.kogito.index".level=INFO -quarkus.log.category."org.kie.kogito.index".min-level=INFO diff --git a/data-index/data-index-service/data-index-service-postgresql/src/test/java/org/kie/kogito/index/service/graphql/PostgreSqlDateTimeCoercingTest.java b/data-index/data-index-service/data-index-service-postgresql/src/test/java/org/kie/kogito/index/service/graphql/PostgreSqlDateTimeCoercingTest.java deleted file mode 100644 index 9ac63e7352..0000000000 --- a/data-index/data-index-service/data-index-service-postgresql/src/test/java/org/kie/kogito/index/service/graphql/PostgreSqlDateTimeCoercingTest.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.kogito.index.service.graphql; - -import java.time.ZonedDateTime; - -import org.junit.jupiter.api.Test; -import org.kie.kogito.index.graphql.PostgreSqlDateTimeCoercing; - -import graphql.language.StringValue; -import graphql.schema.CoercingSerializeException; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.fail; - -public class PostgreSqlDateTimeCoercingTest { - - PostgreSqlDateTimeCoercing dateTimeCoercing = new PostgreSqlDateTimeCoercing(); - - @Test - public void testParseValueAsZonedDateTime() { - assertThat(dateTimeCoercing.parseValue(null)).isNull(); - assertThat(dateTimeCoercing.parseValue("2019-11-20T03:14:03.075Z")) - .isEqualTo(ZonedDateTime.parse("2019-11-20T03:14:03.075Z")); - } - - @Test - public void testParseLiteral() { - assertThat(dateTimeCoercing.parseLiteral(null)).isNull(); - assertThat(dateTimeCoercing.parseLiteral(new StringValue("2019-11-20T03:14:03.075Z"))) - .isEqualTo(ZonedDateTime.parse("2019-11-20T03:14:03.075Z")); - } - - @Test - public void testSerializeInvalidString() { - try { - dateTimeCoercing.serialize("test"); - fail("Method should throw CoercingSerializeException"); - } catch (CoercingSerializeException ex) { - assertThat(ex.getMessage()) - .isEqualTo("Invalid ISO-8601 value : 'test'. because of : 'Text 'test' could not be parsed at index 0'"); - } - } - - @Test - public void testSerializeNull() { - try { - dateTimeCoercing.serialize(null); - fail("Method should throw CoercingSerializeException"); - } catch (CoercingSerializeException ex) { - assertThat(ex.getMessage()) - .isEqualTo("Expected something we can convert to 'java.time.ZonedDateTime' but was 'null'."); - } - } - - @Test - public void testSerializeInvalidType() { - try { - dateTimeCoercing.serialize(1); - fail("Method should throw CoercingSerializeException"); - } catch (CoercingSerializeException ex) { - assertThat(ex.getMessage()) - .isEqualTo("Expected something we can convert to 'java.time.ZonedDateTime' but was 'java.lang.Integer'."); - } - } - - @Test - public void testSerializeString() { - String result = dateTimeCoercing.serialize("2019-08-20T19:26:02.092+00:00"); - assertThat(result).isEqualTo("2019-08-20T19:26:02.092Z"); - } - -} diff --git a/data-index/data-index-service/pom.xml b/data-index/data-index-service/pom.xml index 48be5911aa..cdc2c04d47 100644 --- a/data-index/data-index-service/pom.xml +++ b/data-index/data-index-service/pom.xml @@ -37,7 +37,6 @@ data-index-service-postgresql data-index-service-infinispan data-index-service-mongodb - data-index-service-oracle diff --git a/data-index/data-index-storage/data-index-storage-api/src/main/java/org/kie/kogito/index/model/ProcessDefinition.java b/data-index/data-index-storage/data-index-storage-api/src/main/java/org/kie/kogito/index/model/ProcessDefinition.java index 200d4347f8..e6e2450ea0 100644 --- a/data-index/data-index-storage/data-index-storage-api/src/main/java/org/kie/kogito/index/model/ProcessDefinition.java +++ b/data-index/data-index-storage/data-index-storage-api/src/main/java/org/kie/kogito/index/model/ProcessDefinition.java @@ -21,9 +21,7 @@ import java.util.List; import java.util.Map; import java.util.Objects; -import java.util.Optional; import java.util.Set; -import java.util.regex.Pattern; public class ProcessDefinition { @@ -112,18 +110,6 @@ public void setNodes(List nodes) { this.nodes = nodes; } - public String getKey() { - return toKey(id, version); - } - - public static String toKey(String processId, String version) { - return processId + "$v:" + version; - } - - public static String[] fromKey(String key) { - return Optional.ofNullable(key).map(k -> k.split(Pattern.quote("$v:"))).orElse(new String[0]); - } - public String getDescription() { return description; } @@ -176,5 +162,4 @@ public String toString() { ", nodes='" + nodes + '\'' + '}'; } - } diff --git a/data-index/data-index-storage/data-index-storage-jpa/src/main/java/org/kie/kogito/index/jpa/model/ProcessDefinitionEntityId.java b/data-index/data-index-storage/data-index-storage-api/src/main/java/org/kie/kogito/index/model/ProcessDefinitionKey.java similarity index 52% rename from data-index/data-index-storage/data-index-storage-jpa/src/main/java/org/kie/kogito/index/jpa/model/ProcessDefinitionEntityId.java rename to data-index/data-index-storage/data-index-storage-api/src/main/java/org/kie/kogito/index/model/ProcessDefinitionKey.java index 28f61990f5..a850f9efd8 100644 --- a/data-index/data-index-storage/data-index-storage-jpa/src/main/java/org/kie/kogito/index/jpa/model/ProcessDefinitionEntityId.java +++ b/data-index/data-index-storage/data-index-storage-api/src/main/java/org/kie/kogito/index/model/ProcessDefinitionKey.java @@ -16,74 +16,53 @@ * specific language governing permissions and limitations * under the License. */ -package org.kie.kogito.index.jpa.model; +package org.kie.kogito.index.model; -import java.io.Serializable; import java.util.Objects; -import static org.kie.kogito.index.model.ProcessDefinition.fromKey; -import static org.kie.kogito.index.model.ProcessDefinition.toKey; - -public class ProcessDefinitionEntityId implements Serializable { +public class ProcessDefinitionKey { private String id; - private String version; - public ProcessDefinitionEntityId() { - } - - public ProcessDefinitionEntityId(String key) { - String[] fromKey = fromKey(key); - this.id = fromKey[0]; - this.version = fromKey[1]; - } - - public ProcessDefinitionEntityId(String id, String version) { + public ProcessDefinitionKey(String id, String version) { this.id = id; this.version = version; } - public String getKey() { - return toKey(id, version); - } - public String getId() { return id; } - public void setId(String id) { - this.id = id; - } - public String getVersion() { return version; } - public void setVersion(String version) { - this.version = version; + @Override + public int hashCode() { + return Objects.hash(id, version); } @Override - public boolean equals(Object o) { - if (this == o) + public boolean equals(Object obj) { + if (this == obj) { return true; - if (o == null || getClass() != o.getClass()) + } + if (!(obj instanceof ProcessDefinitionKey)) { return false; - ProcessDefinitionEntityId that = (ProcessDefinitionEntityId) o; - return Objects.equals(id, that.id) && Objects.equals(version, that.version); + } + ProcessDefinitionKey other = (ProcessDefinitionKey) obj; + return Objects.equals(id, other.id) && Objects.equals(version, other.version); } @Override - public int hashCode() { - return Objects.hash(id, version); + public String toString() { + return "ProcessDefinitionKey [id=" + id + ", version=" + version + "]"; } - @Override - public String toString() { - return "ProcessDefinitionEntityId{" + - "id='" + id + '\'' + - ", version='" + version + '\'' + - '}'; + @SuppressWarnings("unused") + private ProcessDefinitionKey() { + // needed by external tools } + } diff --git a/data-index/data-index-storage/data-index-storage-api/src/main/java/org/kie/kogito/index/storage/DataIndexStorageService.java b/data-index/data-index-storage/data-index-storage-api/src/main/java/org/kie/kogito/index/storage/DataIndexStorageService.java index 5e8995d08c..43c951fd83 100644 --- a/data-index/data-index-storage/data-index-storage-api/src/main/java/org/kie/kogito/index/storage/DataIndexStorageService.java +++ b/data-index/data-index-storage/data-index-storage-api/src/main/java/org/kie/kogito/index/storage/DataIndexStorageService.java @@ -20,13 +20,14 @@ import org.kie.kogito.index.model.Job; import org.kie.kogito.index.model.ProcessDefinition; +import org.kie.kogito.index.model.ProcessDefinitionKey; import org.kie.kogito.persistence.api.Storage; import com.fasterxml.jackson.databind.node.ObjectNode; public interface DataIndexStorageService { - Storage getProcessDefinitionStorage(); + Storage getProcessDefinitionStorage(); ProcessInstanceStorage getProcessInstanceStorage(); diff --git a/data-index/data-index-storage/data-index-storage-api/src/test/java/org/kie/kogito/index/test/QueryTestBase.java b/data-index/data-index-storage/data-index-storage-api/src/test/java/org/kie/kogito/index/test/QueryTestBase.java index c2a654df8e..5e25817c65 100644 --- a/data-index/data-index-storage/data-index-storage-api/src/test/java/org/kie/kogito/index/test/QueryTestBase.java +++ b/data-index/data-index-storage/data-index-storage-api/src/test/java/org/kie/kogito/index/test/QueryTestBase.java @@ -34,8 +34,8 @@ protected Boolean isDateTimeAsLong() { return true; } - public void queryAndAssert(BiConsumer, String[]> assertConsumer, StorageFetcher storage, List> filters, List sort, Integer offset, Integer limit, - String... ids) { + public void queryAndAssert(BiConsumer, K[]> assertConsumer, StorageFetcher storage, List> filters, List sort, Integer offset, Integer limit, + K... ids) { assertConsumer.accept(storage.query().filter(filters).sort(sort).offset(offset).limit(limit).execute(), ids); } diff --git a/data-index/data-index-storage/data-index-storage-api/src/test/java/org/kie/kogito/index/test/query/AbstractProcessDefinitionQueryIT.java b/data-index/data-index-storage/data-index-storage-api/src/test/java/org/kie/kogito/index/test/query/AbstractProcessDefinitionQueryIT.java index dc0bd2de9a..a6e61fc01f 100644 --- a/data-index/data-index-storage/data-index-storage-api/src/test/java/org/kie/kogito/index/test/query/AbstractProcessDefinitionQueryIT.java +++ b/data-index/data-index-storage/data-index-storage-api/src/test/java/org/kie/kogito/index/test/query/AbstractProcessDefinitionQueryIT.java @@ -22,8 +22,10 @@ import java.util.Set; import java.util.function.BiConsumer; +import org.assertj.core.groups.Tuple; import org.junit.jupiter.api.Test; import org.kie.kogito.index.model.ProcessDefinition; +import org.kie.kogito.index.model.ProcessDefinitionKey; import org.kie.kogito.index.test.QueryTestBase; import org.kie.kogito.index.test.TestUtils; import org.kie.kogito.persistence.api.Storage; @@ -41,34 +43,37 @@ import static org.kie.kogito.persistence.api.query.QueryFilterFactory.notNull; import static org.kie.kogito.persistence.api.query.QueryFilterFactory.orderBy; -public abstract class AbstractProcessDefinitionQueryIT extends QueryTestBase { +public abstract class AbstractProcessDefinitionQueryIT extends QueryTestBase { - public abstract Storage getStorage(); + public abstract Storage getStorage(); @Test void testProcessDefinitionQuery() { String processId = "travels"; ProcessDefinition pdv1 = TestUtils.createProcessDefinition(processId, "1.0", Set.of("admin", "kogito")); - Storage storage = getStorage(); - storage.put(pdv1.getKey(), pdv1); + Storage storage = getStorage(); + ProcessDefinitionKey pdv1Key = new ProcessDefinitionKey(pdv1.getId(), pdv1.getVersion()); + storage.put(pdv1Key, pdv1); ProcessDefinition pdv2 = TestUtils.createProcessDefinition(processId, "2.0", Set.of("kogito")); - storage.put(pdv2.getKey(), pdv2); + ProcessDefinitionKey pdv2Key = new ProcessDefinitionKey(pdv2.getId(), pdv2.getVersion()); + storage.put(pdv2Key, pdv2); - queryAndAssert(assertWithKey(), storage, singletonList(isNull("type")), null, null, null, pdv1.getKey(), pdv2.getKey()); - queryAndAssert(assertWithKey(), storage, singletonList(notNull("version")), null, null, null, pdv1.getKey(), pdv2.getKey()); - queryAndAssert(assertWithKey(), storage, singletonList(equalTo("version", pdv1.getVersion())), null, null, null, pdv1.getKey()); - queryAndAssert(assertWithKey(), storage, singletonList(contains("roles", "admin")), null, null, null, pdv1.getKey()); - queryAndAssert(assertWithKey(), storage, singletonList(containsAny("roles", asList("admin", "kogito"))), null, null, null, pdv1.getKey(), pdv2.getKey()); - queryAndAssert(assertWithKey(), storage, singletonList(containsAll("roles", asList("admin", "kogito"))), null, null, null, pdv1.getKey()); + queryAndAssert(assertWithKey(), storage, singletonList(isNull("type")), null, null, null, pdv1Key, pdv2Key); + queryAndAssert(assertWithKey(), storage, singletonList(notNull("version")), null, null, null, pdv1Key, pdv2Key); + queryAndAssert(assertWithKey(), storage, singletonList(equalTo("version", pdv1.getVersion())), null, null, null, pdv1Key); + queryAndAssert(assertWithKey(), storage, singletonList(contains("roles", "admin")), null, null, null, pdv1Key); + queryAndAssert(assertWithKey(), storage, singletonList(containsAny("roles", asList("admin", "kogito"))), null, null, null, pdv1Key, pdv2Key); + queryAndAssert(assertWithKey(), storage, singletonList(containsAll("roles", asList("admin", "kogito"))), null, null, null, pdv1Key); queryAndAssert(assertWithKey(), storage, asList(in("id", asList(pdv1.getId(), pdv2.getId())), in("version", asList(pdv1.getVersion(), pdv2.getVersion()))), - singletonList(orderBy("version", SortDirection.ASC)), 1, 1, pdv2.getKey()); + singletonList(orderBy("version", SortDirection.ASC)), 1, 1, pdv2Key); queryAndAssert(assertWithKey(), storage, null, singletonList(orderBy("version", SortDirection.DESC)), null, - null, pdv2.getKey(), pdv1.getKey()); + null, pdv2Key, pdv1Key); } - public static BiConsumer, String[]> assertWithKey() { - return (instances, ids) -> assertThat(instances).hasSize(ids == null ? 0 : ids.length).extracting("key").containsExactly(ids); + public static BiConsumer, ProcessDefinitionKey[]> assertWithKey() { + return (instances, ids) -> assertThat(instances).hasSize(ids == null ? 0 : ids.length).extracting("id", "version").map(Tuple::toArray) + .map(objs -> new ProcessDefinitionKey((String) objs[0], (String) objs[1])).containsExactly(ids); } } diff --git a/data-index/data-index-storage/data-index-storage-common/src/main/java/org/kie/kogito/index/storage/ModelDataIndexStorageService.java b/data-index/data-index-storage/data-index-storage-common/src/main/java/org/kie/kogito/index/storage/ModelDataIndexStorageService.java index 007ecb51c0..693928d991 100644 --- a/data-index/data-index-storage/data-index-storage-common/src/main/java/org/kie/kogito/index/storage/ModelDataIndexStorageService.java +++ b/data-index/data-index-storage/data-index-storage-common/src/main/java/org/kie/kogito/index/storage/ModelDataIndexStorageService.java @@ -20,6 +20,7 @@ import org.kie.kogito.index.model.Job; import org.kie.kogito.index.model.ProcessDefinition; +import org.kie.kogito.index.model.ProcessDefinitionKey; import org.kie.kogito.index.model.ProcessInstance; import org.kie.kogito.index.model.UserTaskInstance; import org.kie.kogito.persistence.api.Storage; @@ -43,8 +44,8 @@ public class ModelDataIndexStorageService implements DataIndexStorageService { StorageService storageService; @Override - public Storage getProcessDefinitionStorage() { - return storageService.getCache(PROCESS_DEFINITIONS_STORAGE, ProcessDefinition.class); + public Storage getProcessDefinitionStorage() { + return new ModelProcessDefinitionStorage(storageService.getCache(PROCESS_DEFINITIONS_STORAGE, ProcessDefinition.class)); } @Override diff --git a/data-index/data-index-storage/data-index-storage-common/src/main/java/org/kie/kogito/index/storage/ModelProcessDefinitionStorage.java b/data-index/data-index-storage/data-index-storage-common/src/main/java/org/kie/kogito/index/storage/ModelProcessDefinitionStorage.java new file mode 100644 index 0000000000..5462c4df08 --- /dev/null +++ b/data-index/data-index-storage/data-index-storage-common/src/main/java/org/kie/kogito/index/storage/ModelProcessDefinitionStorage.java @@ -0,0 +1,73 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.kie.kogito.index.storage; + +import java.util.Map; +import java.util.Map.Entry; +import java.util.stream.Collectors; + +import org.kie.kogito.index.model.ProcessDefinition; +import org.kie.kogito.index.model.ProcessDefinitionKey; +import org.kie.kogito.persistence.api.Storage; + +public class ModelProcessDefinitionStorage extends ModelStorageFetcher implements Storage { + + private static final String VERSION_SEPARATOR = "$v:"; + + static ProcessDefinitionKey fromString(String key) { + int indexOf = key.indexOf(VERSION_SEPARATOR); + return indexOf == -1 ? new ProcessDefinitionKey(key, null) + : new ProcessDefinitionKey(key.substring(0, indexOf), key.substring(indexOf + VERSION_SEPARATOR.length())); + } + + static String toString(ProcessDefinitionKey key) { + String id = key.getId(); + String version = key.getVersion(); + return version == null ? id : id + VERSION_SEPARATOR + version; + } + + public ModelProcessDefinitionStorage(Storage storage) { + super(storage, ModelProcessDefinitionStorage::toString, ModelProcessDefinitionStorage::fromString); + } + + @Override + public ProcessDefinition put(ProcessDefinitionKey key, ProcessDefinition value) { + return storage.put(toString(key), value); + } + + @Override + public ProcessDefinition remove(ProcessDefinitionKey key) { + return storage.remove(toString(key)); + } + + @Override + public boolean containsKey(ProcessDefinitionKey key) { + return storage.containsKey(toString(key)); + } + + @Override + public Map entries() { + return storage.entries().entrySet().stream().collect(Collectors.toMap(e -> fromString(e.getKey()), Entry::getValue)); + } + + @Override + public String getRootType() { + return ProcessDefinition.class.getName(); + } +} diff --git a/data-index/data-index-storage/data-index-storage-common/src/main/java/org/kie/kogito/index/storage/ModelProcessInstanceStorage.java b/data-index/data-index-storage/data-index-storage-common/src/main/java/org/kie/kogito/index/storage/ModelProcessInstanceStorage.java index 52c8b56892..9f21497fc2 100644 --- a/data-index/data-index-storage/data-index-storage-common/src/main/java/org/kie/kogito/index/storage/ModelProcessInstanceStorage.java +++ b/data-index/data-index-storage/data-index-storage-common/src/main/java/org/kie/kogito/index/storage/ModelProcessInstanceStorage.java @@ -1,3 +1,21 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ package org.kie.kogito.index.storage; import org.kie.kogito.event.process.ProcessInstanceDataEvent; @@ -15,7 +33,7 @@ import org.kie.kogito.index.storage.merger.ProcessInstanceVariableDataEventMerger; import org.kie.kogito.persistence.api.Storage; -public class ModelProcessInstanceStorage extends ModelStorageFetcher implements ProcessInstanceStorage { +public class ModelProcessInstanceStorage extends ModelStorageFetcher implements ProcessInstanceStorage { private final ProcessInstanceErrorDataEventMerger errorMerger = new ProcessInstanceErrorDataEventMerger(); private final ProcessInstanceNodeDataEventMerger nodeMerger = new ProcessInstanceNodeDataEventMerger(); private final ProcessInstanceSLADataEventMerger slaMerger = new ProcessInstanceSLADataEventMerger(); diff --git a/data-index/data-index-storage/data-index-storage-common/src/main/java/org/kie/kogito/index/storage/ModelStorageFetcher.java b/data-index/data-index-storage/data-index-storage-common/src/main/java/org/kie/kogito/index/storage/ModelStorageFetcher.java index cbadc33c59..8ea6b833d4 100644 --- a/data-index/data-index-storage/data-index-storage-common/src/main/java/org/kie/kogito/index/storage/ModelStorageFetcher.java +++ b/data-index/data-index-storage/data-index-storage-common/src/main/java/org/kie/kogito/index/storage/ModelStorageFetcher.java @@ -1,17 +1,46 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ package org.kie.kogito.index.storage; +import java.util.function.Function; + import org.kie.kogito.persistence.api.Storage; import org.kie.kogito.persistence.api.StorageFetcher; import org.kie.kogito.persistence.api.query.Query; import io.smallrye.mutiny.Multi; -public abstract class ModelStorageFetcher implements StorageFetcher { +public abstract class ModelStorageFetcher implements StorageFetcher { protected final Storage storage; + private final Function toString; + private final Function fromString; + public ModelStorageFetcher(Storage storage) { + this(storage, Object::toString, s -> (K) s); + } + + public ModelStorageFetcher(Storage storage, Function toString, Function fromString) { this.storage = storage; + this.toString = toString; + this.fromString = fromString; } @Override @@ -25,8 +54,8 @@ public Multi objectUpdatedListener() { } @Override - public Multi objectRemovedListener() { - return storage.objectRemovedListener(); + public Multi objectRemovedListener() { + return storage.objectRemovedListener().map(fromString); } @Override @@ -35,8 +64,8 @@ public Query query() { } @Override - public V get(String key) { - return storage.get(key); + public V get(K key) { + return storage.get(toString.apply(key)); } @Override diff --git a/data-index/data-index-storage/data-index-storage-common/src/main/java/org/kie/kogito/index/storage/ModelUserTaskInstanceStorage.java b/data-index/data-index-storage/data-index-storage-common/src/main/java/org/kie/kogito/index/storage/ModelUserTaskInstanceStorage.java index d5a46917a7..20f98a396c 100644 --- a/data-index/data-index-storage/data-index-storage-common/src/main/java/org/kie/kogito/index/storage/ModelUserTaskInstanceStorage.java +++ b/data-index/data-index-storage/data-index-storage-common/src/main/java/org/kie/kogito/index/storage/ModelUserTaskInstanceStorage.java @@ -1,3 +1,21 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ package org.kie.kogito.index.storage; import java.util.ArrayList; @@ -19,7 +37,7 @@ import org.kie.kogito.index.storage.merger.UserTaskInstanceVariableDataEventMerger; import org.kie.kogito.persistence.api.Storage; -public class ModelUserTaskInstanceStorage extends ModelStorageFetcher implements UserTaskInstanceStorage { +public class ModelUserTaskInstanceStorage extends ModelStorageFetcher implements UserTaskInstanceStorage { private final UserTaskInstanceAssignmentDataEventMerger assignmentMerger = new UserTaskInstanceAssignmentDataEventMerger(); private final UserTaskInstanceAttachmentDataEventMerger attachmentMerger = new UserTaskInstanceAttachmentDataEventMerger(); diff --git a/data-index/data-index-storage/data-index-storage-common/src/main/java/org/kie/kogito/index/storage/merger/ProcessInstanceErrorDataEventMerger.java b/data-index/data-index-storage/data-index-storage-common/src/main/java/org/kie/kogito/index/storage/merger/ProcessInstanceErrorDataEventMerger.java index 6466c4e719..3408a7247d 100644 --- a/data-index/data-index-storage/data-index-storage-common/src/main/java/org/kie/kogito/index/storage/merger/ProcessInstanceErrorDataEventMerger.java +++ b/data-index/data-index-storage/data-index-storage-common/src/main/java/org/kie/kogito/index/storage/merger/ProcessInstanceErrorDataEventMerger.java @@ -20,6 +20,7 @@ import org.kie.kogito.event.process.ProcessInstanceDataEvent; import org.kie.kogito.event.process.ProcessInstanceErrorDataEvent; +import org.kie.kogito.index.CommonUtils; import org.kie.kogito.index.model.ProcessInstance; import org.kie.kogito.index.model.ProcessInstanceError; @@ -30,12 +31,13 @@ public class ProcessInstanceErrorDataEventMerger extends ProcessInstanceEventMer @Override public ProcessInstance merge(ProcessInstance pi, ProcessInstanceDataEvent data) { - pi = getOrNew(pi, data); ProcessInstanceErrorDataEvent event = (ProcessInstanceErrorDataEvent) data; + pi = getOrNew(pi, data, event.getData().getEventDate()); ProcessInstanceError error = new ProcessInstanceError(); error.setMessage(event.getData().getErrorMessage()); error.setNodeDefinitionId(event.getData().getNodeDefinitionId()); pi.setError(error); + pi.setState(CommonUtils.ERROR_STATE); return pi; } diff --git a/data-index/data-index-storage/data-index-storage-common/src/main/java/org/kie/kogito/index/storage/merger/ProcessInstanceEventMerger.java b/data-index/data-index-storage/data-index-storage-common/src/main/java/org/kie/kogito/index/storage/merger/ProcessInstanceEventMerger.java index 7da0072eb1..440d4d6c1a 100644 --- a/data-index/data-index-storage/data-index-storage-common/src/main/java/org/kie/kogito/index/storage/merger/ProcessInstanceEventMerger.java +++ b/data-index/data-index-storage/data-index-storage-common/src/main/java/org/kie/kogito/index/storage/merger/ProcessInstanceEventMerger.java @@ -19,17 +19,20 @@ package org.kie.kogito.index.storage.merger; import java.util.ArrayList; +import java.util.Date; import org.kie.kogito.event.process.ProcessInstanceDataEvent; +import org.kie.kogito.index.DateTimeUtils; import org.kie.kogito.index.model.ProcessInstance; public abstract class ProcessInstanceEventMerger implements Merger, ProcessInstance> { - protected ProcessInstance getOrNew(ProcessInstance pi, ProcessInstanceDataEvent event) { + protected ProcessInstance getOrNew(ProcessInstance pi, ProcessInstanceDataEvent event, Date date) { if (pi == null) { pi = new ProcessInstance(); pi.setId(event.getKogitoProcessInstanceId()); pi.setProcessId(event.getKogitoProcessId()); + pi.setLastUpdate(DateTimeUtils.toZonedDateTime(date)); pi.setMilestones(new ArrayList<>()); pi.setNodes(new ArrayList<>()); } diff --git a/data-index/data-index-storage/data-index-storage-common/src/main/java/org/kie/kogito/index/storage/merger/ProcessInstanceNodeDataEventMerger.java b/data-index/data-index-storage/data-index-storage-common/src/main/java/org/kie/kogito/index/storage/merger/ProcessInstanceNodeDataEventMerger.java index f3442d24b9..d800dfd226 100644 --- a/data-index/data-index-storage/data-index-storage-common/src/main/java/org/kie/kogito/index/storage/merger/ProcessInstanceNodeDataEventMerger.java +++ b/data-index/data-index-storage/data-index-storage-common/src/main/java/org/kie/kogito/index/storage/merger/ProcessInstanceNodeDataEventMerger.java @@ -47,8 +47,8 @@ public class ProcessInstanceNodeDataEventMerger extends ProcessInstanceEventMerg @Override public ProcessInstance merge(ProcessInstance pi, ProcessInstanceDataEvent data) { - pi = getOrNew(pi, data); ProcessInstanceNodeDataEvent event = (ProcessInstanceNodeDataEvent) data; + pi = getOrNew(pi, data, event.getData().getEventDate()); List nodeInstances = Optional.ofNullable(pi.getNodes()).orElse(new ArrayList<>()); diff --git a/data-index/data-index-storage/data-index-storage-common/src/main/java/org/kie/kogito/index/storage/merger/ProcessInstanceStateDataEventMerger.java b/data-index/data-index-storage/data-index-storage-common/src/main/java/org/kie/kogito/index/storage/merger/ProcessInstanceStateDataEventMerger.java index db80965403..b49036fb0c 100644 --- a/data-index/data-index-storage/data-index-storage-common/src/main/java/org/kie/kogito/index/storage/merger/ProcessInstanceStateDataEventMerger.java +++ b/data-index/data-index-storage/data-index-storage-common/src/main/java/org/kie/kogito/index/storage/merger/ProcessInstanceStateDataEventMerger.java @@ -39,8 +39,8 @@ public class ProcessInstanceStateDataEventMerger extends ProcessInstanceEventMer @Override public ProcessInstance merge(ProcessInstance pi, ProcessInstanceDataEvent data) { - pi = getOrNew(pi, data); ProcessInstanceStateDataEvent event = (ProcessInstanceStateDataEvent) data; + pi = getOrNew(pi, data, event.getData().getEventDate()); LOGGER.debug("Value before merging: {}", pi); pi.setId(event.getData().getProcessInstanceId()); pi.setVersion(event.getData().getProcessVersion()); diff --git a/data-index/data-index-storage/data-index-storage-common/src/main/java/org/kie/kogito/index/storage/merger/ProcessInstanceVariableDataEventMerger.java b/data-index/data-index-storage/data-index-storage-common/src/main/java/org/kie/kogito/index/storage/merger/ProcessInstanceVariableDataEventMerger.java index f6ae8df0a7..b536a15f08 100644 --- a/data-index/data-index-storage/data-index-storage-common/src/main/java/org/kie/kogito/index/storage/merger/ProcessInstanceVariableDataEventMerger.java +++ b/data-index/data-index-storage/data-index-storage-common/src/main/java/org/kie/kogito/index/storage/merger/ProcessInstanceVariableDataEventMerger.java @@ -18,49 +18,23 @@ */ package org.kie.kogito.index.storage.merger; -import java.util.HashMap; -import java.util.Map; - import org.kie.kogito.event.process.ProcessInstanceDataEvent; import org.kie.kogito.event.process.ProcessInstanceVariableDataEvent; import org.kie.kogito.event.process.ProcessInstanceVariableEventBody; import org.kie.kogito.index.json.JsonUtils; import org.kie.kogito.index.model.ProcessInstance; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; import jakarta.enterprise.context.ApplicationScoped; @ApplicationScoped public class ProcessInstanceVariableDataEventMerger extends ProcessInstanceEventMerger { - private static final Logger LOGGER = LoggerFactory.getLogger(ProcessInstanceVariableDataEventMerger.class); - - @SuppressWarnings("unchecked") @Override public ProcessInstance merge(ProcessInstance pi, ProcessInstanceDataEvent data) { - pi = getOrNew(pi, data); ProcessInstanceVariableDataEvent event = (ProcessInstanceVariableDataEvent) data; - try { - ProcessInstanceVariableEventBody body = event.getData(); - ObjectMapper mapper = JsonUtils.getObjectMapper(); - - Map variables = null; - if (pi.getVariables() == null) { - variables = new HashMap<>(); - } else { - variables = new HashMap<>(mapper.treeToValue(pi.getVariables(), HashMap.class)); - } - variables.put(body.getVariableName(), body.getVariableValue()); - pi.setVariables(mapper.valueToTree(variables)); - } catch (JsonProcessingException e) { - LOGGER.error("error during unmarshalling variable instance", e); - } catch (IllegalArgumentException e) { - LOGGER.error("error during merging variable instance event", e); - } + ProcessInstanceVariableEventBody body = event.getData(); + pi = getOrNew(pi, data, body.getEventDate()); + pi.setVariables(JsonUtils.mergeVariable(body.getVariableName(), body.getVariableValue(), pi.getVariables())); return pi; } } diff --git a/data-index/data-index-storage/data-index-storage-common/src/test/java/org/kie/kogito/index/storage/ModelDataIndexStorageServiceTest.java b/data-index/data-index-storage/data-index-storage-common/src/test/java/org/kie/kogito/index/storage/ModelDataIndexStorageServiceTest.java new file mode 100644 index 0000000000..64ab4b0d74 --- /dev/null +++ b/data-index/data-index-storage/data-index-storage-common/src/test/java/org/kie/kogito/index/storage/ModelDataIndexStorageServiceTest.java @@ -0,0 +1,36 @@ +package org.kie.kogito.index.storage; + +import java.util.HashSet; +import java.util.Set; + +import org.junit.jupiter.api.Test; +import org.kie.kogito.index.model.ProcessDefinitionKey; + +import static org.assertj.core.api.Assertions.assertThat; + +public class ModelDataIndexStorageServiceTest { + + @Test + void testIdAndVersion() { + assertKeyConversion(new ProcessDefinitionKey("Javierito", "1_0")); + } + + @Test + void testIdEmptyVersion() { + assertKeyConversion(new ProcessDefinitionKey("Javierito", "")); + } + + @Test + void testIdNullVersion() { + assertKeyConversion(new ProcessDefinitionKey("Javierito", null)); + } + + private void assertKeyConversion(ProcessDefinitionKey key) { + Set set = new HashSet<>(); + set.add(key); + ProcessDefinitionKey deserializedKey = ModelProcessDefinitionStorage.fromString(ModelProcessDefinitionStorage.toString(key)); + set.add(deserializedKey); + assertThat(deserializedKey).isEqualTo(key); + assertThat(set).hasSize(1); + } +} diff --git a/data-index/data-index-storage/data-index-storage-infinispan/pom.xml b/data-index/data-index-storage/data-index-storage-infinispan/pom.xml index 1fa72cc112..f0b572f156 100644 --- a/data-index/data-index-storage/data-index-storage-infinispan/pom.xml +++ b/data-index/data-index-storage/data-index-storage-infinispan/pom.xml @@ -64,8 +64,8 @@ - org.kie.kogito - kogito-addons-quarkus-persistence-infinispan-health + org.kie + kie-addons-quarkus-persistence-infinispan-health diff --git a/data-index/data-index-storage/data-index-storage-oracle/pom.xml b/data-index/data-index-storage/data-index-storage-jpa-common/pom.xml similarity index 58% rename from data-index/data-index-storage/data-index-storage-oracle/pom.xml rename to data-index/data-index-storage/data-index-storage-jpa-common/pom.xml index fa5409ddc4..d9d262ac0f 100644 --- a/data-index/data-index-storage/data-index-storage-oracle/pom.xml +++ b/data-index/data-index-storage/data-index-storage-jpa-common/pom.xml @@ -29,21 +29,30 @@ 4.0.0 - data-index-storage-oracle - Kogito Apps :: Data Index Storage Oracle DB + data-index-storage-jpa-common + Kogito Apps :: Data Index Storage JPA common classes - org.kie.kogito.index.oracle + org.kie.kogito.index.jpa.common + org.kie.kogito - data-index-storage-jpa + data-index-storage-api - io.quarkus - quarkus-jdbc-oracle + org.kie.kogito + data-index-common + + + org.kie.kogito + persistence-commons-jpa + + + org.mapstruct + mapstruct org.kie.kogito @@ -51,7 +60,7 @@ test-jar test - + io.quarkus quarkus-junit5-mockito test @@ -72,65 +81,33 @@ test + org.apache.maven.plugins - maven-failsafe-plugin + maven-compiler-plugin - - org.jboss.logmanager.LogManager - + + + org.mapstruct + mapstruct-processor + ${version.org.mapstruct} + + + + + org.apache.maven.plugins + maven-jar-plugin - test - integration-test - verify + test-jar - - - - schema - - - generate.schema - - - - - - org.codehaus.mojo - exec-maven-plugin - - - package - - exec - - - - - java - - -classpath - - - org.kie.kogito.index.oracle.schema.DDLSchemaExporter - - test - - - - - - - \ No newline at end of file diff --git a/data-index/data-index-storage/data-index-storage-jpa/src/main/java/org/kie/kogito/index/jpa/mapper/JobEntityMapper.java b/data-index/data-index-storage/data-index-storage-jpa-common/src/main/java/org/kie/kogito/index/jpa/mapper/JobEntityMapper.java similarity index 94% rename from data-index/data-index-storage/data-index-storage-jpa/src/main/java/org/kie/kogito/index/jpa/mapper/JobEntityMapper.java rename to data-index/data-index-storage/data-index-storage-jpa-common/src/main/java/org/kie/kogito/index/jpa/mapper/JobEntityMapper.java index 94aeae2d07..526f5f255d 100644 --- a/data-index/data-index-storage/data-index-storage-jpa/src/main/java/org/kie/kogito/index/jpa/mapper/JobEntityMapper.java +++ b/data-index/data-index-storage/data-index-storage-jpa-common/src/main/java/org/kie/kogito/index/jpa/mapper/JobEntityMapper.java @@ -23,7 +23,7 @@ import org.mapstruct.InheritInverseConfiguration; import org.mapstruct.Mapper; -@Mapper(componentModel = "cdi") +@Mapper(componentModel = "cdi", suppressTimestampInGenerated = true) public interface JobEntityMapper { JobEntity mapToEntity(Job job); diff --git a/data-index/data-index-storage/data-index-storage-jpa/src/main/java/org/kie/kogito/index/jpa/mapper/ProcessDefinitionEntityMapper.java b/data-index/data-index-storage/data-index-storage-jpa-common/src/main/java/org/kie/kogito/index/jpa/mapper/ProcessDefinitionEntityMapper.java similarity index 96% rename from data-index/data-index-storage/data-index-storage-jpa/src/main/java/org/kie/kogito/index/jpa/mapper/ProcessDefinitionEntityMapper.java rename to data-index/data-index-storage/data-index-storage-jpa-common/src/main/java/org/kie/kogito/index/jpa/mapper/ProcessDefinitionEntityMapper.java index 065dfbddc1..1cf04b7ab9 100644 --- a/data-index/data-index-storage/data-index-storage-jpa/src/main/java/org/kie/kogito/index/jpa/mapper/ProcessDefinitionEntityMapper.java +++ b/data-index/data-index-storage/data-index-storage-jpa-common/src/main/java/org/kie/kogito/index/jpa/mapper/ProcessDefinitionEntityMapper.java @@ -25,7 +25,7 @@ import org.mapstruct.Mapper; import org.mapstruct.MappingTarget; -@Mapper(componentModel = "cdi") +@Mapper(componentModel = "cdi", suppressTimestampInGenerated = true) public interface ProcessDefinitionEntityMapper { ProcessDefinitionEntity mapToEntity(ProcessDefinition pd); diff --git a/data-index/data-index-storage/data-index-storage-jpa/src/main/java/org/kie/kogito/index/jpa/mapper/ProcessInstanceEntityMapper.java b/data-index/data-index-storage/data-index-storage-jpa-common/src/main/java/org/kie/kogito/index/jpa/mapper/ProcessInstanceEntityMapper.java similarity index 96% rename from data-index/data-index-storage/data-index-storage-jpa/src/main/java/org/kie/kogito/index/jpa/mapper/ProcessInstanceEntityMapper.java rename to data-index/data-index-storage/data-index-storage-jpa-common/src/main/java/org/kie/kogito/index/jpa/mapper/ProcessInstanceEntityMapper.java index ec4bd23b60..f241c4d857 100644 --- a/data-index/data-index-storage/data-index-storage-jpa/src/main/java/org/kie/kogito/index/jpa/mapper/ProcessInstanceEntityMapper.java +++ b/data-index/data-index-storage/data-index-storage-jpa-common/src/main/java/org/kie/kogito/index/jpa/mapper/ProcessInstanceEntityMapper.java @@ -27,7 +27,7 @@ import org.mapstruct.Mapper; import org.mapstruct.MappingTarget; -@Mapper(componentModel = "cdi") +@Mapper(componentModel = "cdi", suppressTimestampInGenerated = true) public interface ProcessInstanceEntityMapper { MilestoneEntity mapMilestoneToEntity(Milestone mi); diff --git a/data-index/data-index-storage/data-index-storage-jpa/src/main/java/org/kie/kogito/index/jpa/mapper/UserTaskInstanceEntityMapper.java b/data-index/data-index-storage/data-index-storage-jpa-common/src/main/java/org/kie/kogito/index/jpa/mapper/UserTaskInstanceEntityMapper.java similarity index 95% rename from data-index/data-index-storage/data-index-storage-jpa/src/main/java/org/kie/kogito/index/jpa/mapper/UserTaskInstanceEntityMapper.java rename to data-index/data-index-storage/data-index-storage-jpa-common/src/main/java/org/kie/kogito/index/jpa/mapper/UserTaskInstanceEntityMapper.java index b0006a1e15..364478e75d 100644 --- a/data-index/data-index-storage/data-index-storage-jpa/src/main/java/org/kie/kogito/index/jpa/mapper/UserTaskInstanceEntityMapper.java +++ b/data-index/data-index-storage/data-index-storage-jpa-common/src/main/java/org/kie/kogito/index/jpa/mapper/UserTaskInstanceEntityMapper.java @@ -25,7 +25,7 @@ import org.mapstruct.Mapper; import org.mapstruct.MappingTarget; -@Mapper(componentModel = "cdi") +@Mapper(componentModel = "cdi", suppressTimestampInGenerated = true) public interface UserTaskInstanceEntityMapper { UserTaskInstanceEntity mapToEntity(UserTaskInstance ut); diff --git a/data-index/data-index-storage/data-index-storage-jpa/src/main/java/org/kie/kogito/index/jpa/model/AbstractEntity.java b/data-index/data-index-storage/data-index-storage-jpa-common/src/main/java/org/kie/kogito/index/jpa/model/AbstractEntity.java similarity index 100% rename from data-index/data-index-storage/data-index-storage-jpa/src/main/java/org/kie/kogito/index/jpa/model/AbstractEntity.java rename to data-index/data-index-storage/data-index-storage-jpa-common/src/main/java/org/kie/kogito/index/jpa/model/AbstractEntity.java diff --git a/data-index/data-index-storage/data-index-storage-jpa/src/main/java/org/kie/kogito/index/jpa/model/AttachmentEntity.java b/data-index/data-index-storage/data-index-storage-jpa-common/src/main/java/org/kie/kogito/index/jpa/model/AttachmentEntity.java similarity index 100% rename from data-index/data-index-storage/data-index-storage-jpa/src/main/java/org/kie/kogito/index/jpa/model/AttachmentEntity.java rename to data-index/data-index-storage/data-index-storage-jpa-common/src/main/java/org/kie/kogito/index/jpa/model/AttachmentEntity.java diff --git a/data-index/data-index-storage/data-index-storage-jpa/src/main/java/org/kie/kogito/index/jpa/model/CommentEntity.java b/data-index/data-index-storage/data-index-storage-jpa-common/src/main/java/org/kie/kogito/index/jpa/model/CommentEntity.java similarity index 100% rename from data-index/data-index-storage/data-index-storage-jpa/src/main/java/org/kie/kogito/index/jpa/model/CommentEntity.java rename to data-index/data-index-storage/data-index-storage-jpa-common/src/main/java/org/kie/kogito/index/jpa/model/CommentEntity.java diff --git a/data-index/data-index-storage/data-index-storage-jpa/src/main/java/org/kie/kogito/index/jpa/model/JobEntity.java b/data-index/data-index-storage/data-index-storage-jpa-common/src/main/java/org/kie/kogito/index/jpa/model/JobEntity.java similarity index 100% rename from data-index/data-index-storage/data-index-storage-jpa/src/main/java/org/kie/kogito/index/jpa/model/JobEntity.java rename to data-index/data-index-storage/data-index-storage-jpa-common/src/main/java/org/kie/kogito/index/jpa/model/JobEntity.java diff --git a/data-index/data-index-storage/data-index-storage-jpa/src/main/java/org/kie/kogito/index/jpa/model/JobEntityRepository.java b/data-index/data-index-storage/data-index-storage-jpa-common/src/main/java/org/kie/kogito/index/jpa/model/JobEntityRepository.java similarity index 100% rename from data-index/data-index-storage/data-index-storage-jpa/src/main/java/org/kie/kogito/index/jpa/model/JobEntityRepository.java rename to data-index/data-index-storage/data-index-storage-jpa-common/src/main/java/org/kie/kogito/index/jpa/model/JobEntityRepository.java diff --git a/data-index/data-index-storage/data-index-storage-jpa/src/main/java/org/kie/kogito/index/jpa/model/MilestoneEntity.java b/data-index/data-index-storage/data-index-storage-jpa-common/src/main/java/org/kie/kogito/index/jpa/model/MilestoneEntity.java similarity index 100% rename from data-index/data-index-storage/data-index-storage-jpa/src/main/java/org/kie/kogito/index/jpa/model/MilestoneEntity.java rename to data-index/data-index-storage/data-index-storage-jpa-common/src/main/java/org/kie/kogito/index/jpa/model/MilestoneEntity.java diff --git a/data-index/data-index-storage/data-index-storage-jpa/src/main/java/org/kie/kogito/index/jpa/model/MilestoneEntityId.java b/data-index/data-index-storage/data-index-storage-jpa-common/src/main/java/org/kie/kogito/index/jpa/model/MilestoneEntityId.java similarity index 100% rename from data-index/data-index-storage/data-index-storage-jpa/src/main/java/org/kie/kogito/index/jpa/model/MilestoneEntityId.java rename to data-index/data-index-storage/data-index-storage-jpa-common/src/main/java/org/kie/kogito/index/jpa/model/MilestoneEntityId.java diff --git a/data-index/data-index-storage/data-index-storage-jpa/src/main/java/org/kie/kogito/index/jpa/model/NodeEntity.java b/data-index/data-index-storage/data-index-storage-jpa-common/src/main/java/org/kie/kogito/index/jpa/model/NodeEntity.java similarity index 100% rename from data-index/data-index-storage/data-index-storage-jpa/src/main/java/org/kie/kogito/index/jpa/model/NodeEntity.java rename to data-index/data-index-storage/data-index-storage-jpa-common/src/main/java/org/kie/kogito/index/jpa/model/NodeEntity.java diff --git a/data-index/data-index-storage/data-index-storage-jpa/src/main/java/org/kie/kogito/index/jpa/model/NodeEntityId.java b/data-index/data-index-storage/data-index-storage-jpa-common/src/main/java/org/kie/kogito/index/jpa/model/NodeEntityId.java similarity index 100% rename from data-index/data-index-storage/data-index-storage-jpa/src/main/java/org/kie/kogito/index/jpa/model/NodeEntityId.java rename to data-index/data-index-storage/data-index-storage-jpa-common/src/main/java/org/kie/kogito/index/jpa/model/NodeEntityId.java diff --git a/data-index/data-index-storage/data-index-storage-jpa/src/main/java/org/kie/kogito/index/jpa/model/NodeInstanceEntity.java b/data-index/data-index-storage/data-index-storage-jpa-common/src/main/java/org/kie/kogito/index/jpa/model/NodeInstanceEntity.java similarity index 100% rename from data-index/data-index-storage/data-index-storage-jpa/src/main/java/org/kie/kogito/index/jpa/model/NodeInstanceEntity.java rename to data-index/data-index-storage/data-index-storage-jpa-common/src/main/java/org/kie/kogito/index/jpa/model/NodeInstanceEntity.java diff --git a/data-index/data-index-storage/data-index-storage-jpa/src/main/java/org/kie/kogito/index/jpa/model/ProcessDefinitionEntity.java b/data-index/data-index-storage/data-index-storage-jpa-common/src/main/java/org/kie/kogito/index/jpa/model/ProcessDefinitionEntity.java similarity index 98% rename from data-index/data-index-storage/data-index-storage-jpa/src/main/java/org/kie/kogito/index/jpa/model/ProcessDefinitionEntity.java rename to data-index/data-index-storage/data-index-storage-jpa-common/src/main/java/org/kie/kogito/index/jpa/model/ProcessDefinitionEntity.java index 5ffdec6e26..dd2db761a6 100644 --- a/data-index/data-index-storage/data-index-storage-jpa/src/main/java/org/kie/kogito/index/jpa/model/ProcessDefinitionEntity.java +++ b/data-index/data-index-storage/data-index-storage-jpa-common/src/main/java/org/kie/kogito/index/jpa/model/ProcessDefinitionEntity.java @@ -23,6 +23,8 @@ import java.util.Objects; import java.util.Set; +import org.kie.kogito.index.model.ProcessDefinitionKey; + import jakarta.persistence.CascadeType; import jakarta.persistence.CollectionTable; import jakarta.persistence.Column; @@ -38,7 +40,7 @@ @Entity(name = "definitions") @Table(name = "definitions") -@IdClass(ProcessDefinitionEntityId.class) +@IdClass(ProcessDefinitionKey.class) public class ProcessDefinitionEntity extends AbstractEntity { @Id diff --git a/data-index/data-index-storage/data-index-storage-jpa/src/main/java/org/kie/kogito/index/jpa/model/ProcessDefinitionEntityRepository.java b/data-index/data-index-storage/data-index-storage-jpa-common/src/main/java/org/kie/kogito/index/jpa/model/ProcessDefinitionEntityRepository.java similarity index 89% rename from data-index/data-index-storage/data-index-storage-jpa/src/main/java/org/kie/kogito/index/jpa/model/ProcessDefinitionEntityRepository.java rename to data-index/data-index-storage/data-index-storage-jpa-common/src/main/java/org/kie/kogito/index/jpa/model/ProcessDefinitionEntityRepository.java index a17d92a5fd..c055cba6b5 100644 --- a/data-index/data-index-storage/data-index-storage-jpa/src/main/java/org/kie/kogito/index/jpa/model/ProcessDefinitionEntityRepository.java +++ b/data-index/data-index-storage/data-index-storage-jpa-common/src/main/java/org/kie/kogito/index/jpa/model/ProcessDefinitionEntityRepository.java @@ -18,11 +18,13 @@ */ package org.kie.kogito.index.jpa.model; +import org.kie.kogito.index.model.ProcessDefinitionKey; + import io.quarkus.hibernate.orm.panache.PanacheRepositoryBase; import jakarta.enterprise.context.ApplicationScoped; @ApplicationScoped -public class ProcessDefinitionEntityRepository implements PanacheRepositoryBase { +public class ProcessDefinitionEntityRepository implements PanacheRepositoryBase { } diff --git a/data-index/data-index-storage/data-index-storage-jpa/src/main/java/org/kie/kogito/index/jpa/model/ProcessInstanceEntity.java b/data-index/data-index-storage/data-index-storage-jpa-common/src/main/java/org/kie/kogito/index/jpa/model/ProcessInstanceEntity.java similarity index 100% rename from data-index/data-index-storage/data-index-storage-jpa/src/main/java/org/kie/kogito/index/jpa/model/ProcessInstanceEntity.java rename to data-index/data-index-storage/data-index-storage-jpa-common/src/main/java/org/kie/kogito/index/jpa/model/ProcessInstanceEntity.java diff --git a/data-index/data-index-storage/data-index-storage-jpa/src/main/java/org/kie/kogito/index/jpa/model/ProcessInstanceEntityRepository.java b/data-index/data-index-storage/data-index-storage-jpa-common/src/main/java/org/kie/kogito/index/jpa/model/ProcessInstanceEntityRepository.java similarity index 100% rename from data-index/data-index-storage/data-index-storage-jpa/src/main/java/org/kie/kogito/index/jpa/model/ProcessInstanceEntityRepository.java rename to data-index/data-index-storage/data-index-storage-jpa-common/src/main/java/org/kie/kogito/index/jpa/model/ProcessInstanceEntityRepository.java diff --git a/data-index/data-index-storage/data-index-storage-jpa/src/main/java/org/kie/kogito/index/jpa/model/ProcessInstanceErrorEntity.java b/data-index/data-index-storage/data-index-storage-jpa-common/src/main/java/org/kie/kogito/index/jpa/model/ProcessInstanceErrorEntity.java similarity index 100% rename from data-index/data-index-storage/data-index-storage-jpa/src/main/java/org/kie/kogito/index/jpa/model/ProcessInstanceErrorEntity.java rename to data-index/data-index-storage/data-index-storage-jpa-common/src/main/java/org/kie/kogito/index/jpa/model/ProcessInstanceErrorEntity.java diff --git a/data-index/data-index-storage/data-index-storage-jpa/src/main/java/org/kie/kogito/index/jpa/model/UserTaskInstanceEntity.java b/data-index/data-index-storage/data-index-storage-jpa-common/src/main/java/org/kie/kogito/index/jpa/model/UserTaskInstanceEntity.java similarity index 100% rename from data-index/data-index-storage/data-index-storage-jpa/src/main/java/org/kie/kogito/index/jpa/model/UserTaskInstanceEntity.java rename to data-index/data-index-storage/data-index-storage-jpa-common/src/main/java/org/kie/kogito/index/jpa/model/UserTaskInstanceEntity.java diff --git a/data-index/data-index-storage/data-index-storage-jpa/src/main/java/org/kie/kogito/index/jpa/model/UserTaskInstanceEntityRepository.java b/data-index/data-index-storage/data-index-storage-jpa-common/src/main/java/org/kie/kogito/index/jpa/model/UserTaskInstanceEntityRepository.java similarity index 100% rename from data-index/data-index-storage/data-index-storage-jpa/src/main/java/org/kie/kogito/index/jpa/model/UserTaskInstanceEntityRepository.java rename to data-index/data-index-storage/data-index-storage-jpa-common/src/main/java/org/kie/kogito/index/jpa/model/UserTaskInstanceEntityRepository.java diff --git a/data-index/data-index-storage/data-index-storage-jpa/src/main/java/org/kie/kogito/index/jpa/storage/AbstractJPAStorageFetcher.java b/data-index/data-index-storage/data-index-storage-jpa-common/src/main/java/org/kie/kogito/index/jpa/storage/AbstractJPAStorageFetcher.java similarity index 58% rename from data-index/data-index-storage/data-index-storage-jpa/src/main/java/org/kie/kogito/index/jpa/storage/AbstractJPAStorageFetcher.java rename to data-index/data-index-storage/data-index-storage-jpa-common/src/main/java/org/kie/kogito/index/jpa/storage/AbstractJPAStorageFetcher.java index 881b7eb516..c8ab20c38f 100644 --- a/data-index/data-index-storage/data-index-storage-jpa/src/main/java/org/kie/kogito/index/jpa/storage/AbstractJPAStorageFetcher.java +++ b/data-index/data-index-storage/data-index-storage-jpa-common/src/main/java/org/kie/kogito/index/jpa/storage/AbstractJPAStorageFetcher.java @@ -1,3 +1,21 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ package org.kie.kogito.index.jpa.storage; import java.util.function.Function; @@ -11,18 +29,18 @@ import jakarta.transaction.Transactional; -public class AbstractJPAStorageFetcher implements StorageFetcher { +public class AbstractJPAStorageFetcher implements StorageFetcher { private static final String LISTENER_NOT_AVAILABLE_IN_JPA = "Listener not available in JPA database"; - protected PanacheRepositoryBase repository; + protected PanacheRepositoryBase repository; protected Class entityClass; protected Function mapToModel; protected AbstractJPAStorageFetcher() { } - protected AbstractJPAStorageFetcher(PanacheRepositoryBase repository, Class entityClass, Function mapToModel) { + protected AbstractJPAStorageFetcher(PanacheRepositoryBase repository, Class entityClass, Function mapToModel) { this.repository = repository; this.entityClass = entityClass; this.mapToModel = mapToModel; @@ -39,7 +57,7 @@ public Multi objectUpdatedListener() { } @Override - public Multi objectRemovedListener() { + public Multi objectRemovedListener() { throw new UnsupportedOperationException(LISTENER_NOT_AVAILABLE_IN_JPA); } @@ -50,7 +68,7 @@ public Query query() { @Override @Transactional - public V get(String key) { + public V get(K key) { return repository.findByIdOptional(key).map(mapToModel).orElse(null); } diff --git a/data-index/data-index-storage/data-index-storage-jpa/src/main/java/org/kie/kogito/index/jpa/storage/AbstractStorage.java b/data-index/data-index-storage/data-index-storage-jpa-common/src/main/java/org/kie/kogito/index/jpa/storage/AbstractStorage.java similarity index 59% rename from data-index/data-index-storage/data-index-storage-jpa/src/main/java/org/kie/kogito/index/jpa/storage/AbstractStorage.java rename to data-index/data-index-storage/data-index-storage-jpa-common/src/main/java/org/kie/kogito/index/jpa/storage/AbstractStorage.java index abae372ebe..de426fc4ef 100644 --- a/data-index/data-index-storage/data-index-storage-jpa/src/main/java/org/kie/kogito/index/jpa/storage/AbstractStorage.java +++ b/data-index/data-index-storage/data-index-storage-jpa-common/src/main/java/org/kie/kogito/index/jpa/storage/AbstractStorage.java @@ -18,7 +18,6 @@ */ package org.kie.kogito.index.jpa.storage; -import java.util.ConcurrentModificationException; import java.util.Map; import java.util.function.Function; @@ -27,24 +26,22 @@ import io.quarkus.hibernate.orm.panache.PanacheRepositoryBase; -import jakarta.persistence.LockModeType; -import jakarta.persistence.PersistenceException; import jakarta.transaction.Transactional; import static java.util.stream.Collectors.toMap; -public abstract class AbstractStorage extends AbstractJPAStorageFetcher implements Storage { +public abstract class AbstractStorage extends AbstractJPAStorageFetcher implements Storage { private Class modelClass; private Function mapToEntity; - private Function mapEntityToKey; + private Function mapEntityToKey; protected AbstractStorage() { } - protected AbstractStorage(PanacheRepositoryBase repository, Class modelClass, Class entityClass, Function mapToModel, - Function mapToEntity, Function mapEntityToKey) { + protected AbstractStorage(PanacheRepositoryBase repository, Class modelClass, Class entityClass, Function mapToModel, + Function mapToEntity, Function mapEntityToKey) { super(repository, entityClass, mapToModel); this.modelClass = modelClass; this.mapToEntity = mapToEntity; @@ -53,26 +50,14 @@ protected AbstractStorage(PanacheRepositoryBase repository, Class @Override @Transactional - public V put(String key, V value) { - //Pessimistic lock is used to lock the row to handle concurrency with an exiting registry - E persistedEntity = repository.findById(key, LockModeType.PESSIMISTIC_WRITE); - E newEntity = mapToEntity.apply(value); - if (persistedEntity != null) { - repository.getEntityManager().merge(newEntity); - } else { - try { - //to handle concurrency in case of a new registry persist flush and throw an exception to allow retry on the caller side - repository.persistAndFlush(newEntity); - } catch (PersistenceException e) { - throw new ConcurrentModificationException(e); - } - } + public V put(K key, V value) { + repository.getEntityManager().merge(mapToEntity.apply(value)); return value; } @Override @Transactional - public V remove(String key) { + public V remove(K key) { V value = get(key); if (value != null) { repository.deleteById(key); @@ -82,12 +67,12 @@ public V remove(String key) { @Transactional @Override - public boolean containsKey(String key) { + public boolean containsKey(K key) { return repository.count("id = ?1", key) == 1; } @Override - public Map entries() { + public Map entries() { return repository.streamAll().collect(toMap(mapEntityToKey, mapToModel)); } @@ -102,7 +87,7 @@ public String getRootType() { return modelClass.getCanonicalName(); } - protected PanacheRepositoryBase getRepository() { + protected PanacheRepositoryBase getRepository() { return repository; } } diff --git a/data-index/data-index-storage/data-index-storage-jpa/src/main/java/org/kie/kogito/index/jpa/storage/JPADataIndexStorageService.java b/data-index/data-index-storage/data-index-storage-jpa-common/src/main/java/org/kie/kogito/index/jpa/storage/JPADataIndexStorageService.java similarity index 72% rename from data-index/data-index-storage/data-index-storage-jpa/src/main/java/org/kie/kogito/index/jpa/storage/JPADataIndexStorageService.java rename to data-index/data-index-storage/data-index-storage-jpa-common/src/main/java/org/kie/kogito/index/jpa/storage/JPADataIndexStorageService.java index 9a726a3a6e..99bbccf0c3 100644 --- a/data-index/data-index-storage/data-index-storage-jpa/src/main/java/org/kie/kogito/index/jpa/storage/JPADataIndexStorageService.java +++ b/data-index/data-index-storage/data-index-storage-jpa-common/src/main/java/org/kie/kogito/index/jpa/storage/JPADataIndexStorageService.java @@ -20,26 +20,25 @@ import org.kie.kogito.index.model.Job; import org.kie.kogito.index.model.ProcessDefinition; +import org.kie.kogito.index.model.ProcessDefinitionKey; import org.kie.kogito.index.storage.DataIndexStorageService; import org.kie.kogito.index.storage.ProcessInstanceStorage; import org.kie.kogito.index.storage.UserTaskInstanceStorage; import org.kie.kogito.persistence.api.Storage; -import org.kie.kogito.persistence.api.StorageService; import com.fasterxml.jackson.databind.node.ObjectNode; import jakarta.enterprise.context.ApplicationScoped; import jakarta.inject.Inject; -import static org.kie.kogito.index.storage.Constants.JOBS_STORAGE; -import static org.kie.kogito.index.storage.Constants.PROCESS_DEFINITIONS_STORAGE; -import static org.kie.kogito.index.storage.Constants.PROCESS_ID_MODEL_STORAGE; - @ApplicationScoped public class JPADataIndexStorageService implements DataIndexStorageService { @Inject - StorageService storageService; + ProcessDefinitionEntityStorage definitionStorage; + + @Inject + JobEntityStorage jobsStorage; @Inject ProcessInstanceStorage processInstanceStorage; @@ -48,8 +47,8 @@ public class JPADataIndexStorageService implements DataIndexStorageService { UserTaskInstanceStorage userTaskInstanceStorage; @Override - public Storage getProcessDefinitionStorage() { - return storageService.getCache(PROCESS_DEFINITIONS_STORAGE, ProcessDefinition.class); + public Storage getProcessDefinitionStorage() { + return definitionStorage; } @Override @@ -64,13 +63,12 @@ public UserTaskInstanceStorage getUserTaskInstanceStorage() { @Override public Storage getJobsStorage() { - return storageService.getCache(JOBS_STORAGE, Job.class); + return jobsStorage; } @Override public Storage getDomainModelCache(String processId) { - String rootType = getProcessIdModelCache().get(processId); - return rootType == null ? null : storageService.getCache(getDomainModelCacheName(processId), ObjectNode.class, rootType); + throw new UnsupportedOperationException("Generic custom type cache not available in JPA"); } @Override @@ -80,6 +78,6 @@ public String getDomainModelCacheName(String processId) { @Override public Storage getProcessIdModelCache() { - return storageService.getCache(PROCESS_ID_MODEL_STORAGE); + throw new UnsupportedOperationException("Generic String cache not available in JPA"); } } diff --git a/data-index/data-index-graphql/src/main/java/org/kie/kogito/index/graphql/OracleDateTimeCoercing.java b/data-index/data-index-storage/data-index-storage-jpa-common/src/main/java/org/kie/kogito/index/jpa/storage/JPADateTimeCoercing.java similarity index 80% rename from data-index/data-index-graphql/src/main/java/org/kie/kogito/index/graphql/OracleDateTimeCoercing.java rename to data-index/data-index-storage/data-index-storage-jpa-common/src/main/java/org/kie/kogito/index/jpa/storage/JPADateTimeCoercing.java index 1c604cae29..6ac9ef2dd4 100644 --- a/data-index/data-index-graphql/src/main/java/org/kie/kogito/index/graphql/OracleDateTimeCoercing.java +++ b/data-index/data-index-storage/data-index-storage-jpa-common/src/main/java/org/kie/kogito/index/jpa/storage/JPADateTimeCoercing.java @@ -16,20 +16,18 @@ * specific language governing permissions and limitations * under the License. */ -package org.kie.kogito.index.graphql; +package org.kie.kogito.index.jpa.storage; import java.time.ZonedDateTime; -import io.quarkus.arc.properties.IfBuildProperty; +import org.kie.kogito.index.api.DateTimeCoercing; +import org.kie.kogito.index.api.DefaultDateTimeCoercing; import graphql.language.StringValue; import jakarta.enterprise.context.ApplicationScoped; -import static org.kie.kogito.persistence.api.factory.Constants.PERSISTENCE_TYPE_PROPERTY; - @ApplicationScoped -@IfBuildProperty(name = PERSISTENCE_TYPE_PROPERTY, stringValue = "oracle") -public class OracleDateTimeCoercing extends DefaultDateTimeCoercing implements DateTimeCoercing { +public class JPADateTimeCoercing extends DefaultDateTimeCoercing implements DateTimeCoercing { @Override public Object parseValue(Object input) { diff --git a/data-index/data-index-storage/data-index-storage-jpa/src/main/java/org/kie/kogito/index/jpa/storage/JPAQuery.java b/data-index/data-index-storage/data-index-storage-jpa-common/src/main/java/org/kie/kogito/index/jpa/storage/JPAQuery.java similarity index 100% rename from data-index/data-index-storage/data-index-storage-jpa/src/main/java/org/kie/kogito/index/jpa/storage/JPAQuery.java rename to data-index/data-index-storage/data-index-storage-jpa-common/src/main/java/org/kie/kogito/index/jpa/storage/JPAQuery.java diff --git a/data-index/data-index-storage/data-index-storage-jpa/src/main/java/org/kie/kogito/index/jpa/storage/JobEntityStorage.java b/data-index/data-index-storage/data-index-storage-jpa-common/src/main/java/org/kie/kogito/index/jpa/storage/JobEntityStorage.java similarity index 94% rename from data-index/data-index-storage/data-index-storage-jpa/src/main/java/org/kie/kogito/index/jpa/storage/JobEntityStorage.java rename to data-index/data-index-storage/data-index-storage-jpa-common/src/main/java/org/kie/kogito/index/jpa/storage/JobEntityStorage.java index 697ed00c33..f5b9c270dd 100644 --- a/data-index/data-index-storage/data-index-storage-jpa/src/main/java/org/kie/kogito/index/jpa/storage/JobEntityStorage.java +++ b/data-index/data-index-storage/data-index-storage-jpa-common/src/main/java/org/kie/kogito/index/jpa/storage/JobEntityStorage.java @@ -28,7 +28,7 @@ import jakarta.inject.Inject; @ApplicationScoped -public class JobEntityStorage extends AbstractStorage { +public class JobEntityStorage extends AbstractStorage { protected JobEntityStorage() { } diff --git a/data-index/data-index-storage/data-index-storage-jpa-common/src/main/java/org/kie/kogito/index/jpa/storage/ProcessDefinitionEntityStorage.java b/data-index/data-index-storage/data-index-storage-jpa-common/src/main/java/org/kie/kogito/index/jpa/storage/ProcessDefinitionEntityStorage.java new file mode 100644 index 0000000000..e22670c665 --- /dev/null +++ b/data-index/data-index-storage/data-index-storage-jpa-common/src/main/java/org/kie/kogito/index/jpa/storage/ProcessDefinitionEntityStorage.java @@ -0,0 +1,49 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.kie.kogito.index.jpa.storage; + +import org.kie.kogito.index.jpa.mapper.ProcessDefinitionEntityMapper; +import org.kie.kogito.index.jpa.model.ProcessDefinitionEntity; +import org.kie.kogito.index.jpa.model.ProcessDefinitionEntityRepository; +import org.kie.kogito.index.model.ProcessDefinition; +import org.kie.kogito.index.model.ProcessDefinitionKey; + +import jakarta.enterprise.context.ApplicationScoped; +import jakarta.inject.Inject; +import jakarta.transaction.Transactional; + +@ApplicationScoped +public class ProcessDefinitionEntityStorage extends AbstractStorage { + + protected ProcessDefinitionEntityStorage() { + } + + @Inject + public ProcessDefinitionEntityStorage(ProcessDefinitionEntityRepository repository, ProcessDefinitionEntityMapper mapper) { + super(repository, ProcessDefinition.class, ProcessDefinitionEntity.class, mapper::mapToModel, mapper::mapToEntity, e -> new ProcessDefinitionKey(e.getId(), + e.getVersion())); + } + + @Transactional + @Override + public boolean containsKey(ProcessDefinitionKey key) { + return getRepository().count("id = ?1 and version = ?2", key.getId(), key.getVersion()) == 1; + } + +} diff --git a/data-index/data-index-storage/data-index-storage-jpa/src/main/java/org/kie/kogito/index/jpa/storage/ProcessInstanceEntityStorage.java b/data-index/data-index-storage/data-index-storage-jpa-common/src/main/java/org/kie/kogito/index/jpa/storage/ProcessInstanceEntityStorage.java similarity index 92% rename from data-index/data-index-storage/data-index-storage-jpa/src/main/java/org/kie/kogito/index/jpa/storage/ProcessInstanceEntityStorage.java rename to data-index/data-index-storage/data-index-storage-jpa-common/src/main/java/org/kie/kogito/index/jpa/storage/ProcessInstanceEntityStorage.java index f86570fbd4..386aabcf78 100644 --- a/data-index/data-index-storage/data-index-storage-jpa/src/main/java/org/kie/kogito/index/jpa/storage/ProcessInstanceEntityStorage.java +++ b/data-index/data-index-storage/data-index-storage-jpa-common/src/main/java/org/kie/kogito/index/jpa/storage/ProcessInstanceEntityStorage.java @@ -20,6 +20,7 @@ import java.time.ZonedDateTime; import java.util.ArrayList; +import java.util.Date; import java.util.Set; import org.kie.kogito.event.process.ProcessInstanceErrorDataEvent; @@ -32,19 +33,17 @@ 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.index.CommonUtils; import org.kie.kogito.index.jpa.mapper.ProcessInstanceEntityMapper; import org.kie.kogito.index.jpa.model.MilestoneEntity; import org.kie.kogito.index.jpa.model.NodeInstanceEntity; import org.kie.kogito.index.jpa.model.ProcessInstanceEntity; import org.kie.kogito.index.jpa.model.ProcessInstanceEntityRepository; import org.kie.kogito.index.jpa.model.ProcessInstanceErrorEntity; +import org.kie.kogito.index.json.JsonUtils; import org.kie.kogito.index.model.MilestoneStatus; import org.kie.kogito.index.model.ProcessInstance; import org.kie.kogito.index.storage.ProcessInstanceStorage; -import org.kie.kogito.jackson.utils.JsonObjectUtils; -import org.kie.kogito.jackson.utils.ObjectMapperFactory; - -import com.fasterxml.jackson.databind.node.ObjectNode; import jakarta.enterprise.context.ApplicationScoped; import jakarta.inject.Inject; @@ -55,7 +54,7 @@ import static org.kie.kogito.index.DateTimeUtils.toZonedDateTime; @ApplicationScoped -public class ProcessInstanceEntityStorage extends AbstractJPAStorageFetcher implements ProcessInstanceStorage { +public class ProcessInstanceEntityStorage extends AbstractJPAStorageFetcher implements ProcessInstanceStorage { protected ProcessInstanceEntityStorage() { } @@ -96,11 +95,12 @@ public void indexVariable(ProcessInstanceVariableDataEvent event) { indexVariable(event.getData()); } - private ProcessInstanceEntity findOrInit(String processId, String processInstanceId) { + private ProcessInstanceEntity findOrInit(String processId, String processInstanceId, Date date) { return repository.findByIdOptional(processInstanceId).orElseGet(() -> { ProcessInstanceEntity pi = new ProcessInstanceEntity(); pi.setProcessId(processId); pi.setId(processInstanceId); + pi.setLastUpdate(toZonedDateTime(date)); pi.setNodes(new ArrayList<>()); pi.setMilestones(new ArrayList<>()); repository.persist(pi); @@ -109,7 +109,7 @@ private ProcessInstanceEntity findOrInit(String processId, String processInstanc } private void indexError(ProcessInstanceErrorEventBody error) { - ProcessInstanceEntity pi = findOrInit(error.getProcessId(), error.getProcessInstanceId()); + ProcessInstanceEntity pi = findOrInit(error.getProcessId(), error.getProcessInstanceId(), error.getEventDate()); ProcessInstanceErrorEntity errorEntity = pi.getError(); if (errorEntity == null) { errorEntity = new ProcessInstanceErrorEntity(); @@ -117,11 +117,12 @@ private void indexError(ProcessInstanceErrorEventBody error) { } errorEntity.setMessage(error.getErrorMessage()); errorEntity.setNodeDefinitionId(error.getNodeDefinitionId()); + pi.setState(CommonUtils.ERROR_STATE); repository.flush(); } private void indexNode(ProcessInstanceNodeEventBody data) { - ProcessInstanceEntity pi = findOrInit(data.getProcessId(), data.getProcessInstanceId()); + ProcessInstanceEntity pi = findOrInit(data.getProcessId(), data.getProcessInstanceId(), data.getEventDate()); pi.getNodes().stream().filter(n -> n.getId().equals(data.getNodeInstanceId())).findAny().ifPresentOrElse(n -> updateNode(n, data), () -> createNode(pi, data)); if ("MilestoneNode".equals(data.getNodeType())) { pi.getMilestones().stream().filter(n -> n.getId().equals(data.getNodeInstanceId())).findAny().ifPresentOrElse(n -> updateMilestone(n, data), () -> createMilestone(pi, data)); @@ -174,12 +175,12 @@ private NodeInstanceEntity updateNode(NodeInstanceEntity nodeInstance, ProcessIn } private void indexSLA(ProcessInstanceSLAEventBody data) { - findOrInit(data.getProcessId(), data.getProcessInstanceId()); + findOrInit(data.getProcessId(), data.getProcessInstanceId(), data.getEventDate()); repository.flush(); } private void indexState(ProcessInstanceStateEventBody data, Set addons, String endpoint) { - ProcessInstanceEntity pi = findOrInit(data.getProcessId(), data.getProcessInstanceId()); + ProcessInstanceEntity pi = findOrInit(data.getProcessId(), data.getProcessInstanceId(), data.getEventDate()); pi.setVersion(data.getProcessVersion()); pi.setProcessName(data.getProcessName()); pi.setRootProcessInstanceId(data.getRootProcessInstanceId()); @@ -202,14 +203,9 @@ private void indexState(ProcessInstanceStateEventBody data, Set addons, } private void indexVariable(ProcessInstanceVariableEventBody data) { - ProcessInstanceEntity pi = findOrInit(data.getProcessId(), data.getProcessInstanceId()); - ObjectNode node = pi.getVariables(); - if (node == null) { - node = ObjectMapperFactory.get().createObjectNode(); - } - node.set(data.getVariableName(), JsonObjectUtils.fromValue(data.getVariableValue())); - // Object node is not tracked, need explicit set - pi.setVariables(node); + ProcessInstanceEntity pi = findOrInit(data.getProcessId(), data.getProcessInstanceId(), data.getEventDate()); + pi.setVariables(JsonUtils.mergeVariable(data.getVariableName(), data.getVariableValue(), pi.getVariables())); repository.flush(); } + } diff --git a/data-index/data-index-storage/data-index-storage-jpa/src/main/java/org/kie/kogito/index/jpa/storage/UserTaskInstanceEntityStorage.java b/data-index/data-index-storage/data-index-storage-jpa-common/src/main/java/org/kie/kogito/index/jpa/storage/UserTaskInstanceEntityStorage.java similarity index 99% rename from data-index/data-index-storage/data-index-storage-jpa/src/main/java/org/kie/kogito/index/jpa/storage/UserTaskInstanceEntityStorage.java rename to data-index/data-index-storage/data-index-storage-jpa-common/src/main/java/org/kie/kogito/index/jpa/storage/UserTaskInstanceEntityStorage.java index 4d5cc47003..1e2c127a36 100644 --- a/data-index/data-index-storage/data-index-storage-jpa/src/main/java/org/kie/kogito/index/jpa/storage/UserTaskInstanceEntityStorage.java +++ b/data-index/data-index-storage/data-index-storage-jpa-common/src/main/java/org/kie/kogito/index/jpa/storage/UserTaskInstanceEntityStorage.java @@ -56,7 +56,7 @@ import static org.kie.kogito.index.DateTimeUtils.toZonedDateTime; @ApplicationScoped -public class UserTaskInstanceEntityStorage extends AbstractJPAStorageFetcher implements UserTaskInstanceStorage { +public class UserTaskInstanceEntityStorage extends AbstractJPAStorageFetcher implements UserTaskInstanceStorage { protected UserTaskInstanceEntityStorage() { } diff --git a/data-index/data-index-service/data-index-service-oracle/src/main/resources/META-INF/beans.xml b/data-index/data-index-storage/data-index-storage-jpa-common/src/main/resources/META-INF/beans.xml similarity index 100% rename from data-index/data-index-service/data-index-service-oracle/src/main/resources/META-INF/beans.xml rename to data-index/data-index-storage/data-index-storage-jpa-common/src/main/resources/META-INF/beans.xml diff --git a/data-index/data-index-storage/data-index-storage-oracle/src/test/java/org/kie/kogito/index/oracle/mapper/JobEntityMapperIT.java b/data-index/data-index-storage/data-index-storage-jpa-common/src/test/java/org/kie/kogito/index/jpa/mapper/AbstractJobEntityMapperIT.java similarity index 95% rename from data-index/data-index-storage/data-index-storage-oracle/src/test/java/org/kie/kogito/index/oracle/mapper/JobEntityMapperIT.java rename to data-index/data-index-storage/data-index-storage-jpa-common/src/test/java/org/kie/kogito/index/jpa/mapper/AbstractJobEntityMapperIT.java index a7504f914f..dd8477855d 100644 --- a/data-index/data-index-storage/data-index-storage-oracle/src/test/java/org/kie/kogito/index/oracle/mapper/JobEntityMapperIT.java +++ b/data-index/data-index-storage/data-index-storage-jpa-common/src/test/java/org/kie/kogito/index/jpa/mapper/AbstractJobEntityMapperIT.java @@ -16,24 +16,20 @@ * specific language governing permissions and limitations * under the License. */ -package org.kie.kogito.index.oracle.mapper; +package org.kie.kogito.index.jpa.mapper; import java.time.ZonedDateTime; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.kie.kogito.index.jpa.mapper.JobEntityMapper; import org.kie.kogito.index.jpa.model.JobEntity; import org.kie.kogito.index.model.Job; -import io.quarkus.test.junit.QuarkusTest; - import jakarta.inject.Inject; import static org.assertj.core.api.Assertions.assertThat; -@QuarkusTest -class JobEntityMapperIT { +public abstract class AbstractJobEntityMapperIT { @Inject JobEntityMapper mapper; diff --git a/data-index/data-index-storage/data-index-storage-oracle/src/test/java/org/kie/kogito/index/oracle/mapper/ProcessDefinitionEntityMapperIT.java b/data-index/data-index-storage/data-index-storage-jpa-common/src/test/java/org/kie/kogito/index/jpa/mapper/AbstractProcessDefinitionEntityMapperIT.java similarity index 94% rename from data-index/data-index-storage/data-index-storage-oracle/src/test/java/org/kie/kogito/index/oracle/mapper/ProcessDefinitionEntityMapperIT.java rename to data-index/data-index-storage/data-index-storage-jpa-common/src/test/java/org/kie/kogito/index/jpa/mapper/AbstractProcessDefinitionEntityMapperIT.java index 4369de3058..3df75e17bf 100644 --- a/data-index/data-index-storage/data-index-storage-oracle/src/test/java/org/kie/kogito/index/oracle/mapper/ProcessDefinitionEntityMapperIT.java +++ b/data-index/data-index-storage/data-index-storage-jpa-common/src/test/java/org/kie/kogito/index/jpa/mapper/AbstractProcessDefinitionEntityMapperIT.java @@ -16,20 +16,17 @@ * specific language governing permissions and limitations * under the License. */ -package org.kie.kogito.index.oracle.mapper; +package org.kie.kogito.index.jpa.mapper; import java.util.Set; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.kie.kogito.index.jpa.mapper.ProcessDefinitionEntityMapper; import org.kie.kogito.index.jpa.model.NodeEntity; import org.kie.kogito.index.jpa.model.ProcessDefinitionEntity; import org.kie.kogito.index.model.Node; import org.kie.kogito.index.model.ProcessDefinition; -import io.quarkus.test.junit.QuarkusTest; - import jakarta.inject.Inject; import static java.util.Collections.singleton; @@ -37,8 +34,7 @@ import static java.util.Collections.singletonMap; import static org.assertj.core.api.Assertions.assertThat; -@QuarkusTest -class ProcessDefinitionEntityMapperIT { +public abstract class AbstractProcessDefinitionEntityMapperIT { ProcessDefinition pd = new ProcessDefinition(); ProcessDefinitionEntity entity = new ProcessDefinitionEntity(); diff --git a/data-index/data-index-storage/data-index-storage-oracle/src/test/java/org/kie/kogito/index/oracle/mapper/ProcessInstanceEntityMapperIT.java b/data-index/data-index-storage/data-index-storage-jpa-common/src/test/java/org/kie/kogito/index/jpa/mapper/AbstractProcessInstanceEntityMapperIT.java similarity index 96% rename from data-index/data-index-storage/data-index-storage-oracle/src/test/java/org/kie/kogito/index/oracle/mapper/ProcessInstanceEntityMapperIT.java rename to data-index/data-index-storage/data-index-storage-jpa-common/src/test/java/org/kie/kogito/index/jpa/mapper/AbstractProcessInstanceEntityMapperIT.java index 95840d7e1a..1bb4b5a64f 100644 --- a/data-index/data-index-storage/data-index-storage-oracle/src/test/java/org/kie/kogito/index/oracle/mapper/ProcessInstanceEntityMapperIT.java +++ b/data-index/data-index-storage/data-index-storage-jpa-common/src/test/java/org/kie/kogito/index/jpa/mapper/AbstractProcessInstanceEntityMapperIT.java @@ -16,14 +16,13 @@ * specific language governing permissions and limitations * under the License. */ -package org.kie.kogito.index.oracle.mapper; +package org.kie.kogito.index.jpa.mapper; import java.time.ZonedDateTime; import java.util.Set; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.kie.kogito.index.jpa.mapper.ProcessInstanceEntityMapper; import org.kie.kogito.index.jpa.model.MilestoneEntity; import org.kie.kogito.index.jpa.model.MilestoneEntityId; import org.kie.kogito.index.jpa.model.NodeInstanceEntity; @@ -37,16 +36,13 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.node.ObjectNode; -import io.quarkus.test.junit.QuarkusTest; - import jakarta.inject.Inject; import static java.util.Collections.singleton; import static java.util.Collections.singletonList; import static org.assertj.core.api.Assertions.assertThat; -@QuarkusTest -class ProcessInstanceEntityMapperIT { +public abstract class AbstractProcessInstanceEntityMapperIT { ObjectMapper jsonMapper = new ObjectMapper(); ProcessInstance processInstance = new ProcessInstance(); @@ -72,7 +68,6 @@ void setup() { String testId = "testId"; String processId = "testProcessId"; - String version = "1.0"; Set roles = singleton("testRoles"); ObjectNode variables = jsonMapper.createObjectNode(); variables.put("test", "testValue"); @@ -108,7 +103,6 @@ void setup() { processInstance.setId(testId); processInstance.setProcessId(processId); - processInstance.setVersion(version); processInstance.setRoles(roles); processInstance.setVariables(variables); processInstance.setEndpoint(endpoint); @@ -153,7 +147,6 @@ void setup() { processInstanceEntity.setId(testId); processInstanceEntity.setProcessId(processId); - processInstanceEntity.setVersion(version); processInstanceEntity.setRoles(roles); processInstanceEntity.setVariables(variables); processInstanceEntity.setEndpoint(endpoint); @@ -169,9 +162,9 @@ void setup() { processInstanceEntity.setAddons(addons); processInstanceEntity.setLastUpdate(time); processInstanceEntity.setBusinessKey(businessKey); + processInstanceEntity.setMilestones(singletonList(milestoneEntity)); processInstanceEntity.setCreatedBy(createdBy); processInstanceEntity.setUpdatedBy(updatedBy); - processInstanceEntity.setMilestones(singletonList(milestoneEntity)); } @Test diff --git a/data-index/data-index-storage/data-index-storage-oracle/src/test/java/org/kie/kogito/index/oracle/mapper/UserTaskInstanceEntityMapperIT.java b/data-index/data-index-storage/data-index-storage-jpa-common/src/test/java/org/kie/kogito/index/jpa/mapper/AbstractUserTaskInstanceEntityMapperIT.java similarity index 97% rename from data-index/data-index-storage/data-index-storage-oracle/src/test/java/org/kie/kogito/index/oracle/mapper/UserTaskInstanceEntityMapperIT.java rename to data-index/data-index-storage/data-index-storage-jpa-common/src/test/java/org/kie/kogito/index/jpa/mapper/AbstractUserTaskInstanceEntityMapperIT.java index 167da216df..6d4dd31e24 100644 --- a/data-index/data-index-storage/data-index-storage-oracle/src/test/java/org/kie/kogito/index/oracle/mapper/UserTaskInstanceEntityMapperIT.java +++ b/data-index/data-index-storage/data-index-storage-jpa-common/src/test/java/org/kie/kogito/index/jpa/mapper/AbstractUserTaskInstanceEntityMapperIT.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.kie.kogito.index.oracle.mapper; +package org.kie.kogito.index.jpa.mapper; import java.time.ZonedDateTime; import java.util.HashMap; @@ -25,7 +25,6 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.kie.kogito.index.jpa.mapper.UserTaskInstanceEntityMapper; import org.kie.kogito.index.jpa.model.AttachmentEntity; import org.kie.kogito.index.jpa.model.CommentEntity; import org.kie.kogito.index.jpa.model.UserTaskInstanceEntity; @@ -36,16 +35,13 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.node.ObjectNode; -import io.quarkus.test.junit.QuarkusTest; - import jakarta.inject.Inject; import static java.util.Collections.singleton; import static java.util.Collections.singletonList; import static org.assertj.core.api.Assertions.assertThat; -@QuarkusTest -class UserTaskInstanceEntityMapperIT { +public abstract class AbstractUserTaskInstanceEntityMapperIT { UserTaskInstance userTaskInstance = new UserTaskInstance(); UserTaskInstanceEntity userTaskInstanceEntity = new UserTaskInstanceEntity(); diff --git a/data-index/data-index-storage/data-index-storage-oracle/src/test/java/org/kie/kogito/index/oracle/query/JobEntityQueryIT.java b/data-index/data-index-storage/data-index-storage-jpa-common/src/test/java/org/kie/kogito/index/jpa/query/AbstractJobEntityQueryIT.java similarity index 77% rename from data-index/data-index-storage/data-index-storage-oracle/src/test/java/org/kie/kogito/index/oracle/query/JobEntityQueryIT.java rename to data-index/data-index-storage/data-index-storage-jpa-common/src/test/java/org/kie/kogito/index/jpa/query/AbstractJobEntityQueryIT.java index fe12f79d1d..f07b11b5dd 100644 --- a/data-index/data-index-storage/data-index-storage-oracle/src/test/java/org/kie/kogito/index/oracle/query/JobEntityQueryIT.java +++ b/data-index/data-index-storage/data-index-storage-jpa-common/src/test/java/org/kie/kogito/index/jpa/query/AbstractJobEntityQueryIT.java @@ -16,22 +16,16 @@ * specific language governing permissions and limitations * under the License. */ -package org.kie.kogito.index.oracle.query; +package org.kie.kogito.index.jpa.query; import org.kie.kogito.index.jpa.storage.JobEntityStorage; import org.kie.kogito.index.model.Job; import org.kie.kogito.index.test.query.AbstractJobQueryIT; import org.kie.kogito.persistence.api.Storage; -import org.kie.kogito.testcontainers.quarkus.OracleSqlQuarkusTestResource; - -import io.quarkus.test.common.QuarkusTestResource; -import io.quarkus.test.junit.QuarkusTest; import jakarta.inject.Inject; -@QuarkusTest -@QuarkusTestResource(OracleSqlQuarkusTestResource.class) -class JobEntityQueryIT extends AbstractJobQueryIT { +public abstract class AbstractJobEntityQueryIT extends AbstractJobQueryIT { @Inject JobEntityStorage storage; diff --git a/data-index/data-index-storage/data-index-storage-oracle/src/test/java/org/kie/kogito/index/oracle/query/ProcessDefinitionEntityQueryIT.java b/data-index/data-index-storage/data-index-storage-jpa-common/src/test/java/org/kie/kogito/index/jpa/query/AbstractProcessDefinitionEntityQueryIT.java similarity index 73% rename from data-index/data-index-storage/data-index-storage-oracle/src/test/java/org/kie/kogito/index/oracle/query/ProcessDefinitionEntityQueryIT.java rename to data-index/data-index-storage/data-index-storage-jpa-common/src/test/java/org/kie/kogito/index/jpa/query/AbstractProcessDefinitionEntityQueryIT.java index f5ab610f09..1c9a84d667 100644 --- a/data-index/data-index-storage/data-index-storage-oracle/src/test/java/org/kie/kogito/index/oracle/query/ProcessDefinitionEntityQueryIT.java +++ b/data-index/data-index-storage/data-index-storage-jpa-common/src/test/java/org/kie/kogito/index/jpa/query/AbstractProcessDefinitionEntityQueryIT.java @@ -16,28 +16,23 @@ * specific language governing permissions and limitations * under the License. */ -package org.kie.kogito.index.oracle.query; +package org.kie.kogito.index.jpa.query; import org.kie.kogito.index.jpa.storage.ProcessDefinitionEntityStorage; import org.kie.kogito.index.model.ProcessDefinition; +import org.kie.kogito.index.model.ProcessDefinitionKey; import org.kie.kogito.index.test.query.AbstractProcessDefinitionQueryIT; import org.kie.kogito.persistence.api.Storage; -import org.kie.kogito.testcontainers.quarkus.OracleSqlQuarkusTestResource; - -import io.quarkus.test.common.QuarkusTestResource; -import io.quarkus.test.junit.QuarkusTest; import jakarta.inject.Inject; -@QuarkusTest -@QuarkusTestResource(OracleSqlQuarkusTestResource.class) -class ProcessDefinitionEntityQueryIT extends AbstractProcessDefinitionQueryIT { +public abstract class AbstractProcessDefinitionEntityQueryIT extends AbstractProcessDefinitionQueryIT { @Inject ProcessDefinitionEntityStorage storage; @Override - public Storage getStorage() { + public Storage getStorage() { return storage; } diff --git a/data-index/data-index-storage/data-index-storage-oracle/src/test/java/org/kie/kogito/index/oracle/query/ProcessInstanceEntityQueryIT.java b/data-index/data-index-storage/data-index-storage-jpa-common/src/test/java/org/kie/kogito/index/jpa/query/AbstractProcessInstanceEntityQueryIT.java similarity index 71% rename from data-index/data-index-storage/data-index-storage-oracle/src/test/java/org/kie/kogito/index/oracle/query/ProcessInstanceEntityQueryIT.java rename to data-index/data-index-storage/data-index-storage-jpa-common/src/test/java/org/kie/kogito/index/jpa/query/AbstractProcessInstanceEntityQueryIT.java index 88e898e9c8..f2fc967907 100644 --- a/data-index/data-index-storage/data-index-storage-oracle/src/test/java/org/kie/kogito/index/oracle/query/ProcessInstanceEntityQueryIT.java +++ b/data-index/data-index-storage/data-index-storage-jpa-common/src/test/java/org/kie/kogito/index/jpa/query/AbstractProcessInstanceEntityQueryIT.java @@ -16,20 +16,14 @@ * specific language governing permissions and limitations * under the License. */ -package org.kie.kogito.index.oracle.query; +package org.kie.kogito.index.jpa.query; import org.kie.kogito.index.jpa.storage.ProcessInstanceEntityStorage; import org.kie.kogito.index.test.query.AbstractProcessInstanceQueryIT; -import org.kie.kogito.testcontainers.quarkus.OracleSqlQuarkusTestResource; - -import io.quarkus.test.common.QuarkusTestResource; -import io.quarkus.test.junit.QuarkusTest; import jakarta.inject.Inject; -@QuarkusTest -@QuarkusTestResource(OracleSqlQuarkusTestResource.class) -class ProcessInstanceEntityQueryIT extends AbstractProcessInstanceQueryIT { +public abstract class AbstractProcessInstanceEntityQueryIT extends AbstractProcessInstanceQueryIT { @Inject ProcessInstanceEntityStorage storage; @@ -38,9 +32,4 @@ class ProcessInstanceEntityQueryIT extends AbstractProcessInstanceQueryIT { public ProcessInstanceEntityStorage getStorage() { return storage; } - - @Override - protected Boolean isDateTimeAsLong() { - return false; - } } diff --git a/data-index/data-index-storage/data-index-storage-oracle/src/test/java/org/kie/kogito/index/oracle/query/UserTaskInstanceEntityQueryIT.java b/data-index/data-index-storage/data-index-storage-jpa-common/src/test/java/org/kie/kogito/index/jpa/query/AbstractUserTaskInstanceEntityQueryIT.java similarity index 77% rename from data-index/data-index-storage/data-index-storage-oracle/src/test/java/org/kie/kogito/index/oracle/query/UserTaskInstanceEntityQueryIT.java rename to data-index/data-index-storage/data-index-storage-jpa-common/src/test/java/org/kie/kogito/index/jpa/query/AbstractUserTaskInstanceEntityQueryIT.java index 522bd54ad2..347b2765c9 100644 --- a/data-index/data-index-storage/data-index-storage-oracle/src/test/java/org/kie/kogito/index/oracle/query/UserTaskInstanceEntityQueryIT.java +++ b/data-index/data-index-storage/data-index-storage-jpa-common/src/test/java/org/kie/kogito/index/jpa/query/AbstractUserTaskInstanceEntityQueryIT.java @@ -16,20 +16,14 @@ * specific language governing permissions and limitations * under the License. */ -package org.kie.kogito.index.oracle.query; +package org.kie.kogito.index.jpa.query; import org.kie.kogito.index.jpa.storage.UserTaskInstanceEntityStorage; import org.kie.kogito.index.test.query.AbstractUserTaskInstanceQueryIT; -import org.kie.kogito.testcontainers.quarkus.OracleSqlQuarkusTestResource; - -import io.quarkus.test.common.QuarkusTestResource; -import io.quarkus.test.junit.QuarkusTest; import jakarta.inject.Inject; -@QuarkusTest -@QuarkusTestResource(OracleSqlQuarkusTestResource.class) -class UserTaskInstanceEntityQueryIT extends AbstractUserTaskInstanceQueryIT { +public abstract class AbstractUserTaskInstanceEntityQueryIT extends AbstractUserTaskInstanceQueryIT { @Inject UserTaskInstanceEntityStorage storage; diff --git a/data-index/data-index-storage/data-index-storage-oracle/src/test/java/org/kie/kogito/index/oracle/storage/JobStorageIT.java b/data-index/data-index-storage/data-index-storage-jpa-common/src/test/java/org/kie/kogito/index/jpa/storage/AbstractJobStorageIT.java similarity index 72% rename from data-index/data-index-storage/data-index-storage-oracle/src/test/java/org/kie/kogito/index/oracle/storage/JobStorageIT.java rename to data-index/data-index-storage/data-index-storage-jpa-common/src/test/java/org/kie/kogito/index/jpa/storage/AbstractJobStorageIT.java index a602ad8c45..2510619cc4 100644 --- a/data-index/data-index-storage/data-index-storage-oracle/src/test/java/org/kie/kogito/index/oracle/storage/JobStorageIT.java +++ b/data-index/data-index-storage/data-index-storage-jpa-common/src/test/java/org/kie/kogito/index/jpa/storage/AbstractJobStorageIT.java @@ -16,45 +16,30 @@ * specific language governing permissions and limitations * under the License. */ -package org.kie.kogito.index.oracle.storage; +package org.kie.kogito.index.jpa.storage; import java.util.UUID; import org.apache.commons.lang3.RandomStringUtils; import org.junit.jupiter.api.Test; import org.kie.kogito.index.jpa.model.JobEntity; -import org.kie.kogito.index.jpa.model.JobEntityRepository; import org.kie.kogito.index.model.Job; import org.kie.kogito.index.test.TestUtils; -import org.kie.kogito.persistence.api.StorageService; -import org.kie.kogito.testcontainers.quarkus.OracleSqlQuarkusTestResource; - -import io.quarkus.test.common.QuarkusTestResource; -import io.quarkus.test.junit.QuarkusTest; +import org.kie.kogito.persistence.api.Storage; import jakarta.inject.Inject; -@QuarkusTest -@QuarkusTestResource(OracleSqlQuarkusTestResource.class) -public class JobStorageIT extends AbstractStorageIT { - - @Inject - JobEntityRepository repository; +public abstract class AbstractJobStorageIT extends AbstractStorageIT { @Inject - StorageService storage; + JobEntityStorage storage; - public JobStorageIT() { + public AbstractJobStorageIT() { super(Job.class); } @Override - public JobEntityRepository getRepository() { - return repository; - } - - @Override - public StorageService getStorage() { + public Storage getStorage() { return storage; } @@ -71,5 +56,4 @@ public void testJobEntity() { RandomStringUtils.randomAlphabetic(10), "SCHEDULED", 1000L); testStorage(jobId, job1, job2); } - } diff --git a/data-index/data-index-storage/data-index-storage-oracle/src/test/java/org/kie/kogito/index/oracle/storage/ProcessDefinitionStorageIT.java b/data-index/data-index-storage/data-index-storage-jpa-common/src/test/java/org/kie/kogito/index/jpa/storage/AbstractProcessDefinitionStorageIT.java similarity index 60% rename from data-index/data-index-storage/data-index-storage-oracle/src/test/java/org/kie/kogito/index/oracle/storage/ProcessDefinitionStorageIT.java rename to data-index/data-index-storage/data-index-storage-jpa-common/src/test/java/org/kie/kogito/index/jpa/storage/AbstractProcessDefinitionStorageIT.java index 7d915b5fed..bba2ee7e7c 100644 --- a/data-index/data-index-storage/data-index-storage-oracle/src/test/java/org/kie/kogito/index/oracle/storage/ProcessDefinitionStorageIT.java +++ b/data-index/data-index-storage/data-index-storage-jpa-common/src/test/java/org/kie/kogito/index/jpa/storage/AbstractProcessDefinitionStorageIT.java @@ -16,56 +16,41 @@ * specific language governing permissions and limitations * under the License. */ -package org.kie.kogito.index.oracle.storage; +package org.kie.kogito.index.jpa.storage; import java.util.Set; import org.apache.commons.lang3.RandomStringUtils; import org.junit.jupiter.api.Test; import org.kie.kogito.index.jpa.model.ProcessDefinitionEntity; -import org.kie.kogito.index.jpa.model.ProcessDefinitionEntityRepository; -import org.kie.kogito.index.jpa.storage.ProcessDefinitionEntityStorage; import org.kie.kogito.index.model.ProcessDefinition; +import org.kie.kogito.index.model.ProcessDefinitionKey; import org.kie.kogito.index.test.TestUtils; -import org.kie.kogito.persistence.api.StorageService; -import org.kie.kogito.testcontainers.quarkus.OracleSqlQuarkusTestResource; - -import io.quarkus.test.common.QuarkusTestResource; -import io.quarkus.test.junit.QuarkusTest; +import org.kie.kogito.persistence.api.Storage; import jakarta.inject.Inject; -@QuarkusTest -@QuarkusTestResource(OracleSqlQuarkusTestResource.class) -class ProcessDefinitionStorageIT extends AbstractStorageIT { - - @Inject - ProcessDefinitionEntityRepository repository; +public abstract class AbstractProcessDefinitionStorageIT extends AbstractStorageIT { @Inject - StorageService storage; + ProcessDefinitionEntityStorage storage; - public ProcessDefinitionStorageIT() { + public AbstractProcessDefinitionStorageIT() { super(ProcessDefinition.class); } @Override - public ProcessDefinitionEntityStorage.RepositoryAdapter getRepository() { - return new ProcessDefinitionEntityStorage.RepositoryAdapter(repository); - } - - @Override - public StorageService getStorage() { + public Storage getStorage() { return storage; } @Test - void testProcessInstanceEntity() { + void testProcessDefinitionEntity() { String processId = RandomStringUtils.randomAlphabetic(10); String version = "1.0"; ProcessDefinition pdv1 = TestUtils.createProcessDefinition(processId, version, Set.of("admin", "kogito")); ProcessDefinition pdv2 = TestUtils.createProcessDefinition(processId, version, Set.of("kogito")); - testStorage(pdv1.getKey(), pdv1, pdv2); + testStorage(new ProcessDefinitionKey(pdv1.getId(), pdv1.getVersion()), pdv1, pdv2); } } diff --git a/data-index/data-index-storage/data-index-storage-oracle/src/test/java/org/kie/kogito/index/oracle/storage/ProcessInstanceStorageIT.java b/data-index/data-index-storage/data-index-storage-jpa-common/src/test/java/org/kie/kogito/index/jpa/storage/AbstractProcessInstanceStorageIT.java similarity index 84% rename from data-index/data-index-storage/data-index-storage-oracle/src/test/java/org/kie/kogito/index/oracle/storage/ProcessInstanceStorageIT.java rename to data-index/data-index-storage/data-index-storage-jpa-common/src/test/java/org/kie/kogito/index/jpa/storage/AbstractProcessInstanceStorageIT.java index 1772743048..1ea09ce497 100644 --- a/data-index/data-index-storage/data-index-storage-oracle/src/test/java/org/kie/kogito/index/oracle/storage/ProcessInstanceStorageIT.java +++ b/data-index/data-index-storage/data-index-storage-jpa-common/src/test/java/org/kie/kogito/index/jpa/storage/AbstractProcessInstanceStorageIT.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.kie.kogito.index.oracle.storage; +package org.kie.kogito.index.jpa.storage; import java.util.UUID; @@ -25,16 +25,10 @@ import org.kie.kogito.index.jpa.model.ProcessInstanceEntityRepository; import org.kie.kogito.index.model.ProcessInstanceState; import org.kie.kogito.index.test.TestUtils; -import org.kie.kogito.testcontainers.quarkus.OracleSqlQuarkusTestResource; - -import io.quarkus.test.common.QuarkusTestResource; -import io.quarkus.test.junit.QuarkusTest; import jakarta.inject.Inject; -@QuarkusTest -@QuarkusTestResource(OracleSqlQuarkusTestResource.class) -public class ProcessInstanceStorageIT { +public abstract class AbstractProcessInstanceStorageIT { @Inject ProcessInstanceEntityRepository repository; diff --git a/data-index/data-index-storage/data-index-storage-oracle/src/test/java/org/kie/kogito/index/oracle/storage/AbstractStorageIT.java b/data-index/data-index-storage/data-index-storage-jpa-common/src/test/java/org/kie/kogito/index/jpa/storage/AbstractStorageIT.java similarity index 77% rename from data-index/data-index-storage/data-index-storage-oracle/src/test/java/org/kie/kogito/index/oracle/storage/AbstractStorageIT.java rename to data-index/data-index-storage/data-index-storage-jpa-common/src/test/java/org/kie/kogito/index/jpa/storage/AbstractStorageIT.java index b50ff27551..165ce328dd 100644 --- a/data-index/data-index-storage/data-index-storage-oracle/src/test/java/org/kie/kogito/index/oracle/storage/AbstractStorageIT.java +++ b/data-index/data-index-storage/data-index-storage-jpa-common/src/test/java/org/kie/kogito/index/jpa/storage/AbstractStorageIT.java @@ -16,17 +16,14 @@ * specific language governing permissions and limitations * under the License. */ -package org.kie.kogito.index.oracle.storage; +package org.kie.kogito.index.jpa.storage; import org.kie.kogito.index.jpa.model.AbstractEntity; import org.kie.kogito.persistence.api.Storage; -import org.kie.kogito.persistence.api.StorageService; - -import io.quarkus.hibernate.orm.panache.PanacheRepositoryBase; import static org.assertj.core.api.Assertions.assertThat; -public abstract class AbstractStorageIT { +public abstract class AbstractStorageIT { Class type; @@ -34,12 +31,10 @@ public AbstractStorageIT(Class type) { this.type = type; } - abstract StorageService getStorage(); - - abstract PanacheRepositoryBase getRepository(); + abstract Storage getStorage(); - void testStorage(String key, T value1, T value2) { - Storage cache = getStorage().getCache("cache", type); + void testStorage(K key, T value1, T value2) { + Storage cache = getStorage(); assertThat(cache.get(key)).isNull(); assertThat(cache.containsKey(key)).isFalse(); diff --git a/data-index/data-index-storage/data-index-storage-oracle/src/test/java/org/kie/kogito/index/oracle/storage/UserTaskInstanceStorageIT.java b/data-index/data-index-storage/data-index-storage-jpa-common/src/test/java/org/kie/kogito/index/jpa/storage/AbstractUserTaskInstanceStorageIT.java similarity index 68% rename from data-index/data-index-storage/data-index-storage-oracle/src/test/java/org/kie/kogito/index/oracle/storage/UserTaskInstanceStorageIT.java rename to data-index/data-index-storage/data-index-storage-jpa-common/src/test/java/org/kie/kogito/index/jpa/storage/AbstractUserTaskInstanceStorageIT.java index 0784f6d106..9b8c0056c9 100644 --- a/data-index/data-index-storage/data-index-storage-oracle/src/test/java/org/kie/kogito/index/oracle/storage/UserTaskInstanceStorageIT.java +++ b/data-index/data-index-storage/data-index-storage-jpa-common/src/test/java/org/kie/kogito/index/jpa/storage/AbstractUserTaskInstanceStorageIT.java @@ -16,28 +16,18 @@ * specific language governing permissions and limitations * under the License. */ -package org.kie.kogito.index.oracle.storage; +package org.kie.kogito.index.jpa.storage; import java.util.UUID; import org.apache.commons.lang3.RandomStringUtils; import org.junit.jupiter.api.Test; import org.kie.kogito.index.jpa.model.UserTaskInstanceEntityRepository; -import org.kie.kogito.index.model.UserTaskInstance; import org.kie.kogito.index.test.TestUtils; -import org.kie.kogito.testcontainers.quarkus.OracleSqlQuarkusTestResource; - -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.node.ObjectNode; - -import io.quarkus.test.common.QuarkusTestResource; -import io.quarkus.test.junit.QuarkusTest; import jakarta.inject.Inject; -@QuarkusTest -@QuarkusTestResource(OracleSqlQuarkusTestResource.class) -public class UserTaskInstanceStorageIT { +public abstract class AbstractUserTaskInstanceStorageIT { @Inject UserTaskInstanceEntityRepository repository; @@ -46,14 +36,14 @@ public class UserTaskInstanceStorageIT { public void testUserTaskInstanceEntity() { String taskId = UUID.randomUUID().toString(); String processInstanceId = UUID.randomUUID().toString(); - UserTaskInstance userTaskInstance1 = TestUtils + TestUtils .createUserTaskInstance(taskId, processInstanceId, RandomStringUtils.randomAlphabetic(5), UUID.randomUUID().toString(), RandomStringUtils.randomAlphabetic(10), "InProgress", 0L); - ObjectMapper objectMapper = new ObjectMapper(); - ObjectNode node = objectMapper.createObjectNode(); - node.put("test", "test"); - userTaskInstance1.setInputs(node); + TestUtils + .createUserTaskInstance(taskId, processInstanceId, RandomStringUtils.randomAlphabetic(5), + UUID.randomUUID().toString(), + RandomStringUtils.randomAlphabetic(10), "Completed", 1000L); } } diff --git a/data-index/data-index-storage/data-index-storage-oracle/src/test/java/org/kie/kogito/index/oracle/storage/DomainQueryTest.java b/data-index/data-index-storage/data-index-storage-jpa-common/src/test/java/org/kie/kogito/index/jpa/storage/DomainQueryTest.java similarity index 98% rename from data-index/data-index-storage/data-index-storage-oracle/src/test/java/org/kie/kogito/index/oracle/storage/DomainQueryTest.java rename to data-index/data-index-storage/data-index-storage-jpa-common/src/test/java/org/kie/kogito/index/jpa/storage/DomainQueryTest.java index 768f872612..10657a8bc3 100644 --- a/data-index/data-index-storage/data-index-storage-oracle/src/test/java/org/kie/kogito/index/oracle/storage/DomainQueryTest.java +++ b/data-index/data-index-storage/data-index-storage-jpa-common/src/test/java/org/kie/kogito/index/jpa/storage/DomainQueryTest.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.kie.kogito.index.oracle.storage; +package org.kie.kogito.index.jpa.storage; import java.util.List; import java.util.function.Function; @@ -25,7 +25,6 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.kie.kogito.index.jpa.model.ProcessInstanceEntity; -import org.kie.kogito.index.jpa.storage.JPAQuery; import org.kie.kogito.index.model.ProcessInstance; import org.mockito.ArgumentCaptor; import org.mockito.Mock; 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 30b1571157..d5b70212bf 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 @@ -30,46 +30,83 @@ 4.0.0 data-index-storage-jpa - Kogito Apps :: Data Index Storage JPA + Kogito Apps :: Data Index Storage JPA compatible DBs org.kie.kogito.index.jpa - + org.kie.kogito - data-index-storage-api + data-index-storage-jpa-common + + + io.quarkus + quarkus-test-h2 + test - org.kie.kogito - data-index-common + io.quarkus + quarkus-jdbc-h2 org.kie.kogito - persistence-commons-jpa + data-index-storage-api + test-jar + test + ${project.version} + + + org.kie.kogito + data-index-storage-jpa-common + test-jar + test + ${project.version} + + + io.quarkus + quarkus-junit5-mockito + test - org.mapstruct - mapstruct + org.assertj + assertj-core + test + + + org.mockito + mockito-junit-jupiter + test + + + org.kie.kogito + kogito-quarkus-test-utils + test - org.apache.maven.plugins - maven-compiler-plugin + maven-failsafe-plugin - - - org.mapstruct - mapstruct-processor - ${version.org.mapstruct} - - + + org.jboss.logmanager.LogManager + + + + test + + integration-test + verify + + + + + \ No newline at end of file diff --git a/data-index/data-index-storage/data-index-storage-oracle/src/main/java/org/kie/kogito/index/oracle/JsonBinaryConverter.java b/data-index/data-index-storage/data-index-storage-jpa/src/main/java/org/kie/kogito/index/jdbc/JsonBinaryConverter.java similarity index 97% rename from data-index/data-index-storage/data-index-storage-oracle/src/main/java/org/kie/kogito/index/oracle/JsonBinaryConverter.java rename to data-index/data-index-storage/data-index-storage-jpa/src/main/java/org/kie/kogito/index/jdbc/JsonBinaryConverter.java index 5701e70dc0..586f60ed18 100644 --- a/data-index/data-index-storage/data-index-storage-oracle/src/main/java/org/kie/kogito/index/oracle/JsonBinaryConverter.java +++ b/data-index/data-index-storage/data-index-storage-jpa/src/main/java/org/kie/kogito/index/jdbc/JsonBinaryConverter.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.kie.kogito.index.oracle; +package org.kie.kogito.index.jdbc; import java.io.IOException; import java.io.UncheckedIOException; diff --git a/data-index/data-index-storage/data-index-storage-jpa/src/main/java/org/kie/kogito/index/jpa/storage/JPAStorageService.java b/data-index/data-index-storage/data-index-storage-jpa/src/main/java/org/kie/kogito/index/jpa/storage/JPAStorageService.java deleted file mode 100644 index 89446436fa..0000000000 --- a/data-index/data-index-storage/data-index-storage-jpa/src/main/java/org/kie/kogito/index/jpa/storage/JPAStorageService.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.kogito.index.jpa.storage; - -import org.kie.kogito.index.model.Job; -import org.kie.kogito.index.model.ProcessDefinition; -import org.kie.kogito.index.model.ProcessInstance; -import org.kie.kogito.index.model.UserTaskInstance; -import org.kie.kogito.persistence.api.Storage; -import org.kie.kogito.persistence.api.StorageService; - -import static java.lang.String.format; - -public class JPAStorageService implements StorageService { - - private ProcessDefinitionEntityStorage definitionStorage; - private ProcessInstanceEntityStorage processStorage; - private JobEntityStorage jobStorage; - private UserTaskInstanceEntityStorage taskStorage; - - public JPAStorageService(final ProcessDefinitionEntityStorage definitionStorage, - final ProcessInstanceEntityStorage processStorage, - final JobEntityStorage jobStorage, - final UserTaskInstanceEntityStorage taskStorage) { - this.definitionStorage = definitionStorage; - this.processStorage = processStorage; - this.jobStorage = jobStorage; - this.taskStorage = taskStorage; - } - - @Override - public Storage getCache(String name) { - throw new UnsupportedOperationException("Generic String cache not available in PostgresSQL"); - } - - @Override - public Storage getCache(String name, Class type) { - if (type == ProcessInstance.class) { - return (Storage) processStorage; - } - if (type == ProcessDefinition.class) { - return (Storage) definitionStorage; - } - if (type == Job.class) { - return (Storage) jobStorage; - } - if (type == UserTaskInstance.class) { - return (Storage) taskStorage; - } - throw new UnsupportedOperationException(format("Unknown class type: %s, cache not available", type.getCanonicalName())); - } - - @Override - public Storage getCache(String name, Class type, String rootType) { - throw new UnsupportedOperationException("Generic custom type cache not available in PostgresSQL"); - } -} diff --git a/data-index/data-index-storage/data-index-storage-jpa/src/main/java/org/kie/kogito/index/jpa/storage/ProcessDefinitionEntityStorage.java b/data-index/data-index-storage/data-index-storage-jpa/src/main/java/org/kie/kogito/index/jpa/storage/ProcessDefinitionEntityStorage.java deleted file mode 100644 index 1bbe7d546c..0000000000 --- a/data-index/data-index-storage/data-index-storage-jpa/src/main/java/org/kie/kogito/index/jpa/storage/ProcessDefinitionEntityStorage.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.kogito.index.jpa.storage; - -import java.util.Optional; - -import org.kie.kogito.index.jpa.mapper.ProcessDefinitionEntityMapper; -import org.kie.kogito.index.jpa.model.ProcessDefinitionEntity; -import org.kie.kogito.index.jpa.model.ProcessDefinitionEntityId; -import org.kie.kogito.index.jpa.model.ProcessDefinitionEntityRepository; -import org.kie.kogito.index.model.ProcessDefinition; - -import io.quarkus.hibernate.orm.panache.PanacheRepositoryBase; - -import jakarta.enterprise.context.ApplicationScoped; -import jakarta.inject.Inject; -import jakarta.persistence.EntityManager; -import jakarta.persistence.LockModeType; -import jakarta.transaction.Transactional; - -@ApplicationScoped -public class ProcessDefinitionEntityStorage extends AbstractStorage { - - protected ProcessDefinitionEntityStorage() { - } - - @Inject - public ProcessDefinitionEntityStorage(ProcessDefinitionEntityRepository repository, ProcessDefinitionEntityMapper mapper) { - super(new RepositoryAdapter(repository), ProcessDefinition.class, ProcessDefinitionEntity.class, mapper::mapToModel, mapper::mapToEntity, e -> new ProcessDefinitionEntityId(e.getId(), - e.getVersion()).getKey()); - } - - @Transactional - @Override - public boolean containsKey(String key) { - ProcessDefinitionEntityId id = new ProcessDefinitionEntityId(key); - return getRepository().count("id = ?1 and version = ?2", id.getId(), id.getVersion()) == 1; - } - - public static class RepositoryAdapter implements PanacheRepositoryBase { - - ProcessDefinitionEntityRepository repository; - - public RepositoryAdapter(ProcessDefinitionEntityRepository repository) { - this.repository = repository; - } - - @Override - public boolean deleteById(String key) { - return repository.deleteById(new ProcessDefinitionEntityId(key)); - } - - @Override - public Optional findByIdOptional(String key) { - return repository.findByIdOptional(new ProcessDefinitionEntityId(key)); - } - - @Override - public ProcessDefinitionEntity findById(String s, LockModeType lockModeType) { - return repository.findById(new ProcessDefinitionEntityId(s), lockModeType); - } - - @Override - public void persist(ProcessDefinitionEntity entity) { - repository.persist(entity); - } - - @Override - public EntityManager getEntityManager() { - return repository.getEntityManager(); - } - } -} diff --git a/data-index/data-index-storage/data-index-storage-oracle/src/main/resources/META-INF/orm.xml b/data-index/data-index-storage/data-index-storage-jpa/src/main/resources/META-INF/orm.xml similarity index 78% rename from data-index/data-index-storage/data-index-storage-oracle/src/main/resources/META-INF/orm.xml rename to data-index/data-index-storage/data-index-storage-jpa/src/main/resources/META-INF/orm.xml index ff5279f699..2e9789c752 100644 --- a/data-index/data-index-storage/data-index-storage-oracle/src/main/resources/META-INF/orm.xml +++ b/data-index/data-index-storage/data-index-storage-jpa/src/main/resources/META-INF/orm.xml @@ -7,7 +7,7 @@ - + @@ -15,11 +15,11 @@ - + - + @@ -27,7 +27,7 @@ - + diff --git a/data-index/data-index-storage/data-index-storage-oracle/src/main/resources/db/migration/V1.33.0__data_index_create.sql b/data-index/data-index-storage/data-index-storage-jpa/src/main/resources/db/migration/V1.33.0__data_index_create.sql similarity index 100% rename from data-index/data-index-storage/data-index-storage-oracle/src/main/resources/db/migration/V1.33.0__data_index_create.sql rename to data-index/data-index-storage/data-index-storage-jpa/src/main/resources/db/migration/V1.33.0__data_index_create.sql diff --git a/data-index/data-index-storage/data-index-storage-oracle/src/main/resources/db/migration/V1.44.0__data_index_definitions.sql b/data-index/data-index-storage/data-index-storage-jpa/src/main/resources/db/migration/V1.44.0__data_index_definitions.sql similarity index 100% rename from data-index/data-index-storage/data-index-storage-oracle/src/main/resources/db/migration/V1.44.0__data_index_definitions.sql rename to data-index/data-index-storage/data-index-storage-jpa/src/main/resources/db/migration/V1.44.0__data_index_definitions.sql diff --git a/data-index/data-index-storage/data-index-storage-oracle/src/main/resources/db/migration/V1.45.0.0__data_index_node_definitions.sql b/data-index/data-index-storage/data-index-storage-jpa/src/main/resources/db/migration/V1.45.0.0__data_index_node_definitions.sql similarity index 100% rename from data-index/data-index-storage/data-index-storage-oracle/src/main/resources/db/migration/V1.45.0.0__data_index_node_definitions.sql rename to data-index/data-index-storage/data-index-storage-jpa/src/main/resources/db/migration/V1.45.0.0__data_index_node_definitions.sql diff --git a/data-index/data-index-storage/data-index-storage-oracle/src/main/resources/db/migration/V1.45.0.1__add_identity_to_process_instance.sql b/data-index/data-index-storage/data-index-storage-jpa/src/main/resources/db/migration/V1.45.0.1__add_identity_to_process_instance.sql similarity index 100% rename from data-index/data-index-storage/data-index-storage-oracle/src/main/resources/db/migration/V1.45.0.1__add_identity_to_process_instance.sql rename to data-index/data-index-storage/data-index-storage-jpa/src/main/resources/db/migration/V1.45.0.1__add_identity_to_process_instance.sql diff --git a/data-index/data-index-storage/data-index-storage-oracle/src/main/resources/db/migration/V1.45.0.2__data_index_definitions_add_collums.sql b/data-index/data-index-storage/data-index-storage-jpa/src/main/resources/db/migration/V1.45.0.2__data_index_definitions_add_collums.sql similarity index 100% rename from data-index/data-index-storage/data-index-storage-oracle/src/main/resources/db/migration/V1.45.0.2__data_index_definitions_add_collums.sql rename to data-index/data-index-storage/data-index-storage-jpa/src/main/resources/db/migration/V1.45.0.2__data_index_definitions_add_collums.sql diff --git a/data-index/data-index-service/data-index-service-oracle/src/test/java/org/kie/kogito/index/service/messaging/OracleMessagingKafkaConsumerIT.java b/data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/mapper/JobEntityMapperIT.java similarity index 75% rename from data-index/data-index-service/data-index-service-oracle/src/test/java/org/kie/kogito/index/service/messaging/OracleMessagingKafkaConsumerIT.java rename to data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/mapper/JobEntityMapperIT.java index ee54c4274a..5d85af3fcd 100644 --- a/data-index/data-index-service/data-index-service-oracle/src/test/java/org/kie/kogito/index/service/messaging/OracleMessagingKafkaConsumerIT.java +++ b/data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/mapper/JobEntityMapperIT.java @@ -16,15 +16,12 @@ * specific language governing permissions and limitations * under the License. */ -package org.kie.kogito.index.service.messaging; +package org.kie.kogito.index.jdbc.mapper; -import org.kie.kogito.index.service.test.KafkaMessageTestProfile; +import org.kie.kogito.index.jpa.mapper.AbstractJobEntityMapperIT; import io.quarkus.test.junit.QuarkusTest; -import io.quarkus.test.junit.TestProfile; @QuarkusTest -@TestProfile(KafkaMessageTestProfile.class) -class OracleMessagingKafkaConsumerIT extends AbstractMessagingKafkaConsumerIT { - +class JobEntityMapperIT extends AbstractJobEntityMapperIT { } diff --git a/data-index/data-index-service/data-index-service-oracle/src/test/java/org/kie/kogito/index/service/messaging/OracleMessagingHttpConsumerIT.java b/data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/mapper/ProcessDefinitionEntityMapperIT.java similarity index 75% rename from data-index/data-index-service/data-index-service-oracle/src/test/java/org/kie/kogito/index/service/messaging/OracleMessagingHttpConsumerIT.java rename to data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/mapper/ProcessDefinitionEntityMapperIT.java index 1a255cf16d..f2ea4d334b 100644 --- a/data-index/data-index-service/data-index-service-oracle/src/test/java/org/kie/kogito/index/service/messaging/OracleMessagingHttpConsumerIT.java +++ b/data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/mapper/ProcessDefinitionEntityMapperIT.java @@ -16,15 +16,12 @@ * specific language governing permissions and limitations * under the License. */ -package org.kie.kogito.index.service.messaging; +package org.kie.kogito.index.jdbc.mapper; -import org.kie.kogito.index.service.test.InMemoryMessageTestProfile; +import org.kie.kogito.index.jpa.mapper.AbstractProcessDefinitionEntityMapperIT; import io.quarkus.test.junit.QuarkusTest; -import io.quarkus.test.junit.TestProfile; @QuarkusTest -@TestProfile(InMemoryMessageTestProfile.class) -class OracleMessagingHttpConsumerIT extends AbstractMessagingHttpConsumerIT { - +class ProcessDefinitionEntityMapperIT extends AbstractProcessDefinitionEntityMapperIT { } diff --git a/data-index/data-index-service/data-index-service-oracle/src/test/java/org/kie/kogito/index/service/OracleIndexingServiceIT.java b/data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/mapper/ProcessInstanceEntityMapperIT.java similarity index 76% rename from data-index/data-index-service/data-index-service-oracle/src/test/java/org/kie/kogito/index/service/OracleIndexingServiceIT.java rename to data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/mapper/ProcessInstanceEntityMapperIT.java index 436ba483ca..5c3230ddbe 100644 --- a/data-index/data-index-service/data-index-service-oracle/src/test/java/org/kie/kogito/index/service/OracleIndexingServiceIT.java +++ b/data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/mapper/ProcessInstanceEntityMapperIT.java @@ -16,15 +16,13 @@ * specific language governing permissions and limitations * under the License. */ -package org.kie.kogito.index.service; +package org.kie.kogito.index.jdbc.mapper; -import org.kie.kogito.index.service.test.InMemoryMessageTestProfile; +import org.kie.kogito.index.jpa.mapper.AbstractProcessInstanceEntityMapperIT; import io.quarkus.test.junit.QuarkusTest; -import io.quarkus.test.junit.TestProfile; @QuarkusTest -@TestProfile(InMemoryMessageTestProfile.class) -class OracleIndexingServiceIT extends AbstractIndexingServiceIT { +class ProcessInstanceEntityMapperIT extends AbstractProcessInstanceEntityMapperIT { } diff --git a/data-index/data-index-service/data-index-service-oracle/src/test/java/org/kie/kogito/index/service/KeycloakOracleIndexingServiceIT.java b/data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/mapper/UserTaskInstanceEntityMapperIT.java similarity index 75% rename from data-index/data-index-service/data-index-service-oracle/src/test/java/org/kie/kogito/index/service/KeycloakOracleIndexingServiceIT.java rename to data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/mapper/UserTaskInstanceEntityMapperIT.java index d5b17e14b8..64131ffe24 100644 --- a/data-index/data-index-service/data-index-service-oracle/src/test/java/org/kie/kogito/index/service/KeycloakOracleIndexingServiceIT.java +++ b/data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/mapper/UserTaskInstanceEntityMapperIT.java @@ -16,15 +16,13 @@ * specific language governing permissions and limitations * under the License. */ -package org.kie.kogito.index.service; +package org.kie.kogito.index.jdbc.mapper; -import org.kie.kogito.index.service.test.KeycloakTestProfile; +import org.kie.kogito.index.jpa.mapper.AbstractUserTaskInstanceEntityMapperIT; import io.quarkus.test.junit.QuarkusTest; -import io.quarkus.test.junit.TestProfile; @QuarkusTest -@TestProfile(KeycloakTestProfile.class) -class KeycloakOracleIndexingServiceIT extends AbstractKeycloakIntegrationIndexingServiceIT { +class UserTaskInstanceEntityMapperIT extends AbstractUserTaskInstanceEntityMapperIT { } 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/JobEntityQueryIT.java new file mode 100644 index 0000000000..a99c7eeabd --- /dev/null +++ b/data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/query/JobEntityQueryIT.java @@ -0,0 +1,31 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.kie.kogito.index.jdbc.query; + +import org.kie.kogito.index.jpa.query.AbstractJobEntityQueryIT; + +import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.h2.H2DatabaseTestResource; +import io.quarkus.test.junit.QuarkusTest; + +@QuarkusTest +@QuarkusTestResource(H2DatabaseTestResource.class) +class JobEntityQueryIT 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/ProcessDefinitionEntityQueryIT.java new file mode 100644 index 0000000000..c99803b83a --- /dev/null +++ b/data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/query/ProcessDefinitionEntityQueryIT.java @@ -0,0 +1,31 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.kie.kogito.index.jdbc.query; + +import org.kie.kogito.index.jpa.query.AbstractProcessDefinitionEntityQueryIT; + +import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.h2.H2DatabaseTestResource; +import io.quarkus.test.junit.QuarkusTest; + +@QuarkusTest +@QuarkusTestResource(H2DatabaseTestResource.class) +class ProcessDefinitionEntityQueryIT 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/ProcessInstanceEntityQueryIT.java new file mode 100644 index 0000000000..10bd679b53 --- /dev/null +++ b/data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/query/ProcessInstanceEntityQueryIT.java @@ -0,0 +1,35 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.kie.kogito.index.jdbc.query; + +import org.kie.kogito.index.jpa.query.AbstractProcessInstanceEntityQueryIT; + +import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.h2.H2DatabaseTestResource; +import io.quarkus.test.junit.QuarkusTest; + +@QuarkusTest +@QuarkusTestResource(H2DatabaseTestResource.class) +class ProcessInstanceEntityQueryIT extends AbstractProcessInstanceEntityQueryIT { + + @Override + protected Boolean isDateTimeAsLong() { + return false; + } +} 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/UserTaskInstanceEntityQueryIT.java new file mode 100644 index 0000000000..abaffc8741 --- /dev/null +++ b/data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/query/UserTaskInstanceEntityQueryIT.java @@ -0,0 +1,31 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.kie.kogito.index.jdbc.query; + +import org.kie.kogito.index.jpa.query.AbstractUserTaskInstanceEntityQueryIT; + +import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.h2.H2DatabaseTestResource; +import io.quarkus.test.junit.QuarkusTest; + +@QuarkusTest +@QuarkusTestResource(H2DatabaseTestResource.class) +class UserTaskInstanceEntityQueryIT 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/JobStorageIT.java new file mode 100644 index 0000000000..88c5db0fbb --- /dev/null +++ b/data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/storage/JobStorageIT.java @@ -0,0 +1,31 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.kie.kogito.index.jdbc.storage; + +import org.kie.kogito.index.jpa.storage.AbstractJobStorageIT; + +import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.h2.H2DatabaseTestResource; +import io.quarkus.test.junit.QuarkusTest; + +@QuarkusTest +@QuarkusTestResource(H2DatabaseTestResource.class) +public class JobStorageIT 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/ProcessDefinitionStorageIT.java new file mode 100644 index 0000000000..b0369d8369 --- /dev/null +++ b/data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/storage/ProcessDefinitionStorageIT.java @@ -0,0 +1,31 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.kie.kogito.index.jdbc.storage; + +import org.kie.kogito.index.jpa.storage.AbstractProcessDefinitionStorageIT; + +import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.h2.H2DatabaseTestResource; +import io.quarkus.test.junit.QuarkusTest; + +@QuarkusTest +@QuarkusTestResource(H2DatabaseTestResource.class) +class ProcessDefinitionStorageIT 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/ProcessInstanceStorageIT.java new file mode 100644 index 0000000000..9f40d50928 --- /dev/null +++ b/data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/storage/ProcessInstanceStorageIT.java @@ -0,0 +1,30 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.kie.kogito.index.jdbc.storage; + +import org.kie.kogito.index.jpa.storage.AbstractProcessInstanceStorageIT; + +import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.h2.H2DatabaseTestResource; +import io.quarkus.test.junit.QuarkusTest; + +@QuarkusTest +@QuarkusTestResource(H2DatabaseTestResource.class) +public class ProcessInstanceStorageIT 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/UserTaskInstanceStorageIT.java new file mode 100644 index 0000000000..4a6b9921e5 --- /dev/null +++ b/data-index/data-index-storage/data-index-storage-jpa/src/test/java/org/kie/kogito/index/jdbc/storage/UserTaskInstanceStorageIT.java @@ -0,0 +1,30 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.kie.kogito.index.jdbc.storage; + +import org.kie.kogito.index.jpa.storage.AbstractUserTaskInstanceStorageIT; + +import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.h2.H2DatabaseTestResource; +import io.quarkus.test.junit.QuarkusTest; + +@QuarkusTest +@QuarkusTestResource(H2DatabaseTestResource.class) +public class UserTaskInstanceStorageIT extends AbstractUserTaskInstanceStorageIT { +} diff --git a/data-index/data-index-storage/data-index-storage-oracle/src/test/resources/application.properties b/data-index/data-index-storage/data-index-storage-jpa/src/test/resources/application.properties similarity index 84% rename from data-index/data-index-storage/data-index-storage-oracle/src/test/resources/application.properties rename to data-index/data-index-storage/data-index-storage-jpa/src/test/resources/application.properties index 6dbb374445..5cf2dfb3a2 100644 --- a/data-index/data-index-storage/data-index-storage-oracle/src/test/resources/application.properties +++ b/data-index/data-index-storage/data-index-storage-jpa/src/test/resources/application.properties @@ -18,12 +18,10 @@ # # Kogito -kogito.apps.persistence.type=oracle +kogito.apps.persistence.type=jdbc # Data source -quarkus.datasource.db-kind=oracle -quarkus.datasource.username=kogito -quarkus.datasource.password=kogito -quarkus.datasource.jdbc.url=jdbc:oracle://localhost:1521/kogito +quarkus.datasource.db-kind=h2 +quarkus.datasource.jdbc.url=jdbc:h2:tcp://localhost/mem:test;NON_KEYWORDS=VALUE,KEY # Hibernate quarkus.hibernate-orm.database.generation=create quarkus.hibernate-orm.database.generation.halt-on-error=true diff --git a/data-index/data-index-storage/data-index-storage-mongodb/src/main/java/org/kie/kogito/index/mongodb/model/ProcessDefinitionEntityMapper.java b/data-index/data-index-storage/data-index-storage-mongodb/src/main/java/org/kie/kogito/index/mongodb/model/ProcessDefinitionEntityMapper.java index 6dfc5573db..ea91176fbd 100644 --- a/data-index/data-index-storage/data-index-storage-mongodb/src/main/java/org/kie/kogito/index/mongodb/model/ProcessDefinitionEntityMapper.java +++ b/data-index/data-index-storage/data-index-storage-mongodb/src/main/java/org/kie/kogito/index/mongodb/model/ProcessDefinitionEntityMapper.java @@ -40,7 +40,7 @@ public ProcessDefinitionEntity mapToEntity(String key, ProcessDefinition pd) { } ProcessDefinitionEntity entity = new ProcessDefinitionEntity(); - entity.setKey(pd.getKey()); + entity.setKey(key); entity.setId(pd.getId()); entity.setVersion(pd.getVersion()); entity.setName(pd.getName()); diff --git a/data-index/data-index-storage/data-index-storage-mongodb/src/test/java/org/kie/kogito/index/mongodb/query/ProcessDefinitionQueryIT.java b/data-index/data-index-storage/data-index-storage-mongodb/src/test/java/org/kie/kogito/index/mongodb/query/ProcessDefinitionQueryIT.java index b2d18d3928..1f126d801d 100644 --- a/data-index/data-index-storage/data-index-storage-mongodb/src/test/java/org/kie/kogito/index/mongodb/query/ProcessDefinitionQueryIT.java +++ b/data-index/data-index-storage/data-index-storage-mongodb/src/test/java/org/kie/kogito/index/mongodb/query/ProcessDefinitionQueryIT.java @@ -20,8 +20,10 @@ import org.junit.jupiter.api.BeforeEach; import org.kie.kogito.index.model.ProcessDefinition; +import org.kie.kogito.index.model.ProcessDefinitionKey; import org.kie.kogito.index.mongodb.model.ProcessDefinitionEntity; import org.kie.kogito.index.mongodb.model.ProcessDefinitionEntityMapper; +import org.kie.kogito.index.storage.ModelProcessDefinitionStorage; import org.kie.kogito.index.test.query.AbstractProcessDefinitionQueryIT; import org.kie.kogito.persistence.api.Storage; import org.kie.kogito.persistence.mongodb.client.MongoClientManager; @@ -42,16 +44,16 @@ class ProcessDefinitionQueryIT extends AbstractProcessDefinitionQueryIT { @Inject MongoClientManager mongoClientManager; - Storage storage; + Storage storage; @BeforeEach void setUp() { - this.storage = new MongoStorage<>(mongoClientManager.getCollection(PROCESS_DEFINITIONS_STORAGE, ProcessDefinitionEntity.class), - ProcessDefinition.class.getName(), new ProcessDefinitionEntityMapper()); + this.storage = new ModelProcessDefinitionStorage(new MongoStorage<>(mongoClientManager.getCollection(PROCESS_DEFINITIONS_STORAGE, ProcessDefinitionEntity.class), + ProcessDefinition.class.getName(), new ProcessDefinitionEntityMapper())); } @Override - public Storage getStorage() { + public Storage getStorage() { return storage; } } diff --git a/data-index/data-index-storage/data-index-storage-mongodb/src/test/java/org/kie/kogito/index/mongodb/storage/ProcessDefinitionStorageIT.java b/data-index/data-index-storage/data-index-storage-mongodb/src/test/java/org/kie/kogito/index/mongodb/storage/ProcessDefinitionStorageIT.java index ec88ef525f..4aec97a2c5 100644 --- a/data-index/data-index-storage/data-index-storage-mongodb/src/test/java/org/kie/kogito/index/mongodb/storage/ProcessDefinitionStorageIT.java +++ b/data-index/data-index-storage/data-index-storage-mongodb/src/test/java/org/kie/kogito/index/mongodb/storage/ProcessDefinitionStorageIT.java @@ -25,8 +25,10 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.kie.kogito.index.model.ProcessDefinition; +import org.kie.kogito.index.model.ProcessDefinitionKey; import org.kie.kogito.index.mongodb.model.ProcessDefinitionEntity; import org.kie.kogito.index.mongodb.model.ProcessDefinitionEntityMapper; +import org.kie.kogito.index.storage.ModelProcessDefinitionStorage; import org.kie.kogito.index.test.TestUtils; import org.kie.kogito.persistence.api.Storage; import org.kie.kogito.persistence.mongodb.client.MongoClientManager; @@ -42,17 +44,17 @@ @QuarkusTest @QuarkusTestResource(MongoDBQuarkusTestResource.class) -class ProcessDefinitionStorageIT extends StorageTestBase { +class ProcessDefinitionStorageIT extends StorageTestBase { @Inject MongoClientManager mongoClientManager; - Storage storage; + Storage storage; @BeforeEach void setUp() { - this.storage = new MongoStorage<>(mongoClientManager.getCollection(PROCESS_DEFINITIONS_STORAGE, ProcessDefinitionEntity.class), - ProcessDefinition.class.getName(), new ProcessDefinitionEntityMapper()); + this.storage = new ModelProcessDefinitionStorage(new MongoStorage<>(mongoClientManager.getCollection(PROCESS_DEFINITIONS_STORAGE, ProcessDefinitionEntity.class), + ProcessDefinition.class.getName(), new ProcessDefinitionEntityMapper())); } @AfterEach @@ -66,6 +68,6 @@ void testCache() { String version = "1.0"; ProcessDefinition pdv1 = TestUtils.createProcessDefinition(processId, version, Set.of("admin", "kogito")); ProcessDefinition pdv2 = TestUtils.createProcessDefinition(processId, version, Set.of("kogito")); - testStorage(storage, pdv1.getKey(), pdv1, pdv2); + testStorage(storage, new ProcessDefinitionKey(processId, version), pdv1, pdv2); } } diff --git a/data-index/data-index-storage/data-index-storage-oracle/src/main/java/org/kie/kogito/index/oracle/OracleStorageServiceProducer.java b/data-index/data-index-storage/data-index-storage-oracle/src/main/java/org/kie/kogito/index/oracle/OracleStorageServiceProducer.java deleted file mode 100644 index f14dde82e9..0000000000 --- a/data-index/data-index-storage/data-index-storage-oracle/src/main/java/org/kie/kogito/index/oracle/OracleStorageServiceProducer.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.kogito.index.oracle; - -import org.kie.kogito.index.jpa.storage.JPAStorageService; -import org.kie.kogito.index.jpa.storage.JobEntityStorage; -import org.kie.kogito.index.jpa.storage.ProcessDefinitionEntityStorage; -import org.kie.kogito.index.jpa.storage.ProcessInstanceEntityStorage; -import org.kie.kogito.index.jpa.storage.UserTaskInstanceEntityStorage; -import org.kie.kogito.persistence.api.StorageService; - -import io.quarkus.arc.properties.IfBuildProperty; - -import jakarta.annotation.Priority; -import jakarta.enterprise.context.ApplicationScoped; -import jakarta.enterprise.inject.Alternative; -import jakarta.enterprise.inject.Produces; - -import static org.kie.kogito.persistence.api.factory.Constants.PERSISTENCE_TYPE_PROPERTY; - -public class OracleStorageServiceProducer { - @Produces - @Alternative - @Priority(1) - @ApplicationScoped - @IfBuildProperty(name = PERSISTENCE_TYPE_PROPERTY, stringValue = "oracle") - StorageService PostgreSqlStorageService(final ProcessDefinitionEntityStorage definitionStorage, - final ProcessInstanceEntityStorage processStorage, - final JobEntityStorage jobStorage, - final UserTaskInstanceEntityStorage taskStorage) { - return new JPAStorageService(definitionStorage, processStorage, jobStorage, taskStorage); - } -} diff --git a/data-index/data-index-storage/data-index-storage-oracle/src/main/resources/META-INF/beans.xml b/data-index/data-index-storage/data-index-storage-oracle/src/main/resources/META-INF/beans.xml deleted file mode 100644 index a0eb9fbf8c..0000000000 --- a/data-index/data-index-storage/data-index-storage-oracle/src/main/resources/META-INF/beans.xml +++ /dev/null @@ -1,20 +0,0 @@ - diff --git a/data-index/data-index-storage/data-index-storage-oracle/src/test/java/org/kie/kogito/index/oracle/schema/DDLSchemaExporter.java b/data-index/data-index-storage/data-index-storage-oracle/src/test/java/org/kie/kogito/index/oracle/schema/DDLSchemaExporter.java deleted file mode 100644 index 6e2c2dfde5..0000000000 --- a/data-index/data-index-storage/data-index-storage-oracle/src/test/java/org/kie/kogito/index/oracle/schema/DDLSchemaExporter.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.kogito.index.oracle.schema; - -import java.util.EnumSet; -import java.util.HashMap; -import java.util.Map; - -import org.hibernate.boot.Metadata; -import org.hibernate.boot.MetadataSources; -import org.hibernate.boot.registry.StandardServiceRegistry; -import org.hibernate.boot.registry.StandardServiceRegistryBuilder; -import org.hibernate.cfg.Environment; -import org.hibernate.tool.hbm2ddl.SchemaExport; -import org.hibernate.tool.schema.TargetType; -import org.kie.kogito.index.jpa.model.AttachmentEntity; -import org.kie.kogito.index.jpa.model.CommentEntity; -import org.kie.kogito.index.jpa.model.JobEntity; -import org.kie.kogito.index.jpa.model.MilestoneEntity; -import org.kie.kogito.index.jpa.model.NodeEntity; -import org.kie.kogito.index.jpa.model.NodeInstanceEntity; -import org.kie.kogito.index.jpa.model.ProcessDefinitionEntity; -import org.kie.kogito.index.jpa.model.ProcessInstanceEntity; -import org.kie.kogito.index.jpa.model.ProcessInstanceErrorEntity; -import org.kie.kogito.index.jpa.model.UserTaskInstanceEntity; -import org.kie.kogito.testcontainers.KogitoOracleSqlContainer; - -public class DDLSchemaExporter { - - public static void main(String[] args) { - try (KogitoOracleSqlContainer oracleSql = new KogitoOracleSqlContainer()) { - oracleSql.start(); - Map settings = new HashMap<>(); - settings.put(Environment.URL, oracleSql.getJdbcUrl()); - settings.put(Environment.USER, oracleSql.getUsername()); - settings.put(Environment.PASS, oracleSql.getPassword()); - settings.put(Environment.PHYSICAL_NAMING_STRATEGY, "org.hibernate.boot.model.naming.CamelCaseToUnderscoresNamingStrategy"); - - StandardServiceRegistry serviceRegistry = new StandardServiceRegistryBuilder().applySettings(settings).build(); - - MetadataSources metadataSources = new MetadataSources(serviceRegistry); - metadataSources.addAnnotatedClass(NodeEntity.class); - metadataSources.addAnnotatedClass(ProcessDefinitionEntity.class); - metadataSources.addAnnotatedClass(JobEntity.class); - metadataSources.addAnnotatedClass(MilestoneEntity.class); - metadataSources.addAnnotatedClass(NodeInstanceEntity.class); - metadataSources.addAnnotatedClass(ProcessInstanceEntity.class); - metadataSources.addAnnotatedClass(ProcessInstanceErrorEntity.class); - metadataSources.addAnnotatedClass(AttachmentEntity.class); - metadataSources.addAnnotatedClass(CommentEntity.class); - metadataSources.addAnnotatedClass(UserTaskInstanceEntity.class); - Metadata metadata = metadataSources.buildMetadata(); - - SchemaExport schemaExport = new SchemaExport(); - schemaExport.setDelimiter(";"); - schemaExport.setFormat(true); - schemaExport.setOverrideOutputFileContent(); - schemaExport.setOutputFile("src/main/resources/data_index_create.sql"); - schemaExport.createOnly(EnumSet.of(TargetType.SCRIPT), metadata); - schemaExport.getExceptions().forEach(System.err::println); - } catch (Exception ex) { - ex.printStackTrace(); - } - } -} diff --git a/data-index/data-index-storage/data-index-storage-postgresql/pom.xml b/data-index/data-index-storage/data-index-storage-postgresql/pom.xml index 75ab6b6b4c..dc2fca03e5 100644 --- a/data-index/data-index-storage/data-index-storage-postgresql/pom.xml +++ b/data-index/data-index-storage/data-index-storage-postgresql/pom.xml @@ -39,7 +39,7 @@ org.kie.kogito - data-index-storage-jpa + data-index-storage-jpa-common org.kie.kogito @@ -51,6 +51,13 @@ test-jar test + + org.kie.kogito + data-index-storage-jpa-common + test-jar + test + ${project.version} + io.quarkus quarkus-junit5-mockito diff --git a/data-index/data-index-storage/data-index-storage-postgresql/src/main/java/org/kie/kogito/index/postgresql/PostgreSqlStorageServiceProducer.java b/data-index/data-index-storage/data-index-storage-postgresql/src/main/java/org/kie/kogito/index/postgresql/PostgreSqlStorageServiceProducer.java deleted file mode 100644 index 4e495f1071..0000000000 --- a/data-index/data-index-storage/data-index-storage-postgresql/src/main/java/org/kie/kogito/index/postgresql/PostgreSqlStorageServiceProducer.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.kogito.index.postgresql; - -import org.kie.kogito.index.jpa.storage.JPAStorageService; -import org.kie.kogito.index.jpa.storage.JobEntityStorage; -import org.kie.kogito.index.jpa.storage.ProcessDefinitionEntityStorage; -import org.kie.kogito.index.jpa.storage.ProcessInstanceEntityStorage; -import org.kie.kogito.index.jpa.storage.UserTaskInstanceEntityStorage; -import org.kie.kogito.persistence.api.StorageService; - -import io.quarkus.arc.properties.IfBuildProperty; - -import jakarta.annotation.Priority; -import jakarta.enterprise.context.ApplicationScoped; -import jakarta.enterprise.inject.Alternative; -import jakarta.enterprise.inject.Produces; - -import static org.kie.kogito.persistence.api.factory.Constants.PERSISTENCE_TYPE_PROPERTY; -import static org.kie.kogito.persistence.postgresql.Constants.POSTGRESQL_STORAGE; - -public class PostgreSqlStorageServiceProducer { - @Produces - @Alternative - @Priority(1) - @ApplicationScoped - @IfBuildProperty(name = PERSISTENCE_TYPE_PROPERTY, stringValue = POSTGRESQL_STORAGE) - StorageService PostgreSqlStorageService(final ProcessDefinitionEntityStorage definitionStorage, - final ProcessInstanceEntityStorage processStorage, - final JobEntityStorage jobStorage, - final UserTaskInstanceEntityStorage taskStorage) { - return new JPAStorageService(definitionStorage, processStorage, jobStorage, taskStorage); - } -} diff --git a/data-index/data-index-storage/data-index-storage-postgresql/src/main/resources/db/migration/V1.45.0.3__add_fk_index.sql b/data-index/data-index-storage/data-index-storage-postgresql/src/main/resources/db/migration/V1.45.0.3__add_fk_index.sql new file mode 100644 index 0000000000..72e909ac55 --- /dev/null +++ b/data-index/data-index-storage/data-index-storage-postgresql/src/main/resources/db/migration/V1.45.0.3__add_fk_index.sql @@ -0,0 +1,17 @@ +create index if not exists idx_attachments_tid on attachments(task_id); +create index if not exists idx_comments_tid on comments(task_id); +create index if not exists idx_definitions_addons_pid_pv on definitions_addons(process_id, process_version); +create index if not exists idx_definitions_annotations_pid_pv on definitions_annotations(process_id, process_version); +create index if not exists idx_definitions_metadata_pid_pv on definitions_metadata(process_id, process_version); +create index if not exists idx_definitions_nodes_pid_pv on definitions_nodes(process_id, process_version); +create index if not exists idx_definitions_nodes_metadata_pid_pv on definitions_nodes_metadata(process_id, process_version); +create index if not exists idx_definitions_roles_pid_pv on definitions_roles(process_id, process_version); +create index if not exists idx_milestones_piid on milestones(process_instance_id); +create index if not exists idx_nodes_piid on nodes(process_instance_id); +create index if not exists idx_processes_addons_pid on processes_addons(process_id); +create index if not exists idx_processes_roles_pid on processes_roles(process_id); +create index if not exists idx_tasks_admin_groups_tid on tasks_admin_groups(task_id); +create index if not exists idx_tasks_admin_users_tid on tasks_admin_users(task_id); +create index if not exists idx_tasks_excluded_users_tid on tasks_excluded_users(task_id); +create index if not exists idx_tasks_potential_groups_tid on tasks_potential_groups(task_id); +create index if not exists idx_tasks_potential_users_tid on tasks_potential_users(task_id); diff --git a/data-index/data-index-storage/data-index-storage-postgresql/src/test/java/org/kie/kogito/index/postgresql/mapper/JobEntityMapperIT.java b/data-index/data-index-storage/data-index-storage-postgresql/src/test/java/org/kie/kogito/index/postgresql/mapper/JobEntityMapperIT.java index 8b18c82c38..42a74c5b9b 100644 --- a/data-index/data-index-storage/data-index-storage-postgresql/src/test/java/org/kie/kogito/index/postgresql/mapper/JobEntityMapperIT.java +++ b/data-index/data-index-storage/data-index-storage-postgresql/src/test/java/org/kie/kogito/index/postgresql/mapper/JobEntityMapperIT.java @@ -18,89 +18,10 @@ */ package org.kie.kogito.index.postgresql.mapper; -import java.time.ZonedDateTime; - -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.kie.kogito.index.jpa.mapper.JobEntityMapper; -import org.kie.kogito.index.jpa.model.JobEntity; -import org.kie.kogito.index.model.Job; +import org.kie.kogito.index.jpa.mapper.AbstractJobEntityMapperIT; import io.quarkus.test.junit.QuarkusTest; -import jakarta.inject.Inject; - -import static org.assertj.core.api.Assertions.assertThat; - @QuarkusTest -class JobEntityMapperIT { - - @Inject - JobEntityMapper mapper; - - Job job = new Job(); - - JobEntity jobEntity = new JobEntity(); - - @BeforeEach - void setup() { - String testId = "testId"; - ZonedDateTime time = ZonedDateTime.now(); - String status = "ACTIVE"; - String processId = "testProcessId"; - String processInstanceId = "testProcessInstanceId"; - String rootProcessId = "testRootProcessId"; - String rootProcessInstanceId = "testRootProcessInstanceId"; - Integer priority = 79; - String callbackEndpoint = "testCallbackEndpoint"; - Long repeatInterval = 70L; - Integer repeatLimit = 89; - String scheduledId = "testScheduleId"; - Integer retries = 25; - Integer executionCounter = 17; - - job.setId(testId); - job.setStatus(status); - job.setLastUpdate(time); - job.setProcessId(processId); - job.setProcessInstanceId(processInstanceId); - job.setRootProcessId(rootProcessId); - job.setRootProcessInstanceId(rootProcessInstanceId); - job.setExpirationTime(time); - job.setPriority(priority); - job.setCallbackEndpoint(callbackEndpoint); - job.setRepeatInterval(repeatInterval); - job.setRepeatLimit(repeatLimit); - job.setScheduledId(scheduledId); - job.setRetries(retries); - job.setExecutionCounter(executionCounter); - - jobEntity.setId(testId); - jobEntity.setStatus(status); - jobEntity.setLastUpdate(time); - jobEntity.setProcessId(processId); - jobEntity.setProcessInstanceId(processInstanceId); - jobEntity.setRootProcessId(rootProcessId); - jobEntity.setRootProcessInstanceId(rootProcessInstanceId); - jobEntity.setExpirationTime(time); - jobEntity.setPriority(priority); - jobEntity.setCallbackEndpoint(callbackEndpoint); - jobEntity.setRepeatInterval(repeatInterval); - jobEntity.setRepeatLimit(repeatLimit); - jobEntity.setScheduledId(scheduledId); - jobEntity.setRetries(retries); - jobEntity.setExecutionCounter(executionCounter); - } - - @Test - void testMapToEntity() { - JobEntity result = mapper.mapToEntity(job); - assertThat(result).isEqualToIgnoringGivenFields(jobEntity, "$$_hibernate_tracker"); - } - - @Test - void testMapToModel() { - Job result = mapper.mapToModel(jobEntity); - assertThat(result).isEqualToComparingFieldByField(job); - } +class JobEntityMapperIT extends AbstractJobEntityMapperIT { } diff --git a/data-index/data-index-storage/data-index-storage-postgresql/src/test/java/org/kie/kogito/index/postgresql/mapper/ProcessDefinitionEntityMapperIT.java b/data-index/data-index-storage/data-index-storage-postgresql/src/test/java/org/kie/kogito/index/postgresql/mapper/ProcessDefinitionEntityMapperIT.java index 35634f9713..eb7cef3d14 100644 --- a/data-index/data-index-storage/data-index-storage-postgresql/src/test/java/org/kie/kogito/index/postgresql/mapper/ProcessDefinitionEntityMapperIT.java +++ b/data-index/data-index-storage/data-index-storage-postgresql/src/test/java/org/kie/kogito/index/postgresql/mapper/ProcessDefinitionEntityMapperIT.java @@ -18,88 +18,10 @@ */ package org.kie.kogito.index.postgresql.mapper; -import java.util.Set; - -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.kie.kogito.index.jpa.mapper.ProcessDefinitionEntityMapper; -import org.kie.kogito.index.jpa.model.NodeEntity; -import org.kie.kogito.index.jpa.model.ProcessDefinitionEntity; -import org.kie.kogito.index.model.Node; -import org.kie.kogito.index.model.ProcessDefinition; +import org.kie.kogito.index.jpa.mapper.AbstractProcessDefinitionEntityMapperIT; import io.quarkus.test.junit.QuarkusTest; -import jakarta.inject.Inject; - -import static java.util.Collections.singleton; -import static java.util.Collections.singletonList; -import static java.util.Collections.singletonMap; -import static org.assertj.core.api.Assertions.assertThat; - @QuarkusTest -class ProcessDefinitionEntityMapperIT { - - ProcessDefinition pd = new ProcessDefinition(); - ProcessDefinitionEntity entity = new ProcessDefinitionEntity(); - - @Inject - ProcessDefinitionEntityMapper mapper; - - @BeforeEach - void setup() { - String version = "1.0"; - String processId = "testProcessId"; - Set roles = singleton("testRoles"); - String type = "testType"; - Set addons = singleton("testAddons"); - - String nodeId = "testNodeId"; - String nodeName = "testNodeName"; - String nodeUniqueId = "testNodeUniqueId"; - String nodeMetadataUniqueId = "testMetadataUniqueId"; - String nodeType = "testNodeType"; - - Node node = new Node(); - node.setId(nodeId); - node.setName(nodeName); - node.setType(nodeType); - node.setUniqueId(nodeUniqueId); - node.setMetadata(singletonMap("UniqueId", nodeMetadataUniqueId)); - - pd.setId(processId); - pd.setVersion(version); - pd.setRoles(roles); - pd.setAddons(addons); - pd.setType(type); - pd.setNodes(singletonList(node)); - - NodeEntity nodeEntity = new NodeEntity(); - nodeEntity.setId(nodeId); - nodeEntity.setName(nodeName); - nodeEntity.setType(nodeType); - nodeEntity.setUniqueId(nodeUniqueId); - nodeEntity.setMetadata(singletonMap("UniqueId", nodeMetadataUniqueId)); - nodeEntity.setProcessDefinition(entity); - - entity.setId(processId); - entity.setVersion(version); - entity.setRoles(roles); - entity.setAddons(addons); - entity.setType(type); - entity.setNodes(singletonList(nodeEntity)); - } - - @Test - void testMapToEntity() { - ProcessDefinitionEntity result = mapper.mapToEntity(pd); - assertThat(result).usingRecursiveComparison().ignoringFieldsMatchingRegexes(".*\\$\\$_hibernate_tracker").isEqualTo(entity); - } - - @Test - void testMapToModel() { - ProcessDefinition result = mapper.mapToModel(entity); - assertThat(result).usingRecursiveComparison().isEqualTo(pd); - } - +class ProcessDefinitionEntityMapperIT extends AbstractProcessDefinitionEntityMapperIT { } diff --git a/data-index/data-index-storage/data-index-storage-postgresql/src/test/java/org/kie/kogito/index/postgresql/mapper/ProcessInstanceEntityMapperIT.java b/data-index/data-index-storage/data-index-storage-postgresql/src/test/java/org/kie/kogito/index/postgresql/mapper/ProcessInstanceEntityMapperIT.java index ea0b9fdba8..949bd0c010 100644 --- a/data-index/data-index-storage/data-index-storage-postgresql/src/test/java/org/kie/kogito/index/postgresql/mapper/ProcessInstanceEntityMapperIT.java +++ b/data-index/data-index-storage/data-index-storage-postgresql/src/test/java/org/kie/kogito/index/postgresql/mapper/ProcessInstanceEntityMapperIT.java @@ -18,169 +18,10 @@ */ package org.kie.kogito.index.postgresql.mapper; -import java.time.ZonedDateTime; -import java.util.Set; - -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.kie.kogito.index.jpa.mapper.ProcessInstanceEntityMapper; -import org.kie.kogito.index.jpa.model.MilestoneEntity; -import org.kie.kogito.index.jpa.model.MilestoneEntityId; -import org.kie.kogito.index.jpa.model.NodeInstanceEntity; -import org.kie.kogito.index.jpa.model.ProcessInstanceEntity; -import org.kie.kogito.index.jpa.model.ProcessInstanceErrorEntity; -import org.kie.kogito.index.model.Milestone; -import org.kie.kogito.index.model.NodeInstance; -import org.kie.kogito.index.model.ProcessInstance; -import org.kie.kogito.index.model.ProcessInstanceError; - -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.node.ObjectNode; +import org.kie.kogito.index.jpa.mapper.AbstractProcessInstanceEntityMapperIT; import io.quarkus.test.junit.QuarkusTest; -import jakarta.inject.Inject; - -import static java.util.Collections.singleton; -import static java.util.Collections.singletonList; -import static org.assertj.core.api.Assertions.assertThat; - @QuarkusTest -class ProcessInstanceEntityMapperIT { - - ObjectMapper jsonMapper = new ObjectMapper(); - ProcessInstance processInstance = new ProcessInstance(); - ProcessInstanceEntity processInstanceEntity = new ProcessInstanceEntity(); - - @Inject - ProcessInstanceEntityMapper mapper; - - @BeforeEach - void setup() { - String nodeInstanceId = "testNodeInstanceId"; - String nodeInstanceName = "testNodeInstanceName"; - String nodeInstanceNodeId = "testNodeInstanceNodeId"; - String nodeInstanceType = "testNodeInstanceType"; - String nodeInstanceDefinitionId = "testNodeInstanceDefinitionId"; - - String processInstanceErrorMessage = "testProcessInstanceErrorMessage"; - String processInstanceErrorNodeDefinitionId = "testProcessInstanceErrorNodeDefinitionId"; - - String milestoneId = "testMilestone"; - String milestoneName = "testMilestoneName"; - String milestoneStatus = "testMilestoneStatus"; - - String testId = "testId"; - String processId = "testProcessId"; - Set roles = singleton("testRoles"); - ObjectNode variables = jsonMapper.createObjectNode(); - variables.put("test", "testValue"); - String endpoint = "testEndpoint"; - Integer state = 2; - ZonedDateTime time = ZonedDateTime.now(); - String rootProcessId = "testRootProcessId"; - String rootProcessInstanceId = "testRootProcessInstanceId"; - String parentProcessInstanceId = "testParentProcessInstanceId"; - String processName = "testProcessName"; - Set addons = singleton("testAddons"); - String businessKey = "testBusinessKey"; - String createdBy = "initiatorUser"; - String updatedBy = "currentUser"; - - NodeInstance nodeInstance = new NodeInstance(); - nodeInstance.setId(nodeInstanceId); - nodeInstance.setDefinitionId(nodeInstanceDefinitionId); - nodeInstance.setExit(time); - nodeInstance.setEnter(time); - nodeInstance.setType(nodeInstanceType); - nodeInstance.setNodeId(nodeInstanceNodeId); - nodeInstance.setName(nodeInstanceName); - - ProcessInstanceError processInstanceError = new ProcessInstanceError(); - processInstanceError.setMessage(processInstanceErrorMessage); - processInstanceError.setNodeDefinitionId(processInstanceErrorNodeDefinitionId); - - Milestone milestone = new Milestone(); - milestone.setId(milestoneId); - milestone.setName(milestoneName); - milestone.setStatus(milestoneStatus); - - processInstance.setId(testId); - processInstance.setProcessId(processId); - processInstance.setRoles(roles); - processInstance.setVariables(variables); - processInstance.setEndpoint(endpoint); - processInstance.setNodes(singletonList(nodeInstance)); - processInstance.setState(state); - processInstance.setStart(time); - processInstance.setEnd(time); - processInstance.setRootProcessId(rootProcessId); - processInstance.setRootProcessInstanceId(rootProcessInstanceId); - processInstance.setParentProcessInstanceId(parentProcessInstanceId); - processInstance.setProcessName(processName); - processInstance.setError(processInstanceError); - processInstance.setAddons(addons); - processInstance.setLastUpdate(time); - processInstance.setBusinessKey(businessKey); - processInstance.setMilestones(singletonList(milestone)); - processInstance.setCreatedBy(createdBy); - processInstance.setUpdatedBy(updatedBy); - - NodeInstanceEntity nodeInstanceEntity = new NodeInstanceEntity(); - nodeInstanceEntity.setId(nodeInstanceId); - nodeInstanceEntity.setDefinitionId(nodeInstanceDefinitionId); - nodeInstanceEntity.setEnter(time); - nodeInstanceEntity.setExit(time); - nodeInstanceEntity.setName(nodeInstanceName); - nodeInstanceEntity.setNodeId(nodeInstanceNodeId); - nodeInstanceEntity.setType(nodeInstanceType); - nodeInstanceEntity.setProcessInstance(processInstanceEntity); - - ProcessInstanceErrorEntity processInstanceErrorEntity = new ProcessInstanceErrorEntity(); - processInstanceErrorEntity.setMessage(processInstanceErrorMessage); - processInstanceErrorEntity.setNodeDefinitionId(processInstanceErrorNodeDefinitionId); - - MilestoneEntity milestoneEntity = new MilestoneEntity(); - MilestoneEntityId milestoneEntityId = new MilestoneEntityId(); - milestoneEntityId.setId(milestoneId); - milestoneEntityId.setProcessInstance(testId); - milestoneEntity.setId(milestoneId); - milestoneEntity.setName(milestoneName); - milestoneEntity.setStatus(milestoneStatus); - milestoneEntity.setProcessInstance(processInstanceEntity); - - processInstanceEntity.setId(testId); - processInstanceEntity.setProcessId(processId); - processInstanceEntity.setRoles(roles); - processInstanceEntity.setVariables(variables); - processInstanceEntity.setEndpoint(endpoint); - processInstanceEntity.setNodes(singletonList(nodeInstanceEntity)); - processInstanceEntity.setState(state); - processInstanceEntity.setStart(time); - processInstanceEntity.setEnd(time); - processInstanceEntity.setRootProcessId(rootProcessId); - processInstanceEntity.setRootProcessInstanceId(rootProcessInstanceId); - processInstanceEntity.setParentProcessInstanceId(parentProcessInstanceId); - processInstanceEntity.setProcessName(processName); - processInstanceEntity.setError(processInstanceErrorEntity); - processInstanceEntity.setAddons(addons); - processInstanceEntity.setLastUpdate(time); - processInstanceEntity.setBusinessKey(businessKey); - processInstanceEntity.setMilestones(singletonList(milestoneEntity)); - processInstanceEntity.setCreatedBy(createdBy); - processInstanceEntity.setUpdatedBy(updatedBy); - } - - @Test - void testMapToEntity() { - ProcessInstanceEntity result = mapper.mapToEntity(processInstance); - assertThat(result).usingRecursiveComparison().ignoringFieldsMatchingRegexes(".*\\$\\$_hibernate_tracker").isEqualTo(processInstanceEntity); - } - - @Test - void testMapToModel() { - ProcessInstance result = mapper.mapToModel(processInstanceEntity); - assertThat(result).usingRecursiveComparison().isEqualTo(processInstance); - } - +class ProcessInstanceEntityMapperIT extends AbstractProcessInstanceEntityMapperIT { } diff --git a/data-index/data-index-storage/data-index-storage-postgresql/src/test/java/org/kie/kogito/index/postgresql/mapper/UserTaskInstanceEntityMapperIT.java b/data-index/data-index-storage/data-index-storage-postgresql/src/test/java/org/kie/kogito/index/postgresql/mapper/UserTaskInstanceEntityMapperIT.java index 39574a8020..65a1ef1a6c 100644 --- a/data-index/data-index-storage/data-index-storage-postgresql/src/test/java/org/kie/kogito/index/postgresql/mapper/UserTaskInstanceEntityMapperIT.java +++ b/data-index/data-index-storage/data-index-storage-postgresql/src/test/java/org/kie/kogito/index/postgresql/mapper/UserTaskInstanceEntityMapperIT.java @@ -18,151 +18,10 @@ */ package org.kie.kogito.index.postgresql.mapper; -import java.time.ZonedDateTime; -import java.util.HashMap; -import java.util.Map; -import java.util.Set; - -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.kie.kogito.index.jpa.mapper.UserTaskInstanceEntityMapper; -import org.kie.kogito.index.jpa.model.AttachmentEntity; -import org.kie.kogito.index.jpa.model.CommentEntity; -import org.kie.kogito.index.jpa.model.UserTaskInstanceEntity; -import org.kie.kogito.index.model.Attachment; -import org.kie.kogito.index.model.Comment; -import org.kie.kogito.index.model.UserTaskInstance; - -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.node.ObjectNode; +import org.kie.kogito.index.jpa.mapper.AbstractUserTaskInstanceEntityMapperIT; import io.quarkus.test.junit.QuarkusTest; -import jakarta.inject.Inject; - -import static java.util.Collections.singleton; -import static java.util.Collections.singletonList; -import static org.assertj.core.api.Assertions.assertThat; - @QuarkusTest -class UserTaskInstanceEntityMapperIT { - - UserTaskInstance userTaskInstance = new UserTaskInstance(); - UserTaskInstanceEntity userTaskInstanceEntity = new UserTaskInstanceEntity(); - - @Inject - ObjectMapper jsonMapper; - - @Inject - UserTaskInstanceEntityMapper mapper; - - @BeforeEach - void setup() { - String testId = "testId"; - String description = "testDescription"; - String name = "testName"; - String priority = "10"; - String processInstanceId = "testProcessInstanceId"; - String state = "testState"; - String actualOwner = "testActualOwner"; - Set adminGroups = singleton("testAdminGroups"); - Set adminUsers = singleton("testAdminUsers"); - ZonedDateTime time = ZonedDateTime.now(); - Set excludedUsers = singleton("testExcludedUsers"); - Set potentialGroups = singleton("testPotentialGroups"); - Set potentialUsers = singleton("testPotentialUsers"); - String referenceName = "testReferenceName"; - String processId = "testProcessId"; - String rootProcessId = "testRootProcessId"; - String rootProcessInstanceId = "testRootProcessInstanceId"; - Map object = new HashMap<>(); - object.put("test", "testValue"); - ObjectNode inputs = jsonMapper.createObjectNode().put("testInput", "testValue"); - ObjectNode outputs = jsonMapper.createObjectNode().put("testOutput", "testValue"); - - String commentId = "testCommentId"; - String comment_content = "testCommentContent"; - String comment_updatedBy = "testCommentUpdatedBy"; - Comment comment = Comment.builder().id(commentId).updatedAt(time).updatedBy(comment_updatedBy).content(comment_content).build(); - CommentEntity commentEntity = new CommentEntity(); - commentEntity.setId(commentId); - commentEntity.setContent(comment_content); - commentEntity.setUpdatedAt(time); - commentEntity.setUpdatedBy(comment_updatedBy); - commentEntity.setUserTask(userTaskInstanceEntity); - - String attachmentId = "testAttachmentId"; - String attachment_name = "testAttachmentName"; - String attachment_content = "testAttachmentContent"; - String attachment_updatedBy = "testAttachmentUpdatedBy"; - Attachment attachment = Attachment.builder().id(attachmentId).updatedAt(time).updatedBy(attachment_updatedBy) - .content(attachment_content).name(attachment_name).build(); - AttachmentEntity attachmentEntity = new AttachmentEntity(); - attachmentEntity.setId(attachmentId); - attachmentEntity.setContent(attachment_content); - attachmentEntity.setName(attachment_name); - attachmentEntity.setUpdatedAt(time); - attachmentEntity.setUpdatedBy(attachment_updatedBy); - attachmentEntity.setUserTask(userTaskInstanceEntity); - - userTaskInstance.setId(testId); - userTaskInstance.setDescription(description); - userTaskInstance.setName(name); - userTaskInstance.setPriority(priority); - userTaskInstance.setProcessInstanceId(processInstanceId); - userTaskInstance.setState(state); - userTaskInstance.setActualOwner(actualOwner); - userTaskInstance.setAdminGroups(adminGroups); - userTaskInstance.setAdminUsers(adminUsers); - userTaskInstance.setCompleted(time); - userTaskInstance.setStarted(time); - userTaskInstance.setExcludedUsers(excludedUsers); - userTaskInstance.setPotentialGroups(potentialGroups); - userTaskInstance.setPotentialUsers(potentialUsers); - userTaskInstance.setReferenceName(referenceName); - userTaskInstance.setLastUpdate(time); - userTaskInstance.setProcessId(processId); - userTaskInstance.setRootProcessId(rootProcessId); - userTaskInstance.setRootProcessInstanceId(rootProcessInstanceId); - userTaskInstance.setInputs(inputs); - userTaskInstance.setOutputs(outputs); - userTaskInstance.setComments(singletonList(comment)); - userTaskInstance.setAttachments(singletonList(attachment)); - - userTaskInstanceEntity.setId(testId); - userTaskInstanceEntity.setDescription(description); - userTaskInstanceEntity.setName(name); - userTaskInstanceEntity.setPriority(priority); - userTaskInstanceEntity.setProcessInstanceId(processInstanceId); - userTaskInstanceEntity.setState(state); - userTaskInstanceEntity.setActualOwner(actualOwner); - userTaskInstanceEntity.setAdminGroups(adminGroups); - userTaskInstanceEntity.setAdminUsers(adminUsers); - userTaskInstanceEntity.setCompleted(time); - userTaskInstanceEntity.setStarted(time); - userTaskInstanceEntity.setExcludedUsers(excludedUsers); - userTaskInstanceEntity.setPotentialGroups(potentialGroups); - userTaskInstanceEntity.setPotentialUsers(potentialUsers); - userTaskInstanceEntity.setReferenceName(referenceName); - userTaskInstanceEntity.setLastUpdate(time); - userTaskInstanceEntity.setProcessId(processId); - userTaskInstanceEntity.setRootProcessId(rootProcessId); - userTaskInstanceEntity.setRootProcessInstanceId(rootProcessInstanceId); - userTaskInstanceEntity.setInputs(inputs); - userTaskInstanceEntity.setOutputs(outputs); - userTaskInstanceEntity.setComments(singletonList(commentEntity)); - userTaskInstanceEntity.setAttachments(singletonList(attachmentEntity)); - } - - @Test - void testMapToEntity() { - UserTaskInstanceEntity result = mapper.mapToEntity(userTaskInstance); - assertThat(result).isEqualToIgnoringGivenFields(userTaskInstanceEntity, "$$_hibernate_tracker"); - } - - @Test - void testMapToModel() { - UserTaskInstance result = mapper.mapToModel(userTaskInstanceEntity); - assertThat(result).isEqualToComparingFieldByField(userTaskInstance); - } +class UserTaskInstanceEntityMapperIT extends AbstractUserTaskInstanceEntityMapperIT { } diff --git a/data-index/data-index-storage/data-index-storage-postgresql/src/test/java/org/kie/kogito/index/postgresql/query/JobEntityQueryIT.java b/data-index/data-index-storage/data-index-storage-postgresql/src/test/java/org/kie/kogito/index/postgresql/query/JobEntityQueryIT.java index b97a783fbf..90502e9075 100644 --- a/data-index/data-index-storage/data-index-storage-postgresql/src/test/java/org/kie/kogito/index/postgresql/query/JobEntityQueryIT.java +++ b/data-index/data-index-storage/data-index-storage-postgresql/src/test/java/org/kie/kogito/index/postgresql/query/JobEntityQueryIT.java @@ -18,27 +18,13 @@ */ package org.kie.kogito.index.postgresql.query; -import org.kie.kogito.index.jpa.storage.JobEntityStorage; -import org.kie.kogito.index.model.Job; -import org.kie.kogito.index.test.query.AbstractJobQueryIT; -import org.kie.kogito.persistence.api.Storage; +import org.kie.kogito.index.jpa.query.AbstractJobEntityQueryIT; import org.kie.kogito.testcontainers.quarkus.PostgreSqlQuarkusTestResource; import io.quarkus.test.common.QuarkusTestResource; import io.quarkus.test.junit.QuarkusTest; -import jakarta.inject.Inject; - @QuarkusTest @QuarkusTestResource(PostgreSqlQuarkusTestResource.class) -class JobEntityQueryIT extends AbstractJobQueryIT { - - @Inject - JobEntityStorage storage; - - @Override - public Storage getStorage() { - return storage; - } - +class JobEntityQueryIT extends AbstractJobEntityQueryIT { } diff --git a/data-index/data-index-storage/data-index-storage-postgresql/src/test/java/org/kie/kogito/index/postgresql/query/ProcessDefinitionEntityQueryIT.java b/data-index/data-index-storage/data-index-storage-postgresql/src/test/java/org/kie/kogito/index/postgresql/query/ProcessDefinitionEntityQueryIT.java index 28384df31a..0f304623be 100644 --- a/data-index/data-index-storage/data-index-storage-postgresql/src/test/java/org/kie/kogito/index/postgresql/query/ProcessDefinitionEntityQueryIT.java +++ b/data-index/data-index-storage/data-index-storage-postgresql/src/test/java/org/kie/kogito/index/postgresql/query/ProcessDefinitionEntityQueryIT.java @@ -18,31 +18,13 @@ */ package org.kie.kogito.index.postgresql.query; -import org.kie.kogito.index.jpa.storage.ProcessDefinitionEntityStorage; -import org.kie.kogito.index.model.ProcessDefinition; -import org.kie.kogito.index.test.query.AbstractProcessDefinitionQueryIT; -import org.kie.kogito.persistence.api.Storage; +import org.kie.kogito.index.jpa.query.AbstractProcessDefinitionEntityQueryIT; import org.kie.kogito.testcontainers.quarkus.PostgreSqlQuarkusTestResource; import io.quarkus.test.common.QuarkusTestResource; import io.quarkus.test.junit.QuarkusTest; -import jakarta.inject.Inject; - @QuarkusTest @QuarkusTestResource(PostgreSqlQuarkusTestResource.class) -class ProcessDefinitionEntityQueryIT extends AbstractProcessDefinitionQueryIT { - - @Inject - ProcessDefinitionEntityStorage storage; - - @Override - public Storage getStorage() { - return storage; - } - - @Override - protected Boolean isDateTimeAsLong() { - return false; - } +class ProcessDefinitionEntityQueryIT extends AbstractProcessDefinitionEntityQueryIT { } diff --git a/data-index/data-index-storage/data-index-storage-postgresql/src/test/java/org/kie/kogito/index/postgresql/query/ProcessInstanceEntityQueryIT.java b/data-index/data-index-storage/data-index-storage-postgresql/src/test/java/org/kie/kogito/index/postgresql/query/ProcessInstanceEntityQueryIT.java index 5e963cee98..254bca48f2 100644 --- a/data-index/data-index-storage/data-index-storage-postgresql/src/test/java/org/kie/kogito/index/postgresql/query/ProcessInstanceEntityQueryIT.java +++ b/data-index/data-index-storage/data-index-storage-postgresql/src/test/java/org/kie/kogito/index/postgresql/query/ProcessInstanceEntityQueryIT.java @@ -18,30 +18,13 @@ */ package org.kie.kogito.index.postgresql.query; -import org.kie.kogito.index.jpa.storage.ProcessInstanceEntityStorage; -import org.kie.kogito.index.storage.ProcessInstanceStorage; -import org.kie.kogito.index.test.query.AbstractProcessInstanceQueryIT; +import org.kie.kogito.index.jpa.query.AbstractProcessInstanceEntityQueryIT; import org.kie.kogito.testcontainers.quarkus.PostgreSqlQuarkusTestResource; import io.quarkus.test.common.QuarkusTestResource; import io.quarkus.test.junit.QuarkusTest; -import jakarta.inject.Inject; - @QuarkusTest @QuarkusTestResource(PostgreSqlQuarkusTestResource.class) -class ProcessInstanceEntityQueryIT extends AbstractProcessInstanceQueryIT { - - @Inject - ProcessInstanceEntityStorage storage; - - @Override - public ProcessInstanceStorage getStorage() { - return storage; - } - - @Override - protected Boolean isDateTimeAsLong() { - return false; - } +class ProcessInstanceEntityQueryIT extends AbstractProcessInstanceEntityQueryIT { } diff --git a/data-index/data-index-storage/data-index-storage-postgresql/src/test/java/org/kie/kogito/index/postgresql/query/UserTaskInstanceEntityQueryIT.java b/data-index/data-index-storage/data-index-storage-postgresql/src/test/java/org/kie/kogito/index/postgresql/query/UserTaskInstanceEntityQueryIT.java index f0e2a6fc9b..399e5ecf2d 100644 --- a/data-index/data-index-storage/data-index-storage-postgresql/src/test/java/org/kie/kogito/index/postgresql/query/UserTaskInstanceEntityQueryIT.java +++ b/data-index/data-index-storage/data-index-storage-postgresql/src/test/java/org/kie/kogito/index/postgresql/query/UserTaskInstanceEntityQueryIT.java @@ -18,30 +18,14 @@ */ package org.kie.kogito.index.postgresql.query; -import org.kie.kogito.index.jpa.storage.UserTaskInstanceEntityStorage; -import org.kie.kogito.index.storage.UserTaskInstanceStorage; -import org.kie.kogito.index.test.query.AbstractUserTaskInstanceQueryIT; +import org.kie.kogito.index.jpa.query.AbstractUserTaskInstanceEntityQueryIT; import org.kie.kogito.testcontainers.quarkus.PostgreSqlQuarkusTestResource; import io.quarkus.test.common.QuarkusTestResource; import io.quarkus.test.junit.QuarkusTest; -import jakarta.inject.Inject; - @QuarkusTest @QuarkusTestResource(PostgreSqlQuarkusTestResource.class) -class UserTaskInstanceEntityQueryIT extends AbstractUserTaskInstanceQueryIT { - - @Inject - UserTaskInstanceEntityStorage storage; - - @Override - public UserTaskInstanceStorage getStorage() { - return storage; - } +class UserTaskInstanceEntityQueryIT extends AbstractUserTaskInstanceEntityQueryIT { - @Override - protected Boolean isDateTimeAsLong() { - return false; - } } diff --git a/data-index/data-index-storage/data-index-storage-postgresql/src/test/java/org/kie/kogito/index/postgresql/storage/AbstractStorageIT.java b/data-index/data-index-storage/data-index-storage-postgresql/src/test/java/org/kie/kogito/index/postgresql/storage/AbstractStorageIT.java deleted file mode 100644 index 427e8d3d2a..0000000000 --- a/data-index/data-index-storage/data-index-storage-postgresql/src/test/java/org/kie/kogito/index/postgresql/storage/AbstractStorageIT.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.kogito.index.postgresql.storage; - -import org.kie.kogito.index.jpa.model.AbstractEntity; -import org.kie.kogito.persistence.api.Storage; -import org.kie.kogito.persistence.api.StorageService; - -import io.quarkus.hibernate.orm.panache.PanacheRepositoryBase; - -import static org.assertj.core.api.Assertions.assertThat; - -public abstract class AbstractStorageIT { - - Class type; - - public AbstractStorageIT(Class type) { - this.type = type; - } - - abstract StorageService getStorage(); - - abstract PanacheRepositoryBase getRepository(); - - void testStorage(String key, T value1, T value2) { - Storage cache = getStorage().getCache("cache", type); - assertThat(cache.get(key)).isNull(); - assertThat(cache.containsKey(key)).isFalse(); - - cache.put(key, value1); - assertThat(cache.get(key)).isEqualTo(value1); - assertThat(cache.containsKey(key)).isTrue(); - - cache.put(key, value2); - assertThat(cache.get(key)).isEqualTo(value2); - assertThat(cache.containsKey(key)).isTrue(); - - cache.remove(key); - assertThat(cache.get(key)).isNull(); - assertThat(cache.containsKey(key)).isFalse(); - } - -} diff --git a/data-index/data-index-storage/data-index-storage-postgresql/src/test/java/org/kie/kogito/index/postgresql/storage/DomainQueryTest.java b/data-index/data-index-storage/data-index-storage-postgresql/src/test/java/org/kie/kogito/index/postgresql/storage/DomainQueryTest.java deleted file mode 100644 index 20d85db1b1..0000000000 --- a/data-index/data-index-storage/data-index-storage-postgresql/src/test/java/org/kie/kogito/index/postgresql/storage/DomainQueryTest.java +++ /dev/null @@ -1,170 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.kogito.index.postgresql.storage; - -import java.util.List; -import java.util.function.Function; - -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.kie.kogito.index.jpa.model.ProcessInstanceEntity; -import org.kie.kogito.index.jpa.storage.JPAQuery; -import org.kie.kogito.index.model.ProcessInstance; -import org.mockito.ArgumentCaptor; -import org.mockito.Mock; -import org.mockito.junit.jupiter.MockitoExtension; - -import io.quarkus.hibernate.orm.panache.PanacheRepositoryBase; - -import jakarta.persistence.EntityManager; -import jakarta.persistence.TypedQuery; -import jakarta.persistence.criteria.CriteriaBuilder; -import jakarta.persistence.criteria.CriteriaQuery; -import jakarta.persistence.criteria.Order; -import jakarta.persistence.criteria.Path; -import jakarta.persistence.criteria.Predicate; -import jakarta.persistence.criteria.Root; - -import static java.util.Arrays.asList; -import static java.util.Collections.emptyList; -import static org.assertj.core.api.Assertions.assertThat; -import static org.kie.kogito.persistence.api.query.QueryFilterFactory.orderBy; -import static org.kie.kogito.persistence.api.query.SortDirection.ASC; -import static org.kie.kogito.persistence.api.query.SortDirection.DESC; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -@ExtendWith(MockitoExtension.class) -class DomainQueryTest { - - private static final Class rootType = ProcessInstanceEntity.class; - - @Mock - PanacheRepositoryBase repository; - - @Mock - EntityManager entityManager; - - @Mock - CriteriaBuilder criteriaBuilder; - - @Mock - CriteriaQuery criteriaQuery; - - @Mock - TypedQuery mockQuery; - - @BeforeEach - public void setup() { - when(repository.getEntityManager()).thenReturn(entityManager); - when(entityManager.getCriteriaBuilder()).thenReturn(criteriaBuilder); - when(criteriaBuilder.createQuery(rootType)).thenReturn(criteriaQuery); - when(entityManager.createQuery(criteriaQuery)).thenReturn(mockQuery); - } - - @Test - void testNoParameters() { - JPAQuery query = new JPAQuery(repository, Function.identity(), rootType); - - query.execute(); - - verify(criteriaQuery).from(rootType); - verify(criteriaQuery, never()).where(any(Predicate.class)); - verify(criteriaQuery, never()).orderBy(any(List.class)); - verify(entityManager).createQuery(criteriaQuery); - verify(mockQuery).getResultList(); - } - - @Test - void testEmptyParameters() { - JPAQuery query = new JPAQuery(repository, Function.identity(), rootType); - query.filter(emptyList()); - query.sort(emptyList()); - - query.execute(); - - verify(criteriaQuery).from(rootType); - verify(criteriaQuery, never()).where(any(Predicate.class)); - verify(criteriaQuery, never()).orderBy(any(List.class)); - verify(entityManager).createQuery(criteriaQuery); - verify(mockQuery).getResultList(); - } - - @Test - void testPagination() { - JPAQuery query = new JPAQuery(repository, Function.identity(), rootType); - query.limit(10); - query.offset(0); - - query.execute(); - - verify(criteriaQuery).from(rootType); - verify(criteriaQuery, never()).where(any(Predicate.class)); - verify(criteriaQuery, never()).orderBy(any(List.class)); - verify(entityManager).createQuery(criteriaQuery); - verify(mockQuery).setFirstResult(0); - verify(mockQuery).setMaxResults(10); - verify(mockQuery).getResultList(); - } - - @Test - void testOrderBy() { - Root root = mock(Root.class); - when(root.get(any(String.class))).thenAnswer(inv -> { - Path path = mock(Path.class); - when(path.getAlias()).thenReturn(inv.getArgument(0)); - return path; - }); - when(criteriaQuery.from(rootType)).thenReturn(root); - when(criteriaBuilder.asc(any())).thenAnswer(inv -> { - Order order = mock(Order.class); - when(order.isAscending()).thenReturn(true); - when(order.getExpression()).thenReturn(inv.getArgument(0)); - return order; - }); - when(criteriaBuilder.desc(any())).thenAnswer(inv -> { - Order order = mock(Order.class); - when(order.isAscending()).thenReturn(false); - when(order.getExpression()).thenReturn(inv.getArgument(0)); - return order; - }); - - JPAQuery query = new JPAQuery(repository, Function.identity(), rootType); - query.sort(asList(orderBy("name", DESC), orderBy("date", ASC))); - - query.execute(); - - verify(criteriaQuery).from(rootType); - verify(criteriaQuery, never()).where(any(Predicate.class)); - ArgumentCaptor> captor = ArgumentCaptor.forClass(List.class); - verify(criteriaQuery).orderBy(captor.capture()); - assertThat(captor.getValue()).hasSize(2); - assertThat(captor.getValue().get(0).isAscending()).isFalse(); - assertThat(captor.getValue().get(0).getExpression().getAlias()).isEqualTo("name"); - assertThat(captor.getValue().get(1).isAscending()).isTrue(); - assertThat(captor.getValue().get(1).getExpression().getAlias()).isEqualTo("date"); - verify(entityManager).createQuery(criteriaQuery); - verify(mockQuery).getResultList(); - } - -} diff --git a/data-index/data-index-storage/data-index-storage-postgresql/src/test/java/org/kie/kogito/index/postgresql/storage/JobStorageIT.java b/data-index/data-index-storage/data-index-storage-postgresql/src/test/java/org/kie/kogito/index/postgresql/storage/JobStorageIT.java index 91b5488eaa..168041a92d 100644 --- a/data-index/data-index-storage/data-index-storage-postgresql/src/test/java/org/kie/kogito/index/postgresql/storage/JobStorageIT.java +++ b/data-index/data-index-storage/data-index-storage-postgresql/src/test/java/org/kie/kogito/index/postgresql/storage/JobStorageIT.java @@ -18,58 +18,13 @@ */ package org.kie.kogito.index.postgresql.storage; -import java.util.UUID; - -import org.apache.commons.lang3.RandomStringUtils; -import org.junit.jupiter.api.Test; -import org.kie.kogito.index.jpa.model.JobEntity; -import org.kie.kogito.index.jpa.model.JobEntityRepository; -import org.kie.kogito.index.model.Job; -import org.kie.kogito.index.test.TestUtils; -import org.kie.kogito.persistence.api.StorageService; +import org.kie.kogito.index.jpa.storage.AbstractJobStorageIT; import org.kie.kogito.testcontainers.quarkus.PostgreSqlQuarkusTestResource; import io.quarkus.test.common.QuarkusTestResource; import io.quarkus.test.junit.QuarkusTest; -import jakarta.inject.Inject; - @QuarkusTest @QuarkusTestResource(PostgreSqlQuarkusTestResource.class) -public class JobStorageIT extends AbstractStorageIT { - - @Inject - JobEntityRepository repository; - - @Inject - StorageService storage; - - public JobStorageIT() { - super(Job.class); - } - - @Override - public JobEntityRepository getRepository() { - return repository; - } - - @Override - public StorageService getStorage() { - return storage; - } - - @Test - public void testJobEntity() { - String jobId = UUID.randomUUID().toString(); - String processInstanceId = UUID.randomUUID().toString(); - - Job job1 = TestUtils - .createJob(jobId, processInstanceId, RandomStringUtils.randomAlphabetic(5), UUID.randomUUID().toString(), - RandomStringUtils.randomAlphabetic(10), "EXPECTED", 0L); - Job job2 = TestUtils - .createJob(jobId, processInstanceId, RandomStringUtils.randomAlphabetic(5), UUID.randomUUID().toString(), - RandomStringUtils.randomAlphabetic(10), "SCHEDULED", 1000L); - testStorage(jobId, job1, job2); - } - +public class JobStorageIT extends AbstractJobStorageIT { } diff --git a/data-index/data-index-storage/data-index-storage-postgresql/src/test/java/org/kie/kogito/index/postgresql/storage/ProcessDefinitionStorageIT.java b/data-index/data-index-storage/data-index-storage-postgresql/src/test/java/org/kie/kogito/index/postgresql/storage/ProcessDefinitionStorageIT.java index 5fe6e69c8d..627733c823 100644 --- a/data-index/data-index-storage/data-index-storage-postgresql/src/test/java/org/kie/kogito/index/postgresql/storage/ProcessDefinitionStorageIT.java +++ b/data-index/data-index-storage/data-index-storage-postgresql/src/test/java/org/kie/kogito/index/postgresql/storage/ProcessDefinitionStorageIT.java @@ -18,54 +18,13 @@ */ package org.kie.kogito.index.postgresql.storage; -import java.util.Set; - -import org.apache.commons.lang3.RandomStringUtils; -import org.junit.jupiter.api.Test; -import org.kie.kogito.index.jpa.model.ProcessDefinitionEntity; -import org.kie.kogito.index.jpa.model.ProcessDefinitionEntityRepository; -import org.kie.kogito.index.jpa.storage.ProcessDefinitionEntityStorage; -import org.kie.kogito.index.model.ProcessDefinition; -import org.kie.kogito.index.test.TestUtils; -import org.kie.kogito.persistence.api.StorageService; +import org.kie.kogito.index.jpa.storage.AbstractProcessDefinitionStorageIT; import org.kie.kogito.testcontainers.quarkus.PostgreSqlQuarkusTestResource; import io.quarkus.test.common.QuarkusTestResource; import io.quarkus.test.junit.QuarkusTest; -import jakarta.inject.Inject; - @QuarkusTest @QuarkusTestResource(PostgreSqlQuarkusTestResource.class) -class ProcessDefinitionStorageIT extends AbstractStorageIT { - - @Inject - ProcessDefinitionEntityRepository repository; - - @Inject - StorageService storage; - - public ProcessDefinitionStorageIT() { - super(ProcessDefinition.class); - } - - @Override - public ProcessDefinitionEntityStorage.RepositoryAdapter getRepository() { - return new ProcessDefinitionEntityStorage.RepositoryAdapter(repository); - } - - @Override - public StorageService getStorage() { - return storage; - } - - @Test - void testProcessDefinitionEntity() { - String processId = RandomStringUtils.randomAlphabetic(10); - String version = "1.0"; - ProcessDefinition pdv1 = TestUtils.createProcessDefinition(processId, version, Set.of("admin", "kogito")); - ProcessDefinition pdv2 = TestUtils.createProcessDefinition(processId, version, Set.of("kogito")); - testStorage(pdv1.getKey(), pdv1, pdv2); - } - +class ProcessDefinitionStorageIT 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-postgresql/src/test/java/org/kie/kogito/index/postgresql/storage/ProcessInstanceStorageIT.java index 6b6b43d8fe..0ad8baf9b6 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 @@ -18,37 +18,13 @@ */ package org.kie.kogito.index.postgresql.storage; -import java.util.UUID; - -import org.apache.commons.lang3.RandomStringUtils; -import org.junit.jupiter.api.Test; -import org.kie.kogito.index.jpa.model.ProcessInstanceEntityRepository; -import org.kie.kogito.index.model.ProcessInstanceState; -import org.kie.kogito.index.test.TestUtils; +import org.kie.kogito.index.jpa.storage.AbstractProcessInstanceStorageIT; import org.kie.kogito.testcontainers.quarkus.PostgreSqlQuarkusTestResource; import io.quarkus.test.common.QuarkusTestResource; import io.quarkus.test.junit.QuarkusTest; -import jakarta.inject.Inject; - @QuarkusTest @QuarkusTestResource(PostgreSqlQuarkusTestResource.class) -public class ProcessInstanceStorageIT { - - @Inject - ProcessInstanceEntityRepository repository; - - @Test - public void testProcessInstanceEntity() { - 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); - - } - +public class ProcessInstanceStorageIT extends AbstractProcessInstanceStorageIT { } diff --git a/data-index/data-index-storage/data-index-storage-postgresql/src/test/java/org/kie/kogito/index/postgresql/storage/UserTaskInstanceStorageIT.java b/data-index/data-index-storage/data-index-storage-postgresql/src/test/java/org/kie/kogito/index/postgresql/storage/UserTaskInstanceStorageIT.java index 33e06afd01..4ada5a0753 100644 --- a/data-index/data-index-storage/data-index-storage-postgresql/src/test/java/org/kie/kogito/index/postgresql/storage/UserTaskInstanceStorageIT.java +++ b/data-index/data-index-storage/data-index-storage-postgresql/src/test/java/org/kie/kogito/index/postgresql/storage/UserTaskInstanceStorageIT.java @@ -18,38 +18,13 @@ */ package org.kie.kogito.index.postgresql.storage; -import java.util.UUID; - -import org.apache.commons.lang3.RandomStringUtils; -import org.junit.jupiter.api.Test; -import org.kie.kogito.index.jpa.model.UserTaskInstanceEntityRepository; -import org.kie.kogito.index.test.TestUtils; +import org.kie.kogito.index.jpa.storage.AbstractUserTaskInstanceStorageIT; import org.kie.kogito.testcontainers.quarkus.PostgreSqlQuarkusTestResource; import io.quarkus.test.common.QuarkusTestResource; import io.quarkus.test.junit.QuarkusTest; -import jakarta.inject.Inject; - @QuarkusTest @QuarkusTestResource(PostgreSqlQuarkusTestResource.class) -public class UserTaskInstanceStorageIT { - - @Inject - UserTaskInstanceEntityRepository repository; - - @Test - public void testUserTaskInstanceEntity() { - String taskId = UUID.randomUUID().toString(); - String processInstanceId = UUID.randomUUID().toString(); - TestUtils - .createUserTaskInstance(taskId, processInstanceId, RandomStringUtils.randomAlphabetic(5), - UUID.randomUUID().toString(), - RandomStringUtils.randomAlphabetic(10), "InProgress", 0L); - TestUtils - .createUserTaskInstance(taskId, processInstanceId, RandomStringUtils.randomAlphabetic(5), - UUID.randomUUID().toString(), - RandomStringUtils.randomAlphabetic(10), "Completed", 1000L); - } - +public class UserTaskInstanceStorageIT extends AbstractUserTaskInstanceStorageIT { } diff --git a/data-index/data-index-storage/pom.xml b/data-index/data-index-storage/pom.xml index d7f550b721..c939ad4880 100644 --- a/data-index/data-index-storage/pom.xml +++ b/data-index/data-index-storage/pom.xml @@ -36,11 +36,11 @@ data-index-storage-api data-index-storage-protobuf data-index-storage-postgresql - data-index-storage-jpa + data-index-storage-jpa-common data-index-storage-common data-index-storage-infinispan data-index-storage-mongodb data-index-storage-postgresql-reporting - data-index-storage-oracle + data-index-storage-jpa \ No newline at end of file diff --git a/data-index/data-index-test-utils/src/main/java/org/kie/kogito/index/test/containers/DataIndexOracleContainer.java b/data-index/data-index-test-utils/src/main/java/org/kie/kogito/index/test/containers/DataIndexOracleContainer.java deleted file mode 100644 index c6b7cc143a..0000000000 --- a/data-index/data-index-test-utils/src/main/java/org/kie/kogito/index/test/containers/DataIndexOracleContainer.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.kogito.index.test.containers; - -/** - * This container wraps Data Index Service container - */ -public class DataIndexOracleContainer extends AbstractDataIndexContainer { - public static final String NAME = "data-index-service-oracle"; - - public DataIndexOracleContainer() { - super(NAME); - } - - public void setDatabaseURL(String oracleURL, String username, String password) { - addEnv("QUARKUS_DATASOURCE_JDBC_URL", oracleURL); - addEnv("QUARKUS_DATASOURCE_USERNAME", username); - addEnv("QUARKUS_DATASOURCE_PASSWORD", password); - addEnv("QUARKUS_FLYWAY_MIGRATE_AT_START", "true"); - addEnv("QUARKUS_FLYWAY_BASELINE_ON_MIGRATE", "true"); - } - - @Override - public String getResourceName() { - return NAME; - } - -} diff --git a/data-index/data-index-test-utils/src/main/java/org/kie/kogito/index/test/quarkus/http/DataIndexOracleHttpQuarkusTestResource.java b/data-index/data-index-test-utils/src/main/java/org/kie/kogito/index/test/quarkus/http/DataIndexOracleHttpQuarkusTestResource.java deleted file mode 100644 index e72a31e8e8..0000000000 --- a/data-index/data-index-test-utils/src/main/java/org/kie/kogito/index/test/quarkus/http/DataIndexOracleHttpQuarkusTestResource.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.kogito.index.test.quarkus.http; - -import java.util.HashMap; -import java.util.Map; - -public class DataIndexOracleHttpQuarkusTestResource extends AbstractDataIndexHttpQuarkusTestResource { - - public DataIndexOracleHttpQuarkusTestResource() { - super(new DataIndexOracleHttpResource()); - } - - @Override - protected Map getProperties() { - Map properties = new HashMap<>(); - properties.putAll(getDataIndexConnectionProperties()); - properties.putAll(getTestResource().getProperties()); - return properties; - } - -} diff --git a/data-index/data-index-test-utils/src/main/java/org/kie/kogito/index/test/quarkus/http/DataIndexOracleHttpResource.java b/data-index/data-index-test-utils/src/main/java/org/kie/kogito/index/test/quarkus/http/DataIndexOracleHttpResource.java deleted file mode 100644 index fc8f666f14..0000000000 --- a/data-index/data-index-test-utils/src/main/java/org/kie/kogito/index/test/quarkus/http/DataIndexOracleHttpResource.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.kogito.index.test.quarkus.http; - -import java.util.HashMap; -import java.util.Map; - -import org.kie.kogito.index.test.containers.DataIndexOracleContainer; -import org.kie.kogito.test.resources.TestResource; -import org.kie.kogito.testcontainers.KogitoOracleSqlContainer; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.testcontainers.containers.Network; - -public class DataIndexOracleHttpResource implements TestResource { - - private static final Logger LOGGER = LoggerFactory.getLogger(DataIndexOracleHttpResource.class); - - KogitoOracleSqlContainer oracle = new KogitoOracleSqlContainer(); - DataIndexOracleContainer dataIndex = new DataIndexOracleContainer(); - Map properties = new HashMap<>(); - - @Override - public String getResourceName() { - return dataIndex.getResourceName(); - } - - @Override - public void start() { - LOGGER.debug("Starting Oracle Quarkus test resource"); - properties.clear(); - Network network = Network.newNetwork(); - oracle.withNetwork(network); - oracle.withNetworkAliases("oracle"); - oracle.withUsername("kogito"); - oracle.withPassword("kogito"); - oracle.start(); - - dataIndex.addProtoFileFolder(); - dataIndex.withNetwork(network); - dataIndex.setDatabaseURL("jdbc:oracle:thin:@oracle:1521/" + oracle.getDatabaseName(), - oracle.getUsername(), oracle.getPassword()); - dataIndex.addEnv("QUARKUS_PROFILE", "http-events-support"); - dataIndex.start(); - LOGGER.debug("Oracle Quarkus test resource started"); - } - - @Override - public void stop() { - dataIndex.stop(); - oracle.stop(); - LOGGER.debug("Oracle Quarkus test resource stopped"); - } - - @Override - public int getMappedPort() { - return dataIndex.getMappedPort(); - } - - public Map getProperties() { - return properties; - } -} diff --git a/data-index/data-index-test-utils/src/main/java/org/kie/kogito/index/test/quarkus/kafka/DataIndexOracleKafkaResource.java b/data-index/data-index-test-utils/src/main/java/org/kie/kogito/index/test/quarkus/kafka/DataIndexOracleKafkaResource.java deleted file mode 100644 index 968ad34f5e..0000000000 --- a/data-index/data-index-test-utils/src/main/java/org/kie/kogito/index/test/quarkus/kafka/DataIndexOracleKafkaResource.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.kogito.index.test.quarkus.kafka; - -import java.util.HashMap; -import java.util.Map; - -import org.kie.kogito.index.test.containers.DataIndexOracleContainer; -import org.kie.kogito.index.test.containers.KogitoKafkaContainerWithoutBridge; -import org.kie.kogito.test.resources.TestResource; -import org.kie.kogito.testcontainers.Constants; -import org.kie.kogito.testcontainers.KogitoOracleSqlContainer; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.testcontainers.containers.Network; -import org.testcontainers.containers.wait.strategy.Wait; - -public class DataIndexOracleKafkaResource implements TestResource { - - private static final Logger LOGGER = LoggerFactory.getLogger(DataIndexOracleKafkaResource.class); - - KogitoKafkaContainerWithoutBridge kafka = new KogitoKafkaContainerWithoutBridge(); - KogitoOracleSqlContainer oracle = new KogitoOracleSqlContainer(); - DataIndexOracleContainer dataIndex = new DataIndexOracleContainer(); - Map properties = new HashMap<>(); - - @Override - public String getResourceName() { - return dataIndex.getResourceName(); - } - - @Override - public void start() { - LOGGER.debug("Starting Oracle Quarkus test resource"); - properties.clear(); - Network network = Network.newNetwork(); - oracle.withNetwork(network); - oracle.withNetworkAliases("oracle"); - oracle.withUsername("kogito"); - oracle.withPassword("kogito"); - oracle.start(); - kafka.withNetwork(network); - kafka.withNetworkAliases("kafka"); - kafka.waitingFor(Wait.forListeningPort()).withStartupTimeout(Constants.CONTAINER_START_TIMEOUT); - kafka.start(); - String kafkaURL = kafka.getBootstrapServers(); - properties.put("kafka.bootstrap.servers", kafkaURL); - properties.put("spring.kafka.bootstrap-servers", kafkaURL); - - dataIndex.addProtoFileFolder(); - dataIndex.withNetwork(network); - dataIndex.setDatabaseURL("jdbc:oracle:thin:@oracle:1521/" + oracle.getDatabaseName(), - oracle.getUsername(), oracle.getPassword()); - dataIndex.setKafkaURL("kafka:29092"); - dataIndex.addEnv("QUARKUS_PROFILE", "kafka-events-support"); - dataIndex.start(); - LOGGER.debug("Oracle Quarkus test resource started"); - } - - @Override - public void stop() { - dataIndex.stop(); - oracle.stop(); - kafka.stop(); - LOGGER.debug("Oracle Quarkus test resource stopped"); - } - - @Override - public int getMappedPort() { - return dataIndex.getMappedPort(); - } - - public Map getProperties() { - return properties; - } -} diff --git a/data-index/data-index-test-utils/src/main/java/org/kie/kogito/index/test/quarkus/kafka/DataIndexOracleQuarkusKafkaTestResource.java b/data-index/data-index-test-utils/src/main/java/org/kie/kogito/index/test/quarkus/kafka/DataIndexOracleQuarkusKafkaTestResource.java deleted file mode 100644 index 1466378146..0000000000 --- a/data-index/data-index-test-utils/src/main/java/org/kie/kogito/index/test/quarkus/kafka/DataIndexOracleQuarkusKafkaTestResource.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.kie.kogito.index.test.quarkus.kafka; - -import java.util.HashMap; -import java.util.Map; - -import org.kie.kogito.test.resources.ConditionalQuarkusTestResource; - -import static org.kie.kogito.index.test.Constants.KOGITO_DATA_INDEX_SERVICE_URL; - -public class DataIndexOracleQuarkusKafkaTestResource extends ConditionalQuarkusTestResource { - public DataIndexOracleQuarkusKafkaTestResource() { - super(new DataIndexOracleKafkaResource()); - } - - @Override - protected Map getProperties() { - Map properties = new HashMap<>(); - properties.put(KOGITO_DATA_INDEX_SERVICE_URL, "http://localhost:" + getTestResource().getMappedPort()); - properties.putAll(getTestResource().getProperties()); - return properties; - } - -} diff --git a/data-index/docs/data-index.png b/data-index/docs/data-index.png new file mode 100644 index 0000000000..8619654c5c Binary files /dev/null and b/data-index/docs/data-index.png differ diff --git a/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-common/deployment/pom.xml b/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-common/deployment/pom.xml index a3fd489c22..fbdae338bd 100644 --- a/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-common/deployment/pom.xml +++ b/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-common/deployment/pom.xml @@ -23,7 +23,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 4.0.0 - org.kie.kogito + org.kie kogito-addons-quarkus-data-index-persistence-common-parent 999-SNAPSHOT @@ -39,16 +39,16 @@ quarkus-jackson-deployment - org.kie.kogito + org.kie kogito-addons-quarkus-common-deployment - org.kie.kogito + org.kie kogito-addons-quarkus-data-index-persistence-common-runtime - org.kie.kogito - kogito-addons-quarkus-source-files-deployment + org.kie + kie-addons-quarkus-source-files-deployment io.quarkus diff --git a/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-common/pom.xml b/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-common/pom.xml index 3a0d414097..690ce9668f 100644 --- a/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-common/pom.xml +++ b/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-common/pom.xml @@ -23,7 +23,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 4.0.0 - org.kie.kogito + org.kie kogito-addons-quarkus-data-index-persistence 999-SNAPSHOT diff --git a/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-common/runtime/pom.xml b/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-common/runtime/pom.xml index 5b608d2e7c..943f7f4b60 100644 --- a/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-common/runtime/pom.xml +++ b/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-common/runtime/pom.xml @@ -24,7 +24,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 4.0.0 - org.kie.kogito + org.kie kogito-addons-quarkus-data-index-persistence-common-parent 999-SNAPSHOT @@ -49,8 +49,8 @@ kogito-addons-process-svg - org.kie.kogito - kogito-addons-quarkus-source-files + org.kie + kie-addons-quarkus-source-files io.quarkus 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/ProcessDefinitionRegister.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/ProcessDefinitionRegister.java index d3f34c8c23..b291feb5dc 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/ProcessDefinitionRegister.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/ProcessDefinitionRegister.java @@ -26,6 +26,7 @@ import org.kie.kogito.Application; import org.kie.kogito.index.api.KogitoRuntimeClient; import org.kie.kogito.index.model.ProcessDefinition; +import org.kie.kogito.index.model.ProcessDefinitionKey; import org.kie.kogito.index.service.DataIndexServiceException; import org.kie.kogito.index.storage.DataIndexStorageService; import org.kie.kogito.process.Process; @@ -57,7 +58,7 @@ void startup(@Observes StartupEvent event, Instance processesInstance .map(mapProcessDefinition(app.config().addons().availableAddons(), kogitoServiceUrl.orElse(null), client)) .forEach(process -> { LOGGER.debug("Registering process definition with id: {}", process.getId()); - storage.getProcessDefinitionStorage().put(process.getKey(), process); + storage.getProcessDefinitionStorage().put(new ProcessDefinitionKey(process.getId(), process.getVersion()), process); }); } else { LOGGER.info("No process definitions to register."); diff --git a/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-infinispan/deployment/pom.xml b/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-infinispan/deployment/pom.xml index 0a63c1c734..6542f22985 100644 --- a/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-infinispan/deployment/pom.xml +++ b/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-infinispan/deployment/pom.xml @@ -23,7 +23,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 4.0.0 - org.kie.kogito + org.kie kogito-addons-quarkus-data-index-persistence-infinispan-parent 999-SNAPSHOT @@ -31,11 +31,11 @@ Kogito Apps :: Kogito Addons Quarkus Data Index Persistence Infinispan :: Deployment - org.kie.kogito + org.kie kogito-addons-quarkus-data-index-persistence-common-deployment - org.kie.kogito + org.kie kogito-addons-quarkus-data-index-persistence-infinispan diff --git a/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-infinispan/integration-tests-process/pom.xml b/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-infinispan/integration-tests-process/pom.xml index caac1b2a61..63ebdfe24b 100644 --- a/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-infinispan/integration-tests-process/pom.xml +++ b/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-infinispan/integration-tests-process/pom.xml @@ -23,7 +23,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 4.0.0 - org.kie.kogito + org.kie kogito-addons-quarkus-data-index-persistence-infinispan-parent 999-SNAPSHOT @@ -32,8 +32,8 @@ - org.kie.kogito - kogito-quarkus-processes + org.jbpm + jbpm-quarkus io.quarkus @@ -44,12 +44,12 @@ quarkus-resteasy-jackson - org.kie.kogito + org.kie kogito-addons-quarkus-data-index-persistence-infinispan - org.kie.kogito - kogito-addons-quarkus-persistence-infinispan + org.kie + kie-addons-quarkus-persistence-infinispan org.kie.kogito @@ -67,7 +67,7 @@ test - org.kie.kogito + org.kie kogito-addons-quarkus-data-index-persistence-infinispan-deployment ${project.version} pom diff --git a/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-infinispan/integration-tests-sw/pom.xml b/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-infinispan/integration-tests-sw/pom.xml index 9499b8c3c0..fe3f196c72 100644 --- a/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-infinispan/integration-tests-sw/pom.xml +++ b/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-infinispan/integration-tests-sw/pom.xml @@ -23,7 +23,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 4.0.0 - org.kie.kogito + org.kie kogito-addons-quarkus-data-index-persistence-infinispan-parent 999-SNAPSHOT @@ -44,12 +44,12 @@ quarkus-resteasy-jackson - org.kie.kogito + org.kie kogito-addons-quarkus-data-index-persistence-infinispan - org.kie.kogito - kogito-addons-quarkus-persistence-infinispan + org.kie + kie-addons-quarkus-persistence-infinispan org.kie.kogito @@ -72,7 +72,7 @@ test - org.kie.kogito + org.kie kogito-addons-quarkus-data-index-persistence-infinispan-deployment ${project.version} pom diff --git a/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-infinispan/pom.xml b/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-infinispan/pom.xml index 950991eccd..f89c056c5f 100644 --- a/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-infinispan/pom.xml +++ b/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-infinispan/pom.xml @@ -23,7 +23,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 4.0.0 - org.kie.kogito + org.kie kogito-addons-quarkus-data-index-persistence 999-SNAPSHOT diff --git a/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-infinispan/runtime/pom.xml b/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-infinispan/runtime/pom.xml index 4b7f517f3b..e967805e02 100644 --- a/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-infinispan/runtime/pom.xml +++ b/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-infinispan/runtime/pom.xml @@ -23,7 +23,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 4.0.0 - org.kie.kogito + org.kie kogito-addons-quarkus-data-index-persistence-infinispan-parent 999-SNAPSHOT @@ -31,7 +31,7 @@ Kogito Apps :: Kogito Addons Quarkus Data Index Persistence Infinispan :: Runtime - org.kie.kogito + org.kie kogito-addons-quarkus-data-index-persistence-common-runtime @@ -58,7 +58,7 @@ ${project.groupId}:${project.artifactId}-deployment:${project.version} - org.kie.kogito.data-index.persistence + org.kie.kogito.data-index.persistence.infinispan diff --git a/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-infinispan/runtime/src/main/resources/META-INF/quarkus-extension.yaml b/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-infinispan/runtime/src/main/resources/META-INF/quarkus-extension.yaml index f128cd3d65..3fae68a5bd 100644 --- a/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-infinispan/runtime/src/main/resources/META-INF/quarkus-extension.yaml +++ b/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-infinispan/runtime/src/main/resources/META-INF/quarkus-extension.yaml @@ -17,12 +17,18 @@ # under the License. # -name: Kogito Addons Quarkus Data Index Persistence Infinispan -description: Kogito Data Index Persistence Infinispan Add-On +name: Kogito Data Index Persistence Infinispan Quarkus Add-On +description: Add-On to colocate the Data Index Persistence (Infinispan) in your application. metadata: keywords: - data-index - kogito + - processes + - workflows + - tasks + - jobs + - BPMN guide: https://quarkus.io/guides/kogito categories: - - "business-automation" \ No newline at end of file + - "business-automation" + status: "stable" \ No newline at end of file diff --git a/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-mongodb/deployment/pom.xml b/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-mongodb/deployment/pom.xml index f5a9fe9cab..121176e1fd 100644 --- a/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-mongodb/deployment/pom.xml +++ b/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-mongodb/deployment/pom.xml @@ -23,7 +23,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 4.0.0 - org.kie.kogito + org.kie kogito-addons-quarkus-data-index-persistence-mongodb-parent 999-SNAPSHOT @@ -31,11 +31,11 @@ Kogito Apps :: Kogito Addons Quarkus Data Index Persistence MongoDB :: Deployment - org.kie.kogito + org.kie kogito-addons-quarkus-data-index-persistence-common-deployment - org.kie.kogito + org.kie kogito-addons-quarkus-data-index-persistence-mongodb diff --git a/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-mongodb/integration-tests-process/pom.xml b/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-mongodb/integration-tests-process/pom.xml index e7c86409f1..4d983333b9 100644 --- a/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-mongodb/integration-tests-process/pom.xml +++ b/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-mongodb/integration-tests-process/pom.xml @@ -23,7 +23,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 4.0.0 - org.kie.kogito + org.kie kogito-addons-quarkus-data-index-persistence-mongodb-parent 999-SNAPSHOT @@ -32,8 +32,8 @@ - org.kie.kogito - kogito-quarkus-processes + org.jbpm + jbpm-quarkus io.quarkus @@ -44,11 +44,11 @@ quarkus-resteasy-jackson - org.kie.kogito - kogito-addons-quarkus-persistence-mongodb + org.kie + kie-addons-quarkus-persistence-mongodb - org.kie.kogito + org.kie kogito-addons-quarkus-data-index-persistence-mongodb @@ -67,7 +67,7 @@ test - org.kie.kogito + org.kie kogito-addons-quarkus-data-index-persistence-mongodb-deployment ${project.version} pom diff --git a/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-mongodb/integration-tests-sw/pom.xml b/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-mongodb/integration-tests-sw/pom.xml index 72893b296d..66687c90c0 100644 --- a/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-mongodb/integration-tests-sw/pom.xml +++ b/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-mongodb/integration-tests-sw/pom.xml @@ -23,7 +23,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 4.0.0 - org.kie.kogito + org.kie kogito-addons-quarkus-data-index-persistence-mongodb-parent 999-SNAPSHOT @@ -44,11 +44,11 @@ quarkus-resteasy-jackson - org.kie.kogito - kogito-addons-quarkus-persistence-mongodb + org.kie + kie-addons-quarkus-persistence-mongodb - org.kie.kogito + org.kie kogito-addons-quarkus-data-index-persistence-mongodb @@ -72,7 +72,7 @@ test - org.kie.kogito + org.kie kogito-addons-quarkus-data-index-persistence-mongodb-deployment ${project.version} pom diff --git a/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-mongodb/pom.xml b/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-mongodb/pom.xml index d5a3b6d821..c3f62cb5f2 100644 --- a/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-mongodb/pom.xml +++ b/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-mongodb/pom.xml @@ -23,7 +23,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 4.0.0 - org.kie.kogito + org.kie kogito-addons-quarkus-data-index-persistence 999-SNAPSHOT diff --git a/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-mongodb/runtime/pom.xml b/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-mongodb/runtime/pom.xml index 4c53eaf404..5c6b565665 100644 --- a/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-mongodb/runtime/pom.xml +++ b/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-mongodb/runtime/pom.xml @@ -23,7 +23,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 4.0.0 - org.kie.kogito + org.kie kogito-addons-quarkus-data-index-persistence-mongodb-parent 999-SNAPSHOT @@ -31,7 +31,7 @@ Kogito Apps :: Kogito Addons Quarkus Data Index Persistence MongoDB :: Runtime - org.kie.kogito + org.kie kogito-addons-quarkus-data-index-persistence-common-runtime @@ -54,7 +54,7 @@ ${project.groupId}:${project.artifactId}-deployment:${project.version} - org.kie.kogito.data-index.persistence + org.kie.kogito.data-index.persistence.mongodb diff --git a/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-mongodb/runtime/src/main/resources/META-INF/quarkus-extension.yaml b/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-mongodb/runtime/src/main/resources/META-INF/quarkus-extension.yaml index 4889d304d8..28f1f13b0e 100644 --- a/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-mongodb/runtime/src/main/resources/META-INF/quarkus-extension.yaml +++ b/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-mongodb/runtime/src/main/resources/META-INF/quarkus-extension.yaml @@ -17,12 +17,18 @@ # under the License. # -name: Kogito Addons Quarkus Data Index Persistence MongoDB -description: Kogito Data Index Persistence MongoDB Add-On +name: Kogito Data Index Persistence MongoDB Quarkus Add-On +description: Add-On to colocate the Data Index Persistence (MongoDb) in your application. metadata: keywords: - data-index - kogito + - processes + - workflows + - tasks + - jobs + - BPMN guide: https://quarkus.io/guides/kogito categories: - - "business-automation" \ No newline at end of file + - "business-automation" + status: "stable" \ No newline at end of file diff --git a/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-postgresql/deployment/pom.xml b/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-postgresql/deployment/pom.xml index a1b449fad0..197d5d3f13 100644 --- a/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-postgresql/deployment/pom.xml +++ b/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-postgresql/deployment/pom.xml @@ -23,7 +23,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 4.0.0 - org.kie.kogito + org.kie kogito-addons-quarkus-data-index-persistence-postgresql-parent 999-SNAPSHOT @@ -31,11 +31,11 @@ Kogito Apps :: Kogito Addons Quarkus Data Index Persistence PostgreSQL :: Deployment - org.kie.kogito + org.kie kogito-addons-quarkus-data-index-persistence-common-deployment - org.kie.kogito + org.kie kogito-addons-quarkus-data-index-persistence-postgresql diff --git a/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-postgresql/integration-tests-process/pom.xml b/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-postgresql/integration-tests-process/pom.xml index aa3da6893b..81c1036fc7 100644 --- a/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-postgresql/integration-tests-process/pom.xml +++ b/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-postgresql/integration-tests-process/pom.xml @@ -23,7 +23,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 4.0.0 - org.kie.kogito + org.kie kogito-addons-quarkus-data-index-persistence-postgresql-parent 999-SNAPSHOT @@ -32,8 +32,8 @@ - org.kie.kogito - kogito-quarkus-processes + org.jbpm + jbpm-quarkus io.quarkus @@ -44,12 +44,12 @@ quarkus-resteasy-jackson - org.kie.kogito + org.kie kogito-addons-quarkus-data-index-persistence-postgresql - org.kie.kogito - kogito-addons-quarkus-persistence-jdbc + org.kie + kie-addons-quarkus-persistence-jdbc io.quarkus @@ -65,7 +65,7 @@ test - org.kie.kogito + org.kie kogito-addons-quarkus-data-index-persistence-postgresql-deployment ${project.version} pom diff --git a/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-postgresql/integration-tests-sw/pom.xml b/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-postgresql/integration-tests-sw/pom.xml index 1176f5ae29..24437c6241 100644 --- a/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-postgresql/integration-tests-sw/pom.xml +++ b/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-postgresql/integration-tests-sw/pom.xml @@ -23,7 +23,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 4.0.0 - org.kie.kogito + org.kie kogito-addons-quarkus-data-index-persistence-postgresql-parent 999-SNAPSHOT @@ -44,16 +44,16 @@ quarkus-resteasy-jackson - org.kie.kogito + org.kie kogito-addons-quarkus-data-index-persistence-postgresql - org.kie.kogito - kogito-addons-quarkus-persistence-jdbc + org.kie + kie-addons-quarkus-persistence-jdbc - org.kie.kogito - kogito-addons-quarkus-source-files + org.kie + kie-addons-quarkus-source-files io.quarkus @@ -78,7 +78,7 @@ test - org.kie.kogito + org.kie kogito-addons-quarkus-data-index-persistence-postgresql-deployment ${project.version} pom diff --git a/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-postgresql/pom.xml b/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-postgresql/pom.xml index 534c37123a..4b084a1c94 100644 --- a/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-postgresql/pom.xml +++ b/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-postgresql/pom.xml @@ -23,7 +23,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 4.0.0 - org.kie.kogito + org.kie kogito-addons-quarkus-data-index-persistence 999-SNAPSHOT diff --git a/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-postgresql/runtime/pom.xml b/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-postgresql/runtime/pom.xml index 64fbb5bc50..edcce3089d 100644 --- a/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-postgresql/runtime/pom.xml +++ b/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-postgresql/runtime/pom.xml @@ -23,7 +23,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 4.0.0 - org.kie.kogito + org.kie kogito-addons-quarkus-data-index-persistence-postgresql-parent 999-SNAPSHOT @@ -31,7 +31,7 @@ Kogito Apps :: Kogito Addons Quarkus Data Index Persistence PostgreSQL :: Runtime - org.kie.kogito + org.kie kogito-addons-quarkus-data-index-persistence-common-runtime diff --git a/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-postgresql/runtime/src/main/resources/META-INF/quarkus-extension.yaml b/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-postgresql/runtime/src/main/resources/META-INF/quarkus-extension.yaml index bcdc2b21be..b4bf0bc14c 100644 --- a/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-postgresql/runtime/src/main/resources/META-INF/quarkus-extension.yaml +++ b/data-index/kogito-addons-quarkus-data-index-persistence/kogito-addons-quarkus-data-index-persistence-postgresql/runtime/src/main/resources/META-INF/quarkus-extension.yaml @@ -17,12 +17,18 @@ # under the License. # -name: Kogito Addons Quarkus Data Index Persistence PostgreSQL -description: Kogito Data Index Persistence PostgreSQL Add-On +name: Kogito Data Index Persistence PostgreSQL Quarkus Add-On +description: Add-On to colocate the Data Index Persistence (PostgreSQL) in your application. metadata: keywords: - data-index - kogito + - processes + - workflows + - tasks + - jobs + - BPMN guide: https://quarkus.io/guides/kogito categories: - - "business-automation" \ No newline at end of file + - "business-automation" + status: "stable" \ No newline at end of file diff --git a/data-index/kogito-addons-quarkus-data-index-persistence/pom.xml b/data-index/kogito-addons-quarkus-data-index-persistence/pom.xml index a50d704971..d4cb56a63f 100644 --- a/data-index/kogito-addons-quarkus-data-index-persistence/pom.xml +++ b/data-index/kogito-addons-quarkus-data-index-persistence/pom.xml @@ -27,6 +27,8 @@ data-index 999-SNAPSHOT + + org.kie kogito-addons-quarkus-data-index-persistence Kogito Apps :: Kogito Addons Quarkus Data Index Persistence pom diff --git a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-common/deployment/pom.xml b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-common/deployment/pom.xml index c347c653dc..fadec9f963 100644 --- a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-common/deployment/pom.xml +++ b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-common/deployment/pom.xml @@ -23,7 +23,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 4.0.0 - org.kie.kogito + org.kie kogito-addons-quarkus-data-index-common-parent 999-SNAPSHOT @@ -35,11 +35,11 @@ quarkus-arc-deployment - org.kie.kogito + org.kie kogito-addons-quarkus-common-deployment - org.kie.kogito + org.kie kogito-addons-quarkus-data-index-persistence-common-deployment @@ -47,7 +47,7 @@ quarkus-smallrye-fault-tolerance-deployment - org.kie.kogito + org.kie kogito-addons-quarkus-data-index-common-runtime diff --git a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-common/pom.xml b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-common/pom.xml index 5b53d3ec54..ae5a4387cc 100644 --- a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-common/pom.xml +++ b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-common/pom.xml @@ -23,7 +23,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 4.0.0 - org.kie.kogito + org.kie kogito-addons-quarkus-data-index 999-SNAPSHOT diff --git a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-common/runtime/pom.xml b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-common/runtime/pom.xml index 296e29d909..5d51ababa0 100644 --- a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-common/runtime/pom.xml +++ b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-common/runtime/pom.xml @@ -24,7 +24,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 4.0.0 - org.kie.kogito + org.kie kogito-addons-quarkus-data-index-common-parent 999-SNAPSHOT @@ -40,7 +40,7 @@ data-index-graphql - org.kie.kogito + org.kie kogito-addons-quarkus-data-index-persistence-common-runtime diff --git a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-infinispan/deployment/pom.xml b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-infinispan/deployment/pom.xml index 954aff2e84..51a2f3cd25 100644 --- a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-infinispan/deployment/pom.xml +++ b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-infinispan/deployment/pom.xml @@ -23,7 +23,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 4.0.0 - org.kie.kogito + org.kie kogito-addons-quarkus-data-index-infinispan-parent 999-SNAPSHOT @@ -31,15 +31,15 @@ Kogito Apps :: Kogito Addons Quarkus Data Index Infinispan :: Deployment - org.kie.kogito + org.kie kogito-addons-quarkus-data-index-common-deployment - org.kie.kogito + org.kie kogito-addons-quarkus-data-index-persistence-infinispan-deployment - org.kie.kogito + org.kie kogito-addons-quarkus-data-index-infinispan diff --git a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-infinispan/integration-tests-process/pom.xml b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-infinispan/integration-tests-process/pom.xml index db6ec11c48..3932306aff 100644 --- a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-infinispan/integration-tests-process/pom.xml +++ b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-infinispan/integration-tests-process/pom.xml @@ -23,7 +23,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 4.0.0 - org.kie.kogito + org.kie kogito-addons-quarkus-data-index-infinispan-parent 999-SNAPSHOT @@ -32,8 +32,8 @@ - org.kie.kogito - kogito-quarkus-processes + org.jbpm + jbpm-quarkus io.quarkus @@ -44,16 +44,16 @@ quarkus-resteasy-jackson - org.kie.kogito + org.kie kogito-addons-quarkus-data-index-infinispan - org.kie.kogito - kogito-addons-quarkus-persistence-infinispan + org.kie + kie-addons-quarkus-persistence-infinispan - org.kie.kogito - kogito-addons-quarkus-process-svg + org.kie + kie-addons-quarkus-process-svg io.quarkus @@ -66,7 +66,7 @@ test - org.kie.kogito + org.kie kogito-addons-quarkus-data-index-infinispan-deployment ${project.version} pom diff --git a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-infinispan/integration-tests-sw/pom.xml b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-infinispan/integration-tests-sw/pom.xml index 049b332e3c..f8f56c8e04 100644 --- a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-infinispan/integration-tests-sw/pom.xml +++ b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-infinispan/integration-tests-sw/pom.xml @@ -23,7 +23,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 4.0.0 - org.kie.kogito + org.kie kogito-addons-quarkus-data-index-infinispan-parent 999-SNAPSHOT @@ -44,21 +44,21 @@ quarkus-resteasy-jackson - org.kie.kogito + org.kie kogito-addons-quarkus-data-index-infinispan - org.kie.kogito - kogito-addons-quarkus-persistence-infinispan + org.kie + kie-addons-quarkus-persistence-infinispan org.kie.kogito - kogito-quarkus-serverless-workflow-devui + sonataflow-quarkus-devui org.kie.kogito - kogito-quarkus-serverless-workflow-devui-deployment + sonataflow-quarkus-devui-deployment ${project.version} pom test @@ -80,7 +80,7 @@ test - org.kie.kogito + org.kie kogito-addons-quarkus-data-index-infinispan-deployment ${project.version} pom diff --git a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-infinispan/pom.xml b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-infinispan/pom.xml index 7ac2d09e24..42f2e9c549 100644 --- a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-infinispan/pom.xml +++ b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-infinispan/pom.xml @@ -23,7 +23,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 4.0.0 - org.kie.kogito + org.kie kogito-addons-quarkus-data-index 999-SNAPSHOT diff --git a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-infinispan/runtime/pom.xml b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-infinispan/runtime/pom.xml index eaa379a481..5c361b575c 100644 --- a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-infinispan/runtime/pom.xml +++ b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-infinispan/runtime/pom.xml @@ -23,7 +23,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 4.0.0 - org.kie.kogito + org.kie kogito-addons-quarkus-data-index-infinispan-parent 999-SNAPSHOT @@ -31,11 +31,11 @@ Kogito Apps :: Kogito Addons Quarkus Data Index Infinispan :: Runtime - org.kie.kogito + org.kie kogito-addons-quarkus-data-index-common-runtime - org.kie.kogito + org.kie kogito-addons-quarkus-data-index-persistence-infinispan @@ -54,7 +54,7 @@ ${project.groupId}:${project.artifactId}-deployment:${project.version} - org.kie.kogito.data-index + org.kie.kogito.data-index.infinispan diff --git a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-infinispan/runtime/src/main/resources/META-INF/quarkus-extension.yaml b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-infinispan/runtime/src/main/resources/META-INF/quarkus-extension.yaml index c7eab06352..a23a22c1af 100644 --- a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-infinispan/runtime/src/main/resources/META-INF/quarkus-extension.yaml +++ b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-infinispan/runtime/src/main/resources/META-INF/quarkus-extension.yaml @@ -17,12 +17,22 @@ # under the License. # -name: Kogito Addons Quarkus Data Index Infinispan -description: Kogito Data Index Infinispan Add-On +name: Kogito Add-On Quarkus Data Index Infinispan +description: Runs the Kogito Data Index embedded with Infinispan persistence metadata: keywords: - data-index - kogito + - processes + - workflows + - tasks + - jobs + - BPMN + - infinispan guide: https://quarkus.io/guides/kogito categories: - - "business-automation" \ No newline at end of file + - "business-automation" + status: "stable" + config: + - "kogito.data-index." + - "kogito.dataindex." \ No newline at end of file diff --git a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-inmemory/deployment/pom.xml b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-inmemory/deployment/pom.xml index 0dcdd353e2..5557427def 100644 --- a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-inmemory/deployment/pom.xml +++ b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-inmemory/deployment/pom.xml @@ -23,7 +23,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 4.0.0 - org.kie.kogito + org.kie kogito-addons-quarkus-data-index-inmemory-parent 999-SNAPSHOT @@ -31,11 +31,11 @@ Kogito Apps :: Kogito Addons Quarkus Data Index In-memory :: Deployment - org.kie.kogito + org.kie kogito-addons-quarkus-data-index-common-deployment - org.kie.kogito + org.kie kogito-addons-quarkus-data-index-inmemory diff --git a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-inmemory/integration-tests-process/pom.xml b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-inmemory/integration-tests-process/pom.xml index ca60d8cc4a..9b9dd4872d 100644 --- a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-inmemory/integration-tests-process/pom.xml +++ b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-inmemory/integration-tests-process/pom.xml @@ -23,7 +23,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 4.0.0 - org.kie.kogito + org.kie kogito-addons-quarkus-data-index-inmemory-parent 999-SNAPSHOT @@ -32,8 +32,8 @@ - org.kie.kogito - kogito-quarkus-processes + org.jbpm + jbpm-quarkus io.quarkus @@ -44,12 +44,12 @@ quarkus-resteasy-jackson - org.kie.kogito + org.kie kogito-addons-quarkus-data-index-inmemory - org.kie.kogito - kogito-addons-quarkus-process-svg + org.kie + kie-addons-quarkus-process-svg io.quarkus @@ -62,7 +62,7 @@ test - org.kie.kogito + org.kie kogito-addons-quarkus-data-index-inmemory-deployment ${project.version} pom diff --git a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-inmemory/integration-tests-sw/pom.xml b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-inmemory/integration-tests-sw/pom.xml index 6351fef36e..2561c48a11 100644 --- a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-inmemory/integration-tests-sw/pom.xml +++ b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-inmemory/integration-tests-sw/pom.xml @@ -23,7 +23,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 4.0.0 - org.kie.kogito + org.kie kogito-addons-quarkus-data-index-inmemory-parent 999-SNAPSHOT @@ -44,7 +44,7 @@ quarkus-resteasy-jackson - org.kie.kogito + org.kie kogito-addons-quarkus-data-index-inmemory @@ -58,7 +58,7 @@ test - org.kie.kogito + org.kie kogito-addons-quarkus-data-index-inmemory-deployment ${project.version} pom diff --git a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-inmemory/pom.xml b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-inmemory/pom.xml index 0f6a0b62bb..92855b0b45 100644 --- a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-inmemory/pom.xml +++ b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-inmemory/pom.xml @@ -23,7 +23,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 4.0.0 - org.kie.kogito + org.kie kogito-addons-quarkus-data-index 999-SNAPSHOT diff --git a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-inmemory/runtime/pom.xml b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-inmemory/runtime/pom.xml index 3136f2db4a..737e73f30f 100644 --- a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-inmemory/runtime/pom.xml +++ b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-inmemory/runtime/pom.xml @@ -23,7 +23,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 4.0.0 - org.kie.kogito + org.kie kogito-addons-quarkus-data-index-inmemory-parent 999-SNAPSHOT @@ -31,7 +31,7 @@ Kogito Apps :: Kogito Addons Quarkus Data Index In-memory :: Runtime - org.kie.kogito + org.kie kogito-addons-quarkus-data-index-common-runtime @@ -62,7 +62,7 @@ ${project.groupId}:${project.artifactId}-deployment:${project.version} - org.kie.kogito.data-index + org.kie.kogito.data-index.in-memory diff --git a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-inmemory/runtime/src/main/resources/META-INF/quarkus-extension.yaml b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-inmemory/runtime/src/main/resources/META-INF/quarkus-extension.yaml index 81daebd833..a9ae3a74ce 100644 --- a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-inmemory/runtime/src/main/resources/META-INF/quarkus-extension.yaml +++ b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-inmemory/runtime/src/main/resources/META-INF/quarkus-extension.yaml @@ -17,12 +17,22 @@ # under the License. # -name: Kogito Addons Quarkus Data Index In-memory -description: Kogito Data Index In-memory Add-On +name: Kogito Data Index In-memory Quarkus Add-On +description: Runs the Kogito Data Index embedded with In-memory persistence metadata: keywords: - data-index - kogito + - processes + - workflows + - tasks + - jobs + - BPMN + - in-memory guide: https://quarkus.io/guides/kogito categories: - - "business-automation" \ No newline at end of file + - "business-automation" + status: "stable" + config: + - "kogito.data-index." + - "kogito.dataindex." \ No newline at end of file diff --git a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-mongodb/deployment/pom.xml b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-mongodb/deployment/pom.xml index 85d2a897bd..e9bf591d49 100644 --- a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-mongodb/deployment/pom.xml +++ b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-mongodb/deployment/pom.xml @@ -23,7 +23,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 4.0.0 - org.kie.kogito + org.kie kogito-addons-quarkus-data-index-mongodb-parent 999-SNAPSHOT @@ -31,15 +31,15 @@ Kogito Apps :: Kogito Addons Quarkus Data Index MongoDB :: Deployment - org.kie.kogito + org.kie kogito-addons-quarkus-data-index-common-deployment - org.kie.kogito + org.kie kogito-addons-quarkus-data-index-persistence-mongodb-deployment - org.kie.kogito + org.kie kogito-addons-quarkus-data-index-mongodb diff --git a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-mongodb/integration-tests-process/pom.xml b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-mongodb/integration-tests-process/pom.xml index bfb73aeaa3..d866905155 100644 --- a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-mongodb/integration-tests-process/pom.xml +++ b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-mongodb/integration-tests-process/pom.xml @@ -23,7 +23,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 4.0.0 - org.kie.kogito + org.kie kogito-addons-quarkus-data-index-mongodb-parent 999-SNAPSHOT @@ -32,8 +32,8 @@ - org.kie.kogito - kogito-quarkus-processes + org.jbpm + jbpm-quarkus io.quarkus @@ -44,16 +44,16 @@ quarkus-resteasy-jackson - org.kie.kogito - kogito-addons-quarkus-persistence-mongodb + org.kie + kie-addons-quarkus-persistence-mongodb - org.kie.kogito + org.kie kogito-addons-quarkus-data-index-mongodb - org.kie.kogito - kogito-addons-quarkus-process-svg + org.kie + kie-addons-quarkus-process-svg io.quarkus @@ -66,7 +66,7 @@ test - org.kie.kogito + org.kie kogito-addons-quarkus-data-index-mongodb-deployment ${project.version} pom diff --git a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-mongodb/integration-tests-sw/pom.xml b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-mongodb/integration-tests-sw/pom.xml index 8090b922d5..fe231eb406 100644 --- a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-mongodb/integration-tests-sw/pom.xml +++ b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-mongodb/integration-tests-sw/pom.xml @@ -23,7 +23,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 4.0.0 - org.kie.kogito + org.kie kogito-addons-quarkus-data-index-mongodb-parent 999-SNAPSHOT @@ -44,11 +44,11 @@ quarkus-resteasy-jackson - org.kie.kogito - kogito-addons-quarkus-persistence-mongodb + org.kie + kie-addons-quarkus-persistence-mongodb - org.kie.kogito + org.kie kogito-addons-quarkus-data-index-mongodb @@ -62,7 +62,7 @@ test - org.kie.kogito + org.kie kogito-addons-quarkus-data-index-mongodb-deployment ${project.version} pom diff --git a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-mongodb/pom.xml b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-mongodb/pom.xml index 4837e90517..d26fe089ed 100644 --- a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-mongodb/pom.xml +++ b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-mongodb/pom.xml @@ -23,7 +23,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 4.0.0 - org.kie.kogito + org.kie kogito-addons-quarkus-data-index 999-SNAPSHOT diff --git a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-mongodb/runtime/pom.xml b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-mongodb/runtime/pom.xml index 5e52f0592d..bba0e6e3c5 100644 --- a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-mongodb/runtime/pom.xml +++ b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-mongodb/runtime/pom.xml @@ -23,7 +23,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 4.0.0 - org.kie.kogito + org.kie kogito-addons-quarkus-data-index-mongodb-parent 999-SNAPSHOT @@ -31,11 +31,11 @@ Kogito Apps :: Kogito Addons Quarkus Data Index MongoDB :: Runtime - org.kie.kogito + org.kie kogito-addons-quarkus-data-index-common-runtime - org.kie.kogito + org.kie kogito-addons-quarkus-data-index-persistence-mongodb @@ -58,7 +58,7 @@ ${project.groupId}:${project.artifactId}-deployment:${project.version} - org.kie.kogito.data-index + org.kie.kogito.data-index.mongodb diff --git a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-mongodb/runtime/src/main/resources/META-INF/quarkus-extension.yaml b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-mongodb/runtime/src/main/resources/META-INF/quarkus-extension.yaml index e04f00a450..4e638b32b1 100644 --- a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-mongodb/runtime/src/main/resources/META-INF/quarkus-extension.yaml +++ b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-mongodb/runtime/src/main/resources/META-INF/quarkus-extension.yaml @@ -17,12 +17,22 @@ # under the License. # -name: Kogito Addons Quarkus Data Index MongoDB -description: Kogito Data Index MongoDB Add-On +name: Kogito Data Index MongoDB Quarkus Add-On +description: Runs the Kogito Data Index embedded with MongoDB persistence metadata: keywords: - data-index - kogito + - processes + - workflows + - tasks + - jobs + - BPMN + - mongodb guide: https://quarkus.io/guides/kogito categories: - - "business-automation" \ No newline at end of file + - "business-automation" + status: "stable" + config: + - "kogito.data-index." + - "kogito.dataindex." \ No newline at end of file diff --git a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-postgresql/deployment/pom.xml b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-postgresql/deployment/pom.xml index 098e64e0e5..434a514962 100644 --- a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-postgresql/deployment/pom.xml +++ b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-postgresql/deployment/pom.xml @@ -23,7 +23,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 4.0.0 - org.kie.kogito + org.kie kogito-addons-quarkus-data-index-postgresql-parent 999-SNAPSHOT @@ -31,15 +31,15 @@ Kogito Apps :: Kogito Addons Quarkus Data Index PostgreSQL :: Deployment - org.kie.kogito + org.kie kogito-addons-quarkus-data-index-common-deployment - org.kie.kogito + org.kie kogito-addons-quarkus-data-index-persistence-postgresql-deployment - org.kie.kogito + org.kie kogito-addons-quarkus-data-index-postgresql diff --git a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-postgresql/integration-tests-process/pom.xml b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-postgresql/integration-tests-process/pom.xml index 6cfd8c75ca..86e8c2e46d 100644 --- a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-postgresql/integration-tests-process/pom.xml +++ b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-postgresql/integration-tests-process/pom.xml @@ -23,7 +23,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 4.0.0 - org.kie.kogito + org.kie kogito-addons-quarkus-data-index-postgresql-parent 999-SNAPSHOT @@ -32,8 +32,8 @@ - org.kie.kogito - kogito-quarkus-processes + org.jbpm + jbpm-quarkus io.quarkus @@ -44,16 +44,16 @@ quarkus-resteasy-jackson - org.kie.kogito + org.kie kogito-addons-quarkus-data-index-postgresql - org.kie.kogito - kogito-addons-quarkus-persistence-jdbc + org.kie + kie-addons-quarkus-persistence-jdbc - org.kie.kogito - kogito-addons-quarkus-process-svg + org.kie + kie-addons-quarkus-process-svg io.quarkus @@ -74,7 +74,7 @@ test - org.kie.kogito + org.kie kogito-addons-quarkus-data-index-postgresql-deployment ${project.version} pom diff --git a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-postgresql/integration-tests-sw/pom.xml b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-postgresql/integration-tests-sw/pom.xml index 9d58ee647c..3e1defacee 100644 --- a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-postgresql/integration-tests-sw/pom.xml +++ b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-postgresql/integration-tests-sw/pom.xml @@ -23,7 +23,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 4.0.0 - org.kie.kogito + org.kie kogito-addons-quarkus-data-index-postgresql-parent 999-SNAPSHOT @@ -44,12 +44,12 @@ quarkus-resteasy-jackson - org.kie.kogito + org.kie kogito-addons-quarkus-data-index-postgresql - org.kie.kogito - kogito-addons-quarkus-persistence-jdbc + org.kie + kie-addons-quarkus-persistence-jdbc io.quarkus @@ -70,7 +70,7 @@ test - org.kie.kogito + org.kie kogito-addons-quarkus-data-index-postgresql-deployment ${project.version} pom diff --git a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-postgresql/pom.xml b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-postgresql/pom.xml index df80ccf45c..226d365822 100644 --- a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-postgresql/pom.xml +++ b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-postgresql/pom.xml @@ -23,7 +23,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 4.0.0 - org.kie.kogito + org.kie kogito-addons-quarkus-data-index 999-SNAPSHOT diff --git a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-postgresql/runtime/pom.xml b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-postgresql/runtime/pom.xml index 191461c653..91e7c8d0a4 100644 --- a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-postgresql/runtime/pom.xml +++ b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-postgresql/runtime/pom.xml @@ -23,7 +23,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 4.0.0 - org.kie.kogito + org.kie kogito-addons-quarkus-data-index-postgresql-parent 999-SNAPSHOT @@ -31,11 +31,11 @@ Kogito Apps :: Kogito Addons Quarkus Data Index PostgreSQL :: Runtime - org.kie.kogito + org.kie kogito-addons-quarkus-data-index-common-runtime - org.kie.kogito + org.kie kogito-addons-quarkus-data-index-persistence-postgresql @@ -58,7 +58,7 @@ ${project.groupId}:${project.artifactId}-deployment:${project.version} - org.kie.kogito.data-index + org.kie.kogito.data-index.postgresql diff --git a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-postgresql/runtime/src/main/resources/META-INF/quarkus-extension.yaml b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-postgresql/runtime/src/main/resources/META-INF/quarkus-extension.yaml index c06bb06e62..87338f83d4 100644 --- a/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-postgresql/runtime/src/main/resources/META-INF/quarkus-extension.yaml +++ b/data-index/kogito-addons-quarkus-data-index/kogito-addons-quarkus-data-index-postgresql/runtime/src/main/resources/META-INF/quarkus-extension.yaml @@ -17,12 +17,22 @@ # under the License. # -name: Kogito Addons Quarkus Data Index PostgreSQL -description: Kogito Data Index PostgreSQL Add-On +name: Kogito Data Index PostgreSQL Quarkus Add-On +description: Runs the Kogito Data Index embedded with PostgreSQL persistence metadata: keywords: - data-index - kogito + - processes + - workflows + - tasks + - jobs + - BPMN + - postgresql guide: https://quarkus.io/guides/kogito categories: - - "business-automation" \ No newline at end of file + - "business-automation" + status: "stable" + config: + - "kogito.data-index." + - "kogito.dataindex." \ No newline at end of file diff --git a/data-index/kogito-addons-quarkus-data-index/pom.xml b/data-index/kogito-addons-quarkus-data-index/pom.xml index ba51ba6cdb..2996e9027a 100644 --- a/data-index/kogito-addons-quarkus-data-index/pom.xml +++ b/data-index/kogito-addons-quarkus-data-index/pom.xml @@ -27,6 +27,8 @@ data-index 999-SNAPSHOT + + org.kie kogito-addons-quarkus-data-index Kogito Apps :: Kogito Addons Quarkus Data Index pom diff --git a/jitexecutor/jitexecutor-bpmn/pom.xml b/jitexecutor/jitexecutor-bpmn/pom.xml index 00ca9e0713..ba267ce747 100644 --- a/jitexecutor/jitexecutor-bpmn/pom.xml +++ b/jitexecutor/jitexecutor-bpmn/pom.xml @@ -67,8 +67,8 @@ jitexecutor-common - org.kie.kogito - kogito-quarkus-processes + org.jbpm + jbpm-quarkus diff --git a/jobs-service/README.md b/jobs-service/README.md new file mode 100644 index 0000000000..322da8c9b6 --- /dev/null +++ b/jobs-service/README.md @@ -0,0 +1,98 @@ + +# Jobs + +job service represents a subsystem within kogito workflow domain. This component is responsible for scheduling jobs. In the case of workflow this module takes care of timers such from boundary events, SLA, throw events relevant to timers. Also is used for things like human tasks notifications. + +The system supports two different types of deployment: + +* Compact Architecture: as a component deployed within the application. +* Distributed architecture: as a microservice deployed independently + +The current support storage is + +* postgresql +* infinspan +* mongodb +* in memmory + +At present jobs only supports quarkus runtimes in compact architecture. + +## How jobs work + +![job service](docs/job_service.png "Job Service") + +The concepts to understand the above picture are: +* transport: the medium used to transfer a message between client component and job service. The transport could be http, kafka or in-vm at the moment. +* sink: is the client endpoint callback. +* storage: is the persistence tier of the jobs being current scheduled. +* job service: it the main component containing the logic of scheduling a job and storing data. + +When a client invokes the job service the client component send a message through the transport tier containing the information required in order to call back the sink once the job times out. +Once the request reaches the job service it creates internally the job and stores the data about the job status in the storage. +After the job times out, the component calls the sink signaling the client using either in-vm or http request. + +## Using job service as Compact architecture + +For using in your project this you need first to include the dependency related to the transport tier. in our case for in-vm we use + + + + org.kie + kogito-addons-quarkus-jobs-management + + + org.kie + kogito-addons-quarkus-jobs + + + + +after that we need to include the storage we want to use. For instance we are using postgresql + + + + + org.kie.kogito + jobs-service-postgresql-common + + + +In this case for postgresql in-vm it will use automatically your main data source available. +Here you have an example of this configuration: + + + + + kogito.persistence.type=jdbc + quarkus.datasource.db-kind=postgresql + quarkus.datasource.username=kogito-user + quarkus.datasource.password=kogito-pass + quarkus.datasource.jdbc.url=${QUARKUS_DATASOURCE_JDBC_URL:jdbc:postgresql://localhost:5432/kogito} + quarkus.datasource.reactive.url=${QUARKUS_DATASOURCE_REACTIVE_URL:postgresql://localhost:5432/kogito} + + + +> Note: you need to us managed dependencies, otherwise you need to specify the version of the dependencies. + +> Note: in case you are using other service like MongoDB, check you need to configure the storage with the proper properties. The components uses the common quarkus + +> Note: in the case of ddl scripts for pgsql you can find it in `jobs-service-postgresql-common/src/main/resources/db/jobs-service` + +## Distributed deployment + +For distributed deployment job service offers already builtin docker images. This images are based on the repository + + +* [Kogito Images](https://github.com/apache/incubator-kie-kogito-images) +* [Kogito Job Images](https://github.com/apache/incubator-kie-kogito-images?tab=readme-ov-file#kogito-jobs-service-component-images) + +And you need to setup a few things in the client side of things: + + + + kogito.jobs-service.url=http://localhost:8580 + + + + + diff --git a/jobs-service/docs/job_service.png b/jobs-service/docs/job_service.png new file mode 100644 index 0000000000..77c43c4384 Binary files /dev/null and b/jobs-service/docs/job_service.png differ diff --git a/jobs-service/jobs-recipients/job-http-recipient/deployment/pom.xml b/jobs-service/jobs-recipients/job-http-recipient/deployment/pom.xml index 8764590228..9d66b1c5d7 100644 --- a/jobs-service/jobs-recipients/job-http-recipient/deployment/pom.xml +++ b/jobs-service/jobs-recipients/job-http-recipient/deployment/pom.xml @@ -23,20 +23,20 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 4.0.0 - org.kie.kogito - job-http-recipient-parent + org.kie + kogito-addons-quarkus-job-http-recipient-parent 999-SNAPSHOT - job-http-recipient-deployment - Kogito Apps :: Jobs Service :: Job Http Recipient - Deployment + kogito-addons-quarkus-job-http-recipient-deployment + Kogito Apps :: Jobs Service :: Kogito Add-Ons Quarkus Job Http Recipient - Deployment io.quarkus quarkus-arc-deployment - org.kie.kogito - job-http-recipient + org.kie + kogito-addons-quarkus-job-http-recipient io.quarkus diff --git a/jobs-service/jobs-recipients/job-http-recipient/pom.xml b/jobs-service/jobs-recipients/job-http-recipient/pom.xml index 4c38e877d1..8e8214f306 100644 --- a/jobs-service/jobs-recipients/job-http-recipient/pom.xml +++ b/jobs-service/jobs-recipients/job-http-recipient/pom.xml @@ -27,9 +27,11 @@ jobs-recipients 999-SNAPSHOT - job-http-recipient-parent + + org.kie + kogito-addons-quarkus-job-http-recipient-parent pom - Kogito Apps :: Jobs Service :: Job Http Recipient - Parent + Kogito Apps :: Jobs Service :: Kogito Add-Ons Quarkus Job Http Recipient - Parent org.kie.kogito.job.recipient.http.extension diff --git a/jobs-service/jobs-recipients/job-http-recipient/runtime/pom.xml b/jobs-service/jobs-recipients/job-http-recipient/runtime/pom.xml index 1504cf7645..1605df80c0 100644 --- a/jobs-service/jobs-recipients/job-http-recipient/runtime/pom.xml +++ b/jobs-service/jobs-recipients/job-http-recipient/runtime/pom.xml @@ -23,12 +23,12 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 4.0.0 - org.kie.kogito - job-http-recipient-parent + org.kie + kogito-addons-quarkus-job-http-recipient-parent 999-SNAPSHOT - job-http-recipient - Kogito Apps :: Jobs Service :: Job Http Recipient - Runtime + kogito-addons-quarkus-job-http-recipient + Kogito Apps :: Jobs Service :: Kogito Add-Ons Quarkus Job Http Recipient - Runtime io.quarkus @@ -94,6 +94,9 @@ ${project.groupId}:${project.artifactId}-deployment:${project.version} + + org.kie.kogito.jobs.http-recipient + diff --git a/jobs-service/jobs-recipients/job-http-recipient/runtime/src/main/resources/META-INF/quarkus-extension.yaml b/jobs-service/jobs-recipients/job-http-recipient/runtime/src/main/resources/META-INF/quarkus-extension.yaml index 100d9038bc..2f5d80af2e 100644 --- a/jobs-service/jobs-recipients/job-http-recipient/runtime/src/main/resources/META-INF/quarkus-extension.yaml +++ b/jobs-service/jobs-recipients/job-http-recipient/runtime/src/main/resources/META-INF/quarkus-extension.yaml @@ -17,8 +17,18 @@ # under the License. # -name: Job Http Recipient extension +name: Kogito Job Http Recipient Quarkus Add-On description: Handle HTTP requests based on information from the job recipient. metadata: keywords: - - HTTP, HTTPRecipient \ No newline at end of file + - kogito + - processes + - BPMN + - workflows + - jobs + - HTTP + - HTTPRecipient + guide: https://quarkus.io/guides/kogito + categories: + - "business-automation" + status: "stable" \ No newline at end of file diff --git a/jobs-service/jobs-recipients/job-sink-recipient/deployment/pom.xml b/jobs-service/jobs-recipients/job-sink-recipient/deployment/pom.xml index 22258b22d8..be9e71b4c6 100644 --- a/jobs-service/jobs-recipients/job-sink-recipient/deployment/pom.xml +++ b/jobs-service/jobs-recipients/job-sink-recipient/deployment/pom.xml @@ -23,13 +23,13 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - job-sink-recipient-parent - org.kie.kogito + org.kie + kogito-addons-quarkus-job-sink-recipient-parent 999-SNAPSHOT 4.0.0 - job-sink-recipient-deployment - Kogito Apps :: Jobs Service :: Job Sink Recipient - Deployment + kogito-addons-quarkus-job-sink-recipient-deployment + Kogito Apps :: Jobs Service :: Kogito Add-Ons Quarkus Job Sink Recipient - Deployment @@ -45,9 +45,10 @@ quarkus-jackson-deployment - org.kie.kogito - job-sink-recipient + org.kie + kogito-addons-quarkus-job-sink-recipient + org.junit.jupiter diff --git a/jobs-service/jobs-recipients/job-sink-recipient/pom.xml b/jobs-service/jobs-recipients/job-sink-recipient/pom.xml index 449cbde24e..3ba1e39129 100644 --- a/jobs-service/jobs-recipients/job-sink-recipient/pom.xml +++ b/jobs-service/jobs-recipients/job-sink-recipient/pom.xml @@ -29,9 +29,10 @@ 4.0.0 - job-sink-recipient-parent + org.kie + kogito-addons-quarkus-job-sink-recipient-parent pom - Kogito Apps :: Jobs Service :: Job Sink Recipient - Parent + Kogito Apps :: Jobs Service :: Kogito Add-Ons Quarkus Job Sink Recipient - Parent org.kie.kogito.job.recipient.sink.extension diff --git a/jobs-service/jobs-recipients/job-sink-recipient/runtime/pom.xml b/jobs-service/jobs-recipients/job-sink-recipient/runtime/pom.xml index 4502c70a00..79a7ddc30b 100644 --- a/jobs-service/jobs-recipients/job-sink-recipient/runtime/pom.xml +++ b/jobs-service/jobs-recipients/job-sink-recipient/runtime/pom.xml @@ -23,13 +23,13 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - job-sink-recipient-parent - org.kie.kogito + org.kie + kogito-addons-quarkus-job-sink-recipient-parent 999-SNAPSHOT 4.0.0 - job-sink-recipient - Kogito Apps :: Jobs Service :: Job Sink Recipient - Runtime + kogito-addons-quarkus-job-sink-recipient + Kogito Apps :: Jobs Service :: Kogito Add-Ons Quarkus Job Sink Recipient - Runtime @@ -99,8 +99,10 @@ extension-descriptor - ${project.groupId}:${project.artifactId}-deployment:${project.version} - + ${project.groupId}:${project.artifactId}-deployment:${project.version} + + org.kie.kogito.jobs.sink-recipient + diff --git a/jobs-service/jobs-recipients/job-sink-recipient/runtime/src/main/resources/META-INF/quarkus-extension.yaml b/jobs-service/jobs-recipients/job-sink-recipient/runtime/src/main/resources/META-INF/quarkus-extension.yaml index cbde8a946a..02c4a4943c 100644 --- a/jobs-service/jobs-recipients/job-sink-recipient/runtime/src/main/resources/META-INF/quarkus-extension.yaml +++ b/jobs-service/jobs-recipients/job-sink-recipient/runtime/src/main/resources/META-INF/quarkus-extension.yaml @@ -17,8 +17,21 @@ # under the License. # -name: Job Sink Recipient extension +name: Kogito Job Sink Recipient extension Quarkus Add-On description: Handle the delivery of cloud events to a knative sink based on the information from the job recipient. metadata: keywords: - - Sink, SinkRecipient \ No newline at end of file + - kogito + - processes + - BPMN + - workflows + - jobs + - Sink + - SinkRecipient + - cloudevents + guide: https://quarkus.io/guides/kogito + categories: + - "business-automation" + status: "stable" + config: + - "kogito.job.recipient.sink." \ No newline at end of file diff --git a/jobs-service/jobs-service-common/pom.xml b/jobs-service/jobs-service-common/pom.xml index 96163c8780..c1db185e38 100644 --- a/jobs-service/jobs-service-common/pom.xml +++ b/jobs-service/jobs-service-common/pom.xml @@ -54,12 +54,12 @@ jobs-service-internal-api - org.kie.kogito - job-http-recipient + org.kie + kogito-addons-quarkus-job-http-recipient - org.kie.kogito - job-sink-recipient + org.kie + kogito-addons-quarkus-job-sink-recipient io.quarkus diff --git a/jobs-service/jobs-service-infinispan/pom.xml b/jobs-service/jobs-service-infinispan/pom.xml index 89c72945c8..a5bfaed242 100644 --- a/jobs-service/jobs-service-infinispan/pom.xml +++ b/jobs-service/jobs-service-infinispan/pom.xml @@ -68,8 +68,8 @@ infinispan-query-dsl - org.kie.kogito - kogito-addons-quarkus-persistence-infinispan-health + org.kie + kie-addons-quarkus-persistence-infinispan-health diff --git a/jobs-service/kogito-addons-jobs-service/kogito-addons-quarkus-jobs-service-embedded/deployment/pom.xml b/jobs-service/kogito-addons-jobs-service/kogito-addons-quarkus-jobs-service-embedded/deployment/pom.xml index 8fc8d79fa9..705ac833e2 100644 --- a/jobs-service/kogito-addons-jobs-service/kogito-addons-quarkus-jobs-service-embedded/deployment/pom.xml +++ b/jobs-service/kogito-addons-jobs-service/kogito-addons-quarkus-jobs-service-embedded/deployment/pom.xml @@ -23,23 +23,23 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 4.0.0 - org.kie.kogito + org.kie kogito-addons-quarkus-jobs-service-embedded-parent 999-SNAPSHOT kogito-addons-quarkus-jobs-service-embedded-deployment - Jobs Service Embedded Quarkus Addon - Deployment + Jobs Service Embedded Quarkus Add-On - Deployment io.quarkus quarkus-arc-deployment - org.kie.kogito + org.kie kogito-addons-quarkus-jobs-service-embedded - org.kie.kogito + org.kie kogito-addons-quarkus-jobs-management-deployment @@ -51,12 +51,12 @@ quarkus-resteasy-mutiny-deployment - org.kie.kogito + org.kie kogito-addons-quarkus-common-deployment - org.kie.kogito - job-http-recipient-deployment + org.kie + kogito-addons-quarkus-job-http-recipient-deployment io.quarkus diff --git a/jobs-service/kogito-addons-jobs-service/kogito-addons-quarkus-jobs-service-embedded/pom.xml b/jobs-service/kogito-addons-jobs-service/kogito-addons-quarkus-jobs-service-embedded/pom.xml index 58b9aeafbe..3f6bc0b450 100644 --- a/jobs-service/kogito-addons-jobs-service/kogito-addons-quarkus-jobs-service-embedded/pom.xml +++ b/jobs-service/kogito-addons-jobs-service/kogito-addons-quarkus-jobs-service-embedded/pom.xml @@ -23,13 +23,13 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 4.0.0 - org.kie.kogito + org.kie kogito-addons-jobs-service 999-SNAPSHOT kogito-addons-quarkus-jobs-service-embedded-parent pom - Jobs Service Embedded Quarkus Addon - Parent + Jobs Service Embedded Quarkus Add-On - Parent org.kie.kogito.addons.quarkus.job.service.embedded diff --git a/jobs-service/kogito-addons-jobs-service/kogito-addons-quarkus-jobs-service-embedded/runtime/pom.xml b/jobs-service/kogito-addons-jobs-service/kogito-addons-quarkus-jobs-service-embedded/runtime/pom.xml index 22dc476289..4901ba3d81 100644 --- a/jobs-service/kogito-addons-jobs-service/kogito-addons-quarkus-jobs-service-embedded/runtime/pom.xml +++ b/jobs-service/kogito-addons-jobs-service/kogito-addons-quarkus-jobs-service-embedded/runtime/pom.xml @@ -23,12 +23,12 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 4.0.0 - org.kie.kogito + org.kie kogito-addons-quarkus-jobs-service-embedded-parent 999-SNAPSHOT kogito-addons-quarkus-jobs-service-embedded - Jobs Service Embedded Quarkus Addon - Runtime + Jobs Service Embedded Quarkus Add-On - Runtime Run Jobs Service embedded with the application. @@ -73,13 +73,13 @@ - org.kie.kogito - job-sink-recipient + org.kie + kogito-addons-quarkus-job-sink-recipient - org.kie.kogito + org.kie kogito-addons-quarkus-jobs-management @@ -113,6 +113,9 @@ ${project.groupId}:${project.artifactId}-deployment:${project.version} + + org.kie.kogito.jobs.embedded-jobs-service + diff --git a/jobs-service/kogito-addons-jobs-service/kogito-addons-quarkus-jobs-service-embedded/runtime/src/main/resources/META-INF/quarkus-extension.yaml b/jobs-service/kogito-addons-jobs-service/kogito-addons-quarkus-jobs-service-embedded/runtime/src/main/resources/META-INF/quarkus-extension.yaml index 76d650d377..ce0fa3b515 100644 --- a/jobs-service/kogito-addons-jobs-service/kogito-addons-quarkus-jobs-service-embedded/runtime/src/main/resources/META-INF/quarkus-extension.yaml +++ b/jobs-service/kogito-addons-jobs-service/kogito-addons-quarkus-jobs-service-embedded/runtime/src/main/resources/META-INF/quarkus-extension.yaml @@ -17,12 +17,18 @@ # under the License. # -name: Jobs Service Embedded Quarkus Addon +name: Kogito Jobs Service Embedded Quarkus Add-On description: Run Jobs Service embedded with the application. metadata: keywords: - - kogito-addons-quarkus-jobs-service-embedded + - kogito + - processes + - BPMN + - workflows + - jobs guide: https://quarkus.io/guides/kogito categories: - - "miscellaneous" + - "business-automation" status: "preview" + config: + - "kogito.job-service." diff --git a/jobs-service/kogito-addons-jobs-service/kogito-addons-quarkus-jobs/pom.xml b/jobs-service/kogito-addons-jobs-service/kogito-addons-quarkus-jobs/pom.xml index ed160a6db6..e83e2ecdae 100644 --- a/jobs-service/kogito-addons-jobs-service/kogito-addons-quarkus-jobs/pom.xml +++ b/jobs-service/kogito-addons-jobs-service/kogito-addons-quarkus-jobs/pom.xml @@ -5,13 +5,13 @@ 4.0.0 kogito-addons-jobs-service - org.kie.kogito + org.kie 999-SNAPSHOT kogito-addons-quarkus-jobs - Jobs Collocated Quarkus Addon - Runtime + Jobs Collocated Quarkus Add-On - Runtime Run Jobs Service embedded with the application. diff --git a/jobs-service/kogito-addons-jobs-service/pom.xml b/jobs-service/kogito-addons-jobs-service/pom.xml index 45b2397131..d2dc14e4c2 100644 --- a/jobs-service/kogito-addons-jobs-service/pom.xml +++ b/jobs-service/kogito-addons-jobs-service/pom.xml @@ -28,6 +28,8 @@ jobs-service 999-SNAPSHOT + + org.kie kogito-addons-jobs-service Kogito Apps :: Jobs :: Addons Kogito Jobs Addons Parent diff --git a/jobs-service/pom.xml b/jobs-service/pom.xml index a505ae3031..df5f21f771 100644 --- a/jobs-service/pom.xml +++ b/jobs-service/pom.xml @@ -73,32 +73,32 @@ test - org.kie.kogito - job-http-recipient + org.kie + kogito-addons-quarkus-job-http-recipient ${project.version} - org.kie.kogito - job-http-recipient-deployment + org.kie + kogito-addons-quarkus-job-http-recipient-deployment ${project.version} - org.kie.kogito - job-sink-recipient + org.kie + kogito-addons-quarkus-job-sink-recipient ${project.version} org.kie.kogito - job-sink-recipient-deployment + kogito-addons-quarkus-job-sink-recipient-deployment ${project.version} - org.kie.kogito + org.kie kogito-addons-quarkus-jobs-service-embedded ${project.version} - org.kie.kogito + org.kie kogito-addons-quarkus-jobs-service-embedded-deployment ${project.version} diff --git a/kogito-apps-bom/pom.xml b/kogito-apps-bom/pom.xml index a25c91ac82..5d7488973b 100644 --- a/kogito-apps-bom/pom.xml +++ b/kogito-apps-bom/pom.xml @@ -1,4 +1,3 @@ - - org.kie.kogito - data-audit-common + org.kie + kogito-addons-quarkus-job-http-recipient-deployment ${project.version} - org.kie.kogito - data-audit-common + org.kie + kogito-addons-quarkus-job-http-recipient-deployment ${project.version} - tests + sources - org.kie.kogito - data-audit-common-service + org.kie + kogito-addons-quarkus-job-http-recipient ${project.version} - org.kie.kogito - data-audit-quarkus-tck + org.kie + kogito-addons-quarkus-job-http-recipient + ${project.version} + sources + + + org.kie + kogito-addons-quarkus-job-sink-recipient-deployment ${project.version} + + org.kie + kogito-addons-quarkus-job-sink-recipient-deployment + ${project.version} + sources + + + org.kie + kogito-addons-quarkus-job-sink-recipient + ${project.version} + + + org.kie + kogito-addons-quarkus-job-sink-recipient + ${project.version} + sources + + + org.kie.kogito - data-audit-quarkus-tck + data-audit-common ${project.version} - test-jar org.kie.kogito - data-audit-springboot-tck + data-audit-common ${project.version} + tests org.kie.kogito - data-audit-springboot-tck + data-audit-common-service ${project.version} - test-jar org.kie.kogito @@ -181,29 +203,34 @@ ${project.version} - org.kie.kogito - kogito-addons-data-audit-quarkus + org.kie + kogito-addons-quarkus-data-audit ${project.version} - org.kie.kogito - kogito-addons-data-audit-springboot + org.kie + kogito-addons-springboot-data-audit ${project.version} - org.kie.kogito + org.kie + data-audit-quarkus-jpa-service + ${project.version} + + + org.kie kogito-addons-data-audit-jpa-common ${project.version} - org.kie.kogito - kogito-addons-data-audit-jpa-quarkus + org.kie + kogito-addons-quarkus-data-audit-jpa ${project.version} - org.kie.kogito - kogito-addons-data-audit-jpa-springboot + org.kie + kogito-addons-springboot-data-audit-jpa ${project.version} @@ -265,26 +292,33 @@ org.kie.kogito - data-index-storage-oracle + data-index-storage-jpa ${project.version} org.kie.kogito - data-index-storage-oracle + data-index-storage-jpa ${project.version} sources org.kie.kogito - data-index-storage-jpa + data-index-storage-jpa-common ${project.version} org.kie.kogito - data-index-storage-jpa + data-index-storage-jpa-common ${project.version} sources + + org.kie.kogito + data-index-storage-jpa-common + ${project.version} + test-jar + test + org.kie.kogito data-index-storage-postgresql @@ -368,17 +402,6 @@ ${project.version} sources - - org.kie.kogito - data-index-service-oracle - ${project.version} - - - org.kie.kogito - data-index-service-oracle - ${project.version} - sources - org.kie.kogito data-index-service-postgresql @@ -402,49 +425,45 @@ sources - org.kie.kogito - - kogito-addons-quarkus-data-index-persistence-common-runtime + org.kie + kogito-addons-quarkus-data-index-persistence-common-runtime ${project.version} - org.kie.kogito - - kogito-addons-quarkus-data-index-persistence-common-runtime + org.kie + kogito-addons-quarkus-data-index-persistence-common-runtime ${project.version} sources - org.kie.kogito - - kogito-addons-quarkus-data-index-persistence-common-deployment + org.kie + kogito-addons-quarkus-data-index-persistence-common-deployment ${project.version} - org.kie.kogito - - kogito-addons-quarkus-data-index-persistence-common-deployment + org.kie + kogito-addons-quarkus-data-index-persistence-common-deployment ${project.version} sources - org.kie.kogito + org.kie kogito-addons-quarkus-data-index-common-runtime ${project.version} - org.kie.kogito + org.kie kogito-addons-quarkus-data-index-common-runtime ${project.version} sources - org.kie.kogito + org.kie kogito-addons-quarkus-data-index-common-deployment ${project.version} - org.kie.kogito + org.kie kogito-addons-quarkus-data-index-common-deployment ${project.version} sources @@ -963,15 +982,40 @@ ${project.version} + + + org.jbpm + jbpm-quarkus-devui + ${project.version} + + + org.jbpm + jbpm-quarkus-devui-deployment + ${project.version} + + + org.kie.kogito - runtime-tools-quarkus-extension-deployment + sonataflow-quarkus-devui ${project.version} org.kie.kogito - runtime-tools-quarkus-extension + sonataflow-quarkus-devui ${project.version} + sources + + + org.kie.kogito + sonataflow-quarkus-devui-deployment + ${project.version} + + + org.kie.kogito + sonataflow-quarkus-devui-deployment + ${project.version} + sources diff --git a/kogito-apps-build-parent/pom.xml b/kogito-apps-build-parent/pom.xml index 8760600b75..8069ce384e 100644 --- a/kogito-apps-build-parent/pom.xml +++ b/kogito-apps-build-parent/pom.xml @@ -80,6 +80,7 @@ 1.0.0 + ${project.version} @@ -135,6 +136,53 @@ + + + + + + org.codehaus.mojo + exec-maven-plugin + + + org.drools + drools-util + ${version.drools.util} + + + + + Remove comments from generated files + prepare-package + + java + + + false + true + + org.drools + drools-util + + org.drools.util.RemoveCommentsMain + + true + ${project.basedir}/target/classes/META-INF/quarkus-javadoc.properties + ${project.basedir}/target/classes/META-INF/quarkus-extension.properties + ${project.basedir}/target/generated-sources/annotations/org/kie/kogito/job/http/recipient/JobHttpRecipientRuntimeConfiguration.jdp + ${project.basedir}/target/generated-sources/annotations/org/kie/kogito/job/sink/recipient/JobSinkRecipientRuntimeConfiguration.jdp + ${project.basedir}/target/generated-sources/annotations/org/kie/kogito/addons/quarkus/jobs/service/embedded/KogitoAddonsQuarkusJobsServiceEmbeddedRuntimeConfig.jdp + ${project.basedir}/target/generated-sources/annotations/org/kie/kogito/index/addon/config/DataIndexBuildConfig.jdp + ${project.basedir}/target/generated-sources/annotations/org/kie/kogito/index/addon/config/DataIndexRuntimeConfig.jdp + ${project.basedir}/target/generated-sources/annotations/org/kie/kogito/index/addon/config/DataIndexUIClientRuntimeConfig.jdp + ${project.basedir}/target/generated-sources/annotations/org/kie/kogito/runtime/tools/quarkus/extension/runtime/config/DevConsoleRuntimeConfig.jdp + ${project.basedir}/target/generated-sources/annotations/org/kie/kogito/runtime/tools/quarkus/extension/runtime/config/UserConfig.jdp + + + + + + diff --git a/kogito-quarkus-serverless-workflow-devui-parent/kogito-quarkus-serverless-workflow-devui-deployment/pom.xml b/kogito-quarkus-serverless-workflow-devui-parent/kogito-quarkus-serverless-workflow-devui-deployment/pom.xml index de3cd1776b..c17d98976d 100644 --- a/kogito-quarkus-serverless-workflow-devui-parent/kogito-quarkus-serverless-workflow-devui-deployment/pom.xml +++ b/kogito-quarkus-serverless-workflow-devui-parent/kogito-quarkus-serverless-workflow-devui-deployment/pom.xml @@ -25,12 +25,12 @@ org.kie.kogito - kogito-quarkus-serverless-workflow-devui-parent + sonataflow-quarkus-devui-parent 999-SNAPSHOT - kogito-quarkus-serverless-workflow-devui-deployment - Kogito Apps :: Serverless Workflow Quarkus Dev UI Extension :: Deployment + sonataflow-quarkus-devui-deployment + Kogito Apps :: SonataFlow Quarkus Dev UI Extension :: Deployment ../../ui-packages/packages/runtime-tools-dev-ui-webapp @@ -91,7 +91,7 @@ org.kie.kogito - kogito-quarkus-serverless-workflow-devui + sonataflow-quarkus-devui ${project.version} @@ -130,7 +130,7 @@ copy-resources - ${basedir}/target/classes/dev-static/webapp + ${basedir}/target/classes/dev-static/resources/webapp ${path.to.webapp.app}/dist/resources/webapp @@ -143,6 +143,7 @@ + copy-envelope-resources process-resources @@ -150,7 +151,7 @@ copy-resources - ${basedir}/target/classes/dev-static/ + ${basedir}/target/classes/dev-static/resources ${path.to.webapp.app}/dist/resources @@ -175,6 +176,25 @@ + + + copy-index + process-resources + + copy-resources + + + ${basedir}/target/classes/dev-static + + + ${basedir}/target/classes/static + + index.html + + + + + diff --git a/kogito-quarkus-serverless-workflow-devui-parent/kogito-quarkus-serverless-workflow-devui-deployment/src/main/java/org/kie/kogito/swf/tools/deployment/DevConsoleProcessor.java b/kogito-quarkus-serverless-workflow-devui-parent/kogito-quarkus-serverless-workflow-devui-deployment/src/main/java/org/kie/kogito/swf/tools/deployment/DevConsoleProcessor.java index effce8f5a5..1e2dfb81ba 100644 --- a/kogito-quarkus-serverless-workflow-devui-parent/kogito-quarkus-serverless-workflow-devui-deployment/src/main/java/org/kie/kogito/swf/tools/deployment/DevConsoleProcessor.java +++ b/kogito-quarkus-serverless-workflow-devui-parent/kogito-quarkus-serverless-workflow-devui-deployment/src/main/java/org/kie/kogito/swf/tools/deployment/DevConsoleProcessor.java @@ -19,6 +19,8 @@ package org.kie.kogito.swf.tools.deployment; import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; import java.nio.file.Path; import java.util.Optional; @@ -30,22 +32,57 @@ import io.quarkus.deployment.annotations.BuildStep; import io.quarkus.deployment.annotations.ExecutionTime; import io.quarkus.deployment.annotations.Record; +import io.quarkus.deployment.builditem.ConfigurationBuildItem; import io.quarkus.deployment.builditem.LaunchModeBuildItem; import io.quarkus.deployment.builditem.LiveReloadBuildItem; import io.quarkus.deployment.builditem.ShutdownContextBuildItem; import io.quarkus.deployment.pkg.builditem.CurateOutcomeBuildItem; import io.quarkus.deployment.util.WebJarUtil; import io.quarkus.devconsole.spi.DevConsoleTemplateInfoBuildItem; +import io.quarkus.devui.spi.page.CardPageBuildItem; +import io.quarkus.devui.spi.page.Page; import io.quarkus.maven.dependency.ResolvedDependency; +import io.quarkus.vertx.http.deployment.NonApplicationRootPathBuildItem; import io.quarkus.vertx.http.deployment.RouteBuildItem; import io.quarkus.vertx.http.runtime.devmode.DevConsoleRecorder; +import io.quarkus.vertx.http.runtime.management.ManagementInterfaceBuildTimeConfig; public class DevConsoleProcessor { private static final String STATIC_RESOURCES_PATH = "dev-static/"; - private static final String BASE_RELATIVE_URL = "/q/dev-v1/org.kie.kogito.kogito-quarkus-serverless-workflow-devui"; + private static final String BASE_RELATIVE_URL = "/q/dev-v1/org.kie.kogito.sonataflow-quarkus-devui"; private static final String DATA_INDEX_CAPABILITY = "org.kie.kogito.data-index"; + @BuildStep(onlyIf = IsDevelopment.class) + public CardPageBuildItem pages(NonApplicationRootPathBuildItem nonApplicationRootPathBuildItem, + ManagementInterfaceBuildTimeConfig managementInterfaceBuildTimeConfig, + LaunchModeBuildItem launchModeBuildItem, + ConfigurationBuildItem configurationBuildItem) throws UnsupportedEncodingException { + + String uiPath = nonApplicationRootPathBuildItem.resolveManagementPath(BASE_RELATIVE_URL, + managementInterfaceBuildTimeConfig, launchModeBuildItem, true); + + String devUIUrl = getProperty(configurationBuildItem, "kogito.dev-ui.url"); + String devUIUrlQueryParam = devUIUrl != null ? "&devUIUrl=" + URLEncoder.encode(devUIUrl, "UTF-8") : ""; + + String dataIndexUrl = getProperty(configurationBuildItem, "kogito.data-index.url"); + String dataIndexUrlQueryParam = dataIndexUrl != null ? "&dataIndexUrl=" + URLEncoder.encode(dataIndexUrl, "UTF-8") : ""; + + CardPageBuildItem cardPageBuildItem = new CardPageBuildItem(); + + cardPageBuildItem.addPage(Page.externalPageBuilder("Workflows") + .url(uiPath + "/index.html?page=Processes" + devUIUrlQueryParam + dataIndexUrlQueryParam, uiPath) + .isHtmlContent() + .icon("font-awesome-solid:diagram-project")); + + cardPageBuildItem.addPage(Page.externalPageBuilder("Monitoring") + .url(uiPath + "/index.html?page=Monitoring" + devUIUrlQueryParam + dataIndexUrlQueryParam, uiPath) + .isHtmlContent() + .icon("font-awesome-solid:gauge-high")); + + return cardPageBuildItem; + } + @BuildStep(onlyIf = IsDevelopment.class) @Record(ExecutionTime.RUNTIME_INIT) public void deployStaticResources(final DevConsoleRecorder recorder, @@ -56,7 +93,7 @@ public void deployStaticResources(final DevConsoleRecorder recorder, final BuildProducer routeBuildItemBuildProducer) throws IOException { ResolvedDependency devConsoleResourcesArtifact = WebJarUtil.getAppArtifact(curateOutcomeBuildItem, "org.kie.kogito", - "kogito-quarkus-serverless-workflow-devui-deployment"); + "sonataflow-quarkus-devui-deployment"); Path devConsoleStaticResourcesDeploymentPath = WebJarUtil.copyResourcesForDevOrTest( liveReloadBuildItem, @@ -66,12 +103,6 @@ public void deployStaticResources(final DevConsoleRecorder recorder, STATIC_RESOURCES_PATH, true); - routeBuildItemBuildProducer.produce(new RouteBuildItem.Builder() - .route(BASE_RELATIVE_URL + "/resources/*") - .handler(recorder.devConsoleHandler(devConsoleStaticResourcesDeploymentPath.toString(), - shutdownContext)) - .build()); - routeBuildItemBuildProducer.produce(new RouteBuildItem.Builder() .route(BASE_RELATIVE_URL + "/*") .handler(recorder.devConsoleHandler(devConsoleStaticResourcesDeploymentPath.toString(), @@ -87,4 +118,31 @@ public void isDataIndexAvailable(BuildProducer devConsoleTemplateInfoBuildItemBuildProducer.produce(new DevConsoleTemplateInfoBuildItem("isDataIndexAvailable", dataIndexServiceAvailableBuildItem.isPresent() || capabilities.isPresent(DATA_INDEX_CAPABILITY))); } + + private static String getProperty(ConfigurationBuildItem configurationBuildItem, + String propertyKey) { + + String propertyValue = configurationBuildItem + .getReadResult() + .getAllBuildTimeValues() + .get(propertyKey); + + if (propertyValue == null) { + propertyValue = configurationBuildItem + .getReadResult() + .getBuildTimeRunTimeValues() + .get(propertyKey); + } else { + return propertyValue; + } + + if (propertyValue == null) { + propertyValue = configurationBuildItem + .getReadResult() + .getRunTimeDefaultValues() + .get(propertyKey); + } + + return propertyValue; + } } diff --git a/kogito-quarkus-serverless-workflow-devui-parent/kogito-quarkus-serverless-workflow-devui-deployment/src/main/resources/static/index.html b/kogito-quarkus-serverless-workflow-devui-parent/kogito-quarkus-serverless-workflow-devui-deployment/src/main/resources/static/index.html new file mode 100644 index 0000000000..4040f1fbea --- /dev/null +++ b/kogito-quarkus-serverless-workflow-devui-parent/kogito-quarkus-serverless-workflow-devui-deployment/src/main/resources/static/index.html @@ -0,0 +1,48 @@ + +
+ + + diff --git a/kogito-quarkus-serverless-workflow-devui-parent/kogito-quarkus-serverless-workflow-devui/pom.xml b/kogito-quarkus-serverless-workflow-devui-parent/kogito-quarkus-serverless-workflow-devui/pom.xml index 6372f7a801..142211b1e9 100644 --- a/kogito-quarkus-serverless-workflow-devui-parent/kogito-quarkus-serverless-workflow-devui/pom.xml +++ b/kogito-quarkus-serverless-workflow-devui-parent/kogito-quarkus-serverless-workflow-devui/pom.xml @@ -24,11 +24,11 @@ 4.0.0 org.kie.kogito - kogito-quarkus-serverless-workflow-devui-parent + sonataflow-quarkus-devui-parent 999-SNAPSHOT - kogito-quarkus-serverless-workflow-devui - Kogito Apps :: Serverless Workflow Quarkus Dev UI Extension :: Extension + sonataflow-quarkus-devui + Kogito Apps :: SonataFlow Quarkus Dev UI Extension :: Runtime Runtime development tools for Serverless Workflows @@ -133,6 +133,9 @@ ${project.groupId}:${project.artifactId}-deployment:${project.version} + + org.sonataflow.quarkus.dev-ui + diff --git a/kogito-quarkus-serverless-workflow-devui-parent/kogito-quarkus-serverless-workflow-devui/src/main/java/org/kie/kogito/swf/tools/custom/dashboard/impl/CustomDashboardStorageImpl.java b/kogito-quarkus-serverless-workflow-devui-parent/kogito-quarkus-serverless-workflow-devui/src/main/java/org/kie/kogito/swf/tools/custom/dashboard/impl/CustomDashboardStorageImpl.java index 3afdcf16dc..a2a00437c0 100644 --- a/kogito-quarkus-serverless-workflow-devui-parent/kogito-quarkus-serverless-workflow-devui/src/main/java/org/kie/kogito/swf/tools/custom/dashboard/impl/CustomDashboardStorageImpl.java +++ b/kogito-quarkus-serverless-workflow-devui-parent/kogito-quarkus-serverless-workflow-devui/src/main/java/org/kie/kogito/swf/tools/custom/dashboard/impl/CustomDashboardStorageImpl.java @@ -90,6 +90,10 @@ private void start(final URL classLoaderCustomDashboardUrl, final URL customDash } catch (Exception ex) { LOGGER.warn("Couldn't properly initialize CustomDashboardStorageImpl"); } finally { + if (classLoaderCustomDashboardUrl == null) { + return; + } + init(readCustomDashboardResources()); String storageUrl = getStorageUrl(classLoaderCustomDashboardUrl); Thread t = new Thread(new DashboardFilesWatcher(reload(), storageUrl)); diff --git a/kogito-quarkus-serverless-workflow-devui-parent/kogito-quarkus-serverless-workflow-devui/src/main/resources/META-INF/quarkus-extension.yaml b/kogito-quarkus-serverless-workflow-devui-parent/kogito-quarkus-serverless-workflow-devui/src/main/resources/META-INF/quarkus-extension.yaml index 24d5c4be1e..6b857e4b94 100644 --- a/kogito-quarkus-serverless-workflow-devui-parent/kogito-quarkus-serverless-workflow-devui/src/main/resources/META-INF/quarkus-extension.yaml +++ b/kogito-quarkus-serverless-workflow-devui-parent/kogito-quarkus-serverless-workflow-devui/src/main/resources/META-INF/quarkus-extension.yaml @@ -17,11 +17,14 @@ # under the License. # -name: Serverless Workflow Tools + +name: SonataFlow Runtime Tools Quarkus Dev UI +description: Enables the SonataFlow Runtime tools in Quarkus Dev UI metadata: keywords: - "kogito" - "workflows" + - "dev-ui" guide: "https://quarkus.io/guides/kogito" categories: - "business-automation" diff --git a/kogito-quarkus-serverless-workflow-devui-parent/pom.xml b/kogito-quarkus-serverless-workflow-devui-parent/pom.xml index c5491db11a..2d692e34b0 100644 --- a/kogito-quarkus-serverless-workflow-devui-parent/pom.xml +++ b/kogito-quarkus-serverless-workflow-devui-parent/pom.xml @@ -29,8 +29,8 @@ 4.0.0 - Kogito Apps :: Serverless Workflow Quarkus Dev UI Extension - kogito-quarkus-serverless-workflow-devui-parent + Kogito Apps :: SonataFlow Quarkus Dev UI Extension + sonataflow-quarkus-devui-parent pom diff --git a/management-console/pom.xml b/management-console/pom.xml index a01fae0840..58f3238c55 100644 --- a/management-console/pom.xml +++ b/management-console/pom.xml @@ -40,8 +40,8 @@ - org.kie.kogito - kogito-addons-quarkus-process-svg + org.kie + kie-addons-quarkus-process-svg io.quarkus diff --git a/persistence-commons/persistence-commons-infinispan/pom.xml b/persistence-commons/persistence-commons-infinispan/pom.xml index 1f80b3d489..51f921248e 100644 --- a/persistence-commons/persistence-commons-infinispan/pom.xml +++ b/persistence-commons/persistence-commons-infinispan/pom.xml @@ -52,8 +52,8 @@ - org.kie.kogito - kogito-addons-quarkus-persistence-infinispan-health + org.kie + kie-addons-quarkus-persistence-infinispan-health diff --git a/runtime-tools-quarkus-extension-parent/pom.xml b/runtime-tools-quarkus-extension-parent/pom.xml index d3f32eae2a..96b7ee8362 100644 --- a/runtime-tools-quarkus-extension-parent/pom.xml +++ b/runtime-tools-quarkus-extension-parent/pom.xml @@ -29,8 +29,9 @@ 4.0.0 - Runtime Tools Quarkus Extension - Parent - runtime-tools-quarkus-extension-parent + jBPM Quarkus DevUI - Parent + org.jbpm + jbpm-quarkus-devui-parent pom diff --git a/runtime-tools-quarkus-extension-parent/runtime-tools-quarkus-extension-deployment/pom.xml b/runtime-tools-quarkus-extension-parent/runtime-tools-quarkus-extension-deployment/pom.xml index c665aa5f7a..f6937b6ed1 100644 --- a/runtime-tools-quarkus-extension-parent/runtime-tools-quarkus-extension-deployment/pom.xml +++ b/runtime-tools-quarkus-extension-parent/runtime-tools-quarkus-extension-deployment/pom.xml @@ -24,13 +24,13 @@ 4.0.0 - org.kie.kogito - runtime-tools-quarkus-extension-parent + org.jbpm + jbpm-quarkus-devui-parent 999-SNAPSHOT - runtime-tools-quarkus-extension-deployment - Runtime Tools Quarkus Extension - Deployment + jbpm-quarkus-devui-deployment + jBPM Quarkus DevUI - Deployment ../../ui-packages/packages/runtime-tools-dev-ui-webapp @@ -90,8 +90,8 @@ test - org.kie.kogito - runtime-tools-quarkus-extension + org.jbpm + jbpm-quarkus-devui ${project.version} diff --git a/runtime-tools-quarkus-extension-parent/runtime-tools-quarkus-extension-deployment/src/main/java/org/kie/kogito/runtime/tools/quarkus/extension/deployment/DevConsoleProcessor.java b/runtime-tools-quarkus-extension-parent/runtime-tools-quarkus-extension-deployment/src/main/java/org/kie/kogito/runtime/tools/quarkus/extension/deployment/DevConsoleProcessor.java index a5337babd5..16ae6b4200 100644 --- a/runtime-tools-quarkus-extension-parent/runtime-tools-quarkus-extension-deployment/src/main/java/org/kie/kogito/runtime/tools/quarkus/extension/deployment/DevConsoleProcessor.java +++ b/runtime-tools-quarkus-extension-parent/runtime-tools-quarkus-extension-deployment/src/main/java/org/kie/kogito/runtime/tools/quarkus/extension/deployment/DevConsoleProcessor.java @@ -46,7 +46,7 @@ public class DevConsoleProcessor { private static final String STATIC_RESOURCES_PATH = "dev-static/"; - private static final String BASE_RELATIVE_URL = "/q/dev-v1/org.kie.kogito.runtime-tools-quarkus-extension"; + private static final String BASE_RELATIVE_URL = "/q/dev-v1/org.jbpm.jbpm-quarkus-devui"; private static final String DATA_INDEX_CAPABILITY = "org.kie.kogito.data-index"; @SuppressWarnings("unused") @@ -66,8 +66,8 @@ public void deployStaticResources(final DevConsoleRecorder recorder, final ShutdownContextBuildItem shutdownContext, final BuildProducer routeBuildItemBuildProducer) throws IOException { ResolvedDependency devConsoleResourcesArtifact = WebJarUtil.getAppArtifact(curateOutcomeBuildItem, - "org.kie.kogito", - "runtime-tools-quarkus-extension-deployment"); + "org.jbpm", + "jbpm-quarkus-devui-deployment"); Path devConsoleStaticResourcesDeploymentPath = WebJarUtil.copyResourcesForDevOrTest( liveReloadBuildItem, diff --git a/runtime-tools-quarkus-extension-parent/runtime-tools-quarkus-extension/pom.xml b/runtime-tools-quarkus-extension-parent/runtime-tools-quarkus-extension/pom.xml index 100acdd4ac..56f7285b25 100644 --- a/runtime-tools-quarkus-extension-parent/runtime-tools-quarkus-extension/pom.xml +++ b/runtime-tools-quarkus-extension-parent/runtime-tools-quarkus-extension/pom.xml @@ -23,13 +23,13 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 4.0.0 - org.kie.kogito - runtime-tools-quarkus-extension-parent + org.jbpm + jbpm-quarkus-devui-parent 999-SNAPSHOT - runtime-tools-quarkus-extension - Runtime Tools Quarkus Extension - Runtime - Runtime development tools for Kogito projects + jbpm-quarkus-devui + jBPM Quarkus DevUI - Runtime + Runtime development tools for jBPM projects @@ -128,6 +128,9 @@ ${project.groupId}:${project.artifactId}-deployment:${project.version} + + org.jbpm.quarkus.dev-ui + diff --git a/runtime-tools-quarkus-extension-parent/runtime-tools-quarkus-extension/src/main/resources/META-INF/quarkus-extension.yaml b/runtime-tools-quarkus-extension-parent/runtime-tools-quarkus-extension/src/main/resources/META-INF/quarkus-extension.yaml index e7c3116378..1e6efa0ff5 100644 --- a/runtime-tools-quarkus-extension-parent/runtime-tools-quarkus-extension/src/main/resources/META-INF/quarkus-extension.yaml +++ b/runtime-tools-quarkus-extension-parent/runtime-tools-quarkus-extension/src/main/resources/META-INF/quarkus-extension.yaml @@ -17,16 +17,24 @@ # under the License. # -name: Kogito Runtime Tools +name: jBPM Runtime Tools Quarkus Dev UI +description: Enables the jBPM Runtime tools in Quarkus Dev UI metadata: keywords: - "kogito" - "drools" - "jbpm" - "processes" + - "tasks" - "rules" - "decisions" + - "BPMN" + - "DMN" + - "DRL" + - "dev-ui" guide: "https://quarkus.io/guides/kogito" categories: - "business-automation" - status: "preview" \ No newline at end of file + status: "preview" + config: + - "kogito." \ No newline at end of file diff --git a/ui-packages/packages/consoles-common/package.json b/ui-packages/packages/consoles-common/package.json index 56ef5aeb3c..6e3f70bdc9 100644 --- a/ui-packages/packages/consoles-common/package.json +++ b/ui-packages/packages/consoles-common/package.json @@ -37,7 +37,7 @@ "gql-query-builder": "3.1.3", "graphql-tag": "2.0.0", "history": "^4.10.1", - "keycloak-js": "^13.0.1", + "keycloak-js": "^23.0.5", "react": "^17.0.2", "react-dom": "^17.0.2", "react-router": "^5.3.4", diff --git a/ui-packages/packages/consoles-common/src/utils/KeycloakClient.ts b/ui-packages/packages/consoles-common/src/utils/KeycloakClient.ts index d97dd1d27f..0924b8a0f9 100644 --- a/ui-packages/packages/consoles-common/src/utils/KeycloakClient.ts +++ b/ui-packages/packages/consoles-common/src/utils/KeycloakClient.ts @@ -73,8 +73,8 @@ export const checkAuthServerHealth = () => { }); }; -export const getKeycloakClient = (): Keycloak.KeycloakInstance => { - return Keycloak({ +export const getKeycloakClient = (): Keycloak => { + return new Keycloak({ realm: window['KOGITO_CONSOLES_KEYCLOAK_REALM'], url: window['KOGITO_CONSOLES_KEYCLOAK_URL'], clientId: window['KOGITO_CONSOLES_KEYCLOAK_CLIENT_ID'] diff --git a/ui-packages/packages/runtime-tools-dev-ui-webapp/package.json b/ui-packages/packages/runtime-tools-dev-ui-webapp/package.json index 3151e8ed15..a3d380faf6 100644 --- a/ui-packages/packages/runtime-tools-dev-ui-webapp/package.json +++ b/ui-packages/packages/runtime-tools-dev-ui-webapp/package.json @@ -127,7 +127,7 @@ "mini-css-extract-plugin": "^2.7.6", "node-polyfill-webpack-plugin": "^2.0.1", "nodemon": "^2.0.22", - "openapi-types": "^9.3.1", + "openapi-types": "^7.0.1", "raw-loader": "^4.0.2", "rimraf": "^3.0.2", "sass-loader": "^12.6.0", diff --git a/ui-packages/packages/runtime-tools-dev-ui-webapp/src/channel/apis/apis.tsx b/ui-packages/packages/runtime-tools-dev-ui-webapp/src/channel/apis/apis.tsx index f142094cec..b7faaa24e0 100755 --- a/ui-packages/packages/runtime-tools-dev-ui-webapp/src/channel/apis/apis.tsx +++ b/ui-packages/packages/runtime-tools-dev-ui-webapp/src/channel/apis/apis.tsx @@ -16,6 +16,8 @@ * specific language governing permissions and limitations * under the License. */ + +import { OpenAPI } from 'openapi-types'; import { GraphQL } from '@kogito-apps/consoles-common/dist/graphql'; import { BulkProcessInstanceActionResponse, @@ -542,38 +544,50 @@ export const getCustomDashboardContent = (name: string): Promise => { }); }; -export const getCustomWorkflowSchema = ( +export const getCustomWorkflowSchemaFromApi = async ( + api: OpenAPI.Document, + workflowName: string +): Promise> => { + let schema = {}; + + try { + const schemaFromRequestBody = + api.paths['/' + workflowName].post.requestBody.content['application/json'] + .schema; + + if (schemaFromRequestBody.type) { + schema = { + type: schemaFromRequestBody.type, + properties: schemaFromRequestBody.properties + }; + } else { + schema = (api as any).components.schemas[workflowName + '_input']; + } + } catch (e) { + console.log(e); + schema = (api as any).components.schemas[workflowName + '_input']; + } + + // Components can contain the content of internal refs ($ref) + // This keeps the refs working while avoiding circular refs with the workflow itself + if (schema) { + const { [workflowName + '_input']: _, ...schemas } = + (api as any).components?.schemas ?? {}; + (schema as any)['components'] = { schemas }; + } + + return schema ?? null; +}; + +export const getCustomWorkflowSchema = async ( devUIUrl: string, openApiPath: string, workflowName: string ): Promise> => { return new Promise((resolve, reject) => { SwaggerParser.parse(`${devUIUrl}/${openApiPath}`) - .then((response: any) => { - let schema = {}; - try { - const schemaFromRequestBody = - response.paths['/' + workflowName].post.requestBody.content[ - 'application/json' - ].schema; - /* istanbul ignore else*/ - if (schemaFromRequestBody.type) { - schema = { - type: schemaFromRequestBody.type, - properties: schemaFromRequestBody.properties - }; - } else { - schema = response.components.schemas[workflowName + '_input']; - } - } catch (e) { - console.log(e); - schema = response.components.schemas[workflowName + '_input']; - } - if (schema) { - resolve(schema); - } else { - resolve(null); - } + .then(async (response: any) => { + resolve(await getCustomWorkflowSchemaFromApi(response, workflowName)); }) .catch((err) => reject(err)); }); diff --git a/ui-packages/packages/runtime-tools-dev-ui-webapp/src/channel/apis/tests/apis.test.tsx b/ui-packages/packages/runtime-tools-dev-ui-webapp/src/channel/apis/tests/apis.test.tsx index 143939d6e4..b5ae6846aa 100755 --- a/ui-packages/packages/runtime-tools-dev-ui-webapp/src/channel/apis/tests/apis.test.tsx +++ b/ui-packages/packages/runtime-tools-dev-ui-webapp/src/channel/apis/tests/apis.test.tsx @@ -1108,6 +1108,9 @@ describe('swf custom form tests', () => { it('get custom workflow schema - success - with workflowdata', async () => { const schema = { + components: { + schemas: {} + }, type: 'object', properties: { name: { diff --git a/ui-packages/pnpm-lock.yaml b/ui-packages/pnpm-lock.yaml index 91905da312..9460833c32 100644 --- a/ui-packages/pnpm-lock.yaml +++ b/ui-packages/pnpm-lock.yaml @@ -286,8 +286,8 @@ importers: specifier: ^4.10.1 version: 4.10.1 keycloak-js: - specifier: ^13.0.1 - version: 13.0.1 + specifier: ^23.0.5 + version: 23.0.5 react: specifier: ^17.0.2 version: 17.0.2 @@ -1859,7 +1859,7 @@ importers: dependencies: '@apidevtools/swagger-parser': specifier: ^10.1.0 - version: 10.1.0(openapi-types@9.3.1) + version: 10.1.0(openapi-types@7.2.3) '@babel/standalone': specifier: ^7.22.8 version: 7.22.8 @@ -2138,8 +2138,8 @@ importers: specifier: ^2.0.22 version: 2.0.22 openapi-types: - specifier: ^9.3.1 - version: 9.3.1 + specifier: ^7.0.1 + version: 7.2.3 raw-loader: specifier: ^4.0.2 version: 4.0.2(webpack@5.88.1) @@ -3144,7 +3144,7 @@ packages: resolution: {integrity: sha512-QAkD5kK2b1WfjDS/UQn/qQkbwF31uqRjPTrsCs5ZG9BQGAkjwvqGFjjPqAuzac/IYzpPtRzjCP1WrTuAIjMrXg==} dev: false - /@apidevtools/swagger-parser@10.1.0(openapi-types@9.3.1): + /@apidevtools/swagger-parser@10.1.0(openapi-types@7.2.3): resolution: {integrity: sha512-9Kt7EuS/7WbMAUv2gSziqjvxwDbFSg3Xeyfuj5laUODX8o/k/CpsAKiQ8W7/R88eXFTMbJYg6+7uAmOWNKmwnw==} peerDependencies: openapi-types: '>=7' @@ -3156,7 +3156,7 @@ packages: ajv: 8.12.0 ajv-draft-04: 1.0.0(ajv@8.12.0) call-me-maybe: 1.0.2 - openapi-types: 9.3.1 + openapi-types: 7.2.3 dev: false /@apollo/protobufjs@1.2.2: @@ -8495,13 +8495,8 @@ packages: resolution: {integrity: sha512-pNdYkNPiJUnEhnfXV56+sQy8+AaPcG3POZAUnwr4EeqCUZFz4u2PePbo3e5Gj4ziYPCWGUZT9RHisvJKnwFuBQ==} dev: false - /base64-js@1.3.1: - resolution: {integrity: sha512-mLQ4i2QO1ytvGWFWmcngKO//JXAQueZvwEKtjgQFM4jIK0kU+ytMfplL8j+n5mspOfjHwoAg+9yhb7BwAHm36g==} - dev: false - /base64-js@1.5.1: resolution: {integrity: sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==} - dev: true /base@0.11.2: resolution: {integrity: sha512-5T6P4xPgpp0YDFvSWwEZ4NoE3aM4QBQXDzmVbraCkFj8zHM+mba8SyqB5DbZWyR7mYHo6Y7BdQo3MoA4m0TeQg==} @@ -13535,8 +13530,8 @@ packages: resolution: {integrity: sha512-j8GhLiKmUAh+dsFXlX1aJCbt5KMibuKb+d7j1JaOJG6s2UjX1PQlW+OKB/sD4a/5ZYF4RcmYmLSndOoU3Lt/3g==} dev: true - /js-sha256@0.9.0: - resolution: {integrity: sha512-sga3MHh9sgQN2+pJ9VYZ+1LPwXOxuBJBA5nrR5/ofPfuiJBE2hnjsaN8se8JznOmGLN2p49Pe5U/ttafcs/apA==} + /js-sha256@0.10.1: + resolution: {integrity: sha512-5obBtsz9301ULlsgggLg542s/jqtddfOpV5KJc4hajc9JV8GeY2gZHSVpYBn4nWqAUTJ9v+xwtbJ1mIBgIH5Vw==} dev: false /js-tokens@4.0.0: @@ -13753,11 +13748,17 @@ packages: resolution: {integrity: sha512-g3UB796vUFIY90VIv/WX3L2c8CS2MdWUww3CNrYmqza1Fg0DURc2K/O4YrnklBdQarSJ/y8JnJYDGc+1iumQjg==} dev: false - /keycloak-js@13.0.1: - resolution: {integrity: sha512-S9mFX8HHlgw+i2HAIhteccrkffQmUn4CpYcU8ViGnODSBcnaf2YTtLhiiRH/a6SaOBpxmJTN3XVIZbE9d/HyXQ==} + /jwt-decode@4.0.0: + resolution: {integrity: sha512-+KJGIyHgkGuIq3IEBNftfhW/LfWhXUIY6OmyVWjliu5KH1y0fw7VQ8YndE2O4qZdMSd9SqbnC8GOcZEy0Om7sA==} + engines: {node: '>=18'} + dev: false + + /keycloak-js@23.0.5: + resolution: {integrity: sha512-etSFCG/sh1rBV8RJRgKsuVBJwtzeZaO5eI8B3ZIhxGwQLo9bObZHYDgthvMik35sYIbepV1LU9N0pZ+3sxai3w==} dependencies: - base64-js: 1.3.1 - js-sha256: 0.9.0 + base64-js: 1.5.1 + js-sha256: 0.10.1 + jwt-decode: 4.0.0 dev: false /keyv@3.1.0: @@ -14865,10 +14866,6 @@ packages: /openapi-types@7.2.3: resolution: {integrity: sha512-olbaNxz12R27+mTyJ/ZAFEfUruauHH27AkeQHDHRq5AF0LdNkK1SSV7EourXQDK+4aX7dv2HtyirAGK06WMAsA==} - dev: false - - /openapi-types@9.3.1: - resolution: {integrity: sha512-/Yvsd2D7miYB4HLJ3hOOS0+vnowQpaT75FsHzr/y5M9P4q9bwa7RcbW2YdH6KZBn8ceLbKGnHxMZ1CHliGHUFw==} /optimism@0.10.3: resolution: {integrity: sha512-9A5pqGoQk49H6Vhjb9kPgAeeECfUDF6aIICbMDL23kDLStBn1MWk3YvcZ4xWF9CsSf6XEgvRLkXy4xof/56vVw==}