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 Jul 12, 2024
2 parents be48242 + b42931c commit 641e00d
Show file tree
Hide file tree
Showing 21 changed files with 126 additions and 64 deletions.
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 @@ -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
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);
}

}
8 changes: 6 additions & 2 deletions bpm/bonita-core/bonita-contract-data/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,14 @@ dependencies {
api project(':services:bonita-log')
api project(':services:bonita-archive')
api project(':services:bonita-persistence')
testImplementation "junit:junit:${Deps.junit4Version}"
implementation platform(libs.bonitaArtifactsModelBom)
implementation 'org.bonitasoft.engine:bonita-process-definition-model'
testImplementation "org.assertj:assertj-core:${Deps.assertjVersion}"
testImplementation "org.mockito:mockito-core:${Deps.mockitoVersion}"

testImplementation libs.junit5api
testImplementation libs.junit4
testRuntimeOnly(libs.junitJupiterEngine)
testRuntimeOnly(libs.junitVintageEngine)
annotationProcessor libs.lombok
compileOnly libs.lombok
}
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,8 @@ public Serializable getArchivedProcessDataValue(final long processInstanceId, fi
final SAProcessContractData contractData = readPersistenceService.selectOne(descriptor);
if (contractData == null) {
throw new SContractDataNotFoundException(
"No contract data found named: " + dataName + " of process instance: " + processInstanceId);
"No archived contract data found named: " + dataName + " of process instance: "
+ processInstanceId);
}
return contractData.getValue();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.bonitasoft.engine.bpm.contract.FileInputValue;
import org.bonitasoft.engine.persistence.PersistentObject;
import org.bonitasoft.engine.persistence.PersistentObjectId;
import org.bonitasoft.engine.persistence.SAPersistenceObjectImpl;
Expand All @@ -46,14 +47,27 @@ public abstract class SAContractData extends SAPersistenceObjectImpl {
@Column
protected long scopeId;

public SAContractData(long sourceObjectId, String name, Serializable value, long scopeId) {
protected SAContractData(long sourceObjectId, String name, Serializable value, long scopeId) {
super(sourceObjectId);
this.name = name;
this.scopeId = scopeId;
this.value = value;
this.value = clearFileInputContent(value);
}

public SAContractData(SContractData contractData) {
/**
* Remove the {@link FileInputValue} content from Archived Contract Data
*
* @param value, The contract input value
* @return The contract input value without file content in case of a {@link FileInputValue}
*/
private static Serializable clearFileInputContent(Serializable value) {
if (value instanceof FileInputValue inputValue) {
inputValue.setContent(null);
}
return value;
}

protected SAContractData(SContractData contractData) {
this(contractData.getId(), contractData.getName(), contractData.getValue(), contractData.getScopeId());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,27 @@

import static org.assertj.core.api.Assertions.assertThat;

import org.junit.Test;
import org.bonitasoft.engine.bpm.contract.FileInputValue;
import org.junit.jupiter.api.Test;

public class SAProcessContractDataTest {
class SAProcessContractDataTest {

@Test
public void creatingSAProcessContractDataShouldCopyNonArchivedValues() throws Exception {
void clearFileInputContent() {
var contractData = new SProcessContractData();
contractData.setId(1);
contractData.setName("myFile");
contractData.setValue(new FileInputValue("theFile", "content".getBytes()));

var archivedContractData = new SAProcessContractData(contractData);

assertThat(archivedContractData.getValue()).isInstanceOf(FileInputValue.class)
.extracting("content")
.isNull();
}

@Test
void creatingSAProcessContractDataShouldCopyNonArchivedValues() {
long processInstanceId = 555L;
String some_name = "some_name";
long value = 999999L;
Expand All @@ -31,11 +46,11 @@ public void creatingSAProcessContractDataShouldCopyNonArchivedValues() throws Ex

final SAProcessContractData saProcessContractData = new SAProcessContractData(processContractData);

assertThat(saProcessContractData.getTenantId()).isEqualTo(0L); // not set yet by Persistence service
assertThat(saProcessContractData.getId()).isEqualTo(0L);
assertThat(saProcessContractData.getTenantId()).isZero(); // not set yet by Persistence service
assertThat(saProcessContractData.getId()).isZero();
assertThat(saProcessContractData.getName()).isEqualTo(some_name);
assertThat(saProcessContractData.getScopeId()).isEqualTo(processInstanceId);
assertThat(saProcessContractData.getArchiveDate()).isEqualTo(0L);
assertThat(saProcessContractData.getArchiveDate()).isZero();
assertThat(saProcessContractData.getSourceObjectId()).isEqualTo(originalProcessDataId);
assertThat(saProcessContractData.getValue()).isEqualTo(value);
}
Expand Down
4 changes: 2 additions & 2 deletions bpm/bonita-web-server/src/main/resources/i18n/portal-js_es.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ msgstr ""
"X-Crowdin-Project: bonita\n"
"X-Crowdin-Project-ID: 13316\n"
"X-Crowdin-Language: es-ES\n"
"X-Crowdin-File: /release-10.2.0/bonita-web/portal/portal-js.pot\n"
"X-Crowdin-File-ID: 72894\n"
"X-Crowdin-File: /dev/bonita-web/portal/portal-js.pot\n"
"X-Crowdin-File-ID: 60594\n"
"Language-Team: Spanish\n"
"Language: es_ES\n"
"PO-Revision-Date: 2024-01-01 00:00\n"
Expand Down
4 changes: 2 additions & 2 deletions bpm/bonita-web-server/src/main/resources/i18n/portal-js_fr.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ msgstr ""
"X-Crowdin-Project: bonita\n"
"X-Crowdin-Project-ID: 13316\n"
"X-Crowdin-Language: fr\n"
"X-Crowdin-File: /release-10.2.0/bonita-web/portal/portal-js.pot\n"
"X-Crowdin-File-ID: 72894\n"
"X-Crowdin-File: /dev/bonita-web/portal/portal-js.pot\n"
"X-Crowdin-File-ID: 60594\n"
"Language-Team: French\n"
"Language: fr_FR\n"
"PO-Revision-Date: 2024-01-01 00:00\n"
Expand Down
4 changes: 2 additions & 2 deletions bpm/bonita-web-server/src/main/resources/i18n/portal-js_ja.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ msgstr ""
"X-Crowdin-Project: bonita\n"
"X-Crowdin-Project-ID: 13316\n"
"X-Crowdin-Language: ja\n"
"X-Crowdin-File: /release-10.2.0/bonita-web/portal/portal-js.pot\n"
"X-Crowdin-File-ID: 72894\n"
"X-Crowdin-File: /dev/bonita-web/portal/portal-js.pot\n"
"X-Crowdin-File-ID: 60594\n"
"Language-Team: Japanese\n"
"Language: ja_JP\n"
"PO-Revision-Date: 2024-01-01 00:00\n"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ msgstr ""
"X-Crowdin-Project: bonita\n"
"X-Crowdin-Project-ID: 13316\n"
"X-Crowdin-Language: pt-BR\n"
"X-Crowdin-File: /release-10.2.0/bonita-web/portal/portal-js.pot\n"
"X-Crowdin-File-ID: 72894\n"
"X-Crowdin-File: /dev/bonita-web/portal/portal-js.pot\n"
"X-Crowdin-File-ID: 60594\n"
"Language-Team: Portuguese, Brazilian\n"
"Language: pt_BR\n"
"PO-Revision-Date: 2024-01-01 00:00\n"
Expand Down
6 changes: 3 additions & 3 deletions bpm/bonita-web-server/src/main/resources/i18n/portal_es.po
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ msgid ""
msgstr ""
"Project-Id-Version: bonita\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-06-28 14:29+0000\n"
"POT-Creation-Date: 2024-04-01 14:34+0000\n"
"PO-Revision-Date: 2024-01-01 00:00\n"
"Last-Translator: \n"
"Language-Team: Spanish\n"
Expand All @@ -14,8 +14,8 @@ msgstr ""
"X-Crowdin-Project: bonita\n"
"X-Crowdin-Project-ID: 13316\n"
"X-Crowdin-Language: es-ES\n"
"X-Crowdin-File: /release-10.2.0/bonita-web/portal/portal.po\n"
"X-Crowdin-File-ID: 72886\n"
"X-Crowdin-File: /dev/bonita-web/portal/portal.po\n"
"X-Crowdin-File-ID: 60581\n"

msgid "%attribute% file format is not allowed. Only %file_formats% files are allowed."
msgstr "%attribute% formato de archivo no permitido. Sólo se permiten archivos %file_formats%."
Expand Down
6 changes: 3 additions & 3 deletions bpm/bonita-web-server/src/main/resources/i18n/portal_fr.po
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ msgid ""
msgstr ""
"Project-Id-Version: bonita\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-06-28 14:29+0000\n"
"POT-Creation-Date: 2024-04-01 14:34+0000\n"
"PO-Revision-Date: 2024-01-01 00:00\n"
"Last-Translator: \n"
"Language-Team: French\n"
Expand All @@ -14,8 +14,8 @@ msgstr ""
"X-Crowdin-Project: bonita\n"
"X-Crowdin-Project-ID: 13316\n"
"X-Crowdin-Language: fr\n"
"X-Crowdin-File: /release-10.2.0/bonita-web/portal/portal.po\n"
"X-Crowdin-File-ID: 72886\n"
"X-Crowdin-File: /dev/bonita-web/portal/portal.po\n"
"X-Crowdin-File-ID: 60581\n"

msgid "%attribute% file format is not allowed. Only %file_formats% files are allowed."
msgstr "le format de fichier %attribute% n'est pas autorisé. Utiliser les fichiers de format %file_formats%."
Expand Down
6 changes: 3 additions & 3 deletions bpm/bonita-web-server/src/main/resources/i18n/portal_ja.po
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ msgid ""
msgstr ""
"Project-Id-Version: bonita\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-06-28 14:29+0000\n"
"POT-Creation-Date: 2024-04-01 14:34+0000\n"
"PO-Revision-Date: 2024-01-01 00:00\n"
"Last-Translator: \n"
"Language-Team: Japanese\n"
Expand All @@ -14,8 +14,8 @@ msgstr ""
"X-Crowdin-Project: bonita\n"
"X-Crowdin-Project-ID: 13316\n"
"X-Crowdin-Language: ja\n"
"X-Crowdin-File: /release-10.2.0/bonita-web/portal/portal.po\n"
"X-Crowdin-File-ID: 72886\n"
"X-Crowdin-File: /dev/bonita-web/portal/portal.po\n"
"X-Crowdin-File-ID: 60581\n"

msgid "%attribute% file format is not allowed. Only %file_formats% files are allowed."
msgstr "%attribute% ファイルの形式は許可されていません。%file_formats%のファイルのみが許可されます。"
Expand Down
6 changes: 3 additions & 3 deletions bpm/bonita-web-server/src/main/resources/i18n/portal_pt_BR.po
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ msgid ""
msgstr ""
"Project-Id-Version: bonita\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-06-28 14:29+0000\n"
"POT-Creation-Date: 2024-04-01 14:34+0000\n"
"PO-Revision-Date: 2024-01-01 00:00\n"
"Last-Translator: \n"
"Language-Team: Portuguese, Brazilian\n"
Expand All @@ -14,8 +14,8 @@ msgstr ""
"X-Crowdin-Project: bonita\n"
"X-Crowdin-Project-ID: 13316\n"
"X-Crowdin-Language: pt-BR\n"
"X-Crowdin-File: /release-10.2.0/bonita-web/portal/portal.po\n"
"X-Crowdin-File-ID: 72886\n"
"X-Crowdin-File: /dev/bonita-web/portal/portal.po\n"
"X-Crowdin-File-ID: 60581\n"

msgid "%attribute% file format is not allowed. Only %file_formats% files are allowed."
msgstr "formato de arquivo %attribute% não é permitido. Apenas arquivos %file_formats% são permitidos."
Expand Down
4 changes: 2 additions & 2 deletions bpm/bonita-web-server/src/main/resources/i18n/resources_es.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ msgstr ""
"X-Crowdin-Project: bonita\n"
"X-Crowdin-Project-ID: 13316\n"
"X-Crowdin-Language: es-ES\n"
"X-Crowdin-File: /release-10.2.0/bonita-web/distrib/resources.pot\n"
"X-Crowdin-File-ID: 72900\n"
"X-Crowdin-File: /dev/bonita-web/distrib/resources.pot\n"
"X-Crowdin-File-ID: 61547\n"
"Language-Team: Spanish\n"
"Language: es_ES\n"
"PO-Revision-Date: 2024-01-01 00:00\n"
Expand Down
4 changes: 2 additions & 2 deletions bpm/bonita-web-server/src/main/resources/i18n/resources_fr.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ msgstr ""
"X-Crowdin-Project: bonita\n"
"X-Crowdin-Project-ID: 13316\n"
"X-Crowdin-Language: fr\n"
"X-Crowdin-File: /release-10.2.0/bonita-web/distrib/resources.pot\n"
"X-Crowdin-File-ID: 72900\n"
"X-Crowdin-File: /dev/bonita-web/distrib/resources.pot\n"
"X-Crowdin-File-ID: 61547\n"
"Language-Team: French\n"
"Language: fr_FR\n"
"PO-Revision-Date: 2024-01-01 00:00\n"
Expand Down
4 changes: 2 additions & 2 deletions bpm/bonita-web-server/src/main/resources/i18n/resources_ja.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ msgstr ""
"X-Crowdin-Project: bonita\n"
"X-Crowdin-Project-ID: 13316\n"
"X-Crowdin-Language: ja\n"
"X-Crowdin-File: /release-10.2.0/bonita-web/distrib/resources.pot\n"
"X-Crowdin-File-ID: 72900\n"
"X-Crowdin-File: /dev/bonita-web/distrib/resources.pot\n"
"X-Crowdin-File-ID: 61547\n"
"Language-Team: Japanese\n"
"Language: ja_JP\n"
"PO-Revision-Date: 2024-01-01 00:00\n"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ msgstr ""
"X-Crowdin-Project: bonita\n"
"X-Crowdin-Project-ID: 13316\n"
"X-Crowdin-Language: pt-BR\n"
"X-Crowdin-File: /release-10.2.0/bonita-web/distrib/resources.pot\n"
"X-Crowdin-File-ID: 72900\n"
"X-Crowdin-File: /dev/bonita-web/distrib/resources.pot\n"
"X-Crowdin-File-ID: 61547\n"
"Language-Team: Portuguese, Brazilian\n"
"Language: pt_BR\n"
"PO-Revision-Date: 2024-01-01 00:00\n"
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ org.gradle.jvmargs=--add-opens java.base/java.util=ALL-UNNAMED --add-opens java.
org.gradle.caching=true
org.gradle.vfs.watch=true

version=10.2-SNAPSHOT
brandingVersion=2024.3-SNAPSHOT
version=10.3-SNAPSHOT
brandingVersion=2025.1-SNAPSHOT
Loading

0 comments on commit 641e00d

Please sign in to comment.