Skip to content

Commit

Permalink
Merge branch 'dev' into merge/release-10.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
rbioteau authored Oct 4, 2024
2 parents fba5361 + 7224698 commit b3f1c93
Show file tree
Hide file tree
Showing 103 changed files with 374 additions and 270 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public void should_configure_database_using_properties() {
assertThat(businessDataDatabaseConfiguration.getXaDatasource().getMaxPoolSize()).isEqualTo(6);
assertThat(
businessDataDatabaseConfiguration.getDbVendor())
.isEqualTo("mysql");
.isEqualTo("mysql");
});
}

Expand Down
9 changes: 8 additions & 1 deletion bonita-engine/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,14 @@ dependencyManagement {
entry 'httpmime'
}
dependency libs.xstream.get() as String
dependency libs.tomcatDbcp.get() as String
dependencySet(group: 'org.apache.tomcat', version: libs.versions.tomcatVersion.get()) {
entry 'tomcat-dbcp'
entry 'tomcat'
entry 'tomcat-catalina'
}
dependencySet(group: 'org.apache.tomcat.embed', version: libs.versions.tomcatVersion.get()) {
entry 'tomcat-embed-core'
}
dependency libs.narayanaJta.get() as String
dependency libs.jakartaActivation.get() as String
dependency(libs.quartz.get() as String)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -447,13 +447,14 @@ public void use_a_multiple_complex_input_in_user_tasks() throws Exception {
waitForUserTaskAndGetIt(TASK2);
assertThat((List<Map<String, Object>>) getProcessAPI()
.getArchivedActivityDataInstance("expenseData", userTask.getId()).getValue()).as(
"should have my expense report data").hasSize(3);
"should have my expense report data")
.hasSize(3);
final Serializable reportData = getProcessAPI().getArchivedActivityDataInstance("reportData", userTask.getId())
.getValue();
assertThat(reportData).as("should have single file").isEqualTo(reportFile);
assertThat((List<Object>) getProcessAPI().getArchivedActivityDataInstance("receiptsData", userTask.getId())
.getValue()).as("should have multiple file")
.containsExactly(receipt1, receipt2);
.containsExactly(receipt1, receipt2);
final List<Document> receiptsAsDoc = getProcessAPI().getDocumentList(processInstance.getId(), "receiptsAsDoc",
0, 100);
final Document reportAsDoc = getProcessAPI().getLastDocument(processInstance.getId(), "reportAsDoc");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ public void should_access_identity_api_using_default_application_permissions() t
long userId = user.getId();
assertThat(
getPermissionAPI().isAuthorized(new APICallContext("GET", "identity", "user", String.valueOf(userId))))
.isTrue();
.isTrue();
assertThat(getPermissionAPI()
.isAuthorized(new APICallContext("GET", "identity", "user", String.valueOf(userId + 1)))).isFalse();
assertThat(getPermissionAPI().isAuthorized(new APICallContext("GET", "identity", "user", null))).isFalse();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ public void deploying_bdm_with_invalid_query_should_throw_a_BDM_deployment_excep
getTenantAdministrationAPI().cleanAndUninstallBusinessDataModel();
assertThatThrownBy(
() -> getTenantAdministrationAPI().updateBusinessDataModel(getZip(buildBOMWithInvalidQuery())))
.isInstanceOf(BusinessDataRepositoryDeploymentException.class);
.isInstanceOf(BusinessDataRepositoryDeploymentException.class);
}

@Test
Expand Down Expand Up @@ -2527,7 +2527,7 @@ public void should_event_sub_process_only_start_element_in_the_event_sub_process
waitForUserTask("userTask");
assertThat(new String(getProcessAPI().getDocumentContent(
getProcessAPI().getLastDocument(processInstance.getId(), "myDoc").getContentStorageId())))
.isEqualTo("updatedContents");
.isEqualTo("updatedContents");

getProcessAPI().sendSignal("theSignal");
//then
Expand All @@ -2536,7 +2536,7 @@ public void should_event_sub_process_only_start_element_in_the_event_sub_process
//instantiation of the event sub process work and did not reinitialized elements
assertThat(new String(getProcessAPI().getDocumentContent(
getProcessAPI().getLastDocument(processInstance.getId(), "myDoc").getContentStorageId())))
.isEqualTo("updatedContents");
.isEqualTo("updatedContents");
assertThat(getProcessAPI().getDocumentList(processInstance.getId(), "MyList", 0, 100)).hasSize(2);
try {
getProcessAPI().getLastDocument(eventSubProcessActivity.getParentProcessInstanceId(), "myDoc");
Expand All @@ -2545,7 +2545,7 @@ public void should_event_sub_process_only_start_element_in_the_event_sub_process
}
assertThat(
getProcessAPI().getDocumentList(eventSubProcessActivity.getParentProcessInstanceId(), "MyList", 0, 100))
.isEmpty();
.isEmpty();
disableAndDeleteProcess(processDefinition);
}

