Package org.concordion.internal.cache
Enum Class RunResultsCache
- All Implemented Interfaces:
Serializable
,Comparable<RunResultsCache>
,Constable
A thread-safe class to provide caching of run results.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
failRun
(FixtureType fixtureType, String example) Run failed.void
finishRun
(FixtureType fixtureType, String example, ResultSummary actualResultSummary, ImplementationStatusChecker statusChecker) Updates the cache with the results of a run.getFromCache
(Class<?> fixtureClass, String example) Provides a direct method to access the cachegetFromCache
(FixtureType fixtureType, String example) Provides a direct method to access the cachevoid
removeAllFromCache
(FixtureType fixtureType) For test purposes onlyvoid
startFixtureRun
(FixtureType fixtureType, String specificationDescription) Initialises an entry in the cache for a specification with the given description.startRun
(FixtureType fixtureType, String example) Searches for a match in the cache.static RunResultsCache
Returns the enum constant of this class with the specified name.static RunResultsCache[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
SINGLETON
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum class has no constant with the specified nameNullPointerException
- if the argument is null
-
getFromCache
Provides a direct method to access the cache- Parameters:
fixtureClass
- class to retrieve from the cacheexample
- the example to get from the cache- Returns:
- can return null if not in the cache
-
getFromCache
Provides a direct method to access the cache- Parameters:
fixtureType
- class to retrieve from the cacheexample
- the example to get from the cache- Returns:
- can return null if not in the cache
-
startFixtureRun
Initialises an entry in the cache for a specification with the given description. Individual examples may then be run, and their results will be added to the fixture total whenfinishRun(FixtureType, String, ResultSummary, ImplementationStatusChecker)
is called.- Parameters:
fixtureType
- the fixture class that is being startedspecificationDescription
- a description of the target specification
-
startRun
Searches for a match in the cache. If there is no match, it marks the test as "in progress". This is done in one method to avoid thread synchronization issues.- Parameters:
fixtureType
- the fixture class to retrieveexample
- the name of the example that is being started (null OK)- Returns:
- the result summary from the cache
-
finishRun
public void finishRun(FixtureType fixtureType, String example, ResultSummary actualResultSummary, ImplementationStatusChecker statusChecker) Updates the cache with the results of a run.- Parameters:
fixtureType
- the fixture class to updateexample
- the name of the example that is being finished (null ok)actualResultSummary
- the results as reported from the specstatusChecker
- modifier that updates results dependent on ImplementationStatus (ExpectedToFail etc)
-
failRun
Run failed. Remove our placeholder value.- Parameters:
fixtureType
- fixture class that failedexample
- the name of the example that failed
-
removeAllFromCache
For test purposes only- Parameters:
fixtureType
- fixture class to remove cache results for
-