コード例 #1
0
    def execute(self):
        self.assertTrue(
            os.path.exists(
                f'{PROJECT.EXAMPLES_DIR}/FileTransport/Release/libGoFileTransport.so'
            ))
        for f in ['read.txt', 'config.yaml']:
            filecopy(f'{self.input}/{f}', f'{self.output}/{f}')

        correlator = CorrelatorHelper(self, name='correlator')
        correlator.start(
            logfile='correlator.log',
            inputLog='correlator.input.log',
            config=[f'{self.output}/config.yaml'],
            environ={'EXAMPLES_DIR': PROJECT.EXAMPLES_DIR},
            arguments=['-DEXAMPLES_DIR=%s' % PROJECT.EXAMPLES_DIR])
        correlator.injectEPL(filenames=[
            'ConnectivityPluginsControl.mon', 'ConnectivityPlugins.mon'
        ],
                             filedir=f'{PROJECT.APAMA_HOME}/monitors')
        correlator.injectEPL(filenames=['simple.mon'])

        self.waitForSignal('correlator.log',
                           expr="Hello from transport",
                           condition=">=10")
        self.waitForSignal('write.txt',
                           expr="Hello from correlator",
                           condition=">=10")
コード例 #2
0
ファイル: run.py プロジェクト: nigelm187/apama-rxepl
	def execute(self):
		correlator = CorrelatorHelper(self, name='correlator')
		
		correlator.start(logfile='correlator.log', config=os.path.join(PROJECT.TEST_SUBJECT_DIR, 'initialization.yaml'))

		correlator.flush()
		correlator.injectEPL(filenames='testUtils.mon', filedir=PROJECT.UTILS_DIR)
		
		# Start test results receiver
		correlator.receive(filename='TestResult.evt', channels=['TestResult'], logChannels=True)
		
		# Set the log level to DEBUG so that we can see when the listeners are killed
		correlator.setApplicationLogLevel(verbosity='DEBUG')
				
		# Inject test
		correlator.injectEPL(filenames=['test.mon'])
		
		# wait for all events to be processed
		correlator.flush()
		
		# wait for test to complete
		self.waitForSignal('TestResult.evt', expr="TestComplete", condition="==1", timeout=10)
		
		# Output the engine_inspect result to a file to check for any remaining subscribed channels
		correlator.inspect(filename='preTerminateInspect.txt', arguments=['-x'])
		
		correlator.sendEventStrings('utils.KeepAliveUntilTerminated()')
		
		# Output the engine_inspect result to a file to check for non-terminated listeners
		correlator.inspect(filename='postTerminateInspect.txt', raw=True, arguments=['-x'])
コード例 #3
0
ファイル: run.py プロジェクト: nigelm187/apama-rxepl
    def execute(self):
        correlator = CorrelatorHelper(self, name='correlator')
        correlator.start(logfile='correlator.log',
                         config=os.path.join(PROJECT.TEST_SUBJECT_DIR,
                                             'initialization.yaml'))

        correlator.flush()
        correlator.injectEPL(filenames='testUtils.mon',
                             filedir=PROJECT.UTILS_DIR)

        # Start test results receiver
        correlator.receive(filename='TestResult.evt',
                           channels=['TestResult'],
                           logChannels=True)

        # Inject test
        correlator.injectEPL(filenames=['test.mon'])

        # wait for all events to be processed
        correlator.flush()

        # wait for test to complete
        self.waitForSignal('TestResult.evt',
                           expr="TestComplete",
                           condition="==1",
                           timeout=10)
コード例 #4
0
 def execute(self):
     correlator = CorrelatorHelper(self)
     correlator.start(logfile='correlator.log',
                      arguments=['--config', self.input + '/project'])
     correlator.injectJava('test.jar')
     correlator.injectEPL('test.mon')
     correlator.flush()
