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));
}
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()));
});
}
Aggregations