public class ModelInstance extends Object
Constructor and Description |
---|
ModelInstance(LspsRemote remote,
Module module,
long id) |
Modifier and Type | Method and Description |
---|---|
void |
deactivateGoal(String goal) |
boolean |
equals(Object obj) |
EvaluationResultValue |
evaluateExpressionInEvaluationLevel(Long contextId,
String expression,
String evaluationLevel,
boolean mergeEvaluation)
Evaluates expression in the given context and the specified evaluation level.
|
EvaluationResultValue |
evaluateExpressionInEvaluationLevel(String expression,
String evaluationLevel,
boolean mergeEvaluation)
Evaluates expression in the specified evaluation level.
|
EvaluationResultValue |
execute(String expression)
Evaluates expression in base context.
|
EvaluationResultValue |
execute(String expression,
Long contextId)
Evaluates expression in base evaluation level in the specified context.
|
List<Todo> |
findAliveTodos()
Finds alive Todos created by this model instance.
|
List<Todo> |
findAliveTodos(String title)
Finds alive Todos created by this model instance.
|
List<Todo> |
findAliveTodosForPerson(Person person)
Finds Todos created by this model instance in the given person todo list.
|
List<RollbackInfo> |
findRollbackInfos()
Returns a list of rollback informations (when model run encounters an exception, the DB transaction is rolled back and a instance is produced).
|
Todo |
findSingleAliveTodo(String title)
Finds an alive Todo with the given title.
|
Todo |
findSingleAliveTodoForPerson(Person person,
String title)
Finds an alive Todo with the given title in the todo list of the current user
belonging to this model instance.
|
List<Todo> |
findTodos()
Finds Todos created by this model instance.
|
List<Todo> |
findTodos(TodoStatus status)
Finds todos created by this model instance with the given status.
|
List<Todo> |
findTodos(TodoStatus status,
String title)
Finds todos created by this model instance with the given status and a given title.
|
EvaluationResultValue |
gc()
Performs a GC.
|
List<ModelInstance> |
getChildren()
Returns the list of children model instances.
|
List<ModelInstance> |
getChildren(ModelInstanceState state)
Returns the list of children model instances
that have the given lifecycle state.
|
List<ModelInstance> |
getChildren(ModelInstanceState state,
Module module)
Returns the list of children model instances
that have the given lifecycle state
and are running on a given model.
|
List<ModelInstance> |
getChildren(Module module)
Returns the list of children model instances
that are runnig on a given model.
|
List<RollbackInfo> |
getErrors() |
GoalState |
getGoalState(String goal)
Returns a state of the given goal.
|
long |
getId()
Returns the model instance id.
|
ModelInstanceInfo |
getInfo() |
ModelInstanceLogs |
getLogs()
Gets all log entries for this model instance.
|
long |
getMainContextId() |
long |
getModelId()
Returns the ID of the model instance model.
|
String |
getModelName()
Returns the name of the model instance model.
|
String |
getModelVersion()
Returns the version of the model instance model.
|
ModelInstance |
getParent()
Returns the parent model instance.
|
ProcessInstance |
getProcessInstance(String name)
Returns the single process instance with given name for this model instance.
|
List<ProcessInstance> |
getProcessInstances(String name)
Finds all process instances for this model instance, with given name.
|
ProcessInstanceState |
getProcessInstanceState(String name)
Returns the state of a process instance with given name.
|
List<ProcessLog> |
getProcessLogs() |
Map<String,String> |
getProperties()
Returns the model instance properties.
|
LspsRemote |
getRemote()
Returns the associated remote.
|
List<Signal> |
getSignals()
Returns a list of signals in the signal queue of this model instance.
|
ModelInstanceState |
getState()
Returns the model instance state
|
Object |
getVariableValue(String name)
Returns the value of module variable.
|
int |
hashCode() |
void |
notifyModelInstance()
Wakes up the model execution and continues the processing.
|
void |
reactivateGoal(String goal) |
void |
removeSignal(long signalId) |
void |
resume()
Resumes the model execution.
|
void |
sendAsynchronousSignal(Object signal)
Sends a signal to this model instance, with given signal value, or payload.
|
void |
sendSignal(Object signal)
Sends a signal to this model instance, with given signal value, or payload.
|
void |
setVariableValue(String name,
Object value)
Sets the value of the module variable.
|
void |
stop()
Deprecated.
Use
terminate() |
void |
submitTodo(String title)
Asserts that there is a single alive todo with a given title
and submits it.
|
void |
suspend()
Suspends the model execution.
|
void |
terminate()
Terminates this model instance, if it is not already finished.
|
String |
toString() |
void |
updateGoal(String goal,
boolean reactivate) |
long |
updateModel(String migrationName,
ByteData migrationConfig)
Updates a model.
|
boolean |
waitForExceptionPresent() |
boolean |
waitForExceptionPresent(long timeoutMillis) |
void |
waitForGoalState(String goalName,
GoalState state)
Awaits for given goal to enter given state, but at most for 60 seconds.
|
void |
waitForGoalState(String goalName,
GoalState state,
long timeoutMillis)
Awaits for given goal to enter given state, but at most for given time duration.
|
boolean |
waitForLogPresent(String logMessage) |
boolean |
waitForLogPresent(String logMessage,
long timeoutMillis) |
void |
waitForSignal(Object signal,
long timeoutMillis) |
Todo |
waitForSingleAliveTodo(String title) |
Todo |
waitForSingleAliveTodo(String title,
long timeoutMillis) |
void |
waitForState(ModelInstanceState state)
Waits at most 60 seconds for the model instance to reach given state.
|
void |
waitForState(ModelInstanceState state,
long timeoutMillis)
Waits for the model instance to reach given state.
|
void |
waitForVariableNotNull(String variableName,
long timeoutMillis)
Awaits for given variable to become assigned with a not-null value.
|
public ModelInstance(LspsRemote remote, Module module, long id)
public LspsRemote getRemote()
public long getId()
public long getModelId()
public String getModelName()
public String getModelVersion()
public Map<String,String> getProperties()
public ModelInstance getParent()
null
.null
public List<ModelInstance> getChildren()
public List<ModelInstance> getChildren(ModelInstanceState state)
state
- a statepublic List<ModelInstance> getChildren(Module module)
public List<ModelInstance> getChildren(ModelInstanceState state, Module module)
state
- a statemodule
- a modulepublic EvaluationResultValue execute(String expression) throws ErrorException, ValidationException
expression
- ValidationException
ErrorException
public EvaluationResultValue execute(String expression, Long contextId) throws ErrorException, ValidationException
expression
- contextId
- ErrorException
ValidationException
public EvaluationResultValue evaluateExpressionInEvaluationLevel(String expression, String evaluationLevel, boolean mergeEvaluation) throws ErrorException, ValidationException
expression
- evaluationLevel
- mergeEvaluation
- ErrorException
ValidationException
public EvaluationResultValue evaluateExpressionInEvaluationLevel(Long contextId, String expression, String evaluationLevel, boolean mergeEvaluation) throws ErrorException, ValidationException
contextId
- expression
- evaluationLevel
- mergeEvaluation
- ErrorException
ValidationException
@Deprecated public void stop()
terminate()
public void terminate()
public List<RollbackInfo> getErrors()
public ModelInstanceLogs getLogs()
public ModelInstanceState getState()
public ModelInstanceInfo getInfo()
public void sendSignal(Object signal)
signal
- the signal value, may be null.public void sendAsynchronousSignal(Object signal)
signal
- the signal value, may be null.public void removeSignal(long signalId)
public List<Todo> findTodos()
public List<Todo> findTodos(TodoStatus status)
status
- the status of the searched todostitle
- the titlepublic List<Todo> findTodos(TodoStatus status, String title)
status
- the status of the searched todostitle
- the titlepublic List<Todo> findAliveTodos()
public List<Todo> findAliveTodos(String title)
title
- a titlepublic List<Todo> findAliveTodosForPerson(Person person)
person
- a personpublic Todo findSingleAliveTodo(String title)
title
- the title of the Todonull
if no such Todo exists.LspsTesterException
- if more than one such a Todo is foundpublic Todo findSingleAliveTodoForPerson(Person person, String title)
person
- title
- null
if no such Todo exists.LspsTesterException
- if more than one such a Todo is foundpublic void submitTodo(String title)
title
- public void waitForState(ModelInstanceState state) throws InterruptedException
state
- expected state, not null.InterruptedException
AssertionError
- if the model does not reach given state in given time period.public void waitForState(ModelInstanceState state, long timeoutMillis) throws InterruptedException
state
- expected state, not null.timeoutMillis
- wait at most this amount of milliseconds.InterruptedException
AssertionError
- if the model does not reach given state in given time period.public Todo waitForSingleAliveTodo(String title) throws InterruptedException
InterruptedException
public Todo waitForSingleAliveTodo(String title, long timeoutMillis) throws InterruptedException
InterruptedException
public boolean waitForLogPresent(String logMessage) throws InterruptedException
InterruptedException
public boolean waitForLogPresent(String logMessage, long timeoutMillis) throws InterruptedException
InterruptedException
public boolean waitForExceptionPresent() throws InterruptedException
InterruptedException
public boolean waitForExceptionPresent(long timeoutMillis) throws InterruptedException
InterruptedException
public GoalState getGoalState(String goal)
goal
- the goal namepublic void deactivateGoal(String goal)
public void reactivateGoal(String goal)
public void updateGoal(String goal, boolean reactivate)
public void waitForVariableNotNull(String variableName, long timeoutMillis) throws InterruptedException
variableName
- the variable name, not null.timeoutMillis
- wait at most this amount of millisecondsInterruptedException
AssertionError
- if the variable is null after given time period ellapses.public void waitForGoalState(String goalName, GoalState state) throws InterruptedException
goalName
- the goal name, not null.state
- expected state, not null.InterruptedException
AssertionError
- if the goal is not in given state.public void waitForGoalState(String goalName, GoalState state, long timeoutMillis) throws InterruptedException
goalName
- the goal name, not null.state
- expected state, not null.timeoutMillis
- wait at most this amount of millisecondsInterruptedException
AssertionError
- if the goal is not in given state.public void waitForSignal(Object signal, long timeoutMillis) throws InterruptedException
InterruptedException
public ProcessInstanceState getProcessInstanceState(String name)
name
- the process instance name, not null.LspsTesterException
- if there is no such process instance, or if there are two or more process instances.public ProcessInstance getProcessInstance(String name)
name
- necessary process instance name, not null.LspsTesterException
- if there are multiple process instances with given name.public List<ProcessInstance> getProcessInstances(String name)
name
- required name, not null.public long getMainContextId()
public Object getVariableValue(String name)
mymodule::myvariable
.name
- the variable namepublic void setVariableValue(String name, Object value)
mymodule::myvariable
.name
- the variable namevalue
- public void notifyModelInstance()
execute(String)
changes value of some variable, used in some model's condition
and the execution may now continue.public void suspend()
public void resume()
public long updateModel(String migrationName, ByteData migrationConfig)
migrationName
- migration namemigrationConfig
- the .muc file contents. Use new ByteData(Files.readAllBytes(path)) to read the file.public List<RollbackInfo> findRollbackInfos()
public EvaluationResultValue gc()
public List<Signal> getSignals()
public List<ProcessLog> getProcessLogs()
Copyright © 2007-2020 Whitestein Technologies. All Rights Reserved.