Revision 077e4de7
Prise en compte conventions de codage
Change-Id: I74d6ea904e099519e7d2b08f0586696470514280
Reviewed-on: https://vigilo-dev.si.c-s.fr/review/2367
Tested-by: Build system <qa@vigilo-dev.si.c-s.fr>
Reviewed-by: Francois POIROTTE <francois.poirotte@c-s.fr>
src/Vigilo/VigiloTestSoftware.php | ||
---|---|---|
1 | 1 |
<?php |
2 | 2 |
|
3 |
include 'VigiloSoftwareList.php'; |
|
4 |
|
|
5 | 3 |
class VigiloTestSoftware |
6 | 4 |
{ |
7 | 5 |
protected $testTable; |
... | ... | |
24 | 22 |
|
25 | 23 |
public function addRelevantTestWith($softwareName) |
26 | 24 |
{ |
27 |
if (strstr($softwareName, "vigilo-test")) |
|
28 |
{ |
|
29 |
$functionArray=array("addCustomTest", array($softwareName)); |
|
30 |
} |
|
31 |
else |
|
32 |
{ |
|
25 |
if (strstr($softwareName, "vigilo-test")) { |
|
26 |
$functionArray = array("addCustomTest", array($softwareName)); |
|
27 |
} else { |
|
33 | 28 |
if (!array_key_exists($softwareName, $this->softwareBase)) { |
34 | 29 |
return; |
35 | 30 |
} |
36 |
$functionArray=$this->softwareBase[$softwareName];
|
|
31 |
$functionArray = $this->softwareBase[$softwareName];
|
|
37 | 32 |
} |
38 |
$this->testTable[]=call_user_func_array(array($this,$functionArray[0]), $functionArray[1]);
|
|
33 |
$this->testTable[] = call_user_func_array(array($this, $functionArray[0]), $functionArray[1]);
|
|
39 | 34 |
} |
40 | 35 |
|
41 | 36 |
protected function addCustomTest($softwareName) |
42 | 37 |
{ |
43 | 38 |
$software_name = str_replace('vigilo-test-', '', $softwareName); |
44 | 39 |
$explode_software_name = explode('-', $software_name, 2); |
45 |
$args=array();
|
|
46 |
switch(strtolower($explode_software_name[0])) |
|
47 |
{ |
|
40 |
$args = array();
|
|
41 |
|
|
42 |
switch (strtolower($explode_software_name[0])) {
|
|
48 | 43 |
case "process": |
49 |
$args[]=new VigiloArg('processname', $explode_software_name[1]);
|
|
44 |
$args[] = new VigiloArg('processname', $explode_software_name[1]);
|
|
50 | 45 |
$explode_software_name[0] = "Process"; |
51 | 46 |
break; |
47 |
|
|
52 | 48 |
case "service": |
53 |
$args[]=new VigiloArg('svcname', $explode_software_name[1]);
|
|
49 |
$args[] = new VigiloArg('svcname', $explode_software_name[1]);
|
|
54 | 50 |
$explode_software_name[0] = "Service"; |
55 | 51 |
break; |
52 |
|
|
56 | 53 |
case "tcp": |
57 |
$args[]=new VigiloArg('port', $explode_software_name[1]);
|
|
54 |
$args[] = new VigiloArg('port', $explode_software_name[1]);
|
|
58 | 55 |
$explode_software_name[0] = "TCP"; |
59 | 56 |
break; |
60 |
default: return; |
|
57 |
|
|
58 |
default: |
|
59 |
return; |
|
61 | 60 |
} |
62 | 61 |
|
63 | 62 |
return new VigiloTest($explode_software_name[0], $args); |
... | ... | |
65 | 64 |
|
66 | 65 |
protected function addNTPTest() |
67 | 66 |
{ |
68 |
$args=array();
|
|
67 |
$args = array();
|
|
69 | 68 |
//$address=0; |
70 |
//$args[]=new VigiloArg('address',$address);
|
|
71 |
$args[]=new VigiloArg('crit', 0);
|
|
72 |
$args[]=new VigiloArg('warn', 0);
|
|
69 |
//$args[] = new VigiloArg('address', $address);
|
|
70 |
$args[] = new VigiloArg('crit', 0);
|
|
71 |
$args[] = new VigiloArg('warn', 0);
|
|
73 | 72 |
return new VigiloTest('NTP', $args); |
74 | 73 |
} |
75 | 74 |
|
76 | 75 |
protected function addNTPqTest() |
77 | 76 |
{ |
78 | 77 |
$args=array(); |
79 |
$args[]=new VigiloArg('crit', 2000);
|
|
80 |
$args[]=new VigiloArg('warn', 5000);
|
|
78 |
$args[] = new VigiloArg('crit', 2000);
|
|
79 |
$args[] = new VigiloArg('warn', 5000);
|
|
81 | 80 |
return new VigiloTest('NTPq', $args); |
82 | 81 |
} |
83 | 82 |
|
... | ... | |
94 | 93 |
protected function addMemcachedTest($computer) |
95 | 94 |
{ |
96 | 95 |
$args=array(); |
97 |
$args[]=new VigiloArg('port', 11211);
|
|
96 |
$args[] = new VigiloArg('port', 11211);
|
|
98 | 97 |
return new VigiloTest('Memcached', $args); |
99 | 98 |
} |
100 | 99 |
|
... | ... | |
106 | 105 |
protected function addPGSQLTest($computer) |
107 | 106 |
{ |
108 | 107 |
$args=array(); |
109 |
$args[]=new VigiloArg('database',"postgres");
|
|
110 |
$args[]=new VigiloArg('port',5432);
|
|
111 |
$args[]=new VigiloArg('user',"postgres");
|
|
112 |
return new VigiloTest('PostgreSQLConnection',$args); |
|
108 |
$args[] = new VigiloArg('database', "postgres");
|
|
109 |
$args[] = new VigiloArg('port', 5432);
|
|
110 |
$args[] = new VigiloArg('user', "postgres");
|
|
111 |
return new VigiloTest('PostgreSQLConnection', $args);
|
|
113 | 112 |
} |
114 | 113 |
|
115 | 114 |
protected function addProxyTest() |
116 | 115 |
{ |
117 | 116 |
$args=array(); |
118 |
$args[]=new VigiloArg('auth',"False");
|
|
119 |
$args[]=new VigiloArg('port',8080);
|
|
120 |
$args[]=new VigiloArg('url',"http://www.google.fr");
|
|
121 |
return new VigiloTest('Proxy',$args); |
|
117 |
$args[] = new VigiloArg('auth', "False");
|
|
118 |
$args[] = new VigiloArg('port', 8080);
|
|
119 |
$args[] = new VigiloArg('url', "http://www.google.fr");
|
|
120 |
return new VigiloTest('Proxy', $args);
|
|
122 | 121 |
} |
123 | 122 |
|
124 | 123 |
protected function addRRDcachedTest($computer) |
125 | 124 |
{ |
126 | 125 |
$path="/var/lib/vigilo/connector-metro/rrdcached.sock"; |
127 | 126 |
$args=array(); |
128 |
$args[]=new VigiloArg('crit',0);
|
|
129 |
$args[]=new VigiloArg('path',$path);
|
|
130 |
$args[]=new VigiloArg('warn',0);
|
|
131 |
return new VigiloTest('RRDcached',$args); |
|
127 |
$args[] = new VigiloArg('crit', 0);
|
|
128 |
$args[] = new VigiloArg('path', $path);
|
|
129 |
$args[] = new VigiloArg('warn', 0);
|
|
130 |
return new VigiloTest('RRDcached', $args);
|
|
132 | 131 |
} |
133 | 132 |
|
134 | 133 |
protected function addSSHTest() |
... | ... | |
139 | 138 |
protected function addVigiloConnectorTest($type) |
140 | 139 |
{ |
141 | 140 |
$args=array(); |
142 |
$args[]=new VigiloArg('type', $type);
|
|
141 |
$args[] = new VigiloArg('type', $type);
|
|
143 | 142 |
return new VigiloTest('VigiloConnector', $args); |
144 | 143 |
} |
145 | 144 |
|
146 | 145 |
protected function addVigiloCorrelatorTest() |
147 | 146 |
{ |
148 | 147 |
$args=array(); |
149 |
//$args[]=new VigiloArg('rules','');
|
|
150 |
$args[]=new VigiloArg('servicename','vigilo-correlator');
|
|
151 |
return new VigiloTest('VigiloCorrelator',$args); |
|
148 |
//$args[] = new VigiloArg('rules', '');
|
|
149 |
$args[] = new VigiloArg('servicename', 'vigilo-correlator');
|
|
150 |
return new VigiloTest('VigiloCorrelator', $args);
|
|
152 | 151 |
} |
153 | 152 |
|
154 | 153 |
protected function addTestService($computer, $service) |
155 | 154 |
{ |
156 | 155 |
$args=array(); |
157 |
$args[]=new VigiloArg('svcname',$service);
|
|
158 |
return new VigiloTest('Service',$args); |
|
156 |
$args[] = new VigiloArg('svcname', $service);
|
|
157 |
return new VigiloTest('Service', $args);
|
|
159 | 158 |
} |
160 | 159 |
|
161 | 160 |
public function __toString() |
Also available in: Unified diff