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

[kie-issues-249] Data Index Events changes for allowing historical data #1881

Merged
merged 5 commits into from
Oct 18, 2023
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
2 changes: 2 additions & 0 deletions .ci/jenkins/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ pipeline {
timestamps()
timeout(time: 480, unit: 'MINUTES')
disableConcurrentBuilds(abortPrevious: true)
skipDefaultCheckout()
}
environment {
BUILDCHAIN_PROJECT = 'apache/incubator-kie-kogito-apps'
Expand All @@ -20,6 +21,7 @@ pipeline {
stages {
stage('Initialize') {
steps {
cleanWs()
script {
// load `pr_check.groovy` file from kogito-pipelines:main
dir('kogito-pipelines') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@ public void testProcessInstanceEvents() throws IOException {

public void testProcessGatewayAPI() throws IOException {
String pId2 = createTestProcessInstance();

await()
.atMost(TIMEOUT)
.untilAsserted(() -> getProcessInstanceById(pId2, "ACTIVE"));
Expand Down Expand Up @@ -474,6 +475,18 @@ public void testProcessGatewayAPIComments(String taskId, String processInstanceI
.body("$.size()", is(1))
.body("[0].content", is(commentContent)));

await()
.atMost(TIMEOUT)
.untilAsserted(() -> given().spec(dataIndexSpec()).contentType(ContentType.JSON)
.body("{ \"query\" : \"{ UserTaskInstances (where: { processInstanceId: {equal: \\\"" + processInstanceId + "\\\"}}) { " +
"id description priority potentialGroups comments {id content updatedBy updatedAt} } }\"}")
.when().post("/graphql")
.then()
.statusCode(200)
.body("data.UserTaskInstances[0].comments", notNullValue())
.body("data.UserTaskInstances[0].comments.size()", is(1))
.extract().jsonPath().getMap("data.UserTaskInstances[0].comments[0]"));

Map<String, String> commentMap = given().spec(dataIndexSpec()).contentType(ContentType.JSON)
.body("{ \"query\" : \"{ UserTaskInstances (where: { processInstanceId: {equal: \\\"" + processInstanceId + "\\\"}}) { " +
"id description priority potentialGroups comments {id content updatedBy updatedAt} } }\"}")
Expand All @@ -485,6 +498,7 @@ public void testProcessGatewayAPIComments(String taskId, String processInstanceI
.body("data.UserTaskInstances[0].potentialGroups[0]", equalTo("managers"))
.body("data.UserTaskInstances[0].comments.size()", is(1))
.extract().jsonPath().getMap("data.UserTaskInstances[0].comments[0]");

checkExpectedCreatedItemData(commentCreationResult, commentMap);
String commentNewContent = "commentNewContent";
String commentUpdateResult = given().spec(dataIndexSpec()).contentType(ContentType.JSON)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,4 @@ mp.messaging.outgoing.kogito-usertaskinstances-events.connector=smallrye-kafka
mp.messaging.outgoing.kogito-usertaskinstances-events.topic=kogito-usertaskinstances-events
mp.messaging.outgoing.kogito-usertaskinstances-events.value.serializer=org.apache.kafka.common.serialization.StringSerializer
mp.messaging.outgoing.kogito-usertaskinstances-events.group.id=kogito-data-index-it
mp.messaging.outgoing.kogito-usertaskinstances-events.auto.offset.reset=earliest

mp.messaging.outgoing.kogito-variables-events.connector=smallrye-kafka
mp.messaging.outgoing.kogito-variables-events.topic=kogito-variables-events
mp.messaging.outgoing.kogito-variables-events.value.serializer=org.apache.kafka.common.serialization.StringSerializer
mp.messaging.outgoing.kogito-variables-events.group.id=kogito-data-index-it
mp.messaging.outgoing.kogito-variables-events.auto.offset.reset=earliest
mp.messaging.outgoing.kogito-usertaskinstances-events.auto.offset.reset=earliest
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ protected Map<String, String> getProperties() {
properties.put(KOGITO_SERVICE_URL, "http://host.testcontainers.internal:" + getTestResource().getMappedPort());
properties.put("mp.messaging.outgoing.kogito-processinstances-events.connector", "smallrye-kafka");
properties.put("mp.messaging.outgoing.kogito-usertaskinstances-events.connector", "smallrye-kafka");
properties.put("mp.messaging.outgoing.kogito-variables-events.connector", "smallrye-kafka");

return properties;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,5 @@ mp.messaging.outgoing.kogito-usertaskinstances-events.connector=smallrye-kafka
mp.messaging.outgoing.kogito-usertaskinstances-events.topic=kogito-usertaskinstances-events
mp.messaging.outgoing.kogito-usertaskinstances-events.value.serializer=org.apache.kafka.common.serialization.StringSerializer

mp.messaging.outgoing.kogito-variables-events.connector=smallrye-kafka
mp.messaging.outgoing.kogito-variables-events.topic=kogito-variables-events
mp.messaging.outgoing.kogito-variables-events.value.serializer=org.apache.kafka.common.serialization.StringSerializer

quarkus.http.auth.permission.source-files-addon.paths=/management/*
quarkus.http.auth.permission.source-files-addon.policy=permit

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* 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.event.mapper;

import javax.enterprise.context.ApplicationScoped;

import org.kie.kogito.event.process.ProcessInstanceDataEvent;
import org.kie.kogito.event.process.ProcessInstanceErrorDataEvent;
import org.kie.kogito.index.model.ProcessInstance;
import org.kie.kogito.index.model.ProcessInstanceError;

@ApplicationScoped
public class ProcessInstanceErrorDataEventMerger implements ProcessInstanceEventMerger {

@Override
public boolean accept(ProcessInstanceDataEvent<?> event) {
return event instanceof ProcessInstanceErrorDataEvent;
}

@Override
public void merge(ProcessInstance pi, ProcessInstanceDataEvent<?> data) {
ProcessInstanceErrorDataEvent event = (ProcessInstanceErrorDataEvent) data;
ProcessInstanceError error = new ProcessInstanceError();
error.setMessage(event.getData().getErrorMessage());
error.setNodeDefinitionId(event.getData().getNodeDefinitionId());
pi.setError(error);
}

}
Original file line number Diff line number Diff line change
@@ -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.event.mapper;

import org.kie.kogito.event.process.ProcessInstanceDataEvent;
import org.kie.kogito.index.model.ProcessInstance;

public interface ProcessInstanceEventMerger {

boolean accept(ProcessInstanceDataEvent<?> event);

void merge(ProcessInstance pi, ProcessInstanceDataEvent<?> event);

}
Loading
Loading