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 Sep 9, 2024
2 parents 67b6ac0 + b3d5736 commit ca84299
Show file tree
Hide file tree
Showing 16 changed files with 175 additions and 137 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,24 +31,7 @@
import org.bonitasoft.engine.bpm.bar.BusinessArchive;
import org.bonitasoft.engine.bpm.bar.BusinessArchiveBuilder;
import org.bonitasoft.engine.bpm.connector.ConnectorEvent;
import org.bonitasoft.engine.bpm.flownode.ActivityInstance;
import org.bonitasoft.engine.bpm.flownode.ActivityInstanceCriterion;
import org.bonitasoft.engine.bpm.flownode.ActivityInstanceSearchDescriptor;
import org.bonitasoft.engine.bpm.flownode.ActivityStates;
import org.bonitasoft.engine.bpm.flownode.ArchivedActivityInstance;
import org.bonitasoft.engine.bpm.flownode.ArchivedActivityInstanceSearchDescriptor;
import org.bonitasoft.engine.bpm.flownode.ArchivedAutomaticTaskInstance;
import org.bonitasoft.engine.bpm.flownode.ArchivedFlowNodeInstance;
import org.bonitasoft.engine.bpm.flownode.ArchivedFlowNodeInstanceSearchDescriptor;
import org.bonitasoft.engine.bpm.flownode.ArchivedHumanTaskInstance;
import org.bonitasoft.engine.bpm.flownode.ArchivedHumanTaskInstanceSearchDescriptor;
import org.bonitasoft.engine.bpm.flownode.ArchivedManualTaskInstance;
import org.bonitasoft.engine.bpm.flownode.ArchivedUserTaskInstance;
import org.bonitasoft.engine.bpm.flownode.FlowNodeInstance;
import org.bonitasoft.engine.bpm.flownode.FlowNodeType;
import org.bonitasoft.engine.bpm.flownode.HumanTaskInstance;
import org.bonitasoft.engine.bpm.flownode.HumanTaskInstanceSearchDescriptor;
import org.bonitasoft.engine.bpm.flownode.TaskPriority;
import org.bonitasoft.engine.bpm.flownode.*;
import org.bonitasoft.engine.bpm.process.DesignProcessDefinition;
import org.bonitasoft.engine.bpm.process.ProcessDefinition;
import org.bonitasoft.engine.bpm.process.ProcessInstance;
Expand All @@ -66,6 +49,7 @@
import org.bonitasoft.engine.identity.Role;
import org.bonitasoft.engine.identity.User;
import org.bonitasoft.engine.test.BuildTestUtil;
import org.bonitasoft.engine.test.TestStates;
import org.bonitasoft.engine.test.check.CheckNbOfActivities;
import org.junit.Test;

Expand Down Expand Up @@ -357,8 +341,8 @@ public void searchAssignedAndPendingHumanTaskInstances() throws Exception {
ProcessDefinition p1 = deployAndEnableProcessWithActor(bar1, "a", user);
ProcessDefinition p2 = deployAndEnableProcessWithActor(bar2, "a", user);

getProcessAPI().startProcess(p1.getId());
getProcessAPI().startProcess(p2.getId());
var instance1 = getProcessAPI().startProcess(p1.getId());
var instance2 = getProcessAPI().startProcess(p2.getId());
waitForUserTask("p1task1");
long p1task2 = waitForUserTask("p1task2");
long p1task3 = waitForUserTask("p1task3");
Expand Down Expand Up @@ -388,6 +372,16 @@ public void searchAssignedAndPendingHumanTaskInstances() throws Exception {
.filter("name", "p1task3").done());
assertThat(searchResult).matches(haveTasks(), toDescription(searchResult));

try {
waitForTaskInState(instance1, "p1task3", TestStates.NORMAL_FINAL);
} catch (ActivityInstanceNotFoundException e) {
// ignore it, instance is already completed
}
try {
waitForTaskInState(instance2, "p2task3", TestStates.NORMAL_FINAL);
} catch (ActivityInstanceNotFoundException e) {
// ignore it, instance is already completed
}
disableAndDeleteProcess(p1, p2);
}

