Search in sources :

Example 1 with CloudBPMNErrorReceivedEvent

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));
}
Also used : CloudRuntimeEventImpl(org.activiti.cloud.api.model.shared.impl.events.CloudRuntimeEventImpl) CloudBPMNErrorReceivedEvent(org.activiti.cloud.api.process.model.events.CloudBPMNErrorReceivedEvent) BPMNErrorReceivedEvent(org.activiti.api.process.model.events.BPMNErrorReceivedEvent) CloudBPMNErrorReceivedEvent(org.activiti.cloud.api.process.model.events.CloudBPMNErrorReceivedEvent) BPMNError(org.activiti.api.process.model.BPMNError) BPMNErrorReceivedEventImpl(org.activiti.api.runtime.event.impl.BPMNErrorReceivedEventImpl) Test(org.junit.jupiter.api.Test)

Example 2 with CloudBPMNErrorReceivedEvent

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);
}
Also used : CloudBPMNErrorReceivedEvent(org.activiti.cloud.api.process.model.events.CloudBPMNErrorReceivedEvent) BPMNErrorReceivedEvent(org.activiti.api.process.model.events.BPMNErrorReceivedEvent) CloudBPMNErrorReceivedEvent(org.activiti.cloud.api.process.model.events.CloudBPMNErrorReceivedEvent) CloudBPMNErrorReceivedEventImpl(org.activiti.cloud.api.process.model.impl.events.CloudBPMNErrorReceivedEventImpl) BPMNErrorReceivedEventImpl(org.activiti.api.runtime.event.impl.BPMNErrorReceivedEventImpl) CloudBPMNErrorReceivedEventImpl(org.activiti.cloud.api.process.model.impl.events.CloudBPMNErrorReceivedEventImpl) BPMNErrorImpl(org.activiti.api.runtime.model.impl.BPMNErrorImpl) Test(org.junit.jupiter.api.Test)

