use of org.activiti.cloud.api.process.model.events.CloudBPMNErrorReceivedEvent in project activiti-cloud by Activiti.
the class ToCloudProcessRuntimeErrorEventsConverterTest method shouldConvertBPMNErrorReceivedEventToCloudBPMNErrorReceivedEvent.
@Test
public void shouldConvertBPMNErrorReceivedEventToCloudBPMNErrorReceivedEvent() {
BPMNError entity = bpmnErrorEntity("entityId");
BPMNErrorReceivedEvent runtimeEvent = new BPMNErrorReceivedEventImpl(entity);
CloudBPMNErrorReceivedEvent cloudEvent = converter.from(runtimeEvent);
assertThat(cloudEvent.getEntity()).isEqualTo(entity);
assertThat(cloudEvent.getProcessDefinitionId()).isEqualTo("procDefId");
assertThat(cloudEvent.getProcessInstanceId()).isEqualTo("procInstId");
verify(runtimeBundleInfoAppender).appendRuntimeBundleInfoTo(any(CloudRuntimeEventImpl.class));
}
use of org.activiti.cloud.api.process.model.events.CloudBPMNErrorReceivedEvent in project activiti-cloud by Activiti.
the class CloudErrorProducerTest method shouldConvertErrorReceivedEventToCloudEventAndAddToAggregator.
@Test
public void shouldConvertErrorReceivedEventToCloudEventAndAddToAggregator() {
BPMNErrorReceivedEvent eventFired = new BPMNErrorReceivedEventImpl(new BPMNErrorImpl());
CloudBPMNErrorReceivedEvent cloudEventFired = new CloudBPMNErrorReceivedEventImpl();
given(eventConverter.from(eventFired)).willReturn(cloudEventFired);
cloudErrorReceivedProducer.onEvent(eventFired);
verify(eventsAggregator).add(cloudEventFired);
}
use of org.activiti.cloud.api.process.model.events.CloudBPMNErrorReceivedEvent in project activiti-cloud by Activiti.
the class AuditServiceIT method shouldGetErrorReceivedEvent.
@Test
public void shouldGetErrorReceivedEvent() {
// given
List<CloudRuntimeEvent> coveredEvents = new ArrayList<>();
BPMNErrorImpl error = new BPMNErrorImpl("elementId");
error.setProcessDefinitionId("processDefinitionId");
error.setProcessInstanceId("processInstanceId");
error.setErrorCode("errorCode");
error.setErrorId("errorId");
CloudBPMNErrorReceivedEventImpl cloudErrorReceivedEvent = new CloudBPMNErrorReceivedEventImpl("eventId", System.currentTimeMillis(), error, error.getProcessDefinitionId(), error.getProcessInstanceId());
coveredEvents.add(cloudErrorReceivedEvent);
producer.send(coveredEvents.toArray(new CloudRuntimeEvent[coveredEvents.size()]));
await().untilAsserted(() -> {
// when
Map<String, Object> filters = new HashMap<>();
filters.put("eventType", BPMNErrorReceivedEvent.ErrorEvents.ERROR_RECEIVED.name());
ResponseEntity<PagedResources<CloudRuntimeEvent>> eventsPagedResources = eventsRestTemplate.executeFind(filters);
// then
Collection<CloudRuntimeEvent> retrievedEvents = eventsPagedResources.getBody().getContent();
assertThat(retrievedEvents).hasSize(1);
assertThat(retrievedEvents).extracting(CloudRuntimeEvent::getEventType, CloudRuntimeEvent::getServiceName, CloudRuntimeEvent::getServiceVersion, CloudRuntimeEvent::getProcessInstanceId, CloudRuntimeEvent::getProcessDefinitionId, CloudRuntimeEvent::getEntityId, event -> ((CloudBPMNErrorReceivedEvent) event).getEntity().getElementId(), event -> ((CloudBPMNErrorReceivedEvent) event).getEntity().getProcessInstanceId(), event -> ((CloudBPMNErrorReceivedEvent) event).getEntity().getProcessDefinitionId(), event -> ((CloudBPMNErrorReceivedEvent) event).getEntity().getErrorCode(), event -> ((CloudBPMNErrorReceivedEvent) event).getEntity().getErrorId()).contains(tuple(cloudErrorReceivedEvent.getEventType(), cloudErrorReceivedEvent.getServiceName(), cloudErrorReceivedEvent.getServiceVersion(), cloudErrorReceivedEvent.getProcessInstanceId(), cloudErrorReceivedEvent.getProcessDefinitionId(), cloudErrorReceivedEvent.getEntityId(), cloudErrorReceivedEvent.getEntity().getElementId(), cloudErrorReceivedEvent.getEntity().getProcessInstanceId(), cloudErrorReceivedEvent.getEntity().getProcessDefinitionId(), cloudErrorReceivedEvent.getEntity().getErrorCode(), cloudErrorReceivedEvent.getEntity().getErrorId()));
});
}
Aggregations