plugins/templates/check_template-SOAP.pl

filter: Statementstmt 48.5% 34 / 70 Branchbran 8.3% 2 / 24 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 87.5% 7 / 8 Podpod n/a totaltotal 40.1% 43 / 107 CC 14 SCAR 47.3
CC
14
Cov
37%
actionOnSoapResponse
182.0
BEGIN
2.5
BEGIN
1.0
CRAP 113.2
« blib/lib/ASNMTAP/Asnmtap/Plugins/NPTest.pm ↑ Summary blib/lib/ASNMTAP/Time.pm »
1 #!/usr/bin/env perl
2 # ----------------------------------------------------------------------------------------------------------
3 # © Copyright 2003-2011 by Alex Peeters [alex.peeters@citap.be]
4 # ----------------------------------------------------------------------------------------------------------
5 # 2011/mm/dd, v3.002.003, check_template-SOAP.pl
6 # ----------------------------------------------------------------------------------------------------------
7  
8 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 3 ▶use warnings; # Must be used in test mode only. This reduces a little process speed
Subroutine BEGIN: called CC=1 SCAR=0.0
10 #use diagnostics; # Must be used in test mode only. This reduces a lot of process speed
11  
12 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
13  
14 0 ▶BEGIN { if ( $ENV{ASNMTAP_PERL5LIB} ) { eval 'use lib ( "$ENV{ASNMTAP_PERL5LIB}" )'; } }
Subroutine BEGIN: called CC=2 SCAR=9.2
Branch: 1 branch
BranchTrueFalseTotal
if ($ENV{"ASNMTAP_PERL5LIB"}) 0 3 3
15  
16 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
17  
18 3 ▶use ASNMTAP::Asnmtap::Plugins v3.002.003;
Subroutine BEGIN: called CC=1 SCAR=0.0
19 3 ▶use ASNMTAP::Asnmtap::Plugins qw(:PLUGINS);
Subroutine BEGIN: called CC=1 SCAR=0.0
20  
21 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
22  
23 3 my $objectPlugins = ASNMTAP::Asnmtap::Plugins->new (
24 _programName => 'check_template-SOAP.pl',
25 _programDescription => "SOAP::LITE plugin template for testing the '$APPLICATION' with Performance Data",
26 _programVersion => '3.002.003',
27 _programGetOptions => ['proxy:s', 'timeout|t:i', 'trendline|T:i'],
28 _timeout => 30,
29 _debug => 0);
30  
31 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
32  
33 3 ▶use ASNMTAP::Asnmtap::Plugins::SOAP qw(&get_soap_request);
Subroutine BEGIN: called CC=1 SCAR=0.0
34  
35 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
36  
37 3 ▶use SOAP::Lite;
Subroutine BEGIN: called CC=1 SCAR=0.0
38  
39 1 my $proxy = 'http://services.soaplite.com/hibye.cgi';
40 1 my $namespace = 'http://www.soaplite.com/Demo';
41 1 my $methodName = 'hi';
42 1 my $method = SOAP::Data->name($methodName)->attr( {xmlns => $namespace} );
43  
44 1 my %soapService_Register_NS = (
45 'http://schemas.xmlsoap.org/wsdl/mime/' => 'mime',
46 'http://www.w3.org/2001/XMLSchema' => 's'
47 );
48  
49 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
50 # Start plugin - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
51 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
52  
53 1 my ($returnCode, $xml);
54  
55 1 ($returnCode, $xml) = get_soap_request (
56 asnmtapInherited => \$objectPlugins,
57 custom => \&actionOnSoapResponse,
58 customArguments => 'scalar',
59 proxy => $proxy,
60 namespace => $namespace,
61 method => $method,
62 registerNamespace => \%soapService_Register_NS,
63 cookies => 1,
64 perfdataLabel => 'SOAP'
65 );
66  
67 1 ($returnCode, $xml) = get_soap_request (
68 asnmtapInherited => \$objectPlugins,
69 custom => \&actionOnSoapResponse,
70 customArguments => [1, 2, 3],
71 proxy => $proxy,
72 namespace => $namespace,
73 method => $method,
74 registerNamespace => \%soapService_Register_NS,
75 cookies => 1,
76 perfdataLabel => 'SOAP'
77 );
78  
79 1 ($returnCode, $xml) = get_soap_request (
80 asnmtapInherited => \$objectPlugins,
81 custom => \&actionOnSoapResponse,
82 customArguments => {a => 1, b => 2, c => 3},
83 proxy => $proxy,
84 namespace => $namespace,
85 method => $method,
86 registerNamespace => \%soapService_Register_NS,
87 cookies => 1,
88 perfdataLabel => 'SOAP'
89 );
90  
91 1 ($returnCode, $xml) = get_soap_request (
92 asnmtapInherited => \$objectPlugins,
93 custom => \&actionOnSoapResponse,
94 customArguments => \$proxy,
95 proxy => $proxy,
96 namespace => $namespace,
97 method => $method,
98 registerNamespace => \%soapService_Register_NS,
99 cookies => 1,
100 perfdataLabel => 'SOAP'
101 );
102  
103 1 ($returnCode, $xml) = get_soap_request (
104 asnmtapInherited => \$objectPlugins,
105 custom => \&actionOnSoapResponse,
106 customArguments => \[1, 2, 3],
107 proxy => $proxy,
108 namespace => $namespace,
109 method => $method,
110 registerNamespace => \%soapService_Register_NS,
111 cookies => 1,
112 perfdataLabel => 'SOAP'
113 );
114  
115 1 ($returnCode, $xml) = get_soap_request (
116 asnmtapInherited => \$objectPlugins,
117 custom => \&actionOnSoapResponse,
118 customArguments => \{a => 1, b => 2, c => 3},
119 proxy => $proxy,
120 namespace => $namespace,
121 method => $method,
122 registerNamespace => \%soapService_Register_NS,
123 cookies => 1,
124 perfdataLabel => 'SOAP'
125 );
126  
127 1 ▶unless ( $returnCode ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($returnCode) 0 1 1
128 0 ▶ if (defined $xml) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $xml) { } 0 0 0
129 } else {
130 }
131 }
132  
133 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
134 # End plugin - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
135 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
136  
137 1 $objectPlugins->exit (7);
138  
139 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
140  
141 0 ▶sub actionOnSoapResponse {
Subroutine actionOnSoapResponse: not called CC=13 SCAR=52.0
142 0 my ($asnmtapInherited, $tSom, $arguments) = @_;
143  
144 0 my $debug = $asnmtapInherited->getOptionsValue ('debug');
145  
146 0 ▶ if ($debug and defined $arguments) {
Branch: 1 branch
BranchTrueFalseTotal
if ($debug and defined $arguments) 0 0 0
Condition0%0/3
$debug and defined $arguments
!ll&&!rl&&r
000
MC/DC0%0/2
$debug and defined $arguments
$debug defined $arguments
Truth table0%0/3
A and B
A= $debugB= defined $arguments
ABresult
0X0
100
111
147 0 for ( ref $arguments ) {
148 /^REF$/ &&
149 0 ▶ do {
Branch: 1 branch
BranchTrueFalseTotal
/^REF$/ and do { foreach $_ (ref $$arguments) { /^ARRAY$/ and do { print "REF ARRAY: @$$arguments\n"; last }; /^HASH$/ and do { print "REF HASH: "; while (() = each %{$$arguments;}) { do { print "$key => $value " }; } ; print "\n"; last }; } ; last } 0 0 0
150 0 for ( ref $$arguments ) {
151 /^ARRAY$/ &&
152 0 ▶ do { print "REF ARRAY: @$$arguments\n"; last; };
Branch: 1 branch
BranchTrueFalseTotal
/^ARRAY$/ and do { print "REF ARRAY: @$$arguments\n"; last } 0 0 0
153 /^HASH$/ &&
154 0 ▶ do { print "REF HASH: "; while (my ($key, $value) = each %{ $$arguments } ) { print "$key => $value "; }; print "\n"; last; };
Branch: 2 branches
BranchTrueFalseTotal
/^HASH$/ and do { print "REF HASH: "; while (() = each %{$$arguments;}) { do { print "$key => $value " }; } ; print "\n"; last } 0 0 0
if (() = each %{$$arguments;}) 0 0 0
155 }
156  
157 0 last;
158 };
159 /^ARRAY$/ &&
160 0 ▶ do { print "ARRAY: @$arguments\n"; last; };
Branch: 1 branch
BranchTrueFalseTotal
/^ARRAY$/ and do { print "ARRAY: @$arguments\n"; last } 0 0 0
161 /^HASH$/ &&
162 0 ▶ do { print "HASH: "; while (my ($key, $value) = each %{ $arguments } ) { print "$key => $value "; }; print "\n"; last; };
Branch: 2 branches
BranchTrueFalseTotal
/^HASH$/ and do { print "HASH: "; while (() = each %{$arguments;}) { do { print "$key => $value " }; } ; print "\n"; last } 0 0 0
if (() = each %{$arguments;}) 0 0 0
163 /^SCALAR$/ &&
164 0 ▶ do { print "REF SCALAR: ", $$arguments, "\n"; last; };
Branch: 1 branch
BranchTrueFalseTotal
/^SCALAR$/ and do { print "REF SCALAR: ", $$arguments, "\n"; last } 0 0 0
165 0 print "SCALAR: ", $arguments, "\n";
166 }
167 }
168  
169 0 my $returnCode = $ERRORS{OK};
170 0 $asnmtapInherited->pluginValues ( { stateValue => $returnCode, alert => 'SOAP::LITE' }, $TYPE{APPEND} );
171 0 return ($returnCode);
172 }
173  
174 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
175  
176 __END__
« blib/lib/ASNMTAP/Asnmtap/Plugins/NPTest.pm ↑ Summary blib/lib/ASNMTAP/Time.pm »