[jboss-svn-commits] JBoss Portal SVN: r5519 - in trunk/common/src/main/org/jboss/portal/common/test: . driver driver/command driver/response info
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Mon Oct 30 18:44:18 EST 2006
Author: julien at jboss.com
Date: 2006-10-30 18:44:07 -0500 (Mon, 30 Oct 2006)
New Revision: 5519
Modified:
trunk/common/src/main/org/jboss/portal/common/test/MonoValuedTestParameterValue.java
trunk/common/src/main/org/jboss/portal/common/test/MultiValuedTestParameterValue.java
trunk/common/src/main/org/jboss/portal/common/test/TestParameterValue.java
trunk/common/src/main/org/jboss/portal/common/test/driver/TestDriver.java
trunk/common/src/main/org/jboss/portal/common/test/driver/command/StartTestCommand.java
trunk/common/src/main/org/jboss/portal/common/test/driver/response/EndTestResponse.java
trunk/common/src/main/org/jboss/portal/common/test/driver/response/ErrorResponse.java
trunk/common/src/main/org/jboss/portal/common/test/driver/response/FailureResponse.java
trunk/common/src/main/org/jboss/portal/common/test/info/TestContainerInfo.java
trunk/common/src/main/org/jboss/portal/common/test/info/TestInfo.java
trunk/common/src/main/org/jboss/portal/common/test/info/TestItemInfo.java
trunk/common/src/main/org/jboss/portal/common/test/info/TestParameterInfo.java
Log:
added javadoc for the test framework
Modified: trunk/common/src/main/org/jboss/portal/common/test/MonoValuedTestParameterValue.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/test/MonoValuedTestParameterValue.java 2006-10-30 22:57:57 UTC (rev 5518)
+++ trunk/common/src/main/org/jboss/portal/common/test/MonoValuedTestParameterValue.java 2006-10-30 23:44:07 UTC (rev 5519)
@@ -23,7 +23,7 @@
package org.jboss.portal.common.test;
/**
- * A simple value.
+ * A mono value.
*
* @author <a href="mailto:julien at jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
@@ -31,7 +31,7 @@
public class MonoValuedTestParameterValue extends TestParameterValue
{
- /** . */
+ /** The value. */
protected final Object value;
public MonoValuedTestParameterValue(Object value)
Modified: trunk/common/src/main/org/jboss/portal/common/test/MultiValuedTestParameterValue.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/test/MultiValuedTestParameterValue.java 2006-10-30 22:57:57 UTC (rev 5518)
+++ trunk/common/src/main/org/jboss/portal/common/test/MultiValuedTestParameterValue.java 2006-10-30 23:44:07 UTC (rev 5519)
@@ -27,7 +27,7 @@
import java.util.Arrays;
/**
- * A multi valueed.
+ * A multi value.
*
* @author <a href="mailto:julien at jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
@@ -38,7 +38,7 @@
/** . */
protected final Collection value;
- public MultiValuedTestParameterValue(Object[] value)
+ public MultiValuedTestParameterValue(Object[] value) throws IllegalArgumentException
{
if (value == null)
{
@@ -49,7 +49,7 @@
this.value = Arrays.asList(value);
}
- public MultiValuedTestParameterValue(Collection value)
+ public MultiValuedTestParameterValue(Collection value) throws IllegalArgumentException
{
if (value == null)
{
@@ -65,6 +65,9 @@
return value;
}
+ /**
+ * Return an iterator over the values.
+ */
public Iterator iterator()
{
return new Iterator()
Modified: trunk/common/src/main/org/jboss/portal/common/test/TestParameterValue.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/test/TestParameterValue.java 2006-10-30 22:57:57 UTC (rev 5518)
+++ trunk/common/src/main/org/jboss/portal/common/test/TestParameterValue.java 2006-10-30 23:44:07 UTC (rev 5519)
@@ -32,5 +32,10 @@
*/
public abstract class TestParameterValue implements Serializable
{
+ /**
+ * Return the actual value.
+ *
+ * @return
+ */
public abstract Object get();
}
Modified: trunk/common/src/main/org/jboss/portal/common/test/driver/TestDriver.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/test/driver/TestDriver.java 2006-10-30 22:57:57 UTC (rev 5518)
+++ trunk/common/src/main/org/jboss/portal/common/test/driver/TestDriver.java 2006-10-30 23:44:07 UTC (rev 5519)
@@ -25,7 +25,7 @@
import org.jboss.portal.common.test.info.TestItemInfo;
/**
- * The contract that defines what a test is.
+ * The contract that defines what a testable system is and its usage.
*
* @author <a href="mailto:julien at jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
Modified: trunk/common/src/main/org/jboss/portal/common/test/driver/command/StartTestCommand.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/test/driver/command/StartTestCommand.java 2006-10-30 22:57:57 UTC (rev 5518)
+++ trunk/common/src/main/org/jboss/portal/common/test/driver/command/StartTestCommand.java 2006-10-30 23:44:07 UTC (rev 5519)
@@ -26,6 +26,8 @@
import org.jboss.portal.common.test.TestParametrization;
/**
+ * Start the test.
+ *
* @author <a href="mailto:julien at jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
@@ -38,7 +40,12 @@
/** . */
private TestParametrization parametrization;
- public StartTestCommand(String testName, TestParametrization parametrization)
+ /**
+ * @param testName the test name
+ * @param parametrization the test parametrization
+ * @throws IllegalArgumentException if the test name or the parametrization is null
+ */
+ public StartTestCommand(String testName, TestParametrization parametrization) throws IllegalArgumentException
{
if (testName == null)
{
@@ -52,11 +59,21 @@
this.parametrization = parametrization;
}
+ /**
+ * Return the test name.
+ *
+ * @return the test name
+ */
public String getTestName()
{
return testName;
}
+ /**
+ * Return the test parametrization.
+ *
+ * @return the test parametrization
+ */
public TestParametrization getParametrization()
{
return parametrization;
Modified: trunk/common/src/main/org/jboss/portal/common/test/driver/response/EndTestResponse.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/test/driver/response/EndTestResponse.java 2006-10-30 22:57:57 UTC (rev 5518)
+++ trunk/common/src/main/org/jboss/portal/common/test/driver/response/EndTestResponse.java 2006-10-30 23:44:07 UTC (rev 5519)
@@ -25,6 +25,8 @@
import org.jboss.portal.common.test.driver.DriverResponse;
/**
+ * Terminate the test.
+ *
* @author <a href="mailto:julien at jboss.org">Julien Viet</a>
* @version $Revision: 5448 $
*/
Modified: trunk/common/src/main/org/jboss/portal/common/test/driver/response/ErrorResponse.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/test/driver/response/ErrorResponse.java 2006-10-30 22:57:57 UTC (rev 5518)
+++ trunk/common/src/main/org/jboss/portal/common/test/driver/response/ErrorResponse.java 2006-10-30 23:44:07 UTC (rev 5519)
@@ -26,6 +26,8 @@
import junit.framework.AssertionFailedError;
/**
+ * An error occured during the execution of the test.
+ *
* @author <a href="mailto:julien at jboss.org">Julien Viet</a>
* @version $Revision: 5448 $
*/
Modified: trunk/common/src/main/org/jboss/portal/common/test/driver/response/FailureResponse.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/test/driver/response/FailureResponse.java 2006-10-30 22:57:57 UTC (rev 5518)
+++ trunk/common/src/main/org/jboss/portal/common/test/driver/response/FailureResponse.java 2006-10-30 23:44:07 UTC (rev 5519)
@@ -26,6 +26,8 @@
import junit.framework.AssertionFailedError;
/**
+ * A failure occured during the execution of the test.
+ *
* @author <a href="mailto:julien at jboss.org">Julien Viet</a>
* @version $Revision: 5448 $
*/
Modified: trunk/common/src/main/org/jboss/portal/common/test/info/TestContainerInfo.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/test/info/TestContainerInfo.java 2006-10-30 22:57:57 UTC (rev 5518)
+++ trunk/common/src/main/org/jboss/portal/common/test/info/TestContainerInfo.java 2006-10-30 23:44:07 UTC (rev 5519)
@@ -28,27 +28,48 @@
import java.util.Iterator;
/**
+ * Container for items.
+ *
* @author <a href="mailto:julien at jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
public class TestContainerInfo extends TestItemInfo
{
- /** . */
+ /** The map of children. */
private final Map children;
- public TestContainerInfo(String name)
+ /**
+ * Create a named container.
+ *
+ * @param name the container name
+ * @throws IllegalArgumentException if the name is null
+ */
+ public TestContainerInfo(String name) throws IllegalArgumentException
{
this(name, null);
}
- public TestContainerInfo(String name, String description)
+ /**
+ * Create a named container.
+ *
+ * @param name the container name
+ * @param description the container description
+ * @throws IllegalArgumentException if the name is null
+ */
+ public TestContainerInfo(String name, String description) throws IllegalArgumentException
{
super(name, description);
this.children = new HashMap();
}
- public TestContainerInfo(TestContainerInfo that)
+ /**
+ * Copy constructor which performs a deep copy of the structure.
+ *
+ * @param that the structure to deep copy
+ * @throws IllegalArgumentException if the container to copy is null
+ */
+ public TestContainerInfo(TestContainerInfo that) throws IllegalArgumentException
{
super(that);
this.children = new HashMap(that.children.size());
@@ -80,26 +101,48 @@
visitor.leave(this);
}
- public synchronized void addChild(TestItemInfo item)
+ /**
+ * Add a child to this container
+ *
+ * @param child the child to add
+ * @throws IllegalArgumentException if the child is null or already in the container
+ */
+ public void addChild(TestItemInfo child) throws IllegalArgumentException
{
- if (item == null)
+ if (child == null)
{
- throw new IllegalArgumentException();
+ throw new IllegalArgumentException("No null child accepted");
}
+ if (children.containsKey(child.getName()))
+ {
+ throw new IllegalArgumentException("Duplicate child " + child.getName());
+ }
// Perform attachment
- children.put(item.getName(), item);
+ children.put(child.getName(), child);
}
- public TestItemInfo getChild(String childName)
+ /**
+ * Retrieve a specified child
+ *
+ * @param childName the child name to retrieve
+ * @return the child or null if it cant be found
+ * @throws IllegalArgumentException if the child name is null
+ */
+ public TestItemInfo getChild(String childName) throws IllegalArgumentException
{
if (childName == null)
{
- throw new IllegalArgumentException();
+ throw new IllegalArgumentException("No null child name");
}
return (TestItemInfo)children.get(childName);
}
+ /**
+ * Return the set of child names.
+ *
+ * @return the child names
+ */
public Set getChildNames()
{
return children.keySet();
@@ -109,7 +152,7 @@
{
if (itemName == null)
{
- throw new IllegalArgumentException();
+ throw new IllegalArgumentException("No null item name");
}
if (getName().equals(itemName))
{
Modified: trunk/common/src/main/org/jboss/portal/common/test/info/TestInfo.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/test/info/TestInfo.java 2006-10-30 22:57:57 UTC (rev 5518)
+++ trunk/common/src/main/org/jboss/portal/common/test/info/TestInfo.java 2006-10-30 23:44:07 UTC (rev 5519)
@@ -25,7 +25,6 @@
import java.util.Map;
import java.util.HashMap;
import java.util.Set;
-import java.util.Iterator;
/**
* Meta information that describe a test.
@@ -39,18 +38,37 @@
/** The parameters that the test requires. */
private final Map parameters;
- public TestInfo(TestInfo that)
+ /**
+ * Copy constructor.
+ *
+ * @param that the structure to copy
+ * @throws IllegalArgumentException if the test to copy is null
+ */
+ public TestInfo(TestInfo that) throws IllegalArgumentException
{
super(that);
this.parameters = new HashMap(that.parameters);
}
- public TestInfo(String name)
+ /**
+ * Create a named test.
+ *
+ * @param name the test name
+ * @throws IllegalArgumentException if the name is null
+ */
+ public TestInfo(String name) throws IllegalArgumentException
{
this(name, null);
}
- public TestInfo(String name, String description)
+ /**
+ * Create a named test.
+ *
+ * @param name the test name
+ * @param description the test description
+ * @throws IllegalArgumentException if the name is null
+ */
+ public TestInfo(String name, String description) throws IllegalArgumentException
{
super(name, description);
this.parameters = new HashMap();
@@ -61,8 +79,13 @@
return new TestInfo(this);
}
-
- public void addParameter(TestParameterInfo parameter)
+ /**
+ * Add a test required to execute the test.
+ *
+ * @param parameter the parameter to add
+ * @throws IllegalArgumentException if the parameter is null or already exising
+ */
+ public void addParameter(TestParameterInfo parameter) throws IllegalArgumentException
{
if (parameter == null)
{
@@ -75,16 +98,28 @@
parameters.put(parameter.getName(), parameter);
}
+ /**
+ * Return the set of parameter names.
+ *
+ * @return the parameter names
+ */
public Set getParameterNames()
{
return parameters.keySet();
}
- public TestParameterInfo getParameter(String parameterName)
+ /**
+ * Return a specified parameter.
+ *
+ * @param parameterName the parameter name to retrieve
+ * @return the parameter or null if it does not exist
+ * @throws IllegalArgumentException if the parameter name is null
+ */
+ public TestParameterInfo getParameter(String parameterName) throws IllegalArgumentException
{
if (parameterName == null)
{
- throw new IllegalArgumentException();
+ throw new IllegalArgumentException("No null parameter name");
}
return (TestParameterInfo)parameters.get(parameterName);
}
@@ -93,7 +128,7 @@
{
if (itemName == null)
{
- throw new IllegalArgumentException();
+ throw new IllegalArgumentException("No null item name");
}
return getName().equals(itemName) ? this : null;
}
Modified: trunk/common/src/main/org/jboss/portal/common/test/info/TestItemInfo.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/test/info/TestItemInfo.java 2006-10-30 22:57:57 UTC (rev 5518)
+++ trunk/common/src/main/org/jboss/portal/common/test/info/TestItemInfo.java 2006-10-30 23:44:07 UTC (rev 5519)
@@ -25,6 +25,10 @@
import 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.
+ *
* @author <a href="mailto:julien at jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
@@ -37,48 +41,95 @@
/** The optional test description. */
private final String description;
- public TestItemInfo(TestItemInfo that)
+ /**
+ * Clone constructor.
+ *
+ * @param that the item to clone
+ * @throws IllegalArgumentException if the argument is null
+ */
+ protected TestItemInfo(TestItemInfo that) throws IllegalArgumentException
{
if (that == null)
{
- throw new IllegalArgumentException();
+ throw new IllegalArgumentException("No null item accepted");
}
this.name = that.name;
this.description = that.description;
}
- public TestItemInfo(String name)
+ /**
+ * Create an item with the specified name.
+ *
+ * @param name the test name
+ * @throws IllegalArgumentException if the name is null
+ */
+ protected TestItemInfo(String name) throws IllegalArgumentException
{
this(name, null);
}
- public TestItemInfo(String name, String description)
+ /**
+ * Create an item with the specified name.
+ *
+ * @param name the test name
+ * @param description the test description
+ * @throws IllegalArgumentException if the name is null
+ */
+ protected TestItemInfo(String name, String description) throws IllegalArgumentException
{
if (name == null)
{
- throw new IllegalArgumentException();
+ throw new IllegalArgumentException("No null item name accepted");
}
this.name = name;
this.description = description;
}
+ /**
+ * Return the item name.
+ *
+ * @return the item name.
+ */
public String getName()
{
return name;
}
+ /**
+ * Return the item description.
+ *
+ * @return the item description
+ */
public String getDescription()
{
return description;
}
- public abstract TestItemInfo findItem(String itemId);
+ /**
+ * Find an item within the scope of the current item.
+ *
+ * @param itemName the item name to find
+ * @return the item or null if not found
+ * @throws IllegalArgumentException if the name is null
+ */
+ public abstract TestItemInfo findItem(String itemName) throws IllegalArgumentException;
+ /**
+ * Create a deep clone of the current item in a detyped manner.
+ *
+ * @return a deep clone of the current item
+ */
public abstract TestItemInfo createClone();
protected abstract void internalVisit(Visitor visitor);
- public void visit(Visitor visitor)
+ /**
+ * Visit the structure following the GOF visitor pattern.
+ *
+ * @param visitor
+ * @throws IllegalArgumentException if the visitor is null
+ */
+ public void visit(Visitor visitor) throws IllegalArgumentException
{
if (visitor == null)
{
@@ -87,32 +138,49 @@
internalVisit(visitor);
}
+ /**
+ * Visitor interface for the item structure.
+ */
public interface Visitor
{
/**
- *
+ * Enter a container.
*/
void enter(TestContainerInfo testContainerInfo);
/**
- *
+ * Leave a container.
*/
void leave(TestContainerInfo testContainerInfo);
/**
- *
+ * Visit a test.
*/
void visit(TestInfo testInfo);
}
+ /**
+ * Boiler plate visitor.
+ */
public static class AbstractVisitor implements Visitor
{
+ /**
+ *
+ */
public void enter(TestContainerInfo testContainerInfo)
{
}
+
+ /**
+ *
+ */
public void leave(TestContainerInfo testContainerInfo)
{
}
+
+ /**
+ *
+ */
public void visit(TestInfo testInfo)
{
}
Modified: trunk/common/src/main/org/jboss/portal/common/test/info/TestParameterInfo.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/test/info/TestParameterInfo.java 2006-10-30 22:57:57 UTC (rev 5518)
+++ trunk/common/src/main/org/jboss/portal/common/test/info/TestParameterInfo.java 2006-10-30 23:44:07 UTC (rev 5519)
@@ -39,12 +39,25 @@
/** The optional parameter description. */
private final String description;
- public TestParameterInfo(String name)
+ /**
+ * Create a test parameter with the specified name.
+ *
+ * @param name the parameter name
+ * @throws IllegalArgumentException if the name is null
+ */
+ public TestParameterInfo(String name) throws IllegalArgumentException
{
this(name, null);
}
- public TestParameterInfo(String name, String description)
+ /**
+ * Create a test parameter with the specified name.
+ *
+ * @param name the parameter name
+ * @param description the parameter description
+ * @throws IllegalArgumentException if the name is null
+ */
+ public TestParameterInfo(String name, String description) throws IllegalArgumentException
{
if (name == null)
{
@@ -54,11 +67,21 @@
this.description = description;
}
+ /**
+ * Return the parameter name.
+ *
+ * @return the parameter name
+ */
public String getName()
{
return name;
}
+ /**
+ * Return the parameter description.
+ *
+ * @return the parameter description
+ */
public String getDescription()
{
return description;
More information about the jboss-svn-commits
mailing list