FOSSology  4.4.0
Open Source License Compliance by Open Source Software
fossologyTestCase.php
1 <?php
2 /*
3  SPDX-FileCopyrightText: © 2008 Hewlett-Packard Development Company, L.P.
4 
5  SPDX-License-Identifier: GPL-2.0-only
6 */
19 require_once ('TestEnvironment.php');
20 require_once ('fossologyTest.php');
21 
32 {
33  public $mybrowser;
34  public $debug;
35  public $webProxy;
36 
53  public function addUser($UserName, $Description = NULL, $Email = NULL, $Access = 1, $Folder = 1, $Password = NULL, $EmailNotify = 'y')
54  {
55 
56  global $URL;
57 
58  // check user name, everything else defaults (not a good idea to use defaults)
59  if (empty ($UserName))
60  {
61  return ("No User Name, cannot add user");
62  }
63 
64  $page = $this->mybrowser->get($URL);
65  $page = $this->mybrowser->clickLink('Add');
66  $this->assertTrue($this->myassertText($page, '/Add A User/'), "Did NOT find Title, 'Add A User'");
67 
68  $this->setUserFields($UserName, $Description, $Email, $Access, $Folder, NULL, NULL, $Password, $EmailNotify);
69 
70  /* fields set, add the user */
71  $page = $this->mybrowser->clickSubmit('Add!', "Could not select the Add! button");
72  $this->assertTrue($page);
73  //print "<pre>page after clicking Add!\n"; print_r($page) . "\n</pre>";
74  if ($this->myassertText($page, "/User .*? added/"))
75  {
76  return (NULL);
77  } else
78  if ($this->myassertText($page, "/User already exists\. Not added/"))
79  {
80  return ('User already exists. Not added');
81  } else
82  if ($this->myassertText($page, "/ERROR/"))
83  {
84  return ("addUser FAILED! ERROR when adding users, please investigate");
85  }
86  return (NULL);
87  } // addUser
88 
106  public function checkEmailNotification($number)
107  {
108 
109  if (empty ($number))
110  {
111  return (array (
112  0,
113  'ERROR! Must supply a number to verify'
114  ));
115  }
116 
117  $headers = getMailSubjects();
118  if (empty ($headers))
119  {
120  //print "No messages found\n";
121  $this->pass();
122  return (NULL);
123  }
124  //print "Got back from getMailSubjects:\n";print_r($headers) . "\n";
125 
126  /*
127  check for errors
128  */
132  if (preg_match('/ERROR/', $headers[0], $matches))
133  {
134  $this->fail("{$headers[0]}\n");
135  return (FALSE);
136  }
137  $pattern = 'completed with no errors';
138 
139  $failed = array ();
140  foreach ($headers as $header)
141  {
142  /* Make sure all say completed */
143  $match = preg_match("/$pattern/", $header, $matches);
144  if ($match == 0)
145  {
146  $failed[] = $header;
147  }
148  }
149  if (!empty ($failed))
150  {
151  $this->fail("Failures! there were jobs that did not report as completed\n");
152  //foreach($failed as $fail) {
153  // print "$fail\n";
154  return ($failed);
155  }
156  }
157 
176  public function createFolder($parent, $name, $description = null)
177  {
178 
179  global $URL;
180  $FolderId = 0;
181 
182  /* Need to check parameters */
183  if (is_null($parent))
184  {
185  $FolderId = 1; // default is root folder
186  }
187  if (is_null($description))
188  { // set default if null
189  $description = "Folder $name created by createFolder as subfolder of $parent";
190  }
191  if(empty($name))
192  {
193  $this->fail("FATAL! No folder name supplied, cannot create folder\n");
194  }
195  $page = $this->mybrowser->get($URL);
196  // There is only 1 create menu, so just select it
197  // No need to make sure we are in folders menu.
198  $page = $this->mybrowser->clickLink('Create');
199  $this->assertTrue($this->myassertText($page, '/Create a new Fossology folder/'));
200  /* if $FolderId=0 select the folder to create this folder under */
201  if (!$FolderId)
202  {
203  $FolderId = $this->getFolderId($parent, $page, 'parentid');
204  }
205  $this->assertTrue($this->mybrowser->setField('parentid', $FolderId));
206  $this->assertTrue($this->mybrowser->setField('newname', $name),
207  "FATAL! Could not set newname for folder:$name\n");
208  $this->assertTrue($this->mybrowser->setField('description', "$description"),
209  "FATAL! Could not set description for folder:$name\n");
210  $createdPage = $this->mybrowser->clickSubmit('Create!');
211  $this->assertTrue($createdPage);
212  if ($this->myassertText($createdPage, "/Folder $name Created/"))
213  {
214  $folderId = $this->getFolderId($name, $createdPage, 'parentid');
215  return ($folderId);
216  }
217  if ($this->myassertText($createdPage, "/Folder $name Exists/"))
218  {
219  $folderId = $this->getFolderId($name, $createdPage, 'parentid');
220  return ($folderId);
221  }
222  else
223  {
224  $this->fail("Failure! Did not find phrase 'Folder $name Created'\n");
225  }
226  }
227 
242  public function deleteFolder($folder)
243  {
244  global $URL;
245 
246  $page = $this->mybrowser->get($URL);
247  $page = $this->mybrowser->clickLink('Delete Folder');
248  $this->assertTrue($this->myassertText($page, '/Select the folder to delete/'));
249  $FolderId = $this->getFolderId($folder, $page, 'folder');
250  if (empty ($FolderId)) // not in the list of folders
251  {
252  return (true);
253  }
254  $this->assertTrue($this->mybrowser->setField('folder', $FolderId));
255  $page = $this->mybrowser->clickSubmit('Delete!');
256  $this->assertTrue($page);
257  $this->assertTrue($this->myassertText($page, "/Deletion of folder $folder added to job queue/"), "delete Folder Failed!\nPhrase 'Deletion of folder $folder added to job queue' not found\n");
258  }
259 
274  public function deleteUpload($upload)
275  {
276  global $URL;
277 
278  $page = $this->mybrowser->get($URL);
279  $page = $this->mybrowser->clickLink('Delete Uploaded File');
280  $this->assertTrue($this->myassertText($page, '/Select the uploaded file to delete/'));
281  $UploadId = $this->getUploadId($upload, $page, 'upload');
282  if (empty ($UploadId)) // not in the list of uploads on the root page
283  {
284  return (FALSE);
285  }
286  $this->assertTrue($this->mybrowser->setField('upload', $UploadId));
287  $page = $this->mybrowser->clickSubmit('Delete!');
288  $this->assertTrue($page);
289  $this->assertTrue($this->myassertText($page, "/Deletion added to job queue/"), "delete Upload Failed!\nPhrase 'Deletion added to job queue' not found\n");
290  }
291 
298  public function deleteUser($User)
299  {
300 
301  global $URL;
302 
303  if (empty ($User))
304  {
305  return ('No User Specified');
306  }
307  // Should already be logged in... no need to call this: $this->Login();
308  $page = $this->mybrowser->get("$URL?mod=user_del");
309  /* Get the user id */
310  $select = $this->parseSelectStmnt($page, 'userid', $User);
311  if (!is_null($select))
312  {
313  $this->assertTrue($this->mybrowser->setField('userid', $select));
314  $this->assertTrue($this->mybrowser->setField('confirm', 1));
315  $page = $this->mybrowser->clickSubmit('Delete!', "Could not select the Delete! button");
316  $this->assertTrue($page);
317  if ($this->myassertText($page, "/User deleted/"))
318  {
319  print "User $User Deleted\n";
320  $this->pass();
321  } else
322  {
323  $this->fail("Delete User Failed!\nPhrase 'User deleted' not found\n");
324  }
325  }
326  } // Delete User
338  public function editFolder($folder, $newName, $description = null)
339  {
340  global $URL;
341 
342  /* Need to check parameters */
343  if (empty ($folder))
344  {
345  return (FALSE);
346  }
347  if (is_null($description)) // set default if null
348  {
349  $description = "Folder $newName edited by editFolder Test, this is the changed description";
350  }
351  $page = $this->mybrowser->get($URL);
352  $page = $this->mybrowser->clickLink('Edit Properties');
353  $this->assertTrue($this->myassertText($page, '/Edit Folder Properties/'));
354  $FolderId = $this->getFolderId($folder, $page, 'oldfolderid');
355  $this->assertTrue($this->mybrowser->setField('oldfolderid', $FolderId));
356  if (!(empty ($newName)))
357  {
358  $this->assertTrue($this->mybrowser->setField('newname', $newName));
359  }
360  $this->assertTrue($this->mybrowser->setField('newdesc', "$description"));
361  $page = $this->mybrowser->clickSubmit('Edit!');
362  $this->assertTrue($page);
363  $this->assertTrue($this->myassertText($page, "/Folder Properties changed/"), "editFolder Failed!\nPhrase 'Folder Properties changed' not found\n");
364  }
383  public function editUser($UserName, $Description = NULL, $Email = NULL, $Access = 1, $Folder = 1, $Block = NULL, $Blank = NULL, $Password = NULL, $EmailNotify = 'y')
384  {
385 
386  global $URL;
387 
388  // check user name, everything else defaults (not a good idea to use defaults)
389  if (empty ($UserName))
390  {
391  return ("No User Name, cannot add user");
392  }
393  $page = $this->mybrowser->get($URL);
394  $page = $this->mybrowser->clickLink('Edit Users');
395  $this->assertTrue($this->myassertText($page, '/Edit A User/'), "Did NOT find Title, 'Edit A User'");
396  $this->setUserFields($UserName, $Description, $Email, $Access, $Folder, NULL, NULL, $Password, $EmailNotify);
397 
398  /* fields set, edit the user */
399  $page = $this->mybrowser->clickSubmit('Edit!', "Could not select the Edit! button");
400  $this->assertTrue($page);
401  //print "<pre>page after clicking Add!\n"; print_r($page) . "\n</pre>";
402  if ($this->myassertText($page, "/User edited/"))
403  {
404  return (NULL);
405  }
406  return;
407  } // addUser
426  public function moveUpload($oldFolder, $destFolder, $upload)
427  {
428  global $URL;
429  print "mU: OF:$oldFolder DF:$destFolder U:$upload\n";
430  if (empty ($oldFolder))
431  {
432  return FALSE;
433  }
434  if (empty ($destFolder))
435  {
436  $destFolder = 'root'; // default is root folder
437  }
438  $page = $this->mybrowser->get($URL);
439  /* use the method below till you write a menu function */
440  $page = $this->mybrowser->get("$URL?mod=upload_move");
441  //$page = $this->mybrowser->clickLink('Move');
442  $this->assertTrue($this->myassertText($page, '/Move upload to different folder/'));
443  $oldFolderId = $this->getFolderId($oldFolder, $page, 'oldfolderid');
444  $this->assertTrue($this->mybrowser->setField('oldfolderid', $oldFolderId));
445  $uploadId = $this->getUploadId($upload, $page, 'uploadid');
446  if (empty ($uploadId))
447  {
448  $this->fail("moveUpload FAILED! could not find upload id for upload" .
449  "$upload\n is $upload in $oldFolder?\n");
450  }
451  $this->assertTrue($this->mybrowser->setField('uploadid', $uploadId));
452  $destFolderId = $this->getFolderId($destFolder, $page, 'targetfolderid');
453  $this->assertTrue($this->mybrowser->setField('targetfolderid', $destFolderId));
454  $page = $this->mybrowser->clickSubmit('Move!');
455  $this->assertTrue($page);
456  print "page after move is:\n$page\n";
457  $this->assertTrue($this->myassertText($page,
458  //"/Moved $upload from folder $oldFolder to folder $destFolder/"),
459  "/Moved $upload from folder /"), "moveUpload Failed!\nPhrase 'Move $upload from folder $oldFolder " .
460  "to folder $destFolder' not found\n");
461  }
462 
473  public function mvFolder($folder, $destination)
474  {
475  global $URL;
476  if (empty ($folder))
477  {
478  return (FALSE);
479  }
480  if (empty ($destination))
481  {
482  $destination = 1;
483  }
484  $page = $this->mybrowser->get($URL);
485  $page = $this->mybrowser->clickLink('Move');
486  $this->assertTrue($this->myassertText($page, '/Move Folder/'));
487  $FolderId = $this->getFolderId($folder, $page, 'oldfolderid');
488  $this->assertTrue($this->mybrowser->setField('oldfolderid', $FolderId));
489  if ($destination != 1)
490  {
491  $DfolderId = $this->getFolderId($destination, $page, 'targetfolderid');
492  }
493  $this->assertTrue($this->mybrowser->setField('targetfolderid', $DfolderId));
494  $page = $this->mybrowser->clickSubmit('Move!');
495  $this->assertTrue($page);
496  $this->assertTrue($this->myassertText($page, "/Moved folder $folder to folder $destination/"), "moveFolder Failed!\nPhrase 'Move folder $folder to folder ....' not found\n");
497  }
498 
509  public function fillGroupForm($groupName, $user)
510  {
511  global $URL;
512 
513  if (is_NULL($groupName))
514  {
515  $msg = "FATAL! no group name to set\n";
516  $this->fail($msg);
517  return ($msg);
518  }
519  if (is_NULL($user))
520  {
521  $msg = "FATAL! no user name to set\n";
522  $this->fail($msg);
523  return ($msg);
524  }
525  // make sure we are on the page
526  $page = $this->mybrowser->get("$URL?mod=group_manage");
527  $this->assertTrue($this->myassertText($page, '/Manage Group/'), "Did NOT find Title, 'Manage Group'");
528  $this->assertTrue($this->myassertText($page, '/Add a Group/'), "Did NOT find phrase, 'Add a Group'");
529 
530  // set the fields
531  $groupNotSet = 'FATAL! Could Not set the groupname field';
532  if (!empty ($groupName))
533  {
534  $this->assertTrue($this->mybrowser->setField('groupname', $groupName), $groupNotSet);
535  }
536  if (!empty ($user))
537  {
538  $userNotSet = 'FATAL! Could Not set the userid field in select';
539  $this->assertTrue($this->mybrowser->setField('userid', $user), $userNotSet);
540  //return($userNotSet);
541  }
542  return (NULL);
543  } //fillGroupForm
544 
563  protected function setUserFields($UserName = NULL, $Description = NULL,
564  $Email = NULL, $Access = 1, $Folder = 1, $Block = NULL, $Blank = NULL,
565  $Password = NULL, $EmailNotify = NULL, $BucketPool = 1, $Ui = 'simple')
566  {
567 
568  $FailStrings = NULL;
569  $simple = FALSE;
570  $original = FALSE;
571 
572  global $URL;
573 
574  if (strtoupper($UserName) == 'NULL')
575  {
576  $this->fail("setUserFields, FATAL! no user name to set\n");
577  }
578  if (strtoupper($Description) == 'NULL')
579  {
580  $Description = '';
581  }
582  if (strtoupper($Email) == 'NULL')
583  {
584  $Email = '';
585  }
586  if (strtoupper($Access) == 'NULL')
587  {
588  $Access = 1;
589  }
590  if (strtoupper($Folder) == 'NULL')
591  {
592  $Folder = 1;
593  }
594  if (strtoupper($Block) == 'NULL')
595  {
596  $Block = '';
597  }
598  if (strtoupper($Blank) == 'NULL')
599  {
600  $Blank = '';
601  }
602  if (strtoupper($Password) == 'NULL')
603  {
604  $Password = '';
605  }
606  if (strtoupper($EmailNotify) == 'NULL' || is_null($EmailNotify))
607  {
608  unset ($EmailNotify);
609  }
610  if ($BucketPool == NULL)
611  {
612  $BucketPool = 1; // default bucket pool
613  }
614  if (strcasecmp($Ui, 'simple'))
615  {
616  $simple = TRUE;
617  }
618  else if (strcasecmp($Ui, 'original'))
619  {
620  $orignal = TRUE;
621  }
622 
623  $page = $this->mybrowser->get($URL);
624  $page = $this->mybrowser->clickLink('Add');
625  $this->assertTrue($this->myassertText($page, '/Add A User/'),
626  "Did NOT find Title, 'Add A User'");
627 
628  if (!empty ($UserName))
629  {
630  $this->assertTrue($this->mybrowser->setField('username', $UserName),
631  "Could Not set the username field");
632  }
633  if (!empty ($Description))
634  {
635  $this->assertTrue($this->mybrowser->setField('description', $Description),
636  "Could Not set the description field");
637  }
638  if (!empty ($Email))
639  {
640  $this->assertTrue($this->mybrowser->setField('email', $Email),
641  "Could Not set the email field");
642  }
643  if (!empty ($Access))
644  {
645  $this->assertTrue($this->mybrowser->setField('permission', $Access),
646  "Could Not set the permission field");
647  } else
648  {
649  return ('FATAL: Access/permission is a required field');
650  }
651  if (!empty ($Folder))
652  {
653  $this->assertTrue($this->mybrowser->setField('folder', $Folder),
654  "Could Not set the folder Field");
655  }
656  if (!empty ($Block))
657  {
658  $this->assertTrue($this->mybrowser->setField('block', $Block),
659  "Could Not set the block Field");
660  }
661  if (!empty ($Blank))
662  {
663  $this->assertTrue($this->mybrowser->setField('blank', $Blank),
664  "Could Not set the blank Field");
665  }
666  if (!empty ($Password))
667  {
668  $this->assertTrue($this->mybrowser->setField('pass1', $Password),
669  "Could Not set the pass1 field");
670  $this->assertTrue($this->mybrowser->setField('pass2', $Password),
671  "Could Not set the pass2 field");
672  }
673  if (isset ($EmailNotify))
674  {
675  $this->assertTrue($this->mybrowser->setField('enote', TRUE),
676  "Could Not set the enote Field to non default value");
677  } else
678  {
679  $this->assertTrue($this->mybrowser->setField('enote', FALSE),
680  "Could Not set the enote Field");
681  }
682  if (!empty($BucketPool))
683  {
684  $this->assertTrue($this->mybrowser->setField('default_bucketpool_fk', $BucketPool),
685  "Could Not set the default bucketpool select");
686  }
687  if ($simple)
688  {
689  $this->assertTrue($this->mybrowser->setField('simple', 'checked'),
690  "Could Not set the simple check box");
691 
692  }
693  if($original)
694  {
695  $this->assertTrue($this->mybrowser->setField('original', 'checked'),
696  "Could Not set the original check box");
697  }
698  return (NULL);
699  } // setUserFields
700 
717  public function uploadFile($parentFolder, $uploadFile, $description = null, $uploadName = null, $agents = null)
718  {
719  global $URL;
720  /*
721  * check parameters:
722  * default parent folder is root folder
723  * no uploadfile return false
724  * description and upload name are optonal
725  * future: agents are optional
726  */
727  if (empty ($parentFolder))
728  {
729  $parentFolder = 1;
730  }
731  if (empty ($uploadFile))
732  {
733  return (FALSE);
734  }
735  if (is_null($description)) // set default if null
736  {
737  $description = "File $uploadFile uploaded by test UploadFileTest";
738  }
739  //print "starting uploadFile\n";
740  $loggedIn = $this->mybrowser->get($URL);
741  $this->assertTrue($this->myassertText($loggedIn, '/Upload/'));
742  $page = $this->mybrowser->get("$URL?mod=upload_file");
743  $this->assertTrue($this->myassertText($page, '/Upload a New File/'));
744  $this->assertTrue($this->myassertText($page, '/Select the file to upload:/'));
745  $FolderId = $this->getFolderId($parentFolder, $page, 'folder');
746  $this->assertTrue($this->mybrowser->setField('folder', $FolderId),
747  "uploadFile FAILED! could not set 'folder' field!\n");
748  $this->assertTrue($this->mybrowser->setField('getfile', "$uploadFile"),
749  "uploadFile FAILED! could not set 'getfile' field!\n");
750  $this->assertTrue($this->mybrowser->setField('description', "$description"),
751  "uploadFile FAILED! could not set 'description' field!\n");
752  /*
753  * the test will fail if name is set to null, so we special case it
754  * rather than just set it.
755  */
756  if (!(is_null($uploadName)))
757  {
758  $this->assertTrue($this->mybrowser->setField('name', "$uploadName"),
759  "uploadFile FAILED! could not set 'name' field!\n");
760  }
761  /*
762  * Select agents to run, we just pass on the parameter to setAgents,
763  * don't bother if null
764  */
765  if (!(is_null($agents)))
766  {
767  $this->setAgents($agents);
768  }
769  $page = $this->mybrowser->clickSubmit('Upload');
770  $this->assertTrue($page);
771  $this->assertTrue($this->myassertText($page, '/The file .*? has been uploaded/'), "FAILURE:Did not find the message 'The file .*? has been uploaded'\n");
772  } // uploadFile
793  public function uploadServer($parentFolder, $uploadPath, $description = null, $uploadName = null, $agents = null)
794  {
795  global $URL;
796  global $PROXY;
797  /*
798  * check parameters:
799  * default parent folder is root folder
800  * no uploadfile return false
801  * description and upload name are optonal
802  * future: agents are optional
803  */
804  if (empty ($parentFolder))
805  {
806  $parentFolder = 1;
807  }
808  if (empty ($uploadPath))
809  {
810  return (FALSE);
811  }
812  if (is_null($description)) // set default if null
813  {
814  $description = "File $uploadPath uploaded by test UploadAUrl";
815  }
816  //print "starting UploadAUrl\n";
817  $loggedIn = $this->mybrowser->get($URL);
818  $this->assertTrue($this->myassertText($loggedIn, '/Upload/'), "uploadURL FAILED! cannot file Upload menu, did we get a fossology page?\n");
819  $page = $this->mybrowser->clickLink("From Server");
820 
821  $this->assertTrue($this->myassertText($page, '/Upload from Server/'));
822  $this->assertTrue($this->myassertText($page, '/Select the directory or file\‍(s\‍) on the server to upload/'));
823  /* only look for the the folder id if it's not the root folder */
824  $folderId = $parentFolder;
825  if ($parentFolder != 1)
826  {
827  $folderId = $this->getFolderId($parentFolder, $page, 'folder');
828  }
829  $this->assertTrue($this->mybrowser->setField('folder', $folderId), "Count not set folder field\n");
830  $this->assertTrue($this->mybrowser->setField('sourcefiles', $uploadPath), "Count not set sourcefiles field\n");
831  $this->assertTrue($this->mybrowser->setField('description', "$description"), "Count not set description field\n");
832  /* Set the name field if an upload name was passed in. */
833  if (!is_null($uploadName))
834  {
835  $this->assertTrue($this->mybrowser->setField('name', $uploadName));
836  }
837  /* selects agents */
838  $rtn = $this->setAgents($agents);
839  if (!is_null($rtn))
840  {
841  $this->fail("FAIL: could not set agents in uploadServer test\n");
842  }
843  $page = $this->mybrowser->clickSubmit('Upload!');
844  $this->assertTrue($page);
845  $this->assertTrue($this->myassertText($page, '/The upload for .*? has been scheduled/'), "FAIL! did not see phrase The upload for .*? has been scheduled\n");
846  //print "************ page after Upload! *************\n$page\n";
847  } //uploadServer
848 
868  public function uploadUrl($parentFolder, $url, $description = null, $uploadName = null, $agents = null)
869  {
870  global $URL;
871  global $PROXY;
872  /*
873  * check parameters:
874  * default parent folder is root folder
875  * no uploadfile return false
876  * description and upload name are optonal
877  * future: agents are optional
878  */
879  if (empty ($parentFolder))
880  {
881  $parentFolder = 1;
882  }
883  if (empty ($url))
884  {
885  return (FALSE);
886  }
887  if (is_null($description)) // set default if null
888  {
889  $description = "File $url uploaded by test UploadAUrl";
890  }
891  //print "starting UploadAUrl\n";
892  $loggedIn = $this->mybrowser->get($URL);
893  $this->assertFalse($this->myassertText($loggedIn, '/Network Error/'), "uploadURL FAILED! there was a Newtwork Error (dns lookup?)\n");
894  $this->assertTrue($this->myassertText($loggedIn, '/Upload/'), "uploadURL FAILED! cannot file Upload menu, did we get a fossology page?\n");
895  $this->assertTrue($this->myassertText($loggedIn, '/From URL/'));
896  $page = $this->mybrowser->get("$URL?mod=upload_url");
897 
898  $this->assertTrue($this->myassertText($page, '/Upload from URL/'));
899  $this->assertTrue($this->myassertText($page, '/Enter the URL to the file/'));
900  /* only look for the the folder id if it's not the root folder */
901  $folderId = $parentFolder;
902  if ($parentFolder != 1)
903  {
904  $folderId = $this->getFolderId($parentFolder, $page, 'folder');
905  }
906  $this->assertTrue($this->mybrowser->setField('folder', $folderId));
907  $this->assertTrue($this->mybrowser->setField('geturl', $url));
908  $this->assertTrue($this->mybrowser->setField('description', "$description"));
909  /* Set the name field if an upload name was passed in. */
910  if (!(is_null($uploadName)))
911  {
912  $this->assertTrue($this->mybrowser->setField('name', $url));
913  }
914  /* selects agents using numbers 1,2,3 or names license, mime, pkgmetagetta */
915  $rtn = $this->setAgents($agents);
916  if (!is_null($rtn))
917  {
918  $this->fail("FAIL: could not set agents in uploadAFILE test\n");
919  }
920  $page = $this->mybrowser->clickSubmit('Upload!');
921  $this->assertTrue($page);
922  $this->assertTrue($this->myassertText($page, '/The upload .*? has been scheduled/'), "FAIL! did find phrase The upload .*? has been scheduled\n");
923  //print "************ page after Upload! *************\n$page\n";
924  } //uploadUrl
925 
943  public function wait4jobs()
944  {
945 
946  require_once ('testClasses/check4jobs.php');
947 
948  define("FiveMIN", "300");
949 
950  $Jq = new check4jobs();
951 
952  /* wait at most 2 hours for test jobs to finish */
953  $done = FALSE;
954  for ($i = 1; $i <= 24; $i++)
955  {
956  //print "DB:W4Q: checking Q...\n";
957  $number = $Jq->Check();
958  if ($number != 0)
959  {
960  //print "sleeping 10 min...\n";
961  sleep(FiveMIN);
962  } else
963  {
964  //print "$number jobs found in the Queue\n";
965  $done = TRUE;
966  break;
967  }
968  }
969  if ($done === FALSE)
970  {
971  print "{$argv[0]} waited for 2 hours and the jobs are still not done\n" .
972  "Please investigate\n";
973  return (FALSE);
974  }
975  if ($done === TRUE)
976  {
977  return (TRUE);
978  }
979  } // wait4jobs
980 
981  /* possible methods to add */
982  public function dbCheck()
983  {
984  return TRUE;
985  }
986 
987  public function jobsSummary()
988  {
989  return TRUE;
990  }
991  public function jobsDetail()
992  {
993  return TRUE;
994  }
995 
996  public function oneShotLicense()
997  {
998  return TRUE;
999  }
1000  public function rmLicAnalysis()
1001  {
1002  return TRUE;
1003  }
1004 }
addUser($UserName, $Description=NULL, $Email=NULL, $Access=1, $Folder=1, $Password=NULL, $EmailNotify='y')
fillGroupForm($groupName, $user)
moveUpload($oldFolder, $destFolder, $upload)
uploadServer($parentFolder, $uploadPath, $description=null, $uploadName=null, $agents=null)
setUserFields($UserName=NULL, $Description=NULL, $Email=NULL, $Access=1, $Folder=1, $Block=NULL, $Blank=NULL, $Password=NULL, $EmailNotify=NULL, $BucketPool=1, $Ui='simple')
mvFolder($folder, $destination)
uploadUrl($parentFolder, $url, $description=null, $uploadName=null, $agents=null)
editUser($UserName, $Description=NULL, $Email=NULL, $Access=1, $Folder=1, $Block=NULL, $Blank=NULL, $Password=NULL, $EmailNotify='y')
editFolder($folder, $newName, $description=null)
uploadFile($parentFolder, $uploadFile, $description=null, $uploadName=null, $agents=null)
createFolder($parent, $name, $description=null)
getUploadId($uploadName, $page, $selectName)
getFolderId($folderName, $page, $selectName)
parseSelectStmnt($page, $selectName, $optionText=NULL)
setAgents($agents=NULL)
FUNCTION char * strtoupper(char *s)
Helper function to upper case a string.
Definition: utils.c:39