コード例 #5
0
ファイル: run.py プロジェクト: mjj29/apama-random-plugin
 def execute(self):
     correlator = CorrelatorHelper(self, name='testcorrelator')
     correlator.start(logfile='testcorrelator.log')
     correlator.injectEPL(filenames=['RandomPlugin.mon'],
                          filedir=PROJECT.APAMA_WORK + '/monitors')
     correlator.injectEPL(filenames=['test.mon'])
     correlator.flush()
コード例 #6
0
    def execute(self):
        # copy the build(Release folder) and config yaml to output
        fileutils.mkdir(self.output + '/Release')
        with socketProcessMutex:
            self.copytree(TEST_SUBJECT_DIR + '/Release',
                          self.output + '/Release')
        filecopy.filecopy(self.input + '/sample.yaml',
                          self.output + '/sample.yaml')

        # create the correlator helper and start the correlator and an
        # engine receive listening on the Echo Channel
        correlator = CorrelatorHelper(self, name='mycorrelator')
        correlator.start(logfile='mycorrelator.log',
                         inputLog='mycorrelator.input.log',
                         config=[self.output + '/sample.yaml'])
        correlator.injectEPL(
            ['ConnectivityPluginsControl.mon', 'ConnectivityPlugins.mon'],
            filedir=PROJECT.APAMA_HOME + '/monitors')
        correlator.receive(filename='receive.evt', channels=['EchoChannel'])

        # inject the simple monitor into the correlator
        correlator.injectEPL(filenames=[self.input + '/DemoApp.mon'])
        #self.wait(3)

        # wait for receipt msg towards transport
        # we could use correlator.flush() here instead
        self.waitForSignal('mycorrelator.log',
                           expr="Towards Host:",
                           condition="==8")
コード例 #7
0
class BlinktBaseTest(BaseTest):

	def __init__(self, descriptor, outdir, runner):
		BaseTest.__init__(self, descriptor, outdir, runner)

		# Load the plugin and wrapper from the build or install
		if hasattr(self, 'TEST_AGAINST_INSTALL'):
			self.BlinktMonitors = ApamaWorkMonitors
		else:
			self.BlinktMonitors = BlinktProjectDir
			os.environ["LD_LIBRARY_PATH"] = BlinktProjectDir + os.pathsep + os.environ["LD_LIBRARY_PATH"]

		# Initialise a correlator with the Blinkt plugin, the plugin
		# wrapper and other required supporting code.
		self.correlator = CorrelatorHelper(self, name='BlinktCorrelator')
		process = self.correlator.start()
		self.correlatorLog = process.stdout
		self.correlatorOut = process.stdout
		self.correlatorErr = process.stderr
		self.correlator.injectEPL(filenames=[
			join(ApamaHomeMonitors, 'TimeFormatEvents.mon'),
			join(ApamaWorkMonitors, 'GPIOPlugin.mon'),
			join(self.BlinktMonitors, 'BlinktHelper.mon')
		])
		self.waitForSignal(self.correlatorLog, expr="Blinkt initialised")
コード例 #8
0
	def execute(self):
		correlator = CorrelatorHelper(self, name='mycorrelator')
		correlator.start(logfile='mycorrelator.log', config=[self.input+'/sample.yaml'], 
			configPropertyOverrides={'EXAMPLES_DIR':self.project.EXAMPLES_DIR, 'RUST_TARGET': self.project.RUST_TARGET})
		correlator.injectEPL(['ConnectivityPluginsControl.mon', 'ConnectivityPlugins.mon'], filedir=PROJECT.APAMA_HOME+'/monitors')
		correlator.injectEPL(filenames=[self.input+'/DemoApp.mon'])

		self.waitForSignal('mycorrelator.log', expr="Got echo response", process=correlator, 
			errorExpr=[' ERROR ', ' FATAL ', 'Failed to parse event'])
		correlator.shutdown()
