Methods Summary |
---|
public java.lang.String | className()This shows an example of a content-level method that returns
the name of the new name of the generated class. See the
junitperf.xdt file for an example of how to use this method.
This method shows how to use the active Ant subtask to retrieve
attributes defined in the Ant buildfile. Here we extract out the
'jUnitPerfPattern' attribute.
JUnitPerfDocletSubTask task = (JUnitPerfDocletSubTask)
getDocletContext().getActiveSubTask();
String currentJUnitTest = getCurrentClass().getName();
return MessageFormat.format(task.getJUnitPerfPattern(),
new Object[]{currentJUnitTest});
|
private java.lang.String | getJUnitConstructor()Helper method that retrieves the current class being evaluated. This
class should be an instance of a JUnit TestCase and
therefore we pass in as a single parameter the current method name
being evaluated. This produces a new instance of a TestCase
that executes a single JUnit test method. For example:
new TestExample("testExampleLoad"); might be
the output of the method.
return "new " + getCurrentClass().getName() + "(\"" +
getCurrentMethod().getName() + "\")";
|
private java.lang.String | getMaxElapsedTime()Helper method that retrieves the max allowed time for a
TimedTest to execute. This is another example of a mandatory
attribute.
return getTagValue(XDocletTagSupport.FOR_METHOD,
TIMED_TEST,
MAX_ELAPSED_TIME,
null,
null,
false,
true);
|
private java.lang.String | getNumberOfIterations()Helper method that retrieves the number of iterations each user
of a LoadTest must execute.
return getTagValue(XDocletTagSupport.FOR_METHOD,
LOAD_TEST,
NUMBER_OF_ITERATIONS,
null,
"1",
false,
false);
|
private java.lang.String | getNumberOfUsers()Helper method that retrieves the number of users to use for a
LoadTest . This method shows an example of how
to use the xdoclet.XDocletTagSupport.getMethodTagValue()
method.
return getTagValue(XDocletTagSupport.FOR_METHOD,
LOAD_TEST,
NUMBER_OF_USERS,
null,
null,
false,
true);
|
private java.lang.String | getWaitForCompletion()Helper method that retrieves whether or not the TimedTest
should wait for the JUnit test method to complete before throwing
an exception if the time has elapsed. This method shows an example
of setting up two valid default values.
return getTagValue(XDocletTagSupport.FOR_METHOD,
TIMED_TEST,
WAIT_FOR_COMPLETION,
"true,false",
"false",
false,
false);
|
public void | ifIsTestCase(java.lang.String template)If the current class being evaluated extends TestCase
then add the data contained in the given parameter.
if (TypeTagsHandler.isOfType(getCurrentClass(),
"junit.framework.TestCase",
TypeTagsHandler.TYPE_HIERARCHY)) {
generate(template);
}
|
public java.lang.String | loadTest()This method shows an example of how to use XDoclet to output
code that instantiates an object.
return "new LoadTest(" + getJUnitConstructor() +
", " + getNumberOfUsers() +
", " + getNumberOfIterations() + ");";
|
public java.lang.String | timedTest()This method shows an example of how to use XDoclet to output
code that instantiates an object.
return "new TimedTest(" + getJUnitConstructor() +
", " + getMaxElapsedTime() +
", " + getWaitForCompletion() + ");";
|