FileDocCategorySizeDatePackage
TestThread.javaAPI DocAndroid 1.5 API2632Wed May 06 22:41:02 BST 2009org.apache.harmony.crypto.tests.javax.crypto.func

TestThread

public abstract class TestThread extends Object implements Runnable

Fields Summary
public String[]
algNamesArray
public int
aCounter
public String
algName
public StringBuffer
errorSB
public int
fails
public boolean
flagTestResult
Constructors Summary
TestThread(String[] names)

     
      
        algNamesArray = names;
        aCounter = 0;
    
Methods Summary
public java.lang.StringgetAlgorithmName()

        return algName;
    
public java.lang.StringgetFailureMessages()

        return (errorSB == null) ? "" : new String(errorSB);
    
public java.lang.StringgetNextAlgorithmName()

        aCounter = (hasAlgorithmName()) ? aCounter : 0;
        return algNamesArray[aCounter++];
    
public longgetTotalFailuresNumber()

        return fails;
    
public booleanhasAlgorithmName()

        return (aCounter < algNamesArray.length);
    
public voidlauncher()

        Thread thread = null;

        do {
            algName = getNextAlgorithmName();
            thread = new Thread(this);
            thread.start();
            try {
                thread.join();
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        } while (hasAlgorithmName());
    
public voidrun()

        try {
            test();
        } catch (Exception e) {
            if(errorSB == null) {
                errorSB = new StringBuffer();
            }
            errorSB.append(e.getMessage());
            errorSB.append("\n");
            errorSB.append(getAlgorithmName());
            errorSB.append("\n");
            StackTraceElement[] st = e.getStackTrace();
            for (int i = 0; i < st.length; i++) {
                errorSB.append(st[i].toString());
                errorSB.append("\n");
            }
            fails++;
            return;
        }
        flagTestResult = true;
    
public abstract voidtest()