public function testManageClientTest()
 {
     // set the repository for the project
     $project = new Project();
     $project->Id = 3;
     $project->Fill();
     $project->AddRepositories(array('git://fake/repo.git'), array(''), array(''), array(''));
     // submit a mock machine config xml
     $machineDescription = dirname(__FILE__) . '/data/camelot.cdash.xml';
     $result = $this->uploadfile($this->url . '/submit.php?sitename=camelot.kitware&systemname=Ubuntu32&submitinfo=1', $machineDescription);
     if ($this->findString($result, 'error') || $this->findString($result, 'Warning') || $this->findString($result, 'Notice')) {
         $this->assertEqual($result, "\n");
         return false;
     }
     // schedule a job for the machine
     $this->login();
     $this->connect($this->url . '/manageClient.php?projectid=3');
     $scriptContents = 'message("hello world")';
     $this->setField('clientscript', $scriptContents);
     $this->clickSubmitByName('submit');
     // get the site id
     $siteid = $this->get($this->url . '/submit.php?sitename=camelot.kitware&systemname=Ubuntu32&getsiteid=1');
     // wait a few seconds so that we know we are ahead of the schedule time
     sleep(5);
     // verify that we receive the correct script when we query for a job
     $content = $this->get($this->url . '/submit.php?getjob=1&siteid=' . $siteid);
     if (!$this->findString($content, 'message("hello world")')) {
         $this->fail('Wrong script was sent: expected hello world script but got: ' . $content . ' for siteid=' . $siteid);
         return false;
     }
     $this->pass('Passed');
     return 0;
 }
 public function testSetupRepositories()
 {
     $insight = new Project();
     $row = pdo_single_row_query("SELECT id FROM project where name='InsightExample'");
     $insight->Id = $row['id'];
     $insight->Fill();
     $insight->AddRepositories(array(':pserver:anoncvs@itk.org:/cvsroot/Insight'), array('anoncvs'), array(''), array(''));
     $insight->CTestTemplateScript = 'client testing works';
     $insight->Save();
     $pub = new Project();
     $row = pdo_single_row_query("SELECT id FROM project where name='PublicDashboard'");
     $pub->Id = $row['id'];
     $pub->Fill();
     $pub->AddRepositories(array('git://cmake.org/cmake.git'), array(''), array(''), array(''));
     $pub->CvsViewerType = 'gitweb';
     $pub->CvsUrl = 'cmake.org/gitweb?p=cmake.git';
     $pub->Save();
     $email = new Project();
     $row = pdo_single_row_query("SELECT id FROM project where name='EmailProjectExample'");
     $email->Id = $row['id'];
     $email->Fill();
     $email->AddRepositories(array('https://www.kitware.com/svn/CDash/trunk'), array(''), array(''), array(''));
     $pub->CvsViewerType = 'websvn';
     $email->CvsUrl = 'https://www.kitware.com/svn/CDash/trunk';
     $email->Save();
 }
Example #3
0
 $UserProject = new UserProject();
 $UserProject->Role = 2;
 $UserProject->EmailType = 3;
 // receive all emails
 $UserProject->ProjectId = $projectid;
 $User->Id = 1;
 // administrator
 $User->AddProject($UserProject);
 // Add current user to the project
 $User->Id = $userid;
 if ($userid != 1) {
     $User->Id = $userid;
     $User->AddProject($UserProject);
 }
 // Add the repositories
 $Project->AddRepositories($CVSRepositories, $CVSUsernames, $CVSPasswords, $CVSBranches);
 /** Add the logo if any */
 if (isset($_FILES['logo']) && strlen($_FILES['logo']['tmp_name']) > 0) {
     $handle = fopen($_FILES['logo']['tmp_name'], "r");
     $contents = 0;
     if ($handle) {
         $contents = addslashes(fread($handle, $_FILES['logo']['size']));
         $filetype = $_FILES['logo']['type'];
         fclose($handle);
         unset($handle);
     }
     if ($contents) {
         $imageId = $Project->AddLogo($contents, $filetype);
     }
     // end if contents
 }