fr.inria.peerunit.rmi.coord
Class CoordinatorImpl

java.lang.Object
  extended by fr.inria.peerunit.rmi.coord.CoordinatorImpl
All Implemented Interfaces:
Bootstrapper, Coordinator, java.io.Serializable, java.lang.Runnable, java.rmi.Remote

public class CoordinatorImpl
extends java.lang.Object
implements Coordinator, Bootstrapper, java.lang.Runnable, java.io.Serializable

Author:
sunye
See Also:
Serialized Form

Constructor Summary
CoordinatorImpl(int testerNbr, int relaxIndex)
           
CoordinatorImpl(TesterUtil tu)
           
 
Method Summary
 void cleanUp()
          Clears references to testers.
 void execute(MethodDescription md)
          Dispatches a given action to a given set of testers.
 ResultSet getResultFor(MethodDescription md)
           
 Schedule getSchedule()
           
 boolean isRoot(int id)
           
 void methodExecutionFinished(ResultSet rs)
           
 void printVerdict()
          Waits for all testers to quit and calculates the global verdict for a test case.
 void quit()
          Makes the boostrapper leave the system.
 void quit(Tester t)
          Finish the test case and calculates the global oracle
 int register(Tester t)
          Registers a tester to this Bootstrapper.
 void registerMethods(Tester t, java.util.Collection<MethodDescription> list)
           
 void registerTesters(java.util.List<Tester> testers)
           
 void run()
           
 void testcaseExecution()
          Dispatches actions to testers:
 java.lang.String toString()
           
 void waitAllTestersToQuit()
          Waits for all testers to quit the system.
 void waitForTesterRegistration()
          Waits for all expected testers to registerMethods.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CoordinatorImpl

public CoordinatorImpl(int testerNbr,
                       int relaxIndex)
Parameters:
i - Number of expected testers. The Coordinator will wait for the connection of "i" testers before starting to dispatch actions to Testers.

CoordinatorImpl

public CoordinatorImpl(TesterUtil tu)
Method Detail

registerTesters

public void registerTesters(java.util.List<Tester> testers)
                     throws java.rmi.RemoteException
Specified by:
registerTesters in interface Coordinator
Throws:
java.rmi.RemoteException

registerMethods

public void registerMethods(Tester t,
                            java.util.Collection<MethodDescription> list)
                     throws java.rmi.RemoteException
Specified by:
registerMethods in interface Coordinator
Throws:
java.rmi.RemoteException
See Also:
fr.inria.peerunit.Coordinator#registerMethods(fr.inria.peerunit.Tester, java.util.List)

run

public void run()
Specified by:
run in interface java.lang.Runnable

printVerdict

public void printVerdict()
Waits for all testers to quit and calculates the global verdict for a test case.

Parameters:
chrono -

testcaseExecution

public void testcaseExecution()
                       throws java.lang.InterruptedException
Dispatches actions to testers:

Parameters:
chrono -
Throws:
java.lang.InterruptedException

execute

public void execute(MethodDescription md)
             throws java.lang.InterruptedException
Dispatches a given action to a given set of testers. Waits (blocks) until all tester have executed the action.

Parameters:
testers -
md -
Throws:
java.lang.InterruptedException

getResultFor

public ResultSet getResultFor(MethodDescription md)

register

public int register(Tester t)
             throws java.rmi.RemoteException
Description copied from interface: Bootstrapper
Registers a tester to this Bootstrapper.

Specified by:
register in interface Bootstrapper
Parameters:
t - The Tester to be registered.
Returns:
the generated ID for the added node, or Integer.MAX_VALUE if all nodes have already been registered
Throws:
java.rmi.RemoteException - When a communication error occurs.

methodExecutionFinished

public void methodExecutionFinished(ResultSet rs)
                             throws java.rmi.RemoteException
Specified by:
methodExecutionFinished in interface Coordinator
Throws:
java.rmi.RemoteException

quit

public void quit(Tester t)
          throws java.rmi.RemoteException
Description copied from interface: Coordinator
Finish the test case and calculates the global oracle

Specified by:
quit in interface Coordinator
Throws:
java.rmi.RemoteException

getSchedule

public Schedule getSchedule()
Returns:
A read-only map of (Methods X Testers).

waitForTesterRegistration

public void waitForTesterRegistration()
                               throws java.lang.InterruptedException
Waits for all expected testers to registerMethods.

Throws:
java.lang.InterruptedException

waitAllTestersToQuit

public void waitAllTestersToQuit()
                          throws java.lang.InterruptedException
Waits for all testers to quit the system.

Throws:
java.lang.InterruptedException

cleanUp

public void cleanUp()
Clears references to testers.


toString

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

isRoot

public boolean isRoot(int id)
               throws java.rmi.RemoteException
Throws:
java.rmi.RemoteException

quit

public void quit()
          throws java.rmi.RemoteException
Description copied from interface: Bootstrapper
Makes the boostrapper leave the system.

Specified by:
quit in interface Bootstrapper
Throws:
java.rmi.RemoteException


Copyright © 2010. All Rights Reserved.