@Test public void handleShouldUpdateCurrentProcessInstanceStateToCreated() { CloudProcessCreatedEvent event = buildProcessCreatedEvent(); handler.handle(event); ArgumentCaptor<ProcessInstanceEntity> argumentCaptor = ArgumentCaptor.forClass(ProcessInstanceEntity.class); verify(processInstanceRepository).save(argumentCaptor.capture()); ProcessInstanceEntity processInstanceEntity = argumentCaptor.getValue(); Assertions.assertThat(processInstanceEntity) .hasId(event.getEntity().getId()) .hasProcessDefinitionId(event.getEntity().getProcessDefinitionId()) .hasServiceName(event.getServiceName()) .hasProcessDefinitionKey(event.getEntity().getProcessDefinitionKey()) .hasStatus(ProcessInstance.ProcessInstanceStatus.CREATED) .hasName(event.getEntity().getName()); }
@Override public void handle(CloudRuntimeEvent<?, ?> event) { CloudProcessCreatedEvent createdEvent = (CloudProcessCreatedEvent) event; LOGGER.debug("Handling created process Instance " + createdEvent.getEntity().getId()); ProcessInstanceEntity createdProcessInstanceEntity = new ProcessInstanceEntity(); createdProcessInstanceEntity.setServiceName(createdEvent.getServiceName()); createdProcessInstanceEntity.setServiceFullName(createdEvent.getServiceFullName()); createdProcessInstanceEntity.setServiceVersion(createdEvent.getServiceVersion()); createdProcessInstanceEntity.setAppName(createdEvent.getAppName()); createdProcessInstanceEntity.setAppVersion(createdEvent.getAppVersion()); createdProcessInstanceEntity.setProcessDefinitionId(createdEvent.getEntity().getProcessDefinitionId()); createdProcessInstanceEntity.setId(createdEvent.getEntity().getId()); createdProcessInstanceEntity.setStatus(ProcessInstance.ProcessInstanceStatus.CREATED); createdProcessInstanceEntity.setLastModified(new Date(createdEvent.getTimestamp())); createdProcessInstanceEntity.setName(createdEvent.getEntity().getName()); createdProcessInstanceEntity.setProcessDefinitionKey(createdEvent.getEntity().getProcessDefinitionKey()); createdProcessInstanceEntity.setInitiator(createdEvent.getEntity().getInitiator()); createdProcessInstanceEntity.setBusinessKey(createdEvent.getEntity().getBusinessKey()); createdProcessInstanceEntity.setStartDate(createdEvent.getEntity().getStartDate()); createdProcessInstanceEntity.setParentId(createdEvent.getEntity().getParentId()); createdProcessInstanceEntity.setProcessDefinitionVersion(createdEvent.getEntity().getProcessDefinitionVersion()); processInstanceRepository.save(createdProcessInstanceEntity); }
ProcessCreatedEventHandler implements QueryEventHandler { @Override public void handle(CloudRuntimeEvent<?, ?> event) { CloudProcessCreatedEvent createdEvent = (CloudProcessCreatedEvent) event; LOGGER.debug("Handling created process Instance " + createdEvent.getEntity().getId()); ProcessInstanceEntity createdProcessInstanceEntity = new ProcessInstanceEntity(); createdProcessInstanceEntity.setServiceName(createdEvent.getServiceName()); createdProcessInstanceEntity.setServiceFullName(createdEvent.getServiceFullName()); createdProcessInstanceEntity.setServiceVersion(createdEvent.getServiceVersion()); createdProcessInstanceEntity.setAppName(createdEvent.getAppName()); createdProcessInstanceEntity.setAppVersion(createdEvent.getAppVersion()); createdProcessInstanceEntity.setProcessDefinitionId(createdEvent.getEntity().getProcessDefinitionId()); createdProcessInstanceEntity.setId(createdEvent.getEntity().getId()); createdProcessInstanceEntity.setStatus(ProcessInstance.ProcessInstanceStatus.CREATED); createdProcessInstanceEntity.setLastModified(new Date(createdEvent.getTimestamp())); createdProcessInstanceEntity.setName(createdEvent.getEntity().getName()); createdProcessInstanceEntity.setProcessDefinitionKey(createdEvent.getEntity().getProcessDefinitionKey()); createdProcessInstanceEntity.setInitiator(createdEvent.getEntity().getInitiator()); createdProcessInstanceEntity.setBusinessKey(createdEvent.getEntity().getBusinessKey()); createdProcessInstanceEntity.setStartDate(createdEvent.getEntity().getStartDate()); createdProcessInstanceEntity.setParentId(createdEvent.getEntity().getParentId()); createdProcessInstanceEntity.setProcessDefinitionVersion(createdEvent.getEntity().getProcessDefinitionVersion()); processInstanceRepository.save(createdProcessInstanceEntity); } }
ProcessCreatedEventHandler implements QueryEventHandler { @Override public void handle(CloudRuntimeEvent<?, ?> event) { CloudProcessCreatedEvent createdEvent = (CloudProcessCreatedEvent) event; LOGGER.debug("Handling created process Instance " + createdEvent.getEntity().getId()); ProcessInstanceEntity createdProcessInstanceEntity = new ProcessInstanceEntity(); createdProcessInstanceEntity.setServiceName(createdEvent.getServiceName()); createdProcessInstanceEntity.setServiceFullName(createdEvent.getServiceFullName()); createdProcessInstanceEntity.setServiceVersion(createdEvent.getServiceVersion()); createdProcessInstanceEntity.setAppName(createdEvent.getAppName()); createdProcessInstanceEntity.setAppVersion(createdEvent.getAppVersion()); createdProcessInstanceEntity.setProcessDefinitionId(createdEvent.getEntity().getProcessDefinitionId()); createdProcessInstanceEntity.setId(createdEvent.getEntity().getId()); createdProcessInstanceEntity.setStatus(ProcessInstance.ProcessInstanceStatus.CREATED); createdProcessInstanceEntity.setLastModified(new Date(createdEvent.getTimestamp())); createdProcessInstanceEntity.setName(createdEvent.getEntity().getName()); createdProcessInstanceEntity.setProcessDefinitionKey(createdEvent.getEntity().getProcessDefinitionKey()); createdProcessInstanceEntity.setInitiator(createdEvent.getEntity().getInitiator()); createdProcessInstanceEntity.setBusinessKey(createdEvent.getEntity().getBusinessKey()); createdProcessInstanceEntity.setStartDate(createdEvent.getEntity().getStartDate()); createdProcessInstanceEntity.setParentId(createdEvent.getEntity().getParentId()); createdProcessInstanceEntity.setProcessDefinitionVersion(createdEvent.getEntity().getProcessDefinitionVersion()); processInstanceRepository.save(createdProcessInstanceEntity); } ProcessCreatedEventHandler(ProcessInstanceRepository processInstanceRepository); }
ProcessCreatedEventHandler implements QueryEventHandler { @Override public void handle(CloudRuntimeEvent<?, ?> event) { CloudProcessCreatedEvent createdEvent = (CloudProcessCreatedEvent) event; LOGGER.debug("Handling created process Instance " + createdEvent.getEntity().getId()); ProcessInstanceEntity createdProcessInstanceEntity = new ProcessInstanceEntity(); createdProcessInstanceEntity.setServiceName(createdEvent.getServiceName()); createdProcessInstanceEntity.setServiceFullName(createdEvent.getServiceFullName()); createdProcessInstanceEntity.setServiceVersion(createdEvent.getServiceVersion()); createdProcessInstanceEntity.setAppName(createdEvent.getAppName()); createdProcessInstanceEntity.setAppVersion(createdEvent.getAppVersion()); createdProcessInstanceEntity.setProcessDefinitionId(createdEvent.getEntity().getProcessDefinitionId()); createdProcessInstanceEntity.setId(createdEvent.getEntity().getId()); createdProcessInstanceEntity.setStatus(ProcessInstance.ProcessInstanceStatus.CREATED); createdProcessInstanceEntity.setLastModified(new Date(createdEvent.getTimestamp())); createdProcessInstanceEntity.setName(createdEvent.getEntity().getName()); createdProcessInstanceEntity.setProcessDefinitionKey(createdEvent.getEntity().getProcessDefinitionKey()); createdProcessInstanceEntity.setInitiator(createdEvent.getEntity().getInitiator()); createdProcessInstanceEntity.setBusinessKey(createdEvent.getEntity().getBusinessKey()); createdProcessInstanceEntity.setStartDate(createdEvent.getEntity().getStartDate()); createdProcessInstanceEntity.setParentId(createdEvent.getEntity().getParentId()); createdProcessInstanceEntity.setProcessDefinitionVersion(createdEvent.getEntity().getProcessDefinitionVersion()); processInstanceRepository.save(createdProcessInstanceEntity); } ProcessCreatedEventHandler(ProcessInstanceRepository processInstanceRepository); @Override void handle(CloudRuntimeEvent<?, ?> event); @Override String getHandledEvent(); }
ProcessCreatedEventHandler implements QueryEventHandler { @Override public void handle(CloudRuntimeEvent<?, ?> event) { CloudProcessCreatedEvent createdEvent = (CloudProcessCreatedEvent) event; LOGGER.debug("Handling created process Instance " + createdEvent.getEntity().getId()); ProcessInstanceEntity createdProcessInstanceEntity = new ProcessInstanceEntity(); createdProcessInstanceEntity.setServiceName(createdEvent.getServiceName()); createdProcessInstanceEntity.setServiceFullName(createdEvent.getServiceFullName()); createdProcessInstanceEntity.setServiceVersion(createdEvent.getServiceVersion()); createdProcessInstanceEntity.setAppName(createdEvent.getAppName()); createdProcessInstanceEntity.setAppVersion(createdEvent.getAppVersion()); createdProcessInstanceEntity.setProcessDefinitionId(createdEvent.getEntity().getProcessDefinitionId()); createdProcessInstanceEntity.setId(createdEvent.getEntity().getId()); createdProcessInstanceEntity.setStatus(ProcessInstance.ProcessInstanceStatus.CREATED); createdProcessInstanceEntity.setLastModified(new Date(createdEvent.getTimestamp())); createdProcessInstanceEntity.setName(createdEvent.getEntity().getName()); createdProcessInstanceEntity.setProcessDefinitionKey(createdEvent.getEntity().getProcessDefinitionKey()); createdProcessInstanceEntity.setInitiator(createdEvent.getEntity().getInitiator()); createdProcessInstanceEntity.setBusinessKey(createdEvent.getEntity().getBusinessKey()); createdProcessInstanceEntity.setStartDate(createdEvent.getEntity().getStartDate()); createdProcessInstanceEntity.setParentId(createdEvent.getEntity().getParentId()); createdProcessInstanceEntity.setProcessDefinitionVersion(createdEvent.getEntity().getProcessDefinitionVersion()); processInstanceRepository.save(createdProcessInstanceEntity); } ProcessCreatedEventHandler(ProcessInstanceRepository processInstanceRepository); @Override void handle(CloudRuntimeEvent<?, ?> event); @Override String getHandledEvent();  }