Revision b204adb9
[#1569] Correction des tests fictifs
Change-Id: Idb2ee4935192141bc969364e96f92891be086980
Reviewed-on: https://vigilo-dev.si.c-s.fr/review/2307
Reviewed-by: Francois POIROTTE <francois.poirotte@c-s.fr>
Tested-by: Francois POIROTTE <francois.poirotte@c-s.fr>
Vigilo/VigiloTestSoftware.php | ||
---|---|---|
24 | 24 |
|
25 | 25 |
public function addRelevantTestWith($softwareName) |
26 | 26 |
{ |
27 |
if (substr($softwareName, 0, 20) === "vigilo-test-process-")
|
|
27 |
if (strstr($softwareName, "vigilo-test"))
|
|
28 | 28 |
{ |
29 | 29 |
$functionArray=array("addCustomTest", array($softwareName)); |
30 | 30 |
} |
... | ... | |
37 | 37 |
|
38 | 38 |
protected function addCustomTest($softwareName) |
39 | 39 |
{ |
40 |
return new VigiloTest(substr($softwareName, 20)); |
|
40 |
$software_name = str_replace('vigilo-test-', '', $softwareName); |
|
41 |
$explode_software_name = explode('-', $software_name, 2); |
|
42 |
$args=array(); |
|
43 |
switch($explode_software_name[0]) |
|
44 |
{ |
|
45 |
case "process": $args[]=new VigiloArg('processname', $explode_software_name[1]); break; |
|
46 |
case "service": $args[]=new VigiloArg('svcname', $explode_software_name[1]); break; |
|
47 |
default: return; |
|
48 |
} |
|
49 |
|
|
50 |
return new VigiloTest(ucfirst($explode_software_name[0]), $args); |
|
41 | 51 |
} |
42 | 52 |
|
43 | 53 |
protected function addNTPTest() |
... | ... | |
128 | 138 |
return new VigiloTest('VigiloCorrelator',$args); |
129 | 139 |
} |
130 | 140 |
|
131 |
protected function TestService($computer, $service) |
|
141 |
protected function addTestService($computer, $service)
|
|
132 | 142 |
{ |
133 | 143 |
$args=array(); |
134 | 144 |
$args[]=new VigiloArg('svcname',$service); |
hook.php | ||
---|---|---|
76 | 76 |
unlink(implode(DIRECTORY_SEPARATOR, $dirs)); |
77 | 77 |
} |
78 | 78 |
|
79 |
public function manageComputerSoftwareVersion($computer_software_version) |
|
80 |
{ |
|
81 |
global $DB; |
|
82 |
$computer=new Computer(); |
|
83 |
$computer->getFromDB($computer_software_version->getField("computers_id")); |
|
84 |
$this->update($computer); |
|
85 |
} |
|
86 |
|
|
79 | 87 |
public function manageSoftwares($software) |
80 | 88 |
{ |
81 | 89 |
global $DB; |
setup.php | ||
---|---|---|
21 | 21 |
"Software" => array($hookObj,"manageSoftwares"), |
22 | 22 |
"Location" => array($hookObj,"updateGroups"), |
23 | 23 |
"Entity" => array($hookObj,"updateGroups"), |
24 |
"Computer_SoftwareVersion" => array($hookObj, "manageComputerSoftwareVersion"), |
|
24 | 25 |
"Manufacturer" => array($hookObj,"updateGroups")); |
25 | 26 |
$hooks['item_update'][$p] = array("Computer" => array($hookObj, "update"), |
26 | 27 |
"ComputerDisk" => array($hookObj,"manageDisks"), |
... | ... | |
33 | 34 |
"DeviceSoundCard" => array($hookObj,"manageNetworks"), |
34 | 35 |
"Software" => array($hookObj,"manageSoftwares"), |
35 | 36 |
"Location" => array($hookObj,"updateGroups"), |
37 |
"Computer_SoftwareVersion" => array($hookObj, "manageComputerSoftwareVersion"), |
|
36 | 38 |
"Entity" => array($hookObj,"updateGroups"), |
37 | 39 |
"Manufacturer" => array($hookObj,"updateGroups")); |
38 | 40 |
$hooks['item_purge'][$p] = array("Computer" => array($hookObj, "delete"), |
... | ... | |
46 | 48 |
"DeviceSoundCard" => array($hookObj,"manageNetworks"), |
47 | 49 |
"Software" => array($hookObj,"manageSoftwares"), |
48 | 50 |
"Location" => array($hookObj,"updateGroups"), |
51 |
"Computer_SoftwareVersion" => array($hookObj, "manageComputerSoftwareVersion"), |
|
49 | 52 |
"Entity" => array($hookObj,"updateGroups"), |
50 | 53 |
"Manufacturer" => array($hookObj,"updateGroups")); |
51 | 54 |
$hooks['item_delete'][$p] = array("Computer" => array($hookObj, "delete"), |
... | ... | |
59 | 62 |
"DeviceSoundCard" => array($hookObj,"manageNetworks"), |
60 | 63 |
"Software" => array($hookObj,"manageSoftwares"), |
61 | 64 |
"Location" => array($hookObj,"updateGroups"), |
65 |
"Computer_SoftwareVersion" => array($hookObj, "manageComputerSoftwareVersion"), |
|
62 | 66 |
"Entity" => array($hookObj,"updateGroups"), |
63 | 67 |
"Manufacturer" => array($hookObj,"updateGroups")); |
64 | 68 |
$hooks['item_restore'][$p] = array("Computer" => array($hookObj, "add"), |
... | ... | |
72 | 76 |
"DeviceSoundCard" => array($hookObj,"manageNetworks"), |
73 | 77 |
"Software" => array($hookObj,"manageSoftwares"), |
74 | 78 |
"Location" => array($hookObj,"updateGroups"), |
79 |
"Computer_SoftwareVersion" => array($hookObj, "manageComputerSoftwareVersion"), |
|
75 | 80 |
"Entity" => array($hookObj,"updateGroups"), |
76 | 81 |
"Manufacturer" => array($hookObj,"updateGroups")); |
77 | 82 |
$hooks["menu_toadd"][$p]['plugins'] = 'PluginVigiloMenu'; |
Also available in: Unified diff