org.jboss.portal.test.framework.info
Class TestItemInfo

java.lang.Object
  extended by org.jboss.portal.test.framework.info.TestItemInfo
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
TestContainerInfo, TestInfo

public abstract class TestItemInfo
extends java.lang.Object
implements java.io.Serializable

A test item info is the abstraction over a test info and a test container info as both of them contains similarities. It is a data structure which describes a collection of tests.

Version:
$Revision: 7228 $
Author:
Julien Viet
See Also:
Serialized Form

Nested Class Summary
static class TestItemInfo.AbstractVisitor
          Boiler plate visitor.
static interface TestItemInfo.Visitor
          Visitor interface for the item structure.
 
Field Summary
protected  java.lang.String description
          The optional test description.
protected  java.lang.String name
          The test name.
protected  TestContainerInfo parent
          The optional parent.
 
Constructor Summary
protected TestItemInfo(java.lang.String name)
          Create an item with the specified name.
protected TestItemInfo(java.lang.String name, java.lang.String description)
          Create an item with the specified name.
protected TestItemInfo(TestItemInfo that)
          Clone constructor.
 
Method Summary
abstract  TestItemInfo createClone()
          Create a deep clone of the current item in a detyped manner.
abstract  TestItemInfo findItem(java.lang.String itemId)
          Find an item within the scope of the current item.
 java.lang.String getDescription()
          Return the item description.
 java.lang.String getId(TestItemInfo context)
          Return the id relative to a parent context.
 java.lang.String getName()
          Return the item name.
 TestContainerInfo getParent()
          Return the parent or null if it does not exist.
protected  java.lang.StringBuffer internalGetId()
           
protected  java.lang.StringBuffer internalGetId(TestItemInfo context)
           
protected abstract  void internalVisit(TestItemInfo.Visitor visitor)
           
 void visit(TestItemInfo.Visitor visitor)
          Visit the structure following the GOF visitor pattern.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

name

protected final java.lang.String name
The test name.


description

protected final java.lang.String description
The optional test description.


parent

protected TestContainerInfo parent
The optional parent.

Constructor Detail

TestItemInfo

protected TestItemInfo(TestItemInfo that)
                throws java.lang.IllegalArgumentException
Clone constructor.

Parameters:
that - the item to clone
Throws:
java.lang.IllegalArgumentException - if the argument is null

TestItemInfo

protected TestItemInfo(java.lang.String name)
                throws java.lang.IllegalArgumentException
Create an item with the specified name.

Parameters:
name - the test name
Throws:
java.lang.IllegalArgumentException - if the name is null

TestItemInfo

protected TestItemInfo(java.lang.String name,
                       java.lang.String description)
                throws java.lang.IllegalArgumentException
Create an item with the specified name.

Parameters:
name - the test name
description - the test description
Throws:
java.lang.IllegalArgumentException - if the name is null
Method Detail

getName

public java.lang.String getName()
Return the item name.

Returns:
the item name.

getDescription

public java.lang.String getDescription()
Return the item description.

Returns:
the item description

getParent

public TestContainerInfo getParent()
Return the parent or null if it does not exist.

Returns:
the parent

getId

public java.lang.String getId(TestItemInfo context)
Return the id relative to a parent context.

Returns:
the id relative

internalGetId

protected java.lang.StringBuffer internalGetId(TestItemInfo context)

internalGetId

protected java.lang.StringBuffer internalGetId()

findItem

public abstract TestItemInfo findItem(java.lang.String itemId)
                               throws java.lang.IllegalArgumentException
Find an item within the scope of the current item.

Parameters:
itemId - the item id to find
Returns:
the item or null if not found
Throws:
java.lang.IllegalArgumentException - if the id is null

createClone

public abstract TestItemInfo createClone()
Create a deep clone of the current item in a detyped manner.

Returns:
a deep clone of the current item

internalVisit

protected abstract void internalVisit(TestItemInfo.Visitor visitor)

visit

public void visit(TestItemInfo.Visitor visitor)
           throws java.lang.IllegalArgumentException
Visit the structure following the GOF visitor pattern.

Parameters:
visitor -
Throws:
java.lang.IllegalArgumentException - if the visitor is null