Class CastorTestCase

java.lang.Object
junit.framework.Assert
junit.framework.TestCase
org.castor.xmlctf.CastorTestCase
All Implemented Interfaces:
junit.framework.Test

public class CastorTestCase extends junit.framework.TestCase
Abstracts a test case in the CTF (Castor Test Framework). A CTF test case can be driven by a directory or by a JAR file.
Version:
$Revision: 6787 $ $Date: 2004-03-08 17:23:25 -0700 (Mon, 08 Mar 2004) $
Author:
Arnaud Blandin
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final short
    A directory-based Castor test case.
    static final short
    A JAR-based Castor test case.
    static final String
    Name of the resource for the test descriptor XML document.
    static final short
    An unknown type of Castor test case.
  • Constructor Summary

    Constructors
    Constructor
    Description
    CastorTestCase(File file, String directoryToHere, String outputRoot)
    Constructs a CTF test case given a File (either a JAR file or a directory) and a directory where temporary files will be placed.
    Constructs a CTF test case given only a test case name.
  • Method Summary

    Modifier and Type
    Method
    Description
     
     
     
     
    short
     
    boolean
    Returns a boolean that when true indicates the output directory has been compiled.
    void
    Sets the ClassLoader to use for loading the resources for this test case.
    void
    setDirectoryCompiled(boolean compiled)
    Sets a flag to indicate the output directory has been compiled.
    junit.framework.Test
    Assembles and returns a test suite containing all known tests.

    Methods inherited from class junit.framework.TestCase

    assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, countTestCases, createResult, fail, fail, failNotEquals, failNotSame, failSame, format, getName, run, run, runBare, runTest, setName, setUp, tearDown, toString

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • UNKNOWN

      public static final short UNKNOWN
      An unknown type of Castor test case.
      See Also:
    • DIRECTORY

      public static final short DIRECTORY
      A directory-based Castor test case.
      See Also:
    • JAR

      public static final short JAR
      A JAR-based Castor test case.
      See Also:
    • TEST_DESCRIPTOR

      public static final String TEST_DESCRIPTOR
      Name of the resource for the test descriptor XML document.
      See Also:
  • Constructor Details

    • CastorTestCase

      public CastorTestCase(String name)
      Constructs a CTF test case given only a test case name.
      Parameters:
      name - the name of the test case
    • CastorTestCase

      public CastorTestCase(File file, String directoryToHere, String outputRoot)
      Constructs a CTF test case given a File (either a JAR file or a directory) and a directory where temporary files will be placed. The test case name will be derived from the file (JAR or directory) name.
      Parameters:
      file - Either a directory containing TestDescriptor.xml or a JAR file containing META-INF/TestDescriptor.xml
      directoryToHere - directory path leading to the current test.
      outputRoot - Directory where temporary files and output will go.
  • Method Details

    • getClassLoader

      public ClassLoader getClassLoader()
    • getTestFile

      public File getTestFile()
    • getType

      public short getType()
    • getDirectoryToHere

      public String getDirectoryToHere()
    • getOutputRootFile

      public File getOutputRootFile()
    • isDirectoryCompiled

      public boolean isDirectoryCompiled()
      Returns a boolean that when true indicates the output directory has been compiled. This is useful for preventing the compilation of a directory multiple times when more than one test case exists in a given directory.
      Returns:
      true when the output root directory has already been compiled.
    • setClassLoader

      public void setClassLoader(ClassLoader loader)
      Sets the ClassLoader to use for loading the resources for this test case.
      Parameters:
      loader - the class loader to use
    • setDirectoryCompiled

      public void setDirectoryCompiled(boolean compiled)
      Sets a flag to indicate the output directory has been compiled. This prevents compiling a directory multiple times unnecessarily when more than one test case exists in a given directory.
      Parameters:
      compiled - true if the output directory for this test case has been compiled
    • suite

      public junit.framework.Test suite()
      Assembles and returns a test suite containing all known tests.
      Returns:
      A non-null test suite if we can load the test descriptor