1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
|
22 |
|
|
23 |
|
|
24 |
|
|
25 |
|
|
26 |
|
|
27 |
|
|
28 |
|
|
29 |
|
|
30 |
|
|
31 |
|
|
32 |
|
|
33 |
|
|
34 |
|
package info.magnolia.integrationtests.rest.delivery.jcr.v2; |
35 |
|
|
36 |
|
import static io.restassured.RestAssured.given; |
37 |
|
import static org.hamcrest.Matchers.*; |
38 |
|
import static org.hamcrest.core.IsNot.not; |
39 |
|
|
40 |
|
import org.junit.Test; |
41 |
|
|
42 |
|
|
43 |
|
|
44 |
|
|
45 |
|
@see |
46 |
|
|
|
|
| 0% |
Uncovered Elements: 62 (62) |
Complexity: 31 |
Complexity Density: 1 |
|
47 |
|
public class JcrDeliveryEndpointTest extends AbstractJcrDeliveryEndpointTest { |
48 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
4-
|
|
49 |
0 |
@Test... |
50 |
|
public void withoutBypassAcls() { |
51 |
0 |
given().when() |
52 |
|
.get("withoutBypassAcls/v1/travel") |
53 |
|
.then() |
54 |
|
.statusCode(404); |
55 |
|
} |
56 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
4-
|
|
57 |
0 |
@Test... |
58 |
|
public void withoutSystemProperties() { |
59 |
0 |
given().when() |
60 |
|
.get("withoutSystemProperties/v1/travel") |
61 |
|
.then() |
62 |
|
.statusCode(200) |
63 |
|
.body( |
64 |
|
"", allOf(hasKey("title"), not(hasKey("mgnl:lastModified"))) |
65 |
|
); |
66 |
|
} |
67 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
4-
|
|
68 |
0 |
@Test... |
69 |
|
public void readNode() { |
70 |
0 |
given().when() |
71 |
|
.get("default/v1/travel") |
72 |
|
.then() |
73 |
|
.statusCode(200) |
74 |
|
.body( |
75 |
|
"", allOf(hasKey("title"), hasKey("mgnl:lastModified")) |
76 |
|
); |
77 |
|
} |
78 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
4-
|
|
79 |
0 |
@Test... |
80 |
|
public void readNodesFromUnregisteredWorkspace() { |
81 |
0 |
given().when() |
82 |
|
.get("users/v1/travel") |
83 |
|
.then() |
84 |
|
.statusCode(404); |
85 |
|
} |
86 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
4-
|
|
87 |
0 |
@Test... |
88 |
|
public void readNodeWithConfiguredRootPath() { |
89 |
0 |
given().when() |
90 |
|
.get("rootPathConfigured/v1/about") |
91 |
|
.then() |
92 |
|
.statusCode(200) |
93 |
|
.body("@name", equalTo("about")); |
94 |
|
} |
95 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
4-
|
|
96 |
0 |
@Test... |
97 |
|
public void readNodeWithStrictMode() { |
98 |
0 |
given().when() |
99 |
|
.get("strict/v1/travel") |
100 |
|
.then() |
101 |
|
.statusCode(200) |
102 |
|
.body( |
103 |
|
"@nodes.size()", equalTo(1), |
104 |
|
"", hasKey("about") |
105 |
|
); |
106 |
|
} |
107 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
4-
|
|
108 |
0 |
@Test... |
109 |
|
public void readNodeWithConfiguredNodeTypes() { |
110 |
0 |
given().when() |
111 |
|
.get("areas/v1/travel") |
112 |
|
.then() |
113 |
|
.statusCode(404); |
114 |
|
} |
115 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
4-
|
|
116 |
0 |
@Test... |
117 |
|
public void readNodeWithConfiguredChildNodeTypes() { |
118 |
0 |
given().when() |
119 |
|
.get("childNodeTypesConfigured/v1/travel") |
120 |
|
.then() |
121 |
|
.statusCode(200) |
122 |
|
.body( |
123 |
|
"about.@name", equalTo("about") |
124 |
|
); |
125 |
|
} |
126 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
4-
|
|
127 |
0 |
@Test... |
128 |
|
public void readNodeWithFolderAsConfiguredNodeTypeReturnFolder() { |
129 |
0 |
given().when() |
130 |
|
.get("folderAsNodeTypesConfigured/v1/folderTests") |
131 |
|
.then() |
132 |
|
.statusCode(200) |
133 |
|
.body( |
134 |
|
"@name", equalTo("folderTests") |
135 |
|
); |
136 |
|
} |
137 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
4-
|
|
138 |
0 |
@Test... |
139 |
|
public void readNodeWithDepth0() { |
140 |
0 |
given().when() |
141 |
|
.get("default/v1/travel") |
142 |
|
.then() |
143 |
|
.statusCode(200) |
144 |
|
.body( |
145 |
|
"@name", equalTo("travel"), |
146 |
|
"@nodes", empty() |
147 |
|
); |
148 |
|
} |
149 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
4-
|
|
150 |
0 |
@Test... |
151 |
|
public void readNodeWithDepth1() { |
152 |
0 |
given().when() |
153 |
|
.get("depth1/v1/travel") |
154 |
|
.then() |
155 |
|
.statusCode(200) |
156 |
|
.body( |
157 |
|
"@name", equalTo("travel"), |
158 |
|
"@nodes", not(empty()), |
159 |
|
"main.@nodes", empty(), |
160 |
|
"main", not(hasKey("0")), |
161 |
|
"footer.@nodes", empty() |
162 |
|
); |
163 |
|
} |
164 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
4-
|
|
165 |
0 |
@Test... |
166 |
|
public void readNodeWithDepth2() { |
167 |
0 |
given().when() |
168 |
|
.get("depth2/v1/travel") |
169 |
|
.then() |
170 |
|
.statusCode(200) |
171 |
|
.body( |
172 |
|
"@name", equalTo("travel"), |
173 |
|
"@nodes", not(empty()), |
174 |
|
"main.@nodes", not(empty()), |
175 |
|
"main", hasKey("0"), |
176 |
|
"footer.@nodes", empty() |
177 |
|
); |
178 |
|
} |
179 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
4-
|
|
180 |
0 |
@Test... |
181 |
|
public void dateTimeShouldBeISO8601() { |
182 |
0 |
given().when() |
183 |
|
.get("default/v1/travel") |
184 |
|
.then() |
185 |
|
.statusCode(200) |
186 |
|
.body( |
187 |
|
"'mgnl:created'", equalTo("2018-01-01T10:26:43.630+07:00"), |
188 |
|
"'mgnl:lastModified'", equalTo("2018-12-01T13:47:21.051+07:00") |
189 |
|
); |
190 |
|
} |
191 |
|
|
192 |
|
|
193 |
|
|
194 |
|
|
195 |
|
|
196 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
4-
|
|
197 |
|
@Test... |
198 |
|
public void getChildrenOfRoot() { |
199 |
|
given().when() |
200 |
|
.urlEncodingEnabled(false) |
201 |
|
.get("getChildrenOfRoot/v1/@nodes") |
202 |
|
.then() |
203 |
|
.statusCode(200) |
204 |
|
.body( |
205 |
|
"@name", hasItem("travel"), |
206 |
|
"about.@name", hasItem("about") |
207 |
|
); |
208 |
|
} |
209 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
4-
|
|
210 |
|
@Test... |
211 |
|
public void getChildrenUnderPathParam() { |
212 |
|
given().when() |
213 |
|
.urlEncodingEnabled(false) |
214 |
|
.get("getChildrenOfRoot/v1/travel/@nodes") |
215 |
|
.then() |
216 |
|
.statusCode(200) |
217 |
|
.body( |
218 |
|
"@name", hasItem("about"), |
219 |
|
"company.@name", hasItem("company") |
220 |
|
); |
221 |
|
} |
222 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
4-
|
|
223 |
|
@Test... |
224 |
|
public void getChildrenUnderConfiguredRootPath() { |
225 |
|
given().when() |
226 |
|
.urlEncodingEnabled(false) |
227 |
|
.get("getChildrenUnderConfiguredRootPath/v1/@nodes") |
228 |
|
.then() |
229 |
|
.statusCode(200) |
230 |
|
.body( |
231 |
|
"@name", hasItem("about"), |
232 |
|
"company.@name", hasItem("company") |
233 |
|
); |
234 |
|
} |
235 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
4-
|
|
236 |
|
@Test... |
237 |
|
public void getChildrenUnderConfiguredRootPathAndPathParam() { |
238 |
|
given().when() |
239 |
|
.urlEncodingEnabled(false) |
240 |
|
.get("getChildrenUnderConfiguredRootPath/v1/about/@nodes") |
241 |
|
.then() |
242 |
|
.statusCode(200) |
243 |
|
.body( |
244 |
|
"@name", hasItem("company") |
245 |
|
); |
246 |
|
} |
247 |
|
|
248 |
|
|
249 |
|
|
250 |
|
|
251 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
4-
|
|
252 |
0 |
@Test... |
253 |
|
public void queryNodes() { |
254 |
0 |
given().when() |
255 |
|
.get("default/v1") |
256 |
|
.then() |
257 |
|
.statusCode(200) |
258 |
|
.body( |
259 |
|
"results.@name", containsInAnyOrder("company", "about", "travel") |
260 |
|
); |
261 |
|
} |
262 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
4-
|
|
263 |
0 |
@Test... |
264 |
|
public void queryNodesWithConfiguredRootPath() { |
265 |
0 |
given().when() |
266 |
|
.get("rootPathConfiguredForQuery/v1") |
267 |
|
.then() |
268 |
|
.statusCode(200) |
269 |
|
.body( |
270 |
|
"results.@name", containsInAnyOrder("about", "company") |
271 |
|
); |
272 |
|
} |
273 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
4-
|
|
274 |
0 |
@Test... |
275 |
|
public void queryNodesWithStrictMode() { |
276 |
0 |
given().when() |
277 |
|
.get("strict/v1") |
278 |
|
.then() |
279 |
|
.statusCode(200) |
280 |
|
.root("results") |
281 |
|
.body( |
282 |
|
"@name", containsInAnyOrder("about", "company", "travel"), |
283 |
|
"[0].@nodes", empty(), |
284 |
|
"[1].@nodes.size()", equalTo(1), |
285 |
|
"[1]", hasKey("company"), |
286 |
|
"[2].@nodes.size()", equalTo(1), |
287 |
|
"[2]", hasKey("about") |
288 |
|
); |
289 |
|
} |
290 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
4-
|
|
291 |
0 |
@Test... |
292 |
|
public void queryNodesWithConfiguredNodeTypes() { |
293 |
0 |
given().when() |
294 |
|
.get("pages/v1") |
295 |
|
.then() |
296 |
|
.statusCode(200) |
297 |
|
.body( |
298 |
|
"results.@name", containsInAnyOrder("about", "company", "travel") |
299 |
|
); |
300 |
|
} |
301 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
4-
|
|
302 |
0 |
@Test... |
303 |
|
public void queryNodesWithConfiguredNodeTypesAndChildNodeTypes() { |
304 |
0 |
given().when() |
305 |
|
.get("pagesAndMore/v1") |
306 |
|
.then() |
307 |
|
.statusCode(200) |
308 |
|
.body("results.size()", equalTo(3)) |
309 |
|
.body("results.@name", containsInAnyOrder("about", "company", "travel")) |
310 |
|
.body("results.@nodes", not(empty())) |
311 |
|
.body("results", everyItem(allOf(hasKey("main"), hasKey("footer")))); |
312 |
|
} |
313 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
4-
|
|
314 |
0 |
@Test... |
315 |
|
public void queryNodesWithFolderAsConfiguredNodeTypeReturnFolder() { |
316 |
0 |
given().when() |
317 |
|
.get("folderAsNodeTypesConfigured/v1") |
318 |
|
.then() |
319 |
|
.statusCode(200) |
320 |
|
.body("results.@name", containsInAnyOrder("folderTests", "folder1", "folder2")) |
321 |
|
.body("results.@name", not(containsInAnyOrder("node1"))) |
322 |
|
.body("results.@id", not(containsInAnyOrder("cafebabe-cafe-babe-cafe-babecafebabe"))); |
323 |
|
} |
324 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
4-
|
|
325 |
0 |
@Test... |
326 |
|
public void offset() { |
327 |
0 |
given().param("orderBy", "@name") |
328 |
|
.param("offset", 1) |
329 |
|
.when() |
330 |
|
.get("pages/v1") |
331 |
|
.then() |
332 |
|
.statusCode(200) |
333 |
|
.body( |
334 |
|
"results.@name", containsInAnyOrder("company", "travel") |
335 |
|
); |
336 |
|
} |
337 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
4-
|
|
338 |
0 |
@Test... |
339 |
|
public void limit() { |
340 |
0 |
given().param("limit", 2) |
341 |
|
.when() |
342 |
|
.get("pages/v1") |
343 |
|
.then() |
344 |
|
.statusCode(200) |
345 |
|
.body("results.size()", equalTo(2)); |
346 |
|
} |
347 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
4-
|
|
348 |
0 |
@Test... |
349 |
|
public void offsetAndLimit() { |
350 |
0 |
given().param("orderBy", "@name") |
351 |
|
.param("offset", 1) |
352 |
|
.param("limit", 2) |
353 |
|
.when() |
354 |
|
.get("pages/v1") |
355 |
|
.then() |
356 |
|
.statusCode(200) |
357 |
|
.body( |
358 |
|
"results.@name", containsInAnyOrder("company", "travel") |
359 |
|
); |
360 |
|
} |
361 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
4-
|
|
362 |
0 |
@Test... |
363 |
|
public void orderByName() { |
364 |
0 |
given().param("orderBy", "@name desc") |
365 |
|
.when() |
366 |
|
.get("pages/v1") |
367 |
|
.then() |
368 |
|
.statusCode(200) |
369 |
|
.body( |
370 |
|
"results.@name", contains("travel", "company", "about") |
371 |
|
); |
372 |
|
} |
373 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
4-
|
|
374 |
0 |
@Test... |
375 |
|
public void orderByTwoProperties() { |
376 |
0 |
given().param("orderBy", "@name desc,mgnl:created desc") |
377 |
|
.when() |
378 |
|
.get("areas/v1") |
379 |
|
.then() |
380 |
|
.statusCode(200) |
381 |
|
.body( |
382 |
|
"results.@path", contains( |
383 |
|
"/travel/about/company/main", |
384 |
|
"/travel/main", |
385 |
|
"/travel/about/main", |
386 |
|
"/travel/about/company/footer", |
387 |
|
"/travel/footer", |
388 |
|
"/travel/about/footer" |
389 |
|
)); |
390 |
|
} |
391 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
4-
|
|
392 |
0 |
@Test... |
393 |
|
public void orderByTwoPropertiesWithDefaultDirections() { |
394 |
0 |
given().param("orderBy", "@name asc,mgnl:lastModified") |
395 |
|
.when() |
396 |
|
.get("areas/v1") |
397 |
|
.then() |
398 |
|
.statusCode(200) |
399 |
|
.body( |
400 |
|
"results.@path", contains( |
401 |
|
"/travel/footer", |
402 |
|
"/travel/about/footer", |
403 |
|
"/travel/about/company/footer", |
404 |
|
"/travel/about/main", |
405 |
|
"/travel/main", |
406 |
|
"/travel/about/company/main" |
407 |
|
)); |
408 |
|
} |
409 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
4-
|
|
410 |
0 |
@Test... |
411 |
|
public void fullTextSearch() { |
412 |
0 |
given().param("q", "travel") |
413 |
|
.when() |
414 |
|
.get("pages/v1") |
415 |
|
.then() |
416 |
|
.statusCode(200) |
417 |
|
.body( |
418 |
|
"results.@name", contains("travel") |
419 |
|
); |
420 |
|
} |
421 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
4-
|
|
422 |
0 |
@Test... |
423 |
|
public void fullTextSearchAnNonexistentString() { |
424 |
0 |
given().param("q", "something") |
425 |
|
.when() |
426 |
|
.get("pages/v1") |
427 |
|
.then() |
428 |
|
.statusCode(200) |
429 |
|
.body("results.size()", equalTo(0)); |
430 |
|
} |
431 |
|
|
432 |
|
|
433 |
|
|
434 |
|
|
435 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
4-
|
|
436 |
0 |
@Test... |
437 |
|
public void filterByTitle() { |
438 |
0 |
given().param("title", "Travel Home") |
439 |
|
.when() |
440 |
|
.get("pages/v1") |
441 |
|
.then() |
442 |
|
.statusCode(200) |
443 |
|
.body( |
444 |
|
"results.@name", contains("travel") |
445 |
|
); |
446 |
|
} |
447 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
4-
|
|
448 |
0 |
@Test... |
449 |
|
public void filterByName() { |
450 |
0 |
given().param("@name", "about") |
451 |
|
.when() |
452 |
|
.get("pages/v1") |
453 |
|
.then() |
454 |
|
.statusCode(200) |
455 |
|
.body( |
456 |
|
"results.@name", contains("about") |
457 |
|
); |
458 |
|
} |
459 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
4-
|
|
460 |
0 |
@Test... |
461 |
|
public void filterByAncestor() { |
462 |
0 |
given().param("@ancestor", "/travel") |
463 |
|
.when() |
464 |
|
.get("pages/v1") |
465 |
|
.then() |
466 |
|
.statusCode(200) |
467 |
|
.body( |
468 |
|
"results.@name", containsInAnyOrder("about", "company") |
469 |
|
); |
470 |
|
} |
471 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
4-
|
|
472 |
0 |
@Test... |
473 |
|
public void filterByMultiValueProperty() { |
474 |
0 |
given().param("title", "Travel Home|Our Company") |
475 |
|
.when() |
476 |
|
.get("pages/v1") |
477 |
|
.then() |
478 |
|
.statusCode(200) |
479 |
|
.body( |
480 |
|
"results.@name", containsInAnyOrder("company", "travel") |
481 |
|
); |
482 |
|
} |
483 |
|
} |