|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.sape.carbon.services.devtools.junit.launcher.TestLauncher
Swing Application that will display all Carbon tests to the user and allow the user to turn off selected tests or groups of tests that meet a criteria.
Test grouping is handled through a properties file located in the same directory called "launcher.properties".
Copyright 2003 Sapient
Nested Class Summary | |
protected class |
TestLauncher.WindowCloser
Closes the window. |
Field Summary | |
private static String |
ACTION_CHECK_ALL
Action command indicating the user wishes to check all tests. |
private static String |
ACTION_DONE
Action command when the user is finished selecting tests. |
private static String |
ACTION_REMOVE_DEPEND
Action command indicating the user has select to remove one of the dependencies. |
protected JFrame |
applicationFrame
The main frame shown to the user. |
private static String |
CARBON_LOGO_LOCATION
Location of the Carbon logo for the frame icon. |
protected Map |
checkBoxToClassNameMap
Map of JCheckBox objects to the String of the Test Class Name they represent. |
protected Map |
classNameToCheckBoxMap
Map of Test Class Names to JCheckBoxs that represent them. |
private static String |
DEPEND_PREFIX
Prefix for depend strings in the properties file. |
protected Map |
dependButtonMap
Map of JButtons to the String name of dependencies. |
protected Map |
dependMap
Map of Strings containing the name of dependencies to a List of Strings containing the name of the class prefixes that have that dependency. |
private static Insets |
emptyInset
Cached empty inset to avoid recreation. |
private static String |
EXCLUDE_PREFIX
Prefix for excluded tests in the properties file. |
protected Set |
excludedClassNames
Set of prefixes for classes that should be excluded from testing. |
protected Set |
inputClassNames
Set of all test classes found in the system. |
private static String |
JUNIT_LOGO_LOCATION
Location of the jUnit logo for the pretty button. |
private static String |
PACKAGE_LOCATION
Base location of this package to load the various resources from. |
private static String |
PROPERTY_FILE_LOCATION
Location of the 'launcher.properties' file that holds configuration data. |
private static String |
REMOVE_ICON_LOCATION
Location of the remove icon for the pretty button. |
protected JCheckBox |
selectAllCheckbox
The selectAllCheckbox. |
static Set |
selectedClasses
Static Set of Strings holding the names of the TestClasses the user wishes to execute. |
protected Toolkit |
toolkit
Holds the awt toolkit for the system. |
private static Insets |
widthInset
Cached inset to avoid recreation. |
private static Object |
WINDOW_NOTIFIER
Used for simple thread concurrency. |
Constructor Summary | |
TestLauncher()
Default constructor initializes all the internal structures. |
Method Summary | |
void |
actionPerformed(ActionEvent evt)
Listens for actions events on the various buttons. |
protected void |
addAllTests()
Adds all the tests under the "org.sape.carbon" package into the list of tests and then removes the performance classes and excluded classes. |
protected void |
addDepend(String dependName,
String className)
Adds a class name to the list of classes that match a dependency. |
protected void |
addExcludedClass(String excludedClassName)
Adds a single class name to the list of classes to exclude from showing the user. |
protected void |
addHeaderRows(JPanel testHarnessPanel,
GridBagLayout gridBagLayout)
Add header rows at the top of the testHarnessPanel. |
protected void |
addRow(JPanel testHarnessPanel,
GridBagLayout gridBagLayout,
String className)
Add checkbox rows to testHarnessPanel. |
protected void |
adjustFrameSize()
If there are too many test classes the Frame will run off the bottom of the screen. |
protected void |
closeAndReturn()
Populates the selectedClasses field based on the checkboxes, closes the frame, and calls notifyAll on the WINDOW_NOTIFIER. |
protected JPanel |
createButtonPanel()
Creates the panel of buttons across the top of the display that the user can use to execute jUnit or turn-off dependency groups. |
protected JPanel |
createTestHarnessPanel()
Creates the panel listing all of the located tests with checkboxes next to each to turn it on or off. |
void |
getUserInput()
This is the main method to build the frame and show it to the user. |
protected void |
loadPropertiesFile()
Loads and parses the properties file from the classpath. |
static void |
main(String[] args)
Executes the main program. |
void |
run()
Allows this class to be run as a thread. |
void |
runAsThread()
Runs the input in it's own thread and will return once the user has finished selecting and closed the window. |
protected void |
setAllCheckboxes(boolean checkboxState)
Cycles through all the checkboxes and sets the state. |
protected void |
setDependsCheckboxes(String dependName,
boolean checkboxState)
Sets all the checkboxes under a given depends key. |
void |
setInputClassNames(Set inputClassNames)
Sets the name of the classes to display to the user. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static Set selectedClasses
private static final Object WINDOW_NOTIFIER
private static final Insets emptyInset
private static final Insets widthInset
private static final String PACKAGE_LOCATION
private static final String PROPERTY_FILE_LOCATION
private static final String JUNIT_LOGO_LOCATION
private static final String REMOVE_ICON_LOCATION
private static final String CARBON_LOGO_LOCATION
private static final String EXCLUDE_PREFIX
private static final String DEPEND_PREFIX
private static final String ACTION_DONE
private static final String ACTION_CHECK_ALL
private static final String ACTION_REMOVE_DEPEND
protected Toolkit toolkit
protected JFrame applicationFrame
protected JCheckBox selectAllCheckbox
protected Map checkBoxToClassNameMap
protected Map classNameToCheckBoxMap
protected Set inputClassNames
protected Set excludedClassNames
protected Map dependMap
protected Map dependButtonMap
Constructor Detail |
public TestLauncher()
Method Detail |
public static void main(String[] args)
args
- ignoredprotected void loadPropertiesFile()
After execution the excludedClassNames and dependMap objects will be initialzed.
protected void addExcludedClass(String excludedClassName)
excludedClassName
- class name to excludeprotected void addDepend(String dependName, String className)
dependName
- the name of the dependency to add the class toclassName
- the name of the class to addprotected void addAllTests()
public void setInputClassNames(Set inputClassNames)
inputClassNames
- A set of Strings representing the
classes to show to the userpublic void run()
run
in interface Runnable
public void runAsThread()
public void getUserInput()
protected void adjustFrameSize()
protected JPanel createButtonPanel()
protected JPanel createTestHarnessPanel()
protected void addHeaderRows(JPanel testHarnessPanel, GridBagLayout gridBagLayout)
The only header row is a checkbox that will activate all other checkboxes in the panel.
testHarnessPanel
- the panel to add the row togridBagLayout
- the layout managerprotected void addRow(JPanel testHarnessPanel, GridBagLayout gridBagLayout, String className)
testHarnessPanel
- the panel to add the row togridBagLayout
- the layout managerclassName
- the name of the class to add a checkbox forprotected void setAllCheckboxes(boolean checkboxState)
checkboxState
- the state to set all checkboxes toprotected void setDependsCheckboxes(String dependName, boolean checkboxState)
dependName
- the name of the depend checkboxes to set.checkboxState
- the state of the checkboxes to setprotected void closeAndReturn()
public void actionPerformed(ActionEvent evt)
actionPerformed
in interface ActionListener
evt
- the event being performed.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |