Exemple #1
0
 private function setUpTables()
 {
     $this->testDb->createPlainTables(array(), true);
     $this->testDb->createInheritedTables();
     $this->dbManager->queryOnce("CREATE TABLE copyright_ars () INHERITS (ars_master)");
     $this->testDb->createSequences(array('agent_agent_pk_seq', 'pfile_pfile_pk_seq', 'upload_upload_pk_seq', 'nomos_ars_ars_pk_seq', 'license_file_fl_pk_seq', 'license_ref_rf_pk_seq', 'license_ref_bulk_lrb_pk_seq', 'clearing_decision_clearing_decision_pk_seq', 'clearing_event_clearing_event_pk_seq'));
     $this->testDb->createConstraints(array('agent_pkey', 'pfile_pkey', 'upload_pkey_idx', 'FileLicense_pkey', 'clearing_event_pkey'));
     $this->testDb->alterTables(array('agent', 'pfile', 'upload', 'ars_master', 'license_ref_bulk', 'license_set_bulk', 'clearing_event', 'clearing_decision', 'license_file', 'highlight'));
     $this->testDb->insertData(array('mimetype_ars', 'pkgagent_ars', 'ununpack_ars', 'decider_ars'), true, __DIR__ . '/fo_report.sql');
     $this->testDb->resetSequenceAsMaxOf('agent_agent_pk_seq', 'agent', 'agent_pk');
 }
 protected function setUp()
 {
     $this->testDb = new TestPgDb("fossclitest");
     $tables = array('users', 'upload', 'uploadtree_a', 'uploadtree', 'copyright', 'groups', 'group_user_member', 'agent', 'copyright_decision', 'copyright_ars', 'ars_master');
     $this->testDb->createPlainTables($tables);
     $this->testDb->createInheritedTables(array('uploadtree_a'));
     $this->testDb->createInheritedArsTables(array('copyright'));
     $this->testDb->insertData($tables);
     $sysConf = $this->testDb->getFossSysConf();
     $this->fo_copyright_list_path = dirname(__DIR__) . '/fo_copyright_list -c ' . $sysConf;
     $this->testInstaller = new TestInstaller($sysConf);
     $this->testInstaller->init();
 }
 private function setUpClearingTables()
 {
     $this->testDb->createPlainTables(array('copyright', 'copyright_audit', 'uploadtree', 'copyright_decision'));
     $this->testDb->createInheritedTables(array('uploadtree_a'));
     $this->testDb->insertData(array('copyright', 'uploadtree_a'));
     $this->testDb->createSequences(array('copyright_ct_pk_seq', 'copyright_decision_pk_seq'));
     $this->testDb->alterTables(array('copyright', 'copyright_decision'));
 }
 private function setUpTables()
 {
     $this->testDb->createPlainTables(array('agent', 'uploadtree', 'upload', 'pfile', 'users', 'bucketpool', 'mimetype', 'ars_master'));
     $this->testDb->createSequences(array('agent_agent_pk_seq', 'upload_upload_pk_seq', 'pfile_pfile_pk_seq', 'users_user_pk_seq', 'nomos_ars_ars_pk_seq'));
     $this->testDb->createConstraints(array('agent_pkey', 'upload_pkey_idx', 'pfile_pkey', 'user_pkey'));
     $this->testDb->alterTables(array('agent', 'pfile', 'upload', 'ars_master', 'users'));
     $this->testDb->createInheritedTables(array('uploadtree_a'));
     $this->testDb->insertData(array('upload', 'pfile', 'uploadtree_a', 'bucketpool', 'mimetype', 'users'), false);
 }
