@Subscribe
    public void reportLocalProcesses(final ReportLocalProcessesEvent event) {
        if (!event.getInstanceId().equals(contextManager.getComputeNodeInstanceContext().getInstance().getMetaData().getId())) {
            return;
        }
        Collection<Process> processes = ProcessRegistry.getInstance().listAll();
        if (!processes.isEmpty()) {
            contextManager.getPersistServiceFacade().getRepository().persist(
                    ProcessNode.getProcessListInstancePath(event.getTaskId(), event.getInstanceId()), YamlEngine.marshal(swapper.swapToYamlConfiguration(processes)));
        }
        contextManager.getPersistServiceFacade().getRepository().delete(ComputeNode.getProcessTriggerInstanceNodePath(event.getInstanceId(), event.getTaskId()));
    }
@Test
    void assertReportLocalProcesses() {
        Process process = mock(Process.class);
        String processId = "foo_id";
        when(process.getId()).thenReturn(processId);
        when(process.isInterrupted()).thenReturn(false);
        when(process.isIdle()).thenReturn(false);
        when(process.getCompletedUnitCount()).thenReturn(new AtomicInteger(0));
        when(process.getTotalUnitCount()).thenReturn(new AtomicInteger(0));
        ProcessRegistry.getInstance().add(process);
        String instanceId = contextManager.getComputeNodeInstanceContext().getInstance().getMetaData().getId();
        subscriber.reportLocalProcesses(new ReportLocalProcessesEvent(instanceId, processId));
        verify(repository).persist("/execution_nodes/foo_id/" + instanceId,
                "processes:" + System.lineSeparator() + "- completedUnitCount: 0" + System.lineSeparator()
                        + "  id: foo_id" + System.lineSeparator()
                        + "  idle: false" + System.lineSeparator()
                        + "  interrupted: false" + System.lineSeparator()
                        + "  startMillis: 0" + System.lineSeparator()
                        + "  totalUnitCount: 0" + System.lineSeparator());
        verify(repository).delete("/nodes/compute_nodes/show_process_list_trigger/" + instanceId + ":foo_id");
    }