RemoteProcessServiceImpl extends AbstractKieServerService implements ProcessService { @Override public void signalProcessInstances(String serverTemplateId, List<String> containers, List<Long> processInstanceId, String signal, Object event) { if (new HashSet<String>(containers).size() == 1) { ProcessServicesClient client = getClient(serverTemplateId, containers.get(0), ProcessServicesClient.class); client.signalProcessInstances(containers.get(0), processInstanceId, signal, event); } else { for (int i = 0; i < processInstanceId.size(); i++) { ProcessServicesClient client = getClient(serverTemplateId, containers.get(i), ProcessServicesClient.class); client.signalProcessInstance(containers.get(i), processInstanceId.get(i), signal, event); } } }  @Override void abortProcessInstance(ProcessInstanceKey processInstance); @Override void abortProcessInstances(String serverTemplateId,
                                      Map<String, List<Long>> containerInstances); @Override Long startProcess(String serverTemplateId,
                             String containerId,
                             String processId,
                             String correlationKey,
                             Map<String, Object> params); @Override List<String> getAvailableSignals(String serverTemplateId,
                                            String containerId,
                                            Long processInstanceId); @Override void signalProcessInstances(String serverTemplateId,
                                       List<String> containers,
                                       List<Long> processInstanceId,
                                       String signal,
                                       Object event); @Override void setProcessVariable(String serverTemplateId,
                                   String containerId,
                                   long processInstanceId,
                                   String variableName,
                                   String value);  }
@Test public void bulkSignalProcessInstancesTest_singleProcessInstance() { final String containerId = "containerId"; final Long processInstanceId = 1L; remoteProcessService.signalProcessInstances(SERVER_TEMPLATE_ID, singletonList(containerId), singletonList(processInstanceId), signal, event); verify(processServicesClientMock).signalProcessInstances(containerId, singletonList(processInstanceId), signal, event); }
@Test public void bulkSignalProcessInstancesTest_multipleProcessInstancesOneContainer() { final String containerId = "containerId"; final List<Long> processInstanceIds = new ArrayList<>(Arrays.asList(1L, 2L)); remoteProcessService.signalProcessInstances(SERVER_TEMPLATE_ID, new ArrayList<>(Arrays.asList(containerId, containerId)), processInstanceIds, signal, event); verify(processServicesClientMock).signalProcessInstances(containerId, processInstanceIds, signal, event); }
@Test public void bulkSignalProcessInstancesTest_multipleProcessInstancesMultipleContainers() { final List<String> containerIds = new ArrayList<>(Arrays.asList("containerId_1", "containerId_2")); final List<Long> processInstanceIds = new ArrayList<>(Arrays.asList(1L, 2L)); remoteProcessService.signalProcessInstances(SERVER_TEMPLATE_ID, containerIds, processInstanceIds, signal, event); verify(processServicesClientMock).signalProcessInstance(containerIds.get(0), processInstanceIds.get(0), signal, event); verify(processServicesClientMock).signalProcessInstance(containerIds.get(1), processInstanceIds.get(1), signal, event); verifyNoMoreInteractions(processServicesClientMock); }