net.sourceforge.anttestsetgen
Class TestSet

java.lang.Object
  extended byorg.apache.tools.ant.ProjectComponent
      extended byorg.apache.tools.ant.Task
          extended bynet.sourceforge.anttestsetgen.TestSet

public class TestSet
extends org.apache.tools.ant.Task

A TestSet contains the description of a test set.

A TestSet has the following attributes: - name - rowtoselect

A TestSet has the following subtasks: - Query - Entries

Version:
$Id: TestSet.java,v 1.3 2004/01/04 15:00:18 mcjansen Exp $
Author:
Marco Jansen (Contrado Technologies)

Field Summary
static java.lang.String SELECT_ALL
          Select all valid rows from the result set.
static java.lang.String SELECT_FIRST_ROW
          Select the first valid row from the result set.
 
Fields inherited from class org.apache.tools.ant.Task
description, location, target, taskName, taskType, wrapper
 
Fields inherited from class org.apache.tools.ant.ProjectComponent
project
 
Constructor Summary
TestSet()
           
 
Method Summary
 void addConfiguredEntry(Entry entry)
          Add a entry to the testset.
 void addConfiguredQuery(Query query)
          Add a Query to the TestSet.
 void addConfiguredValidation(Validation validation)
          Add an Configured Validation to this TestSet.
 void generateTestSet(java.sql.Connection connection)
          Generate a testset.
 java.util.List getEntries()
          Retrieve of the entries of the TestSet.
 java.lang.String getName()
          Retreive the name attribute.
 java.lang.String getQuery()
          Retrieve the query from the TestSet.
 java.lang.String getRowtoselect()
          Retrieve the rowtoselect attribute.
 java.util.List getUniqueEntriesInTestSet()
          Retrieve a list with all the unique entries in the test set.
 Validation getValidation()
          Retrieve the validation class.
 void setName(java.lang.String name)
          Set the name attribute.
 void setRowtoselect(java.lang.String rowtoselect)
          Set the rowtoselect attribute.
 
Methods inherited from class org.apache.tools.ant.Task
execute, getDescription, getLocation, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, handleErrorFlush, handleErrorOutput, handleFlush, handleOutput, init, isInvalid, log, log, maybeConfigure, perform, setDescription, setLocation, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName
 
Methods inherited from class org.apache.tools.ant.ProjectComponent
getProject, setProject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SELECT_FIRST_ROW

public static final java.lang.String SELECT_FIRST_ROW
Select the first valid row from the result set.

See Also:
Constant Field Values

SELECT_ALL

public static final java.lang.String SELECT_ALL
Select all valid rows from the result set.

See Also:
Constant Field Values
Constructor Detail

TestSet

public TestSet()
Method Detail

setName

public void setName(java.lang.String name)
Set the name attribute.

Parameters:
name - The name of the TestSet
See Also:
getName()

getName

public java.lang.String getName()
Retreive the name attribute.

Returns:
A string with the name of the TestSet
See Also:
setName(java.lang.String)

setRowtoselect

public void setRowtoselect(java.lang.String rowtoselect)
                    throws org.apache.tools.ant.BuildException
Set the rowtoselect attribute. This attribute defines which row should be select from the resultset. The attribute can contain the following values: - first - last - random

The default value for this attribute is the first row.

Parameters:
rowtoselect - Defines which row should be selected from the resultset: the first, the last or a random row.
Throws:
org.apache.tools.ant.BuildException - A BuildException is thrown if rowtoselect contains an invalid value.
See Also:
getRowtoselect()

getRowtoselect

public java.lang.String getRowtoselect()
Retrieve the rowtoselect attribute.

Returns:
The row that is used from the resultset (The first, the last or a random rowtoselect)
Throws:
org.apache.tools.ant.BuildException - A BuildException is thrown in rowtoselect contains an invalid value.
See Also:
setRowtoselect(java.lang.String)

getUniqueEntriesInTestSet

public java.util.List getUniqueEntriesInTestSet()
Retrieve a list with all the unique entries in the test set.

Returns:
a list with the names of the unique entries. The elements are of type String

addConfiguredQuery

public void addConfiguredQuery(Query query)
                        throws org.apache.tools.ant.BuildException
Add a Query to the TestSet. A TestSet should contain only one query. If more queries are added a BuildException is thrown.

Parameters:
query - The query to added to the TestSet
Throws:
org.apache.tools.ant.BuildException - A BuildException is thrown in more then one queries are added
See Also:
getQuery()

getQuery

public java.lang.String getQuery()
                          throws org.apache.tools.ant.BuildException
Retrieve the query from the TestSet. If there are any ant properties, replaced them with their values.

Returns:
The query from the TestSet. If there is no query defined, null is returned.
Throws:
org.apache.tools.ant.BuildException - In case the test set doesn't contain a query.
See Also:
addConfiguredQuery(net.sourceforge.anttestsetgen.Query)

addConfiguredValidation

public void addConfiguredValidation(Validation validation)
                             throws org.apache.tools.ant.BuildException
Add an Configured Validation to this TestSet.

Parameters:
validation - The validation class (required)
Throws:
org.apache.tools.ant.BuildException - In case there already is a validation defined in this testset.
See Also:
getValidation()

getValidation

public Validation getValidation()
Retrieve the validation class.

Returns:
The validation class
See Also:
addConfiguredValidation(net.sourceforge.anttestsetgen.Validation)

addConfiguredEntry

public void addConfiguredEntry(Entry entry)
Add a entry to the testset.

Parameters:
entry - A entry that describes how to map a database column on a key in the property file.

getEntries

public java.util.List getEntries()
Retrieve of the entries of the TestSet. A warning is given if there are no entries.

Returns:
A list with entries of the TestSet. The elements of the list are of type Entry
See Also:
Entry

generateTestSet

public void generateTestSet(java.sql.Connection connection)
Generate a testset.

Parameters:
connection - An open connection to the database


Copyright © 2003-2004 Marco Jansen (Contrado Technologies). All Rights Reserved.