1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
|
22 |
|
|
23 |
|
package net.smartlab.web; |
24 |
|
|
25 |
|
import net.smartlab.web.page.Paginator; |
26 |
|
import net.smartlab.web.test.BusinessObjectFactoryTestCase; |
27 |
|
import org.hibernate.Query; |
28 |
|
import org.hibernate.Session; |
29 |
|
|
30 |
|
|
31 |
|
|
32 |
|
|
33 |
|
@author |
34 |
|
|
35 |
|
|
|
|
| 2,6% |
Uncovered Elements: 76 (78) |
Complexity: 25 |
Complexity Density: 0,47 |
|
36 |
|
public class BusinessObjectFactoryPaginatorTest extends BusinessObjectFactoryTestCase { |
37 |
|
|
38 |
|
BusinessObjectFactory factory = null; |
39 |
|
|
40 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
41 |
22
|
protected void setUp() throws Exception {... |
42 |
22
|
super.setUp(); |
43 |
|
|
44 |
|
} |
45 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
46 |
0
|
protected void tearDown() throws Exception {... |
47 |
0
|
super.tearDown(); |
48 |
|
} |
49 |
|
|
50 |
|
|
51 |
|
|
52 |
|
|
53 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
4
-
|
|
54 |
0
|
public void testSetPage() {... |
55 |
|
} |
56 |
|
|
57 |
|
|
58 |
|
|
59 |
|
|
60 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
4
-
|
|
61 |
0
|
public void testSetSize() {... |
62 |
|
} |
63 |
|
|
64 |
|
|
65 |
|
|
66 |
|
|
67 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
4
-
|
|
68 |
0
|
public void testSetArray() {... |
69 |
|
} |
70 |
|
|
71 |
|
|
72 |
|
|
73 |
|
|
74 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
4
-
|
|
75 |
0
|
public void testPaginatorCriteria() throws Exception {... |
76 |
|
|
77 |
|
|
78 |
|
|
79 |
|
|
80 |
|
} |
81 |
|
|
82 |
|
|
83 |
|
|
84 |
|
|
85 |
|
|
86 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
4
-
|
|
87 |
0
|
public void testPaginatorCriteriaResultTransformer() throws Exception {... |
88 |
|
|
89 |
|
|
90 |
|
|
91 |
|
|
92 |
|
|
93 |
|
|
94 |
|
|
95 |
|
|
96 |
|
|
97 |
|
} |
98 |
|
|
99 |
|
|
100 |
|
|
101 |
|
|
102 |
|
|
|
|
| 0% |
Uncovered Elements: 25 (25) |
Complexity: 1 |
Complexity Density: 0,04 |
4
-
|
|
103 |
0
|
public void testPaginatorQuery() throws Exception {... |
104 |
|
|
105 |
0
|
Session session = factory.current(); |
106 |
0
|
Query query = session.createQuery("select u from User u"); |
107 |
0
|
Paginator paginator = factory.new Paginator(query, 20, 5); |
108 |
0
|
super.assertTrue(paginator.hasNext()); |
109 |
|
|
110 |
0
|
query = session.createQuery("select u from User u order by u.display"); |
111 |
0
|
paginator = factory.new Paginator(query, 20, 5); |
112 |
0
|
super.assertTrue(paginator.hasNext()); |
113 |
|
|
114 |
0
|
query = session.createQuery("select u from User u where u.username = :username"); |
115 |
0
|
query.setString("username", "test"); |
116 |
0
|
paginator = factory.new Paginator(query, 20, 5); |
117 |
0
|
super.assertTrue(paginator.hasNext()); |
118 |
|
|
119 |
0
|
query = session.createQuery("select u from User u where id=:id"); |
120 |
0
|
query.setInteger("id", 1); |
121 |
0
|
paginator = factory.new Paginator(query, 20, 5); |
122 |
0
|
super.assertTrue(paginator.hasNext()); |
123 |
|
|
124 |
0
|
query = session.createQuery("select u from User u join u.groups g where g.id=:group"); |
125 |
0
|
query.setInteger("group", 238); |
126 |
0
|
paginator = factory.new Paginator(query, 20, 5); |
127 |
0
|
super.assertTrue(paginator.hasNext()); |
128 |
|
|
129 |
0
|
query = session |
130 |
|
.createQuery("select u from User u join u.groups g where u.display like :partial and u.id=:id and g.id=:group"); |
131 |
0
|
query.setString("partial", "Amministrator%"); |
132 |
0
|
query.setInteger("id", 1); |
133 |
0
|
query.setInteger("group", 238); |
134 |
0
|
paginator = factory.new Paginator(query, 20, 5); |
135 |
0
|
super.assertTrue(paginator.hasNext()); |
136 |
|
} |
137 |
|
|
|
|
| 0% |
Uncovered Elements: 25 (25) |
Complexity: 1 |
Complexity Density: 0,04 |
4
-
|
|
138 |
0
|
public void testPaginatorSQLQuery() throws Exception {... |
139 |
0
|
Session session = factory.current(); |
140 |
|
|
141 |
0
|
Query query = session.createSQLQuery("select * from auth.user"); |
142 |
0
|
Paginator paginator = factory.new Paginator(query, 20, 5); |
143 |
0
|
super.assertTrue(paginator.hasNext()); |
144 |
|
|
145 |
0
|
query = session.createSQLQuery("select * from auth.user u order by u.display"); |
146 |
0
|
paginator = factory.new Paginator(query, 20, 5); |
147 |
0
|
super.assertTrue(paginator.hasNext()); |
148 |
|
|
149 |
0
|
query = session.createSQLQuery("select * from auth.user where display = ?"); |
150 |
0
|
query.setString(0, "test"); |
151 |
0
|
paginator = factory.new Paginator(query, 20, 5); |
152 |
0
|
super.assertTrue(paginator.hasNext()); |
153 |
|
|
154 |
0
|
query = session.createSQLQuery("select * from auth.user u where u.id=:id"); |
155 |
0
|
query.setInteger("id", 1); |
156 |
0
|
paginator = factory.new Paginator(query, 20, 5); |
157 |
0
|
super.assertTrue(paginator.hasNext()); |
158 |
|
|
159 |
0
|
query = session |
160 |
|
.createSQLQuery("SELECT * from auth.user u left join auth.group_user ug on ug.user=u.id where ug.group=:group"); |
161 |
0
|
query.setInteger("group", 238); |
162 |
0
|
paginator = factory.new Paginator(query, 20, 5); |
163 |
0
|
super.assertTrue(paginator.hasNext()); |
164 |
|
|
165 |
0
|
query = session |
166 |
|
.createSQLQuery("SELECT * from auth.user u left join auth.group_user ug on ug.user=u.id where u.display like :partial and u.id=:id and ug.group=:group"); |
167 |
0
|
query.setString("partial", "Amministrator%"); |
168 |
0
|
query.setInteger("id", 1); |
169 |
0
|
query.setInteger("group", 238); |
170 |
0
|
paginator = factory.new Paginator(query, 20, 5); |
171 |
0
|
super.assertTrue(paginator.hasNext()); |
172 |
|
} |
173 |
|
|
174 |
|
|
175 |
|
|
176 |
|
|
177 |
|
|
178 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
4
-
|
|
179 |
0
|
public void testPaginatorQueryIntInt() throws Exception {... |
180 |
|
|
181 |
|
|
182 |
|
|
183 |
|
|
184 |
|
|
185 |
|
|
186 |
|
|
187 |
|
|
188 |
|
|
189 |
|
|
190 |
|
|
191 |
|
|
192 |
|
|
193 |
|
|
194 |
|
|
195 |
|
|
196 |
|
} |
197 |
|
|
198 |
|
|
199 |
|
|
200 |
|
|
201 |
|
|
202 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
4
-
|
|
203 |
0
|
public void testPaginatorCriteriaIntInt() {... |
204 |
|
} |
205 |
|
|
206 |
|
|
207 |
|
|
208 |
|
|
209 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
4
-
|
|
210 |
0
|
public void testAdd() {... |
211 |
|
} |
212 |
|
|
213 |
|
|
214 |
|
|
215 |
|
|
216 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
4
-
|
|
217 |
0
|
public void testAddAll() {... |
218 |
|
} |
219 |
|
|
220 |
|
|
221 |
|
|
222 |
|
|
223 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
4
-
|
|
224 |
0
|
public void testClear() {... |
225 |
|
} |
226 |
|
|
227 |
|
|
228 |
|
|
229 |
|
|
230 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
4
-
|
|
231 |
0
|
public void testContains() {... |
232 |
|
} |
233 |
|
|
234 |
|
|
235 |
|
|
236 |
|
|
237 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
4
-
|
|
238 |
0
|
public void testContainsAll() {... |
239 |
|
} |
240 |
|
|
241 |
|
|
242 |
|
|
243 |
|
|
244 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
4
-
|
|
245 |
0
|
public void testIsEmpty() {... |
246 |
|
} |
247 |
|
|
248 |
|
|
249 |
|
|
250 |
|
|
251 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
4
-
|
|
252 |
0
|
public void testIterator() {... |
253 |
|
} |
254 |
|
|
255 |
|
|
256 |
|
|
257 |
|
|
258 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
4
-
|
|
259 |
0
|
public void testRemoveObject() {... |
260 |
|
} |
261 |
|
|
262 |
|
|
263 |
|
|
264 |
|
|
265 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
4
-
|
|
266 |
0
|
public void testRemoveAll() {... |
267 |
|
} |
268 |
|
|
269 |
|
|
270 |
|
|
271 |
|
|
272 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
4
-
|
|
273 |
0
|
public void testRetainAll() {... |
274 |
|
} |
275 |
|
|
276 |
|
|
277 |
|
|
278 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
4
-
|
|
279 |
0
|
public void testSize() {... |
280 |
|
} |
281 |
|
|
282 |
|
|
283 |
|
|
284 |
|
|
285 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
4
-
|
|
286 |
0
|
public void testToArray() {... |
287 |
|
} |
288 |
|
|
289 |
|
|
290 |
|
|
291 |
|
|
292 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
4
-
|
|
293 |
0
|
public void testToArrayObjectArray() {... |
294 |
|
} |
295 |
|
|
296 |
|
|
297 |
|
@see |
298 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
299 |
0
|
protected String getDataSetFile() {... |
300 |
0
|
return "res/auth.dat.xml"; |
301 |
|
} |
302 |
|
} |