Expand Down Expand Up @@ -2590,7 +2590,7 @@ public void should_be_able_to_update_business_object_in_event_sub_process() thro
assertThatJson(
getBusinessDataAsJson((SimpleBusinessDataReference) getProcessAPI().getProcessInstanceExecutionContext(
processInstance.getId()).get("ref_myBusinessData")))
.node("lastName").isEqualTo("\"Doe\"");
.node("lastName").isEqualTo("\"Doe\"");
//when
getProcessAPI().sendSignal("theSignal");
waitForUserTask("userTaskInSubProcess");
Expand All @@ -2599,7 +2599,7 @@ public void should_be_able_to_update_business_object_in_event_sub_process() thro
assertThatJson(
getBusinessDataAsJson((SimpleBusinessDataReference) getProcessAPI().getProcessInstanceExecutionContext(
processInstance.getId()).get("ref_myBusinessData")))
.node("lastName").isEqualTo("\"newName\"");
.node("lastName").isEqualTo("\"newName\"");
disableAndDeleteProcess(processDefinition);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public void updateTimerEventTriggerInstance() throws Exception {
// Without optimisations, it takes around 30 seconds
assertThat(Duration.between(LocalDateTime.ofInstant(date.toInstant(), ZoneId.systemDefault()),
LocalDateTime.now(ZoneId.systemDefault())))
.isLessThanOrEqualTo(Duration.ofSeconds(10));
.isLessThanOrEqualTo(Duration.ofSeconds(10));
assertThat(getProcessAPI().searchTimerEventTriggerInstances(processInstance2.getId(), options).getResult())
.hasSize(1);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,8 @@ public void deployProcessesWithFormMappings() throws Exception {
processConfigurationAPI
.searchFormMappings(new SearchOptionsBuilder(0, 100)
.sort(FormMappingSearchDescriptor.ID, Order.DESC).done())
.getResult()).isEmpty();
.getResult())
.isEmpty();

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -745,11 +745,11 @@ public void should_search_user_case_insensitively() throws BonitaException {
assertThat(getIdentityAPI().searchUsers(
new SearchOptionsBuilder(0, 10).searchTerm("jean").sort(UserSearchDescriptor.ID, Order.ASC).done())
.getResult())
.hasSize(1).allMatch(user -> user.getUserName().equals("Jean_Michel"));
.hasSize(1).allMatch(user -> user.getUserName().equals("Jean_Michel"));
assertThat(getIdentityAPI().searchUsers(
new SearchOptionsBuilder(0, 10).searchTerm("Jean").sort(UserSearchDescriptor.ID, Order.ASC).done())
.getResult())
.hasSize(1).allMatch(user -> user.getUserName().equals("Jean_Michel"));
.hasSize(1).allMatch(user -> user.getUserName().equals("Jean_Michel"));

deleteUsers(users);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,8 @@ private ProcessDefinition createAndDeployProcessDefinitionAndInstance(final Stri
final DesignProcessDefinition processDef = createProcessDefinitionBuilderWithHumanAndAutomaticSteps(
"My_Process", "1.0",
Collections.singletonList("step1"), Collections.singletonList(isHuman))
.addIntegerData(dataName, dataDefaultExp)
.addDescription("Delivery all day and night long").getProcess();
.addIntegerData(dataName, dataDefaultExp)
.addDescription("Delivery all day and night long").getProcess();

return deployAndEnableProcessWithActor(processDef, "Actor1", user);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -701,7 +701,8 @@ public void searchArchivedDocuments() throws Exception {
assertThat(
getProcessAPI().searchArchivedDocuments(new SearchOptionsBuilder(0, 45).searchTerm("doc1").done())
.getResult().get(0)
.getContentFileName()).isEqualTo("doc1.jpg");
.getContentFileName())
.isEqualTo("doc1.jpg");

} finally {
disableAndDeleteProcess(processInstance.getProcessDefinitionId());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ private Expression string(String calledProcess) throws InvalidExpressionExceptio
private void shouldNotHaveFailedTasks() throws SearchException {
assertThat(getProcessAPI().searchArchivedFlowNodeInstances(new SearchOptionsBuilder(0, 1000).done()).getResult()
.stream().map(ArchivedFlowNodeInstance::getState))
.doesNotContain("failed");
.doesNotContain("failed");
}

private List<ArchivedFlowNodeInstance> getAllCompletedArchivedFlowNodeInstances() throws SearchException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -327,9 +327,9 @@ public void deleteSupervisor_should_throw_SupervisorNotFoundException_when_super
// Already deleted Supervisor
assertThatThrownBy(
() -> getProcessAPI().deleteSupervisor(myProcess1.getId(), null, role2.getId(), group2.getId()))
.isInstanceOf(DeletionException.class)
// Only check the name and not the cause, because in HTTP mode, the stacks are merged and the cause removed:
.hasMessageContaining("SupervisorNotFoundException");
.isInstanceOf(DeletionException.class)
// Only check the name and not the cause, because in HTTP mode, the stacks are merged and the cause removed:
.hasMessageContaining("SupervisorNotFoundException");
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ public void process_update_custom_application_with_same_installed_version() thro
assertThat(updatedApplication.getLastUpdateDate().after(application.getLastUpdateDate())).isTrue();
assertThat(
updatedProcessStarterAPI.getLastModificationDate().after(processStarterAPI.getLastModificationDate()))
.isTrue();
.isTrue();
assertThat(updatedHealthPage.getLastModificationDate().after(healthPage.getLastModificationDate())).isTrue();
assertThat(updatedPmLayout.getLastModificationDate().after(pmLayout.getLastModificationDate())).isTrue();

Expand Down Expand Up @@ -224,7 +224,7 @@ public void process_update_custom_application_with_new_version()
// check updated custom pages
assertThat(
updatedProcessStarterAPI.getLastModificationDate().after(processStarterAPI.getLastModificationDate()))
.isTrue();
.isTrue();
assertThat(updatedProcessStarterAPI.getContentName()).isEqualTo("processStarter-1.1.zip");
assertThat(updatedHealthPage.getLastModificationDate().after(healthPage.getLastModificationDate())).isTrue();
assertThat(updatedHealthPage.getContentName()).isEqualTo("page_HealthPage.zip");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,22 @@
package org.bonitasoft.engine.bpm.process;

import static java.util.Arrays.asList;
import static java.util.Map.entry;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.SoftAssertions.assertSoftly;
import static org.awaitility.Awaitility.await;
import static org.bonitasoft.engine.data.instance.api.DataInstanceContainer.ACTIVITY_INSTANCE;
import static org.bonitasoft.engine.data.instance.api.DataInstanceContainer.PROCESS_INSTANCE;
import static org.junit.Assert.fail;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.Callable;
import java.util.*;

import org.bonitasoft.engine.bpm.bar.BarResource;
import org.bonitasoft.engine.bpm.bar.BusinessArchiveBuilder;
import org.bonitasoft.engine.bpm.bar.actorMapping.Actor;
import org.bonitasoft.engine.bpm.bar.actorMapping.ActorMapping;
import org.bonitasoft.engine.bpm.connector.ConnectorEvent;
import org.bonitasoft.engine.bpm.contract.FileInputValue;
import org.bonitasoft.engine.bpm.contract.Type;
import org.bonitasoft.engine.bpm.document.DocumentValue;
import org.bonitasoft.engine.bpm.process.impl.ProcessDefinitionBuilder;
Expand Down Expand Up @@ -64,7 +65,17 @@ public void should_delete_complete_archived_process_instances() throws Exception
List<Long> userTaskInstances = new ArrayList<>();
for (int i = 0; i < 2; i++) {
long id = getProcessAPI().startProcessWithInputs(mainProcess.getId(),
Collections.singletonMap("simpleInput1", "singleInputValue")).getId();
Map.ofEntries(entry("simpleInput1", "singleInputValue"),
entry("myFile", new FileInputValue("testFile", "testFile".getBytes()))))
.getId();
var archivedFileInput = await().until(() -> inTx(
() -> getServiceAccessor().getContractDataService().getArchivedProcessDataValue(id, "myFile")),
Objects::nonNull);
assertThat(archivedFileInput)
.as("File input content of archived contract data should be null")
.isInstanceOf(FileInputValue.class)
.extracting("content")
.isNull();
long userTask1 = waitForUserTask(id, "userTask1");
userTaskInstances.add(userTask1);
getProcessAPI().assignUserTask(userTask1, user.getId());
Expand All @@ -80,7 +91,7 @@ public void should_delete_complete_archived_process_instances() throws Exception

getProcessAPI().deleteArchivedProcessInstancesInAllStates(processInstances);

getServiceAccessor().getUserTransactionService().executeInTransaction((Callable<Void>) () -> {
inTx(() -> {
for (Long userTaskInstance : userTaskInstances) {
try {
getServiceAccessor().getContractDataService().getArchivedUserTaskDataValue(userTaskInstance,
Expand Down Expand Up @@ -139,7 +150,9 @@ public void should_delete_process_instance_currently_executing() throws Exceptio
ProcessDefinition sub2 = createSubProcessDefinitionWithUserTask(user);

long id = getProcessAPI().startProcessWithInputs(mainProcess.getId(),
Collections.singletonMap("simpleInput1", "singleInputValue")).getId();
Map.ofEntries(entry("simpleInput1", "singleInputValue"),
entry("myFile", new FileInputValue("testFile", "testFile".getBytes()))))
.getId();
waitForUserTask(id, "userTask1");
waitForUserTask("taskOfSubProcess");
waitForUserTask("taskOfSubProcess");
Expand Down Expand Up @@ -183,7 +196,9 @@ protected List<SFlowNodeInstance> getAllFlowNodes() throws Exception {
protected ProcessDefinition createMainProcessDefinition() throws Exception {
ProcessDefinitionBuilder mainProcessBuilder = new ProcessDefinitionBuilder()
.createNewInstance("mainProcess", "1.0");
mainProcessBuilder.addContract().addInput("simpleInput1", Type.TEXT, "a simple input");
mainProcessBuilder.addContract()
.addInput("simpleInput1", Type.TEXT, "a simple input")
.addFileInput("myFile", "A file input");
mainProcessBuilder.addActor("actor");
mainProcessBuilder.addUserTask("userTask1", "actor").addContract().addInput("simpleInputTask", Type.TEXT,
"a simple task input");
Expand Down Expand Up @@ -226,7 +241,7 @@ protected ProcessDefinition createSubProcessDefinition2() throws Exception {
.addAutomaticTask("autoWithConnector")
.addConnector("connector1", "myConnector", "1.0", ConnectorEvent.ON_ENTER)
.addAutomaticTask("autoWithData").addShortTextData("activityData", s("activityDataValue")).getProcess())
.done());
.done());
}

protected ProcessDefinition createSubProcessDefinitionWithUserTask(User user) throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ public void deploy_a_BDR_and_verify_sequence_behaviour_by_DBVendor() throws Exce
case "oracle":
assertThat(((List<BigDecimal>) execute_native_sql(
"SELECT COUNT(*) FROM user_sequences WHERE sequence_name = 'HIBERNATE_SEQUENCE'")).get(0)
.intValue()).isEqualTo(1);
.intValue()).isEqualTo(1);
break;
case "mysql":
assertThat(Arrays.toString((Object[]) execute_native_sql("describe EMPLOYEE").get(0)))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
**/
package org.bonitasoft.engine.test;

import java.util.concurrent.Callable;

import org.bonitasoft.engine.CommonAPIIT;
import org.bonitasoft.engine.exception.BonitaRuntimeException;
import org.bonitasoft.engine.service.ServiceAccessor;
Expand Down Expand Up @@ -44,4 +46,8 @@ protected static void cleanSession() throws Exception {
sessionAccessor.deleteSessionId();
}

protected <T> T inTx(Callable<T> callable) throws Exception {
return getServiceAccessor().getUserTransactionService().executeInTransaction(callable);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -246,11 +246,11 @@ public UserCreator buildEngineUser(final UserItem user) throws NumberFormatExcep

final UserCreator userCreator = new UserCreator(user.getAttributeValue(UserItem.ATTRIBUTE_USERNAME),
user.getAttributeValue(UserItem.ATTRIBUTE_PASSWORD))
.setFirstName(user.getAttributeValue(UserItem.ATTRIBUTE_FIRSTNAME))
.setLastName(user.getAttributeValue(UserItem.ATTRIBUTE_LASTNAME))
.setTitle(user.getAttributeValue(UserItem.ATTRIBUTE_TITLE))
.setIconPath(user.getAttributeValue(UserItem.ATTRIBUTE_ICON))
.setJobTitle(user.getAttributeValue(UserItem.ATTRIBUTE_JOB_TITLE));
.setFirstName(user.getAttributeValue(UserItem.ATTRIBUTE_FIRSTNAME))
.setLastName(user.getAttributeValue(UserItem.ATTRIBUTE_LASTNAME))
.setTitle(user.getAttributeValue(UserItem.ATTRIBUTE_TITLE))
.setIconPath(user.getAttributeValue(UserItem.ATTRIBUTE_ICON))
.setJobTitle(user.getAttributeValue(UserItem.ATTRIBUTE_JOB_TITLE));
// .setPersonalData(personalInfo.done())
// .setProfessionalData(professionalInfo.done());

Expand Down
Loading

0 comments on commit b3f1c93

Please sign in to comment.