public class BasicSession extends java.lang.Object implements SessionExt
Modifier and Type | Class and Description |
---|---|
static class |
BasicSession.E_NewConfig
Event which is delivered when current configuration has been modified.
|
static class |
BasicSession.E_NewWD
Event which is delivered when WorkDircotry has been set.
|
static interface |
BasicSession.OrderedObserver
Extension to the Observer interface for those classes which
are sensitive to the order of notifying.
|
static class |
BasicSession.U_NewConfig
Class of update to configuration
|
Session.Event, Session.Fault, Session.Observer, Session.Update
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CONFIG_NAME_PROP |
protected java.util.List<java.lang.String> |
filterNames
List of available filters
|
protected java.util.List<Session.Observer> |
observers
List of registered observers
|
protected java.util.List<java.lang.String> |
props
List of observable properties
|
static java.lang.String |
WD_PROP |
Constructor and Description |
---|
BasicSession(TestSuite ts)
Creates empty session for the passed test suite.
|
Modifier and Type | Method and Description |
---|---|
void |
addObserver(Session.Observer obs)
Registers the observer.
|
protected void |
applyWorkDir(WorkDirectory wd)
Associates session with the work dir.
|
void |
dispose()
Disposes configuration.
|
protected TestFilter |
findFilter(java.lang.String name)
Supposed to be overridden when extra filters added
|
InterviewParameters |
getInterviewParameters()
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.
|
Parameters |
getParameters()
Data required to execute tests.
|
java.util.List<java.lang.String> |
getPropertyNames()
Returns the config property names
|
TestFilter |
getTestFilter(java.lang.String name) |
java.util.List<java.lang.String> |
getTestFilterNames() |
java.lang.String |
getValue(java.lang.String name) |
WorkDirectory |
getWorkDirectory()
Work directory assigned to the session.
|
protected void |
initFilterList()
Creates list of supported filters: ExcludeList, PriorStatus, Keyword,
Relevant.
|
protected void |
initPropertyList()
Creates list of two session properties: WorkDirectory and Configuration.
|
boolean |
isReady() |
void |
loadInterviewFromFile(WorkDirectory wd,
java.io.File cfgFile)
Loads interview from file.
|
void |
notifyObservers(Session.Event evn)
Delivers events to the all registered observers
|
void |
reloadInterview()
Reloads interview if out of date.
|
void |
removeObserver(Session.Observer obs)
Unregisters the observer.
|
void |
restore(java.util.Map map)
Restores the config state from the map
|
void |
save(java.util.Map map)
Saves the config state to the map
|
void |
update(Session.Update u)
Applies the update.
|
void |
update(Session.Update u,
boolean updateConfig)
Applies the update.
|
protected void |
updateNewConfig(InterviewParameters ip)
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.
|
protected final java.util.List<Session.Observer> observers
protected final java.util.List<java.lang.String> filterNames
protected final java.util.List<java.lang.String> props
public static final java.lang.String CONFIG_NAME_PROP
public static final java.lang.String WD_PROP
public BasicSession(TestSuite ts) throws Session.Fault
ts
- Session.Fault
public void update(Session.Update u) throws Session.Fault
update
in interface Session
u
- Session.Fault
public void update(Session.Update u, boolean updateConfig) throws Session.Fault
update
in interface Session
u
- updateConfig
- - hint whether to reload the configuration from diskSession.Fault
public void addObserver(Session.Observer obs)
Session
addObserver
in interface Session
obs
- - observerpublic void removeObserver(Session.Observer obs)
Session
removeObserver
in interface Session
obs
- - observerpublic void notifyObservers(Session.Event evn)
notifyObservers
in interface Session
evn
- - event to be sent out.public TestFilter getTestFilter(java.lang.String name)
protected TestFilter findFilter(java.lang.String name)
name
- public java.util.List<java.lang.String> getTestFilterNames()
public void save(java.util.Map map)
Session
public void restore(java.util.Map map) throws Session.Fault
Session
restore
in interface Session
Session.Fault
public void loadInterviewFromFile(WorkDirectory wd, java.io.File cfgFile) throws Session.Fault
loadInterviewFromFile
in interface SessionExt
wd
- cfgFile
- Session.Fault
public void dispose()
Session
public java.util.List<java.lang.String> getPropertyNames()
Session
getPropertyNames
in interface Session
public java.lang.String getValue(java.lang.String name)
getValue
in interface Session
Session.getPropertyNames()
public WorkDirectory getWorkDirectory()
getWorkDirectory
in interface SessionExt
public InterviewParameters getInterviewParameters()
SessionExt
getInterviewParameters
in interface SessionExt
Session.getParameters()
public Parameters getParameters()
Session
getParameters
in interface Session
public boolean isReady()
protected void initFilterList()
protected void initPropertyList()
protected void updateWorkDir(WorkDirectory wd, boolean doRestoreConfig)
It's not recommended to override this method.
wd
- - instance of WorkDirectorydoRestoreConfig
- - flag to be passed via Event
signaling whether restoring configuration from wd is requiredprotected void applyWorkDir(WorkDirectory wd)
wd
- protected void updateNewConfig(InterviewParameters ip) throws Session.Fault
ip
- Session.Fault
public void reloadInterview() throws Session.Fault
reloadInterview
in interface SessionExt
Session.Fault
Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.