Eclipse JDT
Release 3.7

org.eclipse.jdt.junit.launcher
Class JUnitLaunchConfigurationDelegate

java.lang.Object
  extended by org.eclipse.debug.core.model.LaunchConfigurationDelegate
      extended by org.eclipse.jdt.launching.AbstractJavaLaunchConfigurationDelegate
          extended by org.eclipse.jdt.junit.launcher.JUnitLaunchConfigurationDelegate
All Implemented Interfaces:
IDebugEventSetListener, ILaunchConfigurationDelegate, ILaunchConfigurationDelegate2

public class JUnitLaunchConfigurationDelegate
extends AbstractJavaLaunchConfigurationDelegate

Launch configuration delegate for a JUnit test as a Java application.

Clients can instantiate and extend this class.

Since:
3.3

Field Summary
 
Fields inherited from class org.eclipse.debug.core.model.LaunchConfigurationDelegate
complileErrorProjectPromptStatus, complileErrorPromptStatus, promptStatus, saveScopedDirtyEditors, switchToDebugPromptStatus
 
Constructor Summary
JUnitLaunchConfigurationDelegate()
           
 
Method Summary
protected  void abort(String message, Throwable exception, int code)
          Throws a core exception with an error status object built from the given message, lower level exception, and error code.
protected  void collectExecutionArguments(ILaunchConfiguration configuration, List vmArguments, List programArguments)
          Collects all VM and program arguments.
protected  IMember[] evaluateTests(ILaunchConfiguration configuration, IProgressMonitor monitor)
          Evaluates all test elements selected by the given launch configuration.
 String[] getClasspath(ILaunchConfiguration configuration)
          Returns the entries that should appear on the user portion of the classpath as specified by the given launch configuration, as an array of resolved strings.
 void launch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor)
           
protected  void preLaunchCheck(ILaunchConfiguration configuration, ILaunch launch, IProgressMonitor monitor)
          Performs a check on the launch configuration's attributes.
 String verifyMainTypeName(ILaunchConfiguration configuration)
          Verifies a main type name is specified by the given launch configuration, and returns the main type name.
 
Methods inherited from class org.eclipse.jdt.launching.AbstractJavaLaunchConfigurationDelegate
getBootpath, getBootpathExt, getBreakpoints, getBuildOrder, getDefaultWorkingDirectory, getEnvironment, getJavaLibraryPath, getJavaProject, getJavaProjectName, getLaunchManager, getMainTypeName, getProgramArguments, getProjectsForProblemSearch, getVMArguments, getVMConnectorId, getVMInstall, getVMInstallName, getVMInstallType, getVMInstallTypeId, getVMRunner, getVMSpecificAttributesMap, getWorkingDirectory, getWorkingDirectoryPath, handleDebugEvents, isAllowTerminate, isLaunchProblem, isStopInMain, preLaunchCheck, prepareStopInMain, setDefaultSourceLocator, verifyJavaProject, verifyVMInstall, verifyWorkingDirectory
 
Methods inherited from class org.eclipse.debug.core.model.LaunchConfigurationDelegate
addReferencedProjects, buildForLaunch, buildProjects, computeBuildOrder, computeReferencedBuildOrder, existsProblems, finalLaunchCheck, getLaunch, saveBeforeLaunch
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JUnitLaunchConfigurationDelegate

public JUnitLaunchConfigurationDelegate()
Method Detail

launch

public void launch(ILaunchConfiguration configuration,
                   String mode,
                   ILaunch launch,
                   IProgressMonitor monitor)
            throws CoreException
Throws:
CoreException

preLaunchCheck

protected void preLaunchCheck(ILaunchConfiguration configuration,
                              ILaunch launch,
                              IProgressMonitor monitor)
                       throws CoreException
Performs a check on the launch configuration's attributes. If an attribute contains an invalid value, a CoreException with the error is thrown.

Parameters:
configuration - the launch configuration to verify
launch - the launch to verify
monitor - the progress monitor to use
Throws:
CoreException - an exception is thrown when the verification fails

verifyMainTypeName

public String verifyMainTypeName(ILaunchConfiguration configuration)
                          throws CoreException
Description copied from class: AbstractJavaLaunchConfigurationDelegate
Verifies a main type name is specified by the given launch configuration, and returns the main type name.

Overrides:
verifyMainTypeName in class AbstractJavaLaunchConfigurationDelegate
Parameters:
configuration - launch configuration
Returns:
the main type name specified by the given launch configuration
Throws:
CoreException - if unable to retrieve the attribute or the attribute is unspecified

evaluateTests

protected IMember[] evaluateTests(ILaunchConfiguration configuration,
                                  IProgressMonitor monitor)
                           throws CoreException
Evaluates all test elements selected by the given launch configuration. The elements are of type IType or IMethod. At the moment it is only possible to run a single method or a set of types, but not mixed or more than one method at a time.

Parameters:
configuration - the launch configuration to inspect
monitor - the progress monitor
Returns:
returns all types or methods that should be ran
Throws:
CoreException - an exception is thrown when the search for tests failed

collectExecutionArguments

protected void collectExecutionArguments(ILaunchConfiguration configuration,
                                         List vmArguments,
                                         List programArguments)
                                  throws CoreException
Collects all VM and program arguments. Implementors can modify and add arguments.

Parameters:
configuration - the configuration to collect the arguments for
vmArguments - a List of String representing the resulting VM arguments
programArguments - a List of String representing the resulting program arguments
Throws:
CoreException - if unable to collect the execution arguments

getClasspath

public String[] getClasspath(ILaunchConfiguration configuration)
                      throws CoreException
Description copied from class: AbstractJavaLaunchConfigurationDelegate
Returns the entries that should appear on the user portion of the classpath as specified by the given launch configuration, as an array of resolved strings. The returned array is empty if no classpath is specified.

Overrides:
getClasspath in class AbstractJavaLaunchConfigurationDelegate
Parameters:
configuration - launch configuration
Returns:
the classpath specified by the given launch configuration, possibly an empty array
Throws:
CoreException - if unable to retrieve the attribute

abort

protected void abort(String message,
                     Throwable exception,
                     int code)
              throws CoreException
Description copied from class: AbstractJavaLaunchConfigurationDelegate
Throws a core exception with an error status object built from the given message, lower level exception, and error code.

Overrides:
abort in class AbstractJavaLaunchConfigurationDelegate
Parameters:
message - the status message
exception - lower level exception associated with the error, or null if none
code - error code
Throws:
CoreException - the "abort" core exception

Eclipse JDT
Release 3.7

Guidelines for using Eclipse APIs.

Copyright (c) 2000, 2011 IBM Corporation and others. All rights reserved.