Expand Down Expand Up @@ -1267,6 +1261,11 @@ public void searchPendingHumanTasksAssignedToUser() throws Exception {
assertThat(searchHumanTaskInstancesCountOnly.getResult()).describedAs("Human tasks").isEmpty();

// -------- tear down
try {
waitForTaskInState(processInstance, "userTask6_assigned_to_John_long_execution", TestStates.NORMAL_FINAL);
} catch (ActivityInstanceNotFoundException e) {
// ignore it, activity is already finished
}
disableAndDeleteProcess(processDefinition);
deleteUser(john);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,13 +144,13 @@ public void searchFailedProcessInstances() throws Exception {
TestConnectorThatThrowException.class, "TestConnectorThatThrowException.jar");

final ProcessInstance instance1 = getProcessAPI().startProcess(processDefinitionWithFailedConnector.getId());
waitForProcessToBeInState(instance1, ProcessInstanceState.ERROR);
waitForProcessToBeInState(instance1.getId(), ProcessInstanceState.ERROR);

final ProcessInstance instance2 = getProcessAPI().startProcess(processDefinitionWithFailedTask.getId());
waitForFlowNodeInFailedState(instance2);

final ProcessInstance instance3 = getProcessAPI().startProcess(processDefinitionWithFailedConnector.getId());
waitForProcessToBeInState(instance3, ProcessInstanceState.ERROR);
waitForProcessToBeInState(instance3.getId(), ProcessInstanceState.ERROR);

// search and check result ASC
final SearchOptionsBuilder searchOptions1 = BuildTestUtil.buildSearchOptions(0, 2,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1036,9 +1036,15 @@ public void waitForProcessToBeInState(final ProcessInstance processInstance, fin

public void waitForProcessToBeInState(final long processInstanceId, final ProcessInstanceState state)
throws Exception {
waitForProcessToBeInState(processInstanceId, state, DEFAULT_TIMEOUT);
}

public void waitForProcessToBeInState(final long processInstanceId, final ProcessInstanceState state,
final int timeoutInMillis)
throws Exception {
ClientEventUtil.executeWaitServerCommand(getCommandAPI(),
ClientEventUtil.getProcessInstanceInState(processInstanceId, state.getId()),
DEFAULT_TIMEOUT);
timeoutInMillis);
}

public void waitForInitializingProcess() throws Exception {
Expand All @@ -1049,15 +1055,15 @@ public void waitForInitializingProcess() throws Exception {

private Long waitForFlowNode(final long processInstanceId, final TestStates state, final String flowNodeName,
final boolean useRootProcessInstance,
final int timeout) throws Exception {
final int timeoutInMillis) throws Exception {
Map<String, Serializable> params;
if (useRootProcessInstance) {
params = ClientEventUtil.getFlowNodeInState(processInstanceId, state.getStateName(), flowNodeName);
} else {
params = ClientEventUtil.getFlowNodeInStateWithParentId(processInstanceId, state.getStateName(),
flowNodeName);
}
return ClientEventUtil.executeWaitServerCommand(getCommandAPI(), params, timeout);
return ClientEventUtil.executeWaitServerCommand(getCommandAPI(), params, timeoutInMillis);
}

public FlowNodeInstance waitForFlowNodeInReadyState(final ProcessInstance processInstance,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ public class SpringBeanAccessor {
private static final String WORK_CORE_POOL_SIZE = "bonita.tenant.work.corePoolSize";
private static final String WORK_MAX_POOL_SIZE = "bonita.tenant.work.maximumPoolSize";
private static final String WORK_KEEP_ALIVE_IN_SECONDS = "bonita.tenant.work.keepAliveTimeSeconds";
private static final String CONNECTOR_CORE_POOL_SIZE = "bonita.tenant.connector.corePoolSize";
private static final String CONNECTOR_MAX_POOL_SIZE = "bonita.tenant.connector.maximumPoolSize";
private static final String CONNECTOR_KEEP_ALIVE_IN_SECONDS = "bonita.tenant.connector.keepAliveTimeSeconds";

private BonitaSpringContext context;

Expand Down Expand Up @@ -117,6 +120,9 @@ protected void warnDeprecatedProperties(MutablePropertySources propertySources)
warnIfPropertyIsDeprecated(propertySources, WORK_CORE_POOL_SIZE);
warnIfPropertyIsDeprecated(propertySources, WORK_MAX_POOL_SIZE);
warnIfPropertyIsDeprecated(propertySources, WORK_KEEP_ALIVE_IN_SECONDS);
warnIfPropertyIsDeprecated(propertySources, CONNECTOR_CORE_POOL_SIZE);
warnIfPropertyIsDeprecated(propertySources, CONNECTOR_MAX_POOL_SIZE);
warnIfPropertyIsDeprecated(propertySources, CONNECTOR_KEEP_ALIVE_IN_SECONDS);
}

private void warnIfPropertyIsDeprecated(MutablePropertySources propertySources, String property) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1528,17 +1528,6 @@
</constructor-arg>
</bean>

<bean id="connectorExecutor" class="org.bonitasoft.engine.connector.impl.ConnectorExecutorImpl">
<constructor-arg name="queueCapacity" value="${bonita.tenant.connector.queueCapacity}" />
<constructor-arg name="corePoolSize" value="${bonita.tenant.connector.corePoolSize}" />
<constructor-arg name="maximumPoolSize" value="${bonita.tenant.connector.maximumPoolSize}" />
<constructor-arg name="keepAliveTimeSeconds" value="${bonita.tenant.connector.keepAliveTimeSeconds}" />
<constructor-arg name="sessionService" ref="sessionService" />
<constructor-arg name="timeTracker" ref="timeTracker" />
<constructor-arg name="meterRegistry" ref="meterRegistry" />
<constructor-arg name="tenantId" value="${tenantId}" />
</bean>

<bean id="expressionService" class="org.bonitasoft.engine.expression.impl.ExpressionServiceImpl">
<constructor-arg name="checkExpressionReturnType" value="true" />
<constructor-arg name="timeTracker" ref="timeTracker" />
Expand Down Expand Up @@ -1726,7 +1715,6 @@
</bean>

<bean id="userFilterServiceSub" class="org.bonitasoft.engine.core.filter.impl.UserFilterServiceImpl">
<constructor-arg name="connectorExecutor" ref="connectorExecutor" />
<constructor-arg name="processResourcesService" ref="processResourcesService" />
<constructor-arg name="expressionResolverService" ref="expressionResolverService" />
</bean>
Expand Down Expand Up @@ -1976,7 +1964,6 @@
</bean>

<bean id="connectorServiceSub" class="org.bonitasoft.engine.core.connector.impl.ConnectorServiceImpl">
<constructor-arg name="connectorExecutor" ref="connectorExecutor" />
<constructor-arg name="expressionResolverService" ref="expressionResolverService" />
<constructor-arg name="operationService" ref="operationService" />
<constructor-arg name="dependencyService" ref="dependencyService" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ bonita.runtime.session.duration=3600000

# Connector executor
bonita.tenant.connector.queueCapacity=10000
bonita.tenant.connector.corePoolSize=10
bonita.tenant.connector.maximumPoolSize=10
bonita.tenant.connector.keepAliveTimeSeconds=100

# Produce a warning log when connector took longer to execute than this value
bonita.tenant.connector.warnWhenLongerThanMillis=10000
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/**
* Copyright (C) 2024 Bonitasoft S.A.
* Bonitasoft, 32 rue Gustave Eiffel - 38000 Grenoble
* This library is free software; you can redistribute it and/or modify it under the terms
* of the GNU Lesser General Public License as published by the Free Software Foundation
* version 2.1 of the License.
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public License along with this
* program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301, USA.
**/
package org.bonitasoft.engine.connector;

import java.util.concurrent.ThreadPoolExecutor;

public interface BonitaConnectorExecutorFactory {

ThreadPoolExecutor create();

}
Loading

0 comments on commit ca84299

Please sign in to comment.