line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package ClientRequest;
|
2
|
|
|
|
|
|
|
# test client for proxy test - Andrew V. Purshottam
|
3
|
|
|
|
|
|
|
# ClientRequest object
|
4
|
1
|
|
|
1
|
|
7
|
use warnings;
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
46
|
|
5
|
1
|
|
|
1
|
|
7
|
use strict;
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
73
|
|
6
|
1
|
|
|
1
|
|
5
|
use diagnostics;
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
8
|
|
7
|
1
|
|
|
1
|
|
40
|
use Carp qw(carp croak);
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
106
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
my $debug_flag = 99;
|
10
|
|
|
|
|
|
|
our $test_count = 1;
|
11
|
1
|
|
|
1
|
|
6
|
use fields qw(count text delay_secs test_name);
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
10
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub new {
|
14
|
4
|
|
|
4
|
0
|
3003028
|
my ClientRequest $self = shift;
|
15
|
4
|
50
|
|
|
|
15
|
unless (ref $self) {
|
16
|
4
|
|
|
|
|
13
|
$self = fields::new($self);
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
}
|
19
|
|
|
|
|
|
|
|
20
|
4
|
|
|
|
|
260
|
my %param = @_;
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
# Extract parameters.
|
23
|
4
|
|
|
|
|
11
|
$self->{count} = delete $param{Count};
|
24
|
4
|
50
|
|
|
|
19
|
$self->{count} = 1 unless defined ($self->{count});
|
25
|
|
|
|
|
|
|
|
26
|
4
|
|
|
|
|
11
|
$self->{text} = delete $param{Text};
|
27
|
4
|
50
|
|
|
|
11
|
$self->{text} = "chunny" unless defined ($self->{text});
|
28
|
|
|
|
|
|
|
|
29
|
4
|
|
|
|
|
9
|
$self->{delay_secs} = delete $param{DelaySecs};
|
30
|
4
|
50
|
|
|
|
11
|
$self->{delay_secs} = 2 unless defined ($self->{delay_secs});
|
31
|
|
|
|
|
|
|
|
32
|
4
|
|
|
|
|
13
|
foreach (sort keys %param) {
|
33
|
0
|
|
|
|
|
0
|
carp "ClientRequest doesn't recognize \"$_\" as a parameter";
|
34
|
|
|
|
|
|
|
}
|
35
|
|
|
|
|
|
|
|
36
|
4
|
|
|
|
|
22
|
$self->{test_name} = $test_count++ .
|
37
|
|
|
|
|
|
|
"bounce $self->{count} copies of $self->{text} with delay: $self->{delay_secs}";
|
38
|
4
|
|
|
|
|
17
|
return $self;
|
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
}
|
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub get_request {
|
44
|
4
|
|
|
4
|
0
|
7
|
my $self = shift;
|
45
|
4
|
|
|
|
|
18
|
return $self->{count} . ":" . $self->{text};
|
46
|
|
|
|
|
|
|
}
|
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub get_test_name {
|
49
|
4
|
|
|
4
|
0
|
7
|
my $self = shift;
|
50
|
4
|
|
|
|
|
25
|
return $self->{test_name};
|
51
|
|
|
|
|
|
|
}
|
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub cmp_with_responce {
|
54
|
32
|
|
|
32
|
0
|
548
|
my $self = shift;
|
55
|
32
|
|
|
|
|
37
|
my $responce = shift;
|
56
|
32
|
|
|
|
|
128
|
my ($resp_index, $resp_text) = split /:/, $responce;
|
57
|
32
|
|
|
|
|
70
|
my $ok = $self->{text} eq $resp_text;
|
58
|
32
|
|
|
|
|
164
|
return $ok;
|
59
|
|
|
|
|
|
|
}
|
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
sub dump {
|
62
|
4
|
|
|
4
|
0
|
6
|
my $self = shift;
|
63
|
4
|
|
|
|
|
28
|
return "ClientRequest(count:$self->{count} text:$self->{text} delay_secs::$self->{delay_secs})";
|
64
|
|
|
|
|
|
|
}
|
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
1;
|
67
|
|
|
|
|
|
|
|