apama.iaf module

Contains PySys extensions for starting and interacting with IAF processes.

class apama.iaf.IAFHelper(parent, port=None, host=None, name='iaf')[source]

Bases: apama.common.ApamaServerProcess

Helper class for the Software AG Apama Integration Adapter Framework (IAF).

The IAF Helper class has been designed for use as an extension module to the PySys System Test Framework, offering the ability to configure, start and interact with an instance of the IAF. The usage pattern of the class is to create an instance per IAF, and to then make method calls onto the instance to perform operations such as to start the component, request reload of the configuration file, perform management operationes etc. For example:

iaf = IAFHelper(self, config="iaf-config.xml")
iaf.start(logfile="iaf.log")
iaf.client(reload=True)

Process related methods of the class declare a method signature which includes named parameters for the most frequently used options to the method. They also declare the **xargs parameter to allow passing in of additional supported arguments to the process. The additional arguments that are currently supported via **xargs are:

workingDir: The default value for the working directory of a process
state: The default state of the process (pysys.constants.BACKGROUND | pysys.constants.FOREGROUND)
timeout: The default value of the process timeout
stdout: The default value of the process stdout
stderr: The default value of the process stderr
arguments: List of extra arguments to be passed to the process

This means that legitimate calls to the start method include:

iaf.start(logfile="iaf.log")
iaf.start(logfile="iaf.log", stdout="correlator1.out")
iaf.start(state=FOREGROUND, timeout=5)
Variables:
  • parent (pysys.basetest) – Reference to the PySys testcase instantiating this class instance
  • port (integer) – Port used for starting and interaction with the Event Correlator
  • host (string) – Hostname for interaction with a remote Event Correlator
  • environ (dictionary) – The environment for running the IAF
__init__(parent, port=None, host=None, name='iaf')[source]

Create an instance of the IAFHelper class.

If no port parameter is used in the argument list an available port will be dynamically found from the OS and used for starting the IAF, and performing all operations against it. The host parameter is only used to perform operations against a remote IAF started external to the PySys framework - the class does not support the starting of an IAF remote to the localhost.

Parameters:
  • parent – Reference to the parent PySys testcase
  • port – The port used for starting and interacting with the IAF
  • host – The hostname used for interaction with a remote IAF
  • name – A display name for this process (default is “iaf”), also used for the default stdout/err filenames.
addToClassPath(path)[source]

Add the supplied path to the APAMA_IAF_CLASSPATH environment variable for starting this IAF instance.

addToPath(path)[source]

Add the supplied path to the PATH (win32) or LD_LIBRARY_PATH (unix) environment variable for starting this IAF instance.

client(reload=False, suspend=False, resume=False, **xargs)[source]

Perform client operations against the IAF (reload, suspend, resume).

Runs as a foreground process by default.

Parameters:
  • reload – Request reload of the IAF configuration file
  • suspend – Request the IAF to suspend event sending
  • resume – Request the IAF to resume event sending
  • xargs – Optional startProcess keyword arguments, e.g. timeout, ignoreExitStatus, arguments, workingDir
start(configname, configdir=None, replace={}, logfile=None, verbosity=None, waitForServerUp=True, **xargs)[source]

Start the IAF.

Start an IAF using the supplied configuration file. If the configdir argument is not supplied, the location of the configuration file defaults to the testcase input directory. The configuration file can first be tailored to replaced token values within the file with values required at run time using the replace argument. For replace of the form

replace = {"@logs_dir@":"/var/tmp/logs"} 

any tokens in the coniguration file directly matching @logs_dir@ will be replaced with the value “/var/tmp/logs”. Note that multiple token value pairs can be supplied in the replace dictionary.

Parameters:
  • configname – The IAF configuration file or template name
  • configdir – The directory containing the IAF configuration file or template
  • logfile – Name of the IAF log file
  • verbosity – The verbosity level of the IAF logging
  • replace – A dictionary of tokens / values to be replaced in the configuration file
  • waitForServerUp – Set to False to disable automatically waiting until the component is ready
  • xargs – Optional startProcess keyword arguments, e.g. timeout, ignoreExitStatus, arguments, workingDir
waitForIAFUp(*args, **kwargs)[source]

Block until the IAF declares itself to be ready for processing.

Deprecated:Use waitForComponentUp instead.