diff options
author | Jim Hahn <jrh3@att.com> | 2021-06-28 14:47:42 -0400 |
---|---|---|
committer | Jim Hahn <jrh3@att.com> | 2021-06-28 15:39:29 -0400 |
commit | ab0c6ca485c20fea9bcf894d27e0935afda17042 (patch) | |
tree | 86c9a56df7980ee4bdff07e1914270af720373b3 /main/src/test | |
parent | 73a1fc6e402766662095de653d8520f0523bd9e1 (diff) |
Use unique name in xacml-pdp PdpStatus messages
Added unique name to PdpStatus and HealthCheckReports.
Issue-ID: POLICY-3410
Change-Id: Ife2248ffee9afae76f3eaab7f8b33dba8bdb4019
Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'main/src/test')
-rw-r--r-- | main/src/test/java/org/onap/policy/pdpx/main/XacmlStateTest.java | 11 | ||||
-rw-r--r-- | main/src/test/java/org/onap/policy/pdpx/main/rest/TestXacmlPdpRestServer.java | 5 |
2 files changed, 8 insertions, 8 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 43ccab04..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 @@ -35,7 +35,6 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.junit.MockitoJUnitRunner; -import org.onap.policy.common.utils.network.NetworkUtil; import org.onap.policy.models.pdp.concepts.PdpResponseDetails; import org.onap.policy.models.pdp.concepts.PdpStateChange; import org.onap.policy.models.pdp.concepts.PdpStatus; @@ -59,7 +58,7 @@ public class XacmlStateTest { @Mock private XacmlPdpActivator act; - private String hostName; + private String pdpName; private XacmlState state; @@ -68,7 +67,7 @@ public class XacmlStateTest { */ @Before public void setUp() { - hostName = NetworkUtil.getHostname(); + pdpName = XacmlState.PDP_NAME; XacmlPdpActivator.setCurrent(act); @@ -85,7 +84,7 @@ public class XacmlStateTest { PdpUpdate msg = new PdpUpdate(); assertFalse(state.shouldHandle(msg)); - msg.setName(NetworkUtil.getHostname()); + msg.setName(XacmlState.PDP_NAME); assertTrue(state.shouldHandle(msg)); } @@ -94,7 +93,7 @@ public class XacmlStateTest { // not healthy PdpStatus status = state.genHeartbeat(); assertEquals(PdpHealthStatus.NOT_HEALTHY, status.getHealthy()); - assertEquals(hostName, status.getName()); + assertEquals(pdpName, status.getName()); assertEquals(GROUP, status.getPdpGroup()); assertEquals(PDP_TYPE, status.getPdpType()); assertEquals(PdpState.PASSIVE, status.getState()); @@ -110,7 +109,7 @@ public class XacmlStateTest { @Test public void testUpdateInternalStatePdpStateChange() { PdpStateChange req = new PdpStateChange(); - req.setName(hostName); + req.setName(pdpName); req.setPdpGroup("wrong-pdp-group"); req.setPdpSubgroup(SUBGROUP); req.setState(STATE); diff --git a/main/src/test/java/org/onap/policy/pdpx/main/rest/TestXacmlPdpRestServer.java b/main/src/test/java/org/onap/policy/pdpx/main/rest/TestXacmlPdpRestServer.java index 7865851d..a8a7b84d 100644 --- a/main/src/test/java/org/onap/policy/pdpx/main/rest/TestXacmlPdpRestServer.java +++ b/main/src/test/java/org/onap/policy/pdpx/main/rest/TestXacmlPdpRestServer.java @@ -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. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,6 +26,7 @@ import javax.ws.rs.client.Invocation; import org.junit.Test; import org.onap.policy.common.endpoints.report.HealthCheckReport; import org.onap.policy.pdpx.main.CommonRest; +import org.onap.policy.pdpx.main.XacmlState; import org.onap.policy.pdpx.main.rest.model.StatisticsReport; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -40,7 +41,7 @@ public class TestXacmlPdpRestServer extends CommonRest { private static final String NOT_ALIVE = "not alive"; private static final String ALIVE = "alive"; private static final String SELF = "self"; - private static final String NAME = "Policy Xacml PDP"; + private static final String NAME = XacmlState.PDP_NAME; private static final String HEALTHCHECK_ENDPOINT = "healthcheck"; private static final String STATISTICS_ENDPOINT = "statistics"; |