Leave xacml-pdp REST server always running
[policy/xacml-pdp.git] / main / src / test / java / org / onap / policy / pdpx / main / startstop / TestXacmlPdpActivator.java
index bb814d3..4286ccf 100644 (file)
@@ -1,6 +1,6 @@
 /*-
  * ============LICENSE_START=======================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019, 2021 AT&T Intellectual Property. All rights reserved.
  * Modifications Copyright (C) 2019 Nordix Foundation.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -70,6 +70,17 @@ public class TestXacmlPdpActivator extends CommonRest {
         activator = new XacmlPdpActivator(parGroup);
     }
 
+    /**
+     * Teardown tests.
+     * @throws PolicyXacmlPdpException on termination errors
+     */
+    @After
+    public void teardown() throws PolicyXacmlPdpException {
+        if (activator != null && activator.isAlive()) {
+            activator.stop();
+        }
+    }
+
     @Test
     public void testXacmlPdpActivator() throws Exception {
         assertFalse(activator.isAlive());
@@ -77,17 +88,15 @@ public class TestXacmlPdpActivator extends CommonRest {
         activator.start();
         assertTrue(activator.isAlive());
 
-        // XacmlPdp starts in PASSIVE state so the rest controller should not be alive
-        assertFalse(activator.isXacmlRestControllerAlive());
         assertTrue(activator.getParameterGroup().isValid());
         assertEquals(CommonTestData.PDPX_PARAMETER_GROUP_NAME, activator.getParameterGroup().getName());
         assertEquals(CommonTestData.PDPX_GROUP, activator.getParameterGroup().getPdpGroup());
 
-        activator.startXacmlRestController();
-        assertTrue(activator.isXacmlRestControllerAlive());
-
         activator.stopXacmlRestController();
         assertFalse(activator.isXacmlRestControllerAlive());
+
+        activator.startXacmlRestController();
+        assertTrue(activator.isXacmlRestControllerAlive());
     }
 
     @Test
@@ -102,15 +111,4 @@ public class TestXacmlPdpActivator extends CommonRest {
         activator.stop();
         assertFalse(activator.isAlive());
     }
-
-    /**
-     * Teardown tests.
-     * @throws PolicyXacmlPdpException on termination errors
-     */
-    @After
-    public void teardown() throws PolicyXacmlPdpException {
-        if (activator != null && activator.isAlive()) {
-            activator.stop();
-        }
-    }
 }