edu.rice.cs.drjava.model
Class GlobalModelOtherTest

java.lang.Object
  |
  +--junit.framework.Assert
        |
        +--junit.framework.TestCase
              |
              +--edu.rice.cs.drjava.model.GlobalModelTestCase
                    |
                    +--edu.rice.cs.drjava.model.GlobalModelOtherTest
All Implemented Interfaces:
OptionConstants, Test

public class GlobalModelOtherTest
extends GlobalModelTestCase
implements OptionConstants

A test on the GlobalModel that does deals with everything outside of simple file operations, e.g., compile, quit.

Version:
$Id: GlobalModelOtherTest.java,v 1.31 2002/09/02 21:24:11 csreis Exp $

Inner classes inherited from class edu.rice.cs.drjava.model.GlobalModelTestCase
GlobalModelTestCase.CancelingSelector, GlobalModelTestCase.CompileShouldFailListener, GlobalModelTestCase.CompileShouldSucceedListener, GlobalModelTestCase.FileSelector, GlobalModelTestCase.OpenWarningException, GlobalModelTestCase.OverwriteException, GlobalModelTestCase.TestListener, GlobalModelTestCase.WarningFileSelector
 
Fields inherited from class edu.rice.cs.drjava.model.GlobalModelTestCase
_model, _originalModel, _tempDir, BAR_TEXT, BAZ_TEXT, FOO_MISSING_CLOSE_TEXT, FOO_PACKAGE_AFTER_IMPORT, FOO_PACKAGE_AS_FIELD, FOO_PACKAGE_AS_FIELD_2, FOO_PACKAGE_AS_PART_OF_FIELD, FOO_PACKAGE_INSIDE_CLASS, FOO_TEXT
 
Fields inherited from class junit.framework.TestCase
fName
 
Fields inherited from interface edu.rice.cs.drjava.config.OptionConstants
COMPILER_ERROR_COLOR, DEBUG_BREAKPOINT_COLOR, DEBUG_SHOW_THREADS, DEBUG_SOURCEPATH, DEBUG_STEP_DRJAVA, DEBUG_STEP_INTERPRETER, DEBUG_STEP_JAVA, DEBUG_THREAD_COLOR, DEFINITIONS_BACKGROUND_COLOR, DEFINITIONS_COMMENT_COLOR, DEFINITIONS_DOUBLE_QUOTED_COLOR, DEFINITIONS_KEYWORD_COLOR, DEFINITIONS_MATCH_COLOR, DEFINITIONS_NORMAL_COLOR, DEFINITIONS_NUMBER_COLOR, DEFINITIONS_SINGLE_QUOTED_COLOR, DEFINITIONS_TYPE_COLOR, EXTRA_CLASSPATH, FONT_DOCLIST, FONT_MAIN, FONT_TOOLBAR, HISTORY_MAX_SIZE, INDENT_LEVEL, INTERACTIONS_EXIT_PROMPT, JAVAC_ALLOW_ASSERT, JAVAC_LOCATION, JSR14_COLLECTIONSPATH, JSR14_LOCATION, KEY_BACKWARD, KEY_BEGIN_DOCUMENT, KEY_BEGIN_LINE, KEY_CLOSE_FILE, KEY_COMPILE, KEY_COMPILE_ALL, KEY_COPY, KEY_CUT, KEY_CUT_LINE, KEY_DEBUG_BREAKPOINT_TOGGLE, KEY_DEBUG_MODE_TOGGLE, KEY_DEBUG_RESUME, KEY_DEBUG_STEP_INTO, KEY_DEBUG_STEP_OUT, KEY_DEBUG_STEP_OVER, KEY_DELETE_NEXT, KEY_DELETE_PREVIOUS, KEY_DOWN, KEY_END_DOCUMENT, KEY_END_LINE, KEY_FIND_NEXT, KEY_FIND_REPLACE, KEY_FORWARD, KEY_GOTO_LINE, KEY_NEW_FILE, KEY_NEXT_DOCUMENT, KEY_NEXT_WORD, KEY_OPEN_FILE, KEY_PAGE_DOWN, KEY_PAGE_UP, KEY_PASTE, KEY_PREVIOUS_DOCUMENT, KEY_PREVIOUS_WORD, KEY_PRINT, KEY_PRINT_PREVIEW, KEY_QUIT, KEY_REDO, KEY_SAVE_FILE, KEY_SAVE_FILE_AS, KEY_SELECT_ALL, KEY_UNDO, KEY_UP, LINEENUM_ENABLED, mask, QUIT_PROMPT, RECENT_FILES, RECENT_FILES_MAX_SIZE, TOOLBAR_ICONS_ENABLED, TOOLBAR_TEXT_ENABLED, WORKING_DIRECTORY
 
Constructor Summary
GlobalModelOtherTest(String name)
          Constructor.
 
Method Summary
private  void _doCompile(OpenDefinitionsDocument doc, File file)
          Saves to the given file, and then compiles the given document.