コード例 #9
0
	def execute(self):
		for allocator in ['platform', 'jemalloc']:
			corr = CorrelatorHelper(self, name=f'correlator_{allocator}')
			corr.start(logfile=f'correlator_{allocator}.log', environ={'AP_ALLOCATOR':allocator, 'AP_TRACKMEMORY':'true'})
			corr.injectEPL(filenames=['ManagementImpl.mon', 'Management.mon', 'TimeFormatEvents.mon'], filedir=self.project.APAMA_HOME+'/monitors')
			corr.injectEPL(filenames=['JEMallocPlugin.mon', 'JEMallocStatus.mon'], filedir=self.input+'/../../../')
			corr.flush()
			corr.manage(['-r', 'malloc_stats'])
			self.wait(12)
			corr.shutdown()
コード例 #10
0
	def execute(self):
		corr = CorrelatorHelper(self, name='correlator')
		corr.start(logfile='correlator.log')
		corr.injectEPL(os.getenv('APAMA_HOME','') + '/monitors/ManagementImpl.mon')
		corr.injectEPL(os.getenv('APAMA_HOME','') + '/monitors/Management.mon')
		corr.injectEPL('../../common/TestHelper.mon')

		corr.injectEPL('../../../src/Assert.mon')

		corr.injectEPL('TestAssertIsTrueIsFalse.mon')
		self.waitForGrep('correlator.log', 'Removed monitor TestAssertIsTrueIsFalse')
コード例 #11
0
 def execute(self):
     corr = CorrelatorHelper(self, name='correlator')
     corr.start(logfile='correlator.log')
     corr.injectEPL('../../../CircularBuffer.mon')
     tests = os.listdir(self.input)
     tests.sort()
     for test in tests:
         if test.endswith('.mon'):
             corr.injectEPL(test)
             corr.flush()
     corr.shutdown()
コード例 #12
0
class PySysTest(BaseTest):
	def execute(self):
		self.correlator = CorrelatorHelper(self)
		self.correlator.start(environ={'APAMA_FILEPLUGIN_ROOT_DIR':self.output})
		self.correlator.injectEPL(filenames=['FilePlugin.mon'], filedir=PROJECT.APAMA_WORK + '/monitors')
		self.correlator.injectMonitorscript(filenames=['test.mon'])
		self.waitForSignal('correlator.out', expr='Test finished', errorExpr=[' (ERROR|FATAL) '])

	def validate(self):
		self.assertGrep('correlator.out', expr=' (ERROR|FATAL) ', contains=False)
		self.assertGrep('correlator.out', expr='correlator.out')
		self.assertGrep('correlator.out', expr='correlator.err')
コード例 #13
0
    def startApplication(self):
        correlator = CorrelatorHelper(self.parent, name='defaultCorrelator')
        correlator.start(logfile='correlator.log')
        receiver = correlator.receive(filename='receive.evt', logChannels=True)

        correlator.injectEPL(filenames=['Cumulocity_EventDefinitions.mon'],
                             filedir=os.path.join(
                                 self.project.APAMA_MONITORS_DIR, 'cumulocity',
                                 '10.5'))
        correlator.injectEPL(filenames=['GAPDemo.mon'],
                             filedir=self.project.MONITORS_DIR)

        self.parent.waitForSignal(
            'receive.evt',
            expr="com.apama.cumulocity.FindManagedObject",
            condition="==1")
        self.correlator = correlator
        return correlator
コード例 #14
0
    def execute(self):
        # create the correlator helper, start the correlator and attach an
        # engine_receive process listening to a test channel. The helper will
        # automatically get an available port that will be used for all
        # operations against it
        correlator = CorrelatorHelper(self, name='testcorrelator')
        correlator.start(
            logfile='testcorrelator.log',
            config=[os.path.join(self.project.APAMA_WORK, 'complex.yaml')])
        correlator.applicationEventLogging(enable=True)

        # inject the monitor (directory defaults to the testcase input)
        correlator.injectEPL(filenames=[
            os.path.join(self.project.APAMA_WORK, 'ComplexPlugin.mon')
        ])

        # wait for all events to be processed
        correlator.flush()
