You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@aries.apache.org by cs...@apache.org on 2019/09/11 13:15:51 UTC
[aries-jax-rs-whiteboard] 10/10: [ARIES-1928] Add new test
This is an automated email from the ASF dual-hosted git repository.
csierra pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/aries-jax-rs-whiteboard.git
commit 978eca4ab6906899dddb9530d20292b16e4a4871
Author: Carlos Sierra <cs...@apache.org>
AuthorDate: Wed Sep 11 14:17:00 2019 +0200
[ARIES-1928] Add new test
---
jax-rs.itests/src/main/java/test/JaxrsTest.java | 48 +++++++++++++++++++++++++
1 file changed, 48 insertions(+)
diff --git a/jax-rs.itests/src/main/java/test/JaxrsTest.java b/jax-rs.itests/src/main/java/test/JaxrsTest.java
index 094364a..8a147fa 100644
--- a/jax-rs.itests/src/main/java/test/JaxrsTest.java
+++ b/jax-rs.itests/src/main/java/test/JaxrsTest.java
@@ -685,6 +685,54 @@ public class JaxrsTest extends TestHelper {
}
@Test
+ public void testApplicationWithDedicatedErroredExtension()
+ throws InterruptedException {
+
+ assertEquals(0, getRuntimeDTO().applicationDTOs.length);
+ assertEquals(0, getRuntimeDTO().failedApplicationDTOs.length);
+
+ registerExtension(
+ Feature.class,
+ context -> {
+ throw new RuntimeException();
+ },
+ "ErrorFeature",
+ JAX_RS_APPLICATION_SELECT,
+ "(" + JAX_RS_APPLICATION_BASE + "=/test-application)");
+
+ registerApplication(
+ new TestApplication(),
+ JAX_RS_EXTENSION_SELECT,
+ String.format("(%s=%s)", JAX_RS_NAME, "ErrorFeature"));
+
+ assertEquals(1, getRuntimeDTO().failedExtensionDTOs.length);
+ assertEquals(1, getRuntimeDTO().failedApplicationDTOs.length);
+ assertEquals(0, getRuntimeDTO().applicationDTOs.length);
+
+ WebTarget webTarget = createDefaultTarget().path("/test-application");
+
+ Response response = webTarget.request().get();
+
+ assertEquals(404, response.getStatus());
+
+ registerExtension(
+ "ErrorFeature",
+ JAX_RS_APPLICATION_SELECT,
+ "(" + JAX_RS_APPLICATION_BASE + "=/test-application)",
+ "service.ranking", 10);
+
+ assertEquals(1, getRuntimeDTO().failedExtensionDTOs.length);
+ assertEquals(0, getRuntimeDTO().failedApplicationDTOs.length);
+ assertEquals(1, getRuntimeDTO().applicationDTOs.length);
+
+ webTarget = createDefaultTarget().path("/test-application");
+
+ response = webTarget.request().get();
+
+ assertEquals(200, response.getStatus());
+ }
+
+ @Test
public void testApplicationWithDependentExtensions() {
assertEquals(0, getRuntimeDTO().applicationDTOs.length);
assertEquals(0, getRuntimeDTO().failedApplicationDTOs.length);