Exemple #5
0
 protected function setUp()
 {
     $this->uploadDao = M::mock(UploadDao::classname());
     $logger = new Logger('default');
     $logger->pushHandler(new ErrorLogHandler());
     $this->testDb = new TestPgDb();
     $this->dbManager =& $this->testDb->getDbManager();
     $this->clearingDao = new ClearingDao($this->dbManager, $this->uploadDao);
     $this->testDb->createPlainTables(array('clearing_decision', 'clearing_decision_event', 'clearing_decision_type', 'clearing_event', 'clearing_licenses', 'highlight_bulk', 'license_ref', 'license_ref_bulk', 'license_set_bulk', 'users', 'uploadtree'));
     $this->testDb->createInheritedTables();
     $userArray = array(array('myself', 1), array('in_same_group', 2), array('in_trusted_group', 3));
     foreach ($userArray as $ur) {
         $this->dbManager->insertInto('users', 'user_name, root_folder_fk', $ur);
     }
     $refArray = array(array(401, 'FOO', 'foo full', 'foo text'), array(402, 'BAR', 'bar full', 'bar text'), array(403, 'BAZ', 'baz full', 'baz text'), array(404, 'QUX', 'qux full', 'qux text'));
     foreach ($refArray as $params) {
         $this->dbManager->insertInto('license_ref', 'rf_pk, rf_shortname, rf_fullname, rf_text', $params, $logStmt = 'insert.ref');
     }
     $modd = 536888320;
     $modf = 33188;
     /*                          (pfile,item,lft,rgt)
           upload101:   upload101/    (  0, 299,  1,  4)
                        Afile         (201, 301,  1,  2)
                        Bfile         (202, 302,  3,  4)
           upload102:   upload102/    (  0, 300,  1,  8)
                        Afile         (201, 303,  1,  2)
                        A-dir/        (  0, 304,  3,  6)
                        A-dir/Afile   (201, 305,  4,  5)
                        Bfile         (202, 306,  7,  8)
         */
     $this->items = array(299 => array(101, 299, 0, $modd, 1, 4, "upload101"), 300 => array(102, 300, 0, $modd, 1, 8, "upload102"), 301 => array(101, 301, 201, $modf, 1, 2, "Afile"), 302 => array(101, 302, 202, $modf, 3, 4, "Bfile"), 303 => array(102, 303, 201, $modf, 1, 2, "Afile"), 304 => array(102, 304, 0, $modd, 3, 6, "A-dir"), 305 => array(102, 305, 201, $modf, 4, 5, "Afile"), 306 => array(102, 306, 202, $modf, 7, 8, "Bfile"));
     foreach ($this->items as $ur) {
         $this->dbManager->insertInto('uploadtree', 'upload_fk,uploadtree_pk,pfile_fk,ufile_mode,lft,rgt,ufile_name', $ur);
     }
     $this->now = time();
     $bulkLicArray = array(array(1, 401, 'TextFOO', false, 101, 299, $this->groupId), array(2, 402, 'TextBAR', false, 101, 299, $this->groupId), array(3, 403, 'TextBAZ', true, 101, 301, $this->groupId), array(4, 403, 'TextBAZ', false, 101, 299, $this->groupId), array(5, 404, 'TextQUX', true, 101, 299, $this->groupId), array(6, 401, 'TexxFOO', true, 101, 302, $this->groupId), array(7, 403, 'TextBAZ', false, 102, 300, $this->groupId), array(8, 403, 'TextBAZ', true, 102, 306, $this->groupId));
     foreach ($bulkLicArray as $params) {
         $paramsRef = array($params[0], $params[2], $params[4], $params[5], $params[6]);
         $paramsSet = array($params[0], $params[1], $params[3]);
         $this->dbManager->insertInto('license_ref_bulk', 'lrb_pk, rf_text, upload_fk, uploadtree_fk, group_fk', $paramsRef, 'insert.bulkref');
         $this->dbManager->insertInto('license_set_bulk', 'lrb_fk, rf_fk, removing', $paramsSet, 'insert.bulkset');
     }
     $this->assertCountBefore = \Hamcrest\MatcherAssert::getCount();
 }
Exemple #6
0
 private function setUpTables()
 {
     $this->testDb->createPlainTables(array('upload', 'uploadtree', 'uploadtree_a', 'license_ref', 'license_ref_bulk', 'license_set_bulk', 'clearing_event', 'clearing_decision', 'clearing_decision_event', 'license_file', 'highlight', 'highlight_bulk', 'agent', 'pfile', 'ars_master', 'users'), false);
     $this->testDb->createSequences(array('agent_agent_pk_seq', 'pfile_pfile_pk_seq', 'upload_upload_pk_seq', 'nomos_ars_ars_pk_seq', 'license_file_fl_pk_seq', 'license_ref_rf_pk_seq', 'license_ref_bulk_lrb_pk_seq', 'clearing_event_clearing_event_pk_seq', 'clearing_decision_clearing_decision_pk_seq'), false);
     $this->testDb->createViews(array('license_file_ref'), false);
     $this->testDb->createConstraints(array('agent_pkey', 'pfile_pkey', 'upload_pkey_idx', 'FileLicense_pkey', 'clearing_event_pkey', 'clearing_decision_pkey'), false);
     $this->testDb->alterTables(array('agent', 'pfile', 'upload', 'ars_master', 'license_ref_bulk', 'license_set_bulk', 'clearing_event', 'license_file', 'highlight', 'clearing_decision'), false);
     $this->testDb->createInheritedTables();
     $this->testDb->insertData(array('pfile', 'upload', 'uploadtree_a', 'users'), false);
     $this->testDb->insertData_license_ref();
 }
 private function setUpTables()
 {
     $this->testDb->createPlainTables(array('upload', 'uploadtree', 'license_ref', 'license_file', 'highlight', 'agent', 'pfile', 'ars_master'), false);
     $this->testDb->createSequences(array('agent_agent_pk_seq', 'pfile_pfile_pk_seq', 'upload_upload_pk_seq', 'nomos_ars_ars_pk_seq', 'license_file_fl_pk_seq', 'license_ref_rf_pk_seq'), false);
     $this->testDb->createViews(array('license_file_ref'), false);
     $this->testDb->createConstraints(array('agent_pkey', 'pfile_pkey', 'upload_pkey_idx', 'FileLicense_pkey', 'rf_pkpk'), false);
     $this->testDb->alterTables(array('agent', 'pfile', 'upload', 'ars_master', 'license_file', 'highlight', 'license_ref'), false);
     $this->testDb->createInheritedTables();
     $this->testDb->insertData(array('pfile', 'upload', 'uploadtree_a'), false);
     $this->testDb->insertData_license_ref();
     $this->testDb->resetSequenceAsMaxOf('license_ref_rf_pk_seq', 'license_ref', 'rf_pk');
 }