コード例 #15
0
    def execute(self):
        correlator = CorrelatorHelper(self, name='mycorrelator')
        correlator.start(logfile='mycorrelator.log',
                         config=[self.input + '/sample.yaml'],
                         configPropertyOverrides={
                             'EXAMPLES_DIR': self.project.EXAMPLES_DIR,
                             'RUST_TARGET': self.project.RUST_TARGET
                         })
        correlator.injectEPL(
            ['ConnectivityPluginsControl.mon', 'ConnectivityPlugins.mon'],
            filedir=PROJECT.APAMA_HOME + '/monitors')
        correlator.injectEPL(filenames=[self.input + '/DemoApp.mon'])

        self.message_count = 100000

        res = asyncio.get_event_loop().run_until_complete(
            self.start_send_recv('ws://127.0.0.1:4999', self.message_count))
        s, r = res
        self.sent = s
        self.receved = r
コード例 #16
0
class PySysTest(BaseTest):
	def execute(self):
		self.correlator_default = CorrelatorHelper(self, name='correlator_default')
		self.correlator_tailored = CorrelatorHelper(self, name='correlator_tailored')

		self.correlator_default.start()
		self.correlator_tailored.start(environ={'APAMA_FILEPLUGIN_ROOT_DIR':self.output})

		self.correlator_default.injectEPL(filenames=['FilePlugin.mon'], filedir=PROJECT.APAMA_WORK + '/monitors')
		self.correlator_tailored.injectEPL(filenames=['FilePlugin.mon'], filedir=PROJECT.APAMA_WORK + '/monitors')

		self.correlator_default.injectMonitorscript(filenames=['test.mon'])
		self.correlator_tailored.injectMonitorscript(filenames=['test.mon'])

		self.waitForSignal('correlator_default.out', expr='Test finished')
		self.waitForSignal('correlator_tailored.out', expr='Test finished')

	def validate(self):
		self.assertGrep('correlator_default.out', expr=self.project.APAMA_WORK, literal=True)
		self.assertGrep('correlator_tailored.out', expr=self.output, literal=True)
コード例 #17
0
    def execute(self):
        corr = CorrelatorHelper(self, name='correlator')
        corr.start(logfile='correlator.log')
        corr.injectEPL(
            os.getenv('APAMA_HOME', '') + '/monitors/ManagementImpl.mon')
        corr.injectEPL(
            os.getenv('APAMA_HOME', '') + '/monitors/Management.mon')

        corr.injectEPL('../../../src/Assert.mon')

        corr.injectEPL('Demo.mon')
        corr.flush()
        corr.shutdown()
コード例 #18
0
    def execute(self):
        corr = CorrelatorHelper(self, name='correlator')
        # Configure com.acme package to log at debug and define asserts=true
        corr.start(logfile='correlator.log',
                   arguments=[
                       '-Dasserts=true', '--config',
                       self.input + '/correlator.yaml'
                   ])
        corr.injectEPL(
            os.getenv('APAMA_HOME', '') + '/monitors/ManagementImpl.mon')
        corr.injectEPL(
            os.getenv('APAMA_HOME', '') + '/monitors/Management.mon')

        corr.injectEPL('../../../src/AssertHelper.mon')

        corr.injectEPL('TestAssertHelper.mon')
        self.waitForGrep('correlator.log',
                         'Removed monitor com.acme.TestAssertHelper')
        corr.injectEPL('TestAssertHelperNoPackage.mon')
        self.waitForGrep('correlator.log',
                         'Removed monitor com.test.TestAssertHelper')
コード例 #19
0
    def execute(self):
        corr = CorrelatorHelper(self, name='correlator')
        corr.start(logfile='correlator.log',
                   arguments=[
                       '-Dasserts=true', '--config',
                       self.input + '/correlator.yaml'
                   ])
        corr.injectEPL(
            os.getenv('APAMA_HOME', '') + '/monitors/ManagementImpl.mon')
        corr.injectEPL(
            os.getenv('APAMA_HOME', '') + '/monitors/Management.mon')

        corr.injectEPL('../../../src/Assert.mon')
        corr.injectEPL('../../../src/AssertHelper.mon')

        for test in [
                'ConfigAssert.mon', 'DebugAssert.mon', 'AssertDieWithError.mon'
        ]:
            corr.injectEPL(test)
            corr.flush()
        corr.shutdown()
