net.sourceforge.anttestsetgen.sample
Class BroadBandValidator

java.lang.Object
  extended bynet.sourceforge.anttestsetgen.sample.BroadBandValidator
All Implemented Interfaces:
TestSetValidator

public class BroadBandValidator
extends java.lang.Object
implements TestSetValidator

Example of a TestSetValidator plug-in.

The BroadBandValidator is a plug-in for the TestSetGenerator that demonstrates how to develop your own validator. With this validator to parameters have to be set: name and city. Only when name contains the value '86 - 20th Ave.' and city contains the value 'Dallas' the validator will return true.

In case on of the parameters is not set an BuildException will be thrown during validation.

Version:
$Id: BroadBandValidator.java,v 1.1 2004/01/04 14:58:59 mcjansen Exp $
Author:
Marco Jansen (Contrado Technologies)

Field Summary
static java.lang.String VALID_CITY
          The city that supports ADSL.
static java.lang.String VALID_STREET
          The street that supports ADSL.
 
Constructor Summary
BroadBandValidator()
           
 
Method Summary
 boolean isValid()
          Validate the parameters.
 void setParameter(java.lang.String name, java.lang.String value)
          Set a parameter of the validator.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VALID_STREET

public static final java.lang.String VALID_STREET
The street that supports ADSL.

See Also:
Constant Field Values

VALID_CITY

public static final java.lang.String VALID_CITY
The city that supports ADSL.

See Also:
Constant Field Values
Constructor Detail

BroadBandValidator

public BroadBandValidator()
Method Detail

setParameter

public void setParameter(java.lang.String name,
                         java.lang.String value)
Set a parameter of the validator.

The ADSL Validator expects two parameters: name and city.

Specified by:
setParameter in interface TestSetValidator
Parameters:
name - The name of the parameter
value - The value of the parameter

isValid

public boolean isValid()
                throws org.apache.tools.ant.BuildException
Validate the parameters.

Only when name contains the value '86 - 20th Ave.' and city contains the value 'Dallas' the validator will return true.

Specified by:
isValid in interface TestSetValidator
Returns:
True when valid, false when not valid.
Throws:
org.apache.tools.ant.BuildException - In case one of the parameters is not set.


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