Skip to content

Commit

Permalink
chore(merge): release-10.2.0 into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
bonita-ci committed Oct 1, 2024
2 parents 2da3c75 + 85a6a5b commit 146bcda
Show file tree
Hide file tree
Showing 26 changed files with 395 additions and 127 deletions.
7 changes: 6 additions & 1 deletion bonita-integration-tests/bonita-query-tests/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@

plugins { id 'bonita-docker-database' }

dependencies {
testAnnotationProcessor(libs.lombok)
testImplementation(libs.lombok)
testImplementation "junit:junit:${Deps.junit4Version}"
testImplementation "org.assertj:assertj-core:${Deps.assertjVersion}"
testImplementation libs.h2
Expand All @@ -13,4 +15,7 @@ dependencies {
testImplementation project(":bpm:bonita-server")
testImplementation project(":bpm:bonita-common")

testRuntimeOnly libs.tomcatDbcp
}

databaseIntegrationTest { include "**/*Test.class" }
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

import javax.inject.Inject;

import org.bonitasoft.engine.test.persistence.jdbc.JdbcRowMapper;
import org.bonitasoft.engine.test.persistence.repository.ContractDataRepository;
import org.junit.Test;
import org.junit.runner.RunWith;
Expand Down Expand Up @@ -52,20 +53,20 @@ public void should_be_able_to_add_contract_data() {
repository.flush();

List<Map<String, Object>> contractData = jdbcTemplate
.queryForList("SELECT kind, name, scopeId, val from contract_data");
.query("SELECT KIND, NAME, SCOPEID, VAL from contract_data", new JdbcRowMapper("SCOPEID"));

assertThat(contractData).hasSize(2);
assertThat(contractData).anySatisfy(c -> {
assertThat(c.get("kind")).isEqualTo("PROCESS");
assertThat(c.get("name")).isEqualTo("myProcessContractData");
assertThat(c.get("scopeId")).isEqualTo(123L);
assertThat(c.get("val")).isEqualTo("<string>SerializedValue</string>");
assertThat(c.get("KIND")).isEqualTo("PROCESS");
assertThat(c.get("NAME")).isEqualTo("myProcessContractData");
assertThat(c.get("SCOPEID")).isEqualTo(123L);
assertThat(c.get("VAL")).isEqualTo("<string>SerializedValue</string>");
});
assertThat(contractData).anySatisfy(c -> {
assertThat(c.get("kind")).isEqualTo("TASK");
assertThat(c.get("name")).isEqualTo("myTaskContractData");
assertThat(c.get("scopeId")).isEqualTo(124L);
assertThat(c.get("val")).isEqualTo("<string>SerializedValue</string>");
assertThat(c.get("KIND")).isEqualTo("TASK");
assertThat(c.get("NAME")).isEqualTo("myTaskContractData");
assertThat(c.get("SCOPEID")).isEqualTo(124L);
assertThat(c.get("VAL")).isEqualTo("<string>SerializedValue</string>");
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import javax.inject.Inject;

import org.bonitasoft.engine.page.SPageMapping;
import org.bonitasoft.engine.test.persistence.jdbc.JdbcRowMapper;
import org.bonitasoft.engine.test.persistence.repository.TestRepository;
import org.junit.Test;
import org.junit.runner.RunWith;
Expand Down Expand Up @@ -52,24 +53,26 @@ public void should_be_able_to_add_form_mapping() {

testRepository.flush();

List<Map<String, Object>> formMapping = jdbcTemplate.queryForList("SELECT * from form_mapping");
List<Map<String, Object>> formMapping = jdbcTemplate.query("SELECT * from form_mapping",
new JdbcRowMapper("PAGE_MAPPING_ID", "LASTUPDATEDATE", "LASTUPDATEDBY", "PROCESS"));

assertThat(formMapping).hasSize(2);

assertThat(formMapping).anySatisfy(c -> {
assertThat(c.get("task")).isEqualTo("task1");
assertThat(c.get("type")).isEqualTo(3);
assertThat(c.get("page_mapping_id")).isEqualTo(1L);
assertThat(c.get("lastupdatedate")).isEqualTo(200L);
assertThat(c.get("lastupdatedby")).isEqualTo(100L);
assertThat(c.get("process")).isEqualTo(2L);
assertThat(c.get("target")).isEqualTo("target1");
assertThat(c.get("TASK")).isEqualTo("task1");
assertThat(c.get("TYPE")).isEqualTo(3);
assertThat(c.get("PAGE_MAPPING_ID")).isEqualTo(1L);
assertThat(c.get("LASTUPDATEDATE")).isEqualTo(200L);
assertThat(c.get("LASTUPDATEDBY")).isEqualTo(100L);
assertThat(c.get("PROCESS")).isEqualTo(2L);
assertThat(c.get("TARGET")).isEqualTo("target1");
});
assertThat(formMapping).anySatisfy(c -> {
assertThat(c.get("task")).isEqualTo("task2");
assertThat(c.get("page_mapping_id")).isEqualTo(1L);
assertThat(c.get("type")).isEqualTo(4);
assertThat(c.get("process")).isEqualTo(3L);
assertThat(c.get("target")).isEqualTo("target2");
assertThat(c.get("TASK")).isEqualTo("task2");
assertThat(c.get("PAGE_MAPPING_ID")).isEqualTo(1L);
assertThat(c.get("TYPE")).isEqualTo(4);
assertThat(c.get("PROCESS")).isEqualTo(3L);
assertThat(c.get("TARGET")).isEqualTo("target2");
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public void should_save_and_get_SAUserTaskInstance_with_task_priority() {
.queryForMap("SELECT * FROM arch_flownode_instance where id = " + flowNode.getId());

assertThat(flowNodeFromQuery).isEqualTo(flowNode);
assertThat(flowNodeAsMap.get("PRIORITY")).isEqualTo(3);
assertThat(((Number) flowNodeAsMap.get("PRIORITY")).intValue()).isEqualTo(3);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import org.bonitasoft.engine.core.process.instance.model.archive.business.data.SAProcessMultiRefBusinessDataInstance;
import org.bonitasoft.engine.core.process.instance.model.archive.business.data.SAProcessSimpleRefBusinessDataInstance;
import org.bonitasoft.engine.persistence.PersistentObject;
import org.bonitasoft.engine.test.persistence.jdbc.JdbcRowMapper;
import org.bonitasoft.engine.test.persistence.repository.ProcessInstanceRepository;
import org.junit.Test;
import org.junit.runner.RunWith;
Expand Down Expand Up @@ -84,7 +85,7 @@ public void getArchivedProcessInstancesInAllStates_should_return_empty_list_when
}

@Test
public void should_save_and_get_multi_business_data_reference_for_process() {
public void should_save_and_get_multi_business_data_reference_for_archived_process() {
SAProcessMultiRefBusinessDataInstance multiRefBusinessDataInstance = new SAProcessMultiRefBusinessDataInstance();
multiRefBusinessDataInstance.setDataIds(Arrays.asList(23L, 25L, 27L));
multiRefBusinessDataInstance.setProcessInstanceId(PROCESS_INSTANCE_ID);
Expand All @@ -96,12 +97,14 @@ public void should_save_and_get_multi_business_data_reference_for_process() {
PersistentObject multiRefBusinessData = repository.selectOne("getSARefBusinessDataInstance",
pair("processInstanceId", PROCESS_INSTANCE_ID), pair("name", "myMultiProcData"));
Map<String, Object> multiRefBusinessDataAsMap = jdbcTemplate
.queryForMap(
.queryForObject(
"SELECT ID, KIND, NAME, DATA_CLASSNAME, DATA_ID, ORIG_PROC_INST_ID, ORIG_FN_INST_ID FROM arch_ref_biz_data_inst WHERE orig_proc_inst_id="
+ PROCESS_INSTANCE_ID + " AND name='myMultiProcData'");
+ PROCESS_INSTANCE_ID + " AND name='myMultiProcData'",
new JdbcRowMapper("ID", "DATA_ID", "ORIG_PROC_INST_ID", "ORIG_FN_INST_ID"));
List<Map<String, Object>> dataIds = jdbcTemplate
.queryForList("SELECT ID, IDX, DATA_ID FROM arch_multi_biz_data WHERE id="
+ multiRefBusinessDataInstance.getId());
.query("SELECT ID, IDX, DATA_ID FROM arch_multi_biz_data WHERE id="
+ multiRefBusinessDataInstance.getId(),
new JdbcRowMapper("ID", "IDX", "DATA_ID"));

assertThat(((SAProcessMultiRefBusinessDataInstance) multiRefBusinessData).getDataIds())
.isEqualTo(Arrays.asList(23L, 25L, 27L));
Expand All @@ -115,13 +118,13 @@ public void should_save_and_get_multi_business_data_reference_for_process() {
entry("ORIG_PROC_INST_ID", PROCESS_INSTANCE_ID),
entry("ORIG_FN_INST_ID", null));
assertThat(dataIds).containsExactly(
mapOf(pair("ID", multiRefBusinessDataInstance.getId()), pair("IDX", 0), pair("DATA_ID", 23L)),
mapOf(pair("ID", multiRefBusinessDataInstance.getId()), pair("IDX", 1), pair("DATA_ID", 25L)),
mapOf(pair("ID", multiRefBusinessDataInstance.getId()), pair("IDX", 2), pair("DATA_ID", 27L)));
mapOf(pair("ID", multiRefBusinessDataInstance.getId()), pair("IDX", 0L), pair("DATA_ID", 23L)),
mapOf(pair("ID", multiRefBusinessDataInstance.getId()), pair("IDX", 1L), pair("DATA_ID", 25L)),
mapOf(pair("ID", multiRefBusinessDataInstance.getId()), pair("IDX", 2L), pair("DATA_ID", 27L)));
}

@Test
public void should_save_and_get_single_business_data_reference_for_process() {
public void should_save_and_get_single_business_data_reference_for_archived_process() {
SAProcessSimpleRefBusinessDataInstance singleRef = new SAProcessSimpleRefBusinessDataInstance();
singleRef.setDataId(43L);
singleRef.setProcessInstanceId(PROCESS_INSTANCE_ID);
Expand All @@ -133,10 +136,11 @@ public void should_save_and_get_single_business_data_reference_for_process() {
PersistentObject singleRefFromQuery = repository.selectOne("getSARefBusinessDataInstance",
pair("processInstanceId", PROCESS_INSTANCE_ID), pair("name", "mySingleData"));
Map<String, Object> multiRefBusinessDataAsMap = jdbcTemplate
.queryForMap(
.queryForObject(
"SELECT ID, KIND, NAME, DATA_CLASSNAME, DATA_ID, ORIG_PROC_INST_ID, ORIG_FN_INST_ID FROM arch_ref_biz_data_inst WHERE orig_proc_inst_id="
+ PROCESS_INSTANCE_ID
+ " AND name='mySingleData'");
+ " AND name='mySingleData'",
new JdbcRowMapper("ID", "DATA_ID", "ORIG_PROC_INST_ID", "ORIG_FN_INST_ID"));
assertThat(singleRefFromQuery).isEqualTo(singleRef);
assertThat(multiRefBusinessDataAsMap).containsOnly(
entry("ID", singleRef.getId()),
Expand All @@ -149,7 +153,7 @@ public void should_save_and_get_single_business_data_reference_for_process() {
}

@Test
public void should_save_and_get_single_business_data_reference_for_flow_node() {
public void should_save_and_get_single_business_data_reference_for_flow_node_of_archived_process() {
SAFlowNodeSimpleRefBusinessDataInstance singleRef = new SAFlowNodeSimpleRefBusinessDataInstance();
singleRef.setDataId(43L);
singleRef.setFlowNodeInstanceId(FLOW_NODE_INSTANCE_ID);
Expand All @@ -161,10 +165,11 @@ public void should_save_and_get_single_business_data_reference_for_flow_node() {
PersistentObject singleRefFromQuery = repository.selectOne("getSAFlowNodeRefBusinessDataInstance",
pair("flowNodeInstanceId", FLOW_NODE_INSTANCE_ID), pair("name", "mySingleData"));
Map<String, Object> multiRefBusinessDataAsMap = jdbcTemplate
.queryForMap(
.queryForObject(
"SELECT ID, KIND, NAME, DATA_CLASSNAME, DATA_ID, ORIG_PROC_INST_ID, ORIG_FN_INST_ID FROM arch_ref_biz_data_inst WHERE orig_fn_inst_id="
+ FLOW_NODE_INSTANCE_ID
+ " AND name='mySingleData'");
+ " AND name='mySingleData'",
new JdbcRowMapper("ID", "DATA_ID", "ORIG_PROC_INST_ID", "ORIG_FN_INST_ID"));
assertThat(singleRefFromQuery).isEqualTo(singleRef);
assertThat(multiRefBusinessDataAsMap).containsOnly(
entry("ID", singleRef.getId()),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import org.bonitasoft.engine.core.process.comment.model.SSystemComment;
import org.bonitasoft.engine.core.process.comment.model.archive.SAComment;
import org.bonitasoft.engine.persistence.PersistentObject;
import org.bonitasoft.engine.test.persistence.jdbc.JdbcRowMapper;
import org.bonitasoft.engine.test.persistence.repository.CommentRepository;
import org.junit.Test;
import org.junit.runner.RunWith;
Expand Down Expand Up @@ -62,7 +63,7 @@ public void should_getComments_of_process_instance() {
repository.add(new SHumanComment(PROCESS2_ID, "comment5", JACK_ID));

assertThat(repository.getCommentsOfProcessInstance(PROCESS1_ID)).extracting("content", "userId", "class")
.containsExactly(
.containsExactlyInAnyOrder(
tuple("comment1", JACK_ID, SHumanComment.class),
tuple("comment2", JOHN_ID, SHumanComment.class),
tuple("comment3", JACK_ID, SHumanComment.class),
Expand All @@ -77,13 +78,15 @@ public void should_save_and_get_SComment() {
repository.flush();

Map<String, Object> comment1AsMap = jdbcTemplate
.queryForMap(
.queryForObject(
"SELECT ID, KIND, CONTENT, POSTDATE, PROCESSINSTANCEID, USERID FROM process_comment WHERE processInstanceId = "
+ PROCESS1_ID);
+ PROCESS1_ID,
new JdbcRowMapper("ID", "POSTDATE", "PROCESSINSTANCEID", "USERID"));
Map<String, Object> comment2AsMap = jdbcTemplate
.queryForMap(
.queryForObject(
"SELECT ID, KIND, CONTENT, POSTDATE, PROCESSINSTANCEID, USERID FROM process_comment WHERE processInstanceId = "
+ PROCESS2_ID);
+ PROCESS2_ID,
new JdbcRowMapper("ID", "POSTDATE", "PROCESSINSTANCEID", "USERID"));

assertThat(comment1AsMap).containsOnly(
entry("ID", comment1.getId()),
Expand Down Expand Up @@ -112,13 +115,17 @@ public void should_save_and_get_SAComment() {
PersistentObject comment2FromQuery = repository.selectOne("getArchivedCommentById",
pair("id", comment2.getId()));
Map<String, Object> comment1AsMap = jdbcTemplate
.queryForMap(
.queryForObject(
"SELECT ID, SOURCEOBJECTID, ARCHIVEDATE, CONTENT, POSTDATE, PROCESSINSTANCEID, USERID FROM arch_process_comment WHERE processInstanceId = "
+ PROCESS1_ID);
+ PROCESS1_ID,
new JdbcRowMapper("ID", "SOURCEOBJECTID", "ARCHIVEDATE", "POSTDATE", "PROCESSINSTANCEID",
"USERID"));
Map<String, Object> comment2AsMap = jdbcTemplate
.queryForMap(
.queryForObject(
"SELECT ID, SOURCEOBJECTID, ARCHIVEDATE, CONTENT, POSTDATE, PROCESSINSTANCEID, USERID FROM arch_process_comment WHERE processInstanceId = "
+ PROCESS2_ID);
+ PROCESS2_ID,
new JdbcRowMapper("ID", "SOURCEOBJECTID", "ARCHIVEDATE", "POSTDATE", "PROCESSINSTANCEID",
"USERID"));

assertThat(comment1FromQuery).isEqualTo(comment1);
assertThat(comment2FromQuery).isEqualTo(comment2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,21 +72,20 @@ public void setUp() {
containerType = "Pouet";
containerId = 1L;
long differentContainerId = 5L;
long tenantId = 100L;
expectedConnector1 = aConnectorInstance().setContainerId(containerId).setContainerType(containerType)
.setActivationEvent(ON_FINISH)
.withFailureInfo(false).setState(ConnectorState.EXECUTING.toString()).build();
expectedConnector2 = aConnectorInstance().setContainerId(containerId).setContainerType(containerType)
.setActivationEvent(ON_ENTER)
.setState(ConnectorState.EXECUTING.toString()).withFailureInfo(false)
.setState(ConnectorState.EXECUTING.toString()).withFailureInfo(false).setExecutionOrder(1)
.build();
expectedConnector3 = aConnectorInstance().setContainerId(containerId).setContainerType(containerType)
.setActivationEvent(ON_ENTER)
.setState(ConnectorState.DONE.toString()).withFailureInfo(false)
.build();
expectedConnector4 = aConnectorInstance().setContainerId(containerId).setContainerType(containerType)
.setActivationEvent(ON_ENTER)
.setState(ConnectorState.TO_BE_EXECUTED.toString()).withFailureInfo(false)
.setState(ConnectorState.TO_BE_EXECUTED.toString()).withFailureInfo(false).setExecutionOrder(2)
.build();
expectedConnector5 = aConnectorInstance().setContainerId(containerId).setContainerType(containerType)
.setActivationEvent(ON_ENTER)
Expand Down Expand Up @@ -143,10 +142,10 @@ public void getNumberOfConnectorInstances() {

@Test
public void getNextExecutableConnectorInstance() {
SConnectorInstance connectors = repository
SConnectorInstance connector = repository
.getNextExecutableConnectorInstance(containerId, containerType, ON_ENTER);

assertThat(connectors).isSameAs(expectedConnector2);
assertThat(connector).isSameAs(expectedConnector2);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import org.bonitasoft.engine.core.process.definition.model.SProcessDefinitionDesignContent;
import org.bonitasoft.engine.persistence.PersistentObject;
import org.bonitasoft.engine.supervisor.mapping.model.SProcessSupervisor;
import org.bonitasoft.engine.test.persistence.jdbc.JdbcRowMapper;
import org.bonitasoft.engine.test.persistence.repository.ProcessDeploymentInfoRepository;
import org.junit.Before;
import org.junit.Test;
Expand Down Expand Up @@ -884,12 +885,15 @@ public void should_reference_design_content_using_id() {
.designContent(content).build());
repository.flush();

Map<String, Object> processDefinitionMap = jdbcTemplate.queryForMap(
"SELECT name, CONTENT_ID FROM process_definition WHERE processId=123456");
Map<String, Object> processContentMap = jdbcTemplate.queryForMap("SELECT ID FROM process_content ");
Map<String, Object> processDefinitionMap = jdbcTemplate.queryForObject(
"SELECT name, CONTENT_ID FROM process_definition WHERE processId=123456",
new JdbcRowMapper("CONTENT_ID"));
Map<String, Object> processContentMap = jdbcTemplate.queryForObject("SELECT ID FROM process_content",
new JdbcRowMapper("ID"));

assertThat(processDefinitionMap.get("name")).isEqualTo("MyProcessWithContent");
assertThat(processDefinitionMap.get("NAME")).isEqualTo("MyProcessWithContent");
assertThat(processDefinitionMap.get("CONTENT_ID")).isEqualTo(content.getId());
assertThat(processContentMap.get("ID")).isEqualTo(content.getId());
}

}
Loading

0 comments on commit 146bcda

Please sign in to comment.