コード例 #20
0
class PySysTest(BaseTest):
    def execute(self):
        self.correlator = CorrelatorHelper(self)
        self.correlator.start(
            environ={'APAMA_FILEPLUGIN_ROOT_DIR': self.output})
        self.correlator.injectEPL(filenames=['FilePlugin.mon'],
                                  filedir=PROJECT.APAMA_WORK + '/monitors')
        self.correlator.injectMonitorscript(filenames=['test.mon'])
        self.waitForSignal('correlator.out',
                           expr='Test finished',
                           errorExpr=[' (ERROR|FATAL) '])

    def validate(self):
        self.assertGrep('correlator.out',
                        expr=' (ERROR|FATAL) ',
                        contains=False)
        # non standard exception messages means we can't succinctly check for specifics
        self.assertGrep('correlator.out', expr='in plugin method read')
        self.assertGrep('correlator.out',
                        expr='in plugin method get_file_size_KB')
        self.assertGrep('correlator.out', expr='in plugin method copy')
        self.assertGrep('correlator.out', expr='in plugin method remove')
コード例 #21
0
ファイル: run.py プロジェクト: mjj29/apama-base64-plugin
	def execute(self):
		correlator = CorrelatorHelper(self, name='testcorrelator')
		correlator.start(logfile='testcorrelator.log', config=self.input+'/config.yaml')
		correlator.injectEPL(filenames=['ConnectivityPluginsControl.mon'], filedir=PROJECT.APAMA_HOME+'/monitors')
		correlator.injectEPL(filenames=['ConnectivityPlugins.mon'], filedir=PROJECT.APAMA_HOME+'/monitors')
		correlator.injectEPL(filenames=['test.mon'])
		correlator.flush() 
		self.waitForSignal(file='testcorrelator.log', expr='Round-trip', condition='>=2')
コード例 #22
0
	def execute(self):
		corr = CorrelatorHelper(self, name='correlator')
		corr.start(logfile='correlator.log')
		corr.injectEPL(filenames=['ManagementImpl.mon', 'Management.mon'], filedir=self.project.APAMA_HOME+'/monitors')
		corr.injectEPL(filenames=['L10N.mon'], filedir=self.input+'/../../../')
		corr.injectEPL(filenames=['Sample.mon'])
		corr.flush()
		corr.shutdown()
コード例 #23
0
	def execute(self):
		"""
			Runs all the tests in the Input directory against the applications configured in the EPL_APPS 
			directory or with the EPLApps directive. 
		"""
		# Check APAMA_HOME and EPL_TESTING_SDK env are valid
		if not os.path.isdir(self.project.APAMA_HOME):
			self.abort(BLOCKED, f'APAMA_HOME project property is not valid ({self.project.APAMA_HOME}). Try running in an Apama command prompt.')
		if not os.path.isdir(self.project.EPL_TESTING_SDK):
			self.abort(BLOCKED, f'EPL_TESTING_SDK is not valid ({self.project.EPL_TESTING_SDK}). Please set the EPL_TESTING_SDK environment variable.')

		from apama.correlator import CorrelatorHelper
		# Create test project and add C8Y properties and EPL Apps 
		project = self.createProject("test-project")
		self.addC8YPropertiesToProject(project)
		eplApps = self.getTestSubjectEPLApps()
		self.addEPLAppsToProject(eplApps, project)
		project.deploy()

		# Run local correlator connected to C8Y with Apama EPL Apps and test files deployed
		correlator = CorrelatorHelper(self, name='c8y-correlator')              
		correlator.start(logfile='c8y-correlator.log', config=project.deployedDir())

		# Wait for our EPL App test subjects to be added
		correlator.flush()

		# Inject test mon files from Input directory to correlator
		inputFiles = os.listdir(self.input)
		for inputFile in inputFiles:
			# Check file is a .mon file before injecting
			if os.path.splitext(inputFile)[1] == '.mon':
				self.log.info(f"Injecting {inputFile} test case")
				correlator.injectEPL(inputFile, self.input)
				# Wait for test to complete
				correlator.flush()
				activeTestMonitors = self.getMonitorsFromInjectedFile(correlator, os.path.join(self.input, inputFile))
				for monitor in activeTestMonitors:
					self.waitForGrep('c8y-correlator.log', expr=f"Removed monitor {monitor}", process=correlator)
