24 include_once(__DIR__.
'/../../../lib/php/Test/Agent/AgentTestMockHelper.php');
25 include_once(__DIR__.
'/SchedulerTestRunner.php');
27 include_once(dirname(dirname(__DIR__)).
'/agent/DeciderAgent.php');
36 private $clearingDecisionProcessor;
38 private $agentLicenseEventProcessor;
44 private $decisionTypes;
46 private $highlightDao;
50 private $copyrightDao;
59 $this->clearingDao = $clearingDao;
60 $this->agentDao = $agentDao;
61 $this->uploadDao = $uploadDao;
62 $this->highlightDao = $highlightDao;
63 $this->showJobsDao = $showJobsDao;
64 $this->copyrightDao = $copyrightDao;
67 $this->clearingDecisionProcessor = $clearingDecisionProcessor;
68 $this->agentLicenseEventProcessor = $agentLicenseEventProcessor;
69 $this->copyrightDao = $copyrightDao;
76 public function run($uploadId, $userId=2, $groupId=2, $jobId=1, $args=
"")
85 if (preg_match(
"/-r([0-9]*)/", $args, $matches)) {
86 $opts[
'r'] = $matches[1];
91 $container = M::mock(
'Container');
92 $container->shouldReceive(
'get')->with(
'db.manager')->andReturn($this->
dbManager);
93 $container->shouldReceive(
'get')->with(
'dao.agent')->andReturn($this->agentDao);
94 $container->shouldReceive(
'get')->with(
'dao.clearing')->andReturn($this->clearingDao);
95 $container->shouldReceive(
'get')->with(
'dao.upload')->andReturn($this->uploadDao);
96 $container->shouldReceive(
'get')->with(
'dao.highlight')->andReturn($this->highlightDao);
97 $container->shouldReceive(
'get')->with(
'dao.show_jobs')->andReturn($this->showJobsDao);
98 $container->shouldReceive(
'get')->with(
'dao.copyright')->andReturn($this->copyrightDao);
99 $container->shouldReceive(
'get')->with(
'decision.types')->andReturn($this->decisionTypes);
100 $container->shouldReceive(
'get')->with(
'businessrules.clearing_decision_processor')->andReturn($this->clearingDecisionProcessor);
101 $container->shouldReceive(
'get')->with(
'businessrules.agent_license_event_processor')->andReturn($this->agentLicenseEventProcessor);
102 $container->shouldReceive(
'get')->with(
'dao.copyright')->andReturn($this->copyrightDao);
105 $fgetsMock = M::mock(\Fossology\Lib\
Agent\FgetsMock::class);
106 $fgetsMock->shouldReceive(
"fgets")->with(STDIN)->andReturn($uploadId,
false);
113 include(dirname(dirname(__DIR__)).
'/agent/decider.php');
115 $output = ob_get_clean();
117 return array(
true, $output, $exitval);
Agent to decide license findings in an upload.
run($uploadId, $userId=2, $groupId=2, $jobId=1, $args="")
Get the arguments required by agent to run and try to run the agent.
Structure of an Agent with all required parameters.
Handle events related to license findings.
Utility functions to process ClearingDecision.
Wrapper class for license map.
Create dummy run interface.
fo_dbManager * dbManager
fo_dbManager object
$GLOBALS['xyyzzzDeciderJob']