Branch Coverage

blib/lib/Monitoring/Generator/TestConfig.pm
Criterion Covered Total %
branch 119 190 62.6


line true false branch
124 6 0 if (exists $self->{$opt_key}) { }
126 3 3 if (not defined $self->{$opt_key} and ref $options{$opt_key} eq '' and defined $options{$opt_key}) { }
3 0 elsif (ref $self->{$opt_key} eq ref $options{$opt_key}) { }
0 0 elsif (ref $options{$opt_key} eq 'Getopt::Long::CallBack') { }
144 3 0 unless (defined $self->{'layout'})
145 0 3 if (defined $ENV{'OMD_ROOT'}) { }
152 0 0 if ($self->{'layout'} ne 'nagios' and $self->{'layout'} ne 'icinga' and $self->{'layout'} ne 'shinken' and $self->{'layout'} ne 'omd')
157 0 3 if ($self->{'layout'} eq 'omd')
158 0 0 unless (defined $ENV{'OMD_ROOT'})
169 0 3 unless (defined $self->{'output_dir'})
176 0 3 if (-e $self->{'output_dir'} and not $self->{'overwrite_dir'})
182 0 3 if ($^O eq 'MSWin32') { }
192 3 0 unless defined $self->{'user'}
193 3 0 unless defined $self->{'group'}
196 3 0 if ($self->{'user'} eq 'root')
203 3 0 unless (defined $self->{'binary'})
205 3 0 if ($self->{'layout'} eq 'nagios') { }
0 0 elsif ($self->{'layout'} eq 'icinga') { }
0 0 elsif ($self->{'layout'} eq 'shinken') { }
216 3 0 unless (defined $self->{'binary'})
218 0 18 if (-x $loc)
226 3 0 unless (defined $self->{'binary'})
255 0 1 unless (-d $self->{'output_dir'} . '/.')
256 0 0 unless mkdir $self->{'output_dir'}
260 1 0 unless ($self->{'layout'} eq 'omd')
262 0 1 unless open my $fh, '>', $self->{'output_dir'} . '/' . $mainconfigfilename
268 1 0 unless ($self->{'layout'} eq 'omd')
270 8 0 unless (-d $self->{'output_dir'} . '/' . $dir)
272 0 8 unless mkdir $self->{'output_dir'} . '/' . $dir
289 0 1 if ($self->{'layout'} eq 'omd')
306 1 0 if ($self->{'layout'} ne 'omd')
311 1 0 if ($self->{'layout'} eq 'nagios' or $self->{'layout'} eq 'icinga')
321 0 1 if ($self->{'layout'} eq 'shinken')
335 1 0 unless ($self->{'skip_dependencys'})
341 0 1 unless (-d $self->{'output_dir'} . '/' . $obj_prefix)
342 0 0 unless mkdir $self->{'output_dir'} . '/' . $obj_prefix
346 0 14 unless open my $fh, '>', $self->{'output_dir'} . $exportFile->{'file'}
351 0 1 unless chmod 0755, $self->{'output_dir'} . $plg_prefix . '/test_servicecheck.pl'
352 0 1 unless chmod 0755, $self->{'output_dir'} . $plg_prefix . '/test_hostcheck.pl'
358 1 0 if ($^O ne 'MSWin32' and $< == 0)
362 0 1 if ($self->{'layout'} eq 'omd') { }
380 1 0 unless defined $objects->{'host'}
407 1 0 if ($self->{'routercount'} > 0)
426 1 4 if $type eq 'pending'
429 1 4 if ($x == 0)
435 1 4 if ($x == 1)
439 1 4 if ($x == 2)
455 2 8 if $x % 5 == 1
456 2 8 if $x % 5 == 2
457 2 8 if $x % 5 == 3
458 2 8 if $x % 5 == 4
471 9 1 if (defined $router[$cur_router])
475 1 9 if $type eq 'pending'
489 1 0 unless defined $objects->{'hostgroup'}
512 1 0 unless defined $objects->{'service'}
552 20 80 if $y % 5 == 1
553 20 80 if $y % 5 == 2
554 20 80 if $y % 5 == 3
555 20 80 if $y % 5 == 4
566 5 95 if $type eq 'pending'
569 10 90 if ($y == 0)
576 10 90 if ($y == 1)
580 10 90 if ($y == 2)
598 1 0 unless defined $objects->{'servicegroup'}
622 1 0 unless defined $objects->{'servicedependency'}
628 0 20 unless defined $dependent->{'host_name'}
629 0 20 unless defined $master->{'host_name'}
649 1 0 unless defined $objects->{'contactgroup'}
656 1 0 unless defined $objects->{'contact'}
678 0 1 if ($self->{'layout'} eq 'omd')
682 1 0 unless defined $objects->{'command'}
697 0 1 defined $self->{'hostcheckcmd'} ? :
0 1 defined $self->{'hostcheckcmd'} ? :
0 1 defined $self->{'servicecheckcmd'} ? :
708 1 0 unless defined $objects->{'timeperiod'}
836 0 1 if $self->{'hostcount'} * $self->{'services_per_host'} > 2000
870 1 107 if (ref $value eq 'ARRAY') { }
890 0 9 unless defined $objects
912 5 111 if $i == $j
937 0 3 if (scalar @types < $count)
970 38 1629 if $a eq 'dependent_service_description'
971 36 1593 if $a eq 'dependent_host_name'
972 6 1587 if $a eq 'name'
973 247 1340 if $a =~ /_name$/mx
974 253 1087 if $a =~ /_description$/mx
975 209 878 if $a eq 'use'
977 7 871 if $b eq 'dependent_service_description'
978 6 865 if $b eq 'dependent_host_name'
979 4 861 if $b eq 'name'
980 113 748 if $b =~ /_name$/mx
981 41 707 if $b =~ /_description$/mx
982 83 624 if $b eq 'use'
991 1 0 unless -r $file
992 0 0 unless open my $fh, '<', $file
994 0 0 unless $line =~ /^\s*use\s+lib\s+/gmx