Example #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');
 }
Example #2
0
 protected function setUp()
 {
     $this->testDb = new TestPgDb();
     $this->dbManager = $this->testDb->getDbManager();
     $userDao = M::mock('Fossology\\Lib\\Dao\\UserDao');
     $uploadDao = M::mock('Fossology\\Lib\\Dao\\UploadDao');
     $this->folderDao = new FolderDao($this->dbManager, $userDao, $uploadDao);
     $this->testDb->createPlainTables(array('folder', 'foldercontents'));
     $this->testDb->createSequences(array('folder_folder_pk_seq', 'foldercontents_foldercontents_pk_seq'));
     $this->testDb->createConstraints(array('folder_pkey', 'foldercontents_pkey'));
     $this->testDb->alterTables(array('folder', 'foldercontents'));
     $this->assertCountBefore = \Hamcrest\MatcherAssert::getCount();
 }
Example #3
0
 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);
 }
Example #4
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();
 }
Example #5
0
 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');
 }
Example #6
0
 public function testupdateClearingEvent()
 {
     $this->testDb->createSequences(array('clearing_event_clearing_event_pk_seq'));
     $this->testDb->createConstraints(array('clearing_event_pkey'));
     $this->dbManager->queryOnce("ALTER TABLE clearing_event ALTER COLUMN clearing_event_pk SET DEFAULT nextval('clearing_event_clearing_event_pk_seq'::regclass)");
     $this->clearingDao->updateClearingEvent($uploadTreeId = 301, $userId = 1, $groupId = 1, $licenseId = 402, $what = 'comment', $changeCom = 'abc123');
     $rowPast = $this->dbManager->getSingleRow('SELECT * FROM clearing_event WHERE uploadtree_fk=$1 AND rf_fk=$2 ORDER BY clearing_event_pk DESC LIMIT 1', array($uploadTreeId, $licenseId), __METHOD__ . 'beforeReportinfo');
     assertThat($rowPast['comment'], equalTo($changeCom));
     $this->clearingDao->updateClearingEvent($uploadTreeId, $userId, $groupId, $licenseId, $what = 'reportinfo', $changeRep = 'def456');
     $rowFuture = $this->dbManager->getSingleRow('SELECT * FROM clearing_event WHERE uploadtree_fk=$1 AND rf_fk=$2 ORDER BY clearing_event_pk DESC LIMIT 1', array($uploadTreeId, $licenseId), __METHOD__ . 'afterReportinfo');
     assertThat($rowFuture['comment'], equalTo($changeCom));
     assertThat($rowFuture['reportinfo'], equalTo($changeRep));
 }
Example #7
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');
 }