Search in sources :

Example 1 with CloudMessageSubscriptionCancelledEvent

use of org.activiti.cloud.api.process.model.events.CloudMessageSubscriptionCancelledEvent in project activiti-cloud by Activiti.

the class ToCloudProcessRuntimeMessageEventsConverterTest method shouldConvertMessageSubscriptionCancelledEventToCloudMessageSubscriptionCancelledEvent.

@Test
public void shouldConvertMessageSubscriptionCancelledEventToCloudMessageSubscriptionCancelledEvent() {
    // given
    MessageSubscription entity = MessageSubscriptionImpl.builder().withId("entityId").withEventName("messageName").withConfiguration("correlationKey").withProcessDefinitionId("procDefId").withProcessInstanceId("procInstId").withBusinessKey("businessKey").build();
    MessageSubscriptionCancelledEvent runtimeEvent = new MessageSubscriptionCancelledEventImpl(entity);
    // when
    CloudMessageSubscriptionCancelledEvent cloudEvent = converter.from(runtimeEvent);
    // then
    Assertions.assertThat(cloudEvent.getEntity()).isNotNull().isEqualTo(entity).extracting(MessageSubscription::getEventName, MessageSubscription::getConfiguration, MessageSubscription::getProcessDefinitionId, MessageSubscription::getProcessInstanceId, MessageSubscription::getBusinessKey).contains(entity.getEventName(), entity.getConfiguration(), entity.getProcessDefinitionId(), entity.getProcessInstanceId(), entity.getBusinessKey());
    verify(runtimeBundleInfoAppender).appendRuntimeBundleInfoTo(any(CloudRuntimeEventImpl.class));
}
Also used : MessageSubscription(org.activiti.api.process.model.MessageSubscription) CloudRuntimeEventImpl(org.activiti.cloud.api.model.shared.impl.events.CloudRuntimeEventImpl) CloudMessageSubscriptionCancelledEvent(org.activiti.cloud.api.process.model.events.CloudMessageSubscriptionCancelledEvent) MessageSubscriptionCancelledEvent(org.activiti.api.process.model.events.MessageSubscriptionCancelledEvent) CloudMessageSubscriptionCancelledEvent(org.activiti.cloud.api.process.model.events.CloudMessageSubscriptionCancelledEvent) MessageSubscriptionCancelledEventImpl(org.activiti.api.runtime.event.impl.MessageSubscriptionCancelledEventImpl) Test(org.junit.jupiter.api.Test)

Example 2 with CloudMessageSubscriptionCancelledEvent

use of org.activiti.cloud.api.process.model.events.CloudMessageSubscriptionCancelledEvent in project activiti-cloud by Activiti.

the class AuditServiceIT method shouldGetMessageSubscriptionCancelledEvent.

@Test
public void shouldGetMessageSubscriptionCancelledEvent() {
    // given
    List<CloudRuntimeEvent> coveredEvents = new ArrayList<>();
    MessageSubscriptionImpl messageSubscription = MessageSubscriptionImpl.builder().withId("entityId").withEventName("messageName").withConfiguration("correlationKey").withProcessDefinitionId("processDefinitionId").withProcessInstanceId("processInstanceId").withBusinessKey("businessKey").build();
    CloudMessageSubscriptionCancelledEventImpl cloudEvent = CloudMessageSubscriptionCancelledEventImpl.builder().withEntity(messageSubscription).build();
    coveredEvents.add(cloudEvent);
    producer.send(coveredEvents.toArray(new CloudRuntimeEvent[coveredEvents.size()]));
    await().untilAsserted(() -> {
        // when
        Map<String, Object> filters = new HashMap<>();
        filters.put("eventType", MessageSubscriptionCancelledEvent.MessageSubscriptionEvents.MESSAGE_SUBSCRIPTION_CANCELLED.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 -> ((CloudMessageSubscriptionCancelledEvent) event).getEntity().getId(), event -> ((CloudMessageSubscriptionCancelledEvent) event).getEntity().getProcessInstanceId(), event -> ((CloudMessageSubscriptionCancelledEvent) event).getEntity().getProcessDefinitionId(), event -> ((CloudMessageSubscriptionCancelledEvent) event).getEntity().getEventName(), event -> ((CloudMessageSubscriptionCancelledEvent) event).getEntity().getConfiguration(), event -> ((CloudMessageSubscriptionCancelledEvent) event).getEntity().getBusinessKey()).contains(tuple(cloudEvent.getEventType(), cloudEvent.getServiceName(), cloudEvent.getServiceVersion(), cloudEvent.getProcessInstanceId(), cloudEvent.getProcessDefinitionId(), cloudEvent.getEntityId(), cloudEvent.getEntity().getId(), cloudEvent.getEntity().getProcessInstanceId(), cloudEvent.getEntity().getProcessDefinitionId(), cloudEvent.getEntity().getEventName(), cloudEvent.getEntity().getConfiguration(), cloudEvent.getEntity().getBusinessKey()));
    });
}
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) CloudMessageSubscriptionCancelledEventImpl(org.activiti.cloud.api.process.model.impl.events.CloudMessageSubscriptionCancelledEventImpl) HashMap(java.util.HashMap) PagedResources(org.springframework.hateoas.PagedResources) ArrayList(java.util.ArrayList) MessageSubscriptionImpl(org.activiti.api.runtime.model.impl.MessageSubscriptionImpl) CloudRuntimeEvent(org.activiti.cloud.api.model.shared.events.CloudRuntimeEvent) Test(org.junit.jupiter.api.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Aggregations

MessageSubscriptionCancelledEvent (org.activiti.api.process.model.events.MessageSubscriptionCancelledEvent)2 CloudRuntimeEventImpl (org.activiti.cloud.api.model.shared.impl.events.CloudRuntimeEventImpl)2 CloudMessageSubscriptionCancelledEvent (org.activiti.cloud.api.process.model.events.CloudMessageSubscriptionCancelledEvent)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 MessageSubscription (org.activiti.api.process.model.MessageSubscription)1 ProcessPayloadBuilder (org.activiti.api.process.model.builders.ProcessPayloadBuilder)1 BPMNActivityEvent (org.activiti.api.process.model.events.BPMNActivityEvent)1 BPMNErrorReceivedEvent (org.activiti.api.process.model.events.BPMNErrorReceivedEvent)1 BPMNTimerEvent (org.activiti.api.process.model.events.BPMNTimerEvent)1 SignalPayload (org.activiti.api.process.model.payloads.SignalPayload)1 TimerPayload (org.activiti.api.process.model.payloads.TimerPayload)1 MessageSubscriptionCancelledEventImpl (org.activiti.api.runtime.event.impl.MessageSubscriptionCancelledEventImpl)1 BPMNActivityImpl (org.activiti.api.runtime.model.impl.BPMNActivityImpl)1