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

AAE-29208 Add Activiti Spring Cache Manager provider #1645

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
c9da458
update activiti.version to 0.0.1-PR-4864-850-SNAPSHOT
igdianov Dec 16, 2024
b10da53
Add activiti-spring-cache-manager cache provider
igdianov Dec 16, 2024
669bf9a
Add temporary logging for cache stats
igdianov Dec 17, 2024
4f2f6b0
remove deprecated CachingProcessExtensionService
igdianov Dec 18, 2024
956c724
update activiti.version to 0.0.1-PR-4864-852-SNAPSHOT
igdianov Dec 18, 2024
383ab83
Revert "Add temporary logging for cache stats"
igdianov Dec 18, 2024
5140458
update activiti.version to 0.0.1-PR-4864-855-SNAPSHOT
igdianov Dec 18, 2024
81aff9f
Set default spring.activiti.caffeine.spec for activiti-cloud-starter-…
igdianov Dec 18, 2024
c801bcb
Add temporary logging for cache stats
igdianov Dec 17, 2024
587b5d4
Add engine cache configuration integration test
igdianov Dec 18, 2024
2d19e9f
Update EngineConfigurationIT process definition cache tests
igdianov Dec 19, 2024
400f07d
update activiti.version to 0.0.1-PR-4864-856-SNAPSHOT
igdianov Dec 19, 2024
9ff0b2a
update activiti.version to 0.0.1-PR-4864-857-SNAPSHOT
igdianov Dec 19, 2024
11e0475
update activiti.version to 0.0.1-PR-4864-859-SNAPSHOT
igdianov Dec 19, 2024
cf600d5
Add process definitions cache limit test coverage
igdianov Dec 19, 2024
80dc5c7
update activiti.version to 0.0.1-PR-4864-861-SNAPSHOT
igdianov Dec 20, 2024
cafb7b6
Cleanup SecurityTestConfiguration
igdianov Dec 23, 2024
a2c8558
Revert "Add temporary logging for cache stats"
igdianov Dec 23, 2024
22a7d0f
update activiti.version to 0.0.1-PR-4864-871-SNAPSHOT
igdianov Dec 23, 2024
089a779
remove public modifier from EngineConfigurationIT Junit4 tests
igdianov Jan 2, 2025
500730b
chore(deps): upgrade Activiti/Activiti to version 8.7.0-alpha.48
igdianov Jan 2, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion activiti-cloud-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<name>Activiti Cloud :: Runtime API Parent</name>
<packaging>pom</packaging>
<properties>
<activiti.version>8.7.0-alpha.47</activiti.version>
<activiti.version>8.7.0-alpha.48</activiti.version>
</properties>
<modules>
<module>activiti-cloud-api-dependencies</module>
Expand Down
2 changes: 1 addition & 1 deletion activiti-cloud-query-service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<module>activiti-cloud-starter-query-rest</module>
</modules>
<properties>
<activiti.version>8.7.0-alpha.47</activiti.version>
<activiti.version>8.7.0-alpha.48</activiti.version>
</properties>
<!-- BoM Marker Dependencies -->
<dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
import org.activiti.image.ProcessDiagramGenerator;
import org.activiti.image.impl.DefaultProcessDiagramGenerator;
import org.activiti.runtime.api.model.impl.APIProcessDefinitionConverter;
import org.activiti.spring.process.CachingProcessExtensionService;
import org.activiti.spring.process.ProcessExtensionService;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
Expand Down Expand Up @@ -279,9 +279,9 @@ public ProcessVariablesPayloadConverter processVariablesPayloadConverter(
@Bean
@ConditionalOnMissingBean
public ProcessDefinitionVariablesDecorator processDefinitionVariablesDecorator(
CachingProcessExtensionService cachingProcessExtensionService
ProcessExtensionService processExtensionService
) {
return new ProcessDefinitionVariablesDecorator(cachingProcessExtensionService);
return new ProcessDefinitionVariablesDecorator(processExtensionService);
}

@Bean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@
import java.util.stream.Collectors;
import org.activiti.api.runtime.model.impl.VariableDefinitionImpl;
import org.activiti.cloud.api.process.model.ExtendedCloudProcessDefinition;
import org.activiti.spring.process.CachingProcessExtensionService;
import org.activiti.spring.process.ProcessExtensionService;
import org.activiti.spring.process.model.VariableDefinition;

public class ProcessDefinitionVariablesDecorator implements ProcessDefinitionDecorator {

private static final String HANDLED_VALUE = "variables";

private final CachingProcessExtensionService processExtensionService;
private final ProcessExtensionService processExtensionService;

public ProcessDefinitionVariablesDecorator(CachingProcessExtensionService processExtensionService) {
public ProcessDefinitionVariablesDecorator(ProcessExtensionService processExtensionService) {
this.processExtensionService = processExtensionService;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import java.util.Map;
import org.activiti.cloud.api.process.model.ExtendedCloudProcessDefinition;
import org.activiti.cloud.api.process.model.impl.CloudProcessDefinitionImpl;
import org.activiti.spring.process.CachingProcessExtensionService;
import org.activiti.spring.process.ProcessExtensionService;
import org.activiti.spring.process.model.Extension;
import org.activiti.spring.process.model.VariableDefinition;
import org.junit.jupiter.api.Test;
Expand All @@ -39,7 +39,7 @@ class ProcessDefinitionVariablesDecoratorTest {
private ProcessDefinitionVariablesDecorator processDefinitionVariablesDecorator;

@Mock
private CachingProcessExtensionService processExtensionService;
private ProcessExtensionService processExtensionService;

@ParameterizedTest
@CsvSource({ "variables, true", "VARIABLES, true", "else, false" })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
import org.activiti.engine.ManagementService;
import org.activiti.engine.RuntimeService;
import org.activiti.engine.impl.context.Context;
import org.activiti.spring.process.CachingProcessExtensionService;
import org.activiti.spring.process.ProcessExtensionService;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
Expand Down Expand Up @@ -351,7 +351,7 @@ public CloudProcessUpdatedProducer cloudProcessUpdatedProducer(
@ConditionalOnMissingBean
public ToCloudVariableEventConverter cloudVariableEventConverter(
RuntimeBundleInfoAppender runtimeBundleInfoAppender,
CachingProcessExtensionService processExtensionService
ProcessExtensionService processExtensionService
) {
return new ToCloudVariableEventConverter(runtimeBundleInfoAppender, processExtensionService);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,17 @@
import org.activiti.cloud.api.model.shared.impl.events.CloudVariableDeletedEventImpl;
import org.activiti.cloud.api.model.shared.impl.events.CloudVariableUpdatedEventImpl;
import org.activiti.core.common.model.connector.VariableDefinition;
import org.activiti.spring.process.CachingProcessExtensionService;
import org.activiti.spring.process.ProcessExtensionService;
import org.activiti.spring.process.model.Extension;

public class ToCloudVariableEventConverter {

private final RuntimeBundleInfoAppender runtimeBundleInfoAppender;
private final CachingProcessExtensionService processExtensionService;
private final ProcessExtensionService processExtensionService;

public ToCloudVariableEventConverter(
RuntimeBundleInfoAppender runtimeBundleInfoAppender,
CachingProcessExtensionService processExtensionService
ProcessExtensionService processExtensionService
) {
this.runtimeBundleInfoAppender = runtimeBundleInfoAppender;
this.processExtensionService = processExtensionService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import org.activiti.api.runtime.model.impl.VariableInstanceImpl;
import org.activiti.cloud.api.model.shared.events.CloudVariableCreatedEvent;
import org.activiti.cloud.api.model.shared.impl.events.CloudVariableCreatedEventImpl;
import org.activiti.spring.process.CachingProcessExtensionService;
import org.activiti.spring.process.ProcessExtensionService;
import org.activiti.spring.process.model.Extension;
import org.activiti.spring.process.model.VariableDefinition;
import org.junit.jupiter.api.Test;
Expand All @@ -45,7 +45,7 @@ class ToCloudVariableEventConverterTest {
private RuntimeBundleInfoAppender runtimeBundleInfoAppender;

@Mock
private CachingProcessExtensionService processExtensionService;
private ProcessExtensionService processExtensionService;

@Test
void should_returnNull_whenPropertiesAreEmpty() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
import org.activiti.engine.ActivitiException;
import org.activiti.engine.RepositoryService;
import org.activiti.engine.impl.util.IoUtil;
import org.activiti.spring.process.CachingProcessExtensionService;
import org.activiti.spring.process.ProcessExtensionService;
import org.activiti.spring.process.model.Extension;
import org.activiti.spring.process.model.Mapping.SourceMappingType;
import org.activiti.spring.process.model.ProcessConstantsMapping;
Expand Down Expand Up @@ -94,7 +94,7 @@ public class ProcessDefinitionControllerImpl implements ProcessDefinitionControl

private final ProcessDefinitionService processDefinitionService;

private final CachingProcessExtensionService cachingProcessExtensionService;
private final ProcessExtensionService processExtensionService;

@Autowired
public ProcessDefinitionControllerImpl(
Expand All @@ -106,7 +106,7 @@ public ProcessDefinitionControllerImpl(
AlfrescoPagedModelAssembler<ProcessDefinition> pagedCollectionModelAssembler,
SpringPageConverter pageConverter,
ProcessDefinitionService processDefinitionService,
CachingProcessExtensionService cachingProcessExtensionService
ProcessExtensionService processExtensionService
) {
this.repositoryService = repositoryService;
this.processDiagramGenerator = processDiagramGenerator;
Expand All @@ -117,7 +117,7 @@ public ProcessDefinitionControllerImpl(
this.pagedCollectionModelAssembler = pagedCollectionModelAssembler;
this.pageConverter = pageConverter;
this.processDefinitionService = processDefinitionService;
this.cachingProcessExtensionService = cachingProcessExtensionService;
this.processExtensionService = processExtensionService;
}

@Override
Expand Down Expand Up @@ -242,7 +242,7 @@ private ExtensionsStartEventId getProcessExtensionsForStartEvent(String id, bool
if (startEvent.isPresent()) {
return new ExtensionsStartEventId(
startEvent.get().getId(),
cachingProcessExtensionService.getExtensionsForId(id)
processExtensionService.getExtensionsForId(id)
);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
import org.activiti.engine.RuntimeService;
import org.activiti.image.exception.ActivitiInterchangeInfoNotFoundException;
import org.activiti.runtime.api.query.impl.PageImpl;
import org.activiti.spring.process.CachingProcessExtensionService;
import org.activiti.spring.process.ProcessExtensionService;
import org.activiti.spring.process.conf.ProcessExtensionsAutoConfiguration;
import org.activiti.spring.process.model.ConstantDefinition;
import org.activiti.spring.process.model.Extension;
Expand Down Expand Up @@ -137,7 +137,7 @@ class ProcessDefinitionControllerImplIT {
private CloudProcessDeployedProducer processDeployedProducer;

@MockBean
private CachingProcessExtensionService cachingProcessExtensionService;
private ProcessExtensionService processExtensionService;

@MockBean
private SecurityContextPrincipalProvider securityContextPrincipalProvider;
Expand Down Expand Up @@ -258,7 +258,7 @@ void getProcessDefinitionsWithVariables() throws Exception {
givenVariableDefinition.setDisplayName("Var name");
extension.setProperties(Map.of("var1", givenVariableDefinition));

when(cachingProcessExtensionService.getExtensionsForId("procId")).thenReturn(extension);
when(processExtensionService.getExtensionsForId("procId")).thenReturn(extension);

mockMvc
.perform(
Expand Down Expand Up @@ -430,7 +430,7 @@ void should_getProcessModelStaticValuesMappingForStartEvent_when_hasStartEventFo
extension.setMappings(Map.of("startEvent", startEventMapping));
extension.setProperties(Map.of("variableRef", givenVariableDefinition));

when(cachingProcessExtensionService.getExtensionsForId("procId")).thenReturn(extension);
when(processExtensionService.getExtensionsForId("procId")).thenReturn(extension);

MvcResult result = mockMvc
.perform(get("/v1/process-definitions/{id}/static-values", procId).accept(APPLICATION_JSON))
Expand Down Expand Up @@ -492,7 +492,7 @@ void should_getEmptyMapForProcessModelStaticValuesMappingForStartEvent_when_star
extension.setMappings(Map.of("startEvent", startEventMapping));
extension.setProperties(Map.of("variableRef", givenVariableDefinition));

when(cachingProcessExtensionService.getExtensionsForId("procId")).thenReturn(extension);
when(processExtensionService.getExtensionsForId("procId")).thenReturn(extension);

MvcResult result = mockMvc
.perform(get("/v1/process-definitions/{id}/static-values", procId).accept(APPLICATION_JSON))
Expand Down Expand Up @@ -545,7 +545,7 @@ void should_getEmptyMapForProcessModelStaticValuesMappingForStartEvent_when_hasN
Extension extension = new Extension();
extension.setProperties(Map.of("variableRef", givenVariableDefinition));

when(cachingProcessExtensionService.getExtensionsForId("procId")).thenReturn(extension);
when(processExtensionService.getExtensionsForId("procId")).thenReturn(extension);

MvcResult result = mockMvc
.perform(get("/v1/process-definitions/{id}/static-values", procId).accept(APPLICATION_JSON))
Expand Down Expand Up @@ -606,7 +606,7 @@ void should_getEmptyMapForProcessModelStaticValuesMappingForStartEvent_when_hasN
extension.setMappings(Map.of("startEvent", startEventMapping));
extension.setProperties(Map.of("variableRef", givenVariableDefinition));

when(cachingProcessExtensionService.getExtensionsForId("procId")).thenReturn(extension);
when(processExtensionService.getExtensionsForId("procId")).thenReturn(extension);

MvcResult result = mockMvc
.perform(get("/v1/process-definitions/{id}/static-values", procId).accept(APPLICATION_JSON))
Expand Down Expand Up @@ -646,7 +646,7 @@ void should_getEmptyMapForProcessModelStaticValuesMappingForStartEvent_when_hasN
bpmnModel.getProcesses().add(process);
when(repositoryService.getBpmnModel(procId)).thenReturn(bpmnModel);

when(cachingProcessExtensionService.getExtensionsForId("procId")).thenReturn(null);
when(processExtensionService.getExtensionsForId("procId")).thenReturn(null);

MvcResult result = mockMvc
.perform(get("/v1/process-definitions/{id}/static-values", procId).accept(APPLICATION_JSON))
Expand Down Expand Up @@ -703,7 +703,7 @@ void should_getProcessModelConstantsForStartEvent_when_hasStartEventFormAndConst
Extension extension = new Extension();
extension.setConstants(Map.of("startEvent", givenConstantsDefinition));

when(cachingProcessExtensionService.getExtensionsForId("procId")).thenReturn(extension);
when(processExtensionService.getExtensionsForId("procId")).thenReturn(extension);

MvcResult result = mockMvc
.perform(get("/v1/process-definitions/{id}/constant-values", procId).accept(APPLICATION_JSON))
Expand Down Expand Up @@ -759,7 +759,7 @@ void should_getProcessModelConstantsForStartEvent_when_hasNoStartEventFormAndCon
Extension extension = new Extension();
extension.setConstants(Map.of("startEvent", givenConstantsDefinition));

when(cachingProcessExtensionService.getExtensionsForId("procId")).thenReturn(extension);
when(processExtensionService.getExtensionsForId("procId")).thenReturn(extension);

MvcResult result = mockMvc
.perform(get("/v1/process-definitions/{id}/constant-values", procId).accept(APPLICATION_JSON))
Expand Down Expand Up @@ -810,7 +810,7 @@ void should_getEmptyMapForProcessModelConstantsForStartEvent_when_startEventHasN

Extension extension = new Extension();

when(cachingProcessExtensionService.getExtensionsForId("procId")).thenReturn(extension);
when(processExtensionService.getExtensionsForId("procId")).thenReturn(extension);

MvcResult result = mockMvc
.perform(get("/v1/process-definitions/{id}/constant-values", procId).accept(APPLICATION_JSON))
Expand Down Expand Up @@ -862,7 +862,7 @@ void should_getEmptyMapForProcessModelConstantsMappingForStartEvent_when_hasForm

Extension extension = new Extension();

when(cachingProcessExtensionService.getExtensionsForId("procId")).thenReturn(extension);
when(processExtensionService.getExtensionsForId("procId")).thenReturn(extension);

MvcResult result = mockMvc
.perform(get("/v1/process-definitions/{id}/constant-values", procId).accept(APPLICATION_JSON))
Expand Down Expand Up @@ -913,7 +913,7 @@ void should_getEmptyMapForProcessModelConstantsMappingForStartEvent_when_hasNoSt
Extension extension = new Extension();
extension.setConstants(Map.of("startEvent", givenConstantsDefinition));

when(cachingProcessExtensionService.getExtensionsForId("procId")).thenReturn(extension);
when(processExtensionService.getExtensionsForId("procId")).thenReturn(extension);

MvcResult result = mockMvc
.perform(get("/v1/process-definitions/{id}/constant-values", procId).accept(APPLICATION_JSON))
Expand Down Expand Up @@ -962,7 +962,7 @@ void should_getEmptyMapForProcessModelConstantsMappingForStartEvent_when_hasNoEx
variableMapping.setType(SourceMappingType.VARIABLE);
startEventMapping.setInputs(Map.of("value", valueMapping, "variable", variableMapping));

when(cachingProcessExtensionService.getExtensionsForId("procId")).thenReturn(null);
when(processExtensionService.getExtensionsForId("procId")).thenReturn(null);

MvcResult result = mockMvc
.perform(get("/v1/process-definitions/{id}/constant-values", procId).accept(APPLICATION_JSON))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
import org.activiti.engine.ManagementService;
import org.activiti.engine.RepositoryService;
import org.activiti.engine.RuntimeService;
import org.activiti.spring.process.CachingProcessExtensionService;
import org.activiti.spring.process.ProcessExtensionService;
import org.activiti.spring.process.variable.VariableValidationService;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
Expand Down Expand Up @@ -117,7 +117,7 @@ class ProcessInstanceVariableControllerImplIT {
private CloudProcessDeployedProducer processDeployedProducer;

@MockBean
private CachingProcessExtensionService cachingProcessExtensionService;
private ProcessExtensionService processExtensionService;

@MockBean
private SecurityContextPrincipalProvider securityContextPrincipalProvider;
Expand All @@ -140,7 +140,7 @@ void setUp() {
assertThat(resourcesAssembler).isNotNull();
assertThat(processEngineChannels).isNotNull();
assertThat(processDeployedProducer).isNotNull();
assertThat(cachingProcessExtensionService).isNotNull();
assertThat(processExtensionService).isNotNull();
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ spring.activiti.deploymentMode=never-fail
spring.activiti.async-executor.default-async-job-acquire-wait-time-in-millis=5000
spring.activiti.async-executor.default-timer-job-acquire-wait-time-in-millis=5000

spring.activiti.process-definition-cache-name=processDefinitions
activiti.spring.cache-manager.caches.processDefinitions.caffeine.spec=maximumSize=${spring.activiti.process-definition-cache-limit:1000}, expireAfterAccess=10m, recordStats

#ensures that producer participates in the Spring transactions
spring.cloud.stream.rabbit.bindings.auditProducer.producer.transacted=${ACT_AUDIT_PRODUCER_TRANSACTED:true}
spring.cloud.stream.kafka.binder.transaction.transactionIdPrefix=${ACT_AUDIT_PRODUCER_TRANSACTION_ID_PREFIX:tx-}
Expand Down
Loading
Loading