AutoTesterpublic class AutoTester extends AutoTesterBase implements AutoTesterInterfaceInstalls/Updates a test suite, runs the first MIDlet in the suite in a loop
specified number of iterations or until the new version of the suite is not
found, then removes the suite.
The MIDlet uses these application properties as arguments:
- arg-0: URL for the test suite
- arg-1: Used to override the default domain used when installing
an unsigned suite. The default is maximum to allow the runtime API tests
be performed automatically without tester interaction. The domain name
may be followed by a colon and a list of permissions that must be allowed
even if they are not listed in the MIDlet-Permissions attribute in the
application descriptor file. Instead of the list a keyword "all" can be
specified indicating that all permissions must be allowed, for example:
operator:all.
- arg-2: Integer number, specifying how many iterations to run
the suite. If argument is not given or less then zero, then suite
will be run until the new version of the suite is not found.
If arg-0 is not given then a form will be used to query the tester for
the arguments. |
Constructors Summary |
---|
public AutoTester()Create and initialize a new auto tester MIDlet.
super();
if (url != null) {
startBackgroundTester();
} else if (restoreSession()) {
// continuation of a previous session
startBackgroundTester();
} else {
/**
* No URL has been provided, ask the user.
*
* commandAction will subsequently call startBackgroundTester.
*/
getUrl();
}
|
Methods Summary |
---|
public void | installAndPerformTests(com.sun.midp.midletsuite.MIDletSuiteStorage midletSuiteStorage, Installer inp_installer, java.lang.String inp_url)Installs and performs the tests.
MIDletInfo midletInfo;
int suiteId = MIDletSuite.UNUSED_SUITE_ID;
try {
Isolate testIsolate;
for (; loopCount != 0; ) {
// force an overwrite and remove the RMS data
suiteId = inp_installer.installJad(inp_url,
Constants.INTERNAL_STORAGE_ID, true, true, installListener);
midletInfo = getFirstMIDletOfSuite(suiteId,
midletSuiteStorage);
testIsolate =
AmsUtil.startMidletInNewIsolate(suiteId,
midletInfo.classname, midletInfo.name, null,
null, null);
testIsolate.waitForExit();
if (loopCount > 0) {
loopCount -= 1;
}
}
} catch (Throwable t) {
handleInstallerException(suiteId, t);
}
if (midletSuiteStorage != null &&
suiteId != MIDletSuite.UNUSED_SUITE_ID) {
try {
midletSuiteStorage.remove(suiteId);
} catch (Throwable ex) {
// ignore
}
}
notifyDestroyed();
| public boolean | restoreSession()Restore the data from the last session, since this version of the
autotester does not have sessions it just returns false.
return false;
| public void | run()Run the installer.
installAndPerformTests(midletSuiteStorage, installer, url);
|
|