23 include_once(__DIR__.
'/../../../lib/php/Test/Agent/AgentTestMockHelper.php');
24 include_once(__DIR__.
'/SchedulerTestRunnerCli.php');
63 $this->testDb =
new TestPgDb(
"report".time());
64 $this->
dbManager = $this->testDb->getDbManager();
67 $this->assertCountBefore = \Hamcrest\MatcherAssert::getCount();
75 $this->addToAssertionCount(\Hamcrest\MatcherAssert::getCount()-$this->assertCountBefore);
86 $sysConf = $this->testDb->getFossSysConf();
88 $this->testInstaller->init();
89 $this->testInstaller->cpRepo();
97 $this->testInstaller->rmRepo();
98 $this->testInstaller->clear();
106 $this->testDb->createSequences(array(),
true);
107 $this->testDb->createPlainTables(array(),
true);
108 $this->testDb->createInheritedTables();
109 $this->testDb->createInheritedArsTables(array(
'copyright',
'monk',
'nomos'));
110 $this->testDb->createConstraints(array(
'agent_pkey',
'pfile_pkey',
'upload_pkey_idx',
111 'FileLicense_pkey',
'clearing_event_pkey'),
false);
112 $this->testDb->alterTables(array(
'agent',
'pfile',
'upload',
'ars_master',
113 'license_ref_bulk',
'clearing_event',
'clearing_decision',
'license_file',
'highlight'),
false);
115 $this->testDb->insertData(array(
'mimetype_ars',
'pkgagent_ars',
'ununpack_ars',
'decider_ars'),
true,__DIR__.
'/fo_report.sql');
117 $this->testDb->resetSequenceAsMaxOf(
'agent_agent_pk_seq',
'agent',
'agent_pk');
126 if (preg_match(
"/.*HEART: ([0-9]*).*/", $output, $matches)) {
127 return intval($matches[1]);
147 list($success,$output,$retCode) = $this->runnerCli->run($uploadId=1, $this->userId, $this->groupId, $jobId=7);
149 assertThat(
'cannot run runner', $success, equalTo(
true));
150 assertThat(
'report failed: "'.$output.
'"', $retCode, equalTo(0));
153 $row = $this->
dbManager->getSingleRow(
"SELECT upload_fk,job_fk,filepath FROM reportgen WHERE job_fk = $1", array($jobId),
"reportFileName");
154 assertThat($row, hasKeyValuePair(
'upload_fk', $uploadId));
155 assertThat($row, hasKeyValuePair(
'job_fk', $jobId));
156 $filepath = $row[
'filepath'];
Handles scheduler interaction.
setUpTables()
Setup tables required by the agent.
testReport()
Test report agent.
getHeartCount($output)
Get the heart count from agent.
rmRepo()
Tear down test repo.
setUpRepo()
Setup test repo.
tearDown()
Tear down test env.
fo_dbManager * dbManager
fo_dbManager object
Namespace for report related tests.
list_t type structure used to keep various lists. (e.g. there are multiple lists).