Skip to content

Commit 1dad935

Browse files
committed
The revision contains cleans up code supporting the Test/TestProject
button in an attempt to eliminate an intermittent (timing?) bug where the slave JVM fails to find a test class that clearly exists. The following classes were modified: modified: drjava/src/edu/rice/cs/drjava/model/DummyGlobalModelListener.java modified: drjava/src/edu/rice/cs/drjava/model/GlobalEventNotifier.java modified: drjava/src/edu/rice/cs/drjava/model/GlobalModelTestCase.java modified: drjava/src/edu/rice/cs/drjava/model/junit/DefaultJUnitModel.java modified: drjava/src/edu/rice/cs/drjava/model/junit/JUnitEventNotifier.java modified: drjava/src/edu/rice/cs/drjava/model/junit/JUnitListener.java modified: drjava/src/edu/rice/cs/drjava/model/junit/JUnitModel.java modified: drjava/src/edu/rice/cs/drjava/model/junit/JUnitTestManager.java modified: drjava/src/edu/rice/cs/drjava/model/repl/newjvm/InterpreterJVM.java modified: drjava/src/edu/rice/cs/drjava/model/repl/newjvm/MainJVM.java
1 parent 2af9c4d commit 1dad935

10 files changed

Lines changed: 6 additions & 46 deletions

