org.apache.ode.test
Class MockExtensionContext

java.lang.Object
  extended by org.apache.ode.test.MockExtensionContext
All Implemented Interfaces:
ExtensionContext

public class MockExtensionContext
extends java.lang.Object
implements ExtensionContext

Very simple mock implementation of the ExtensionContext interface.


Field Summary
 boolean completed
           
 java.net.URI duDir
           
 FaultException fault
           
 boolean faulted
           
 java.util.List<java.lang.String> msgs
           
 
Constructor Summary
MockExtensionContext()
           
 
Method Summary
 void complete()
          Marks the currently executed activity as successfully completed.
 void completeWithFault(FaultException fault)
          Marks the currently executed activity as faulted.
 void completeWithFault(java.lang.Throwable t)
          Marks the currently executed activity as faulted.
 java.lang.String getActivityName()
          Returns the name of the invoking activity.
 java.net.URI getDUDir()
          Returns the location of the deployment bundle of the executed process.
 OdeInternalInstance getInternalInstance()
          Returns ODE's internal runtime instance.
 OActivity getOActivity()
          Returns the OActivity object.
 java.lang.Long getProcessId()
          Reads the current process instance id.
 java.util.Map<java.lang.String,org.w3c.dom.Node> getVariables()
           
 java.util.Map<java.lang.String,OScope.Variable> getVisibleVariables()
          Returns a list of variables visible in the current scope.
 boolean isLinkActive(OLink olink)
           
 boolean isVariableVisible(java.lang.String varName)
          Returns whether a variable is visible in the current scope or not.
 void printToConsole(java.lang.String msg)
          Allows printing debug output to the console.
 java.lang.String readMessageProperty(OScope.Variable variable, OProcess.OProperty property)
          Read the value of a BPEL property.
 org.w3c.dom.Node readVariable(OScope.Variable variable)
          Read the value of a BPEL variable.
 org.w3c.dom.Node readVariable(java.lang.String variableName)
          Read the value of a BPEL variable.
 void writeVariable(OScope.Variable variable, org.w3c.dom.Node value)
          Write the value into a BPEL variable.
 void writeVariable(java.lang.String variableName, org.w3c.dom.Node value)
          Write the value into a BPEL variable.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

completed

public boolean completed

faulted

public boolean faulted

fault

public FaultException fault

duDir

public java.net.URI duDir

msgs

public java.util.List<java.lang.String> msgs
Constructor Detail

MockExtensionContext

public MockExtensionContext()
Method Detail

getVariables

public java.util.Map<java.lang.String,org.w3c.dom.Node> getVariables()

getProcessId

public java.lang.Long getProcessId()
Description copied from interface: ExtensionContext
Reads the current process instance id.

Specified by:
getProcessId in interface ExtensionContext
Returns:
instance id

readVariable

public org.w3c.dom.Node readVariable(java.lang.String variableName)
                              throws FaultException
Description copied from interface: ExtensionContext
Read the value of a BPEL variable.

Specified by:
readVariable in interface ExtensionContext
Parameters:
variableName - variable to read
Returns:
the value of the variable, wrapped in a Node
Throws:
FaultException

writeVariable

public void writeVariable(java.lang.String variableName,
                          org.w3c.dom.Node value)
                   throws FaultException
Description copied from interface: ExtensionContext
Write the value into a BPEL variable.

Specified by:
writeVariable in interface ExtensionContext
Parameters:
variableName - variable to write
value - the value to be stored into the variable
Throws:
FaultException

isVariableVisible

public boolean isVariableVisible(java.lang.String varName)
Description copied from interface: ExtensionContext
Returns whether a variable is visible in the current scope or not.

Specified by:
isVariableVisible in interface ExtensionContext
Parameters:
varName - name of the variable.
Returns:
true if the variable is visible.

getActivityName

public java.lang.String getActivityName()
Description copied from interface: ExtensionContext
Returns the name of the invoking activity.

Specified by:
getActivityName in interface ExtensionContext
Returns:
activity name

getOActivity

public OActivity getOActivity()
Description copied from interface: ExtensionContext
Returns the OActivity object.

Specified by:
getOActivity in interface ExtensionContext

getVisibleVariables

public java.util.Map<java.lang.String,OScope.Variable> getVisibleVariables()
                                                                    throws FaultException
Description copied from interface: ExtensionContext
Returns a list of variables visible in the current scope.

Specified by:
getVisibleVariables in interface ExtensionContext
Returns:
an unmodifiable list of visible variables.
Throws:
FaultException

isLinkActive

public boolean isLinkActive(OLink olink)
                     throws FaultException
Throws:
FaultException

readMessageProperty

public java.lang.String readMessageProperty(OScope.Variable variable,
                                            OProcess.OProperty property)
                                     throws FaultException
Description copied from interface: ExtensionContext
Read the value of a BPEL property.

Specified by:
readMessageProperty in interface ExtensionContext
Parameters:
variable - variable containing property
property - property to read
Returns:
value of the property
Throws:
FaultException

readVariable

public org.w3c.dom.Node readVariable(OScope.Variable variable)
                              throws FaultException
Description copied from interface: ExtensionContext
Read the value of a BPEL variable.

Specified by:
readVariable in interface ExtensionContext
Parameters:
variable - variable to read
Returns:
the value of the variable, wrapped in a Node
Throws:
FaultException

writeVariable

public void writeVariable(OScope.Variable variable,
                          org.w3c.dom.Node value)
                   throws FaultException
Description copied from interface: ExtensionContext
Write the value into a BPEL variable.

Specified by:
writeVariable in interface ExtensionContext
Parameters:
variable - variable to write
value - the value to be stored into the variable
Throws:
FaultException

complete

public void complete()
Description copied from interface: ExtensionContext
Marks the currently executed activity as successfully completed.

Specified by:
complete in interface ExtensionContext

completeWithFault

public void completeWithFault(java.lang.Throwable t)
Description copied from interface: ExtensionContext
Marks the currently executed activity as faulted.

Specified by:
completeWithFault in interface ExtensionContext
Parameters:
t - an exception to be reported as the fault cause.

completeWithFault

public void completeWithFault(FaultException fault)
Description copied from interface: ExtensionContext
Marks the currently executed activity as faulted.

Specified by:
completeWithFault in interface ExtensionContext
Parameters:
fault - a fault.

getInternalInstance

public OdeInternalInstance getInternalInstance()
Description copied from interface: ExtensionContext
Returns ODE's internal runtime instance.

Specified by:
getInternalInstance in interface ExtensionContext

getDUDir

public java.net.URI getDUDir()
Description copied from interface: ExtensionContext
Returns the location of the deployment bundle of the executed process.

Specified by:
getDUDir in interface ExtensionContext
Returns:
URI of the deployment bundle.

printToConsole

public void printToConsole(java.lang.String msg)
Description copied from interface: ExtensionContext
Allows printing debug output to the console. Output will be redirected to the logger associated with org.apache.ode.extension.Console. The target log level is INFO.

Specified by:
printToConsole in interface ExtensionContext