edu.rice.cs.drjava.model.junit
Class ConcJUnitUtils

java.lang.Object
  extended by edu.rice.cs.drjava.model.junit.ConcJUnitUtils

public class ConcJUnitUtils
extends Object

Helpers for ConcJUnit.

Version:
$Id: ConcJUnitUtils.java 5175 2010-01-20 08:46:32Z mgricken $

Constructor Summary
ConcJUnitUtils()
           
 
Method Summary
static boolean generateRTConcJUnitJarFile(File rtFile, File concJUnitJarFile, File tmpDir)
          Generate the rt.concjunit.jar file using the specified concutest-junit-XXX-withrt.jar file.
static boolean isCompatibleRTConcJUnitFile(File f)
          Check if the file is a valid rt.concjunit.jar file that matches the currently running Java version.
static boolean isValidConcJUnitFile(File f)
          Check if the file is a valid concutest-junit-xxx-withrt.jar file.
protected static boolean isValidJarFile(File f, String... checkFilesInJar)
          Check if the file is a valid jar file containing the files in the varargs.
static boolean isValidJUnitFile(File f)
          Check if the file is a valid junit.jar file.
static boolean isValidRTConcJUnitFile(File f)
          Check if the file is a valid rt.concjunit.jar file.
static void showGenerateRTConcJUnitJarFileDialog(Frame parentFrame, File rtFile, File concJUnitJarFile, Runnable1<File> successRunnable, Runnable failureRunnable)
          Show the "Generate ConcJUnit Runtime" dialog (ask for file name, etc.).
static boolean showIncompatibleWantToRegenerateDialog(Frame parentFrame, Runnable yesRunnable, Runnable noRunnable)
          Ask the user if the rt.concjunit.jar file should be regenerated.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConcJUnitUtils

public ConcJUnitUtils()
Method Detail

isValidJarFile

protected static boolean isValidJarFile(File f,
                                        String... checkFilesInJar)
Check if the file is a valid jar file containing the files in the varargs.

Parameters:
f - file to check
checkFilesInJar - file names that should be in the jar file
Returns:
true if f is a jar file and the files are in the jar

isValidJUnitFile

public static boolean isValidJUnitFile(File f)
Check if the file is a valid junit.jar file.

Parameters:
f - file to check
Returns:
true if f is a valid junit.jar file

isValidConcJUnitFile

public static boolean isValidConcJUnitFile(File f)
Check if the file is a valid concutest-junit-xxx-withrt.jar file.

Parameters:
f - file to check
Returns:
true if f is a valid concutest-junit-xxx-withrt.jar file

isValidRTConcJUnitFile

public static boolean isValidRTConcJUnitFile(File f)
Check if the file is a valid rt.concjunit.jar file.

Parameters:
f - file to check
Returns:
true if f is a valid rt.concjunit.jar file

isCompatibleRTConcJUnitFile

public static boolean isCompatibleRTConcJUnitFile(File f)
Check if the file is a valid rt.concjunit.jar file that matches the currently running Java version.

Parameters:
f - file to check
Returns:
true if f is a compatible rt.concjunit.jar file

showIncompatibleWantToRegenerateDialog

public static boolean showIncompatibleWantToRegenerateDialog(Frame parentFrame,
                                                             Runnable yesRunnable,
                                                             Runnable noRunnable)
Ask the user if the rt.concjunit.jar file should be regenerated.

Parameters:
parentFrame - parent frame
Returns:
true if the user chose to regenerate

showGenerateRTConcJUnitJarFileDialog

public static void showGenerateRTConcJUnitJarFileDialog(Frame parentFrame,
                                                        File rtFile,
                                                        File concJUnitJarFile,
                                                        Runnable1<File> successRunnable,
                                                        Runnable failureRunnable)
Show the "Generate ConcJUnit Runtime" dialog (ask for file name, etc.).

Parameters:
parentFrame - parent frame
rtFile - suggestion of where we should generate the runtime
concJUnitJarFile - the concutest-junit-....-withrt.jar file that does the generation
successRunnable - command to execute after successful generation, parameter is the file
failureRunnable - command to execute if generation fails

generateRTConcJUnitJarFile

public static boolean generateRTConcJUnitJarFile(File rtFile,
                                                 File concJUnitJarFile,
                                                 File tmpDir)
Generate the rt.concjunit.jar file using the specified concutest-junit-XXX-withrt.jar file.

Parameters:
rtFile - target rt.concjunit.jar file
concJUnitJarFile - concutest-junit-XXX-withrt.jar file that contains the instrumentor
tmpDir - temporary directory for the processing
Returns:
true if successful