Package apama :: Module iaf :: Class IAFHelper
[hide private]
[frames] | no frames]

Class IAFHelper

source code

               object --+    
                        |    
common.ApamaServerProcess --+
                            |
                           IAFHelper

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)
Instance Methods [hide private]
 
__init__(self, parent, port=None, host=None, name='iaf')
Create an instance of the IAFHelper class.
source code
 
addToClassPath(self, path)
Add the supplied path to the APAMA_IAF_CLASSPATH environment variable for starting this IAF instance.
source code
 
addToPath(self, path)
Add the supplied path to the PATH (win32) or LD_LIBRARY_PATH (unix) environment variable for starting this IAF instance.
source code
 
start(self, configname, configdir=None, replace={}, logfile=None, verbosity=None, waitForServerUp=True, **xargs)
Start the IAF.
source code
 
client(self, reload=False, suspend=False, resume=False, **xargs)
Perform client operations against the IAF (reload, suspend, resume).
source code
 
waitForIAFUp(self, *args, **kwargs)
Block until the IAF declares itself to be ready for processing.
source code

Inherited from common.ApamaServerProcess: __repr__, manage, running, shutdown, waitForComponentUp

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __sizeof__, __str__, __subclasshook__

Instance Variables [hide private]
dictionary environ
The environment for running the process
string host
Hostname for interaction with a remote process
pysys.basetest parent
Reference to the PySys testcase instantiating this class instance
integer port
Port used for starting and interaction with the process
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, parent, port=None, host=None, name='iaf')
(Constructor)

source code 

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.
Overrides: object.__init__

start(self, configname, configdir=None, replace={}, logfile=None, verbosity=None, waitForServerUp=True, **xargs)

source code 

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

client(self, reload=False, suspend=False, resume=False, **xargs)

source code 

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

waitForIAFUp(self, *args, **kwargs)

source code 

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

Deprecated: Use waitForComponentUp instead.