File Coverage

blib/lib/App/Dochazka/CLI/Commands/RestTest/Lock.pm
Criterion Covered Total %
statement 43 43 100.0
branch n/a
condition n/a
subroutine 12 12 100.0
pod n/a
total 55 55 100.0


line stmt bran cond sub pod time code
1             # *************************************************************************
2             # Copyright (c) 2014-2016, SUSE LLC
3             #
4             # All rights reserved.
5             #
6             # Redistribution and use in source and binary forms, with or without
7             # modification, are permitted provided that the following conditions are met:
8             #
9             # 1. Redistributions of source code must retain the above copyright notice,
10             # this list of conditions and the following disclaimer.
11             #
12             # 2. Redistributions in binary form must reproduce the above copyright
13             # notice, this list of conditions and the following disclaimer in the
14             # documentation and/or other materials provided with the distribution.
15             #
16             # 3. Neither the name of SUSE LLC nor the names of its contributors may be
17             # used to endorse or promote products derived from this software without
18             # specific prior written permission.
19             #
20             # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21             # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22             # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23             # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
24             # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25             # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26             # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27             # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28             # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29             # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30             # POSSIBILITY OF SUCH DAMAGE.
31             # *************************************************************************
32             #
33              
34 20     20   239 use 5.012;
  20         38  
35 20     20   65 use strict;
  20         23  
  20         306  
36 20     20   57 use warnings;
  20         19  
  20         6242  
37              
38              
39             # $METHOD lock
40             sub _method_lock {
41 8     8   2681 my ( $ts, $th ) = @_;
42 8         16 my $method = $ts->[0];
43              
44 8         39 return [ $method, 'lock', $th->{_REST} ];
45             }
46              
47             # $METHOD lock eid $EID
48             sub _method_lock_eid {
49 8     8   2673 my ( $ts, $th ) = @_;
50 8         17 my $method = $ts->[0];
51 8         16 my $eid = $th->{_NUM};
52              
53 8         38 return [ $method, "lock/eid/$eid", $th->{_REST} ];
54             }
55              
56             # $METHOD lock eid $EID $TSRANGE
57             sub _method_lock_eid_tsrange {
58 8     8   2789 my ( $ts, $th ) = @_;
59 8         20 my $method = $ts->[0];
60 8         16 my $eid = $th->{_NUM};
61 8         14 my $tsr = $th->{_TSRANGE};
62              
63 8         53 return [ $method, "lock/eid/$eid/$tsr", $th->{_REST} ];
64             }
65              
66             # $METHOD lock lid $LID
67             sub _method_lock_lid {
68 8     8   2703 my ( $ts, $th ) = @_;
69 8         18 my $method = $ts->[0];
70 8         15 my $lid = $th->{_NUM};
71              
72 8         44 return [ $method, "lock/lid/$lid", $th->{_REST} ];
73             }
74              
75             # $METHOD lock new
76             sub _method_lock_new {
77 8     8   2512 my ( $ts, $th ) = @_;
78 8         17 my $method = $ts->[0];
79              
80 8         38 return [ $method, 'lock/new', $th->{_REST} ];
81             }
82              
83             # $METHOD lock nick $NICK
84             sub _method_lock_nick {
85 8     8   3014 my ( $ts, $th ) = @_;
86 8         18 my $method = $ts->[0];
87 8         17 my $nick = $th->{_TERM};
88              
89 8         46 return [ $method, "lock/nick/$nick", $th->{_REST} ];
90             }
91              
92             # $METHOD lock nick $NICK $TSRANGE
93             sub _method_lock_nick_tsrange {
94 8     8   2753 my ( $ts, $th ) = @_;
95 8         23 my $method = $ts->[0];
96 8         22 my $nick = $th->{_TERM};
97 8         11 my $tsr = $th->{_TSRANGE};
98              
99 8         47 return [ $method, "lock/nick/$nick/$tsr", $th->{_REST} ];
100             }
101              
102             # $METHOD lock self $SELF
103             sub _method_lock_self {
104 8     8   2894 my ( $ts, $th ) = @_;
105 8         15 my $method = $ts->[0];
106              
107 8         41 return [ $method, "lock/self", $th->{_REST} ];
108             }
109              
110             # $METHOD lock self $SELF $TSRANGE
111             sub _method_lock_self_tsrange {
112 16     16   5954 my ( $ts, $th ) = @_;
113 16         29 my $method = $ts->[0];
114 16         21 my $tsr = $th->{_TSRANGE};
115              
116 16         86 return [ $method, "lock/self/$tsr", $th->{_REST} ];
117             }
118              
119             1;