Example 3 with CloudBPMNErrorReceivedEvent

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()));
    });
}
Also used : DirtiesContext(org.springframework.test.annotation.DirtiesContext) CloudMessageSubscriptionCancelledEvent(org.activiti.cloud.api.process.model.events.CloudMessageSubscriptionCancelledEvent) BeforeEach(org.junit.jupiter.api.BeforeEach) Arrays(java.util.Arrays) CloudTaskCreatedEventImpl(org.activiti.cloud.api.task.model.impl.events.CloudTaskCreatedEventImpl) IgnoredRuntimeEvent(org.activiti.cloud.api.model.shared.impl.conf.IgnoredRuntimeEvent) Task(org.activiti.api.task.model.Task) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) CloudRuntimeEvent(org.activiti.cloud.api.model.shared.events.CloudRuntimeEvent) CloudProcessStartedEventImpl(org.activiti.cloud.api.process.model.impl.events.CloudProcessStartedEventImpl) CloudProcessCompletedEventImpl(org.activiti.cloud.api.process.model.impl.events.CloudProcessCompletedEventImpl) CloudTaskCandidateUserAddedEventImpl(org.activiti.cloud.api.task.model.impl.events.CloudTaskCandidateUserAddedEventImpl) Autowired(org.springframework.beans.factory.annotation.Autowired) BPMNTimerEvent(org.activiti.api.process.model.events.BPMNTimerEvent) PagedResources(org.springframework.hateoas.PagedResources) Map(java.util.Map) BPMNErrorReceivedEvent(org.activiti.api.process.model.events.BPMNErrorReceivedEvent) CloudIntegrationErrorReceivedEventImpl(org.activiti.cloud.api.process.model.impl.events.CloudIntegrationErrorReceivedEventImpl) Awaitility.await(org.awaitility.Awaitility.await) CloudIntegrationResultReceivedEventImpl(org.activiti.cloud.api.process.model.impl.events.CloudIntegrationResultReceivedEventImpl) IntegrationContextImpl(org.activiti.api.runtime.model.impl.IntegrationContextImpl) BPMNTimerImpl(org.activiti.api.runtime.model.impl.BPMNTimerImpl) Collection(java.util.Collection) TaskImpl(org.activiti.api.task.model.impl.TaskImpl) CloudBPMNSignalReceivedEventImpl(org.activiti.cloud.api.process.model.impl.events.CloudBPMNSignalReceivedEventImpl) CloudTaskAssignedEventImpl(org.activiti.cloud.api.task.model.impl.events.CloudTaskAssignedEventImpl) BPMNActivityEvent(org.activiti.api.process.model.events.BPMNActivityEvent) CloudProcessCancelledEventImpl(org.activiti.cloud.api.process.model.impl.events.CloudProcessCancelledEventImpl) TestPropertySource(org.springframework.test.context.TestPropertySource) UUID(java.util.UUID) MessageSubscriptionCancelledEvent(org.activiti.api.process.model.events.MessageSubscriptionCancelledEvent) Test(org.junit.jupiter.api.Test) List(java.util.List) CloudRuntimeEventImpl(org.activiti.cloud.api.model.shared.impl.events.CloudRuntimeEventImpl) CloudProcessSuspendedEventImpl(org.activiti.cloud.api.process.model.impl.events.CloudProcessSuspendedEventImpl) CloudTaskCompletedEventImpl(org.activiti.cloud.api.task.model.impl.events.CloudTaskCompletedEventImpl) CloudBPMNErrorReceivedEvent(org.activiti.cloud.api.process.model.events.CloudBPMNErrorReceivedEvent) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) ProcessDefinitionImpl(org.activiti.api.runtime.model.impl.ProcessDefinitionImpl) ProcessInstanceImpl(org.activiti.api.runtime.model.impl.ProcessInstanceImpl) CloudBPMNActivityEvent(org.activiti.cloud.api.process.model.events.CloudBPMNActivityEvent) CloudBPMNActivityCompletedEventImpl(org.activiti.cloud.api.process.model.impl.events.CloudBPMNActivityCompletedEventImpl) TaskCandidateUserEvent(org.activiti.api.task.model.events.TaskCandidateUserEvent) EventsRepository(org.activiti.cloud.services.audit.jpa.repository.EventsRepository) BPMNSignalImpl(org.activiti.api.runtime.model.impl.BPMNSignalImpl) CloudProcessDeployedEventImpl(org.activiti.cloud.api.process.model.impl.events.CloudProcessDeployedEventImpl) TaskCandidateUserImpl(org.activiti.api.task.model.impl.TaskCandidateUserImpl) CloudTaskCancelledEvent(org.activiti.cloud.api.task.model.events.CloudTaskCancelledEvent) HashMap(java.util.HashMap) ProcessPayloadBuilder(org.activiti.api.process.model.builders.ProcessPayloadBuilder) CloudTaskCancelledEventImpl(org.activiti.cloud.api.task.model.impl.events.CloudTaskCancelledEventImpl) ArrayList(java.util.ArrayList) SignalPayload(org.activiti.api.process.model.payloads.SignalPayload) CloudTaskCreatedEvent(org.activiti.cloud.api.task.model.events.CloudTaskCreatedEvent) CloudIntegrationRequestedEventImpl(org.activiti.cloud.api.process.model.impl.events.CloudIntegrationRequestedEventImpl) CloudTaskCandidateUserRemovedEventImpl(org.activiti.cloud.api.task.model.impl.events.CloudTaskCandidateUserRemovedEventImpl) TaskRuntimeEvent(org.activiti.api.task.model.events.TaskRuntimeEvent) CloudBPMNTimerScheduledEvent(org.activiti.cloud.api.process.model.events.CloudBPMNTimerScheduledEvent) CloudBPMNSignalReceivedEvent(org.activiti.cloud.api.process.model.events.CloudBPMNSignalReceivedEvent) CloudProcessUpdatedEventImpl(org.activiti.cloud.api.process.model.impl.events.CloudProcessUpdatedEventImpl) MyProducer(org.activiti.cloud.starters.test.MyProducer) Assertions.tuple(org.assertj.core.api.Assertions.tuple) CloudBPMNActivityStartedEvent(org.activiti.cloud.api.process.model.events.CloudBPMNActivityStartedEvent) Import(org.springframework.context.annotation.Import) BPMNActivityImpl(org.activiti.api.runtime.model.impl.BPMNActivityImpl) CloudBPMNActivityCancelledEventImpl(org.activiti.cloud.api.process.model.impl.events.CloudBPMNActivityCancelledEventImpl) TimerPayload(org.activiti.api.process.model.payloads.TimerPayload) BPMNErrorImpl(org.activiti.api.runtime.model.impl.BPMNErrorImpl) CloudTaskAssignedEvent(org.activiti.cloud.api.task.model.events.CloudTaskAssignedEvent) CloudTaskUpdatedEventImpl(org.activiti.cloud.api.task.model.impl.events.CloudTaskUpdatedEventImpl) CloudBPMNActivityStartedEventImpl(org.activiti.cloud.api.process.model.impl.events.CloudBPMNActivityStartedEventImpl) CloudBPMNTimerScheduledEventImpl(org.activiti.cloud.api.process.model.impl.events.CloudBPMNTimerScheduledEventImpl) CloudBPMNErrorReceivedEventImpl(org.activiti.cloud.api.process.model.impl.events.CloudBPMNErrorReceivedEventImpl) CloudBPMNTimerFiredEventImpl(org.activiti.cloud.api.process.model.impl.events.CloudBPMNTimerFiredEventImpl) ResponseEntity(org.springframework.http.ResponseEntity) MessageSubscriptionImpl(org.activiti.api.runtime.model.impl.MessageSubscriptionImpl) Collections(java.util.Collections) CloudMessageSubscriptionCancelledEventImpl(org.activiti.cloud.api.process.model.impl.events.CloudMessageSubscriptionCancelledEventImpl) HashMap(java.util.HashMap) PagedResources(org.springframework.hateoas.PagedResources) ArrayList(java.util.ArrayList) CloudRuntimeEvent(org.activiti.cloud.api.model.shared.events.CloudRuntimeEvent) CloudBPMNErrorReceivedEventImpl(org.activiti.cloud.api.process.model.impl.events.CloudBPMNErrorReceivedEventImpl) BPMNErrorImpl(org.activiti.api.runtime.model.impl.BPMNErrorImpl) Test(org.junit.jupiter.api.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Aggregations

BPMNErrorReceivedEvent (org.activiti.api.process.model.events.BPMNErrorReceivedEvent)3 CloudBPMNErrorReceivedEvent (org.activiti.cloud.api.process.model.events.CloudBPMNErrorReceivedEvent)3 BPMNErrorReceivedEventImpl (org.activiti.api.runtime.event.impl.BPMNErrorReceivedEventImpl)2 BPMNErrorImpl (org.activiti.api.runtime.model.impl.BPMNErrorImpl)2 CloudRuntimeEventImpl (org.activiti.cloud.api.model.shared.impl.events.CloudRuntimeEventImpl)2 Test (org.junit.jupiter.api.Test)2 ArrayList (java.util.ArrayList)1 Arrays (java.util.Arrays)1 Collection (java.util.Collection)1 Collections (java.util.Collections)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1 UUID (java.util.UUID)1 BPMNError (org.activiti.api.process.model.BPMNError)1 ProcessPayloadBuilder (org.activiti.api.process.model.builders.ProcessPayloadBuilder)1 BPMNActivityEvent (org.activiti.api.process.model.events.BPMNActivityEvent)1 BPMNTimerEvent (org.activiti.api.process.model.events.BPMNTimerEvent)1 MessageSubscriptionCancelledEvent (org.activiti.api.process.model.events.MessageSubscriptionCancelledEvent)1 SignalPayload (org.activiti.api.process.model.payloads.SignalPayload)1