@Test
public void testProcess_dymanic() {
final List<Long> initProcessIds = new ArrayList<Long>();
try {
initProcess();
SelectStageListener select = new SelectStageListener(pipelineId);
final Long p2 = select.waitForProcess();
final Long p3 = select.waitForProcess();
final CountDownLatch count = new CountDownLatch(1);
ExecutorService executor = Executors.newCachedThreadPool();
executor.submit(new Runnable() {
public void run() {
sleep();
destoryProcess(p2);
sleep();
destoryProcess(p3);
count.countDown();
}
});
Long p4 = select.waitForProcess();
Long p5 = select.waitForProcess();
initProcessIds.add(p4);
initProcessIds.add(p5);
sleep();
StageMonitor monitor = ArbitrateFactory.getInstance(pipelineId, StageMonitor.class);
List<Long> processIds = monitor.getCurrentProcessIds();
want.collection(processIds).isEqualTo(initProcessIds);
count.await();
select.destory();
ArbitrateFactory.destory(pipelineId);
} catch (InterruptedException e) {
want.fail();
} finally {
for (Long processId : initProcessIds) {