Branch Coverage

blib/lib/EMDIS/ECS.pm
Criterion Covered Total %
branch 43 458 9.3


line true false branch
30 0 6 if ($^O =~ /MSWin32/)
72 0 0 if $^O =~ /MSWin32/
81 0 95 unless defined $val
82 24 71 if $val =~ /^\s*YES\s*$/io or $val =~ /^\s*TRUE\s*$/io
91 0 32 unless defined $val
92 25 7 if $val =~ /^\s*NO\s*$/io or $val =~ /^\s*FALSE\s*$/io
105 0 0 unless ref $cfg
110 0 0 unless ref $node_tbl
133 0 0 unless (-d $dirname)
138 0 0 unless ($cutoff_time =~ /^\d+$/)
149 0 0 unless -f $filename
152 0 0 if ($stat[9] < $cutoff_time)
154 0 0 unless unlink $filename
164 0 12 unless defined $str
165 5 7 if ($str =~ /^"(.*)"$/) { }
1 6 elsif ($str =~ /^'(.*)'$/) { }
187 6 0 unless (ecs_is_configured())
194 0 0 if not defined $level or $level < 0 or $level > $#EMDIS::ECS::LOG_LEVEL
196 0 0 if $level < $cfg->LOG_LEVEL and not $cfg->ECS_DEBUG
198 0 0 unless defined $text
203 0 0 unless (open LOG, '>>' . $cfg->LOG_FILE)
209 0 0 if $setmode
210 0 0 if ($level >= $cfg->MAIL_LEVEL)
232 0 0 unless -f $filename
233 0 0 unless -d $targetdir
240 0 0 if ($basename =~ /^(\d{8}_\d{6}_(.+_)?).{4}(\..{3})$/) { }
250 0 0 unless $fh
252 0 0 unless copy($filename, $fh)
268 0 0 unless $err
282 0 0 if $err
286 0 0 unless my $access_token = $EMDIS::ECS::cmd_output
302 1 9 unless ecs_is_configured()
307 0 9 unless $fh->open("< $filename")
309 1 10 if (m[^Subject:.*$mail_mrk:(\S+?):(\d+):(\d+)/(\d+)\s*$]io)
312 4 6 if (/^Subject:.*$mail_mrk:(\S+?):(\d+)\s*$/io)
315 1 5 if (/^Subject:.*$mail_mrk:(\S+?):(\d+):DOC\s*$/io)
318 1 4 if (/^Subject:.*$mail_mrk:(\S+)\s*$/io)
321 2 2 if /^$/
336 1 0 unless ecs_is_configured()
341 0 1 unless ($err)
346 0 0 unless $fh
348 0 0 if ($fh)
355 0 1 unless ($err)
363 0 0 if $err and not $_[$#_] =~ /Unable to send admin email/iso
380 1 0 unless ecs_is_configured()
388 0 0 if ($seq_num and not $node_id)
392 0 0 unless $fml =~ /^.+:.+;/s
394 0 0 if ($fml =~ /HUB_RCV\s*=\s*([^,;]+)/is) { }
401 0 0 if ($fml =~ /HUB_SND\s*=\s*([^,;]+)/is) { }
408 0 0 unless $hub_snd eq $EMDIS::ECS::ECS_CFG->THIS_NODE
410 0 0 unless $node_id
411 0 0 unless $node_id eq $hub_rcv
418 0 0 unless ($was_locked)
419 0 0 unless $node_tbl->lock
424 0 0 unless ($node)
425 0 0 unless $was_locked
428 0 0 unless ($node->{'addr'})
429 0 0 unless $was_locked
432 0 0 if ($seq_num =~ /auto/i)
439 0 0 if $seq_num
444 0 0 if ($seq_num) { }
448 0 0 unless -e $dirname
456 0 0 unless -e $dirname
462 0 0 if (-e $filename) { }
465 0 0 unless $fh
471 0 0 unless $fh->open("> $filename")
483 0 0 if ($err) { }
0 0 elsif (not $seq_num || $node->{'encr_meta'} =~ /true/i) { }
488 0 0 if (is_yes($cfg->ENABLE_AMQP) and exists $node->{'amqp_addr_meta'} and $node->{'amqp_addr_meta'}) { }
0 0 elsif (is_yes($node->{'amqp_only'})) { }
520 0 0 unless ($err)
523 0 0 unless $node_tbl->write($node_id, $node)
527 0 0 unless $was_locked
542 1 0 unless ecs_is_configured()
546 0 0 if defined $custom_headers and not "HASH" eq ref $custom_headers
551 0 0 if (is_yes($cfg->SMTP_USE_SSL) or is_yes($cfg->SMTP_USE_STARTTLS))
552 0 0 if "CPAN::Version"->vlt($Net::SMTP::VERSION, "3.05")
555 0 0 if (is_yes($cfg->SMTP_USE_SSL)) { }
556 0 0 unless $smtp = "Net::SMTP"->new($cfg->SMTP_HOST, "Hello", $cfg->SMTP_DOMAIN, "Timeout", $cfg->SMTP_TIMEOUT, "Debug", $cfg->SMTP_DEBUG, "Port", $cfg->SMTP_PORT, "SSL", 1)
566 0 0 unless $smtp = "Net::SMTP"->new($cfg->SMTP_HOST, "Hello", $cfg->SMTP_DOMAIN, "Timeout", $cfg->SMTP_TIMEOUT, "Debug", $cfg->SMTP_DEBUG, "Port", $cfg->SMTP_PORT)
573 0 0 if (is_yes($cfg->SMTP_USE_STARTTLS))
574 0 0 unless ($smtp->starttls)
581 0 0 if ($cfg->SMTP_OAUTH_TOKEN_CMD) { }
582 0 0 unless (is_yes($EMDIS::ECS::ECS_CFG->SMTP_USE_SSL) or is_yes($EMDIS::ECS::ECS_CFG->SMTP_USE_STARTTLS))
587 0 0 if "CPAN::Version"->vlt($Authen::SASL::Perl::VERSION, "2.1800")
596 0 0 if ($err)
608 0 0 unless ($sasl)
613 0 0 unless ($smtp->auth($sasl))
622 0 0 if ($cfg->SMTP_USERNAME and $cfg->SMTP_PASSWORD)
623 0 0 unless ($smtp->auth($cfg->SMTP_USERNAME, $cfg->SMTP_PASSWORD))
632 0 0 unless $smtp->mail($cfg->SMTP_FROM)
634 0 0 unless $smtp->to($recipient)
636 0 0 unless $smtp->data
638 0 0 if (defined $custom_headers)
643 0 0 unless $smtp->datasend("${key}: $value\n")
648 0 0 unless $smtp->datasend("From: $from_addr\n")
650 0 0 unless $smtp->datasend("Subject: $subject\n")
652 0 0 unless $smtp->datasend("To: $recipient\n")
654 0 0 if ($cfg->ADM_ADDR =~ /\b$recipient\b/)
656 0 0 unless $smtp->datasend("Reply-To: $recipient\n")
659 0 0 unless $smtp->datasend("MIME-Version: 1.0\n")
661 0 0 unless $smtp->datasend("Content-Type: text/plain\n")
663 0 0 unless $smtp->datasend("Content-Transfer-Encoding: 7bit\n")
665 0 0 unless $smtp->datasend("\n")
667 0 0 unless $smtp->datasend(@_)
669 0 0 unless $smtp->dataend
671 0 0 unless $smtp->quit
689 0 0 unless (defined $amqp_addr)
693 0 0 unless (defined $subject)
697 0 0 if (not defined $node) { }
0 0 elsif (not 'HASH' eq ref $node) { }
701 0 0 ref $custom_properties ? :
705 0 0 if (defined $custom_properties and not "HASH" eq ref $custom_properties)
706 0 0 ref $custom_properties ? :
710 0 0 if (exists $node->{'node_disabled'} and is_yes($node->{'node_disabled'}))
730 0 0 exists $EMDIS::ECS::ECS_CFG->{'AMQP_PASSWORD'} ? :
0 0 exists $EMDIS::ECS::ECS_CFG->{'AMQP_SSLCERT'} ? :
0 0 exists $EMDIS::ECS::ECS_CFG->{'AMQP_SSLKEY'} ? :
0 0 exists $EMDIS::ECS::ECS_CFG->{'AMQP_SSLPASS'} ? :
0 0 exists $EMDIS::ECS::ECS_CFG->{'AMQP_TRUSTSTORE'} ? :
0 0 exists $EMDIS::ECS::ECS_CFG->{'AMQP_USERNAME'} ? :
0 0 exists $EMDIS::ECS::ECS_CFG->{'AMQP_VHOST'} ? :
736 0 0 if exists $node->{$opt}
743 0 0 if ($subject =~ m[$mail_mrk:(\S+?):(\d+):(\d+)/(\d+)\s*$]io) { }
0 0 elsif ($subject =~ /$mail_mrk:(\S+?):(\d+)\s*$/io) { }
0 0 elsif ($subject =~ /$mail_mrk:(\S+?):(\d+):DOC\s*$/io) { }
0 0 elsif ($subject =~ /$mail_mrk:(\S+)\s*$/io) { }
759 0 0 if ($EMDIS::ECS::ECS_CFG->THIS_NODE ne $hub_snd)
764 0 0 $node->{'node'} ? :
0 0 $seq_num ? :
769 0 0 if (defined $custom_properties)
784 0 0 if $send_opts->{'amqp_content_type'}
786 0 0 if $send_opts->{'amqp_encoding'}
788 0 0 if $send_opts->{'amqp_vhost'}
790 0 0 if $send_opts->{'amqp_truststore'}
794 0 0 if $send_opts->{'amqp_sslcert'} and $send_opts->{'amqp_sslkey'}
796 0 0 if $send_opts->{'amqp_username'}
799 0 0 if $send_props->{$prop}
805 0 0 if $send_opts->{'amqp_password'}
807 0 0 if $send_opts->{'amqp_sslpass'}
810 0 0 if $EMDIS::ECS::ECS_CFG->ECS_DEBUG > 0
813 0 0 if ($err)
835 1 0 unless ecs_is_configured()
846 0 0 unless $fh
856 0 0 if (/PGP2/i)
861 0 0 if (/OpenPGP/i)
873 0 0 if $result
877 0 0 unless $fh->open("< $encr_filename")
886 0 0 if (is_yes($cfg->ENABLE_AMQP))
889 0 0 if ($subject =~ /^[^:]+:[^:]+$/io) { }
0 0 elsif ($subject =~ /^[^:]+:[^:]+:[0123456789]+:DOC/io) { }
0 0 elsif ($subject =~ /^[^:]+:[^:]+:[0123456789]+/io) { }
0 0 elsif (is_yes($node->{'amqp_only'})) { }
893 0 0 if not $node->{'amqp_addr_meta'} and is_yes($node->{'amqp_only'})
900 0 0 if not $node->{'amqp_addr_doc'} and is_yes($node->{'amqp_only'})
907 0 0 if not $node->{'amqp_addr_msg'} and is_yes($node->{'amqp_only'})
915 0 0 if ($amqp_addr)
925 0 0 if (is_yes($node->{'amqp_only'}))
930 0 0 if ($node->{'amqp_addr_meta'} or $node->{'amqp_addr_msg'} or $node->{'amqp_addr_doc'})
933 0 0 if $cfg->ECS_DEBUG > 0
947 1 1 unless defined $format
959 0 0 unless ecs_is_configured()
974 1 0 unless ecs_is_configured()
996 1 0 unless ecs_is_configured()
1004 0 0 if $cfg->ECS_DEBUG > 0
1011 0 0 defined $encr_out_passphrase && 0 < length $encr_out_passphrase ? :
1016 0 0 if $result
1019 0 0 if (defined $required_signature and not $result)
1020 0 0 unless ($EMDIS::ECS::cmd_output =~ /Good signature from[^\n]+$required_signature/is)
1041 1 0 unless ecs_is_configured()
1046 0 0 defined $encr_out_keyid && 0 < length $encr_out_keyid ? :
1053 0 0 if $cfg->ECS_DEBUG > 0
1060 0 0 defined $encr_out_passphrase && 0 < length $encr_out_passphrase ? :
1065 0 0 if $result
1080 1 0 unless ecs_is_configured()
1088 0 0 if $cfg->ECS_DEBUG > 0
1093 0 0 defined $encr_out_passphrase && 0 < length $encr_out_passphrase ? :
1099 0 0 if $result =~ /^Status 0x0100/
1100 0 0 if $result
1103 0 0 if (defined $required_signature and not $result)
1104 0 0 unless ($EMDIS::ECS::cmd_output =~ /Good signature from[^\n]+$required_signature/is)
1125 1 0 unless ecs_is_configured()
1130 0 0 defined $encr_out_keyid && 0 < length $encr_out_keyid ? :
1137 0 0 if $cfg->ECS_DEBUG > 0
1142 0 0 defined $encr_out_passphrase && 0 < length $encr_out_passphrase ? :
1148 0 0 if $result
1157 0 0 unless ecs_is_configured()
1160 0 0 if (open PIDFILE, $EMDIS::ECS::pidfile)
1163 0 0 if kill 0, $pid
1175 0 0 unless ecs_is_configured()
1189 0 0 $^O =~ /MSWin32/ ? :
1212 0 0 unless open OLDIN, "< &STDIN"
1213 0 0 unless open STDIN, "< &READ"
1215 0 0 unless open OLDOUT, ">&STDOUT"
1216 0 0 unless open STDOUT, ">${$}.txt"
1218 0 0 unless open OLDERR, ">&STDERR"
1219 0 0 unless open STDERR, ">&STDOUT"
1227 0 0 unless (defined $input_data)
1234 0 0 if (-x "$appname.exe") { }
0 0 elsif (-x "$appname.bat") { }
1243 0 0 if $cfg->ECS_DEBUG > 0
1258 0 0 if ($rc) { }
1259 0 0 if $cfg->ECS_DEBUG > 0
1264 0 0 if (defined $winMsg) { }
1267 0 0 if $cfg->ECS_DEBUG > 0
1273 0 0 if ($rc)
1278 0 0 if $cfg->ECS_DEBUG > 0
1283 0 0 if ($rc) { }
1286 0 0 if $cfg->ECS_DEBUG > 0
1290 0 0 if $cfg->ECS_DEBUG > 0
1312 0 0 if (open FILETEMP, "< ${$}.txt")
1323 0 0 if ($#msgs >= 0) { }
1363 0 0 if defined $input_data
1369 0 0 if $broken_pipe
1372 0 0 if ($@) { }
0 0 elsif ($status) { }
1375 0 0 if not defined $pid and $@ =~ /^open2/
1386 0 0 $signal_num ? :
0 0 $dumped_core ? :
1391 0 0 if $writer->opened
1392 0 0 if $reader->opened
1393 0 0 if (defined $oldsigpipe) { }
1395 0 0 if (defined $oldsigalrm) { }
1397 0 0 if $result and $#msgs >= 0
1399 0 0 if ($#msgs >= 0) { }
1408 0 0 if $EMDIS::ECS::pidfile
1415 0 11 unless defined $str
1427 2 2 if /PGP2/i
1428 2 0 if /OpenPGP/i