Branch Coverage

blib/lib/Monitoring/Generator/TestConfig.pm
Criterion Covered Total %
branch 137 212 64.6


line true false branch
142 13 0 if (exists $self->{$opt_key}) { }
144 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') { }
162 2 3 unless (defined $self->{'layout'})
163 0 2 if (defined $ENV{'OMD_ROOT'}) { }
170 0 1 if ($self->{'layout'} ne 'nagios' and $self->{'layout'} ne 'icinga' and $self->{'layout'} ne 'shinken' and $self->{'layout'} ne 'omd')
175 0 5 if ($self->{'layout'} eq 'omd')
176 0 0 unless (defined $ENV{'OMD_ROOT'})
187 0 5 unless (defined $self->{'output_dir'})
194 0 5 if (-e $self->{'output_dir'} and not $self->{'overwrite_dir'})
200 0 5 if ($^O eq 'MSWin32') { }
210 5 0 unless defined $self->{'user'}
211 5 0 unless defined $self->{'group'}
214 5 0 if ($self->{'user'} eq 'root')
221 5 0 unless (defined $self->{'binary'})
223 3 2 if ($self->{'layout'} eq 'nagios') { }
1 1 elsif ($self->{'layout'} eq 'icinga') { }
1 0 elsif ($self->{'layout'} eq 'shinken') { }
234 4 1 unless (defined $self->{'binary'})
236 0 21 if (-x $loc)
244 4 1 unless (defined $self->{'binary'})
273 0 1 unless (-d $self->{'output_dir'} . '/.')
274 0 0 unless mkdir $self->{'output_dir'}
278 1 0 unless ($self->{'layout'} eq 'omd')
280 0 1 unless open my $fh, '>', $self->{'output_dir'} . '/' . $mainconfigfilename
286 1 0 unless ($self->{'layout'} eq 'omd')
288 8 0 unless (-d $self->{'output_dir'} . '/' . $dir)
290 0 8 unless mkdir $self->{'output_dir'} . '/' . $dir
300 1 0 unless $self->{'skip_hostgroups'}
302 1 0 unless $self->{'skip_servicegroups'}
307 0 1 if ($self->{'layout'} eq 'omd')
324 1 0 if ($self->{'layout'} ne 'omd')
329 1 0 if ($self->{'layout'} eq 'nagios' or $self->{'layout'} eq 'icinga')
339 0 1 if ($self->{'layout'} eq 'shinken')
353 1 0 unless ($self->{'skip_dependencies'})
359 0 1 unless (-d $self->{'output_dir'} . '/' . $obj_prefix)
360 0 0 unless mkdir $self->{'output_dir'} . '/' . $obj_prefix
364 0 14 unless open my $fh, '>', $self->{'output_dir'} . $exportFile->{'file'}
369 0 1 unless chmod 0755, $self->{'output_dir'} . $plg_prefix . '/test_servicecheck.pl'
370 0 1 unless chmod 0755, $self->{'output_dir'} . $plg_prefix . '/test_hostcheck.pl'
376 1 0 if ($^O ne 'MSWin32' and $< == 0)
380 0 1 if ($self->{'layout'} eq 'omd') { }
397 1 0 unless defined $objects->{'host'}
423 1 0 if ($self->{'routercount'} > 0)
442 0 5 if $type eq 'pending'
443 0 5 if $self->{'skip_hostgroups'}
446 1 4 if ($x == 0)
452 1 4 if ($x == 1)
456 1 4 if ($x == 2)
466 0 5 if scalar @contacts > 0
473 5 0 if scalar @contactgroups > 0
486 2 8 if $x % 5 == 1
487 2 8 if $x % 5 == 2
488 2 8 if $x % 5 == 3
489 2 8 if $x % 5 == 4
502 9 1 if (defined $router[$cur_router])
506 1 9 if $type eq 'pending'
507 0 10 if $self->{'skip_hostgroups'}
514 0 10 if scalar @contacts > 0
521 10 0 if scalar @contactgroups > 0
535 1 0 unless defined $objects->{'hostgroup'}
557 1 0 unless defined $objects->{'service'}
596 20 80 if $y % 5 == 1
597 20 80 if $y % 5 == 2
598 20 80 if $y % 5 == 3
599 20 80 if $y % 5 == 4
610 5 95 if $type eq 'pending'
611 0 100 if $self->{'skip_servicegroups'}
614 10 90 if ($y == 0)
621 10 90 if ($y == 1)
625 10 90 if ($y == 2)
635 0 100 if scalar @contacts > 0
642 100 0 if scalar @contactgroups > 0
657 1 0 unless defined $objects->{'servicegroup'}
681 1 0 unless defined $objects->{'servicedependency'}
687 0 20 unless defined $dependent->{'host_name'}
688 0 20 unless defined $master->{'host_name'}
707 1 0 unless defined $objects->{'contact'}
728 1 0 unless defined $objects->{'contactgroup'}
754 0 1 if ($self->{'layout'} eq 'omd')
758 1 0 unless defined $objects->{'command'}
773 0 1 defined $self->{'hostcheckcmd'} ? :
0 1 defined $self->{'hostcheckcmd'} ? :
0 1 defined $self->{'servicecheckcmd'} ? :
784 1 0 unless defined $objects->{'timeperiod'}
912 0 1 if $self->{'hostcount'} * $self->{'services_per_host'} > 2000
946 1 107 if (ref $value eq 'ARRAY') { }
966 0 9 unless defined $objects
988 8 108 if $i == $j
1013 0 3 if (scalar @types < $count)
1046 27 1896 if $a eq 'dependent_service_description'
1047 34 1862 if $a eq 'dependent_host_name'
1048 5 1857 if $a eq 'name'
1049 269 1588 if $a =~ /_name$/mx
1050 208 1380 if $a =~ /_description$/mx
1051 191 1189 if $a eq 'use'
1053 18 1171 if $b eq 'dependent_service_description'
1054 16 1155 if $b eq 'dependent_host_name'
1055 4 1151 if $b eq 'name'
1056 146 1005 if $b =~ /_name$/mx
1057 101 904 if $b =~ /_description$/mx
1058 115 789 if $b eq 'use'
1067 1 0 unless -r $file
1068 0 0 unless open my $fh, '<', $file
1070 0 0 unless $line =~ /^\s*use\s+lib\s+/gmx