Repository: aries-jax-rs-whiteboard
Updated Branches:
  refs/heads/master 7a18a1da7 -> e6dfab21c


Add test for application in error with high ranking


Project: http://git-wip-us.apache.org/repos/asf/aries-jax-rs-whiteboard/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/aries-jax-rs-whiteboard/commit/a915970e
Tree: 
http://git-wip-us.apache.org/repos/asf/aries-jax-rs-whiteboard/tree/a915970e
Diff: 
http://git-wip-us.apache.org/repos/asf/aries-jax-rs-whiteboard/diff/a915970e

Branch: refs/heads/master
Commit: a915970e0196205734202bc5037b70217a852708
Parents: 7a18a1d
Author: Carlos Sierra <[email protected]>
Authored: Thu Nov 9 14:27:54 2017 +0100
Committer: Carlos Sierra <[email protected]>
Committed: Thu Nov 9 14:27:54 2017 +0100

----------------------------------------------------------------------
 jax-rs.itests/src/main/java/test/JaxrsTest.java | 59 ++++++++++++++++++++
 1 file changed, 59 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/aries-jax-rs-whiteboard/blob/a915970e/jax-rs.itests/src/main/java/test/JaxrsTest.java
----------------------------------------------------------------------
diff --git a/jax-rs.itests/src/main/java/test/JaxrsTest.java 
b/jax-rs.itests/src/main/java/test/JaxrsTest.java
index 1cdee14..845bf93 100644
--- a/jax-rs.itests/src/main/java/test/JaxrsTest.java
+++ b/jax-rs.itests/src/main/java/test/JaxrsTest.java
@@ -598,6 +598,63 @@ public class JaxrsTest extends TestHelper {
     }
 
     @Test
+    public void testApplicationWithErrorAndHigherRanking() {
+
+        RuntimeDTO runtimeDTO = getRuntimeDTO();
+
+        assertEquals(0, runtimeDTO.applicationDTOs.length);
+        assertEquals(0, runtimeDTO.failedApplicationDTOs.length);
+
+        ServiceRegistration<Application> applicationRegistration =
+            registerApplication(new TestApplication());
+
+        runtimeDTO = getRuntimeDTO();
+
+        assertEquals(1, runtimeDTO.applicationDTOs.length);
+        assertEquals(0, runtimeDTO.failedApplicationDTOs.length);
+
+        ServiceRegistration<?> erroredRegistration = registerApplication(
+            new TestApplication() {
+
+                @Override
+                public Set<Object> getSingletons() {
+                    throw new RuntimeException();
+                }
+
+            }, "service.ranking", 10);
+
+        runtimeDTO = getRuntimeDTO();
+
+        assertEquals(1, runtimeDTO.applicationDTOs.length);
+        assertEquals(1, runtimeDTO.failedApplicationDTOs.length);
+        assertEquals(
+            DTOConstants.FAILURE_REASON_UNKNOWN,
+            runtimeDTO.failedApplicationDTOs[0].failureReason);
+
+        assertEquals(
+            applicationRegistration.getReference().getProperty("service.id"),
+            runtimeDTO.applicationDTOs[0].serviceId);
+        assertEquals(
+            erroredRegistration.getReference().getProperty("service.id"),
+            runtimeDTO.failedApplicationDTOs[0].serviceId);
+
+        WebTarget webTarget = createDefaultTarget().path("/test-application");
+
+        assertEquals(200, webTarget.request().get().getStatus());
+        assertEquals("Hello application ", 
webTarget.request().get(String.class));
+
+        erroredRegistration.unregister();
+
+        runtimeDTO = getRuntimeDTO();
+
+        assertEquals(1, runtimeDTO.applicationDTOs.length);
+        assertEquals(0, runtimeDTO.failedApplicationDTOs.length);
+        assertEquals(
+            applicationRegistration.getReference().getProperty("service.id"),
+            runtimeDTO.applicationDTOs[0].serviceId);
+    }
+
+    @Test
     public void testApplicationWithExtensionDryRun()
         throws InterruptedException {
 
@@ -1315,6 +1372,8 @@ public class JaxrsTest extends TestHelper {
         assertEquals(0, runtimeDTO.failedExtensionDTOs.length);
     }
 
+
+
     private JaxRSServiceRuntime getJaxRSServiceRuntime()
         throws InterruptedException {
 

Reply via email to