OpenCard  
 
OCF, the OpenCard Framework is a standard Java framework for working with Smart Cards.  
 

opencard.tests.terminal
Class ThreadStarter

java.lang.Object
  |
  +--opencard.core.service.CardService
        |
        +--opencard.tests.terminal.TestBean
              |
              +--opencard.tests.terminal.ThreadStarter

public class ThreadStarter
extends TestBean

ThreadStarter - A wrapper class to start mulitiple instances of one TestCases in multiple Thread. It is derived from the TestBean which provide most of the required functionality.
SAMPLE I:
ThreadStarter ts1 = new ThreadStarter();
ts1.setId("CTnTest1a");
ts1.initialize(CTnTest1a.class,2);
ts1.addExpectedResult(0);
ts1.execute();

SAMPLE II:
SmartCards[] cards = ...
ThreadStarter ts = new ThreadStarter();
ts.setId("CTnTest2");
ts.initialize(CTnTest2a.class, cards.length);
ts.setEmbedded();
ts.setCards(cards);
ts.addExpectedResult(0);
ts.execute();

SAMPLE III:
Class[] tests= {Test1.class, Test2.class, Test3.class};
ThreadStarter ts1 = new ThreadStarter();
ts1.setId("CTnTest1a");
ts1.initialize(tests);
ts1.addExpectedResult(0);
ts1.execute();

Version:
$Id: ThreadStarter.java,v 1.1 1999/12/03 09:31:37 damke Exp $
See Also:
TestBean

Fields inherited from class opencard.tests.terminal.TestBean
resultLookup
 
Constructor Summary
ThreadStarter()
          Default constructor.
 
Method Summary
 void execute()
          Execute
protected  SmartCard[] getCards()
          set the Smartcard objects the set of TestCase Classes should deal with
protected  int getInstances()
           
protected  java.lang.Class[] getTestToPerform()
           
protected  java.lang.Class getTestToPerform(int index)
           
 void initialize(java.lang.Class[] testCaseClasses)
          Initialize. set the Name of the different Test Cases to run in seperate threads
 void initialize(java.lang.Class testCaseClass, int instances)
          Initialize.
 boolean isEmbedded()
           
 void setCards(SmartCard[] cards)
          set the Smartcard objects the set of TestCase Classes should deal with
 void setEmbedded()
           
 void setResult(java.lang.Integer value, int index)
           
 void setTestToPerform(java.lang.Class[] testCaseClasses)
          set the Names of a set of TestCase Classes which should run in multiple threads
 void setTestToPerform(java.lang.Class testCaseClass, int instances)
          set the Name of one TestCase Class for which instances should run in multiple threads
 java.lang.String toString()
           
 
Methods inherited from class opencard.tests.terminal.TestBean
addExpectedResult, addExpectedResult, addUnexpectedResult, addUnexpectedResult, checkResult, clearResultLookup, getId, getLabel, getResult, getResultString, getTitle, isDetails, lookupResult, lookupResult, setDetails, setId, setLabel, setResult, setResult, setResult
 
Methods inherited from class opencard.core.service.CardService
allocateCardChannel, getCard, getCardChannel, getCHVDialog, initialize, releaseCardChannel, setCardChannel, setCHVDialog
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ThreadStarter

public ThreadStarter()
Default constructor. Sets a Label for the friendly log-output Since the TestBeans should be beans, please declare only the default constructor.
Method Detail

setTestToPerform

public void setTestToPerform(java.lang.Class testCaseClass,
                             int instances)
set the Name of one TestCase Class for which instances should run in multiple threads

setTestToPerform

public void setTestToPerform(java.lang.Class[] testCaseClasses)
set the Names of a set of TestCase Classes which should run in multiple threads

getTestToPerform

protected java.lang.Class[] getTestToPerform()

getTestToPerform

protected java.lang.Class getTestToPerform(int index)

getInstances

protected int getInstances()

setCards

public void setCards(SmartCard[] cards)
set the Smartcard objects the set of TestCase Classes should deal with

getCards

protected SmartCard[] getCards()
set the Smartcard objects the set of TestCase Classes should deal with

isEmbedded

public boolean isEmbedded()

setEmbedded

public void setEmbedded()

setResult

public void setResult(java.lang.Integer value,
                      int index)

initialize

public void initialize(java.lang.Class testCaseClass,
                       int instances)
                throws TestInitException
Initialize. Set the Name of a single Test Case to be performed in multiple instances
Parameters:
Class - of the TestCase to be performed
number - of instance which should run in different threads

initialize

public void initialize(java.lang.Class[] testCaseClasses)
                throws TestInitException
Initialize. set the Name of the different Test Cases to run in seperate threads
Parameters:
Array - of Classes of the TestCase to be performed
number - of instance which should run in different threads

execute

public void execute()
             throws TestFailedException
Execute
Throws:
throws - an TestFailedException, if result of this exceution is unexpected or not listed in the result lookup table
Overrides:
execute in class TestBean

toString

public java.lang.String toString()
Overrides:
toString in class TestBean