function testVerifyFossology()
 {
     global $URL;
     global $name;
     global $safeName;
     print "starting verifyFossDirsOnly test\n";
     $page = $this->mybrowser->clickLink('Browse');
     $this->assertTrue($this->myassertText($page, '/Browse/'), "verifyFossDirsOnly FAILED! Could not find Browse menu\n");
     //print "************ Page after upload link *************\n$page\n";
     $this->assertTrue($this->myassertText($page, "/{$safeName}/"), "verifyFossDirsOnly FAILED! did not find {$name}\n");
     $this->assertTrue($this->myassertText($page, "/>View</"), "verifyFossDirsOnly FAILED! >View< not found\n");
     $this->assertTrue($this->myassertText($page, "/>Meta</"), "verifyFossDirsOnly FAILED! >Meta< not found\n");
     $this->assertTrue($this->myassertText($page, "/>Download</"), "verifyFossDirsOnly FAILED! >Download< not found\n");
     /* Select archive */
     $page = $this->mybrowser->clickLink($name);
     //print "************ Page after select foss archive *************\n$page\n";
     $this->assertTrue($this->myassertText($page, "/empty\\//"), "verifyFossDirsOnly FAILED! 'empty/' not found\n");
     $this->assertTrue($this->myassertText($page, "/1 item/"), "verifyFossDirsOnly FAILED! '1 item' not found\n");
     /* Select empty link */
     $page = $this->mybrowser->clickLink('empty/');
     /* need to check that there are 9 items */
     $this->assertTrue($this->myassertText($page, "/9 items/"), "verifyFossDirsOnly FAILED! '9 items' not found\n");
     $this->assertTrue($this->myassertText($page, "/agents/"), "verifyFossDirsOnly FAILED! did not find 'agents' directory\n");
     $this->assertTrue($this->myassertText($page, "/scheduler/"), "verifyFossDirsOnly FAILED! did not find scheduler directory\n");
     /* Select the License link to View License Historgram */
     $browse = new parseBrowseMenu($page);
     $mini = new parseMiniMenu($page);
     $miniMenu = $mini->parseMiniMenu();
     $url = makeUrl($this->host, $miniMenu['License']);
     if ($url === NULL) {
         $this->fail("verifyFossDirsOnly Failed, host is not set");
     }
     $page = $this->mybrowser->get($url);
     //print "page after get of $url is:\n$page\n";
     $this->assertTrue($this->myassertText($page, '/License Browser/'), "verifyFossDirsOnly FAILED! License Browser Title not found\n");
     $this->assertTrue($this->myassertText($page, '/Total licenses: 0/'), "verifyFossDirsOnly FAILED! Total Licenses does not equal 0\n");
     $dList = new parseLicenseTblDirs($page);
     $dirList = $dList->parseLicenseTblDirs();
     //print "dirList is:\n"; print_r($dirList) . "\n";
     /*
      * the directiory agents has 13 subdirectories all other directories
      * are empty. we are going to loop through them, but for now just
      * test a few of them out....
      */
     $url = makeUrl($this->host, $dirList['scheduler/']);
     $page = $this->mybrowser->get($url);
     //print "page after scheduler is:\n$page\n";
     $fList = new parseFolderPath($page, $url);
     $dirCnt = $fList->countFiles();
     // should only get one folder path)
     $this->assertEqual((int) $dirCnt, 1, "verifyFossDirsOnly FAILED! did not get 1 folder path back, got {$dirCnt} instead\n");
     // every entry but the last must have a non-null value (we assume parse
     // routine worked)
     $fpaths = $fList->parseFolderPath();
     $this->assertTrue($this->check4Links($fpaths), "verifyFossDirsOnly FAILED! something wrong with folder path\n" . "See this url:\n{$url}\n");
 }
 function testVerifyFossology()
 {
     global $URL;
     global $name;
     global $safeName;
     $licenseSummary = array('Unique licenses' => 1, 'Licenses found' => 1, 'Files with no licenses' => 0, 'Files' => 1);
     print "starting VerifyFoss23D1F1L test\n";
     $page = $this->mybrowser->clickLink('Browse');
     $this->assertTrue($this->myassertText($page, '/Browse/'), "verify23D1F1L FAILED! Could not find Browse menu\n");
     $page = $this->mybrowser->clickLink('Testing');
     //print "************ Page after upload link *************\n$page\n";
     $this->assertTrue($this->myassertText($page, "/Browse/"), "verify23D1F1L FAILED! Browse Title not found\n");
     $this->assertTrue($this->myassertText($page, "/{$safeName}/"), "verify23D1F1L FAILED! did not find {$name}\n");
     $this->assertTrue($this->myassertText($page, "/>View</"), "verifyfoss23D1F1L FAILED! >View< not found\n");
     $this->assertTrue($this->myassertText($page, "/>Info</"), "verifyFoss23D1F1L FAILED! >Info< not found\n");
     $this->assertTrue($this->myassertText($page, "/>Download</"), "verifyFoss23D1F1L FAILED! >Download< not found\n");
     /* Select archive */
     $page = $this->mybrowser->clickLink($name);
     //print "************ Page after select foss archive *************\n$page\n";
     $this->assertTrue($this->myassertText($page, "/foss23Dirs1File1Lic\\//"), "verifyfoss23D1F1L FAILED! 'foss23Dirs1File1Lic/' not found\n");
     $this->assertTrue($this->myassertText($page, "/1 item/"), "verifyfoss23D1F1L FAILED! '1 item' not found\n");
     /* Select fossology link */
     $page = $this->mybrowser->clickLink('foss23Dirs1File1Lic/');
     /* need to check that there are 9 items */
     $this->assertTrue($this->myassertText($page, "/9 items/"), "verifyfoss23D1F1L FAILED! '9 items' not found\n");
     $this->assertTrue($this->myassertText($page, "/agents/"), "verify23D1F1L FAILED! did not find 'agents' directory\n");
     $this->assertTrue($this->myassertText($page, "/scheduler/"), "verify23D1F1L FAILED! did not find scheduler directory\n");
     /* Select the License link to View License Historgram */
     $mini = new parseMiniMenu($page);
     $miniMenu = $mini->parseMiniMenu();
     $url = makeUrl($this->host, $miniMenu['Nomos License']);
     if ($url === NULL) {
         $this->fail("verify23D1F1L Failed, host is not set");
     }
     $page = $this->mybrowser->get($url);
     //print "page after get of $url is:\n$page\n";
     $this->assertTrue($this->myassertText($page, '/Nomos License Browser/'), "verify23D1F1L FAILED! License Browser Title not found\n");
     // verify license summaries
     $licSummary = new domParseLicenseTbl($page, 'licsummary', 0);
     $licSummary->parseLicenseTbl();
     foreach ($licSummary->hList as $summary) {
         $key = $summary['textOrLink'];
         $this->assertEqual($licenseSummary[$key], $summary['count'], "verifyFossDirsOnly FAILED! {$key} does not equal {$licenseSummary[$key]},\n  \t\tgot {$summary['count']}\n");
         //print "summary is:\n";print_r($summary) . "\n";
     }
     // get the 'Show' links and License color links
     $licHisto = new domParseLicenseTbl($page, 'lichistogram');
     $licHisto->parseLicenseTbl();
     if (empty($licHisto->hList)) {
         $this->fail("FATAL! table with id=lichistogram was not found on\n\t\t\t\t\t\t\t\t\tthe page, nothing to process, stopping test\n");
         exit(1);
     }
     /* Select show  'GPL_v2', verify */
     $gplv2URL = makeUrl($this->host, $licHisto->hList[1]['showLink']);
     $page = $this->mybrowser->get($gplv2URL);
     $licFileList = new parseFolderPath($page, $URL);
     $tblList = $licFileList->parseFolderPath();
     $fileCnt = count($tblList);
     print "Checking the number of files based on 'GPL_v2'\n";
     $this->assertTrue($fileCnt == 1, "FAILURE! Should only have 1 file with a GPL_v2 license: " . "Testing/foss23D1F1L.bz2/foss23Dirs1File1Lic/cli/cp2foss.php, " . "got:{$fileCnt}\n");
 }
 function testVerifyFossI16L518()
 {
     global $URL;
     global $name;
     global $safeName;
     print "starting VerifyFossI16L518 test\n";
     $page = $this->mybrowser->clickLink('Browse');
     $this->assertTrue($this->myassertText($page, '/Browse/'), "verifyFossI16L518 FAILED! Could not find Browse menu\n");
     /* Testing folder */
     $page = $this->mybrowser->clickLink('Testing');
     //print "************ Page after upload link *************\n$page\n";
     $this->assertTrue($this->myassertText($page, "/Browse/"), "verifyFossI16L518 FAILED! Browse Title not found\n");
     $this->assertTrue($this->myassertText($page, "/{$safeName}/"), "verifyFossI16L518 FAILED! did not find {$name}\n");
     $this->assertTrue($this->myassertText($page, "/>View</"), "verifyFossI16L518 FAILED! >View< not found\n");
     $this->assertTrue($this->myassertText($page, "/>Meta</"), "verifyFossI16L518 FAILED! >Meta< not found\n");
     $this->assertTrue($this->myassertText($page, "/>Download</"), "verifyFossI16L518 FAILED! >Download< not found\n");
     /* Select archive */
     $page = $this->mybrowser->clickLink($name);
     //print "************ Page after select foss archive *************\n$page\n";
     $this->assertTrue($this->myassertText($page, "/fossology\\//"));
     /* Select fossology link */
     $page = $this->mybrowser->clickLink('fossology/');
     /* need to check that there are 16 items */
     /* check that all the [xxx] items add to 519 */
     $this->assertTrue($this->myassertText($page, "/Makefile/"));
     $this->assertTrue($this->myassertText($page, "/mkcheck\\.sh/"), "FAIL! did not find mkcheck.sh\n");
     $this->assertTrue($this->myassertText($page, "/>View</"), "FAIL! >View< not found\n");
     $this->assertTrue($this->myassertText($page, "/>Meta</"), "FAIL! >Meta< not found\n");
     $this->assertTrue($this->myassertText($page, "/>Download</"), "FAIL! >Download< not found\n");
     /* Select the License link to View License Historgram */
     $browse = new parseBrowseMenu($page);
     $mini = new parseMiniMenu($page);
     $miniMenu = $mini->parseMiniMenu();
     print "DEBUG: miniMenu is:\n";
     print_r($miniMenu) . "\n";
     $url = makeUrl($this->host, $miniMenu['License']);
     if ($url === NULL) {
         $this->fail("verifyFossI16L518 Failed, host is not set");
     }
     $page = $this->mybrowser->get($url);
     //print "page after get of $url is:\n$page\n";
     $this->assertTrue($this->myassertText($page, '/License Browser/'), "verifyFossI16L518 FAILED! License Browser Title not found\n");
     $this->assertTrue($this->myassertText($page, '/Total licenses: 518/'), "verifyFossI16L518 FAILED! Total Licenses does not equal 518\n");
     // get the 'Show' links and License color links
     $licTbl = new parseLicenseTbl($page);
     $licTable = $licTbl->parseLicenseTbl();
     /* FIX THIS Select show 'Public Domain, verify, select 'LGPL v2.1', verify */
     $pdURL = makeUrl($this->host, $licTable['Public Domain']);
     $lgplURL = makeUrl($this->host, $licTable['\'LGPL v2.1\'-style']);
     $page = $this->mybrowser->get($pdURL);
     $licFileList = new parseFolderPath($page, $URL);
     $fileCount = $licFileList->countFiles();
     print "Checking the number of files based on Public Domain\n";
     $this->assertEqual($fileCount, 4, "verifyFossI16L518 FAILED! Should be 4 files based on Public Domain got:{$fileCount}\n");
     $page = $this->mybrowser->get($lgplURL);
     $licFileList->setPage($page);
     $flist = $licFileList->countFiles();
     print "Checking the number of files based on LGPL v2.1-style\n";
     $this->assertEqual($flist, 16, "verifyFossI16L518 FAILED! Should be 16 files based on LGPL v2.1-style got:{$flist}\n");
 }
 function testVerifyFossology()
 {
     global $URL;
     global $name;
     global $safeName;
     print "starting VerifyFoss23D1F1L test\n";
     $page = $this->mybrowser->clickLink('Browse');
     $this->assertTrue($this->myassertText($page, '/Browse/'), "verify23D1F1L FAILED! Could not find Browse menu\n");
     $page = $this->mybrowser->clickLink('Testing');
     //print "************ Page after upload link *************\n$page\n";
     $this->assertTrue($this->myassertText($page, "/Browse/"), "verify23D1F1L FAILED! Browse Title not found\n");
     $this->assertTrue($this->myassertText($page, "/{$safeName}/"), "verify23D1F1L FAILED! did not find {$name}\n");
     $this->assertTrue($this->myassertText($page, "/>View</"), "verifyfoss23D1F1L FAILED! >View< not found\n");
     $this->assertTrue($this->myassertText($page, "/>Meta</"), "verifyFoss23D1F1L FAILED! >Meta< not found\n");
     $this->assertTrue($this->myassertText($page, "/>Download</"), "verifyFoss23D1F1L FAILED! >Download< not found\n");
     /* Select archive */
     $page = $this->mybrowser->clickLink($name);
     //print "************ Page after select foss archive *************\n$page\n";
     $this->assertTrue($this->myassertText($page, "/foss23Dirs1File1Lic\\//"), "verifyfoss23D1F1L FAILED! 'foss23Dirs1File1Lic/' not found\n");
     $this->assertTrue($this->myassertText($page, "/1 item/"), "verifyfoss23D1F1L FAILED! '1 item' not found\n");
     /* Select fossology link */
     $page = $this->mybrowser->clickLink('foss23Dirs1File1Lic/');
     /* need to check that there are 9 items */
     $this->assertTrue($this->myassertText($page, "/9 items/"), "verifyfoss23D1F1L FAILED! '9 items' not found\n");
     $this->assertTrue($this->myassertText($page, "/agents/"), "verify23D1F1L FAILED! did not find 'agents' directory\n");
     $this->assertTrue($this->myassertText($page, "/scheduler/"), "verify23D1F1L FAILED! did not find scheduler directory\n");
     /* Select the License link to View License Historgram */
     $browse = new parseBrowseMenu($page);
     $mini = new parseMiniMenu($page);
     $miniMenu = $mini->parseMiniMenu();
     $url = makeUrl($this->host, $miniMenu['License']);
     if ($url === NULL) {
         $this->fail("verify23D1F1L Failed, host is not set");
     }
     $page = $this->mybrowser->get($url);
     //print "page after get of $url is:\n$page\n";
     $this->assertTrue($this->myassertText($page, '/License Browser/'), "verify23D1F1L FAILED! License Browser Title not found\n");
     $this->assertTrue($this->myassertText($page, '/Total licenses: 2/'), "verify23D1F1L FAILED! Total Licenses does not equal 2\n");
     // get the 'Show' links and License color links
     $licTbl = new parseLicenseTbl($page);
     $licTable = $licTbl->parseLicenseTbl();
     //print "DB: licTable is:\n"; print_r($licTable) . "\n";
     /* Select show  'GPL v2-stype', verify */
     $gplv2URL = makeUrl($this->host, $licTable['\'GPL v2\'-style']);
     $page = $this->mybrowser->get($gplv2URL);
     $licFileList = new parseFolderPath($page, $URL);
     $tblList = $licFileList->parseFolderPath();
     $tableCnt = count($tblList);
     print "Checking the number of files based on 'GPL v2'-style\n";
     $this->assertEqual($tableCnt, 1);
 }