|
22 | 22 | public class KafkaContextPropagationTest { |
23 | 23 |
|
24 | 24 | @Nested |
| 25 | + // FlowerResource |
25 | 26 | class ContextNotPropagated { |
26 | 27 | @Test |
27 | 28 | void testNonBlocking() { |
@@ -131,6 +132,7 @@ void testVirtualThreadUni() { |
131 | 132 | } |
132 | 133 |
|
133 | 134 | @Nested |
| 135 | + // FlowerContextualResource |
134 | 136 | class ContextPropagated { |
135 | 137 | @Test |
136 | 138 | void testNonBlocking() { |
@@ -192,63 +194,112 @@ void testVirtualThreadUni() { |
192 | 194 | } |
193 | 195 |
|
194 | 196 | @Nested |
195 | | - class MutinyContextPropagated { |
| 197 | + // FlowerMutinyResource |
| 198 | + class MutinyContextNotPropagated { |
196 | 199 | @Test |
197 | 200 | void testNonBlocking() { |
198 | | - given().body("rose").post("/flowers/mutiny").then().statusCode(204); |
199 | | - given().body("peony").post("/flowers/mutiny").then().statusCode(204); |
200 | | - given().body("daisy").post("/flowers/mutiny").then().statusCode(204); |
| 201 | + given().body("rose").post("/flowers/mutiny").then() |
| 202 | + .statusCode(500) |
| 203 | + .body(assertBodyRequestScopedContextWasNotActive()); |
| 204 | + given().body("peony").post("/flowers/mutiny").then() |
| 205 | + .statusCode(500) |
| 206 | + .body(assertBodyRequestScopedContextWasNotActive()); |
| 207 | + given().body("daisy").post("/flowers/mutiny").then() |
| 208 | + .statusCode(500) |
| 209 | + .body(assertBodyRequestScopedContextWasNotActive()); |
201 | 210 | } |
202 | 211 |
|
203 | 212 | @Test |
204 | 213 | void testNonBlockingUni() { |
205 | | - given().body("rose").post("/flowers/mutiny/uni").then().statusCode(204); |
206 | | - given().body("peony").post("/flowers/mutiny/uni").then().statusCode(204); |
207 | | - given().body("daisy").post("/flowers/mutiny/uni").then().statusCode(204); |
| 214 | + given().body("rose").post("/flowers/mutiny/uni").then() |
| 215 | + .statusCode(500) |
| 216 | + .body(assertBodyRequestScopedContextWasNotActive()); |
| 217 | + given().body("peony").post("/flowers/mutiny/uni").then() |
| 218 | + .statusCode(500) |
| 219 | + .body(assertBodyRequestScopedContextWasNotActive()); |
| 220 | + given().body("daisy").post("/flowers/mutiny/uni").then() |
| 221 | + .statusCode(500) |
| 222 | + .body(assertBodyRequestScopedContextWasNotActive()); |
208 | 223 | } |
209 | 224 |
|
210 | 225 | @Test |
211 | 226 | void testBlocking() { |
212 | | - given().body("rose").post("/flowers/mutiny/blocking").then().statusCode(204); |
213 | | - given().body("peony").post("/flowers/mutiny/blocking").then().statusCode(204); |
214 | | - given().body("daisy").post("/flowers/mutiny/blocking").then().statusCode(204); |
| 227 | + given().body("rose").post("/flowers/mutiny/blocking").then() |
| 228 | + .statusCode(500) |
| 229 | + .body(assertBodyRequestScopedContextWasNotActive()); |
| 230 | + given().body("peony").post("/flowers/mutiny/blocking").then() |
| 231 | + .statusCode(500) |
| 232 | + .body(assertBodyRequestScopedContextWasNotActive()); |
| 233 | + given().body("daisy").post("/flowers/mutiny/blocking").then() |
| 234 | + .statusCode(500) |
| 235 | + .body(assertBodyRequestScopedContextWasNotActive()); |
215 | 236 | } |
216 | 237 |
|
217 | 238 | @Test |
218 | 239 | void testBlockingUni() { |
219 | | - given().body("rose").post("/flowers/mutiny/uni/blocking").then().statusCode(204); |
220 | | - given().body("peony").post("/flowers/mutiny/uni/blocking").then().statusCode(204); |
221 | | - given().body("daisy").post("/flowers/mutiny/uni/blocking").then().statusCode(204); |
| 240 | + given().body("rose").post("/flowers/mutiny/uni/blocking").then() |
| 241 | + .statusCode(500) |
| 242 | + .body(assertBodyRequestScopedContextWasNotActive()); |
| 243 | + given().body("peony").post("/flowers/mutiny/uni/blocking").then() |
| 244 | + .statusCode(500) |
| 245 | + .body(assertBodyRequestScopedContextWasNotActive()); |
| 246 | + given().body("daisy").post("/flowers/mutiny/uni/blocking").then() |
| 247 | + .statusCode(500) |
| 248 | + .body(assertBodyRequestScopedContextWasNotActive()); |
222 | 249 | } |
223 | 250 |
|
224 | 251 | @Test |
225 | 252 | void testBlockingNamed() { |
226 | | - given().body("rose").post("/flowers/mutiny/blocking-named").then().statusCode(204); |
227 | | - given().body("peony").post("/flowers/mutiny/blocking-named").then().statusCode(204); |
228 | | - given().body("daisy").post("/flowers/mutiny/blocking-named").then().statusCode(204); |
| 253 | + given().body("rose").post("/flowers/mutiny/blocking-named").then() |
| 254 | + .statusCode(500) |
| 255 | + .body(assertBodyRequestScopedContextWasNotActive()); |
| 256 | + given().body("peony").post("/flowers/mutiny/blocking-named").then() |
| 257 | + .statusCode(500) |
| 258 | + .body(assertBodyRequestScopedContextWasNotActive()); |
| 259 | + given().body("daisy").post("/flowers/mutiny/blocking-named").then() |
| 260 | + .statusCode(500) |
| 261 | + .body(assertBodyRequestScopedContextWasNotActive()); |
229 | 262 | } |
230 | 263 |
|
231 | 264 | @Test |
232 | 265 | void testBlockingNamedUni() { |
233 | | - given().body("rose").post("/flowers/mutiny/uni/blocking-named").then().statusCode(204); |
234 | | - given().body("peony").post("/flowers/mutiny/uni/blocking-named").then().statusCode(204); |
235 | | - given().body("daisy").post("/flowers/mutiny/uni/blocking-named").then().statusCode(204); |
| 266 | + given().body("rose").post("/flowers/mutiny/uni/blocking-named").then() |
| 267 | + .statusCode(500) |
| 268 | + .body(assertBodyRequestScopedContextWasNotActive()); |
| 269 | + given().body("peony").post("/flowers/mutiny/uni/blocking-named").then() |
| 270 | + .statusCode(500) |
| 271 | + .body(assertBodyRequestScopedContextWasNotActive()); |
| 272 | + given().body("daisy").post("/flowers/mutiny/uni/blocking-named").then() |
| 273 | + .statusCode(500) |
| 274 | + .body(assertBodyRequestScopedContextWasNotActive()); |
236 | 275 | } |
237 | 276 |
|
238 | 277 | @Test |
239 | 278 | @EnabledForJreRange(min = JRE.JAVA_21) |
240 | 279 | void testVirtualThread() { |
241 | | - given().body("rose").post("/flowers/mutiny/virtual-thread").then().statusCode(204); |
242 | | - given().body("peony").post("/flowers/mutiny/virtual-thread").then().statusCode(204); |
243 | | - given().body("daisy").post("/flowers/mutiny/virtual-thread").then().statusCode(204); |
| 280 | + given().body("rose").post("/flowers/mutiny/virtual-thread").then() |
| 281 | + .statusCode(500) |
| 282 | + .body(assertBodyRequestScopedContextWasNotActive()); |
| 283 | + given().body("peony").post("/flowers/mutiny/virtual-thread").then() |
| 284 | + .statusCode(500) |
| 285 | + .body(assertBodyRequestScopedContextWasNotActive()); |
| 286 | + given().body("daisy").post("/flowers/mutiny/virtual-thread").then() |
| 287 | + .statusCode(500) |
| 288 | + .body(assertBodyRequestScopedContextWasNotActive()); |
244 | 289 | } |
245 | 290 |
|
246 | 291 | @Test |
247 | 292 | @EnabledForJreRange(min = JRE.JAVA_21) |
248 | 293 | void testVirtualThreadUni() { |
249 | | - given().body("rose").post("/flowers/mutiny/uni/virtual-thread").then().statusCode(204); |
250 | | - given().body("peony").post("/flowers/mutiny/uni/virtual-thread").then().statusCode(204); |
251 | | - given().body("daisy").post("/flowers/mutiny/uni/virtual-thread").then().statusCode(204); |
| 294 | + given().body("rose").post("/flowers/mutiny/uni/virtual-thread").then() |
| 295 | + .statusCode(500) |
| 296 | + .body(assertBodyRequestScopedContextWasNotActive()); |
| 297 | + given().body("peony").post("/flowers/mutiny/uni/virtual-thread").then() |
| 298 | + .statusCode(500) |
| 299 | + .body(assertBodyRequestScopedContextWasNotActive()); |
| 300 | + given().body("daisy").post("/flowers/mutiny/uni/virtual-thread").then() |
| 301 | + .statusCode(500) |
| 302 | + .body(assertBodyRequestScopedContextWasNotActive()); |
252 | 303 | } |
253 | 304 | } |
254 | 305 |
|
|
0 commit comments