コード例 #1
0
 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");
 }
コード例 #2
0
 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");
 }