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;
52 private $compatibilityDao;
64 $this->clearingDao = $clearingDao;
65 $this->agentDao = $agentDao;
66 $this->uploadDao = $uploadDao;
67 $this->highlightDao = $highlightDao;
68 $this->showJobsDao = $showJobsDao;
69 $this->copyrightDao = $copyrightDao;
71 $this->compatibilityDao = $compatibilityDao;
72 $this->licenseDao = $licenseDao;
74 $this->clearingDecisionProcessor = $clearingDecisionProcessor;
75 $this->agentLicenseEventProcessor = $agentLicenseEventProcessor;
82 public function run($uploadId, $userId=2, $groupId=2, $jobId=1, $args=
"")
91 if (preg_match(
"/-r([0-9]*)/", $args, $matches)) {
92 $opts[
'r'] = $matches[1];
97 $container = M::mock(
'Container');
98 $container->shouldReceive(
'get')->with(
'db.manager')->andReturn($this->
dbManager);
99 $container->shouldReceive(
'get')->with(
'dao.agent')->andReturn($this->agentDao);
100 $container->shouldReceive(
'get')->with(
'dao.clearing')->andReturn($this->clearingDao);
101 $container->shouldReceive(
'get')->with(
'dao.upload')->andReturn($this->uploadDao);
102 $container->shouldReceive(
'get')->with(
'dao.highlight')->andReturn($this->highlightDao);
103 $container->shouldReceive(
'get')->with(
'dao.show_jobs')->andReturn($this->showJobsDao);
104 $container->shouldReceive(
'get')->with(
'dao.copyright')->andReturn($this->copyrightDao);
105 $container->shouldReceive(
'get')->with(
'decision.types')->andReturn($this->decisionTypes);
106 $container->shouldReceive(
'get')->with(
'businessrules.clearing_decision_processor')->andReturn($this->clearingDecisionProcessor);
107 $container->shouldReceive(
'get')->with(
'businessrules.agent_license_event_processor')->andReturn($this->agentLicenseEventProcessor);
108 $container->shouldReceive(
'get')->with(
'dao.compatibility')->andReturn($this->compatibilityDao);
109 $container->shouldReceive(
'get')->with(
'dao.license')->andReturn($this->licenseDao);
112 $fgetsMock = M::mock(\Fossology\Lib\
Agent\FgetsMock::class);
113 $fgetsMock->shouldReceive(
"fgets")->with(STDIN)->andReturn($uploadId,
false);
120 include(dirname(dirname(__DIR__)).
'/agent/decider.php');
122 $output = ob_get_clean();
124 return array(
true, $output, $exitval);
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.
Create dummy run interface.
fo_dbManager * dbManager
fo_dbManager object
$GLOBALS['xyyzzzDeciderJob']