FOSSology  3.2.0rc1
Open Source License Compliance by Open Source Software
uplTestData.php
1 <?php
2 /***********************************************************
3  Copyright (C) 2008 Hewlett-Packard Development Company, L.P.
4 
5  This program is free software; you can redistribute it and/or
6  modify it under the terms of the GNU General Public License
7  version 2 as published by the Free Software Foundation.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License along
15  with this program; if not, write to the Free Software Foundation, Inc.,
16  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17  ***********************************************************/
18 
33 require_once ('fossologyTestCase.php');
34 require_once ('TestEnvironment.php');
35 
36 global $URL;
37 global $PROXY;
38 
40 {
41  public $mybrowser;
42  public $webProxy;
43 
44  function setUp()
45  {
46  global $URL;
47  $this->Login();
48  }
49 
54  {
55  global $URL;
56  print "Creating Testing folder\n";
57  $page = $this->mybrowser->get($URL);
58  $this->createFolder(null, 'Testing', null);
59 
60  print "Creating Copyright folder\n";
61  $this->createFolder(null, 'Copyright', null);
62  }
63 
64  function testuploadTestDataTest() {
65 
66  global $URL;
67  global $PROXY;
68 
69  print "starting testUploadTestData\n";
70  $rootFolder = 1;
71  $upload = NULL;
72  $uploadList = array('TestData/archives/fossI16L335U29.tar.bz2',
73  'TestData/archives/foss23D1F1L.tar.bz2',
74  'TestData/licenses/gplv2.1',
75  'TestData/licenses/Affero-v1.0',
76  'nomos/testdata/zend-license',
77  'nomos/testdata/RedHat.tar.gz');
78 
79  $urlList = array('http://downloads.sourceforge.net/simpletest/simpletest_1.0.1.tar.gz',
80  'http://www.gnu.org/licenses/gpl-3.0.txt',
81  'http://www.gnu.org/licenses/agpl-3.0.txt',
82  'http://fossology.org/testing/testFiles/fossDirsOnly.tar.bz2');
83 
84  /* upload the archives using the upload from file menu
85  *
86  * 1 = bucket agent
87  * 2 = copyright agent
88  * 3 = mime agent
89  * 4 = metadata agent
90  * 5 = nomos agent
91  * 6 = package agent
92  */
93 
94  print "Starting file uploads\n";
95  foreach($uploadList as $upload) {
96  $description = "File $upload uploaded by Upload Test Data Test";
97  $this->uploadFile('Testing', $upload, $description, null, '1,2,3,4');
98  }
99 
100  /* Upload the urls using upload from url. Check if the user specificed a
101  * web proxy for the environment. If so, set the attribute. */
102 
103  if(!(empty($PROXY)))
104  {
105  $this->webProxy = $PROXY;
106  }
107  print "Starting Url uploads\n";
108  echo "Using Proxy:$this->webProxy\n";
109  foreach($urlList as $url)
110  {
111  $this->uploadUrl($rootFolder, $url, null, null, '1,2,4,5');
112  }
113  }
114 }
115 ?>
createFolder($parent=null, $name, $description=null)
uploadFile($parentFolder, $uploadFile, $description=null, $uploadName=null, $agents=null)
uploadUrl($parentFolder=1, $url, $description=null, $uploadName=null, $agents=null)
Login($User=NULL, $Password=NULL)