use of org.activiti.cloud.api.process.model.events.CloudBPMNActivityEvent in project activiti-cloud by Activiti.
the class AuditServiceIT method shouldBeAbleToFilterOnEventTypeActivitiStarted.
@Test
public void shouldBeAbleToFilterOnEventTypeActivitiStarted() {
// given
List<CloudRuntimeEvent> coveredEvents = getTestEvents();
producer.send(coveredEvents.toArray(new CloudRuntimeEvent[coveredEvents.size()]));
await().untilAsserted(() -> {
// when
ResponseEntity<PagedResources<CloudRuntimeEvent>> eventsPagedResources = eventsRestTemplate.executeFind(Collections.singletonMap("eventType", BPMNActivityEvent.ActivityEvents.ACTIVITY_STARTED.name()));
// then
Collection<CloudRuntimeEvent> retrievedEvents = eventsPagedResources.getBody().getContent();
assertThat(retrievedEvents).hasSize(3);
for (CloudRuntimeEvent event : retrievedEvents) {
CloudBPMNActivityEvent cloudBPMNActivityEvent = (CloudBPMNActivityStartedEvent) event;
assertThat(cloudBPMNActivityEvent.getEventType()).isEqualTo(BPMNActivityEvent.ActivityEvents.ACTIVITY_STARTED);
}
});
}
use of org.activiti.cloud.api.process.model.events.CloudBPMNActivityEvent in project activiti-cloud by Activiti.
the class AuditServiceIT method shouldBeAbleToFilterOnProcessInstanceIdAndEventType.
@Test
public void shouldBeAbleToFilterOnProcessInstanceIdAndEventType() {
// given
List<CloudRuntimeEvent> coveredEvents = getTestEvents();
producer.send(coveredEvents.toArray(new CloudRuntimeEvent[coveredEvents.size()]));
await().untilAsserted(() -> {
// when
Map<String, Object> filters = new HashMap<>();
filters.put("processInstanceId", "4");
filters.put("eventType", BPMNActivityEvent.ActivityEvents.ACTIVITY_STARTED.name());
ResponseEntity<PagedResources<CloudRuntimeEvent>> eventsPagedResources = eventsRestTemplate.executeFind(filters);
// then
Collection<CloudRuntimeEvent> retrievedEvents = eventsPagedResources.getBody().getContent();
assertThat(retrievedEvents).hasSize(2);
for (CloudRuntimeEvent event : retrievedEvents) {
CloudBPMNActivityEvent cloudBPMNActivityEvent = (CloudBPMNActivityStartedEvent) event;
assertThat(cloudBPMNActivityEvent.getEventType()).isEqualTo(BPMNActivityEvent.ActivityEvents.ACTIVITY_STARTED);
}
});
}
use of org.activiti.cloud.api.process.model.events.CloudBPMNActivityEvent in project activiti-cloud by Activiti.
the class AuditServiceIT method shouldBeAbleToFilterOnProcessInstanceId.
@Test
public void shouldBeAbleToFilterOnProcessInstanceId() {
// given
List<CloudRuntimeEvent> coveredEvents = getTestEvents();
producer.send(coveredEvents.toArray(new CloudRuntimeEvent[coveredEvents.size()]));
await().untilAsserted(() -> {
// when
ResponseEntity<PagedResources<CloudRuntimeEvent>> eventsPagedResources = eventsRestTemplate.executeFind(Collections.singletonMap("processInstanceId", "4"));
// then
Collection<CloudRuntimeEvent> retrievedEvents = eventsPagedResources.getBody().getContent();
assertThat(retrievedEvents).hasSize(2);
for (CloudRuntimeEvent event : retrievedEvents) {
CloudBPMNActivityEvent cloudBPMNActivityEvent = (CloudBPMNActivityEvent) event;
assertThat(cloudBPMNActivityEvent.getProcessInstanceId()).isEqualTo("4");
}
});
}
use of org.activiti.cloud.api.process.model.events.CloudBPMNActivityEvent in project activiti-cloud by Activiti.
the class BaseBPMNActivityEventHandler method findOrCreateBPMNActivityEntity.
protected BPMNActivityEntity findOrCreateBPMNActivityEntity(CloudRuntimeEvent<?, ?> event) {
CloudBPMNActivityEvent activityEvent = CloudBPMNActivityEvent.class.cast(event);
BPMNActivity bpmnActivity = activityEvent.getEntity();
BPMNActivityEntity bpmnActivityEntity = bpmnActivitiyRepository.findByProcessInstanceIdAndElementIdAndExecutionId(bpmnActivity.getProcessInstanceId(), bpmnActivity.getElementId(), bpmnActivity.getExecutionId());
if (bpmnActivityEntity == null) {
bpmnActivityEntity = new BPMNActivityEntity(event.getServiceName(), event.getServiceFullName(), event.getServiceVersion(), event.getAppName(), event.getAppVersion());
// Let use event id to persist activity id
bpmnActivityEntity.setId(event.getId());
bpmnActivityEntity.setElementId(bpmnActivity.getElementId());
bpmnActivityEntity.setActivityName(bpmnActivity.getActivityName());
bpmnActivityEntity.setActivityType(bpmnActivity.getActivityType());
bpmnActivityEntity.setProcessDefinitionId(bpmnActivity.getProcessDefinitionId());
bpmnActivityEntity.setProcessInstanceId(bpmnActivity.getProcessInstanceId());
bpmnActivityEntity.setExecutionId(bpmnActivity.getExecutionId());
bpmnActivityEntity.setProcessDefinitionKey(activityEvent.getProcessDefinitionKey());
bpmnActivityEntity.setProcessDefinitionVersion(activityEvent.getProcessDefinitionVersion());
bpmnActivityEntity.setBusinessKey(activityEvent.getBusinessKey());
entityManager.persist(bpmnActivityEntity);
}
return bpmnActivityEntity;
}
Aggregations