Skip to content

Commit

Permalink
Merge pull request #4 from rgdoliveira/sync_main
Browse files Browse the repository at this point in the history
Sync main branch with Apache main branch
  • Loading branch information
rgdoliveira authored Jan 25, 2024
2 parents b5545a4 + 7244568 commit 1b6689a
Show file tree
Hide file tree
Showing 37 changed files with 265 additions and 310 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ public RequestSpecification dataIndexSpec() {
return spec;
}

protected ValidatableResponse addCheck(ValidatableResponse res) {
return res.body("data.ProcessDefinitions[0].source", notNullValue());
}

@Test
public void testProcessInstanceEvents() throws IOException {
String pId = given()
Expand Down Expand Up @@ -163,14 +167,14 @@ public void testProcessInstanceEvents() throws IOException {

await()
.atMost(TIMEOUT)
.untilAsserted(() -> given().spec(dataIndexSpec()).contentType(ContentType.JSON)
.body("{ \"query\" : \"{ProcessDefinitions{ id, version, name } }\" }")
.untilAsserted(() -> addCheck(given().spec(dataIndexSpec()).contentType(ContentType.JSON)
.body("{ \"query\" : \"{ProcessDefinitions{ id, version, name, source} }\" }")
.when().post("/graphql")
.then().statusCode(200)
.body("data.ProcessDefinitions.size()", is(1))
.body("data.ProcessDefinitions[0].id", is("approvals"))
.body("data.ProcessDefinitions[0].version", is("1.0"))
.body("data.ProcessDefinitions[0].name", is("approvals")));
.body("data.ProcessDefinitions[0].name", is("approvals"))));

await()
.atMost(TIMEOUT)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = { KogitoApplication.class })
@ContextConfiguration(initializers = { KogitoServiceRandomPortSpringTestResource.class, DataIndexInfinispanSpringTestResource.class })
@DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_CLASS)
public class ProcessDataIndexInfinispanIT extends AbstractProcessDataIndexIT {
public class ProcessDataIndexInfinispanIT extends SpringBootAbstractProcessInstanceIT {

@LocalServerPort
private int httpPort;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = { KogitoApplication.class })
@ContextConfiguration(initializers = { KogitoServiceRandomPortSpringTestResource.class, DataIndexMongoDBSpringTestResource.class })
@DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_CLASS)
public class ProcessDataIndexMongoDBIT extends AbstractProcessDataIndexIT {
public class ProcessDataIndexMongoDBIT extends SpringBootAbstractProcessInstanceIT {

@LocalServerPort
private int httpPort;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
@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 AbstractProcessDataIndexIT {
public class ProcessDataIndexOracleIT extends SpringBootAbstractProcessInstanceIT {

@LocalServerPort
private int httpPort;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = { KogitoApplication.class })
@ContextConfiguration(initializers = { KogitoServiceRandomPortSpringTestResource.class, DataIndexPostgreSqlSpringTestResource.class })
@DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_CLASS)
public class ProcessDataIndexPostgreSqlIT extends AbstractProcessDataIndexIT {
public class ProcessDataIndexPostgreSqlIT extends SpringBootAbstractProcessInstanceIT {

@LocalServerPort
private int httpPort;
Expand Down
Original file line number Diff line number Diff line change
@@ -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;

import io.restassured.response.ValidatableResponse;

abstract class SpringBootAbstractProcessInstanceIT extends AbstractProcessDataIndexIT {

@Override
protected ValidatableResponse addCheck(ValidatableResponse res) {
// disable source check for Springboot since it is not implemented yet
return res;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -35,24 +35,11 @@

<modules>
<module>integration-tests-data-index-service-quarkus-devservice</module>
<module>integration-tests-data-index-service-common</module>
<module>integration-tests-data-index-service-quarkus</module>
<module>integration-tests-data-index-service-springboot</module>
</modules>

<profiles>
<profile>
<id>default</id>
<activation>
<property>
<name>!productized</name>
</property>
</activation>
<modules>
<module>integration-tests-data-index-service-common</module>
<module>integration-tests-data-index-service-quarkus</module>
<module>integration-tests-data-index-service-springboot</module>
</modules>
</profile>
</profiles>

<dependencyManagement>
<dependencies>
<dependency>
Expand Down
19 changes: 3 additions & 16 deletions apps-integration-tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,22 +36,9 @@

<modules>
<module>integration-tests-data-index-service</module>
<module>integration-tests-jobs-service</module>
<module>integration-tests-trusty-audit</module>
<module>integration-tests-trusty-service</module>
</modules>

<profiles>
<profile>
<id>default</id>
<activation>
<property>
<name>!productized</name>
</property>
</activation>
<modules>
<module>integration-tests-jobs-service</module>
<module>integration-tests-trusty-audit</module>
<module>integration-tests-trusty-service</module>
</modules>
</profile>
</profiles>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ public static ProcessDefinition merge(ProcessDefinition instance, ProcessDefinit
instance.setAnnotations(doMerge(data.getAnnotations(), instance.getAnnotations()));
instance.setMetadata(doMerge(toStringMap(data.getMetadata()), instance.getMetadata()));
instance.setNodes(doMerge(nodeDefinitions(data), instance.getNodes()));
instance.setSource(doMerge(data.getSource(), instance.getSource()));
return instance;
}

Expand Down
16 changes: 3 additions & 13 deletions data-index/data-index-service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,22 +35,12 @@
<module>data-index-service-common</module>
<module>data-index-service-inmemory</module>
<module>data-index-service-postgresql</module>
<module>data-index-service-infinispan</module>
<module>data-index-service-mongodb</module>
<module>data-index-service-oracle</module>
</modules>

<profiles>
<profile>
<id>default</id>
<activation>
<property>
<name>!productized</name>
</property>
</activation>
<modules>
<module>data-index-service-infinispan</module>
<module>data-index-service-mongodb</module>
<module>data-index-service-oracle</module>
</modules>
</profile>
<profile>
<id>native</id>
<activation>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*/
package org.kie.kogito.index.storage.merger;

import java.time.ZonedDateTime;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
Expand Down Expand Up @@ -62,18 +63,18 @@ public ProcessInstance merge(ProcessInstance pi, ProcessInstanceDataEvent<?> dat
nodeInstance.setNodeId(body.getNodeDefinitionId());
nodeInstance.setName(body.getNodeName());
nodeInstance.setType(body.getNodeType());
ZonedDateTime eventDate = toZonedDateTime(body.getEventDate());
switch (body.getEventType()) {
case EVENT_TYPE_ENTER:
nodeInstance.setEnter(toZonedDateTime(body.getEventDate()));
nodeInstance.setEnter(eventDate);
break;
case EVENT_TYPE_EXIT:
nodeInstance.setExit(toZonedDateTime(body.getEventDate()));

nodeInstance.setExit(eventDate);
default:
if (nodeInstance.getEnter() == null) {
// Adding a default enter time for exit events triggered by EventNodeInstances
nodeInstance.setEnter(nodeInstance.getExit());
nodeInstance.setEnter(eventDate);
}
break;
}
nodeInstances.add(nodeInstance);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*/
package org.kie.kogito.index.jpa.storage;

import java.time.ZonedDateTime;
import java.util.ArrayList;
import java.util.Set;

Expand Down Expand Up @@ -155,18 +156,19 @@ private NodeInstanceEntity updateNode(NodeInstanceEntity nodeInstance, ProcessIn
nodeInstance.setNodeId(body.getNodeDefinitionId());
nodeInstance.setName(body.getNodeName());
nodeInstance.setType(body.getNodeType());
ZonedDateTime eventDate = toZonedDateTime(body.getEventDate());
switch (body.getEventType()) {

case EVENT_TYPE_ENTER:
nodeInstance.setEnter(toZonedDateTime(body.getEventDate()));
nodeInstance.setEnter(eventDate);
break;
case EVENT_TYPE_EXIT:
nodeInstance.setExit(toZonedDateTime(body.getEventDate()));

nodeInstance.setExit(eventDate);
default:
if (nodeInstance.getEnter() == null) {
// Adding a default enter time for exit events triggered by EventNodeInstances
nodeInstance.setEnter(nodeInstance.getExit());
nodeInstance.setEnter(eventDate);
}
break;
}
return nodeInstance;
}
Expand Down
23 changes: 5 additions & 18 deletions data-index/data-index-storage/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,23 +37,10 @@
<module>data-index-storage-protobuf</module>
<module>data-index-storage-postgresql</module>
<module>data-index-storage-jpa</module>
<module>data-index-storage-common</module>
<module>data-index-storage-infinispan</module>
<module>data-index-storage-mongodb</module>
<module>data-index-storage-postgresql-reporting</module>
<module>data-index-storage-oracle</module>
</modules>

<profiles>
<profile>
<id>default</id>
<activation>
<property>
<name>!productized</name>
</property>
</activation>
<modules>
<module>data-index-storage-common</module>
<module>data-index-storage-infinispan</module>
<module>data-index-storage-mongodb</module>
<module>data-index-storage-postgresql-reporting</module>
<module>data-index-storage-oracle</module>
</modules>
</profile>
</profiles>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@

import org.eclipse.microprofile.context.ManagedExecutor;
import org.kie.kogito.Application;
import org.kie.kogito.addon.source.files.SourceFilesProvider;
import org.kie.kogito.index.api.KogitoRuntimeClient;
import org.kie.kogito.index.api.KogitoRuntimeCommonClient;
import org.kie.kogito.index.model.Node;
Expand All @@ -42,6 +41,7 @@
import org.kie.kogito.process.Processes;
import org.kie.kogito.process.impl.AbstractProcess;
import org.kie.kogito.services.uow.UnitOfWorkExecutor;
import org.kie.kogito.source.files.SourceFilesProvider;
import org.kie.kogito.svg.ProcessSvgService;

import jakarta.enterprise.context.ApplicationScoped;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.kie.kogito.Application;
import org.kie.kogito.addon.source.files.SourceFilesProvider;
import org.kie.kogito.index.api.KogitoRuntimeCommonClient;
import org.kie.kogito.index.model.Job;
import org.kie.kogito.index.model.ProcessInstance;
Expand All @@ -37,6 +36,7 @@
import org.kie.kogito.process.impl.AbstractProcess;
import org.kie.kogito.services.uow.CollectingUnitOfWorkFactory;
import org.kie.kogito.services.uow.DefaultUnitOfWorkManager;
import org.kie.kogito.source.files.SourceFilesProvider;
import org.kie.kogito.svg.ProcessSvgService;
import org.mockito.ArgumentCaptor;
import org.mockito.Mock;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,20 +40,7 @@
<module>deployment</module>
<module>runtime</module>
<module>integration-tests-sw</module>
<module>integration-tests-process</module>
</modules>

<profiles>
<profile>
<id>default</id>
<activation>
<property>
<name>!productized</name>
</property>
</activation>
<modules>
<module>integration-tests-process</module>
</modules>
</profile>
</profiles>

</project>
17 changes: 2 additions & 15 deletions data-index/kogito-addons-quarkus-data-index-persistence/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,8 @@
<modules>
<module>kogito-addons-quarkus-data-index-persistence-common</module>
<module>kogito-addons-quarkus-data-index-persistence-postgresql</module>
<module>kogito-addons-quarkus-data-index-persistence-infinispan</module>
<module>kogito-addons-quarkus-data-index-persistence-mongodb</module>
</modules>

<profiles>
<profile>
<id>default</id>
<activation>
<property>
<name>!productized</name>
</property>
</activation>
<modules>
<module>kogito-addons-quarkus-data-index-persistence-infinispan</module>
<module>kogito-addons-quarkus-data-index-persistence-mongodb</module>
</modules>
</profile>
</profiles>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -40,20 +40,7 @@
<module>deployment</module>
<module>runtime</module>
<module>integration-tests-sw</module>
<module>integration-tests-process</module>
</modules>

<profiles>
<profile>
<id>default</id>
<activation>
<property>
<name>!productized</name>
</property>
</activation>
<modules>
<module>integration-tests-process</module>
</modules>
</profile>
</profiles>

</project>
Loading

0 comments on commit 1b6689a

Please sign in to comment.