Exemple #8
0
 private function setUpTables()
 {
     $this->testDb->createPlainTables(array('upload', 'upload_reuse', 'uploadtree', 'uploadtree_a', 'license_ref', 'license_ref_bulk', 'license_set_bulk', 'clearing_decision', 'clearing_decision_event', 'clearing_event', 'license_file', 'highlight', 'highlight_keyword', 'agent', 'pfile', 'ars_master', 'users', 'group_user_member', 'license_map', 'jobqueue', 'job'), false);
     $this->testDb->createSequences(array('agent_agent_pk_seq', 'pfile_pfile_pk_seq', 'upload_upload_pk_seq', 'nomos_ars_ars_pk_seq', 'license_file_fl_pk_seq', 'license_ref_rf_pk_seq', 'license_ref_bulk_lrb_pk_seq', 'clearing_decision_clearing_decision_pk_seq', 'clearing_event_clearing_event_pk_seq', 'FileLicense_pkey', 'jobqueue_jq_pk_seq'), false);
     $this->testDb->createViews(array('license_file_ref'), false);
     $this->testDb->createConstraints(array('agent_pkey', 'pfile_pkey', 'upload_pkey_idx', 'clearing_event_pkey', 'jobqueue_pkey'), false);
     $this->testDb->alterTables(array('agent', 'pfile', 'upload', 'ars_master', 'license_ref_bulk', 'license_set_bulk', 'clearing_event', 'clearing_decision', 'license_file', 'highlight', 'jobqueue'), false);
     $this->testDb->createInheritedTables();
     $this->testDb->createInheritedArsTables(array('nomos', 'monk', 'copyright'));
     $this->testDb->insertData(array('pfile', 'upload', 'uploadtree_a', 'users', 'group_user_member', 'agent', 'license_file', 'nomos_ars', 'monk_ars', 'copyright_ars'), false);
     $this->testDb->insertData_license_ref(80);
     $this->testDb->resetSequenceAsMaxOf('agent_agent_pk_seq', 'agent', 'agent_pk');
 }
 protected function setUp()
 {
     $this->testDb = new TestPgDb();
     $this->dbManager =& $this->testDb->getDbManager();
     $this->testDb->createPlainTables(array('upload', 'uploadtree', 'job', 'perm_upload', 'jobqueue', 'jobdepends'));
     $this->testDb->createInheritedTables(array('uploadtree_a'));
     $uploadArray = array(array('upload_pk' => 1, 'uploadtree_tablename' => 'uploadtree'), array('upload_pk' => 2, 'uploadtree_tablename' => 'uploadtree_a'));
     foreach ($uploadArray as $uploadEntry) {
         $this->dbManager->insertTableRow('upload', $uploadEntry);
     }
     $this->dbManager->prepare($stmt = 'insert.job', "INSERT INTO job (job_pk, job_queued, job_name, job_upload_fk, job_user_fk) VALUES (\$1, \$2, \$3, \$4, \$5)");
     $jobArray = array(array(1, date('c', time() - 5), "FCKeditor_2.6.4.zip", 1, 1), array(2, date('c'), "zlib_1.2.8.zip", 2, 2));
     foreach ($jobArray as $uploadEntry) {
         $this->dbManager->freeResult($this->dbManager->execute($stmt, $uploadEntry));
     }
     $logger = M::mock('Monolog\\Logger');
     $logger->shouldReceive('debug');
     $this->uploadPermissionDao = M::mock('Fossology\\Lib\\Dao\\UploadPermissionDao');
     $this->uploadDao = new UploadDao($this->dbManager, $logger, $this->uploadPermissionDao);
     $this->showJobsDao = new ShowJobsDao($this->dbManager, $this->uploadDao);
     $this->assertCountBefore = \Hamcrest\MatcherAssert::getCount();
 }