12 require_once
"SchedulerTestRunnerCli.php";
13 require_once
"SchedulerTestRunnerScheduler.php";
54 private $testInstaller;
62 private $uploadPermDao;
66 private $compatibilityDao;
74 private $schedulerRunner;
84 protected function setUp() : void
86 $this->testDb =
new TestPgDb(
"compSched" . time());
87 $this->
dbManager = $this->testDb->getDbManager();
89 $this->logger =
new Logger(
"CompatibilitySchedulerTest");
93 $this->uploadPermDao = \Mockery::mock(UploadPermissionDao::class);
95 $this->uploadPermDao);
107 $this->testDb->fullDestruct();
108 $this->testDb =
null;
110 $this->licenseDao =
null;
118 $sysConf = $this->testDb->getFossSysConf();
120 $this->testInstaller->init();
121 $this->testInstaller->cpRepo();
129 $this->testInstaller->rmRepo();
130 $this->testInstaller->clear();
138 $this->testDb->createPlainTables(
151 'upload_clearing_license'
153 $this->testDb->createInheritedTables(
159 $this->testDb->createSequences(
161 'agent_agent_pk_seq',
162 'upload_upload_pk_seq',
163 'pfile_pfile_pk_seq',
165 'group_group_pk_seq',
166 'nomos_ars_ars_pk_seq',
167 'license_ref_rf_pk_seq',
168 'license_file_fl_pk_seq',
169 'license_rules_lr_pk_seq'
171 $this->testDb->createConstraints(
180 $this->testDb->alterTables(
192 $this->testDb->createInheritedTables(array(
196 $this->testDb->insertData(
208 'upload_clearing_license'
211 $this->testDb->getDbManager()->getSingleRow(
212 "UPDATE ars_master SET upload_fk = $1 WHERE ars_pk = $2",
215 $this->testDb->getDbManager()->getSingleRow(
216 "UPDATE ars_master SET upload_fk = $1 WHERE ars_pk = $2",
219 $this->testDb->getDbManager()->getSingleRow(
220 "SELECT setval('agent_agent_pk_seq', 300)", [],
"agent_seq"
240 $this->licenseDao, $this->agentDao);
243 list ($success, $output, $retCode) = $this->schedulerRunner->run($uploadId);
245 $this->assertTrue($success,
'running compatibility failed');
246 $this->assertEquals($retCode, 0,
"compatibility failed ($retCode): $output");
248 $uploadTreeTableName = $this->uploadDao->getUploadtreeTableName($uploadId);
251 $this->assertFalse($this->compatibilityDao->getCompatibilityForFile(
252 $this->uploadDao->getItemTreeBounds(40, $uploadTreeTableName),
253 $this->licenseDao->getLicenseById(202)->getShortName())
255 $this->assertFalse($this->compatibilityDao->getCompatibilityForFile(
256 $this->uploadDao->getItemTreeBounds(40, $uploadTreeTableName),
257 $this->licenseDao->getLicenseById(498)->getShortName())
261 $this->assertTrue($this->compatibilityDao->getCompatibilityForFile(
262 $this->uploadDao->getItemTreeBounds(38, $uploadTreeTableName),
263 $this->licenseDao->getLicenseById(498)->getShortName())
267 $this->assertTrue($this->compatibilityDao->getCompatibilityForFile(
268 $this->uploadDao->getItemTreeBounds(42, $uploadTreeTableName),
269 $this->licenseDao->getLicenseById(544)->getShortName())
Functional test cases for compatibility agent using scheduler.
setUpTables()
Setup tables required by copyright agent.
setUpRepo()
Setup test repo mimicking install.
setUp()
Setup the test cases and initialize the objects.
rmRepo()
Remove the test repo.
tearDown()
Destruct the objects initialized during setUp()
Handles scheduler interaction.
Handles scheduler interaction.
Exception when an agent's stage is invalid.
fo_dbManager * dbManager
fo_dbManager object