Zenoss/Router/Search.pm untested

filter: Statementstmt 0.0% 0 / 66 Branchbran 0.0% 0 / 14 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 10 Podpod 0.0% 0 / 7 totaltotal 0.0% 0 / 97 CC 8 SCAR 16.7
CC
8
Cov
0%
search_getLiveResults
6.0
search_getAllResults
6.0
search_getSavedSearch
6.0
CRAP 5.3
1 package Zenoss::Router::Search;
2 use strict;
3  
4 use Moose::Role;
5 requires '_router_request', '_check_args';
6  
7 #**************************************************************************
8 # Attributes
9 #**************************************************************************
10 has SEARCH_LOCATION => (
11 is => 'ro',
12 isa => 'Str',
13 default => 'zport/dmd/search_router',
14 init_arg => undef,
15 );
16  
17 has SEARCH_ACTION => (
18 is => 'ro',
19 isa => 'Str',
20 default => 'SearchRouter',
21 init_arg => undef,
22 );
23  
24 #**************************************************************************
25 # Public Functions
26 #**************************************************************************
27 #======================================================================
28 # search_getLiveResults
29 #======================================================================
30 sub search_getLiveResults {
31 my ($self, $args) = @_;
32 $args = {} if !$args;
33  
34 # Argument definition
35 my $definition = {
36 required => ['query'],
37 };
38  
39 # Check the args
40 $self->_check_args($args, $definition);
41  
42 # Route the request
43 $self->_router_request(
44 {
45 location => $self->SEARCH_LOCATION,
46 action => $self->SEARCH_ACTION,
47 method => 'getLiveResults',
48 data => [$args],
49 }
50 );
51 } # END search_getLiveResults
52  
53 #======================================================================
54 # search_getAllResults
55 #======================================================================
56 sub search_getAllResults {
57 my ($self, $args) = @_;
58 $args = {} if !$args;
59  
60 # Argument definition
61 my $definition = {
62 required => ['query'],
63 };
64  
65 # Check the args
66 $self->_check_args($args, $definition);
67  
68 # Route the request
69 $self->_router_request(
70 {
71 location => $self->SEARCH_LOCATION,
72 action => $self->SEARCH_ACTION,
73 method => 'getAllResults',
74 data => [$args],
75 }
76 );
77 } # END search_getAllResults
78  
79 #======================================================================
80 # search_getSavedSearch
81 #======================================================================
82 sub search_getSavedSearch {
83 my ($self, $args) = @_;
84 $args = {} if !$args;
85  
86 # Argument definition
87 my $definition = {
88 required => ['searchName'],
89 };
90  
91 # Check the args
92 $self->_check_args($args, $definition);
93  
94 # Route the request
95 $self->_router_request(
96 {
97 location => $self->SEARCH_LOCATION,
98 action => $self->SEARCH_ACTION,
99 method => 'getSavedSearch',
100 data => [$args],
101 }
102 );
103 } # END search_getSavedSearch
104  
105 #======================================================================
106 # search_updateSavedSearch
107 #======================================================================
108 sub search_updateSavedSearch {
109 my ($self, $args) = @_;
110 $args = {} if !$args;
111  
112 # Argument definition
113 my $definition = {
114 required => ['searchName', 'queryString'],
115 };
116  
117 # Check the args
118 $self->_check_args($args, $definition);
119  
120 # Route the request
121 $self->_router_request(
122 {
123 location => $self->SEARCH_LOCATION,
124 action => $self->SEARCH_ACTION,
125 method => 'updateSavedSearch',
126 data => [$args],
127 }
128 );
129 } # END search_updateSavedSearch
130  
131 #======================================================================
132 # search_removeSavedSearch
133 #======================================================================
134 sub search_removeSavedSearch {
135 my ($self, $args) = @_;
136 $args = {} if !$args;
137  
138 # Argument definition
139 my $definition = {
140 required => ['searchName'],
141 };
142  
143 # Check the args
144 $self->_check_args($args, $definition);
145  
146 # Route the request
147 $self->_router_request(
148 {
149 location => $self->SEARCH_LOCATION,
150 action => $self->SEARCH_ACTION,
151 method => 'removeSavedSearch',
152 data => [$args],
153 }
154 );
155 } # END search_removeSavedSearch
156  
157 #======================================================================
158 # search_saveSearch
159 #======================================================================
160 sub search_saveSearch {
161 my ($self, $args) = @_;
162 $args = {} if !$args;
163  
164 # Argument definition
165 my $definition = {
166 required => ['queryString', 'searchName'],
167 };
168  
169 # Check the args
170 $self->_check_args($args, $definition);
171  
172 # Route the request
173 $self->_router_request(
174 {
175 location => $self->SEARCH_LOCATION,
176 action => $self->SEARCH_ACTION,
177 method => 'saveSearch',
178 data => [$args],
179 }
180 );
181 } # END search_saveSearch
182  
183 #======================================================================
184 # search_getAllSavedSearches
185 #======================================================================
186 sub search_getAllSavedSearches {
187 my ($self, $args) = @_;
188 $args = {} if !$args;
189  
190 # Route the request
191 $self->_router_request(
192 {
193 location => $self->SEARCH_LOCATION,
194 action => $self->SEARCH_ACTION,
195 method => 'getAllSavedSearches',
196 data => [$args],
197 }
198 );
199 } # END search_getAllSavedSearches
200  
201 #**************************************************************************
202 # Package end
203 #**************************************************************************
204 no Moose;
205  
206 1;
207  
208 __END__