org.castor.xmlctf

Class CastorTestCase


public class CastorTestCase
extends 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

static short
DIRECTORY
A directory-based Castor test case.
static short
JAR
A JAR-based Castor test case.
static String
TEST_DESCRIPTOR
Name of the resource for the test descriptor XML document.
static short
UNKNOWN
An unknown type of Castor test case.

Constructor Summary

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.
CastorTestCase(String name)
Constructs a CTF test case given only a test case name.

Method Summary

ClassLoader
getClassLoader()
String
getDirectoryToHere()
File
getOutputRootFile()
File
getTestFile()
short
getType()
boolean
isDirectoryCompiled()
Returns a boolean that when true indicates the output directory has been compiled.
void
setClassLoader(ClassLoader loader)
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.
Test
suite()
Assembles and returns a test suite containing all known tests.

Field Details

DIRECTORY

public static final short DIRECTORY
A directory-based Castor test case.
Field Value:
0

JAR

public static final short JAR
A JAR-based Castor test case.
Field Value:
1

TEST_DESCRIPTOR

public static final String TEST_DESCRIPTOR
Name of the resource for the test descriptor XML document.

UNKNOWN

public static final short UNKNOWN
An unknown type of Castor test case.
Field Value:
-1

Constructor Details

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.

CastorTestCase

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

Method Details

getClassLoader

public ClassLoader getClassLoader()

getDirectoryToHere

public String getDirectoryToHere()

getOutputRootFile

public File getOutputRootFile()

getTestFile

public File getTestFile()

getType

public short getType()

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 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

Intalio Inc. (C) 1999-2008. All rights reserved http://www.intalio.com