Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync main branch with Apache main branch #40

Merged
merged 4 commits into from
Oct 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import java.util.Map;
import java.util.concurrent.atomic.AtomicReference;

import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.testcontainers.shaded.com.fasterxml.jackson.databind.JsonNode;
import org.testcontainers.shaded.com.fasterxml.jackson.databind.ObjectMapper;
Expand Down Expand Up @@ -91,6 +92,7 @@ protected ValidatableResponse addCheck(ValidatableResponse res) {
}

@Test
@Disabled
public void testProcessInstanceEvents() throws IOException {
String pId = given()
.contentType(ContentType.JSON)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ public JobServiceContainer() {
waitingFor(Wait.forHttp("/q/health/live").forStatusCode(200)).withStartupTimeout(Constants.CONTAINER_START_TIMEOUT);
addEnv("QUARKUS_HTTP_PORT", Integer.toString(PORT));
addEnv("QUARKUS_LOG_CATEGORY__ORG_KIE_KOGITO_JOBS_SERVICE__LEVEL", "DEBUG");
addEnv("QUARKUS_FLYWAY_MIGRATE_AT_START", "true");
addEnv("QUARKUS_FLYWAY_BASELINE_ON_MIGRATE", "true");
addEnv("QUARKUS_FLYWAY_CLEAN_AT_START", "false");
withAccessToHost(true);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ public void init(JobServiceTestResource annotation) {
if (annotation.dataIndexEnabled()) {
DataIndexPostgreSqlContainer container = new DataIndexPostgreSqlContainer();
container.addProtoFileFolder();
container.migrateDB();
container.addEnv("QUARKUS_PROFILE", "kafka-events-support");
KogitoPostgreSqlContainer postgresql = new KogitoPostgreSqlContainer();
resource.withServiceContainer("data-index", container, postgresql);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#
# 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.
#

module.name=data-audit

module.locations.h2=classpath:kie-flyway/db/data-audit/h2
module.locations.postgresql=classpath:kie-flyway/db/data-audit/postgresql
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ create sequence TASK_INSTANCE_STATE_LOG_ID_SEQ start with 1 increment by 50;
create sequence TASK_INSTANCE_VARIABLE_LOG_ID_SEQ start with 1 increment by 50;
create table Job_Execution_Log (id bigint not null, event_date timestamp(6), execution_counter integer, expiration_time timestamp(6), job_id varchar(255), node_instance_id varchar(255), priority integer, process_instance_id varchar(255), repeat_interval bigint, repeat_limit integer, retries integer, scheduled_id varchar(255), status varchar(255), primary key (id));
create table Process_Instance_Error_Log (id bigint not null, business_key varchar(255), event_date timestamp(6), event_id varchar(255), parent_process_instance_id varchar(255), process_id varchar(255), process_instance_id varchar(255), process_type varchar(255), process_version varchar(255), root_process_id varchar(255), root_process_instance_id varchar(255), error_message varchar(255), node_definition_id varchar(255), node_instance_id varchar(255), primary key (id));
create table Process_Instance_Node_Log (id bigint not null, business_key varchar(255), event_date timestamp(6), event_id varchar(255), parent_process_instance_id varchar(255), process_id varchar(255), process_instance_id varchar(255), process_type varchar(255), process_version varchar(255), root_process_id varchar(255), root_process_instance_id varchar(255), connection varchar(255), event_data varchar(255), event_type varchar(255) check (event_type in ('ENTER','EXIT','ABORTED','ASYNC_ENTER','OBSOLETE','SKIPPED','ERROR','SLA_VIOLATION')), node_definition_id varchar(255), node_instance_id varchar(255), node_name varchar(255), node_type varchar(255), sla_due_date timestamp(6), work_item_id varchar(255), primary key (id));
create table Process_Instance_State_Log (id bigint not null, business_key varchar(255), event_date timestamp(6), event_id varchar(255), parent_process_instance_id varchar(255), process_id varchar(255), process_instance_id varchar(255), process_type varchar(255), process_version varchar(255), root_process_id varchar(255), root_process_instance_id varchar(255), event_type varchar(255) not null check (event_type in ('ACTIVE','STARTED','COMPLETED','ABORTED','SLA_VIOLATION','PENDING','SUSPENDING','ERROR')), outcome varchar(255), sla_due_date timestamp(6), state varchar(255), primary key (id));
create table Process_Instance_Node_Log (id bigint not null, business_key varchar(255), event_date timestamp(6), event_id varchar(255), parent_process_instance_id varchar(255), process_id varchar(255), process_instance_id varchar(255), process_type varchar(255), process_version varchar(255), root_process_id varchar(255), root_process_instance_id varchar(255), connection varchar(255), event_data varchar(255), event_type varchar(255), node_definition_id varchar(255), node_instance_id varchar(255), node_name varchar(255), node_type varchar(255), sla_due_date timestamp(6), work_item_id varchar(255), primary key (id));
create table Process_Instance_State_Log (id bigint not null, business_key varchar(255), event_date timestamp(6), event_id varchar(255), parent_process_instance_id varchar(255), process_id varchar(255), process_instance_id varchar(255), process_type varchar(255), process_version varchar(255), root_process_id varchar(255), root_process_instance_id varchar(255), event_type varchar(255) not null, outcome varchar(255), sla_due_date timestamp(6), state varchar(255), primary key (id));
create table Process_Instance_State_Roles_Log (process_instance_state_log_id bigint not null, role varchar(255));
create table Process_Instance_Variable_Log (id bigint not null, business_key varchar(255), event_date timestamp(6), event_id varchar(255), parent_process_instance_id varchar(255), process_id varchar(255), process_instance_id varchar(255), process_type varchar(255), process_version varchar(255), root_process_id varchar(255), root_process_instance_id varchar(255), variable_id varchar(255), variable_name varchar(255), variable_value varchar(255), primary key (id));
create table Task_Instance_Assignment_Log (id bigint not null, business_key varchar(255), event_date timestamp(6), event_id varchar(255), event_user varchar(255), process_instance_id varchar(255), user_task_definition_id varchar(255), user_task_instance_id varchar(255), assignment_type varchar(255), task_name varchar(255), primary key (id));
Expand All @@ -40,7 +40,7 @@ create table Task_Instance_Attachment_Log (id bigint not null, business_key varc
create table Task_Instance_Comment_Log (id bigint not null, business_key varchar(255), event_date timestamp(6), event_id varchar(255), event_user varchar(255), process_instance_id varchar(255), user_task_definition_id varchar(255), user_task_instance_id varchar(255), comment_content varchar(255), comment_id varchar(255), event_type integer, primary key (id));
create table Task_Instance_Deadline_Log (id bigint not null, business_key varchar(255), event_date timestamp(6), event_id varchar(255), event_user varchar(255), process_instance_id varchar(255), user_task_definition_id varchar(255), user_task_instance_id varchar(255), event_type varchar(255), primary key (id));
create table Task_Instance_State_Log (id bigint not null, business_key varchar(255), event_date timestamp(6), event_id varchar(255), event_user varchar(255), process_instance_id varchar(255), user_task_definition_id varchar(255), user_task_instance_id varchar(255), actual_user varchar(255), description varchar(255), event_type varchar(255), name varchar(255), state varchar(255), primary key (id));
create table Task_Instance_Variable_Log (id bigint not null, business_key varchar(255), event_date timestamp(6), event_id varchar(255), event_user varchar(255), process_instance_id varchar(255), user_task_definition_id varchar(255), user_task_instance_id varchar(255), variable_id varchar(255), variable_name varchar(255), variable_type varchar(255) check (variable_type in ('INPUT','OUTPUT')), variable_value varchar(255), primary key (id));
create table Task_Instance_Variable_Log (id bigint not null, business_key varchar(255), event_date timestamp(6), event_id varchar(255), event_user varchar(255), process_instance_id varchar(255), user_task_definition_id varchar(255), user_task_instance_id varchar(255), variable_id varchar(255), variable_name varchar(255), variable_type varchar(255), variable_value varchar(255), primary key (id));
create table Task_Instance_Deadline_Notification_Log (task_instance_deadline_log_id bigint not null, property_value varchar(255), property_name varchar(255) not null, primary key (task_instance_deadline_log_id, property_name));
create index ix_jel_pid on Job_Execution_Log (process_instance_id);
create index ix_jel_jid on Job_Execution_Log (job_id);
Expand Down Expand Up @@ -84,6 +84,9 @@ create index ix_tavl_utid on Task_Instance_Variable_Log (user_task_instance_id);
create index ix_tavl_pid on Task_Instance_Variable_Log (process_instance_id);
create index ix_tavl_key on Task_Instance_Variable_Log (business_key);
create index ix_tavl_event_date on Task_Instance_Variable_Log (event_date);
alter table if exists Process_Instance_Node_Log add constraint Process_Instance_Node_Log_event_type_check check (event_type in ('ENTER','EXIT','ABORTED','ASYNC_ENTER','OBSOLETE','SKIPPED','ERROR','SLA_VIOLATION'));
alter table if exists Process_Instance_State_Log add constraint Process_Instance_State_Log_event_type_check check (event_type in ('ACTIVE','STARTED','COMPLETED','ABORTED','SLA_VIOLATION','PENDING','SUSPENDING','ERROR'));
alter table if exists Task_Instance_Variable_Log add constraint Task_Instance_Variable_Log_variable_type_check check (variable_type in ('INPUT','OUTPUT'));
alter table if exists Process_Instance_State_Roles_Log add constraint fk_process_instance_state_pid foreign key (process_instance_state_log_id) references Process_Instance_State_Log;
alter table if exists Task_Instance_Assignment_Users_Log add constraint fk_task_instance_assignment_log_tid foreign key (task_instance_assignment_log_id) references Task_Instance_Assignment_Log;
alter table if exists Task_Instance_Deadline_Notification_Log add constraint fk_task_instance_deadline_tid foreign key (task_instance_deadline_log_id) references Task_Instance_Deadline_Log;
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@
<groupId>org.kie.kogito</groupId>
<artifactId>jobs-service-api</artifactId>
</dependency>
<dependency>
<groupId>org.kie</groupId>
<artifactId>kie-addons-quarkus-flyway</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
Expand Down
4 changes: 4 additions & 0 deletions data-audit/kogito-addons-data-audit-quarkus/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@
<groupId>org.kie.kogito</groupId>
<artifactId>jobs-service-api</artifactId>
</dependency>
<dependency>
<groupId>org.kie</groupId>
<artifactId>kie-addons-quarkus-flyway</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ quarkus.datasource.jdbc.url=jdbc:h2:mem:test

quarkus.hibernate-orm.database.generation=create-drop


kie.flyway.enabled=true

4 changes: 4 additions & 0 deletions data-audit/kogito-addons-data-audit-springboot/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@
<groupId>org.kie.kogito</groupId>
<artifactId>kogito-events-core</artifactId>
</dependency>
<dependency>
<groupId>org.kie</groupId>
<artifactId>kie-addons-springboot-flyway</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ spring.datasource.driver-class-name=org.h2.Driver

spring.jpa.database=H2
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.H2Dialect
spring.jpa.properties.hibernate.hbm2ddl.auto=create-drop
kie.flyway.enabled=true
spring.flyway.enabled=false


4 changes: 2 additions & 2 deletions data-index/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ The same dependency is used to specify the storage of the data index and the tra

<dependency>
<groupId>org.kie</groupId>
<artifactId>kogito-addons-quarkus-data-index-persistence-postgresql</artifactId>
<artifactId>kogito-addons-quarkus-data-index-postgresql</artifactId>
</dependency>


Expand All @@ -54,7 +54,7 @@ As this dependency will include the storage as well and the in-vm transport.

<dependency>
<groupId>org.kie</groupId>
<artifactId>kogito-addons-quarkus-data-index-persistence-<storage></artifactId>
<artifactId>kogito-addons-quarkus-data-index-<storage></artifactId>
</dependency>


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@
<groupId>org.kie.kogito</groupId>
<artifactId>data-index-storage-postgresql</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-flyway</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-container-image-jib</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ kogito.data-index.blocking=true
#PostgreSql
quarkus.datasource.db-kind=postgresql

#Flyway - It's safe to enable Flyway by default for in-memory storage
quarkus.flyway.migrate-at-start=true
quarkus.flyway.baseline-on-migrate=true
quarkus.flyway.locations=classpath:kie-flyway/db/data-index/postgresql

#Hibernate
quarkus.hibernate-orm.jdbc.timezone=UTC
quarkus.hibernate-orm.database.generation=update
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ kogito.data-index.blocking=true
#Kafka
quarkus.kafka.health.enabled=true

#Flyway
quarkus.flyway.baseline-on-migrate=true

#PostgreSQL
quarkus.datasource.db-kind=postgresql

Expand All @@ -39,3 +36,6 @@ 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

# Flyway Locations
quarkus.flyway.locations=classpath:kie-flyway/db/data-index/postgresql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/src/main/resources/kie-flyway/db/data-index/postgresql/*
34 changes: 34 additions & 0 deletions data-index/data-index-storage/data-index-storage-jpa/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@
<name>Kogito Apps :: Data Index Storage JPA compatible DBs</name>

<properties>
<path.to.postgresql.storage>../data-index-storage-postgresql</path.to.postgresql.storage>
<path.to.script.folder>src/main/resources/kie-flyway/db/</path.to.script.folder>
<path.to.migration.scripts.from>${path.to.postgresql.storage}/${path.to.script.folder}/data-index/postgresql</path.to.migration.scripts.from>
<path.to.migration.scripts.to>${path.to.script.folder}/data-index/postgresql</path.to.migration.scripts.to>
<java.module.name>org.kie.kogito.index.jpa</java.module.name>
</properties>

Expand Down Expand Up @@ -89,6 +93,11 @@
<artifactId>kogito-quarkus-test-utils</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.kie</groupId>
<artifactId>kie-addons-quarkus-flyway</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
Expand All @@ -110,6 +119,31 @@
</execution>
</executions>
</plugin>
<!-- The cleanest way would be to use the maven-dependency-plugin to unpack and copy scripts from the built artifact `kie-addons-persistence-jdbc` but there's a limitation to using this only in the `package` phase whereas we need that into the `generate-sources` phase. See also https://issues.apache.org/jira/browse/MDEP-98 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<id>copy-resource-one</id>
<phase>generate-sources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${path.to.migration.scripts.to}</outputDirectory>
<resources>
<resource>
<directory>${path.to.migration.scripts.from}</directory>
<includes>
<include>*.sql</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#
# 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.
#

module.name=data-index

module.locations.postgresql=classpath:kie-flyway/db/data-index/postgresql,classpath:kie-flyway/db/persistence-common/postgresql
module.locations.default=classpath:kie-flyway/db/data-index/ansi,classpath:kie-flyway/db/persistence-common/ansi
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@

# Kogito
kogito.apps.persistence.type=jdbc
kie.flyway.enabled=true

# Data source
quarkus.datasource.db-kind=h2
quarkus.datasource.jdbc.url=jdbc:h2:tcp://localhost/mem:test;NON_KEYWORDS=VALUE,KEY
# Hibernate
quarkus.hibernate-orm.database.generation=create
quarkus.hibernate-orm.database.generation.halt-on-error=true
quarkus.hibernate-orm.physical-naming-strategy=org.hibernate.boot.model.naming.CamelCaseToUnderscoresNamingStrategy
quarkus.hibernate-orm.jdbc.timezone=UTC
quarkus.hibernate-orm.log.sql=true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@
<artifactId>kogito-quarkus-test-utils</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.kie</groupId>
<artifactId>kie-addons-quarkus-flyway</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@
<artifactId>kogito-quarkus-test-utils</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.kie</groupId>
<artifactId>kie-addons-quarkus-flyway</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#
# 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.
#

module.name=data-index

module.locations.postgresql=classpath:kie-flyway/db/data-index/postgresql,classpath:kie-flyway/db/persistence-common/postgresql
Loading
Loading