Skip to content

Commit

Permalink
2128 Initial work around conformance tests (Activiti#2232)
Browse files Browse the repository at this point in the history
Initial work on conformance tests at the spring boot app level:
Fixes Activiti#2128
  • Loading branch information
salaboy authored and erdemedeiros committed Dec 4, 2018
1 parent 4a27b78 commit 9c1c486
Show file tree
Hide file tree
Showing 51 changed files with 3,361 additions and 139 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,9 @@ public ProcessCompletedImpl(ProcessInstance entity) {
public ProcessEvents getEventType() {
return ProcessEvents.PROCESS_COMPLETED;
}

@Override
public String toString() {
return "ProcessCompletedEventImpl{" + super.toString() + '}';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,13 @@ public String getNestedProcessInstanceId() {
public ProcessEvents getEventType() {
return ProcessEvents.PROCESS_STARTED;
}

@Override
public String toString() {
return "ProcessStartedEventImpl{" +
super.toString() +
"nestedProcessDefinitionId='" + nestedProcessDefinitionId + '\'' +
", nestedProcessInstanceId='" + nestedProcessInstanceId + '\'' +
'}';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,18 @@

import java.util.Optional;

import org.activiti.api.process.model.events.SequenceFlowTakenEvent;
import org.activiti.api.runtime.event.impl.SequenceFlowTakenImpl;
import org.activiti.api.process.model.events.BPMNSequenceFlowTakenEvent;
import org.activiti.api.runtime.event.impl.BPMNSequenceFlowTakenImpl;
import org.activiti.api.runtime.model.impl.BPMNSequenceFlowImpl;
import org.activiti.engine.delegate.event.ActivitiSequenceFlowTakenEvent;

public class ToSequenceFlowTakenConverter implements EventConverter<SequenceFlowTakenEvent, ActivitiSequenceFlowTakenEvent>{
public class ToSequenceFlowTakenConverter implements EventConverter<BPMNSequenceFlowTakenEvent, ActivitiSequenceFlowTakenEvent>{

@Override
public Optional<SequenceFlowTakenEvent> from(ActivitiSequenceFlowTakenEvent internalEvent) {
public Optional<BPMNSequenceFlowTakenEvent> from(ActivitiSequenceFlowTakenEvent internalEvent) {
BPMNSequenceFlowImpl sequenceFlow = new BPMNSequenceFlowImpl(internalEvent.getId(),
internalEvent.getSourceActivityId(),
internalEvent.getTargetActivityId());

internalEvent.getSourceActivityId(),
internalEvent.getTargetActivityId());

sequenceFlow.setProcessDefinitionId(internalEvent.getProcessDefinitionId());
sequenceFlow.setProcessInstanceId(internalEvent.getProcessInstanceId());
Expand All @@ -39,7 +38,7 @@ public Optional<SequenceFlowTakenEvent> from(ActivitiSequenceFlowTakenEvent inte
sequenceFlow.setTargetActivityName(internalEvent.getTargetActivityName());
sequenceFlow.setTargetActivityType(internalEvent.getTargetActivityType());

SequenceFlowTakenImpl sequenceFlowTaken = new SequenceFlowTakenImpl(sequenceFlow);
BPMNSequenceFlowTakenImpl sequenceFlowTaken = new BPMNSequenceFlowTakenImpl(sequenceFlow);
sequenceFlowTaken.setProcessInstanceId(internalEvent.getProcessInstanceId());
sequenceFlowTaken.setProcessDefinitionId(internalEvent.getProcessDefinitionId());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,19 @@
import java.util.List;

import org.activiti.api.process.model.events.BPMNActivityCancelledEvent;
import org.activiti.api.process.runtime.events.listener.ProcessRuntimeEventListener;
import org.activiti.api.process.runtime.events.listener.BPMNElementEventListener;
import org.activiti.engine.delegate.event.ActivitiActivityEvent;
import org.activiti.engine.delegate.event.ActivitiEvent;
import org.activiti.engine.delegate.event.ActivitiEventListener;
import org.activiti.runtime.api.event.impl.ToActivityCancelledConverter;

public class ActivityCancelledListenerDelegate implements ActivitiEventListener {

private List<ProcessRuntimeEventListener<BPMNActivityCancelledEvent>> processRuntimeEventListeners;
private List<BPMNElementEventListener<BPMNActivityCancelledEvent>> processRuntimeEventListeners;

private ToActivityCancelledConverter converter;

public ActivityCancelledListenerDelegate(List<ProcessRuntimeEventListener<BPMNActivityCancelledEvent>> processRuntimeEventListeners,
public ActivityCancelledListenerDelegate(List<BPMNElementEventListener<BPMNActivityCancelledEvent>> processRuntimeEventListeners,
ToActivityCancelledConverter converter) {
this.processRuntimeEventListeners = processRuntimeEventListeners;
this.converter = converter;
Expand All @@ -42,7 +42,7 @@ public void onEvent(ActivitiEvent event) {
if (event instanceof ActivitiActivityEvent) {
converter.from((ActivitiActivityEvent) event)
.ifPresent(convertedEvent -> {
for (ProcessRuntimeEventListener<BPMNActivityCancelledEvent> listener : processRuntimeEventListeners) {
for (BPMNElementEventListener<BPMNActivityCancelledEvent> listener : processRuntimeEventListeners) {
listener.onEvent(convertedEvent);
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import java.util.List;

import org.activiti.api.process.model.events.BPMNActivityCompletedEvent;
import org.activiti.api.process.runtime.events.listener.BPMNElementEventListener;
import org.activiti.api.process.runtime.events.listener.ProcessRuntimeEventListener;
import org.activiti.engine.delegate.event.ActivitiActivityEvent;
import org.activiti.engine.delegate.event.ActivitiEvent;
Expand All @@ -27,11 +28,11 @@

public class ActivityCompletedListenerDelegate implements ActivitiEventListener {

private List<ProcessRuntimeEventListener<BPMNActivityCompletedEvent>> processRuntimeEventListeners;
private List<BPMNElementEventListener<BPMNActivityCompletedEvent>> processRuntimeEventListeners;

private ToActivityCompletedConverter converter;

public ActivityCompletedListenerDelegate(List<ProcessRuntimeEventListener<BPMNActivityCompletedEvent>> processRuntimeEventListeners,
public ActivityCompletedListenerDelegate(List<BPMNElementEventListener<BPMNActivityCompletedEvent>> processRuntimeEventListeners,
ToActivityCompletedConverter converter) {
this.processRuntimeEventListeners = processRuntimeEventListeners;
this.converter = converter;
Expand All @@ -42,7 +43,7 @@ public void onEvent(ActivitiEvent event) {
if (event instanceof ActivitiActivityEvent) {
converter.from((ActivitiActivityEvent) event)
.ifPresent(convertedEvent -> {
for (ProcessRuntimeEventListener<BPMNActivityCompletedEvent> listener : processRuntimeEventListeners) {
for (BPMNElementEventListener<BPMNActivityCompletedEvent> listener : processRuntimeEventListeners) {
listener.onEvent(convertedEvent);
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,19 @@
import java.util.List;

import org.activiti.api.process.model.events.BPMNActivityStartedEvent;
import org.activiti.api.process.runtime.events.listener.ProcessRuntimeEventListener;
import org.activiti.api.process.runtime.events.listener.BPMNElementEventListener;
import org.activiti.engine.delegate.event.ActivitiActivityEvent;
import org.activiti.engine.delegate.event.ActivitiEvent;
import org.activiti.engine.delegate.event.ActivitiEventListener;
import org.activiti.runtime.api.event.impl.ToActivityStartedConverter;

public class ActivityStartedListenerDelegate implements ActivitiEventListener {

private List<ProcessRuntimeEventListener<BPMNActivityStartedEvent>> processRuntimeEventListeners;
private List<BPMNElementEventListener<BPMNActivityStartedEvent>> processRuntimeEventListeners;

private ToActivityStartedConverter converter;

public ActivityStartedListenerDelegate(List<ProcessRuntimeEventListener<BPMNActivityStartedEvent>> processRuntimeEventListeners,
public ActivityStartedListenerDelegate(List<BPMNElementEventListener<BPMNActivityStartedEvent>> processRuntimeEventListeners,
ToActivityStartedConverter converter) {
this.processRuntimeEventListeners = processRuntimeEventListeners;
this.converter = converter;
Expand All @@ -42,7 +42,7 @@ public void onEvent(ActivitiEvent event) {
if (event instanceof ActivitiActivityEvent) {
converter.from((ActivitiActivityEvent) event)
.ifPresent(convertedEvent -> {
for (ProcessRuntimeEventListener<BPMNActivityStartedEvent> listener : processRuntimeEventListeners) {
for (BPMNElementEventListener<BPMNActivityStartedEvent> listener : processRuntimeEventListeners) {
listener.onEvent(convertedEvent);
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,20 @@

import java.util.List;

import org.activiti.api.process.model.events.SequenceFlowTakenEvent;
import org.activiti.api.process.runtime.events.listener.ProcessRuntimeEventListener;
import org.activiti.api.process.model.events.BPMNSequenceFlowTakenEvent;
import org.activiti.api.process.runtime.events.listener.BPMNElementEventListener;
import org.activiti.engine.delegate.event.ActivitiEvent;
import org.activiti.engine.delegate.event.ActivitiEventListener;
import org.activiti.engine.delegate.event.ActivitiSequenceFlowTakenEvent;
import org.activiti.runtime.api.event.impl.ToSequenceFlowTakenConverter;

public class SequenceFlowTakenListenerDelegate implements ActivitiEventListener {

private List<ProcessRuntimeEventListener<SequenceFlowTakenEvent>> listeners;
private List<BPMNElementEventListener<BPMNSequenceFlowTakenEvent>> listeners;

private ToSequenceFlowTakenConverter converter;

public SequenceFlowTakenListenerDelegate(List<ProcessRuntimeEventListener<SequenceFlowTakenEvent>> listeners,
public SequenceFlowTakenListenerDelegate(List<BPMNElementEventListener<BPMNSequenceFlowTakenEvent>> listeners,
ToSequenceFlowTakenConverter converter) {
this.listeners = listeners;
this.converter = converter;
Expand All @@ -42,7 +42,7 @@ public void onEvent(ActivitiEvent event) {
if (event instanceof ActivitiSequenceFlowTakenEvent) {
converter.from((ActivitiSequenceFlowTakenEvent) event)
.ifPresent(convertedEvent -> {
for (ProcessRuntimeEventListener<SequenceFlowTakenEvent> listener : listeners) {
for (BPMNElementEventListener<BPMNSequenceFlowTakenEvent> listener : listeners) {
listener.onEvent(convertedEvent);
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import org.activiti.api.process.model.events.BPMNActivityCancelledEvent;
import org.activiti.api.process.model.events.BPMNActivityCompletedEvent;
import org.activiti.api.process.model.events.BPMNActivityStartedEvent;
import org.activiti.api.process.model.events.SequenceFlowTakenEvent;
import org.activiti.api.process.model.events.BPMNSequenceFlowTakenEvent;
import org.activiti.api.process.runtime.ProcessAdminRuntime;
import org.activiti.api.process.runtime.ProcessRuntime;
import org.activiti.api.process.runtime.conf.ProcessRuntimeConfiguration;
Expand All @@ -33,6 +33,7 @@
import org.activiti.api.process.runtime.events.ProcessStartedEvent;
import org.activiti.api.process.runtime.events.ProcessSuspendedEvent;
import org.activiti.api.process.runtime.events.ProcessUpdatedEvent;
import org.activiti.api.process.runtime.events.listener.BPMNElementEventListener;
import org.activiti.api.process.runtime.events.listener.ProcessRuntimeEventListener;
import org.activiti.api.runtime.shared.events.VariableEventListener;
import org.activiti.core.common.spring.security.policies.ProcessSecurityPoliciesManager;
Expand Down Expand Up @@ -145,7 +146,7 @@ public ToAPIProcessCreatedEventConverter apiProcessCreatedEventConverter(APIProc
public ToProcessUpdatedConverter processUpdatedConverter(APIProcessInstanceConverter processInstanceConverter) {
return new ToProcessUpdatedConverter(processInstanceConverter);
}

@Bean
public ToProcessResumedConverter processResumedConverter(APIProcessInstanceConverter processInstanceConverter) {
return new ToProcessResumedConverter(processInstanceConverter);
Expand Down Expand Up @@ -177,7 +178,7 @@ public InitializingBean registerProcessCreatedEventListenerDelegate(RuntimeServi
converter),
ActivitiEventType.ENTITY_CREATED);
}

@Bean
public InitializingBean registerProcessUpdatedEventListenerDelegate(RuntimeService runtimeService,
@Autowired(required = false) List<ProcessRuntimeEventListener<ProcessUpdatedEvent>> eventListeners,
Expand Down Expand Up @@ -234,7 +235,7 @@ public ToActivityConverter activityConverter() {

@Bean
public InitializingBean registerActivityStartedListenerDelegate(RuntimeService runtimeService,
@Autowired(required = false) List<ProcessRuntimeEventListener<BPMNActivityStartedEvent>> eventListeners,
@Autowired(required = false) List<BPMNElementEventListener<BPMNActivityStartedEvent>> eventListeners,
ToActivityConverter activityConverter) {
return () -> runtimeService.addEventListener(new ActivityStartedListenerDelegate(getInitializedListeners(eventListeners),
new ToActivityStartedConverter(activityConverter)),
Expand All @@ -243,7 +244,7 @@ public InitializingBean registerActivityStartedListenerDelegate(RuntimeService r

@Bean
public InitializingBean registerActivityCompletedListenerDelegate(RuntimeService runtimeService,
@Autowired(required = false) List<ProcessRuntimeEventListener<BPMNActivityCompletedEvent>> eventListeners,
@Autowired(required = false) List<BPMNElementEventListener<BPMNActivityCompletedEvent>> eventListeners,
ToActivityConverter activityConverter) {
return () -> runtimeService.addEventListener(new ActivityCompletedListenerDelegate(getInitializedListeners(eventListeners),
new ToActivityCompletedConverter(activityConverter)),
Expand All @@ -252,7 +253,7 @@ public InitializingBean registerActivityCompletedListenerDelegate(RuntimeService

@Bean
public InitializingBean registerActivityCancelledListenerDelegate(RuntimeService runtimeService,
@Autowired(required = false) List<ProcessRuntimeEventListener<BPMNActivityCancelledEvent>> eventListeners,
@Autowired(required = false) List<BPMNElementEventListener<BPMNActivityCancelledEvent>> eventListeners,
ToActivityConverter activityConverter) {
return () -> runtimeService.addEventListener(new ActivityCancelledListenerDelegate(getInitializedListeners(eventListeners),
new ToActivityCancelledConverter(activityConverter)),
Expand All @@ -261,7 +262,7 @@ public InitializingBean registerActivityCancelledListenerDelegate(RuntimeService

@Bean
public InitializingBean registerSequenceFlowTakenListenerDelegate(RuntimeService runtimeService,
@Autowired(required = false) List<ProcessRuntimeEventListener<SequenceFlowTakenEvent>> eventListeners) {
@Autowired(required = false) List<BPMNElementEventListener<BPMNSequenceFlowTakenEvent>> eventListeners) {
return () -> runtimeService.addEventListener(new SequenceFlowTakenListenerDelegate(getInitializedListeners(eventListeners),
new ToSequenceFlowTakenConverter()),
ActivitiEventType.SEQUENCEFLOW_TAKEN);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import org.activiti.runtime.api.event.impl.ToVariableDeletedConverter;
import org.activiti.runtime.api.event.impl.ToVariableUpdatedConverter;
import org.activiti.runtime.api.event.internal.VariableCreatedListenerDelegate;
import org.activiti.runtime.api.event.internal.VariableDeletedListenerDelegate;
import org.activiti.runtime.api.event.internal.VariableUpdatedListenerDelegate;
import org.activiti.runtime.api.model.impl.APIVariableInstanceConverter;
import org.springframework.beans.factory.InitializingBean;
Expand Down Expand Up @@ -62,10 +61,4 @@ public InitializingBean registerVariableUpdatedListenerDelegate(RuntimeService r
return () -> runtimeService.addEventListener(new VariableUpdatedListenerDelegate(getInitializedListeners(listeners), new ToVariableUpdatedConverter()), ActivitiEventType.VARIABLE_UPDATED);
}

@Bean
public InitializingBean registerVariableDeletedListenerDelegate(RuntimeService runtimeService,
@Autowired(required = false) List<VariableEventListener<VariableDeletedEvent>> listeners){
return () -> runtimeService.addEventListener(new VariableDeletedListenerDelegate(getInitializedListeners(listeners), new ToVariableDeletedConverter()), ActivitiEventType.VARIABLE_DELETED);
}

}

This file was deleted.

Loading

0 comments on commit 9c1c486

Please sign in to comment.