コード例 #24
0
	def startAnalyticsBuilderCorrelator(self, blockSourceDir=None, Xclock=True, numWorkers=4, injectBlocks = True, **kwargs):
		"""
		Start a correlator with the EPL for Analytics Builder loaded.
		:param blockSourceDir: A location of blocks to include, or a list of locations
		:param Xclock: Externally clock correlator (on by default).
		:param numWorkers: Number of workers for Analytics Builder runtime (4 by default).
		:param injectBlocks: if false, don't inject the actual block EPL (use if there are dependencies), returns blockOutput directory. Also skips applicationInitialized call.
		:param \**kwargs: extra kwargs are passed to startCorrelator
		"""

		# Build and extract the block extension:
		if blockSourceDir == None: blockSourceDir = self.input
		if not isinstance(blockSourceDir, list):
			blockSourceDir = [blockSourceDir]
		blockOutput = self.output+'/block-output-'
		blockOutputDirs=[]
		blockSrcOutput = self.output+'/block-src-'
		for blockDir in blockSourceDir:
			blockOutput=blockSrcOutput + os.path.basename(blockDir)
			self.buildExtensionDirectory(blockDir, blockOutput)
			blockOutputDirs.append(Path(blockOutput))
		# Start the correlator:
		corr = CorrelatorHelper(self)
		arguments=kwargs.get('arguments', [])
		arguments.append(f'-DanalyticsBuilder.numWorkerThreads={numWorkers}')
		arguments.append(f'-DanalyticsBuilder.timedelay_secs=0.1')
		kwargs['arguments']=arguments
		logfile=kwargs.get('logfile', 'correlator.log')
		kwargs['logfile']=logfile
		corr.start(Xclock=Xclock, **kwargs)
		corr.logfile = logfile
		corr.injectEPL([self.project.APAMA_HOME+'/monitors/'+i+'.mon' for i in ['ScenarioService', 'data_storage/MemoryStore', 'JSONPlugin', 'AnyExtractor', 'ManagementImpl', 'Management', 'ConnectivityPluginsControl', 'ConnectivityPlugins', 'HTTPClientEvents', 'AutomaticOnApplicationInitialized']])
		corr.injectCDP(self.project.ANALYTICS_BUILDER_SDK+'/block-api/framework/analyticsbuilder-framework.cdp')
		self.injectCumulocityEvents(corr)
		corr.injectCDP(self.project.ANALYTICS_BUILDER_SDK + '/block-api/framework/cumulocity-inventoryLookup-events.cdp')
		corr.injectEPL(self.project.ANALYTICS_BUILDER_SDK+'/testframework/resources/TestHelpers.mon')


		for blockOutput in blockOutputDirs:
			corr.send(sorted(list(blockOutput.rglob('*.evt'))))
		self.analyticsBuilderCorrelator = corr
		corr.receive('output.evt', channels=['TestOutput'])
		corr.injectTestEventLogger(channels=['TestOutput'])

		if not injectBlocks:
			return blockOutputDirs

		self.preInjectBlock(corr)

		# inject block files:
		for blockOutput in blockOutputDirs:
			corr.injectEPL(sorted(list(blockOutput.rglob('*.mon'))))
			corr.send(sorted(list(blockOutput.rglob('*.evt'))))
		# now done
		corr.sendEventStrings('com.apama.connectivity.ApplicationInitialized()')
		corr.flush(count=10)
		return corr
