line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package IO::EPP::Test::Server; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=encoding utf8 |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=head1 NAME |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
IO::EPP::Test::Server |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 SYNOPSIS |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
use IO::EPP::Test::Server; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
my $s = new IO::EPP::Test::Server( $obj->{sock} ); # $obj->{sock} eq 'epp.example.com:700' |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
# contacts |
16
|
|
|
|
|
|
|
my $conts = $s->data->{conts} |
17
|
|
|
|
|
|
|
# nameservers |
18
|
|
|
|
|
|
|
my $nss = $s->data->{nss}; |
19
|
|
|
|
|
|
|
# domains |
20
|
|
|
|
|
|
|
my $doms = $s->data->{doms}; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=head1 DESCRIPTION |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
For testing IO::EPP::Xxxx, |
25
|
|
|
|
|
|
|
Provides storage of pseudo registries |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=head1 AUTHORS |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
Vadim Likhota |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=cut |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
#use Data::Dumper; |
34
|
|
|
|
|
|
|
|
35
|
13
|
|
|
13
|
|
1366805
|
use strict; |
|
13
|
|
|
|
|
106
|
|
|
13
|
|
|
|
|
297
|
|
36
|
13
|
|
|
13
|
|
54
|
use warnings; |
|
13
|
|
|
|
|
18
|
|
|
13
|
|
|
|
|
247
|
|
37
|
|
|
|
|
|
|
|
38
|
13
|
|
|
13
|
|
5479
|
no utf8; # !!! |
|
13
|
|
|
|
|
142
|
|
|
13
|
|
|
|
|
52
|
|
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=head1 Data storage format |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
Server is cache of data: |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=over 3 |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=item * |
47
|
|
|
|
|
|
|
first level -- server as url:port |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=item * |
50
|
|
|
|
|
|
|
second level -- object type: contact, ns, domain, poll |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=item * |
53
|
|
|
|
|
|
|
third level -- object data |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=back |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
Examples of data: |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
Dump of contact |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
'conts' => { |
62
|
|
|
|
|
|
|
'TEST-b123' => { |
63
|
|
|
|
|
|
|
'statuses' => { |
64
|
|
|
|
|
|
|
'ok' => '+', |
65
|
|
|
|
|
|
|
'linked' => 2 |
66
|
|
|
|
|
|
|
}, |
67
|
|
|
|
|
|
|
'int' => { |
68
|
|
|
|
|
|
|
'addr' => { |
69
|
|
|
|
|
|
|
'pc' => '83000', |
70
|
|
|
|
|
|
|
'cc' => 'UA', |
71
|
|
|
|
|
|
|
'city' => 'Donetsk', |
72
|
|
|
|
|
|
|
'street' => [ |
73
|
|
|
|
|
|
|
'Vagnera 11-22-33' |
74
|
|
|
|
|
|
|
], |
75
|
|
|
|
|
|
|
'sp' => 'Donetskaya' |
76
|
|
|
|
|
|
|
}, |
77
|
|
|
|
|
|
|
'name' => 'Test Testov' |
78
|
|
|
|
|
|
|
}, |
79
|
|
|
|
|
|
|
'updater' => 'test', |
80
|
|
|
|
|
|
|
'creater' => 'test', |
81
|
|
|
|
|
|
|
'id' => 'TEST-b123', |
82
|
|
|
|
|
|
|
'authInfo' => 'Q2+qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq', |
83
|
|
|
|
|
|
|
'email' => [ |
84
|
|
|
|
|
|
|
'test0101@ya.ru' |
85
|
|
|
|
|
|
|
], |
86
|
|
|
|
|
|
|
'fax' => [], |
87
|
|
|
|
|
|
|
'cre_date' => '2019-09-23T22:38:56.0Z', |
88
|
|
|
|
|
|
|
'roid' => '0BC370A917642D744F69514FD4838029-TEST', |
89
|
|
|
|
|
|
|
'owner' => 'test', |
90
|
|
|
|
|
|
|
'reason' => 'in use', |
91
|
|
|
|
|
|
|
'voice' => [ |
92
|
|
|
|
|
|
|
'+380.987654321' |
93
|
|
|
|
|
|
|
], |
94
|
|
|
|
|
|
|
'upd_date' => '2019-09-23T22:38:56.0Z' |
95
|
|
|
|
|
|
|
}, |
96
|
|
|
|
|
|
|
}, |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
Dump of nameserver |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
'nss' => { |
101
|
|
|
|
|
|
|
'ns1.my.com' => { |
102
|
|
|
|
|
|
|
'addr_v4' => [ |
103
|
|
|
|
|
|
|
'11.22.33.44', |
104
|
|
|
|
|
|
|
'11.22.44.88' |
105
|
|
|
|
|
|
|
], |
106
|
|
|
|
|
|
|
'roid' => '873CAEF521E887055DC202BE0AC271F0-TEST', |
107
|
|
|
|
|
|
|
'addr_v6' => [], |
108
|
|
|
|
|
|
|
'avail' => 0, |
109
|
|
|
|
|
|
|
'reason' => 'in use', |
110
|
|
|
|
|
|
|
'creater' => 'test', |
111
|
|
|
|
|
|
|
'statuses' => { |
112
|
|
|
|
|
|
|
'ok' => '+', |
113
|
|
|
|
|
|
|
'linked' => 1 |
114
|
|
|
|
|
|
|
}, |
115
|
|
|
|
|
|
|
'owner' => 'test', |
116
|
|
|
|
|
|
|
'cre_date' => '2019-09-23T22:46:33.0Z' |
117
|
|
|
|
|
|
|
} |
118
|
|
|
|
|
|
|
}, |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
Dump of domain |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
'doms' => { |
123
|
|
|
|
|
|
|
'nssdom.best' => { |
124
|
|
|
|
|
|
|
'upd_date' => '2019-09-23T22:54:12.0Z', |
125
|
|
|
|
|
|
|
'create' => 'test', |
126
|
|
|
|
|
|
|
'nss' => { |
127
|
|
|
|
|
|
|
'ns1.reg.com' => '+', |
128
|
|
|
|
|
|
|
'ns2.reg.com' => '+' |
129
|
|
|
|
|
|
|
}, |
130
|
|
|
|
|
|
|
'hosts' => {}, |
131
|
|
|
|
|
|
|
'exp_date' => '2020-09-23T22:54:12.0Z', |
132
|
|
|
|
|
|
|
'cre_date' => '2019-09-23T22:54:12.0Z', |
133
|
|
|
|
|
|
|
'trans_date' => '2019-09-23T22:54:12.0Z', |
134
|
|
|
|
|
|
|
'billing' => [ |
135
|
|
|
|
|
|
|
'TEST-b123' |
136
|
|
|
|
|
|
|
], |
137
|
|
|
|
|
|
|
'statuses' => { |
138
|
|
|
|
|
|
|
'ok' => '+' |
139
|
|
|
|
|
|
|
}, |
140
|
|
|
|
|
|
|
'tech' => [ |
141
|
|
|
|
|
|
|
'TEST-t123' |
142
|
|
|
|
|
|
|
], |
143
|
|
|
|
|
|
|
'authInfo' => 'bfhRem884mfmf,FMd:fnnfe', |
144
|
|
|
|
|
|
|
'avail' => 0, |
145
|
|
|
|
|
|
|
'reason' => 'in use', |
146
|
|
|
|
|
|
|
'owner' => 'test', |
147
|
|
|
|
|
|
|
'registrant' => 'TEST-r123', |
148
|
|
|
|
|
|
|
'admin' => [ |
149
|
|
|
|
|
|
|
'TEST-a123' |
150
|
|
|
|
|
|
|
], |
151
|
|
|
|
|
|
|
'roid' => 'C3163119E2B3E038F41A60248A2B4214-TEST' |
152
|
|
|
|
|
|
|
}, |
153
|
|
|
|
|
|
|
}, |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
=head1 DIRECT ACCESS TO DATA |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
An Example: |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
my $srv_url = "$socket_data->{PeerHost}:$socket_data->{PeerPort}"; |
161
|
|
|
|
|
|
|
# or $srv_url = $obj->{sock}; |
162
|
|
|
|
|
|
|
my $s = new IO::EPP::Test::Server( $srv_url ); |
163
|
|
|
|
|
|
|
my $doms = $s->data->{doms}; |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
# Set reg_id as admin_id |
166
|
|
|
|
|
|
|
$doms->{'nssdom.best'}{reg_id} = $doms->{admin_id}[0]; |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
# Add new ns |
169
|
|
|
|
|
|
|
push @{$doms->{'nssdom.best'}{nss}}, 'ns9.reg.com'; |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
$doms->{'new_busy_domain.com'} = { avail => 0, reason => 'in use' }; |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
See IO::EPP::Test::Base also. |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
=cut |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
our $data; |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
sub new { |
180
|
155
|
|
|
155
|
0
|
3691
|
my ( undef, $url ) = @_; |
181
|
|
|
|
|
|
|
|
182
|
155
|
100
|
|
|
|
305
|
$data = {} unless ref $data; |
183
|
|
|
|
|
|
|
|
184
|
155
|
100
|
|
|
|
293
|
unless ( $data->{$url} ) { |
185
|
3
|
|
|
|
|
23
|
$data->{$url} = { conts => {}, nss => {}, doms => {}, poll => [] }; |
186
|
|
|
|
|
|
|
} |
187
|
|
|
|
|
|
|
|
188
|
155
|
|
|
|
|
342
|
my $s = { url => $url }; |
189
|
|
|
|
|
|
|
|
190
|
155
|
|
|
|
|
334
|
return bless $s; |
191
|
|
|
|
|
|
|
} |
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
sub data { |
194
|
493
|
|
|
493
|
1
|
2299
|
return $data->{$_[0]->{url}}; |
195
|
|
|
|
|
|
|
} |
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
|
198
|
|
|
|
0
|
|
|
sub DESTROY { |
199
|
|
|
|
|
|
|
# for debug |
200
|
|
|
|
|
|
|
#print Dumper $_[0]; |
201
|
|
|
|
|
|
|
#print Dumper $data; |
202
|
|
|
|
|
|
|
} |
203
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
1; |