Branch Coverage

blib/lib/Monitoring/Generator/TestConfig.pm
Criterion Covered Total %
branch 133 202 65.8


line true false branch
138 13 0 if (exists $self->{$opt_key}) { }
140 8 5 if (not defined $self->{$opt_key} and ref $options{$opt_key} eq '' and defined $options{$opt_key}) { }
5 0 elsif (ref $self->{$opt_key} eq ref $options{$opt_key}) { }
0 0 elsif (ref $options{$opt_key} eq 'Getopt::Long::CallBack') { }
158 2 3 unless (defined $self->{'layout'})
159 0 2 if (defined $ENV{'OMD_ROOT'}) { }
166 0 1 if ($self->{'layout'} ne 'nagios' and $self->{'layout'} ne 'icinga' and $self->{'layout'} ne 'shinken' and $self->{'layout'} ne 'omd')
171 0 5 if ($self->{'layout'} eq 'omd')
172 0 0 unless (defined $ENV{'OMD_ROOT'})
183 0 5 unless (defined $self->{'output_dir'})
190 0 5 if (-e $self->{'output_dir'} and not $self->{'overwrite_dir'})
196 0 5 if ($^O eq 'MSWin32') { }
206 5 0 unless defined $self->{'user'}
207 5 0 unless defined $self->{'group'}
210 5 0 if ($self->{'user'} eq 'root')
217 5 0 unless (defined $self->{'binary'})
219 3 2 if ($self->{'layout'} eq 'nagios') { }
1 1 elsif ($self->{'layout'} eq 'icinga') { }
1 0 elsif ($self->{'layout'} eq 'shinken') { }
230 4 1 unless (defined $self->{'binary'})
232 0 21 if (-x $loc)
240 4 1 unless (defined $self->{'binary'})
269 0 1 unless (-d $self->{'output_dir'} . '/.')
270 0 0 unless mkdir $self->{'output_dir'}
274 1 0 unless ($self->{'layout'} eq 'omd')
276 0 1 unless open my $fh, '>', $self->{'output_dir'} . '/' . $mainconfigfilename
282 1 0 unless ($self->{'layout'} eq 'omd')
284 8 0 unless (-d $self->{'output_dir'} . '/' . $dir)
286 0 8 unless mkdir $self->{'output_dir'} . '/' . $dir
303 0 1 if ($self->{'layout'} eq 'omd')
320 1 0 if ($self->{'layout'} ne 'omd')
325 1 0 if ($self->{'layout'} eq 'nagios' or $self->{'layout'} eq 'icinga')
335 0 1 if ($self->{'layout'} eq 'shinken')
349 1 0 unless ($self->{'skip_dependencys'})
355 0 1 unless (-d $self->{'output_dir'} . '/' . $obj_prefix)
356 0 0 unless mkdir $self->{'output_dir'} . '/' . $obj_prefix
360 0 14 unless open my $fh, '>', $self->{'output_dir'} . $exportFile->{'file'}
365 0 1 unless chmod 0755, $self->{'output_dir'} . $plg_prefix . '/test_servicecheck.pl'
366 0 1 unless chmod 0755, $self->{'output_dir'} . $plg_prefix . '/test_hostcheck.pl'
372 1 0 if ($^O ne 'MSWin32' and $< == 0)
376 0 1 if ($self->{'layout'} eq 'omd') { }
393 1 0 unless defined $objects->{'host'}
419 1 0 if ($self->{'routercount'} > 0)
438 1 4 if $type eq 'pending'
441 1 4 if ($x == 0)
447 1 4 if ($x == 1)
451 1 4 if ($x == 2)
461 0 5 if scalar @contacts > 0
468 5 0 if scalar @contactgroups > 0
481 2 8 if $x % 5 == 1
482 2 8 if $x % 5 == 2
483 2 8 if $x % 5 == 3
484 2 8 if $x % 5 == 4
497 9 1 if (defined $router[$cur_router])
501 1 9 if $type eq 'pending'
508 0 10 if scalar @contacts > 0
515 10 0 if scalar @contactgroups > 0
529 1 0 unless defined $objects->{'hostgroup'}
551 1 0 unless defined $objects->{'service'}
590 20 80 if $y % 5 == 1
591 20 80 if $y % 5 == 2
592 20 80 if $y % 5 == 3
593 20 80 if $y % 5 == 4
604 5 95 if $type eq 'pending'
607 10 90 if ($y == 0)
614 10 90 if ($y == 1)
618 10 90 if ($y == 2)
628 0 100 if scalar @contacts > 0
635 100 0 if scalar @contactgroups > 0
650 1 0 unless defined $objects->{'servicegroup'}
674 1 0 unless defined $objects->{'servicedependency'}
680 0 20 unless defined $dependent->{'host_name'}
681 0 20 unless defined $master->{'host_name'}
700 1 0 unless defined $objects->{'contact'}
721 1 0 unless defined $objects->{'contactgroup'}
747 0 1 if ($self->{'layout'} eq 'omd')
751 1 0 unless defined $objects->{'command'}
766 0 1 defined $self->{'hostcheckcmd'} ? :
0 1 defined $self->{'hostcheckcmd'} ? :
0 1 defined $self->{'servicecheckcmd'} ? :
777 1 0 unless defined $objects->{'timeperiod'}
905 0 1 if $self->{'hostcount'} * $self->{'services_per_host'} > 2000
939 1 107 if (ref $value eq 'ARRAY') { }
959 0 9 unless defined $objects
981 7 109 if $i == $j
1006 0 3 if (scalar @types < $count)
1039 32 1973 if $a eq 'dependent_service_description'
1040 29 1944 if $a eq 'dependent_host_name'
1041 6 1938 if $a eq 'name'
1042 293 1645 if $a =~ /_name$/mx
1043 249 1396 if $a =~ /_description$/mx
1044 218 1178 if $a eq 'use'
1046 4 1174 if $b eq 'dependent_service_description'
1047 13 1161 if $b eq 'dependent_host_name'
1048 3 1158 if $b eq 'name'
1049 121 1037 if $b =~ /_name$/mx
1050 71 966 if $b =~ /_description$/mx
1051 97 869 if $b eq 'use'
1060 1 0 unless -r $file
1061 0 0 unless open my $fh, '<', $file
1063 0 0 unless $line =~ /^\s*use\s+lib\s+/gmx