static Test suite()
          Creates a test suite for JUnit to run.
 void testGetMultipleSourceRootsDefaultPackage()
           
 void testGetSourceRootDefaultPackage()
           
 void testGetSourceRootPackageOneDeepValid()
           
 void testGetSourceRootPackageThreeDeepInvalid()
           
 void testGetSourceRootPackageThreeDeepValid()
           
 void testInteractionAbort()
          Checks that the interpreter can be aborted and then work correctly later.
 void testInteractionPreventedFromExit()
          Checks that System.exit is handled appropriately from interactions frame.
 void testInteractionsCanSeeChangedClass()
          Checks that updating a class and recompiling it is visible from the REPL.
 void testInteractionsCanSeeCompiledClasses()
          Creates a new class, compiles it and then checks that the REPL can see it.
 void testInteractionsDefineAnonymousInnerClass()
          Checks that an anonymous inner class can be defined in the repl!
 void testInteractionsLiveUpdateClasspath()
          Creates a new class, compiles it and then checks that the REPL can see it.
 void testResetConsole()
          Checks that reset console works.
 
Methods inherited from class edu.rice.cs.drjava.model.GlobalModelTestCase
assertCompileErrorsPresent, assertCompileErrorsPresent, assertContents, assertLength, assertModified, assertNumOpenDocs, changeDocumentText, classForJava, createFile, createModel, interpret, interpretIgnoreResult, setUp, setupDocument, tearDown, tempDirectory, tempFile, tempFile, writeToNewTempFile
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, name, run, run, runBare, runTest, setName, toString
 
Methods inherited from class junit.framework.Assert
assert, assert, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertNotNull, assertNotNull, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail, failNotEquals, failNotSame
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 

Constructor Detail

GlobalModelOtherTest

public GlobalModelOtherTest(String name)
Constructor.
Parameters:
String - name
Method Detail

suite

public static Test suite()
Creates a test suite for JUnit to run.
Returns:
a test suite based on the methods in this class

testInteractionPreventedFromExit

public void testInteractionPreventedFromExit()
                                      throws BadLocationException,
                                             InterruptedException
Checks that System.exit is handled appropriately from interactions frame.

testInteractionAbort

public void testInteractionAbort()
                          throws BadLocationException,
                                 InterruptedException,
                                 IOException
Checks that the interpreter can be aborted and then work correctly later. Part of what we check here is that the interactions classpath is correctly reset after aborting interactions. That is, we ensure that the compiled class is still visible after aborting. This was broken in drjava-20020108-0958 -- or so I thought. I can't consistently reproduce the problem in the UI (seems to show up using IBM's JDK only), and I can never reproduce it in the test case. Grr. OK, now I found the explanation: We were in some cases running two new JVMs on an abort. I fixed the problem in MainJVM#restartInterpreterJVM.

testResetConsole

public void testResetConsole()
                      throws BadLocationException,
                             InterruptedException
Checks that reset console works.

_doCompile

private void _doCompile(OpenDefinitionsDocument doc,
                        File file)
                 throws IOException,
                        InterruptedException
Saves to the given file, and then compiles the given document. The compile is expected to succeed and it is checked to make sure it worked reasonably. This method does not return until the Interactions JVM has reset and is ready to use.

testInteractionsCanSeeCompiledClasses

public void testInteractionsCanSeeCompiledClasses()
                                           throws BadLocationException,
                                                  IOException,
                                                  InterruptedException
Creates a new class, compiles it and then checks that the REPL can see it. Then checks that a compiled class file in another directory can be both accessed and extended if it is on the "extra.classpath" config option.

testInteractionsCanSeeChangedClass

public void testInteractionsCanSeeChangedClass()
                                        throws BadLocationException,
                                               IOException,
                                               InterruptedException
Checks that updating a class and recompiling it is visible from the REPL.

testInteractionsDefineAnonymousInnerClass

public void testInteractionsDefineAnonymousInnerClass()
                                               throws BadLocationException,
                                                      IOException,
                                                      InterruptedException
Checks that an anonymous inner class can be defined in the repl!

testGetSourceRootDefaultPackage

public void testGetSourceRootDefaultPackage()
                                     throws BadLocationException,
                                            IOException,
                                            InvalidPackageException

testGetSourceRootPackageThreeDeepValid

public void testGetSourceRootPackageThreeDeepValid()
                                            throws BadLocationException,
                                                   IOException,
                                                   InvalidPackageException

testGetSourceRootPackageThreeDeepInvalid

public void testGetSourceRootPackageThreeDeepInvalid()
                                              throws BadLocationException,
                                                     IOException

testGetSourceRootPackageOneDeepValid

public void testGetSourceRootPackageOneDeepValid()
                                          throws BadLocationException,
                                                 IOException

testGetMultipleSourceRootsDefaultPackage

public void testGetMultipleSourceRootsDefaultPackage()
                                              throws BadLocationException,
                                                     IOException

testInteractionsLiveUpdateClasspath

public void testInteractionsLiveUpdateClasspath()
                                         throws BadLocationException,
                                                IOException,
                                                InterruptedException
Creates a new class, compiles it and then checks that the REPL can see it.