Package com.sun.javatest.exec
Interface Session
-
- All Known Subinterfaces:
SessionExt
- All Known Implementing Classes:
BasicSession
public interface Session
An interface that encapsulates all properties required to run tests. It's introduced to make it possible to get rid of such monsters as InterviewParameters, Template and WorkDir.It's assumed that components will communicate Session via Update and Event classes: those components which are aware how to modify the config will apply some Update object to the config, the config in its turn will send to all registered observers the corresponding Event object. Important note: JavaTest is not ready yet to operate with Session instances, therefore one should implement the SessionExt interface or extends BasicSession class to provide its own behavior.
- See Also:
SessionExt
,BasicSession
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
Session.Event
Root interface for all events happened when state of Session changed.static class
Session.Fault
Exception signaling of the problem happened while dealing with Session.static interface
Session.Observer
Interface for observers of the Session state.static interface
Session.Update
Root interface for all updates to Session.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
addObserver(Session.Observer obs)
Registers the observer.void
dispose()
Disposes configuration.Parameters
getParameters()
Data required to execute tests.java.util.List<java.lang.String>
getPropertyNames()
Returns the config property namesjava.lang.String
getValue(java.lang.String name)
boolean
isReady()
void
notifyObservers(Session.Event evn)
Delivers events to the all registered observersvoid
removeObserver(Session.Observer obs)
Unregisters the observer.void
restore(java.util.Map<java.lang.String,java.lang.String> map)
Restores the config state from the mapvoid
save(java.util.Map<java.lang.String,java.lang.String> map)
Saves the config state to the mapvoid
update(Session.Update u)
Method to be invoked from outside to change the state of the Session.void
update(Session.Update u, boolean updateConfig)
Method to be invoked from outside to change the state of the Session.
-
-
-
Method Detail
-
update
void update(Session.Update u) throws Session.Fault
Method to be invoked from outside to change the state of the Session.- Parameters:
u
- - object encapsulating data describing the change.- Throws:
Session.Fault
- in case of any problem
-
update
void update(Session.Update u, boolean updateConfig) throws Session.Fault
Method to be invoked from outside to change the state of the Session.- Parameters:
u
- - object encapsulating data describing the change.updateConfig
- - hint whether to reload the configuration from disk- Throws:
Session.Fault
- in case of any problem- Since:
- 4.4.1
-
addObserver
void addObserver(Session.Observer obs)
Registers the observer. Does nothing if the observer is null or already registered.- Parameters:
obs
- - observer
-
removeObserver
void removeObserver(Session.Observer obs)
Unregisters the observer. Does nothing if the observer is null or not registered.- Parameters:
obs
- - observer
-
notifyObservers
void notifyObservers(Session.Event evn)
Delivers events to the all registered observers- Parameters:
evn
- - event to be sent out.
-
save
void save(java.util.Map<java.lang.String,java.lang.String> map)
Saves the config state to the map
-
restore
void restore(java.util.Map<java.lang.String,java.lang.String> map) throws Session.Fault
Restores the config state from the map- Parameters:
map
-- Throws:
Session.Fault
-
dispose
void dispose()
Disposes configuration. Critical when heavy objects were used.
-
getPropertyNames
java.util.List<java.lang.String> getPropertyNames()
Returns the config property names- Returns:
- Configuration property name List
-
getValue
java.lang.String getValue(java.lang.String name)
- Returns:
- the value of property or null if unset
- Throws:
java.lang.IllegalArgumentException
- if case of unknown name- See Also:
getPropertyNames()
-
isReady
boolean isReady()
- Returns:
- true if configuration is ready for test execution
-
getParameters
Parameters getParameters()
Data required to execute tests. In future - should be replaced.- Returns:
- The current parameters in use.
-
-