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/05/22 15:40:39 UTC

[aries-jax-rs-whiteboard] branch master updated: Add test for dependent extensions

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


The following commit(s) were added to refs/heads/master by this push:
     new c523979  Add test for dependent extensions
c523979 is described below

commit c523979182484adbf9d0584b7cb01c984c5b36bc
Author: Carlos Sierra <cs...@apache.org>
AuthorDate: Wed May 22 16:35:08 2019 +0200

    Add test for dependent extensions
---
 jax-rs.itests/src/main/java/test/JaxrsTest.java | 46 +++++++++++++++++++++++++
 1 file changed, 46 insertions(+)

diff --git a/jax-rs.itests/src/main/java/test/JaxrsTest.java b/jax-rs.itests/src/main/java/test/JaxrsTest.java
index 85269e0..1f61953 100644
--- a/jax-rs.itests/src/main/java/test/JaxrsTest.java
+++ b/jax-rs.itests/src/main/java/test/JaxrsTest.java
@@ -680,6 +680,52 @@ public class JaxrsTest extends TestHelper {
     }
 
     @Test
+    public void testApplicationWithDependentExtensions() {
+        assertEquals(0, getRuntimeDTO().applicationDTOs.length);
+        assertEquals(0, getRuntimeDTO().failedApplicationDTOs.length);
+
+        registerExtension(
+            "Filter1",
+            JAX_RS_APPLICATION_SELECT,
+            String.format("(%s=%s)", "extension.test", "true"),
+            JAX_RS_EXTENSION_SELECT,
+            new String[]{
+                String.format("(%s=%s)", JAX_RS_NAME, "Filter2"),
+                String.format("(%s=%s)", JAX_RS_NAME, "Filter3")
+            });
+
+        assertEquals(1, getRuntimeDTO().failedExtensionDTOs.length);
+
+        registerApplication(new TestApplication(), "extension.test", "true");
+
+        assertEquals(1, getRuntimeDTO().failedExtensionDTOs.length);
+
+        registerExtension(
+            "Filter2", JAX_RS_APPLICATION_SELECT, "(extension.test=true)");
+
+        assertEquals(1, getRuntimeDTO().failedExtensionDTOs.length);
+
+        registerExtension(
+            "Filter3",
+            JAX_RS_APPLICATION_SELECT,
+            "(&(extension.test=true)(!(excluded=true)))");
+
+        assertEquals(0, getRuntimeDTO().failedExtensionDTOs.length);
+
+        ServiceRegistration<Application> applicationServiceRegistration =
+            registerApplication(
+                new TestApplication(),
+                JAX_RS_APPLICATION_BASE, "/test-application2",
+                "extension.test", "true", "excluded", "true");
+
+        assertEquals(1, getRuntimeDTO().failedExtensionDTOs.length);
+
+        applicationServiceRegistration.unregister();
+
+        assertEquals(0, getRuntimeDTO().failedExtensionDTOs.length);
+    }
+
+    @Test
     public void testApplicationWithError() throws InterruptedException {
         RuntimeDTO runtimeDTO = getRuntimeDTO();