FOSSology  4.4.0
Open Source License Compliance by Open Source Software
uplTestData.php
1 <?php
2 /*
3  SPDX-FileCopyrightText: © 2008 Hewlett-Packard Development Company, L.P.
4 
5  SPDX-License-Identifier: GPL-2.0-only
6 */
7 
22 require_once ('fossologyTestCase.php');
23 require_once ('TestEnvironment.php');
24 
25 global $URL;
26 global $PROXY;
27 
29 {
30  public $mybrowser;
31  public $webProxy;
32 
33  function setUp()
34  {
35  global $URL;
36  $this->Login();
37  }
38 
43  {
44  global $URL;
45  print "Creating Testing folder\n";
46  $page = $this->mybrowser->get($URL);
47  $this->createFolder(null, 'Testing', null);
48 
49  print "Creating Copyright folder\n";
50  $this->createFolder(null, 'Copyright', null);
51  }
52 
53  function testuploadTestDataTest() {
54 
55  global $URL;
56  global $PROXY;
57 
58  print "starting testUploadTestData\n";
59  $rootFolder = 1;
60  $upload = NULL;
61  $uploadList = array('TestData/archives/fossI16L335U29.tar.bz2',
62  'TestData/archives/foss23D1F1L.tar.bz2',
63  'TestData/licenses/gplv2.1',
64  'TestData/licenses/Affero-v1.0',
65  'nomos/testdata/zend-license',
66  'nomos/testdata/RedHat.tar.gz');
67 
68  $urlList = array('http://downloads.sourceforge.net/simpletest/simpletest_1.0.1.tar.gz',
69  'http://www.gnu.org/licenses/gpl-3.0.txt',
70  'http://www.gnu.org/licenses/agpl-3.0.txt',
71  'http://fossology.org/testing/testFiles/fossDirsOnly.tar.bz2');
72 
73  /* upload the archives using the upload from file menu
74  *
75  * 1 = bucket agent
76  * 2 = copyright agent
77  * 3 = mime agent
78  * 4 = metadata agent
79  * 5 = nomos agent
80  * 6 = package agent
81  */
82 
83  print "Starting file uploads\n";
84  foreach($uploadList as $upload) {
85  $description = "File $upload uploaded by Upload Test Data Test";
86  $this->uploadFile('Testing', $upload, $description, null, '1,2,3,4');
87  }
88 
89  /* Upload the urls using upload from url. Check if the user specificed a
90  * web proxy for the environment. If so, set the attribute. */
91 
92  if(!(empty($PROXY)))
93  {
94  $this->webProxy = $PROXY;
95  }
96  print "Starting Url uploads\n";
97  echo "Using Proxy:$this->webProxy\n";
98  foreach($urlList as $url)
99  {
100  $this->uploadUrl($rootFolder, $url, null, null, '1,2,4,5');
101  }
102  }
103 }
uploadUrl($parentFolder, $url, $description=null, $uploadName=null, $agents=null)
uploadFile($parentFolder, $uploadFile, $description=null, $uploadName=null, $agents=null)
createFolder($parent, $name, $description=null)
Login($User=NULL, $Password=NULL)