コード例 #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
    def validate(self):
        self.runAssert()
        self.waitForGrep('run.log',
                         expr='Assertion on',
                         condition='==3',
                         abortOnError=True,
                         ignores=[' DEBUG ', 'Waiting for'])
        filecopy(os.path.join(self.output, 'run.log'),
                 os.path.join(self.output, 'run.log.proc'))
        loc = self.getOutcomeLocation()

        del self.outcome[:]
        self.log.info('---')
        self.assertGrep('run.log.proc', expr='Assertion.*failed \[run.py:9\]')
        self.assertGrep('run.log.proc',
                        expr='Assertion.*failed \[run.py:14,run.py:10\]')
        self.assertGrep('run.log.proc',
                        expr='Assertion.*failed \[run.py:14,run.py:17\]')

        self.assertThat('outcomeLocation[1] == expected',
                        outcomeLocation=loc,
                        expected='9')
        self.assertThat('outcomeLocation[0].endswith(os.sep+"run.py")',
                        outcomeLocation=loc)
        self.assertThat('os.path.exists(outcomeLocation[0])',
                        outcomeLocation=loc)
コード例 #3
0
ファイル: run.py プロジェクト: moraygrieve/pysys
	def execute(self):
		self.assertLineCount('file1.txt', filedir=self.input, expr='Foo', condition='==1')
		self.assertLineCount('file1.txt', filedir=self.input, expr='Fi', condition='>=15')
		self.waitForSignal('run.log', expr='Line count .*Fi.*>=15', timeout=30)
		
		self.log.info('Copying run.log for later verification')
		filecopy(os.path.join(self.output, 'run.log'), os.path.join(self.output, 'run.log.proc'))
コード例 #4
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")
コード例 #5
0
ファイル: run.py プロジェクト: moraygrieve/pysys
 def execute(self):
     self.assertDiff(file1='file1.txt',
                     filedir1=self.input,
                     file2='ref_file.txt',
                     assertMessage='Checking Rabbie B')
     self.log.info('Copying run.log for later verification')
     filecopy(os.path.join(self.output, 'run.log'),
              os.path.join(self.output, 'run.log.proc'))
コード例 #6
0
ファイル: run.py プロジェクト: moraygrieve/pysys
 def execute(self):
     self.assertGrep(file='file.txt',
                     filedir=self.input,
                     expr='moon shines bright',
                     assertMessage='Does the moon shine bright?')
     self.log.info('Copying run.log for later verification')
     filecopy(os.path.join(self.output, 'run.log'),
              os.path.join(self.output, 'run.log.proc'))
コード例 #7
0
ファイル: accounts.py プロジェクト: moraygrieve/kioti-tests
 def copyjars(cls, toDir):
     jars = [
         os.path.join(CORDAPPS_DIR, 'accounts', 'staging',
                      'accounts-test-cordapp-workflows.jar')
     ]
     map(lambda x: filecopy(x, os.path.join(toDir, os.path.basename(x))),
         jars)
     map(lambda x: filecopy(x, os.path.join(toDir, os.path.basename(x))),
         cls.getjars())
コード例 #8
0
	def execute(self):
		self.assertLastGrep('file1.txt', filedir=self.input, expr='Bar', assertMessage='Looking for Bar')
		self.assertLastGrep('file1.txt', filedir=self.input, expr='Foo', contains=FALSE, assertMessage='Looking for Foo')
		self.assertLastGrep('file1.txt', filedir=self.input, expr='Foo', contains=FALSE, assertMessage='Looking for Foo again')
		
		self.waitForGrep('run.log', expr='Looking for Foo again', condition='>=1', timeout=5, ignores=[' DEBUG '])
		
		self.log.info('Copying run.log for later verification')
		filecopy(os.path.join(self.output, 'run.log'), os.path.join(self.output, 'run.log.proc'))
コード例 #9
0
ファイル: node.py プロジェクト: moraygrieve/kioti-tests
    def create(cls,
               name,
               testcase,
               distribution,
               bootstrapped,
               network=None,
               database=None,
               cryptoService=None,
               notary=None,
               cordapps=None):
        """Create a NodeHelper ready for real or bootstrapped network.

        :param name: The logical name of  the node entity
        :param testcase: A reference to the owning testcase
        :param distribution: The distribution of Corda to use
        :param bootstrapped: If True this is for bootstrapping
        :param network: A reference to the network to run against
        :param database: The database type to use for the node vault (defaults H2)
        :param cryptoService: The cryptoservice to use (HSM)
        :param notary: If this node is to be a notary
        :param cordapps: A list of cordapp wrappers used to copy over the jars and configure
        """
        if distribution is None: distribution = testcase.distribution
        node = NodeHelper(name, testcase, distribution, network, database)

        # write the node configuration to the node directory
        node.config = NodeConfig.init(name, testcase, devMode=bootstrapped)
        node.config.withDatabase(testcase, distribution.isOS(), node.database,
                                 node.database_port)
        node.config.withNetworkServices(
            network) if network is not None else None
        node.config.withCryptoService(
            cryptoService.name,
            cryptoService.conf) if cryptoService is not None else None
        node.config.withNotary(
            notary.validating) if notary is not None else None

        # create the node directory structure and write out the node configuration file
        os.makedirs(node.directory)
        os.makedirs(os.path.join(node.directory, 'drivers'))
        os.makedirs(os.path.join(node.directory, 'cordapps'))
        node.config.write(os.path.join(node.directory, 'node.conf'))

        # copy over any cordapps or drivers
        map(lambda x: x.copyjars(os.path.join(node.directory, 'cordapps')),
            cordapps if cordapps is not None else [])
        if database is not None:
            filecopy(getDriver(database),
                     os.path.join(node.directory, 'drivers', database.driver))

        # corda jar will be taken as requested from the distribution
        filecopy(getCordaArtifact(distribution, 'corda'),
                 os.path.join(node.directory, 'corda.jar'))
        node.jar = os.path.join(node.directory, 'corda.jar')
        return node
