diff options
author | Jim Hahn <jrh3@att.com> | 2021-08-20 09:50:44 -0400 |
---|---|---|
committer | Jim Hahn <jrh3@att.com> | 2021-08-20 09:51:12 -0400 |
commit | 2041c0c9113d060edc319be1e85386278ec9f79e (patch) | |
tree | face65b43a15974ceb36c6f79ab0ba08929bcbc8 /main/src/test/java/org | |
parent | ae16322f5dacc72a62797ce1ae2e665dba4028dd (diff) |
Revert "Leave xacml-pdp REST server always running"
This reverts commit 031a0fe51dff21445034befc8a6d8732622acd07.
Issue-ID: POLICY-3531
Change-Id: I20eddfc11589b6ab4822a93b8c8c3d3f209537c0
Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'main/src/test/java/org')
-rw-r--r-- | main/src/test/java/org/onap/policy/pdpx/main/XacmlStateTest.java | 3 | ||||
-rw-r--r-- | main/src/test/java/org/onap/policy/pdpx/main/startstop/TestXacmlPdpActivator.java | 32 |
2 files changed, 20 insertions, 15 deletions
diff --git a/main/src/test/java/org/onap/policy/pdpx/main/XacmlStateTest.java b/main/src/test/java/org/onap/policy/pdpx/main/XacmlStateTest.java index feaaf4f6..5ff3d5c7 100644 --- a/main/src/test/java/org/onap/policy/pdpx/main/XacmlStateTest.java +++ b/main/src/test/java/org/onap/policy/pdpx/main/XacmlStateTest.java @@ -26,6 +26,7 @@ import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import org.junit.AfterClass; @@ -129,10 +130,12 @@ public class XacmlStateTest { req.setState(PdpState.ACTIVE); status = state.updateInternalState(req); assertEquals(PdpState.ACTIVE, status.getState()); + verify(act).startXacmlRestController(); req.setState(PdpState.PASSIVE); status = state.updateInternalState(req); assertEquals(PdpState.PASSIVE, status.getState()); + verify(act).stopXacmlRestController(); } @Test diff --git a/main/src/test/java/org/onap/policy/pdpx/main/startstop/TestXacmlPdpActivator.java b/main/src/test/java/org/onap/policy/pdpx/main/startstop/TestXacmlPdpActivator.java index 9025722c..c874761d 100644 --- a/main/src/test/java/org/onap/policy/pdpx/main/startstop/TestXacmlPdpActivator.java +++ b/main/src/test/java/org/onap/policy/pdpx/main/startstop/TestXacmlPdpActivator.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2019, 2021 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -74,17 +74,6 @@ 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()); @@ -92,15 +81,17 @@ 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.stopXacmlRestController(); - assertFalse(activator.isXacmlRestControllerAlive()); - activator.startXacmlRestController(); assertTrue(activator.isXacmlRestControllerAlive()); + + activator.stopXacmlRestController(); + assertFalse(activator.isXacmlRestControllerAlive()); } @Test @@ -123,4 +114,15 @@ 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(); + } + } } |