Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Activiti to Spring Boot 3 #4313

Closed
wants to merge 14 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ on:
pull_request:
branches:
- develop
# TODO remove before merge
- dev-igdianov-jdk17

# Allows to run this workflow manually from the Actions tab
workflow_dispatch:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@

import org.activiti.common.util.DateFormatterProvider;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@AutoConfiguration
public class ActivitiCoreCommonUtilAutoConfiguration {

@Bean
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
org.activiti.common.util.conf.ActivitiCoreCommonUtilAutoConfiguration
20 changes: 6 additions & 14 deletions activiti-core-common/activiti-core-common-dependencies/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@
<artifactId>activiti-core-common-dependencies</artifactId>
<packaging>pom</packaging>
<name>Activiti :: Core :: Common :: Dependencies BOM (Bill Of Materials)</name>
<properties>
<juel.version>2.2.7</juel.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
Expand Down Expand Up @@ -81,19 +78,14 @@
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>de.odysseus.juel</groupId>
<artifactId>juel-api</artifactId>
<version>${juel.version}</version>
</dependency>
<dependency>
<groupId>de.odysseus.juel</groupId>
<artifactId>juel-impl</artifactId>
<version>${juel.version}</version>
<groupId>org.activiti</groupId>
<artifactId>activiti-juel-impl</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>de.odysseus.juel</groupId>
<artifactId>juel-spi</artifactId>
<version>${juel.version}</version>
<groupId>jakarta.el</groupId>
<artifactId>jakarta.el-api</artifactId>
<version>${jakarta.el-api.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
import org.activiti.test.operations.ProcessOperations;
import org.activiti.test.operations.TaskOperations;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@AutoConfiguration
public class AssertionsAPIAutoConfiguration {

@Bean
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
org.activiti.test.conf.AssertionsAPIAutoConfiguration
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@
<artifactId>activiti-core-test-local-runtime</artifactId>
<name>Activiti :: Test Local Runtime</name>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-autoconfigure</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.activiti</groupId>
<artifactId>activiti-core-test-assertions</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@
import org.activiti.test.TaskSource;
import org.activiti.test.operations.ProcessRuntimeOperations;
import org.activiti.test.operations.TaskRuntimeOperations;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@AutoConfiguration
public class ActivitiAssertionsAutoConfiguration {

private final LocalEventSource localEventProvider = new LocalEventSource();
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
org.activiti.test.config.ActivitiAssertionsAutoConfiguration
25 changes: 13 additions & 12 deletions activiti-core-common/activiti-expression-language/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,12 @@
<name>Activiti :: Expression Language Support</name>
<dependencies>
<dependency>
<groupId>de.odysseus.juel</groupId>
<artifactId>juel-api</artifactId>
<groupId>jakarta.el</groupId>
<artifactId>jakarta.el-api</artifactId>
</dependency>
<dependency>
<groupId>de.odysseus.juel</groupId>
<artifactId>juel-impl</artifactId>
</dependency>
<dependency>
<groupId>de.odysseus.juel</groupId>
<artifactId>juel-spi</artifactId>
<groupId>org.activiti</groupId>
<artifactId>activiti-juel-impl</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
Expand All @@ -45,13 +41,18 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
package org.activiti.core.el;

import java.lang.reflect.Method;
import javax.el.ELContext;
import javax.el.ELResolver;
import javax.el.FunctionMapper;
import javax.el.ValueExpression;
import javax.el.VariableMapper;
import jakarta.el.ELContext;
import jakarta.el.ELResolver;
import jakarta.el.FunctionMapper;
import jakarta.el.ValueExpression;
import jakarta.el.VariableMapper;

/**
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@
*/
package org.activiti.core.el;

import jakarta.el.FunctionMapper;
import java.lang.reflect.Method;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import javax.el.FunctionMapper;

/**
* Default implementation of a {@link FunctionMapper}.
* <p>
* A non-null implementation is required by the javax.el.* classes, hence the reason for this pretty useless class.
* A non-null implementation is required by the jakarta.el.* classes, hence the reason for this pretty useless class.
*/
public class ActivitiFunctionMapper extends FunctionMapper {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import javax.el.ValueExpression;
import javax.el.VariableMapper;
import jakarta.el.ValueExpression;
import jakarta.el.VariableMapper;

public class ActivitiVariablesMapper extends VariableMapper {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
*/
package org.activiti.core.el;

import javax.el.ArrayELResolver;
import javax.el.BeanELResolver;
import javax.el.ELContext;
import javax.el.ELResolver;
import javax.el.ListELResolver;
import javax.el.MapELResolver;
import jakarta.el.ArrayELResolver;
import jakarta.el.BeanELResolver;
import jakarta.el.ELContext;
import jakarta.el.ELResolver;
import jakarta.el.ListELResolver;
import jakarta.el.MapELResolver;

/**
* Builder of {@link ELContext} instances.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@
import java.util.Map;
import java.util.Objects;
import java.util.stream.Stream;
import javax.el.CompositeELResolver;
import javax.el.ELContext;
import javax.el.ELResolver;
import jakarta.el.CompositeELResolver;
import jakarta.el.ELContext;
import jakarta.el.ELResolver;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* Builder of {@link javax.el.ELContext} instances.
* Builder of {@link jakarta.el.ELContext} instances.
*/
public class ELContextBuilder {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@

import java.beans.FeatureDescriptor;
import java.util.Iterator;
import javax.el.ELContext;
import javax.el.ELResolver;
import jakarta.el.ELContext;
import jakarta.el.ELResolver;

/**
* Generic Decorator for {@link ELResolver} implementations.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
import java.util.Set;
import java.util.function.Predicate;
import java.util.stream.Collectors;
import javax.el.ELContext;
import javax.el.ELResolver;
import jakarta.el.ELContext;
import jakarta.el.ELResolver;

/**
* {@link ELResolverDecorator} that blocks invocations using reflection or native calls.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@
import java.util.Iterator;
import java.util.List;

import javax.el.CompositeELResolver;
import javax.el.ELContext;
import javax.el.ELException;
import javax.el.ELResolver;
import javax.el.PropertyNotWritableException;
import jakarta.el.CompositeELResolver;
import jakarta.el.ELContext;
import jakarta.el.ELException;
import jakarta.el.ELResolver;
import jakarta.el.PropertyNotWritableException;

import com.fasterxml.jackson.databind.ObjectMapper;

Expand Down Expand Up @@ -339,22 +339,21 @@ public void setValue(ELContext context, Object base, Object property, Object val
if (context == null) {
throw new NullPointerException("context is null");
}
if (base instanceof ObjectNode) {
if (base instanceof ObjectNode node) {
if (readOnly) {
throw new PropertyNotWritableException("resolver is read-only");
}
ObjectNode node = (ObjectNode) base;
if (value instanceof BigDecimal) {
node.put(property.toString(), (BigDecimal) value);
if (value instanceof BigDecimal decimal) {
node.put(property.toString(), decimal);

} else if (value instanceof Boolean) {
node.put(property.toString(), (Boolean) value);
} else if (value instanceof Boolean boolean1) {
node.put(property.toString(), boolean1);

} else if (value instanceof Long) {
node.put(property.toString(), (Long) value);
} else if (value instanceof Long long1) {
node.put(property.toString(), long1);

} else if (value instanceof Double) {
node.put(property.toString(), (Double) value);
} else if (value instanceof Double double1) {
node.put(property.toString(), double1);

} else if (value != null) {
node.put(property.toString(), value.toString());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,20 @@
import static org.activiti.core.el.CommonELResolversUtil.listResolver;
import static org.activiti.core.el.CommonELResolversUtil.mapResolver;

import jakarta.el.ELContext;
import jakarta.el.ExpressionFactory;
import jakarta.el.ValueExpression;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import javax.el.ELContext;
import javax.el.ExpressionFactory;
import javax.el.ValueExpression;
import de.odysseus.el.ExpressionFactoryImpl;

public class JuelExpressionResolver implements ExpressionResolver {

private final ExpressionFactory expressionFactory;
private final List<CustomFunctionProvider> customFunctionProviders;

public JuelExpressionResolver() {
this(new ExpressionFactoryImpl());
this(ExpressionFactory.newInstance());
}

public JuelExpressionResolver(ExpressionFactory expressionFactory) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
import java.util.Iterator;
import java.util.Map;

import javax.el.ELContext;
import javax.el.ELResolver;
import jakarta.el.ELContext;
import jakarta.el.ELResolver;

/**
* An {@link ELResolver} that exposed object values in the map, under the name of the entry's key. The values in the map are only returned when requested property has no 'base', meaning it's a
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,15 @@

import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
import java.util.Collections;
import java.util.Map;
import org.junit.Test;
import org.junit.jupiter.api.Test;

public class ELResolverReflectionBlockerDecoratorTest {
class ELResolverReflectionBlockerDecoratorTest {

@Test
public void should_resolveExpressionCorrectly_when_noReflectionOrNativeMethodsAreUsed() {
void should_resolveExpressionCorrectly_when_noReflectionOrNativeMethodsAreUsed() {
//given
Map<String, Object> availableVariables = Collections.singletonMap("name", "jon doe");
Map<String, Object> availableVariables = Map.of("name", "jon doe");
String expressionString = "${name.toString()}";
ExpressionResolver expressionResolver = new JuelExpressionResolver();

Expand All @@ -38,10 +37,10 @@ public void should_resolveExpressionCorrectly_when_noReflectionOrNativeMethodsAr
}

@Test
public void should_throwException_when_nativeMethodIsUsed() {
void should_throwException_when_nativeMethodIsUsed() {

//given
Map<String, Object> availableVariables = Collections.singletonMap("name", "jon doe");
Map<String, Object> availableVariables = Map.of("name", "jon doe");
String expressionString = "${name.getClass().getName()}";
ExpressionResolver expressionResolver = new JuelExpressionResolver();

Expand All @@ -53,10 +52,10 @@ public void should_throwException_when_nativeMethodIsUsed() {
}

@Test
public void should_throwException_when_reflectionIsUsed() {
void should_throwException_when_reflectionIsUsed() {

//given
Map<String, Object> availableVariables = Collections.singletonMap("class", String.class);
Map<String, Object> availableVariables = Map.of("class", String.class);
String expressionString = "${class.forName(\"java.lang.Runtime\").getMethods()[6].invoke()}";
ExpressionResolver expressionResolver = new JuelExpressionResolver();

Expand Down