ProcessLocatorExecutor implements ProcessLocator { @Override public List<Long> getProcessIDs() throws USMException { final EventResult result = new DSLEntryExecutor(locator, launcher, puExtDir, LifecycleEvents.PROCESS_LOCATOR).run(); if (result.isSuccess()) { final Object retval = result.getResult(); if (retval == null) { throw new IllegalArgumentException( "A process locator returned an unexpected result that is not a list of longs, " + " or a comma aeparated list of longs. Result was: null"); } else if (retval instanceof List<?>) { final List<?> closureResultList = (List<?>) retval; final List<Long> targetList = new ArrayList<Long>(closureResultList.size()); for (final Object listItem : closureResultList) { if (listItem instanceof Long) { targetList.add((Long) listItem); } else if (listItem instanceof Integer) { targetList.add(Long.valueOf((Integer) listItem)); } else if (listItem instanceof String) { try { final Long temp = Long.valueOf((String) listItem); targetList.add(temp); } catch (final NumberFormatException e) { throw new IllegalArgumentException( "Failed to parse a long value from locator result: " + listItem, e); } } else { throw new IllegalArgumentException( "Values in process locator result must be integers, " + "longs or strings that can be parsed as longs"); } } return targetList; } else if (retval instanceof String) { String listToParse = (String) retval; if (listToParse.startsWith("[") && listToParse.endsWith("]")) { listToParse = listToParse.substring(1, listToParse.length() - 1); } final String[] parts = listToParse.split(","); final List<Long> resultList = new ArrayList<Long>(parts.length); for (final String part : parts) { try { final Long pid = Long.valueOf(part); resultList.add(pid); } catch (final NumberFormatException e) { throw new IllegalArgumentException( "Failed to parse PID list from locator output. Output was: " + retval + ", failed to parse component: " + part, e); } } return resultList; } else { throw new IllegalArgumentException( "A process locator returned an unexpected result that is not a list of longs, " + " or a comma aeparated list of longs. Result was of type: " + retval.getClass().getName() + ".Result was: " + retval); } } else { throw new USMException("A Process locator failed to execute. Exception was: " + result.getException(), result.getException()); } } ProcessLocatorExecutor(final ExecutableDSLEntry locator, final ProcessLauncher launcher,
			final File puExtDir); @Override List<Long> getProcessIDs();  }
@Test(expected = IllegalArgumentException.class) public void testProcessLocatorExecutor_1() throws Exception { final ExecutableDSLEntry locator = ExecutableDSLEntryFactory.createEntry(new Closure<Object>(null) { private static final long serialVersionUID = 1L; @Override public Object call(final Object... params) { return null; } }, "locator", new File(".")); final ProcessLauncher launcher = new DefaultProcessLauncher(); final File puExtDir = new File(""); final ProcessLocatorExecutor result = new ProcessLocatorExecutor(locator, launcher, puExtDir); assertNotNull(result); result.getProcessIDs(); }