|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||
java.lang.Object
|
+--EgTest
|
+--com.egurkha.agent.tests.GenericTest
GenericTest is the abstract base class for all user-defined Tests which an eGurkha user can develop and add to the existing eGurkha system.
Every Test runs on a specific component, internally or externally based on the method of execution. It has a set of variables which hold values for the different measures that are obtained as a result of execution.
Following is an example of a non-descriptor based test :
import com.egurkha.agent.tests.GenericTest;
public class AvailabilityTest extends GenericTest
{
// declare necessary variables
public AvailabilityTest ( String [] args )
{
super(args);
setMeasureCount(1);
}
public void computeMeasures ( Hashtable paramList )
{
double availability = getAvailability(param1);
ArrayList al = new ArrayList();
al.add(new Double(availability));
addNewMeasure(al);
}
// other methods
public double getAvailability(String commStr)
{
// User defined Implementation
}
}
Following is an example of a descriptor based test :
import com.egurkha.agent.tests.GenericTest;
public class AvailabilityTest extends GenericTest
{
String param1;
// declare other necessary variables
public AvailabilityTest ( String [] args )
{
super(args);
setMeasureCount(1);
}
public void computeMeasures ( Hashtable paramList )
{
param1 = paramList.get("communityString");
String [] servers = tokenizeServerList(param1);
double availability = 0;
ArrayList al = null;
for(int i=0; i=servers.length-1; i++)
{
availability = getAvailability(servers[i]);
al = new ArrayList();
al.add(new Double(availability));
addNewMeasure(servers[i], al);
}
}
// other methods
public double getAvailability(String commStr)
{
// User defined Implementation
}
public String [] tokenizeServerList(String param)
{
// User defined Implementation
}
}
| Field Summary | |
protected java.util.Hashtable |
descMeasures
|
protected int |
measureCount
|
protected java.util.ArrayList |
measures
|
protected java.util.Hashtable |
params
|
| Fields inherited from class EgTest |
configInfo,
dateInfo,
debug,
disableInfo,
disableReported,
disableSection,
disableTest,
egConfigDir,
errorMsg,
info,
infoFieldSeparator,
infoList,
infos,
infoTable,
ipAddresses,
isValid,
measurementHost,
noneValue,
numOutputFields,
os,
portNo,
process,
results,
sid,
siteAndInfoSeparator,
siteName,
target,
targetHost,
testDateAndTime,
testInfo,
thresholds,
timeSinceLastTest |
| Constructor Summary | |
GenericTest(java.lang.String[] args)
|
|
| Method Summary | |
void |
addMeasures(java.util.ArrayList measureList)
Adds measures from the Test to the eGurkha system |
void |
addMeasures(java.lang.String descriptor,
java.util.ArrayList measureList)
Adds measures from the Test to the eGurkha system |
void |
addNewMeasure(java.util.ArrayList al)
|
void |
addNewMeasure(java.lang.String desc,
java.util.ArrayList al)
|
void |
addUnknownMeasures()
Adds unknown measures from the Test to the eGurkha system during an exceptional condition |
void |
computeMeasures(java.util.Hashtable params)
|
boolean |
executeTest()
|
void |
getParams(java.lang.String[] args)
Initializes the necessary variables of the test and is called from the constructor |
java.lang.String |
getValueForParam(java.lang.String name)
Gets the value for a parameter passed for the Test |
void |
initTest()
Initializes the Test |
void |
setErrorMessage(java.lang.String errorMsg)
Logs an error message associated with the Test to the eGurkha system |
void |
setMeasureCount(int measureCount)
Sets the count of measures for a test and is called from the test's constructor |
void |
updateAllMeasures()
Updates all measures for the Test with the eGurkha system |
void |
updateAllMeasures(boolean dynamic)
Updates all measures for the Test with the eGurkha system |
| Methods inherited from class EgTest |
addIndexToResultSet,
addToDisabledInfo,
addValueToResultSet,
closeReader,
destroy,
executeProgram,
getHostName,
getMeasurementsLength,
getValidIndex,
infoDisabledFor,
populateInfoTable,
setThresholdProperties,
stopTest,
updateAllResultSets,
updateAllResultSets |
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
| Field Detail |
protected java.util.Hashtable params
protected int measureCount
protected java.util.ArrayList measures
protected java.util.Hashtable descMeasures
| Constructor Detail |
public GenericTest(java.lang.String[] args)
| Method Detail |
public void computeMeasures(java.util.Hashtable params)
public boolean executeTest()
public final void addNewMeasure(java.util.ArrayList al)
public final void addNewMeasure(java.lang.String desc,
java.util.ArrayList al)
public final void setMeasureCount(int measureCount)
measureCount - Number of measures (int) reported
by the Testpublic final void getParams(java.lang.String[] args)
args - Array of java.lang.String passed to
the constructorpublic java.lang.String getValueForParam(java.lang.String name)
name - java.lang.String - name of the parameterpublic final void initTest()
Called usually from the beginning of executeTest()
public final void addMeasures(java.util.ArrayList measureList)
measureList - Measures stored in a
java.util.ArrayList
public final void addMeasures(java.lang.String descriptor,
java.util.ArrayList measureList)
descriptor - java.lang.String which identifies
the set of measures addedmeasureList - Measures stored in a java.util.ArrayListpublic final void addUnknownMeasures()
public final void updateAllMeasures()
public final void updateAllMeasures(boolean dynamic)
dynamic - boolean
true if the descriptors
for the test are dynamically resolvedpublic final void setErrorMessage(java.lang.String errorMsg)
errorMsg - java.lang.String which explains
the error occured
|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||