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.CoreMatchers.not; |
38 |
|
import static org.hamcrest.Matchers.*; |
39 |
|
|
40 |
|
import org.junit.Test; |
41 |
|
|
42 |
|
import io.restassured.builder.ResponseSpecBuilder; |
43 |
|
import io.restassured.specification.ResponseSpecification; |
44 |
|
|
|
|
| 0% |
Uncovered Elements: 22 (22) |
Complexity: 11 |
Complexity Density: 1 |
|
45 |
|
public class AssetReferenceResolverTest extends AbstractJcrDeliveryEndpointTest { |
46 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
4-
|
|
47 |
0 |
@Test... |
48 |
|
public void assetHasResolved() { |
49 |
0 |
given().expect() |
50 |
|
.spec(expandedAssetSpec()) |
51 |
|
.spec(expandedAssetLinkSpec()) |
52 |
|
.spec(expandedAssetMetadataSpec()) |
53 |
|
.when() |
54 |
|
.get("assetReferenceNonConfigurable/v1/imageAsset"); |
55 |
|
} |
56 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
4-
|
|
57 |
0 |
@Test... |
58 |
|
public void assetHasExpanded() { |
59 |
0 |
given().expect() |
60 |
|
.spec(expandedAssetSpec()) |
61 |
|
.spec(expandedAssetLinkSpec()) |
62 |
|
.spec(expandedAssetMetadataSpec()) |
63 |
|
.when() |
64 |
|
.get("assetReference/v1/imageAsset") |
65 |
|
.then() |
66 |
|
.body(not(hasKey("image.renditions"))); |
67 |
|
} |
68 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
4-
|
|
69 |
0 |
@Test... |
70 |
|
public void assetDisabledResolving() { |
71 |
0 |
given().when() |
72 |
|
.get("assetReferenceDisabledAll/v1/imageAsset") |
73 |
|
.then() |
74 |
|
.body("image", equalTo("jcr:d01deefa-dba9-4708-8cfa-604320720253")); |
75 |
|
} |
76 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
4-
|
|
77 |
0 |
@Test... |
78 |
|
public void assetHasExpandedWithoutMetadata() { |
79 |
0 |
given().expect() |
80 |
|
.spec(expandedAssetSpec()) |
81 |
|
.spec(expandedAssetLinkSpec()) |
82 |
|
.when() |
83 |
|
.get("assetReferenceDisabledMetadata/v1/imageAsset") |
84 |
|
.then() |
85 |
|
.body(not(hasKey("image.metadata"))); |
86 |
|
} |
87 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
4-
|
|
88 |
0 |
@Test... |
89 |
|
public void assetHasExpandedWithoutDownloadLink() { |
90 |
0 |
given().expect() |
91 |
|
.spec(expandedAssetSpec()) |
92 |
|
.spec(expandedAssetMetadataSpec()) |
93 |
|
.when() |
94 |
|
.get("assetReferenceDisabledLink/v1/imageAsset") |
95 |
|
.then() |
96 |
|
.body("", not(hasKey("@link"))); |
97 |
|
} |
98 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
4-
|
|
99 |
0 |
@Test... |
100 |
|
public void assetDisabledExpandingButIncludesDownloadLink() { |
101 |
0 |
given().when() |
102 |
|
.get("assetReferenceDisabledExpand/v1/imageAsset") |
103 |
|
.then() |
104 |
|
.body("image", equalTo("/magnoliaTest/dam/jcr:d01deefa-dba9-4708-8cfa-604320720253/flickr-surfer-mandolin-373088839_7da451ccc8_b.jpg")); |
105 |
|
} |
106 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
4-
|
|
107 |
0 |
@Test... |
108 |
|
public void assetExpandedWithRenditions() { |
109 |
0 |
given().expect() |
110 |
|
.spec(expandedAssetSpec()) |
111 |
|
.spec(expandedAssetRenditionsSpec()) |
112 |
|
.when() |
113 |
|
.get("assetReferenceIncludeRenditions/v1/imageAsset"); |
114 |
|
} |
115 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
116 |
0 |
private ResponseSpecification expandedAssetSpec() {... |
117 |
0 |
return new ResponseSpecBuilder() |
118 |
|
.expectStatusCode(200) |
119 |
|
.rootPath("image") |
120 |
|
.expectBody("@name", equalTo("flickr-surfer-mandolin-373088839_7da451ccc8_b.jpg")) |
121 |
|
.expectBody("@path", equalTo("/flickr-surfer-mandolin-373088839_7da451ccc8_b/flickr-surfer-mandolin-373088839_7da451ccc8_b.jpg")) |
122 |
|
.expectBody("@id", equalTo("jcr:d01deefa-dba9-4708-8cfa-604320720253")) |
123 |
|
.build(); |
124 |
|
} |
125 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
126 |
0 |
private ResponseSpecification expandedAssetLinkSpec() {... |
127 |
0 |
return new ResponseSpecBuilder() |
128 |
|
.expectStatusCode(200) |
129 |
|
.expectBody("image.@link", equalTo("/magnoliaTest/dam/jcr:d01deefa-dba9-4708-8cfa-604320720253/flickr-surfer-mandolin-373088839_7da451ccc8_b.jpg")) |
130 |
|
.build(); |
131 |
|
} |
132 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
133 |
0 |
private ResponseSpecification expandedAssetMetadataSpec() {... |
134 |
0 |
return new ResponseSpecBuilder() |
135 |
|
.expectStatusCode(200) |
136 |
|
.rootPath("image.metadata") |
137 |
|
.expectBody("fileSize", equalTo("327927")) |
138 |
|
.expectBody("mimeType", equalTo("image/jpeg")) |
139 |
|
.expectBody("caption", equalTo("Mandolin")) |
140 |
|
.expectBody("fileSize", equalTo("327927")) |
141 |
|
.expectBody("height", equalTo("681")) |
142 |
|
.expectBody("width", equalTo("1024")) |
143 |
|
.expectBody("format", equalTo("image/jpeg")) |
144 |
|
.expectBody("rights", equalTo("by-sa/2.0/")) |
145 |
|
.build(); |
146 |
|
} |
147 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
148 |
0 |
private ResponseSpecification expandedAssetRenditionsSpec() {... |
149 |
0 |
return new ResponseSpecBuilder() |
150 |
|
.expectStatusCode(200) |
151 |
|
.rootPath("image.renditions") |
152 |
|
.expectBody("1600.link", equalTo("/magnoliaTest/.imaging/mte/fallback/1600/dam/flickr-surfer-mandolin-373088839_7da451ccc8_b/flickr-surfer-mandolin-373088839_7da451ccc8_b.jpg/jcr:content/flickr-surfer-mandolin-373088839_7da451ccc8_b.jpg")) |
153 |
|
.expectBody("1600x1200.link", equalTo("/magnoliaTest/.imaging/mte/fallback/1600x1200/dam/flickr-surfer-mandolin-373088839_7da451ccc8_b/flickr-surfer-mandolin-373088839_7da451ccc8_b.jpg/jcr:content/flickr-surfer-mandolin-373088839_7da451ccc8_b.jpg")) |
154 |
|
.expectBody("nonExisting.link", equalTo("/magnoliaTest/.imaging/default/dam/flickr-surfer-mandolin-373088839_7da451ccc8_b/flickr-surfer-mandolin-373088839_7da451ccc8_b.jpg/jcr:content.jpg")) |
155 |
|
.build(); |
156 |
|
} |
157 |
|
} |