コード例 #25
0
ファイル: run.py プロジェクト: mjj29/apama-epl-l10n-plugin
	def execute(self):
		for lang in ['en_GB.utf8', 'es_MX.utf8']:
			corr = CorrelatorHelper(self, name=f'correlator_{lang}')
			corr.start(logfile=f'correlator_{lang}.log', environ={'LANG':lang}, arguments=[f'-DSAMPLE_TRANSLATIONS={self.input}/../../../sample'])
			corr.injectEPL(filenames=['ManagementImpl.mon', 'Management.mon'], filedir=self.project.APAMA_HOME+'/monitors')
			corr.injectEPL(filenames=['L10N.mon'], filedir=self.input+'/../../../')
			corr.injectEPL(filenames=['Sample.mon'])
			corr.flush()
			corr.shutdown()
コード例 #26
0
    def startAnalyticsBuilderCorrelator(self,
                                        blockSourceDir=None,
                                        Xclock=True,
                                        numWorkers=4,
                                        **kwargs):
        """
		Start a correlator with the EPL for Analytics Builder loaded.
		:param blockSourceDir: A location of blocks to include.
		:param Xclock: Externally clock correlator (on by default).
		:param numWorkers: Number of workers for Analytics Builder runtime (4 by default).
		"""

        # Build and extract the block extension:
        if blockSourceDir == None: blockSourceDir = self.input
        blockOutput = self.output + '/block-output.zip'
        self.runAnalyticsBuilderScript([
            'build', 'extension', '--input', blockSourceDir, '--output',
            blockOutput
        ])
        with zipfile.ZipFile(blockOutput, 'r') as zf:
            blockOutput = Path(self.output + '/block-output/')
            os.mkdir(blockOutput)
            zf.extractall(blockOutput)

        # Start the correlator:
        corr = CorrelatorHelper(self)
        arguments = kwargs.get('arguments', [])
        arguments.append(f'-DanalyticsBuilder.numWorkerThreads={numWorkers}')
        kwargs['arguments'] = arguments
        logfile = kwargs.get('logfile', 'correlator.log')
        kwargs['logfile'] = logfile
        corr.start(Xclock=Xclock, **kwargs)
        corr.logfile = logfile
        corr.injectEPL([
            self.project.APAMA_HOME + '/monitors/' + i + '.mon' for i in [
                'ScenarioService', 'data_storage/MemoryStore', 'JSONPlugin',
                'AnyExtractor', 'ManagementImpl', 'Management',
                'ConnectivityPluginsControl', 'ConnectivityPlugins',
                'HTTPClientEvents', 'AutomaticOnApplicationInitialized'
            ]
        ])
        corr.injectCDP(self.project.ANALYTICS_BUILDER_SDK +
                       '/block-api/framework/analyticsbuilder-framework.cdp')
        self.injectCumulocityEvents(corr)
        corr.injectCDP(
            self.project.ANALYTICS_BUILDER_SDK +
            '/block-api/framework/cumulocity-inventoryLookup-events.cdp')
        corr.injectEPL(self.project.ANALYTICS_BUILDER_SDK +
                       '/testframework/resources/TestHelpers.mon')

        # inject block files:
        corr.injectEPL(sorted(list(blockOutput.rglob('*.mon'))))
        corr.send(sorted(list(blockOutput.rglob('*.evt'))))

        # now done
        corr.sendEventStrings(
            'com.apama.connectivity.ApplicationInitialized()')
        corr.flush(10)
        self.analyticsBuilderCorrelator = corr
        corr.receive('output.evt', channels=['TestOutput'])
        corr.injectTestEventLogger(channels=['TestOutput'])

        return corr
コード例 #27
0
	def execute(self):
		correlator = CorrelatorHelper(self, name='testcorrelator')
		correlator.start(logfile='testcorrelator.log', config=self.input+"/config.yaml", arguments=['-DCOMMAND_LINE=commandValue'])
		correlator.injectEPL(filenames=['ConfigurationPlugin.mon'], filedir=PROJECT.APAMA_WORK+"/monitors")
		correlator.injectEPL(filenames=['test.mon'])
		correlator.flush()