34 include_once(__DIR__.
'/../../../lib/php/Test/Agent/AgentTestMockHelper.php');
35 include_once(__DIR__.
'/SchedulerTestRunner.php');
37 include_once(dirname(dirname(__DIR__)).
'/agent/DeciderAgent.php');
46 private $clearingDecisionProcessor;
48 private $agentLicenseEventProcessor;
54 private $decisionTypes;
56 private $highlightDao;
62 $this->clearingDao = $clearingDao;
63 $this->agentDao = $agentDao;
64 $this->uploadDao = $uploadDao;
65 $this->highlightDao = $highlightDao;
66 $this->showJobsDao = $showJobsDao;
69 $this->clearingDecisionProcessor = $clearingDecisionProcessor;
70 $this->agentLicenseEventProcessor = $agentLicenseEventProcessor;
77 public function run($uploadId, $userId=2, $groupId=2, $jobId=1, $args=
"")
86 if (preg_match(
"/-r([0-9]*)/", $args, $matches)) {
87 $opts[
'r'] = $matches[1];
92 $container = M::mock(
'Container');
93 $container->shouldReceive(
'get')->with(
'db.manager')->andReturn($this->
dbManager);
94 $container->shouldReceive(
'get')->with(
'dao.agent')->andReturn($this->agentDao);
95 $container->shouldReceive(
'get')->with(
'dao.clearing')->andReturn($this->clearingDao);
96 $container->shouldReceive(
'get')->with(
'dao.upload')->andReturn($this->uploadDao);
97 $container->shouldReceive(
'get')->with(
'dao.highlight')->andReturn($this->highlightDao);
98 $container->shouldReceive(
'get')->with(
'dao.show_jobs')->andReturn($this->showJobsDao);
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);
105 $fgetsMock->shouldReceive(
"fgets")->with(STDIN)->andReturn($uploadId,
false);
112 include(dirname(dirname(__DIR__)).
'/agent/decider.php');
114 $output = ob_get_clean();
116 return array(
true, $output, $exitval);
Structure of an Agent with all required parameters.
Utility functions to process ClearingDecision.
run($uploadId, $userId=2, $groupId=2, $jobId=1, $args="")
Get the arguments required by agent to run and try to run the agent.
Handle events related to license findings.
Create dummy run interface.
$GLOBALS['xyyzzzDeciderJob']
Namespace used by reuser agent.
fo_dbManager * dbManager
fo_dbManager object