Package com.sun.javatest.exec
Class BasicSession
java.lang.Object
com.sun.javatest.exec.BasicSession
- All Implemented Interfaces:
Session
,SessionExt
The very classic implementation of Session that encapsulates the WorkDirectory
instance and InterviewParameters instance.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Event which is delivered when current configuration has been modified.static class
Event which is delivered when WorkDircotry has been set.static interface
Extension to the Observer interface for those classes which are sensitive to the order of notifying.static class
Class of update to configurationNested classes/interfaces inherited from interface com.sun.javatest.exec.Session
Session.Event, Session.Fault, Session.Observer, Session.Update
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
List of available filtersprotected final List
<Session.Observer> List of registered observersList of observable propertiesstatic final String
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Registers the observer.protected void
Associates session with the work dir.void
dispose()
Disposes configuration.protected TestFilter
findFilter
(String name) Supposed to be overridden when extra filters addedReturns InterviewParameters object, most likely the same object as getParamaters()Data required to execute tests.Returns the config property namesgetTestFilter
(String name) Work directory assigned to the session.protected void
Creates list of supported filters: ExcludeList, PriorStatus, Keyword, Relevant.protected void
Creates list of two session properties: WorkDirectory and Configuration.boolean
isReady()
void
loadInterviewFromFile
(WorkDirectory wd, File cfgFile) Loads interview from file.void
Delivers events to the all registered observersvoid
Reloads interview if out of date.void
Unregisters the observer.void
Restores the config state from the mapvoid
Saves the config state to the mapvoid
Applies the update.void
update
(Session.Update u, boolean updateConfig) Applies the update.protected void
Method invoked as a reaction on U_NewConfig update.protected void
updateWorkDir
(WorkDirectory wd, boolean doRestoreConfig) Sets the work dir to the new specified value, inovkes applyWorkDir() method, notifies observers of the work dir change.
-
Field Details
-
CONFIG_NAME_PROP
- See Also:
-
WD_PROP
- See Also:
-
observers
List of registered observers -
filterNames
List of available filters -
props
List of observable properties
-
-
Constructor Details
-
BasicSession
Creates empty session for the passed test suite.- Throws:
Session.Fault
-
-
Method Details
-
update
Applies the update. Ignores updates of unknown type. Subclasses need override this method to support more update types.- Specified by:
update
in interfaceSession
- Parameters:
u
- - object encapsulating data describing the change.- Throws:
Session.Fault
-
update
Applies the update. Ignores updates of unknown type. Subclasses need override this method to support more update types.- Specified by:
update
in interfaceSession
- Parameters:
u
- - object encapsulating data describing the change.updateConfig
- - hint whether to reload the configuration from disk- Throws:
Session.Fault
- Since:
- 4.4.1
-
addObserver
Description copied from interface:Session
Registers the observer. Does nothing if the observer is null or already registered.- Specified by:
addObserver
in interfaceSession
- Parameters:
obs
- - observer
-
removeObserver
Description copied from interface:Session
Unregisters the observer. Does nothing if the observer is null or not registered.- Specified by:
removeObserver
in interfaceSession
- Parameters:
obs
- - observer
-
notifyObservers
Delivers events to the all registered observers- Specified by:
notifyObservers
in interfaceSession
- Parameters:
evn
- - event to be sent out.
-
getTestFilter
-
findFilter
Supposed to be overridden when extra filters added- Parameters:
name
-- Returns:
- found filter or null, if not found.
-
getTestFilterNames
-
save
Description copied from interface:Session
Saves the config state to the map -
restore
Description copied from interface:Session
Restores the config state from the map- Specified by:
restore
in interfaceSession
- Parameters:
map
-- Throws:
Session.Fault
-
loadInterviewFromFile
Loads interview from file.- Specified by:
loadInterviewFromFile
in interfaceSessionExt
- Parameters:
wd
-cfgFile
-- Throws:
Session.Fault
-
dispose
public void dispose()Description copied from interface:Session
Disposes configuration. Critical when heavy objects were used. -
getPropertyNames
Description copied from interface:Session
Returns the config property names- Specified by:
getPropertyNames
in interfaceSession
- Returns:
- Configuration property name List
-
getValue
-
getWorkDirectory
Work directory assigned to the session.- Specified by:
getWorkDirectory
in interfaceSessionExt
- Returns:
- The current wd set.
-
getInterviewParameters
Description copied from interface:SessionExt
Returns InterviewParameters object, most likely the same object as getParamaters()According to the original idea there should not be such method in this interface, getParameters() should be enough. But JavaTest is not ready yet to not use InterviewParameters.
- Specified by:
getInterviewParameters
in interfaceSessionExt
- Returns:
- an instance of InterviewParameters
- See Also:
-
getParameters
Description copied from interface:Session
Data required to execute tests. In future - should be replaced.- Specified by:
getParameters
in interfaceSession
- Returns:
- The current parameters in use.
-
isReady
public boolean isReady() -
initFilterList
protected void initFilterList()Creates list of supported filters: ExcludeList, PriorStatus, Keyword, Relevant. -
initPropertyList
protected void initPropertyList()Creates list of two session properties: WorkDirectory and Configuration. -
updateWorkDir
Sets the work dir to the new specified value, inovkes applyWorkDir() method, notifies observers of the work dir change.It's not recommended to override this method.
- Parameters:
wd
- - instance of WorkDirectorydoRestoreConfig
- - flag to be passed via Event signaling whether restoring configuration from wd is required
-
applyWorkDir
Associates session with the work dir. To be overridden when wd should be applied not only to session, but template or other properties. -
updateNewConfig
Method invoked as a reaction on U_NewConfig update. Checks if there are any changes in the update, if none - does nothing, Otherwise, copies new values into the main configuration instance, notifies observers with E_NewConfig event.- Throws:
Session.Fault
-
reloadInterview
Reloads interview if out of date.- Specified by:
reloadInterview
in interfaceSessionExt
- Throws:
Session.Fault
-