コード例 #10
0
ファイル: node.py プロジェクト: moraygrieve/kioti-tests
    def upgrade(self, distribution):
        """Set the node jar file to a new distribution version of Corda.

        This method downloads the requested distribution of Corda if it is not available, and
        sets the node jar file to reference this. In order to perform the upgrade, the node
        should be stopped and then restarted.

        :param distribution: The new distribution to upgrade to
        """
        self.distribution = distribution
        filecopy(getCordaArtifact(distribution, self.jar))
コード例 #11
0
 def copyjars(cls, toDir):
     jars = [
         os.path.join(CORDAPPS_DIR, 'confidentities', 'staging',
                      'confidentities-contracts.jar')
     ]
     jars.append(
         os.path.join(CORDAPPS_DIR, 'confidentities', 'staging',
                      'confidentities-workflows.jar'))
     map(lambda x: filecopy(x, os.path.join(toDir, os.path.basename(x))),
         jars)
     map(lambda x: filecopy(x, os.path.join(toDir, os.path.basename(x))),
         cls.getjars())
コード例 #12
0
ファイル: run.py プロジェクト: moraygrieve/pysys
 def execute(self):
     exprList = []
     exprList.append('(?P<direction>westlin|eastlin)')
     exprList.append('moon shines bright')
     exprList.append('my charmer')
     self.assertOrderedGrep(file='file.txt',
                            filedir=self.input,
                            exprList=exprList,
                            assertMessage='Do we know the direction?')
     self.log.info('Copying run.log for later verification')
     filecopy(os.path.join(self.output, 'run.log'),
              os.path.join(self.output, 'run.log.proc'))
コード例 #13
0
 def validate(self):
     self.runAssert()
     self.waitForSignal('run.log',
                        expr='Assertion on',
                        condition='==3',
                        abortOnError=True)
     filecopy(os.path.join(self.output, 'run.log'),
              os.path.join(self.output, 'run.log.proc'))
     del self.outcome[:]
     self.assertGrep('run.log.proc', expr='Assertion.*failed \[run.py:7\]')
     self.assertGrep('run.log.proc',
                     expr='Assertion.*failed \[run.py:20,run.py:8\]')
     self.assertGrep('run.log.proc',
                     expr='Assertion.*failed \[run.py:20,run.py:11\]')
コード例 #14
0
    def execute(self):
        self.assertLineCount('file1.txt',
                             filedir=self.input,
                             expr='Foo',
                             condition='==1',
                             assertMessage='Looking for Foo')
        self.assertLineCount('file1.txt',
                             filedir=self.input,
                             expr='Fi',
                             condition='>=15',
                             assertMessage='Looking for Fi')
        self.waitForGrep('run.log',
                         expr='Looking for Fi.*failed',
                         timeout=5,
                         ignores=[' DEBUG '])

        self.log.info('Copying run.log for later verification')
        filecopy(os.path.join(self.output, 'run.log'),
                 os.path.join(self.output, 'run.log.proc'))
コード例 #15
0
 def copyjars(cls, toDir):
     jars = [
         os.path.join(CORDAPPS_DIR, 'doublespend', 'staging',
                      'doublespend-contracts.jar')
     ]
     jars.append(
         os.path.join(CORDAPPS_DIR, 'doublespend', 'staging',
                      'doublespend-workflows.jar'))
     map(lambda x: filecopy(x, os.path.join(toDir, os.path.basename(x))),
         jars)
コード例 #16
0
ファイル: run.py プロジェクト: moraygrieve/pysys
	def validate(self):
                filecopy(os.path.join(self.output, 'run.log'), os.path.join(self.output, 'run.log.proc'))
                del self.outcome[:]
                self.assertGrep('run.log.proc', expr='Wait.*timed out.*\[run.py:9\]')
コード例 #17
0
ファイル: receiver.py プロジェクト: moraygrieve/kioti-tests
 def copyjars(cls, toDir):
     jar = os.path.join(CORDAPPS_DIR, 'receiver', 'staging',
                        'receiver-workflows.jar')
     filecopy(jar, os.path.join(toDir, os.path.basename(jar)))
コード例 #18
0
ファイル: finance.py プロジェクト: moraygrieve/kioti-tests
 def copyjars(cls, toDir):
     for jar in cls.getjars():
         filecopy(jar, os.path.join(toDir, os.path.basename(jar)))
コード例 #19
0
 def execute(self):
     self.assertTrue(eval('1==1'), assertMessage='Checking if 1==1')
     self.log.info('Copying run.log for later verification')
     filecopy(os.path.join(self.output, 'run.log'),
              os.path.join(self.output, 'run.log.proc'))