use of org.activiti.cloud.api.process.model.impl.events.CloudBPMNTimerCancelledEventImpl in project activiti-cloud by Activiti.
the class TimerEventConverterTest method checkConvertToEntityTimerCancelledEvent.
@Test
public void checkConvertToEntityTimerCancelledEvent() {
// given
CloudBPMNTimerCancelledEventImpl event = createTimerCancelledEvent();
// when
TimerCancelledAuditEventEntity auditEventEntity = (TimerCancelledAuditEventEntity) eventConverterTimerCancelled.convertToEntity(event);
// then
checkCloudAuditEvententity(auditEventEntity, event);
}
use of org.activiti.cloud.api.process.model.impl.events.CloudBPMNTimerCancelledEventImpl in project activiti-cloud by Activiti.
the class MapBuilder method testGraphqlSubscriptionCloudBPMNTimerEvents.
@Test
public void testGraphqlSubscriptionCloudBPMNTimerEvents() throws JsonProcessingException {
ReplayProcessor<String> data = ReplayProcessor.create();
keycloakTokenProducer.setKeycloakTestUser(TESTADMIN);
final String auth = keycloakTokenProducer.authorizationHeaders().getFirst(AUTHORIZATION);
Map<String, Object> variables = new StringObjectMapBuilder().put("appName", "default-app").put("eventTypes", Arrays.array("TIMER_SCHEDULED", "TIMER_FIRED", "TIMER_EXECUTED", "TIMER_CANCELLED", "TIMER_FAILED", "TIMER_RETRIES_DECREMENTED")).get();
Map<String, Object> payload = new StringObjectMapBuilder().put("query", "subscription($appName: String!, $eventTypes: [EngineEventType!]) { " + " engineEvents(appName: [$appName], eventType: $eventTypes) { " + " processInstanceId " + " processDefinitionId " + " entity " + " eventType " + " } " + "}").put("variables", variables).get();
GraphQLMessage start = GraphQLMessage.builder().type(GraphQLMessageType.START).id("1").payload(payload).build();
String startMessage = objectMapper.writeValueAsString(start);
// given
CloudBPMNTimerScheduledEvent event1 = new CloudBPMNTimerScheduledEventImpl("id", new Date().getTime(), new BPMNTimerImpl("timerId"), "processDefinitionId", "processInstanceId") {
{
setAppName("default-app");
setServiceName("rb-my-app");
setServiceFullName("serviceFullName");
setServiceType("runtime-bundle");
setServiceVersion("");
setProcessDefinitionId("processDefinitionId");
setProcessDefinitionKey("processDefinitionKey");
setProcessDefinitionVersion(1);
setBusinessKey("businessKey");
}
};
// given
CloudBPMNTimerFiredEvent event2 = new CloudBPMNTimerFiredEventImpl("id", new Date().getTime(), new BPMNTimerImpl("timerId"), "processDefinitionId", "processInstanceId") {
{
setAppName("default-app");
setServiceName("rb-my-app");
setServiceFullName("serviceFullName");
setServiceType("runtime-bundle");
setServiceVersion("");
setProcessDefinitionId("processDefinitionId");
setProcessDefinitionKey("processDefinitionKey");
setProcessDefinitionVersion(1);
setBusinessKey("businessKey");
}
};
// given
CloudBPMNTimerExecutedEvent event3 = new CloudBPMNTimerExecutedEventImpl("id", new Date().getTime(), new BPMNTimerImpl("timerId"), "processDefinitionId", "processInstanceId") {
{
setAppName("default-app");
setServiceName("rb-my-app");
setServiceFullName("serviceFullName");
setServiceType("runtime-bundle");
setServiceVersion("");
setProcessDefinitionId("processDefinitionId");
setProcessDefinitionKey("processDefinitionKey");
setProcessDefinitionVersion(1);
setBusinessKey("businessKey");
}
};
// given
CloudBPMNTimerCancelledEvent event4 = new CloudBPMNTimerCancelledEventImpl("id", new Date().getTime(), new BPMNTimerImpl("timerId"), "processDefinitionId", "processInstanceId") {
{
setAppName("default-app");
setServiceName("rb-my-app");
setServiceFullName("serviceFullName");
setServiceType("runtime-bundle");
setServiceVersion("");
setProcessDefinitionId("processDefinitionId");
setProcessDefinitionKey("processDefinitionKey");
setProcessDefinitionVersion(1);
setBusinessKey("businessKey");
}
};
// given
CloudBPMNTimerFailedEvent event5 = new CloudBPMNTimerFailedEventImpl("id", new Date().getTime(), new BPMNTimerImpl("timerId"), "processDefinitionId", "processInstanceId") {
{
setAppName("default-app");
setServiceName("rb-my-app");
setServiceFullName("serviceFullName");
setServiceType("runtime-bundle");
setServiceVersion("");
setProcessDefinitionId("processDefinitionId");
setProcessDefinitionKey("processDefinitionKey");
setProcessDefinitionVersion(1);
setBusinessKey("businessKey");
}
};
// given
CloudBPMNTimerRetriesDecrementedEvent event6 = new CloudBPMNTimerRetriesDecrementedEventImpl("id", new Date().getTime(), new BPMNTimerImpl("timerId"), "processDefinitionId", "processInstanceId") {
{
setAppName("default-app");
setServiceName("rb-my-app");
setServiceFullName("serviceFullName");
setServiceType("runtime-bundle");
setServiceVersion("");
setProcessDefinitionId("processDefinitionId");
setProcessDefinitionKey("processDefinitionKey");
setProcessDefinitionVersion(1);
setBusinessKey("businessKey");
}
};
WebsocketSender client = HttpClient.create().baseUrl("ws://localhost:" + port).wiretap(true).headers(h -> h.add(AUTHORIZATION, auth)).websocket(GRAPHQL_WS).uri(WS_GRAPHQL_URI);
// start subscription
client.handle((i, o) -> {
o.options(NettyPipeline.SendOptions::flushOnEach).sendString(Mono.just(startMessage)).then().log("start").subscribe();
return i.receive().asString().log("data").take(1).doOnSubscribe(s -> producerChannel.output().send(MessageBuilder.withPayload(Arrays.array(event1, event2, event3, event4, event5, event6)).setHeader("routingKey", "eventProducer").build())).delaySubscription(Duration.ofSeconds(1)).subscribeWith(data);
}).collectList().subscribe();
// then
Map<String, Object> message = Maps.of("data", Maps.of("engineEvents", Arrays.array(mapBuilder().put("processInstanceId", "processInstanceId").put("processDefinitionId", "processDefinitionId").put("entity", new BPMNTimerImpl("timerId")).put("eventType", "TIMER_SCHEDULED").get(), mapBuilder().put("processInstanceId", "processInstanceId").put("processDefinitionId", "processDefinitionId").put("entity", new BPMNTimerImpl("timerId")).put("eventType", "TIMER_FIRED").get(), mapBuilder().put("processInstanceId", "processInstanceId").put("processDefinitionId", "processDefinitionId").put("entity", new BPMNTimerImpl("timerId")).put("eventType", "TIMER_EXECUTED").get(), mapBuilder().put("processInstanceId", "processInstanceId").put("processDefinitionId", "processDefinitionId").put("entity", new BPMNTimerImpl("timerId")).put("eventType", "TIMER_CANCELLED").get(), mapBuilder().put("processInstanceId", "processInstanceId").put("processDefinitionId", "processDefinitionId").put("entity", new BPMNTimerImpl("timerId")).put("eventType", "TIMER_FAILED").get(), mapBuilder().put("processInstanceId", "processInstanceId").put("processDefinitionId", "processDefinitionId").put("entity", new BPMNTimerImpl("timerId")).put("eventType", "TIMER_RETRIES_DECREMENTED").get())));
String dataMessage = objectMapper.writeValueAsString(GraphQLMessage.builder().type(GraphQLMessageType.DATA).id("1").payload(message).build());
StepVerifier.create(data).expectNext(dataMessage).expectComplete().verify(TIMEOUT);
}
use of org.activiti.cloud.api.process.model.impl.events.CloudBPMNTimerCancelledEventImpl in project activiti-cloud by Activiti.
the class ToCloudProcessRuntimeEventConverter method from.
public CloudBPMNTimerCancelledEvent from(BPMNTimerCancelledEvent event) {
CloudBPMNTimerCancelledEventImpl cloudEvent = new CloudBPMNTimerCancelledEventImpl(event.getEntity(), event.getEntity().getProcessDefinitionId(), event.getEntity().getProcessInstanceId());
runtimeBundleInfoAppender.appendRuntimeBundleInfoTo(cloudEvent);
return cloudEvent;
}
use of org.activiti.cloud.api.process.model.impl.events.CloudBPMNTimerCancelledEventImpl in project activiti-cloud by Activiti.
the class CloudRuntimeEventRegistry method buildRegistry.
public Map<String, Class<?>> buildRegistry() {
List<RuntimeEvent<?, ?>> eventImplementations = new ArrayList<>();
eventImplementations.add(new CloudBPMNActivityStartedEventImpl());
eventImplementations.add(new CloudBPMNActivityCancelledEventImpl());
eventImplementations.add(new CloudBPMNActivityCompletedEventImpl());
eventImplementations.add(new CloudBPMNErrorReceivedEventImpl());
eventImplementations.add(new CloudBPMNSignalReceivedEventImpl());
eventImplementations.add(new CloudBPMNTimerFiredEventImpl());
eventImplementations.add(new CloudBPMNTimerCancelledEventImpl());
eventImplementations.add(new CloudBPMNTimerScheduledEventImpl());
eventImplementations.add(new CloudBPMNTimerExecutedEventImpl());
eventImplementations.add(new CloudBPMNTimerFailedEventImpl());
eventImplementations.add(new CloudBPMNTimerRetriesDecrementedEventImpl());
eventImplementations.add(new CloudBPMNMessageWaitingEventImpl());
eventImplementations.add(new CloudBPMNMessageReceivedEventImpl());
eventImplementations.add(new CloudBPMNMessageSentEventImpl());
eventImplementations.add(new CloudIntegrationRequestedEventImpl());
eventImplementations.add(new CloudIntegrationResultReceivedEventImpl());
eventImplementations.add(new CloudIntegrationErrorReceivedEventImpl());
eventImplementations.add(new CloudProcessDeployedEventImpl());
eventImplementations.add(new CloudProcessCreatedEventImpl());
eventImplementations.add(new CloudProcessStartedEventImpl());
eventImplementations.add(new CloudProcessCompletedEventImpl());
eventImplementations.add(new CloudProcessCancelledEventImpl());
eventImplementations.add(new CloudProcessSuspendedEventImpl());
eventImplementations.add(new CloudProcessResumedEventImpl());
eventImplementations.add(new CloudProcessUpdatedEventImpl());
eventImplementations.add(new CloudSequenceFlowTakenEventImpl());
eventImplementations.add(new CloudStartMessageDeployedEventImpl());
eventImplementations.add(new CloudMessageSubscriptionCancelledEventImpl());
eventImplementations.add(new CloudTaskCreatedEventImpl());
eventImplementations.add(new CloudTaskUpdatedEventImpl());
eventImplementations.add(new CloudTaskAssignedEventImpl());
eventImplementations.add(new CloudTaskCompletedEventImpl());
eventImplementations.add(new CloudTaskSuspendedEventImpl());
eventImplementations.add(new CloudTaskActivatedEventImpl());
eventImplementations.add(new CloudTaskCancelledEventImpl());
eventImplementations.add(new CloudTaskCandidateUserAddedEventImpl());
eventImplementations.add(new CloudTaskCandidateUserRemovedEventImpl());
eventImplementations.add(new CloudTaskCandidateGroupAddedEventImpl());
eventImplementations.add(new CloudTaskCandidateGroupRemovedEventImpl());
eventImplementations.add(new CloudVariableCreatedEventImpl());
eventImplementations.add(new CloudVariableUpdatedEventImpl());
eventImplementations.add(new CloudVariableDeletedEventImpl());
return eventImplementations.stream().collect(Collectors.toMap(event -> event.getEventType().name(), this::findInterface));
}
use of org.activiti.cloud.api.process.model.impl.events.CloudBPMNTimerCancelledEventImpl in project activiti-cloud by Activiti.
the class TimerEventConverterTest method checkConvertToAPITimerCancelledEvent.
@Test
public void checkConvertToAPITimerCancelledEvent() {
// given
TimerCancelledAuditEventEntity auditEventEntity = (TimerCancelledAuditEventEntity) eventConverterTimerCancelled.convertToEntity(createTimerCancelledEvent());
// when
CloudBPMNTimerCancelledEventImpl cloudEvent = (CloudBPMNTimerCancelledEventImpl) eventConverterTimerCancelled.convertToAPI(auditEventEntity);
checkCloudAuditEvententity(auditEventEntity, cloudEvent);
}
Aggregations