edu.cornell.cs.sam.ui
Class TestScript

java.lang.Object
  extended by edu.cornell.cs.sam.ui.TestScript

public class TestScript
extends java.lang.Object

This class holds an execution script to test multiple sam files and report the results.


Nested Class Summary
static class TestScript.Test
          Represents one single test
static class TestScript.TestResult
          This stores results from a test case run
static class TestScript.TestScriptException
           
static class TestScript.TestThread
           
 
Field Summary
protected  boolean autoSort
           
protected  Memory mem
           
protected  Processor proc
           
protected  java.io.File sourceFile
           
protected  Sys sys
           
protected  java.util.List<java.lang.String> testNames
           
protected  java.util.List<TestScript.Test> tests
           
 
Constructor Summary
TestScript()
          Creates a new TestScript
 
Method Summary
protected static void addIO(org.w3c.dom.Document xmlDoc, org.w3c.dom.Element testElem, java.lang.String classParam, TestScript.Test.DataType o)
           
protected static void addIOType(org.w3c.dom.Document xmlDoc, org.w3c.dom.Element testElem, java.lang.String classParam, java.util.Collection<TestScript.Test.DataType> coll)
           
 boolean addTest(TestScript.Test t)
          Add a test
 void clearTests()
          Remove all tests from this script
 void deleteTest(int i)
          Delete the test case
 void enableAutoSorting(boolean sort)
          Set this to true to enable the test script to be automatically sorted by test file name in alphabetical order
 java.io.File getSourceFile()
          Returns the file this TestScript is using
 TestScript.Test getTest(java.lang.String testName)
          Return a specific test
 java.util.List<java.lang.String> getTestNames()
          Return the list of test names
 java.util.List<TestScript.Test> getTests()
          Return the vector of the tests
 boolean isAutoSortingEnabled()
          Returns whether auto sorting is enabled
 void load(java.io.InputStream toParse)
          Loads the provided input stream
protected  TestScript.Test processTest(org.w3c.dom.Element e)
          Processes an individual test element
 void save(java.io.File toSave)
          Saves the test script to a file
 void setSourceFile(java.io.File file)
          Sets the file this testscript will load
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sys

protected Sys sys

proc

protected Processor proc

mem

protected Memory mem

testNames

protected java.util.List<java.lang.String> testNames

tests

protected java.util.List<TestScript.Test> tests

sourceFile

protected java.io.File sourceFile

autoSort

protected boolean autoSort
Constructor Detail

TestScript

public TestScript()
Creates a new TestScript

Method Detail

getSourceFile

public java.io.File getSourceFile()
Returns the file this TestScript is using

Returns:
the source file

setSourceFile

public void setSourceFile(java.io.File file)
Sets the file this testscript will load

Parameters:
file - the file to load

load

public void load(java.io.InputStream toParse)
          throws TestScript.TestScriptException
Loads the provided input stream

Parameters:
toParse - The stream on which the XML file can be read
Throws:
TestScript.TestScriptException - if there is a problem parsing the XML file

processTest

protected TestScript.Test processTest(org.w3c.dom.Element e)
                               throws TestScript.TestScriptException
Processes an individual test element

Throws:
TestScript.TestScriptException

isAutoSortingEnabled

public boolean isAutoSortingEnabled()
Returns whether auto sorting is enabled


enableAutoSorting

public void enableAutoSorting(boolean sort)
Set this to true to enable the test script to be automatically sorted by test file name in alphabetical order


save

public void save(java.io.File toSave)
          throws TestScript.TestScriptException
Saves the test script to a file

Parameters:
toSave - the file to save the XML test script to
Throws:
TestScript.TestScriptException - if there is an error writing the file

addIOType

protected static void addIOType(org.w3c.dom.Document xmlDoc,
                                org.w3c.dom.Element testElem,
                                java.lang.String classParam,
                                java.util.Collection<TestScript.Test.DataType> coll)

addIO

protected static void addIO(org.w3c.dom.Document xmlDoc,
                            org.w3c.dom.Element testElem,
                            java.lang.String classParam,
                            TestScript.Test.DataType o)

addTest

public boolean addTest(TestScript.Test t)
Add a test

Returns:
true if added, false if testname already exists

getTests

public java.util.List<TestScript.Test> getTests()
Return the vector of the tests

Returns:
the tests

getTestNames

public java.util.List<java.lang.String> getTestNames()
Return the list of test names

Returns:
the test names

getTest

public TestScript.Test getTest(java.lang.String testName)
Return a specific test

Parameters:
name - the name of the test
Returns:
the test, or null if it does not exist

clearTests

public void clearTests()
Remove all tests from this script


deleteTest

public void deleteTest(int i)
Delete the test case

See Also:
TestScript.Test#delete()