drjava/src/edu/rice/cs/drjava/model/DummyGlobalModelListener.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,6 @@ public void compileBeforeJUnit(final CompilerListener l, List<OpenDefinitionsDoc
107107
/** Called after JUnit is started by the GlobalModel. */
108108
public void junitStarted() { }
109109

110-
// /** Called when testing all files. */
111-
// public void junitClassesStarted() { }
112-
113110
/** Called to indicate that a suite of tests has started running.
114111
* @param numTests The number of tests in the suite to be run.
115112
*/

drjava/src/edu/rice/cs/drjava/model/GlobalEventNotifier.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -495,13 +495,6 @@ public void junitStarted() {
495495
finally { _lock.endRead(); }
496496
}
497497

498-
// /** Called when testing specific list of classes. */
499-
// public void junitClassesStarted() {
500-
// _lock.startRead();
501-
// try { for (GlobalModelListener l : _listeners) { l.junitClassesStarted(); } }
502-
// finally { _lock.endRead(); }
503-
// }
504-
505498
/** Called to indicate that a suite of tests has started running.
506499
* @param numTests The number of tests in the suite to be run.
507500
*/

drjava/src/edu/rice/cs/drjava/model/GlobalModelTestCase.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -906,7 +906,6 @@ public void handleAlreadyOpenDocument(OpenDefinitionsDocument doc) {
906906
public void saveBeforeCompile() { listenerFail("saveBeforeCompile fired unexpectedly"); }
907907

908908
public void junitStarted() { listenerFail("junitStarted fired unexpectedly"); }
909-
// public void junitClassesStarted() { listenerFail("junitAllStarted fired unexpectedly"); }
910909
public void junitSuiteStarted(int numTests) { listenerFail("junitSuiteStarted fired unexpectedly"); }
911910
public void junitTestStarted(String name) { listenerFail("junitTestStarted fired unexpectedly"); }
912911
public void junitTestEnded(String name, boolean wasSuccessful, boolean causedError) {

drjava/src/edu/rice/cs/drjava/model/junit/DefaultJUnitModel.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,8 @@ public void run() {
462462

463463
synchronized(_compilerModel.getCompilerLock()) {
464464
// synchronized over _compilerModel to ensure that compilation and junit testing are mutually exclusive.
465-
/** Set up junit test suite on slave JVM; get TestCase classes forming that suite */
465+
/** Set up junit test suite on slave JVM; get TestCase classes forming that suite. The computation of TestCase classes
466+
* is done in the slave JVM. */
466467
List<String> tests = _jvm.findTestClasses(classNames, files).unwrap(null); // findTestClasses returns Option<List<String>>
467468
// Utilities.show("found tests " + tests);
468469
_log.log("tests = " + tests);

drjava/src/edu/rice/cs/drjava/model/junit/JUnitEventNotifier.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -111,13 +111,6 @@ public void junitStarted() {
111111
finally { _lock.endRead(); }
112112
}
113113

114-
// /** Called after junitClasses is started by the GlobalModel. */
115-
// public void junitClassesStarted() {
116-
// _lock.startRead();
117-
// try { for (JUnitListener jul : _listeners) { jul.junitClassesStarted(); } }
118-
// finally { _lock.endRead(); }
119-
// }
120-
121114
/** Called to indicate that a suite of tests has started running.
122115
* @param numTests The number of tests in the suite to be run.
123116
*/

drjava/src/edu/rice/cs/drjava/model/junit/JUnitListener.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,6 @@ public interface JUnitListener {
6262
/** Called after JUnit is started by the GlobalModel. */
6363
public void junitStarted();
6464

65-
// /** Called when testing a specific list of classes given their source files. */
66-
// public void junitClassesStarted();
67-
6865
/** Called to indicate that a suite of tests has started running.
6966
* @param numTests The number of tests in the suite to be run.
7067
*/

drjava/src/edu/rice/cs/drjava/model/junit/JUnitModel.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,12 +94,6 @@ public interface JUnitModel {
9494
*/
9595
public void junit(OpenDefinitionsDocument doc) throws ClassNotFoundException, IOException;
9696

97-
// /** Forwards the classnames and files to the test manager to test all of them.
98-
// * @param qualifiedClassnames a list of all the qualified class names to test.
99-
// * @param files a list of their source files in the same order as qualified class names.
100-
// */
101-
// public void junitClasses(List<String> qualifiedClassnames, List<File> files);
102-
//
10397
//---------------------------- Model Callbacks ----------------------------//
10498

10599
/** Cleans up an attempt JUnit test exeuction when suitable test code is not available.

drjava/src/edu/rice/cs/drjava/model/junit/JUnitTestManager.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ public JUnitTestManager(JUnitModelCallback jmc, Lambda<ClassLoader, ClassLoader>
9696

9797
/** Find the test classes among the given classNames and accumulate them in
9898
* TestSuite for junit. Returns null if a test suite is already pending.
99+
* This method runs in the slave JVM! It is called by InterpreterJVM.
99100
* @param classNames the class names that are test class candidates
100101
* @param files the files corresponding to classNames
101102
*/

drjava/src/edu/rice/cs/drjava/model/repl/newjvm/InterpreterJVM.java

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -68,22 +68,6 @@
6868

6969
import edu.rice.cs.util.swing.Utilities;
7070

71-
//import edu.rice.cs.dynamicjava.Options;
72-
73-
/* Most of these imports involve debugger code that I don't think works in DrScala. */
74-
//import edu.rice.cs.dynamicjava.interpreter.ClassContext;
75-
//import edu.rice.cs.dynamicjava.interpreter.ClassSignatureContext;
76-
//import edu.rice.cs.dynamicjava.interpreter.DelegatingContext;
77-
//import edu.rice.cs.dynamicjava.interpreter.EvaluatorException; // moved to this package
78-
//import edu.rice.cs.dynamicjava.interpreter.ImportContext;
79-
//import edu.rice.cs.dynamicjava.interpreter.InterpreterException; // moved to this package
80-
//import edu.rice.cs.dynamicjava.interpreter.LocalContext;
81-
//import edu.rice.cs.dynamicjava.interpreter.RuntimeBindings;
82-
//import edu.rice.cs.dynamicjava.interpreter.TypeContext;
83-
//import edu.rice.cs.dynamicjava.symbol.DJClass;
84-
//import edu.rice.cs.dynamicjava.symbol.SymbolUtil; // no longer used
85-
//import edu.rice.cs.dynamicjava.symbol.LocalVariable;
86-
//import edu.rice.cs.dynamicjava.symbol.type.Type;
8771

8872
// For Windows focus fix
8973
import javax.swing.JDialog;

drjava/src/edu/rice/cs/drjava/model/repl/newjvm/MainJVM.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -487,8 +487,9 @@ public Option<Iterable<File>> getClassPath() {
487487
catch (RemoteException e) { _handleRemoteException(e); return Option.none(); }
488488
}
489489

490-
/** Sets up a JUnit test suite in the Interpreter JVM and finds which classes are really TestCase
491-
* classes (by loading them). Blocks until the interpreter is connected and the operation completes.
490+
/** Sets up a JUnit test suite in the Interpreter JVM and finds which classes are really TestCase classes (by
491+
* loading them). The actual computation is done in the slave JVM. Returns Option.none() if the interpreter is
492+
* not connected or the slave JVM is busy.
492493
* @param classNames the class names to run in a test
493494
* @param files the associated file
494495
* @return the class names that are actually test cases

0 commit comments

Comments
 (0)