def configureTestPaths(): # Point to the testing SDR folder testdir = os.path.abspath(os.path.dirname(__file__)) os.environ['SDRROOT'] = os.path.join(testdir, "sdr") # The top source directory is one levels up from this file topdir = os.path.abspath(os.path.join(testdir, '..')) # Bring in the Python OSSIE stuff for things running in this process prependPythonPath(os.path.join(topdir, 'base/framework/python')) # Add Java libraries to CLASSPATH so that test components can find them # regardless of where they run. jarfiles = [ 'CFInterfaces.jar', 'apache-commons-lang-2.4.jar', 'log4j-1.2.15.jar', 'ossie/ossie.jar' ] for jarfile in jarfiles: appendClassPath(os.path.join(topdir, 'base/framework/java', jarfile)) # Add path to libomnijni.so to LD_LIBRARY_PATH for Java components appendPath('LD_LIBRARY_PATH', os.path.join(topdir, 'omnijni/src/cpp/.libs')) appendPath('LD_LIBRARY_PATH', os.path.join(topdir, 'base/plugin/logcfg/.libs')) # Set the model IDL paths to point to the (uninstalled) REDHAWK IDLs. from ossie.utils import model from ossie.utils.idllib import IDLLibrary model._idllib = IDLLibrary() model._idllib.addSearchPath(os.path.join(topdir, 'idl'))
def launch(self, execparams={}, ossiehome=None, configure={}, initialize=True, objType=None, debugger=None): """ Launch the component. The component will be executed as a child process, then (optionally) initialized and configured. Arguments: execparams - Execparams to override on component execution. ossiehome - Base location of REDHAWK installation for finding IDL files. Default location is determined from $OSSIEHOME environment variable. configure - If a dictionary, a set of key/value pairs to override the initial configuration values of the component. If None, skip initial configuration. initialize - If true, call initialize() after launching the component. If false, skip initialization. objType - Object type to be launched. Could be a component, device or service. """ if IDE_REF_ENV == None: if ossiehome: model._idllib = IDLLibrary() model._idllib.addSearchPath(str(ossiehome) + '/idl') component = sb.launch(self.spd_file, impl=self.impl, execparams=execparams, configure=configure, initialize=initialize, objType=objType, debugger=debugger) else: # spd file path passed in to unit test is relative to current component tests directory (i.e. "..") # IDE unit test requires spd file path relative to redhawk file system componentName = str(self.spd.get_name()) rh_file_system_spd_file = "components/" + componentName + "/" + self.spd_file[ 3:] component = sb.launch(rh_file_system_spd_file, impl=self.impl, execparams=execparams, configure=configure, initialize=initialize, objType=objType, debugger=debugger) self.comp_obj = component.ref self.comp = component
# # You should have received a copy of the GNU Lesser General Public License # along with this program. If not, see http://www.gnu.org/licenses/. # import random import unittest import sys import time import types from ossie.utils import sb from bulkio.bulkioInterfaces import * # Add the local search paths to find local IDL files from ossie.utils import model from ossie.utils.idllib import IDLLibrary model._idllib = IDLLibrary() model._idllib.addSearchPath('../../../idl') model._idllib.addSearchPath('/usr/local/redhawk/core/share/idl') # add local build path to test out api, issue with bulkio.<library> and bulkio.bulkioInterfaces... __init__.py # differs during build process sys.path = ['../../build/lib'] + sys.path from redhawk.burstio import * def str_to_class(s): if s in globals() and isinstance(globals()[s], types.ClassType): return globals()[s] return None
# details. # # You should have received a copy of the GNU Lesser General Public License # along with this program. If not, see http://www.gnu.org/licenses/. # import os from ossie.utils.sca import importIDL from ossie.utils.idllib import IDLLibrary from redhawk.codegen.utils import strenum CorbaTypes = strenum('octet','boolean','char','short','ushort','long','ulong', 'longlong','ulonglong','float','double','string','objref', 'utctime') idlRepo = IDLLibrary() idlRepo.addSearchPath(os.path.join(os.environ['OSSIEHOME'], 'share/idl')) class IDLInterface(object): def __init__(self, repid): self.__repid = repid interface = self.__repid.split(':')[1] if '/' in interface: self.__namespace, self.__interface = interface.rsplit('/', 1) else: self.__namespace = '' self.__interface = interface self.__idl = None def repid(self): return self.__repid