@Test public void getPidsReturnsAllPids() { psapi.setEnumProcessesReturnValue(true); int[] input = IntStream.range(1, 7500).toArray(); psapi.setEnumProcessesPids(input); psapi.setEnumProcessesBytesReturned(input.length * WinApiConstants.SIZEOF_INT); int[] pids = enumerator.getPids().stream().mapToInt(i -> i).toArray(); assertArrayEquals(input, pids); }
@Override public List<Integer> getPids() { int[] pidBuffer = createMaxSizePidBuffer(); int pidCount = fillBufferWithProcessIds(pidBuffer); return Arrays.stream(pidBuffer, 0, pidCount) .boxed() .collect(Collectors.toList()); }
WindowsPidEnumerator implements PidEnumerator { @Override public List<Integer> getPids() { int[] pidBuffer = createMaxSizePidBuffer(); int pidCount = fillBufferWithProcessIds(pidBuffer); return Arrays.stream(pidBuffer, 0, pidCount) .boxed() .collect(Collectors.toList()); } }
WindowsPidEnumerator implements PidEnumerator { @Override public List<Integer> getPids() { int[] pidBuffer = createMaxSizePidBuffer(); int pidCount = fillBufferWithProcessIds(pidBuffer); return Arrays.stream(pidBuffer, 0, pidCount) .boxed() .collect(Collectors.toList()); } WindowsPidEnumerator(Psapi psapi); }
WindowsPidEnumerator implements PidEnumerator { @Override public List<Integer> getPids() { int[] pidBuffer = createMaxSizePidBuffer(); int pidCount = fillBufferWithProcessIds(pidBuffer); return Arrays.stream(pidBuffer, 0, pidCount) .boxed() .collect(Collectors.toList()); } WindowsPidEnumerator(Psapi psapi); @Override List<Integer> getPids(); }
WindowsPidEnumerator implements PidEnumerator { @Override public List<Integer> getPids() { int[] pidBuffer = createMaxSizePidBuffer(); int pidCount = fillBufferWithProcessIds(pidBuffer); return Arrays.stream(pidBuffer, 0, pidCount) .boxed() .collect(Collectors.toList()); } WindowsPidEnumerator(Psapi psapi); @Override List<Integer> getPids();  }