LongRunningProcessManager implements ProcessManager<LongRunningProcess> { @Override public Map<UUID, List<LongRunningProcessStatus>> clear(Map<UUID, List<UUID>> procIds) { return call(procIds, LongRunningProcessClearTask::new, this::rollbackNothing, true); } LongRunningProcessManager(Ignite ignite); @Override Map<UUID, List<UUID>> start(List<LongRunningProcess> specifications); @Override Map<UUID, List<LongRunningProcessStatus>> ping(Map<UUID, List<UUID>> procIds); @Override Map<UUID, List<LongRunningProcessStatus>> stop(Map<UUID, List<UUID>> procIds, boolean clear); @Override Map<UUID, List<LongRunningProcessStatus>> clear(Map<UUID, List<UUID>> procIds);  }
@Test @SuppressWarnings("unchecked") public void testClear() { UUID nodeId = UUID.randomUUID(); UUID procId = UUID.randomUUID(); Ignite ignite = mock(Ignite.class); IgniteCluster cluster = mock(IgniteCluster.class); ClusterGroup clusterGrp = mock(ClusterGroup.class); IgniteCompute igniteCompute = mock(IgniteCompute.class); doReturn(cluster).when(ignite).cluster(); doReturn(igniteCompute).when(ignite).compute(eq(clusterGrp)); doReturn(clusterGrp).when(cluster).forNodeId(eq(nodeId)); doReturn(Collections.singletonList(new LongRunningProcessStatus(LongRunningProcessState.RUNNING))) .when(igniteCompute).call(any(IgniteCallable.class)); Map<UUID, List<UUID>> procIds = new HashMap<>(); procIds.put(nodeId, Collections.singletonList(procId)); LongRunningProcessManager mgr = new LongRunningProcessManager(ignite); Map<UUID, List<LongRunningProcessStatus>> res = mgr.clear(procIds); assertEquals(1, res.size()); assertTrue(res.containsKey(nodeId)); assertEquals(LongRunningProcessState.RUNNING, res.get(nodeId).iterator().next().getState()); verify(igniteCompute).call(any(LongRunningProcessClearTask.class)); }