diff options
author | Jim Hahn <jrh3@att.com> | 2021-06-28 15:04:36 -0400 |
---|---|---|
committer | Jim Hahn <jrh3@att.com> | 2021-06-29 10:21:49 -0400 |
commit | 4d4547ee4b3a6be75cf2c01f3065b129fddcfd3b (patch) | |
tree | c98e2237ab5565ba4af267814fb484fbae14dd64 /feature-lifecycle/src/test/java/org | |
parent | d2b5424c17ef26d5e71b3014234cfd02f7854eca (diff) |
Use unique name in drools PdpMessages
Also modified distributed locking to use the unique name, in case the DB
is shared.
Issue-ID: POLICY-3410
Change-Id: I046a9ffdcb62f3d84d7d388a1e64bcf025fbbf75
Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'feature-lifecycle/src/test/java/org')
6 files changed, 17 insertions, 17 deletions
diff --git a/feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/LifecycleFsmTest.java b/feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/LifecycleFsmTest.java index 73d265c2..4479aa12 100644 --- a/feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/LifecycleFsmTest.java +++ b/feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/LifecycleFsmTest.java @@ -232,7 +232,7 @@ public class LifecycleFsmTest { assertEquals(fsm.getGroup(), status.getStatistics().getPdpGroupName()); assertEquals(fsm.getSubGroup(), status.getStatistics().getPdpSubGroupName()); - assertEquals(NetworkUtil.getHostname(), status.getStatistics().getPdpInstanceId()); + assertEquals(PolicyEngineConstants.PDP_NAME, status.getStatistics().getPdpInstanceId()); assertEquals(6, status.getStatistics().getPolicyDeploySuccessCount()); assertEquals(2, status.getStatistics().getPolicyDeployFailCount()); assertEquals(8, status.getStatistics().getPolicyDeployCount()); @@ -291,4 +291,4 @@ public class LifecycleFsmTest { return serviceTemplate.getToscaTopologyTemplate().getPolicies().get(0).get(policyName); } -}
\ No newline at end of file +} diff --git a/feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/LifecycleFsmUpdateTest.java b/feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/LifecycleFsmUpdateTest.java index 1927c513..253ca5db 100644 --- a/feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/LifecycleFsmUpdateTest.java +++ b/feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/LifecycleFsmUpdateTest.java @@ -46,7 +46,6 @@ import org.onap.policy.common.endpoints.event.comm.bus.NoopTopicFactories; import org.onap.policy.common.endpoints.properties.PolicyEndPointProperties; import org.onap.policy.common.utils.coder.CoderException; import org.onap.policy.common.utils.coder.StandardCoder; -import org.onap.policy.common.utils.network.NetworkUtil; import org.onap.policy.common.utils.resources.ResourceUtils; import org.onap.policy.common.utils.time.PseudoScheduledExecutorService; import org.onap.policy.common.utils.time.TestTimeMulti; @@ -54,6 +53,7 @@ import org.onap.policy.drools.domain.models.artifact.NativeArtifactPolicy; import org.onap.policy.drools.domain.models.controller.ControllerPolicy; import org.onap.policy.drools.persistence.SystemPersistenceConstants; import org.onap.policy.drools.system.PolicyControllerConstants; +import org.onap.policy.drools.system.PolicyEngineConstants; import org.onap.policy.drools.utils.logging.LoggerUtil; import org.onap.policy.models.pdp.concepts.PdpStateChange; import org.onap.policy.models.pdp.concepts.PdpUpdate; @@ -363,7 +363,7 @@ public class LifecycleFsmUpdateTest { protected PdpUpdate getPdpUpdate(List<ToscaPolicy> policiesToDeploy, List<ToscaPolicy> policiesToUndeploy) { PdpUpdate update = new PdpUpdate(); - update.setName(NetworkUtil.getHostname()); + update.setName(PolicyEngineConstants.PDP_NAME); update.setPdpGroup("A"); update.setPdpSubgroup("a"); update.setPoliciesToBeDeployed(policiesToDeploy); diff --git a/feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/LifecycleStateActivePoliciesTest.java b/feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/LifecycleStateActivePoliciesTest.java index b56d21fa..f37e8ef7 100644 --- a/feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/LifecycleStateActivePoliciesTest.java +++ b/feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/LifecycleStateActivePoliciesTest.java @@ -1,6 +1,6 @@ /* * ============LICENSE_START======================================================= - * Copyright (C) 2020 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved. * Modifications Copyright (C) 2021 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -40,7 +40,7 @@ import org.onap.policy.common.endpoints.event.comm.TopicEndpointManager; import org.onap.policy.common.endpoints.properties.PolicyEndPointProperties; import org.onap.policy.common.utils.coder.CoderException; import org.onap.policy.common.utils.coder.StandardCoder; -import org.onap.policy.common.utils.network.NetworkUtil; +import org.onap.policy.drools.system.PolicyEngineConstants; import org.onap.policy.models.pdp.concepts.PdpStateChange; import org.onap.policy.models.pdp.concepts.PdpUpdate; import org.onap.policy.models.pdp.enums.PdpState; @@ -116,7 +116,7 @@ public class LifecycleStateActivePoliciesTest extends LifecycleStateRunningTest getPolicyFromFile(EXAMPLE_NATIVE_DROOLS_POLICY_JSON, EXAMPLE_NATIVE_DROOLS_CONTROLLER_POLICY_NAME); PdpUpdate update = new PdpUpdate(); - update.setName(NetworkUtil.getHostname()); + update.setName(PolicyEngineConstants.PDP_NAME); update.setPdpGroup("W"); update.setPdpSubgroup("w"); update.setPoliciesToBeDeployed(List.of(policyNativeController)); diff --git a/feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/LifecycleStateActiveTest.java b/feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/LifecycleStateActiveTest.java index 2efaa496..f4c33140 100644 --- a/feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/LifecycleStateActiveTest.java +++ b/feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/LifecycleStateActiveTest.java @@ -40,7 +40,7 @@ import org.junit.Before; import org.junit.Test; import org.onap.policy.common.utils.coder.CoderException; import org.onap.policy.common.utils.coder.StandardCoder; -import org.onap.policy.common.utils.network.NetworkUtil; +import org.onap.policy.drools.system.PolicyEngineConstants; import org.onap.policy.models.pdp.concepts.PdpStateChange; import org.onap.policy.models.pdp.concepts.PdpStatus; import org.onap.policy.models.pdp.concepts.PdpUpdate; @@ -189,7 +189,7 @@ public class LifecycleStateActiveTest extends LifecycleStateRunningTest { // TODO: extract repeated similar assertion blocks into their own helper methods PdpUpdate update = new PdpUpdate(); - update.setName(NetworkUtil.getHostname()); + update.setName(PolicyEngineConstants.PDP_NAME); update.setPdpGroup("W"); update.setPdpSubgroup("w"); diff --git a/feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/LifecycleStatePassiveTest.java b/feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/LifecycleStatePassiveTest.java index 9c4c8ab5..d99f011d 100644 --- a/feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/LifecycleStatePassiveTest.java +++ b/feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/LifecycleStatePassiveTest.java @@ -35,7 +35,7 @@ import org.junit.Before; import org.junit.Test; import org.onap.policy.common.utils.coder.CoderException; import org.onap.policy.common.utils.coder.StandardCoder; -import org.onap.policy.common.utils.network.NetworkUtil; +import org.onap.policy.drools.system.PolicyEngineConstants; import org.onap.policy.models.pdp.concepts.PdpStateChange; import org.onap.policy.models.pdp.concepts.PdpStatus; import org.onap.policy.models.pdp.concepts.PdpUpdate; @@ -143,7 +143,7 @@ public class LifecycleStatePassiveTest extends LifecycleStateRunningTest { assertEquals(0, controllerSupport.getController().getDrools().factCount("junits")); PdpUpdate update = new PdpUpdate(); - update.setName(NetworkUtil.getHostname()); + update.setName(PolicyEngineConstants.PDP_NAME); update.setPdpGroup("Z"); update.setPdpSubgroup("z"); @@ -269,7 +269,7 @@ public class LifecycleStatePassiveTest extends LifecycleStateRunningTest { assertNull(fsm.getSubGroup()); PdpUpdate update = new PdpUpdate(); - update.setName(NetworkUtil.getHostname()); + update.setName(PolicyEngineConstants.PDP_NAME); update.setPdpGroup("A"); update.setPdpSubgroup("a"); @@ -330,7 +330,7 @@ public class LifecycleStatePassiveTest extends LifecycleStateRunningTest { assertEquals("foo", status.getPdpType()); assertEquals(PdpState.TERMINATED, status.getState()); assertEquals(PdpHealthStatus.HEALTHY, status.getHealthy()); - assertEquals(NetworkUtil.getHostname(), status.getName()); + assertEquals(PolicyEngineConstants.PDP_NAME, status.getName()); assertEquals(fsm.getName(), status.getName()); assertEquals(PdpMessageType.PDP_STATUS, status.getMessageName()); } diff --git a/feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/LifecycleStateTerminatedTest.java b/feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/LifecycleStateTerminatedTest.java index e17f43a2..cf6f451a 100644 --- a/feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/LifecycleStateTerminatedTest.java +++ b/feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/LifecycleStateTerminatedTest.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP * ================================================================================ - * Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2019-2021 AT&T Intellectual Property. All rights reserved. * Modifications Copyright (C) 2021 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -33,8 +33,8 @@ import java.util.Collections; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; -import org.onap.policy.common.utils.network.NetworkUtil; import org.onap.policy.drools.persistence.SystemPersistenceConstants; +import org.onap.policy.drools.system.PolicyEngineConstants; import org.onap.policy.drools.utils.logging.LoggerUtil; import org.onap.policy.models.pdp.concepts.PdpStateChange; import org.onap.policy.models.pdp.concepts.PdpUpdate; @@ -139,7 +139,7 @@ public class LifecycleStateTerminatedTest { @Test public void testUpdate() { PdpUpdate update = new PdpUpdate(); - update.setName(NetworkUtil.getHostname()); + update.setName(PolicyEngineConstants.PDP_NAME); update.setPdpGroup("A"); update.setPdpSubgroup("a"); update.setPoliciesToBeDeployed(Collections.emptyList()); @@ -190,4 +190,4 @@ public class LifecycleStateTerminatedTest { assertFalse(fsm.statusTask.isCancelled()); assertFalse(fsm.statusTask.isDone()); } -}
\ No newline at end of file +} |