korat.testing.impl
Class TestCradle

java.lang.Object
  extended by korat.testing.impl.AbstractTestCaseGenerator
      extended by korat.testing.impl.TestCradle
All Implemented Interfaces:
ITester
Direct Known Subclasses:
TestCradleII

public class TestCradle
extends AbstractTestCaseGenerator
implements ITester

Given the Finitization, conducts tests for all regular candidates in domain state space

Author:
Sasa Misailovic

Field Summary
protected  IIntList accessedFields
           
protected  ClassLoader classLoader
           
protected  ConfigManager config
           
private  ICVFactory cvFactory
           
private  DataOutputStream dos
           
private  String finName
           
private static TestCradle instance
           
protected  boolean predicateOK
           
protected  StateSpace stateSpace
           
protected  IKoratSearchStrategy stateSpaceExplorer
           
protected  long totalExplored
           
private  boolean traceStarted
           
protected  long validCasesGenerated
           
 
Fields inherited from class korat.testing.impl.AbstractTestCaseGenerator
interrupted, out
 
Constructor Summary
protected TestCradle()
           
 
Method Summary
protected  boolean checkPredicate(Object testCase, Method predicate)
           
 void continueFieldTrace()
          Notifies continuation of a stopped field trace
 IIntList getAccessedFields()
           
 int[] getCandidateVector()
           
 ClassLoader getClassLoader()
           
private  Method getFinMethod(Class cls, String finName, String[] finArgs)
           
static TestCradle getInstance()
           
protected  Method getPredicateMethod(Class<?> testClass, String predicateName)
           
 StateSpace getStateSpace()
           
 long getTotalExplored()
           
 long getValidCasesGenerated()
           
protected  void initStartAndEndCVs(IKoratSearchStrategy ssExplorer)
           
private  IFinitization invokeFinMethod(Class cls, Method finitize, String[] finArgs)
           
 boolean isPredicateOK()
           
 void notifyFieldAccess(int accessedFieldIndex)
          Notifies that particular field has been accessed
 void notifyFieldAccess(Object obj, String field)
          Notifies that particular field has be accessed
private  void printCV(IKoratSearchStrategy sse, boolean predicateOK)
           
protected  void printStatus(IKoratSearchStrategy sse, boolean predicateOK)
           
private  void start(Class clazz, String[] finArgs)
           
 void start(String className, String[] finArgs)
           
 void startFieldTrace()
          Notifies the beginning of field trace
protected  void startTestGeneration(IFinitization fin)
           
 void stopFieldTrace()
          Notifies the end of field trace
 
Methods inherited from class korat.testing.impl.AbstractTestCaseGenerator
attachClient, attachSpecialClient, detachClient, interrupt, isInterrupted, log, log, log, notifyClients, notifyTestFinished, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

instance

private static TestCradle instance

cvFactory

private ICVFactory cvFactory

classLoader

protected ClassLoader classLoader

traceStarted

private boolean traceStarted

validCasesGenerated

protected long validCasesGenerated

totalExplored

protected long totalExplored

config

protected ConfigManager config

finName

private String finName

stateSpace

protected StateSpace stateSpace

accessedFields

protected IIntList accessedFields

stateSpaceExplorer

protected IKoratSearchStrategy stateSpaceExplorer

predicateOK

protected boolean predicateOK

dos

private DataOutputStream dos
Constructor Detail

TestCradle

protected TestCradle()
Method Detail

getInstance

public static TestCradle getInstance()

getClassLoader

public ClassLoader getClassLoader()

startFieldTrace

public void startFieldTrace()
Description copied from interface: ITester
Notifies the beginning of field trace

Specified by:
startFieldTrace in interface ITester

continueFieldTrace

public void continueFieldTrace()
Description copied from interface: ITester
Notifies continuation of a stopped field trace

Specified by:
continueFieldTrace in interface ITester

stopFieldTrace

public void stopFieldTrace()
Description copied from interface: ITester
Notifies the end of field trace

Specified by:
stopFieldTrace in interface ITester

notifyFieldAccess

public void notifyFieldAccess(Object obj,
                              String field)
Description copied from interface: ITester
Notifies that particular field has be accessed

Specified by:
notifyFieldAccess in interface ITester
Parameters:
obj - - object the field of which is accessed
field - - field that is accessed

notifyFieldAccess

public void notifyFieldAccess(int accessedFieldIndex)
Description copied from interface: ITester
Notifies that particular field has been accessed

Specified by:
notifyFieldAccess in interface ITester
Parameters:
accessedFieldIndex - - index of field in candidate vector

getValidCasesGenerated

public long getValidCasesGenerated()

getTotalExplored

public long getTotalExplored()

getCandidateVector

public int[] getCandidateVector()

isPredicateOK

public boolean isPredicateOK()

getAccessedFields

public IIntList getAccessedFields()

getStateSpace

public StateSpace getStateSpace()

start

public void start(String className,
                  String[] finArgs)
           throws KoratTestException
Throws:
KoratTestException

start

private void start(Class clazz,
                   String[] finArgs)
            throws KoratTestException
Throws:
KoratTestException

getFinMethod

private Method getFinMethod(Class cls,
                            String finName,
                            String[] finArgs)
                     throws CannotFindFinitizationException
Throws:
CannotFindFinitizationException

invokeFinMethod

private IFinitization invokeFinMethod(Class cls,
                                      Method finitize,
                                      String[] finArgs)
                               throws CannotInvokeFinitizationException
Throws:
CannotInvokeFinitizationException

startTestGeneration

protected void startTestGeneration(IFinitization fin)
                            throws CannotInvokePredicateException,
                                   CannotFindPredicateException
Throws:
CannotInvokePredicateException
CannotFindPredicateException

getPredicateMethod

protected Method getPredicateMethod(Class<?> testClass,
                                    String predicateName)
                             throws CannotFindPredicateException
Throws:
CannotFindPredicateException

checkPredicate

protected boolean checkPredicate(Object testCase,
                                 Method predicate)
                          throws CannotInvokePredicateException
Throws:
CannotInvokePredicateException

initStartAndEndCVs

protected void initStartAndEndCVs(IKoratSearchStrategy ssExplorer)

printStatus

protected void printStatus(IKoratSearchStrategy sse,
                           boolean predicateOK)

printCV

private void printCV(IKoratSearchStrategy sse,
                     boolean predicateOK)