1 13 14 package org.eclipse.jdt.internal.junit.runner; 15 16 import java.util.ArrayList ; 17 import java.util.Iterator ; 18 19 public class TestExecution { 20 private boolean fShouldStop = false; 21 22 private IListensToTestExecutions fExecutionListener; 23 24 private IClassifiesThrowables fClassifier; 25 26 private ArrayList fStopListeners = new ArrayList (); 27 28 public TestExecution(IListensToTestExecutions listener, 29 IClassifiesThrowables classifier) { 30 fClassifier = classifier; 31 fExecutionListener = listener; 32 } 33 34 public void run(ITestReference[] suites) { 35 for (int i = 0; i < suites.length; i++) { 36 if (fShouldStop) 37 return; 38 suites[i].run(this); 39 } 40 } 41 42 public boolean shouldStop() { 43 return fShouldStop; 44 } 45 46 public void stop() { 47 fShouldStop = true; 48 for (Iterator iter = fStopListeners.iterator(); iter.hasNext();) { 49 IStopListener listener = (IStopListener) iter.next(); 50 listener.stop(); 51 } 52 } 53 54 public IListensToTestExecutions getListener() { 55 return fExecutionListener; 56 } 57 58 public IClassifiesThrowables getClassifier() { 59 return fClassifier; 60 } 61 62 public void addStopListener(IStopListener listener) { 63 fStopListeners.add(listener); 64 } 65 } 66 | Popular Tags |